Пример #1
0
    def test_lisk_sign_tx_send_with_data(self):
        self.setup_mnemonic_allallall()

        with self.client:
            self.client.set_expected_responses(
                [
                    proto.ButtonRequest(code=proto.ButtonRequestType.SignTx),
                    proto.ButtonRequest(code=proto.ButtonRequestType.ConfirmOutput),
                    proto.LiskSignedTx(
                        signature=bytes.fromhex(
                            "4e83a651e82f2f787a71a5f44a2911dd0429ee4001b80c79fb7d174ea63ceeefdfba55aa3a9f31fa14b8325a39ad973dcd7eadbaa77b0447a9893f84b60f210e"
                        )
                    ),
                ]
            )

            lisk.sign_tx(
                self.client,
                parse_path("m/44'/134'/0'"),
                {
                    "amount": "10000000",
                    "recipientId": "9971262264659915921L",
                    "timestamp": 57525937,
                    "type": 0,
                    "fee": "20000000",
                    "asset": {"data": "Test data"},
                },
            )
Пример #2
0
    def test_lisk_sign_tx_send(self):
        self.setup_mnemonic_allallall()

        with self.client:
            self.client.set_expected_responses(
                [
                    proto.ButtonRequest(code=proto.ButtonRequestType.SignTx),
                    proto.ButtonRequest(code=proto.ButtonRequestType.ConfirmOutput),
                    proto.LiskSignedTx(
                        signature=bytes.fromhex(
                            "f48532d43e8c5abadf50bb7b82098b31eec3e67747e5328c0675203e86441899c246fa3aea6fc91043209431ce710c5aa34aa234546b85b88299d5a379bff202"
                        )
                    ),
                ]
            )

            lisk.sign_tx(
                self.client,
                parse_path("m/44'/134'/0'"),
                {
                    "amount": "10000000",
                    "recipientId": "9971262264659915921L",
                    "timestamp": 57525937,
                    "type": 0,
                    "fee": "10000000",
                    "asset": {},
                },
            )
Пример #3
0
    def test_lisk_sign_tx_send_wrong_path(self):
        self.setup_mnemonic_allallall()

        with self.client:
            self.client.set_expected_responses(
                [
                    proto.ButtonRequest(
                        code=proto.ButtonRequestType.UnknownDerivationPath
                    ),
                    proto.ButtonRequest(code=proto.ButtonRequestType.SignTx),
                    proto.ButtonRequest(code=proto.ButtonRequestType.ConfirmOutput),
                    proto.LiskSignedTx(
                        signature=bytes.fromhex(
                            "cdce9eba2ea8fa75f90fbc725f0d9de6152c7189a3044ab2fe307d9ff54754856e09125d7a15376eaf4bb5451b63881821948222ccd9ffb5da4d9b1aa8bd4904"
                        )
                    ),
                ]
            )

            lisk.sign_tx(
                self.client,
                parse_path("m/44'/134'/123456'/123456'/123456'/123456'/123456'"),
                {
                    "amount": "10000000",
                    "recipientId": "9971262264659915921L",
                    "timestamp": 57525937,
                    "type": 0,
                    "fee": "10000000",
                    "asset": {},
                },
            )
Пример #4
0
    def test_lisk_sign_tx_delegate_registration(self):
        self.setup_mnemonic_allallall()

        with self.client:
            self.client.set_expected_responses(
                [
                    proto.ButtonRequest(code=proto.ButtonRequestType.SignTx),
                    proto.ButtonRequest(code=proto.ButtonRequestType.ConfirmOutput),
                    proto.LiskSignedTx(
                        signature=bytes.fromhex(
                            "e9f68b9961198f4e0d33d6ae95cbd90ab243c2c1f9fcc51db54eb54cc1491db53d237131e12da9485bfbfbd02255c431d08095076f926060c434edb01cf25807"
                        )
                    ),
                ]
            )

            lisk.sign_tx(
                self.client,
                parse_path("m/44'/134'/0'"),
                {
                    "amount": "0",
                    "timestamp": 57525937,
                    "type": 2,
                    "fee": "2500000000",
                    "asset": {"delegate": {"username": "******"}},
                },
            )
