Esempio n. 1
0
def test_eos_signtx_vote_proxy(client):
    transaction = {
        "expiration":
        "2018-07-14T10:43:28",
        "ref_block_num":
        6439,
        "ref_block_prefix":
        2995713264,
        "max_net_usage_words":
        0,
        "max_cpu_usage_ms":
        0,
        "delay_sec":
        0,
        "context_free_actions": [],
        "actions": [{
            "account":
            "eosio",
            "name":
            "voteproducer",
            "authorization": [{
                "actor": "miniminimini",
                "permission": "active"
            }],
            "data": {
                "account": "miniminimini",
                "proxy": "",
                "producers": []
            },
        }],
        "transaction_extensions": [],
    }

    with client:
        resp = eos.sign_tx(client, ADDRESS_N, transaction, CHAIN_ID)
        assert isinstance(resp, EosSignedTx)
        assert (
            resp.signature ==
            "SIG_K1_KjJzcDg9MT8XbLeP1fgQjdmdE6oNQQisMwbXikqrEZYmJe6GCYg89Wr2donYV6zRfg9h7dJKQDCHugdtsxjtmEdqLtPv25"
        )
    def test_eos_signtx_sellram(self, client):
        transaction = {
            "expiration":
            "2018-07-14T10:43:28",
            "ref_block_num":
            6439,
            "ref_block_prefix":
            2995713264,
            "max_net_usage_words":
            0,
            "max_cpu_usage_ms":
            0,
            "delay_sec":
            0,
            "context_free_actions": [],
            "actions": [{
                "account":
                "eosio",
                "name":
                "sellram",
                "authorization": [{
                    "actor": "miniminimini",
                    "permission": "active"
                }],
                "data": {
                    "account": "miniminimini",
                    "bytes": 1024
                },
            }],
            "transaction_extensions": [],
        }

        with client:
            client.set_input_flow(self.input_flow(client.debug, pages=2))
            resp = eos.sign_tx(client, ADDRESS_N, transaction, CHAIN_ID)
            assert isinstance(resp, EosSignedTx)
            assert (
                resp.signature ==
                "SIG_K1_JusrCS7H5DR53qke7edoWvJuLiQS2VQ84CsN5NWmWYVa7wmJVjh3Hcg5hH42zF8KjAmmvHtaJZ3wkortTW9eds1eoiKsrj"
            )
Esempio n. 3
0
def test_eos_signtx_buyram(client):
    transaction = {
        "expiration":
        "2018-07-14T10:43:28",
        "ref_block_num":
        6439,
        "ref_block_prefix":
        2995713264,
        "max_net_usage_words":
        0,
        "max_cpu_usage_ms":
        0,
        "delay_sec":
        0,
        "context_free_actions": [],
        "actions": [{
            "account":
            "eosio",
            "name":
            "buyram",
            "authorization": [{
                "actor": "miniminimini",
                "permission": "active"
            }],
            "data": {
                "payer": "miniminimini",
                "receiver": "miniminimini",
                "quant": "1000000000.0000 EOS",
            },
        }],
        "transaction_extensions": [],
    }

    with client:
        resp = eos.sign_tx(client, ADDRESS_N, transaction, CHAIN_ID)
        assert isinstance(resp, EosSignedTx)
        assert (
            resp.signature ==
            "SIG_K1_K4gU5S9g7rS6MojaPwWppEBCBbPrJm1pyJtVR9mts1sBq5xyN7nJv3FGnrBR7ByjanboCtK4ogY35sNPFX1F5qoZW7BkF9"
        )
Esempio n. 4
0
def test_eos_signtx_unlinkauth(client):
    transaction = {
        "expiration":
        "2018-07-14T10:43:28",
        "ref_block_num":
        6439,
        "ref_block_prefix":
        2995713264,
        "max_net_usage_words":
        0,
        "max_cpu_usage_ms":
        0,
        "delay_sec":
        0,
        "context_free_actions": [],
        "actions": [{
            "account":
            "eosio",
            "name":
            "unlinkauth",
            "authorization": [{
                "actor": "miniminimini",
                "permission": "active"
            }],
            "data": {
                "account": "miniminimini",
                "code": "eosbet",
                "type": "whatever",
            },
        }],
        "transaction_extensions": [],
    }

    with client:
        resp = eos.sign_tx(client, ADDRESS_N, transaction, CHAIN_ID)
        assert isinstance(resp, EosSignedTx)
        assert (
            resp.signature ==
            "SIG_K1_K1ioB5KMRC2mmTwYsGwsFU51ENp1XdSBUrb4bxUCLYhoq7Y733WaLZ4Soq9fdrkaJS8uJ3R7Z1ZjyEKRHU8HU4s4MA86zB"
        )
