def test_sign_tx_timebounds(client):
    op = messages.StellarSetOptionsOp()
    tx = _create_msg()
    tx.timebounds_start = 1577836800
    tx.timebounds_end = 1577839000
    response = stellar.sign_tx(client, tx, [op], ADDRESS_N, NETWORK_PASSPHRASE)
    assert (
        b64encode(response.signature) ==
        b"KkZSQxXxEwfeGuFEHD7e93hei34rwK7VB79udYzileg6P/QEzK+lKyB9blUy+dPV3e7PvlHMj1FKXOsrgj/uCA=="
        # 2a46524315f11307de1ae1441c3edef7785e8b7e2bc0aed507bf6e758ce295e83a3ff404ccafa52b207d6e5532f9d3d5ddeecfbe51cc8f514a5ceb2b823fee08
    )

    tx.timebounds_start = 100
    tx.timebounds_end = None
    response = stellar.sign_tx(client, tx, [op], ADDRESS_N, NETWORK_PASSPHRASE)
    assert (
        b64encode(response.signature) ==
        b"ukpdaMwe6wdNnbVnOl0ZDvU1dde7Mtnjzy2IhjeZAjk8Ze+52WCv4M8IFjLoNF5c0aB847XYozFj8AsZ/k5fDQ=="
        # ba4a5d68cc1eeb074d9db5673a5d190ef53575d7bb32d9e3cf2d8886379902393c65efb9d960afe0cf081632e8345e5cd1a07ce3b5d8a33163f00b19fe4e5f0d
    )

    tx.timebounds_start = None
    tx.timebounds_end = 111111111
    response = stellar.sign_tx(client, tx, [op], ADDRESS_N, NETWORK_PASSPHRASE)
    assert (
        b64encode(response.signature) ==
        b"9sFE/EC+zYlYC2t7R33HsI540nOmJi/aHruu2qG+RW4FEvhKLybLS5pRRhSb0IP3comcv1Q3e2Glvis6PgVICQ=="
        # f6c144fc40becd89580b6b7b477dc7b08e78d273a6262fda1ebbaedaa1be456e0512f84a2f26cb4b9a5146149bd083f772899cbf54377b61a5be2b3a3e054809
    )
Example #2
0
    def test_sign_tx_set_options_op_inflation(self):
        """Set inflation destination"""
        self.setup_mnemonic_nopin_nopassphrase()

        op = proto.StellarSetOptionsOp()
        op.inflation_destination_account = 'GAFXTC5OV5XQD66T7WGOB2HUVUC3ZVJDJMBDPTVQYV3G3K7TUHC6CLBR'

        tx = self._create_msg()
        response = self.client.stellar_sign_transaction(
            tx, [op], self.ADDRESS_N, self.NETWORK_PASSPHRASE)

        assert b64encode(
            response.signature
        ) == b'dveWhKY8x7b0YqGHWH6Fo1SskxaHP11NXd2n6oHKGiv+T/LqB+CCzbmJA0tplZ+0HNPJbHD7L3Bsg/y462qLDA=='
Example #3
0
    def test_sign_tx_set_options(self):
        """Set inflation destination"""
        self.setup_mnemonic_nopin_nopassphrase()

        op = proto.StellarSetOptionsOp()
        op.inflation_destination_account = (
            "GAFXTC5OV5XQD66T7WGOB2HUVUC3ZVJDJMBDPTVQYV3G3K7TUHC6CLBR")

        tx = self._create_msg()
        response = stellar.sign_tx(self.client, tx, [op], self.ADDRESS_N,
                                   self.NETWORK_PASSPHRASE)

        assert (
            b64encode(response.signature) ==
            b"dveWhKY8x7b0YqGHWH6Fo1SskxaHP11NXd2n6oHKGiv+T/LqB+CCzbmJA0tplZ+0HNPJbHD7L3Bsg/y462qLDA=="
        )

        op = proto.StellarSetOptionsOp()
        op.signer_type = 0
        op.signer_key = bytes.fromhex(
            "72187adb879c414346d77c71af8cce7b6eaa57b528e999fd91feae6b6418628e")
        op.signer_weight = 2

        tx = self._create_msg()
        response = stellar.sign_tx(self.client, tx, [op], self.ADDRESS_N,
                                   self.NETWORK_PASSPHRASE)
        assert (
            b64encode(response.signature) ==
            b"EAeihuFBhUnjH6Sgd/+uAHlvajfv944VEpNSCLsOULNxYWdo/S0lJdUZw/2kN6I+ztKL7ZPQ5gYPJRNUePTOCg=="
        )

        op = proto.StellarSetOptionsOp()
        op.medium_threshold = 0

        tx = self._create_msg()
        response = stellar.sign_tx(self.client, tx, [op], self.ADDRESS_N,
                                   self.NETWORK_PASSPHRASE)
        assert (
            b64encode(response.signature) ==
            b"E2pz06PFB5CvIT3peUcY0wxo7u9da2h6/+/qim1eRWLHC73ZtFqDtLMBaKnr63ZfjB/kDzZmCzHxiv5m+m6+AQ=="
        )

        op = proto.StellarSetOptionsOp()
        op.low_threshold = 0
        op.high_threshold = 3
        op.clear_flags = 0

        tx = self._create_msg()
        response = stellar.sign_tx(self.client, tx, [op], self.ADDRESS_N,
                                   self.NETWORK_PASSPHRASE)
        assert (
            b64encode(response.signature) ==
            b"ySQE4aS0TI+N1xjSwi/pABHpC+A6RrNPWDOuFYGJFQ5B4vIU2S+ql2gCGLE7bQiYZ5dK9021f+a30mZoYeFLDw=="
        )

        op = proto.StellarSetOptionsOp()
        op.set_flags = 3
        op.master_weight = 4
        op.home_domain = "hello"

        tx = self._create_msg()
        response = stellar.sign_tx(self.client, tx, [op], self.ADDRESS_N,
                                   self.NETWORK_PASSPHRASE)
        assert (
            b64encode(response.signature) ==
            b"22rfcOrxBiE5akpNsnWX8yPgAOpclbajVqXUaXMNeL000p1OhFhi050t1+GNRpoSNyfVsJGNvtlICGpH4ksDAQ=="
        )