Пример #5
0
    def test_lisk_sign_tx_cast_votes(self):
        self.setup_mnemonic_allallall()

        with self.client:
            self.client.set_expected_responses(
                [
                    proto.ButtonRequest(code=proto.ButtonRequestType.SignTx),
                    proto.ButtonRequest(code=proto.ButtonRequestType.ConfirmOutput),
                    proto.LiskSignedTx(
                        signature=bytes.fromhex(
                            "18d7cb27276a83178427aab2abcb5ee1c8ae9e8e2d1231585dcae7a83dd7d5167eea5baca890169bc80dcaf187320cab47c2f65a20c6483fede0f059919e4106"
                        )
                    ),
                ]
            )

            lisk.sign_tx(
                self.client,
                parse_path("m/44'/134'/0'"),
                {
                    "amount": "0",
                    "timestamp": 57525937,
                    "type": 3,
                    "fee": "100000000",
                    "asset": {
                        "votes": [
                            "+b002f58531c074c7190714523eec08c48db8c7cfc0c943097db1a2e82ed87f84",
                            "-ec111c8ad482445cfe83d811a7edd1f1d2765079c99d7d958cca1354740b7614",
                        ]
                    },
                },
            )
    def test_lisk_sign_tx_multisignature(self):
        self.setup_mnemonic_nopin_nopassphrase()

        with self.client:
            self.client.set_expected_responses([
                proto.ButtonRequest(code=proto.ButtonRequestType.SignTx),
                proto.ButtonRequest(code=proto.ButtonRequestType.ConfirmOutput),
                proto.LiskSignedTx(
                    signature=unhexlify('88923866c2d500a6927715699ab41a0f58ea4b52e552d90e923bc24ac9da240f2328c93f9ce043a1da4937d4b61c7f57c02fc931f9824d06b24731e7be23c506')
                )
            ])

            self.client.lisk_sign_tx(self.client.expand_path("m/44'/134'/0'/0'"), {
                "amount": "0",
                "timestamp": 57525937,
                "type": 4,
                "fee": "1500000000",
                "asset": {
                    "multisignature": {
                        "min": 2,
                        "lifetime": 5,
                        "keysgroup": [
                            "+5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09",
                            "+922fbfdd596fa78269bbcadc67ec2a1cc15fc929a19c462169568d7a3df1a1aa"
                        ]
                    }
                }
            })
Пример #7
0
    def test_lisk_sign_tx_second_signature(self):
        self.setup_mnemonic_allallall()

        with self.client:
            self.client.set_expected_responses(
                [
                    proto.ButtonRequest(code=proto.ButtonRequestType.PublicKey),
                    proto.ButtonRequest(code=proto.ButtonRequestType.ConfirmOutput),
                    proto.LiskSignedTx(
                        signature=bytes.fromhex(
                            "e27d8997d0bdbc9ab4ad928fcf140edb25a217007987447270085c0872e4178c018847d1378a949ad2aa913692f10aeec340810fd9de02da9d4461c63b6b6c06"
                        )
                    ),
                ]
            )

            lisk.sign_tx(
                self.client,
                parse_path("m/44'/134'/0'"),
                {
                    "amount": "0",
                    "timestamp": 57525937,
                    "type": 1,
                    "fee": "500000000",
                    "asset": {
                        "signature": {
                            "publicKey": "5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09"
                        }
                    },
                },
            )
    def test_lisk_sign_tx_multisignature(self, client):
        with client:
            client.set_expected_responses([
                proto.ButtonRequest(code=proto.ButtonRequestType.SignTx),
                proto.ButtonRequest(
                    code=proto.ButtonRequestType.ConfirmOutput),
                proto.LiskSignedTx(signature=bytes.fromhex(
                    "b84438ae3d419d270eacd0414fc8818d8f2c721602be54c3d705cf4cb3305de44e674f6dac9aac87379cce006cc97f2f635f296a48ab6a6adf62e2c11e08e409"
                )),
            ])

            lisk.sign_tx(
                client,
                parse_path("m/44'/134'/0'"),
                {
                    "amount": "0",
                    "timestamp": 57525937,
                    "type": 4,
                    "fee": "1500000000",
                    "asset": {
                        "multisignature": {
                            "min":
                            2,
                            "lifetime":
                            5,
                            "keysgroup": [
                                "+5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09",
                                "+922fbfdd596fa78269bbcadc67ec2a1cc15fc929a19c462169568d7a3df1a1aa",
                            ],
                        }
                    },
                },
            )
    def test_lisk_sign_tx_second_signature(self):
        self.setup_mnemonic_nopin_nopassphrase()

        with self.client:
            self.client.set_expected_responses([
                proto.ButtonRequest(code=proto.ButtonRequestType.PublicKey),
                proto.ButtonRequest(
                    code=proto.ButtonRequestType.ConfirmOutput),
                proto.LiskSignedTx(signature=unhexlify(
                    'f02bdc40a7599c21d29db4080ff1ff8934f76eedf5b0c4fa695c8a64af2f0b40a5c4f92db203863eebbbfad8f0611a23f451ed8bb711490234cdfb034728fd01'
                ))
            ])

            self.client.lisk_sign_tx(
                self.client.expand_path("m/44'/134'/0'/0'"), {
                    "amount": "0",
                    "timestamp": 57525937,
                    "type": 1,
                    "fee": "500000000",
                    "asset": {
                        "signature": {
                            "publicKey":
                            "5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09"
                        }
                    }
                })
    def test_lisk_sign_tx_cast_votes(self):
        self.setup_mnemonic_nopin_nopassphrase()

        with self.client:
            self.client.set_expected_responses([
                proto.ButtonRequest(code=proto.ButtonRequestType.SignTx),
                proto.ButtonRequest(
                    code=proto.ButtonRequestType.ConfirmOutput),
                proto.LiskSignedTx(signature=unhexlify(
                    '1d0599a8387edaa4a6d309b8a78accd1ceaff20ff9d87136b01cba0efbcb9781c13dc2b0bab5a1ea4f196d8dcc9dbdbd2d56dbffcc088fc77686b2e2c2fe560f'
                ))
            ])

            self.client.lisk_sign_tx(
                self.client.expand_path("m/44'/134'/0'/0'"), {
                    "amount": "0",
                    "timestamp": 57525937,
                    "type": 3,
                    "fee": "100000000",
                    "asset": {
                        "votes": [
                            "+b002f58531c074c7190714523eec08c48db8c7cfc0c943097db1a2e82ed87f84",
                            "-ec111c8ad482445cfe83d811a7edd1f1d2765079c99d7d958cca1354740b7614"
                        ]
                    }
                })
    def test_lisk_sign_tx_delegate_registration(self):
        self.setup_mnemonic_nopin_nopassphrase()

        with self.client:
            self.client.set_expected_responses([
                proto.ButtonRequest(code=proto.ButtonRequestType.SignTx),
                proto.ButtonRequest(
                    code=proto.ButtonRequestType.ConfirmOutput),
                proto.LiskSignedTx(signature=unhexlify(
                    '5ac02b2882b9d7d0f944e48baadc27de1296cc08c3533f7c8e380fbbb9fb4a6ac81b5dc57060d7d8c68912eea24eb6e39024801bccc0d55020e2052b0c2bb701'
                ))
            ])

            self.client.lisk_sign_tx(
                self.client.expand_path("m/44'/134'/0'/0'"), {
                    "amount": "0",
                    "timestamp": 57525937,
                    "type": 2,
                    "fee": "2500000000",
                    "asset": {
                        "delegate": {
                            "username": "******"
                        }
                    }
                })