Esempio n. 5
0
def test_eos_signtx_buyrambytes(client):
    transaction = {
        "expiration":
        "2018-07-14T10:43:28",
        "ref_block_num":
        6439,
        "ref_block_prefix":
        2995713264,
        "max_net_usage_words":
        0,
        "max_cpu_usage_ms":
        0,
        "delay_sec":
        0,
        "context_free_actions": [],
        "actions": [{
            "account":
            "eosio",
            "name":
            "buyrambytes",
            "authorization": [{
                "actor": "miniminimini",
                "permission": "active"
            }],
            "data": {
                "payer": "miniminimini",
                "receiver": "miniminimini",
                "bytes": 1023,
            },
        }],
        "transaction_extensions": [],
    }

    with client:
        resp = eos.sign_tx(client, ADDRESS_N, transaction, CHAIN_ID)
        assert isinstance(resp, EosSignedTx)
        assert (
            resp.signature ==
            "SIG_K1_K618wK9f27YxHoPG9hoUCsazZXzxumBj3V9MqcTUh9yCocvP1uFZQAmGmZLhsAtuC2TRR4gtqbeQj57FniYd5i4faQCb6t"
        )
    def test_eos_signtx_deleteauth(self, client):
        transaction = {
            "expiration":
            "2018-07-14T10:43:28",
            "ref_block_num":
            6439,
            "ref_block_prefix":
            2995713264,
            "max_net_usage_words":
            0,
            "max_cpu_usage_ms":
            0,
            "delay_sec":
            0,
            "context_free_actions": [],
            "actions": [{
                "account":
                "eosio",
                "name":
                "deleteauth",
                "authorization": [{
                    "actor": "miniminimini",
                    "permission": "active"
                }],
                "data": {
                    "account": "maximaximaxi",
                    "permission": "active"
                },
            }],
            "transaction_extensions": [],
        }

        with client:
            client.set_input_flow(self.input_flow(client.debug, pages=0))
            resp = eos.sign_tx(client, ADDRESS_N, transaction, CHAIN_ID)
            assert isinstance(resp, EosSignedTx)
            assert (
                resp.signature ==
                "SIG_K1_KjPTp8jCtgBKQWqsndhrH4pdCGiks76Q1qBt9e8MtexW6FQg3FzfVFKDU4SvyVDyFs3worn6RyW6WYavw76ACNqcqkCYjf"
            )
Esempio n. 7
0
    def test_eos_signtx_refund(self):
        self.setup_mnemonic_nopin_nopassphrase()
        transaction = {
            "expiration":
            "2018-07-14T10:43:28",
            "ref_block_num":
            6439,
            "ref_block_prefix":
            2995713264,
            "max_net_usage_words":
            0,
            "max_cpu_usage_ms":
            0,
            "delay_sec":
            0,
            "context_free_actions": [],
            "actions": [{
                "account":
                "eosio",
                "name":
                "refund",
                "authorization": [{
                    "actor": "miniminimini",
                    "permission": "active"
                }],
                "data": {
                    "owner": "miniminimini"
                },
            }],
            "transaction_extensions": [],
        }

        with self.client:
            self.client.set_input_flow(self.input_flow(pages=2))
            resp = eos.sign_tx(self.client, ADDRESS_N, transaction, CHAIN_ID)
            assert isinstance(resp, EosSignedTx)
            assert (
                resp.signature ==
                "SIG_K1_JwWZSSKQZL1hCdMmwEAKjs3r15kau5gaBrQczKy65QANANzovV6U4XbVUZQkZzaQrNGYAtgxrU1WJ1smWgXZNqtKVQUZqc"
            )
