simolus3 / web3dart

Ethereum library, written in Dart.
MIT License
442 stars 270 forks source link

How to get token ERC 20 transfered value? #183

Closed mdat31 closed 2 years ago

mdat31 commented 2 years ago

I used generated token code to transfer 1 BUSD and receive a transaction hash. When i getTransactionByHash it does not get the BUSD value transfered. How can i get it?

image

simolus3 commented 2 years ago

I think you can listen for the transfer event generated in that transaction to get the amount?

mdat31 commented 2 years ago

The TransactionInformation does not include the token transfered, right?

simolus3 commented 2 years ago

The TransactionInformation contains the input data, which you could use to re-construct the exact method call and parameters. But I think loading events from a transaction and decoding them is safer, you can see an example for that here:

https://github.com/simolus3/web3dart/blob/af4c3fb4a0c258f4146f051e4c27d1674046003b/example/contracts.dart#L68-L70

mdat31 commented 2 years ago

Thanks!