tronprotocol / tronweb

Javascript API Library for interacting with the TRON Network
MIT License
413 stars 271 forks source link

How to get info about TRC20 transaction #456

Closed hedimin closed 8 months ago

hedimin commented 9 months ago

Hello everyone!

I'm trying to get info about usdt transaction: const transactions = await this.tronWeb.trx.getTransactionFromBlock(lastBlockId); As a result, this usdt transaction looks like this: image

I can parse AddressFrom - this.tronWeb.address.fromHex(transaction.raw_data.contract[0].parameter.value.to_address) And contract address - 'this.tronWeb.address.fromHex(transaction.raw_data.contract[0].parameter.value.contract_address)'

How can i get info about AddressTo (receiver of this transaction) and amount of usdt that was send? Thanks in advance for the help

start940315 commented 9 months ago

value.data is encoded arguments by encodeParamsV2ByABI. You need to decode using function abi and data by decodeParamsV2ByABI