Esempio n. 8
0
    def test_eos_signtx_unknown(self):
        self.setup_mnemonic_nopin_nopassphrase()
        transaction = {
            "expiration":
            "2018-07-14T10:43:28",
            "ref_block_num":
            6439,
            "ref_block_prefix":
            2995713264,
            "max_net_usage_words":
            0,
            "max_cpu_usage_ms":
            0,
            "delay_sec":
            0,
            "context_free_actions": [],
            "actions": [{
                "account":
                "foocontract",
                "name":
                "baraction",
                "authorization": [{
                    "actor": "miniminimini",
                    "permission": "active"
                }],
                "data":
                "deadbeef",
            }],
            "transaction_extensions": [],
        }

        with self.client:
            self.client.set_input_flow(self.input_flow(pages=2))
            resp = eos.sign_tx(self.client, ADDRESS_N, transaction, CHAIN_ID)
            assert isinstance(resp, EosSignedTx)
            assert (
                resp.signature ==
                "SIG_K1_JvoJtrHpQJjHAZzEBhiQm75iimYabcAVNDvz8mkempLh6avSJgnXm5JzCCUEBjDtW3syByfXknmgr93Sw3P9RNLnwySmv6"
            )
Esempio n. 9
0
    def test_eos_signtx_delegate(self):
        self.setup_mnemonic_nopin_nopassphrase()
        transaction = {
            "expiration": "2018-07-14T10:43:28",
            "ref_block_num": 6439,
            "ref_block_prefix": 2995713264,
            "max_net_usage_words": 0,
            "max_cpu_usage_ms": 0,
            "delay_sec": 0,
            "context_free_actions": [],
            "actions": [
                {
                    "account": "eosio",
                    "name": "delegatebw",
                    "authorization": [
                        {"actor": "miniminimini", "permission": "active"}
                    ],
                    "data": {
                        "sender": "miniminimini",
                        "receiver": "maximaximaxi",
                        "stake_net_quantity": "1.0000 EOS",
                        "stake_cpu_quantity": "1.0000 EOS",
                        "transfer": True,
                    },
                }
            ],
            "transaction_extensions": [],
        }

        with self.client:
            self.client.set_input_flow(self.input_flow(pages=3))
            resp = eos.sign_tx(self.client, ADDRESS_N, transaction, CHAIN_ID)
            assert isinstance(resp, EosSignedTx)
            assert (
                resp.signature
                == "SIG_K1_Juju8Wjzyn38nuvgS1KT3koKQLHxMMfqVHrp5jMjv4QLU2pUG6EbiJD7D1EHE6xP8DRuwFLVUNR38nTyUKC1Eiz33WocUE"
            )
Esempio n. 10
0
    def test_eos_signtx_undelegate(self):
        self.setup_mnemonic_nopin_nopassphrase()
        transaction = {
            "expiration": "2018-07-14T10:43:28",
            "ref_block_num": 6439,
            "ref_block_prefix": 2995713264,
            "max_net_usage_words": 0,
            "max_cpu_usage_ms": 0,
            "delay_sec": 0,
            "context_free_actions": [],
            "actions": [
                {
                    "account": "eosio",
                    "name": "undelegatebw",
                    "authorization": [
                        {"actor": "miniminimini", "permission": "active"}
                    ],
                    "data": {
                        "sender": "miniminimini",
                        "receiver": "maximaximaxi",
                        "unstake_net_quantity": "1.0000 EOS",
                        "unstake_cpu_quantity": "1.0000 EOS",
                    },
                }
            ],
            "transaction_extensions": [],
        }

        with self.client:
            self.client.set_input_flow(self.input_flow(pages=2))
            resp = eos.sign_tx(self.client, ADDRESS_N, transaction, CHAIN_ID)
            assert isinstance(resp, EosSignedTx)
            assert (
                resp.signature
                == "SIG_K1_K3XXUzCUkT2HEdrJTz1CdDDKZbLMShmyEjknQozGhy4F21yUetr1nEe2vUgmGebk2nyYe49R5nkA155J5yFBBaLsTcSdBL"
            )
