1

Currently, I am using Etherscan API to get the list of all transactions from a specific wallet using the endpoint: https://api.etherscan.io/api?module=account&action=txlist&address=WALLET_ADDRESS&sort=asc&apikey=MY_API_KEY

Once I find the transaction I'm looking for from that endpoint, I get the transaction hash (lets just say 0x92df276c29cb3cbc77487ef5531a64fac9dc13b1d5fdf7d20fc41bc0830badfc for this example).

I am then using the etherscan-api eth_getTransactionByHash function to get the transaction details using the above hash, however the response does not contain the Token ID which I then intend to use to gather more information about the purchase.

The Token ID for this transaction is 1037 as seen here: https://etherscan.io/tx/0x92df276c29cb3cbc77487ef5531a64fac9dc13b1d5fdf7d20fc41bc0830badfc

The response I get:

{
  jsonrpc: '2.0',
  id: 1,
  result: {
    blockHash: '0x109f379a8d9febf029c78a1fb755c609713028f59404925a5cf489dd7e3e9810',
    blockNumber: '0xc88e66',
    from: '0x5ea9681c3ab9b5739810f8b91ae65ec47de62119',
    gas: '0x4d53e',
    gasPrice: '0xfc49b4261',
    maxFeePerGas: '0x16a8ea23bb',
    maxPriorityFeePerGas: '0x59682f00',
    hash: '0x92df276c29cb3cbc77487ef5531a64fac9dc13b1d5fdf7d20fc41bc0830badfc',
    input: '0xab834bab0000000000000000000000007be8076f4ea4a4ad08075c2508e481d6c946d12b0000000000000000000000005ea9681c3ab9b5739810f8b91ae65ec47de62119000000000000000000000000100081225cde532d9f1b6d62b22d8a946d778b730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c92ceddfb8dd984a89fb494c376f9a48b999aafc000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007be8076f4ea4a4ad08075c2508e481d6c946d12b000000000000000000000000100081225cde532d9f1b6d62b22d8a946d778b7300000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b3256965e7c3cf26e11fcaf296dfc8807c01073000000000000000000000000c92ceddfb8dd984a89fb494c376f9a48b999aafc0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003b60000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000bcbce7f1b1500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006130390f00000000000000000000000000000000000000000000000000000000000000005cb843c750c9f2974cf016198ab5133ddd205c7c9527df216ff2ff8c6697861b00000000000000000000000000000000000000000000000000000000000003b60000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000bcbce7f1b15000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000061302a81000000000000000000000000000000000000000000000000000000000000000062a4880812a03ad1079d5e4e3b2f925861f6cb8ef827f11f876b36a948727d790000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006a0000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000007e0000000000000000000000000000000000000000000000000000000000000088000000000000000000000000000000000000000000000000000000000000009200000000000000000000000000000000000000000000000000000000000000940000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000001ca7ffdb3e5d349c379f14bd36acc36b83a2a413654f377d2d648037264368652555bf631e6d971ff33b2fe7c1de751d61a66563ac47df3e68d677ca4d8d207342a7ffdb3e5d349c379f14bd36acc36b83a2a413654f377d2d648037264368652555bf631e6d971ff33b2fe7c1de751d61a66563ac47df3e68d677ca4d8d2073420000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006423b872dd00000000000000000000000000000000000000000000000000000000000000000000000000000000000000005ea9681c3ab9b5739810f8b91ae65ec47de62119000000000000000000000000000000000000000000000000000000000000040d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006423b872dd000000000000000000000000100081225cde532d9f1b6d62b22d8a946d778b730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006400000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
    nonce: '0x36f',
    to: '0x7be8076f4ea4a4ad08075c2508e481d6c946d12b',
    transactionIndex: '0x12a',
    value: '0xbcbce7f1b150000',
    type: '0x2',
    accessList: [],
    chainId: '0x1',
    v: '0x1',
    r: '0x6c2a67f4f5de28576d3128f1c132c82c6dc6303736c8262790d2a32d02a127ca',
    s: '0x7bb4031c9e2ac1890ee30e7f835fcb49358036ded27bc18144dead4cab47ac09'
  }
} 

Is there anyway I can gather the Token ID from the information provided in the response? Or failing that is there some other API I can call?

Any help is appreciated

2 Answers 2

0

you can use ABI ERC721 or get from 'event log'

1
  • It will be helpful if you can provide some example how to use them.
    – Ismael
    Dec 12, 2021 at 20:42
0

You can use this API endpoint for Ropsten Network. It will provide you all the details with token.

https://api-ropsten.etherscan.io/api?module=account&action=tokennfttx&address=<your_Contract_Address>&startblock=0&endblock=latest&sort=asc&apikey=<your_API_key>

I am using Ropsten API because my contract is deployed on Ropsten Testnet. You can adjust block with your starting block.

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.