Web3j: Get value of transaction token transfered using Transaction Hash

1.4k views Asked by At

With Web3j (not Web3js), how do I get the value of token transferred using transaction hash?

1

There are 1 answers

0
Azrulm On

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