Getting exception while establishing Trust Line

Getting exception while establishing Trust Line

Manage alerts

Loading saved threads...

Volatil3 · External communityPost link
External question — Stellar Stack Exchange Author: Volatil3 Original post: https://stellar.stackexchange.com/questions/2873 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I am working on Stellar Python SDK after a year. When I ran my old script I got the error: TypeError: __init__() got an unexpected keyword argument 'opts' The code given below: from stellar_base.asset import Asset from stellar_base.horizon import horizon_testnet from stellar_base.keypair import Keypair from stellar_base.memo import TextMemo from stellar_base.operation import ChangeTrust, Payment from stellar_base.transaction import Transaction from stellar_base.transaction_envelope import TransactionEnvelope as Te def opr_change_trust(asset_object, receiver_address, receiver_seed, horizon): # Operation Object op = ChangeTrust({ 'source': receiver_address, 'asset': asset_object, 'limit': '5000' }) print('Establishing trust-line for the account {}. Please wait!!'.format(receiver_address)) # Getting the next sequence of the address sequence = horizon.account(receiver_address).get('sequence') # Create Text Memo msg = TextMemo('Change Trust Operation') # construct Tx tx = Transaction( source=receiver_address, opts={ 'sequence': sequence, 'memo': msg, 'operations': [ op, ], }, ) # xdr = tx.xdr() # deccoded_xdr = tx.to_xdr_object() # print(deccoded_xdr) # Get reference of receiving account receiving_account = Keypair.from_seed(receiver_seed) # build envelope envelope = Te(tx=tx, opts={"network_id": "TESTNET"}) envelope.sign(receiving_account) xdr_envelope = envelope.xdr() # Submit the signed transaction to Horizon server. response = horizon.submit(xdr_envelope) print(response) if 'result_xdr' in response: return True else: print('Things go Fishy while opr_change_trust') return False
Quote
Report
kolten · External communityPost link
External answer — Stellar Stack Exchange Author: kolten Original post: https://stellar.stackexchange.com/a/2874 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. Documentation is available here: https://stellar-base.readthedocs.io/en/latest/api.html#transaction The transaction object is constructed like so: Transaction(source, sequence, time_bounds=None, memo=None, fee=None, operations=None) Passing in opts as a list seems to be causing the issue.
Quote
Report

Post Reply

Checking account access…