Esempio n. 11
0
    def test_eos_signtx_transfer_token(self):
        self.setup_mnemonic_nopin_nopassphrase()
        transaction = {
            "expiration": "2018-07-14T10:43:28",
            "ref_block_num": 6439,
            "ref_block_prefix": 2995713264,
            "max_net_usage_words": 0,
            "max_cpu_usage_ms": 0,
            "delay_sec": 0,
            "context_free_actions": [],
            "actions": [
                {
                    "account": "eosio.token",
                    "name": "transfer",
                    "authorization": [
                        {"actor": "miniminimini", "permission": "active"}
                    ],
                    "data": {
                        "from": "miniminimini",
                        "to": "maximaximaxi",
                        "quantity": "1.0000 EOS",
                        "memo": "testtest",
                    },
                }
            ],
            "transaction_extensions": [],
        }

        with self.client:
            self.client.set_input_flow(self.input_flow(pages=3))
            resp = eos.sign_tx(self.client, ADDRESS_N, transaction, CHAIN_ID)
            assert isinstance(resp, EosSignedTx)
            assert (
                resp.signature
                == "SIG_K1_JveDuew7oyKjgLmApra3NmKArx3QH6HVmatgkLYeUYWv7aGaoQPFyjBwAdcxuo2Skq9wRgsizos92h9iq9i5JbeHh7zNuo"
            )
