web3swift icon indicating copy to clipboard operation
web3swift copied to clipboard

How to read internal transaction?

Open KittenYang opened this issue 3 years ago • 1 comments
trafficstars

I write a transaction with a smart contract,but the result what I want to retrieve is inside Internal Transactions. so How can I get the internal transactions? If I can use ‘eth_call’ method to get a tx information? And how can I make it in this repo? Thanks for answering.

KittenYang avatar Jul 25 '22 04:07 KittenYang

As long as you have the TransactionHash you can use web3.eth.getTransactionDetails() to retrieve the transaction itself. getTransactionDetails returns a structure with a meber called .transaction which is the decoded transaction. From there you have access to all the parameters and data that was encoded within the transaction. Note that if the transaction was a contract call, you will need to do some further decoding of the data field to get at that data, as that will be contract specific.

mloit avatar Jul 26 '22 17:07 mloit