Пример #12
0
    def test_lisk_sign_tx_send_wrong_path(self):
        self.setup_mnemonic_allallall()

        with self.client:
            self.client.set_expected_responses([
                proto.ButtonRequest(
                    code=proto.ButtonRequestType.UnknownDerivationPath),
                proto.ButtonRequest(code=proto.ButtonRequestType.SignTx),
                proto.ButtonRequest(
                    code=proto.ButtonRequestType.ConfirmOutput),
                proto.LiskSignedTx(signature=bytes.fromhex(
                    "87b9789ed10fb93311b77d23e34484ee653b43206a7e416da70f8dd6b15231a8dfe05c66bcbca62ba841fdde8affdb04b3ee18300caa8560cd15f6a4942a870a"
                )),
            ])

            lisk.sign_tx(
                self.client,
                parse_path("m/44'/9999'/0'"),
                {
                    "amount": "10000000",
                    "recipientId": "9971262264659915921L",
                    "timestamp": 57525937,
                    "type": 0,
                    "fee": "10000000",
                    "asset": {},
                },
            )
Пример #13
0
    def test_lisk_sign_tx_send(self):
        self.setup_mnemonic_nopin_nopassphrase()

        with self.client:
            self.client.set_expected_responses([
                proto.ButtonRequest(code=proto.ButtonRequestType.SignTx),
                proto.ButtonRequest(code=proto.ButtonRequestType.ConfirmOutput),
                proto.LiskSignedTx(
                    signature=unhexlify('b62717d581e5713bca60b758b661e6cfa091addc6caedd57534e06cda805943ee80797b9fb9a1e1b2bd584e292d2a7f832a4d1b3f15f00e1ee1b72de7e195a08')
                )
            ])

            self.client.lisk_sign_tx(self.client.expand_path("m/44'/134'/0'/0'"), {
                "amount": "10000000",
                "recipientId": "9971262264659915921L",
                "timestamp": 57525937,
                "type": 0,
                "fee": "10000000",
                "asset": {}
            })
Пример #14
0
    def test_lisk_sign_tx_send_with_data(self):
        self.setup_mnemonic_nopin_nopassphrase()

        with self.client:
            self.client.set_expected_responses([
                proto.ButtonRequest(code=proto.ButtonRequestType.SignTx),
                proto.ButtonRequest(code=proto.ButtonRequestType.ConfirmOutput),
                proto.LiskSignedTx(
                    signature=unhexlify('5dd0dbb87ee46f3e985b1ef2df85cb0bec481e8601d150388f73e198cdd57a698eab076c7cd5b281fbb6a83dd3dc64d91a6eccd1614dffd46f101194ffa3a004')
                )
            ])

            self.client.lisk_sign_tx(self.client.expand_path("m/44'/134'/0'/0'"), {
                "amount": "10000000",
                "recipientId": "9971262264659915921L",
                "timestamp": 57525937,
                "type": 0,
                "fee": "20000000",
                "asset": {
                    "data": "Test data"
                }
            })