0

I have a simple JS script. I'm looking at the pending transactions in the Mempool, and only at the ones which are sent to Uniswap router. Namely, each of them has tx.to == $UniswapRouterAddr

How can I get the amounts of the assets that are being swapped in each transaction?

P.S.

By "assets" I mean whatever they may be: both tokens, or token/ETH.

5
  • You need to decode Ethereum transaction input data. which library you sing for web3 or ethers js ? here is an ethersjs example ethereum.stackexchange.com/questions/110489/…
    – Archi
    Commented Jul 19, 2022 at 15:24
  • @Archi I can use whichever library. What's transaction input data concreately? In what field is it?
    – Kum
    Commented Jul 19, 2022 at 15:32
  • Find Input filed {"blockHash":null,"blockNumber":null,"from":"0xffcf9a1bf69bb87c4bfa8767a22dff9c9e0c4a03","gas":"0x417cb","maxPriorityFeePerGas":"0x553062d5","maxFeePerGas":"0xee6b2800","hash":"0x3d3a643d979cd53c441d1529e7252d3111a1ba9b8d195ff10b25a850f2c359a0","input":"0x993e1c4200000000000000000000000000000000000000000000000000000000000eff6b000000000000000000000000ffcf9a1bf69bb87c4bfa8767a22dff9c9e0c4a03000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000611b043e2b4c710000000000000000000000 ..... truncated.
    – Archi
    Commented Jul 20, 2022 at 13:46
  • @Archi ok. Give a full answer. In the link you've given me, there're several things that've been omitted, therefore I can't deduce an answer
    – Kum
    Commented Jul 20, 2022 at 20:01
  • @Archi I've done that. Here's a new question ethereum.stackexchange.com/questions/132162/…
    – Kum
    Commented Jul 21, 2022 at 13:01

0

Your Answer

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