Sitelet https://github.com/iexbase/tron-api-python/issues/86
Skip to content

AttributeError: 'dict' object has no attribute 'text' #86

Description

@aditya-dev201

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions