tron-api-python
tron-api-python copied to clipboard
AttributeError: 'dict' object has no attribute 'text'
i am using below code to send trc20 token but it give error : AttributeError: 'dict' object has no attribute 'text'
import tronapi from tronapi import Tron
full_node = 'https://api.trongrid.io' solidity_node = 'https://api.trongrid.io' event_server = 'https://api.trongrid.io'
PK = "private key" PA = "target address"
add = "TLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU7" #wink contract address
am = 10 td = 6
tron = Tron(full_node=full_node, solidity_node=solidity_node, event_server=event_server)
def setTronPK(pk): tron.private_key = pk tron.default_address = tron.address.from_private_key(pk).base58
setTronPK(PK)
txn = tron.transaction_builder.trigger_smart_contract( contract_address=tron.address.to_hex(add), function_selector='transfer(address,uint256)', fee_limit=10000000, call_value=0, parameters=[ {'type': 'address', 'value': tron.address.to_hex(PA)}, {'type': 'int256', 'value': am*td} ] ) print(txn.text)