def test_to_xdr_with_muxed_account_str_fee_source(self):
     inner_keypair = Keypair.from_secret(
         "SBKTIFHJSS3JJWEZO2W74DZSA45WZU56LOL3AY7GAW63BXPEJQFYV53E"
     )
     inner_source = Account(
         "MAAAAAAAAAAAH2A4KTYT4R7Z6VLHNSFMAK33N3TSKX2OJBSKSXHU4EUFNE3EVMLXYA662", 7
     )
     destination = "GDQERENWDDSQZS7R7WKHZI3BSOYMV3FSWR7TFUYFTKQ447PIX6NREOJM"
     amount = "2000.0000000"
     inner_tx = (
         TransactionBuilder(
             inner_source, Network.TESTNET_NETWORK_PASSPHRASE, 200, v1=True
         )
         .append_payment_op(destination=destination, amount=amount, asset_code="XLM")
         .add_time_bounds(0, 0)
         .build()
     )
     inner_tx.sign(inner_keypair)
     fee_source = Keypair.from_secret(
         "SB7ZMPZB3YMMK5CUWENXVLZWBK4KYX4YU5JBXQNZSK2DP2Q7V3LVTO5V"
     )
     base_fee = 200
     fee_bump_tx = TransactionBuilder.build_fee_bump_transaction(
         fee_source.public_key,
         base_fee,
         inner_tx,
         Network.TESTNET_NETWORK_PASSPHRASE,
     )
     fee_bump_tx.sign(fee_source)
     # xdr = "AAAABQAAAADgSJG2GOUMy/H9lHyjYZOwyuyytH8y0wWaoc596L+bEgAAAAAAAAGQAAAAAgAAAAAcVPE+R/n1VnbIrAK3tu5yVfTkhkqVz04ShWk2SrF3wAAAAMgAAAAAAAAACAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAADgSJG2GOUMy/H9lHyjYZOwyuyytH8y0wWaoc596L+bEgAAAAAAAAAEqBfIAAAAAAAAAAABSrF3wAAAAEAordQh63kT50muRLVYaWW7Pgtt8i1tc4t9Bv9MWFWFN3WfTHSU2Jxv7hedjZEyfBPvaS/XnwvYJFcHgPDd1JkNAAAAAAAAAAHov5sSAAAAQKu/RuArXn/P13IIJ8WlnVDStwOquXM0CsWzA4ooZY6gqJ3k1EfmMVIJ0cir0bMTJD9r+g2IUZCANU7wdC38PA0="
     # assert fee_bump_tx.to_xdr() == xdr
     restore_te = FeeBumpTransactionEnvelope.from_xdr(
         fee_bump_tx.to_xdr(), Network.TESTNET_NETWORK_PASSPHRASE
     )
     assert (
         restore_te.to_xdr()
         == TransactionBuilder.from_xdr(
             fee_bump_tx.to_xdr(), Network.TESTNET_NETWORK_PASSPHRASE
         ).to_xdr()
     )
     assert isinstance(restore_te, FeeBumpTransactionEnvelope)
     restore_tx = restore_te.transaction
     assert isinstance(restore_tx, FeeBumpTransaction)
     assert restore_tx.fee_source == MuxedAccount.from_account(fee_source.public_key)
     assert restore_tx.base_fee == base_fee
     assert restore_tx.inner_transaction_envelope.to_xdr() == inner_tx.to_xdr()
Ejemplo n.º 2
0
    def test_to_xdr_str_muxed_account_str_source_v1(self):
        source = "MAAAAAAAAAAAJURAAB2X52XFQP6FBXLGT6LWOOWMEXWHEWBDVRZ7V5WH34Y22MPFBHUHY"
        destination = "GDJJRRMBK4IWLEPJGIE6SXD2LP7REGZODU7WDC3I2D6MR37F4XSHBKX2"
        amount = "1000.0"
        sequence = 1
        memo = IdMemo(100)
        fee = 200
        asset = Asset.native()
        time_bounds = TimeBounds(12345, 56789)
        ops = [
            Payment(destination, asset, amount),
            ManageData("hello", "world")
        ]

        tx_object = Transaction(source, sequence, fee, ops, memo, time_bounds,
                                True).to_xdr_object()
        restore_transaction = Transaction.from_xdr(tx_object.to_xdr(), True)
        assert isinstance(restore_transaction, Transaction)
        assert restore_transaction.source == MuxedAccount.from_account(source)
        assert restore_transaction.fee == fee
        assert restore_transaction.memo == memo
        assert restore_transaction.time_bounds == time_bounds
        assert restore_transaction.sequence == sequence
Ejemplo n.º 3
0
    def test_to_xdr_v0(self):
        source = Keypair.from_public_key(
            "GC3GJU6L7V7ZLPLKG3NTMC6GYYKBMNNKCPP36FG3LWEVPOHUPY6QJIGL")
        destination = "GDJJRRMBK4IWLEPJGIE6SXD2LP7REGZODU7WDC3I2D6MR37F4XSHBKX2"
        amount = "1000.0"
        sequence = 2
        memo = NoneMemo()
        fee = 200
        asset = Asset.native()
        time_bounds = TimeBounds(12345, 56789)
        ops = [Payment(destination, asset, amount)]

        tx_object = Transaction(source, sequence, fee, ops, memo, time_bounds,
                                False).to_xdr_object()

        restore_transaction = Transaction.from_xdr_object(tx_object, False)
        assert isinstance(restore_transaction, Transaction)
        assert restore_transaction.source == MuxedAccount.from_account(
            source.public_key)
        assert restore_transaction.fee == fee
        assert restore_transaction.memo == memo
        assert restore_transaction.time_bounds == time_bounds
        assert restore_transaction.sequence == sequence