0

i'm using etherscan API to get info about transaction transfer event. I'm using this route :

https://api.etherscan.io/api?module=account&action=tokentx&address=0x4e83362442b8d1bec281594cea3050c8eb01311c&startblock=0&endblock=999999999&sort=asc&apikey=YourApiKeyToken

I tried on a specific address, and i got this return :

   {
      "blockNumber":"11776758",
      "timeStamp":"1612268225",
      "hash":"0x30568148b640d7aec6e5474a97b717d804cadd036a22536768da1db92f96749b",
      "nonce":"180",
      "blockHash":"0x7679fc069005991fb1debfff9afe0a16ed68ed24745143b1df1af25342aa5b2e",
      "from":"0x9f4aa9b4661f0c55b61fc12b1944f006a71c773f",
      "contractAddress":"0x8a9c4dfe8b9d8962b31e4e16f8321c44d48e246e",
      "to":"0x3acefe2fb0375018b68d8499ec9c73bf96a27ba3",
      "value":"7412118173062171917583",
      "tokenName":"NameChangeToken",
      "tokenSymbol":"NCT",
      "tokenDecimal":"18",
      "transactionIndex":"33",
      "gas":"151692",
      "gasPrice":"180000000000",
      "gasUsed":"124538",
      "cumulativeGasUsed":"2146953",
      "input":"deprecated",
      "confirmations":"762"
   },

Here we can see user transfer some eth to get NCT token. How can i know the amount of wich currency the user use to buy NCT token ? Because the only information i have here is the NCT token amount. I don't know with that data with wich currencie user swap NCT ( that was ETH, USDT etc ... ?) I don't either if that was a buy or a sell :/

I'm probably using the wrong api route ?

3
  • yep, wrong route. You need Uniswap Swaps, but Uniswap is not the only exchange, there are lots of them, like Balancer for example. This information needs to be collected per exchange
    – Nulik
    Feb 2, 2021 at 23:11
  • But on etherscan we can see the ETH amount, just on the API i don't get this info :/ You really think i need to use uniswap api to get this info since the info is displayed in etherscan ? Feb 3, 2021 at 8:08
  • if you want to know the source token and the conversion rate, then yes, you need to process all uniswap swaps
    – Nulik
    Feb 3, 2021 at 16:20

0

Your Answer

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

Browse other questions tagged or ask your own question.