Example #4
0
def test_sign_tx_set_options(client):
    """Set inflation destination"""

    op = messages.StellarSetOptionsOp()
    op.inflation_destination_account = (
        "GAFXTC5OV5XQD66T7WGOB2HUVUC3ZVJDJMBDPTVQYV3G3K7TUHC6CLBR")

    tx = _create_msg()
    response = stellar.sign_tx(client, tx, [op], ADDRESS_N, NETWORK_PASSPHRASE)

    assert (
        b64encode(response.signature) ==
        b"dveWhKY8x7b0YqGHWH6Fo1SskxaHP11NXd2n6oHKGiv+T/LqB+CCzbmJA0tplZ+0HNPJbHD7L3Bsg/y462qLDA=="
        # 76f79684a63cc7b6f462a187587e85a354ac9316873f5d4d5ddda7ea81ca1a2bfe4ff2ea07e082cdb989034b69959fb41cd3c96c70fb2f706c83fcb8eb6a8b0c
    )

    op = messages.StellarSetOptionsOp()
    op.signer_type = 0
    op.signer_key = bytes.fromhex(
        "72187adb879c414346d77c71af8cce7b6eaa57b528e999fd91feae6b6418628e")
    op.signer_weight = 2

    tx = _create_msg()
    response = stellar.sign_tx(client, tx, [op], ADDRESS_N, NETWORK_PASSPHRASE)
    assert (
        b64encode(response.signature) ==
        b"EAeihuFBhUnjH6Sgd/+uAHlvajfv944VEpNSCLsOULNxYWdo/S0lJdUZw/2kN6I+ztKL7ZPQ5gYPJRNUePTOCg=="
        # 1007a286e1418549e31fa4a077ffae00796f6a37eff78e1512935208bb0e50b371616768fd2d2525d519c3fda437a23eced28bed93d0e6060f25135478f4ce0a
    )

    op = messages.StellarSetOptionsOp()
    op.medium_threshold = 0

    tx = _create_msg()
    response = stellar.sign_tx(client, tx, [op], ADDRESS_N, NETWORK_PASSPHRASE)
    assert (
        b64encode(response.signature) ==
        b"E2pz06PFB5CvIT3peUcY0wxo7u9da2h6/+/qim1eRWLHC73ZtFqDtLMBaKnr63ZfjB/kDzZmCzHxiv5m+m6+AQ=="
        # 136a73d3a3c50790af213de9794718d30c68eeef5d6b687affefea8a6d5e4562c70bbdd9b45a83b4b30168a9ebeb765f8c1fe40f36660b31f18afe66fa6ebe01
    )

    op = messages.StellarSetOptionsOp()
    op.low_threshold = 0
    op.high_threshold = 3
    op.clear_flags = 0

    tx = _create_msg()
    response = stellar.sign_tx(client, tx, [op], ADDRESS_N, NETWORK_PASSPHRASE)
    assert (
        b64encode(response.signature) ==
        b"ySQE4aS0TI+N1xjSwi/pABHpC+A6RrNPWDOuFYGJFQ5B4vIU2S+ql2gCGLE7bQiYZ5dK9021f+a30mZoYeFLDw=="
        # c92404e1a4b44c8f8dd718d2c22fe90011e90be03a46b34f5833ae158189150e41e2f214d92faa97680218b13b6d089867974af74db57fe6b7d2666861e14b0f
    )

    op = messages.StellarSetOptionsOp()
    op.set_flags = 3
    op.master_weight = 4
    op.home_domain = "hello"

    tx = _create_msg()
    response = stellar.sign_tx(client, tx, [op], ADDRESS_N, NETWORK_PASSPHRASE)
    assert (
        b64encode(response.signature) ==
        b"22rfcOrxBiE5akpNsnWX8yPgAOpclbajVqXUaXMNeL000p1OhFhi050t1+GNRpoSNyfVsJGNvtlICGpH4ksDAQ=="
        # db6adf70eaf10621396a4a4db27597f323e000ea5c95b6a356a5d469730d78bd34d29d4e845862d39d2dd7e18d469a123727d5b0918dbed948086a47e24b0301
    )