Esempio n. 12
0
    def test_eos_signtx_linkauth(self):
        self.setup_mnemonic_nopin_nopassphrase()
        transaction = {
            "expiration": "2018-07-14T10:43:28",
            "ref_block_num": 6439,
            "ref_block_prefix": 2995713264,
            "max_net_usage_words": 0,
            "max_cpu_usage_ms": 0,
            "delay_sec": 0,
            "context_free_actions": [],
            "actions": [
                {
                    "account": "eosio",
                    "name": "linkauth",
                    "authorization": [
                        {"actor": "miniminimini", "permission": "active"}
                    ],
                    "data": {
                        "account": "maximaximaxi",
                        "code": "eosbet",
                        "type": "whatever",
                        "requirement": "active",
                    },
                }
            ],
            "transaction_extensions": [],
        }

        with self.client:
            self.client.set_input_flow(self.input_flow(pages=2))
            resp = eos.sign_tx(self.client, ADDRESS_N, transaction, CHAIN_ID)
            assert isinstance(resp, EosSignedTx)
            assert (
                resp.signature
                == "SIG_K1_Kgs3JdLNqTyGz7uyNiuYLK8sy5qhVQWozrBY7bJWKsjrWAxNyDQUKqHsHmTom5rGY21vYdXmCpi4msU6XeMgWvi4bsBxTx"
            )
    def test_eos_signtx_setcontract(self, client):
        transaction = {
            "expiration":
            "2018-06-19T13:29:53",
            "ref_block_num":
            30587,
            "ref_block_prefix":
            338239089,
            "max_net_usage_words":
            0,
            "max_cpu_usage_ms":
            0,
            "delay_sec":
            0,
            "context_free_actions": [],
            "actions": [
                {
                    "account":
                    "eosio1",
                    "name":
                    "setcode",
                    "authorization": [{
                        "actor": "ednazztokens",
                        "permission": "active"
                    }],
                    "data":
                    "00" * 1024,
                },
                {
                    "account":
                    "eosio1",
                    "name":
                    "setabi",
                    "authorization": [{
                        "actor": "ednazztokens",
                        "permission": "active"
                    }],
                    "data":
                    "00" * 1024,
                },
            ],
            "transaction_extensions": [],
            "context_free_data": [],
        }

        def input_flow():
            # confirm number of actions
            yield
            client.debug.press_yes()

            # swipe through setcode
            yield
            client.debug.swipe_down()

            # confirm setcode
            client.debug.press_yes()

            # swipe through setabi
            yield
            client.debug.swipe_down()

            # confirm setabi
            client.debug.press_yes()

        with client:
            client.set_input_flow(input_flow)
            resp = eos.sign_tx(client, ADDRESS_N, transaction, CHAIN_ID)
            assert isinstance(resp, EosSignedTx)
            assert (
                resp.signature ==
                "SIG_K1_KiG8c8t2SQkSfrEbD9BwJoYT133BPFLx3gu8sAzJadXyFk1EXKYAsgx4tkjt79G6ofuaQzJPAfDqy1FSpgLRbhbeFH9omd"
            )
    def test_eos_signtx_vote(self, client):
        transaction = {
            "expiration":
            "2018-07-14T10:43:28",
            "ref_block_num":
            6439,
            "ref_block_prefix":
            2995713264,
            "max_net_usage_words":
            0,
            "max_cpu_usage_ms":
            0,
            "delay_sec":
            0,
            "context_free_actions": [],
            "actions": [{
                "account":
                "eosio",
                "name":
                "voteproducer",
                "authorization": [{
                    "actor": "miniminimini",
                    "permission": "active"
                }],
                "data": {
                    "account":
                    "miniminimini",
                    "proxy":
                    "",
                    "producers": [
                        "argentinaeos",
                        "bitfinexeos1",
                        "cryptolions1",
                        "eos42freedom",
                        "eosamsterdam",
                        "eosasia11111",
                        "eosauthority",
                        "eosbeijingbp",
                        "eosbixinboot",
                        "eoscafeblock",
                        "eoscanadacom",
                        "eoscannonchn",
                        "eoscleanerbp",
                        "eosdacserver",
                        "eosfishrocks",
                        "eosflytomars",
                        "eoshuobipool",
                        "eosisgravity",
                        "eoslaomaocom",
                        "eosliquideos",
                        "eosnewyorkio",
                        "eosriobrazil",
                        "eosswedenorg",
                        "eostribeprod",
                        "helloeoscnbp",
                        "jedaaaaaaaaa",
                        "libertyblock",
                        "starteosiobp",
                        "teamgreymass",
                    ],
                },
            }],
            "transaction_extensions": [],
        }

        with client:
            client.set_input_flow(self.input_flow(client.debug, pages=6))
            resp = eos.sign_tx(client, ADDRESS_N, transaction, CHAIN_ID)
            assert isinstance(resp, EosSignedTx)
            assert (
                resp.signature ==
                "SIG_K1_JxgVhc6ExoTHee3Djrciwmmf2Xck7NLgvAtC2gfgV4Wj2AqMXEb6aKMhpUcTV59VTR1DdnPF1XbiCcJViJiU3zsk1kQz89"
            )
    def test_eos_signtx_newaccount(self, client):
        transaction = {
            "expiration":
            "2018-07-14T10:43:28",
            "ref_block_num":
            6439,
            "ref_block_prefix":
            2995713264,
            "max_net_usage_words":
            0,
            "max_cpu_usage_ms":
            0,
            "delay_sec":
            0,
            "context_free_actions": [],
            "actions": [
                {
                    "account":
                    "eosio",
                    "name":
                    "newaccount",
                    "authorization": [{
                        "actor": "miniminimini",
                        "permission": "active"
                    }],
                    "data": {
                        "creator": "miniminimini",
                        "name": "maximaximaxi",
                        "owner": {
                            "threshold":
                            1,
                            "keys": [{
                                "key":
                                "EOS8Dkj827FpinZBGmhTM28B85H9eXiFH5XzvLoeukCJV5sKfLc6K",
                                "weight": 1,
                            }],
                            "accounts": [],
                            "waits": [],
                        },
                        "active": {
                            "threshold":
                            1,
                            "keys": [{
                                "key":
                                "EOS8Dkj827FpinZBGmhTM28B85H9eXiFH5XzvLoeukCJV5sKfLc6K",
                                "weight": 1,
                            }],
                            "accounts": [],
                            "waits": [],
                        },
                    },
                },
                {
                    "account":
                    "eosio",
                    "name":
                    "buyrambytes",
                    "authorization": [{
                        "actor": "miniminimini",
                        "permission": "active"
                    }],
                    "data": {
                        "payer": "miniminimini",
                        "receiver": "maximaximaxi",
                        "bytes": 4096,
                    },
                },
                {
                    "account":
                    "eosio",
                    "name":
                    "delegatebw",
                    "authorization": [{
                        "actor": "miniminimini",
                        "permission": "active"
                    }],
                    "data": {
                        "sender": "miniminimini",
                        "receiver": "maximaximaxi",
                        "stake_net_quantity": "1.0000 EOS",
                        "stake_cpu_quantity": "1.0000 EOS",
                        "transfer": True,
                    },
                },
            ],
            "transaction_extensions": [],
        }

        def input_flow():
            # confirm number of actions
            yield
            client.debug.press_yes()

            # swipe through new account
            yield
            for _ in range(5):
                client.debug.swipe_down()

            # confirm new account
            client.debug.press_yes()

            # swipe through buyrambytes
            yield
            client.debug.swipe_down()

            # confirm buyrambytes
            client.debug.press_yes()

            # swipe through delegatebw
            yield
            for _ in range(2):
                client.debug.swipe_down()

            # confirm delegatebw
            client.debug.press_yes()

        with client:
            client.set_input_flow(input_flow)
            resp = eos.sign_tx(client, ADDRESS_N, transaction, CHAIN_ID)
            assert isinstance(resp, EosSignedTx)
            assert (
                resp.signature ==
                "SIG_K1_KhjdS1gKUHR4jKbN3YSdNbPbEqnUVM1Nt6ybdzEAwsUtfbCRJDwpQwPRuEau48CyvhYC5fKo5BiWMPQJbQPrg5ErHThieU"
            )
    def test_eos_signtx_updateauth(self, client):
        transaction = {
            "expiration":
            "2018-07-14T10:43:28",
            "ref_block_num":
            6439,
            "ref_block_prefix":
            2995713264,
            "max_net_usage_words":
            0,
            "max_cpu_usage_ms":
            0,
            "delay_sec":
            0,
            "context_free_actions": [],
            "actions": [{
                "account":
                "eosio",
                "name":
                "updateauth",
                "authorization": [{
                    "actor": "miniminimini",
                    "permission": "active"
                }],
                "data": {
                    "account": "miniminimini",
                    "permission": "active",
                    "parent": "owner",
                    "auth": {
                        "threshold":
                        1,
                        "keys": [
                            {
                                "key":
                                "EOS8Dkj827FpinZBGmhTM28B85H9eXiFH5XzvLoeukCJV5sKfLc6K",
                                "weight": 1,
                            },
                            {
                                "key":
                                "EOS8Dkj827FpinZBGmhTM28B85H9eXiFH5XzvLoeukCJV5sKfLc6K",
                                "weight": 2,
                            },
                        ],
                        "accounts": [{
                            "permission": {
                                "actor": "miniminimini",
                                "permission": "active",
                            },
                            "weight": 3,
                        }],
                        "waits": [{
                            "wait_sec": 55,
                            "weight": 4
                        }],
                    },
                },
            }],
            "transaction_extensions": [],
        }

        with client:
            client.set_input_flow(self.input_flow(client.debug, pages=8))
            resp = eos.sign_tx(client, ADDRESS_N, transaction, CHAIN_ID)
            assert isinstance(resp, EosSignedTx)
            assert (
                resp.signature ==
                "SIG_K1_JuNuwmJm7nLfpxbCqXZMxZoU56TzBh8F5PH7ZyPvQMti6QxJbErDGbKCAaHhoRxwWKzv5kj6kX3WyWys6jAzVe9pDhXB1k"
            )
