With Web3j (not Web3js), how do I get the value of token transferred using transaction hash?
Asked
Active
Viewed 1,390 times
2
-
try to See this : https://stackoverflow.com/a/61154907/9131185 – OLIVIERS Apr 26 '21 at 09:25
-
Thanks @OLIVIERSZINSOU, but my question is for java language (Web3j), the answer you refer to is using javascript from Web3.js – Azrulm Apr 27 '21 at 10:31
1 Answers
0
I found this example for web3j:
String transactionHash = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
TransactionReceipt transReceipt = web3j.ethGetTransactionReceipt(transactionHash).send().getTransactionReceipt();
Transaction transaction = ethTransaction.getResult();
int size = tokenImpl.getTransferEvents(transReceipt).size();
size = size -1;
BigInteger valueTransaction = tokenImpl.getTransferEvents(transReceipt).get(size).value;
The value will be recieved in BigInteger

Azrulm
- 23
- 6