0

I'm testing a simple wallet tracking app that notifies me when a wallet makes a transaction. I'm using Uniswap on the Gorli test network. The tracker is working well, but it only notifies that a transaction has occurred and the relevant transaction hash. Is there a way I can get the token details, including the CA, token name and eth spent etc just from the transaction record?

Thanks!

2 Answers 2

0

The process is straightforward if it's a direct token transfer: the token contract address is the transaction's target address. Once you have the token contract address you can query the contract for more information (such as token name, if it's available).

If the transaction uses some other contract to interact with tokens, things get more difficult. You would basically have to analyze the transaction for any external calls to other contracts, and determine if some of these called contracts are token contracts.

As for eth transfers you can just check the value field of the transaction.

6
  • Thanks for your response. It's the latter, using the Uniswap exchange on the Gorli testnet. I understand this uses the 'execute' function via the V3 router, but not sure how to use that information to obtain the contract address of the token. I'm brand new to this and still learning the ropes.
    – Mr Smith
    Commented Feb 14, 2023 at 7:39
  • This kind of stuff isn't the easiest thing to learn. But if you want, sure, it's one way to start learning. But I would recommend starting from somewhere else. Commented Feb 14, 2023 at 7:40
  • Well it's more that is the functionality I am looking for. I am covering more basic stuff at the same time. Any pointers on where to start with obtaining the CA? I understand I need to get the ABI of the router contract and subscribe to the relevant event. Am I on the right track?
    – Mr Smith
    Commented Feb 14, 2023 at 8:00
  • .....What's CA? Commented Feb 14, 2023 at 8:05
  • Contract address, for the purchased token in this context.
    – Mr Smith
    Commented Feb 14, 2023 at 8:08
0

There are more than one form of track transactions:

  1. Inspecting and decoding transaction data.
  2. Use of trace capabilities of your node/provider.
  3. Tracing transactions and state on contracts that your transaction interact.

If you want, share what your are doing can help others to aswer more precisely your question.

Here's a link showing how to decode transaction data from UniswapV3, may help in what you are doing: How to decode uniswap v3 Router 2 transaction

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.