Esempio n. 17
0
    def test_eos_signtx_setcontract(self):
        self.setup_mnemonic_nopin_nopassphrase()
        transaction = {
            "expiration":
            "2018-06-19T13:29:53",
            "ref_block_num":
            30587,
            "ref_block_prefix":
            338239089,
            "net_usage_words":
            0,
            "max_cpu_usage_ms":
            0,
            "delay_sec":
            0,
            "context_free_actions": [],
            "actions": [
                {
                    "account":
                    "eosio1",
                    "name":
                    "setcode",
                    "authorization": [{
                        "actor": "ednazztokens",
                        "permission": "active"
                    }],
                    "data":
                    "00" * 1024,
                },
                {
                    "account":
                    "eosio1",
                    "name":
                    "setabi",
                    "authorization": [{
                        "actor": "ednazztokens",
                        "permission": "active"
                    }],
                    "data":
                    "00" * 1024,
                },
            ],
            "transaction_extensions": [],
            "context_free_data": [],
        }

        def input_flow():
            # confirm number of actions
            yield
            self.client.debug.press_yes()

            # swipe through setcode
            yield
            self.client.debug.swipe_down()
            time.sleep(1)

            # confirm setcode
            self.client.debug.press_yes()

            # swipe through setabi
            yield
            self.client.debug.swipe_down()
            time.sleep(1)

            # confirm setabi
            self.client.debug.press_yes()

        with self.client:
            self.client.set_input_flow(input_flow)
            resp = eos.sign_tx(self.client, ADDRESS_N, transaction, CHAIN_ID)

            assert isinstance(resp, EosSignedTx)
            assert (
                resp.signature_r.hex() ==
                "674bbe7c8c7b9abf03ab38851cb53411e794afff04737895962643b1ed94b7d1"
            )
            assert (
                resp.signature_s.hex() ==
                "1e47559db68d435494e832a16cc08ae7a67b533013ab3407f7a89d5e28de98b7"
            )
            assert resp.signature_v == 32
Esempio n. 18
0
    def test_eos_signtx_newaccount(self):
        self.setup_mnemonic_nopin_nopassphrase()
        transaction = {
            "expiration":
            "2018-07-14T10:43:28",
            "ref_block_num":
            6439,
            "ref_block_prefix":
            2995713264,
            "net_usage_words":
            0,
            "max_cpu_usage_ms":
            0,
            "delay_sec":
            0,
            "context_free_actions": [],
            "actions": [
                {
                    "account":
                    "eosio",
                    "name":
                    "newaccount",
                    "authorization": [{
                        "actor": "miniminimini",
                        "permission": "active"
                    }],
                    "data": {
                        "creator": "miniminimini",
                        "name": "maximaximaxi",
                        "owner": {
                            "threshold":
                            1,
                            "keys": [{
                                "key":
                                "EOS8Dkj827FpinZBGmhTM28B85H9eXiFH5XzvLoeukCJV5sKfLc6K",
                                "weight": 1,
                            }],
                            "accounts": [],
                            "waits": [],
                        },
                        "active": {
                            "threshold":
                            1,
                            "keys": [{
                                "key":
                                "EOS8Dkj827FpinZBGmhTM28B85H9eXiFH5XzvLoeukCJV5sKfLc6K",
                                "weight": 1,
                            }],
                            "accounts": [],
                            "waits": [],
                        },
                    },
                },
                {
                    "account":
                    "eosio",
                    "name":
                    "buyrambytes",
                    "authorization": [{
                        "actor": "miniminimini",
                        "permission": "active"
                    }],
                    "data": {
                        "payer": "miniminimini",
                        "receiver": "maximaximaxi",
                        "bytes": 4096,
                    },
                },
                {
                    "account":
                    "eosio",
                    "name":
                    "delegatebw",
                    "authorization": [{
                        "actor": "miniminimini",
                        "permission": "active"
                    }],
                    "data": {
                        "sender": "miniminimini",
                        "receiver": "maximaximaxi",
                        "stake_net_quantity": "1.0000 EOS",
                        "stake_cpu_quantity": "1.0000 EOS",
                        "transfer": True,
                    },
                },
            ],
            "transaction_extensions": [],
        }

        def input_flow():
            # confirm number of actions
            yield
            self.client.debug.press_yes()

            # swipe through new account
            yield
            for _ in range(5):
                self.client.debug.swipe_down()
                time.sleep(1)

            # confirm new account
            self.client.debug.press_yes()

            # swipe through buyrambytes
            yield
            self.client.debug.swipe_down()
            time.sleep(1)

            # confirm buyrambytes
            self.client.debug.press_yes()

            # swipe through delegatebw
            yield
            for _ in range(2):
                self.client.debug.swipe_down()
                time.sleep(1)

            # confirm delegatebw
            self.client.debug.press_yes()

        with self.client:
            self.client.set_input_flow(input_flow)
            resp = eos.sign_tx(self.client, ADDRESS_N, transaction, CHAIN_ID)

            assert isinstance(resp, EosSignedTx)
            assert (
                resp.signature_r.hex() ==
                "6346a807eef0257a34269b034df7470e134261833d0da5fe0bd91aedf5a47f86"
            )
            assert (
                resp.signature_s.hex() ==
                "676a1fcd0d8faff63ec206c8596de9cb5d35037d05f337afdc22c7b9e0863e77"
            )
            assert resp.signature_v == 32
Esempio n. 19
0
    def test_eos_signtx_vote(self):
        self.setup_mnemonic_nopin_nopassphrase()
        transaction = {
            "expiration":
            "2018-07-14T10:43:28",
            "ref_block_num":
            6439,
            "ref_block_prefix":
            2995713264,
            "net_usage_words":
            0,
            "max_cpu_usage_ms":
            0,
            "delay_sec":
            0,
            "context_free_actions": [],
            "actions": [{
                "account":
                "eosio",
                "name":
                "voteproducer",
                "authorization": [{
                    "actor": "miniminimini",
                    "permission": "active"
                }],
                "data": {
                    "account":
                    "miniminimini",
                    "proxy":
                    "",
                    "producers": [
                        "argentinaeos",
                        "bitfinexeos1",
                        "cryptolions1",
                        "eos42freedom",
                        "eosamsterdam",
                        "eosasia11111",
                        "eosauthority",
                        "eosbeijingbp",
                        "eosbixinboot",
                        "eoscafeblock",
                        "eoscanadacom",
                        "eoscannonchn",
                        "eoscleanerbp",
                        "eosdacserver",
                        "eosfishrocks",
                        "eosflytomars",
                        "eoshuobipool",
                        "eosisgravity",
                        "eoslaomaocom",
                        "eosliquideos",
                        "eosnewyorkio",
                        "eosriobrazil",
                        "eosswedenorg",
                        "eostribeprod",
                        "helloeoscnbp",
                        "jedaaaaaaaaa",
                        "libertyblock",
                        "starteosiobp",
                        "teamgreymass",
                    ],
                },
            }],
            "transaction_extensions": [],
        }

        with self.client:
            self.client.set_input_flow(self.input_flow(pages=6))
            resp = eos.sign_tx(self.client, ADDRESS_N, transaction, CHAIN_ID)

            assert isinstance(resp, EosSignedTx)
            assert (
                resp.signature_r.hex() ==
                "1a303dcb27d2d17bc9efc89b10c41d9d78f7e3d671e3475bb1115b988f918770"
            )
            assert (
                resp.signature_s.hex() ==
                "07869385bf3af8cf0a4ee9daf4f8dd122650c7d59da48d6d9ce1e26b59753324"
            )
            assert resp.signature_v == 31
Esempio n. 20
0
    def test_eos_signtx_updateauth(self):
        self.setup_mnemonic_nopin_nopassphrase()
        transaction = {
            "expiration":
            "2018-07-14T10:43:28",
            "ref_block_num":
            6439,
            "ref_block_prefix":
            2995713264,
            "net_usage_words":
            0,
            "max_cpu_usage_ms":
            0,
            "delay_sec":
            0,
            "context_free_actions": [],
            "actions": [{
                "account":
                "eosio",
                "name":
                "updateauth",
                "authorization": [{
                    "actor": "miniminimini",
                    "permission": "active"
                }],
                "data": {
                    "account": "miniminimini",
                    "permission": "active",
                    "parent": "owner",
                    "auth": {
                        "threshold":
                        1,
                        "keys": [
                            {
                                "key":
                                "EOS8Dkj827FpinZBGmhTM28B85H9eXiFH5XzvLoeukCJV5sKfLc6K",
                                "weight": 1,
                            },
                            {
                                "key":
                                "EOS8Dkj827FpinZBGmhTM28B85H9eXiFH5XzvLoeukCJV5sKfLc6K",
                                "weight": 2,
                            },
                        ],
                        "accounts": [{
                            "permission": {
                                "actor": "miniminimini",
                                "permission": "active",
                            },
                            "weight": 3,
                        }],
                        "waits": [{
                            "wait_sec": 55,
                            "weight": 4
                        }],
                    },
                },
            }],
            "transaction_extensions": [],
        }

        with self.client:
            self.client.set_input_flow(self.input_flow(pages=8))
            resp = eos.sign_tx(self.client, ADDRESS_N, transaction, CHAIN_ID)

            assert isinstance(resp, EosSignedTx)
            assert (
                resp.signature_r.hex() ==
                "00f0ca8ffa8208e72df509a3b356e77056b234d4db167b58d485f30cb9c61841"
            )
            assert (
                resp.signature_s.hex() ==
                "3f6fb40ffa4e1cf6f3bcb0d8fa3873a2b5a05384ca9251159968558688a4e43d"
            )
            assert resp.signature_v == 31