Links

getTokenApprovals

Get ERC20 approvals for a given token contract address

Parameters

  • contractAddress :(string) REQUIRED - The token contract address
  • fromBlock : (string) OPTIONAL - The block number from which the approvals will be returned
  • toBlock : (string) OPTIONAL - The block number up to which the approvals will be returned
  • ownerAddress : (string) OPTIONAL - The address of the approver
  • spenderAddress : (string) OPTIONAL - The address of the spender
  • pageSize : (integer) OPTIONAL - Number of records to be retrieved on one page
  • pageKey : (string) OPTIONAL - Key used to get the next page of results. Must be set to the value of nextPageKey returned in the previous response

Returns

  • contractAddress: <string> - The token contract address
  • contractDecimals : <string> - Token decimals specified in the contract
  • contractName: <string> - The name of the token
  • contractSymbols: <string> - The name of the token
  • count : <integer> - The number of token approvals
  • nextPageKey: <string> - Key to get the next page of results, if more results are available
  • tokenApprovals: <array> - The array containing all token approvals
    • ownerAddress : <string> - The wallet address of the approver
    • spenderAddress : <string> - The address of the spender
    • value : <string> - The amount of tokens approved
    • blockHash : <string> - The hash of the block in which the transfer transaction was executed
    • blockNumber : <integer> - The height of the block in which the transfer transaction was executed
    • blockTimestamp : <string> - The timestamp of the block in which the transfer transaction was executed
    • transactionHash: <string>- The hash of the token transfer transaction
    • transactionIndex: <integer> - The number of the token transfer transaction
    • logIndex : <integer> - The index of the transaction log

Example Request and Result for getTokenApprovals

Request
curl --location 'https://eth-mainnet.blastapi.io/<project-id>/builder/getTokenApprovals?contractAddress=0xdAC17F958D2ee523a2206206994597C13D831ec7&spenderAddress=0x1111111254eeb25477b68fb85ed929f73a960582&ownerAddress=0xa7ca2c8673bcfa5a26d8ceec2887f2cc2b0db22a'
Result
{
"contractAddress": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"contractDecimals": "6",
"contractName": "Tether USD",
"contractSymbol": "USDT",
"count": 100,
"nextPageKey": "ODhjMzgxNjg2MWQ5OjE2OTg2ODE2MjI6MTg0NTgzMjk6MTAyMDAwMjA4MDAwMDAwOlRldGhlciBVU0Q6VVNEVDo2",
"tokenApprovals": [
{
"ownerAddress": "0xa7ca2c8673bcfa5a26d8ceec2887f2cc2b0db22a",
"spenderAddress": "0x1111111254eeb25477b68fb85ed929f73a960582",
"value": "31172490000",
"blockHash": "0xe2ea1391899a9864098187d5a58d4a27fa5718aeea6203061a2b6908682ae29c",
"blockNumber": 18463752,
"blockTimestamp": "2023-10-30T15:05:47.000Z",
"transactionHash": "0x28a7cd9210edcbaf1670854b051947fab9b8b4f050949cecb334953ea93fe839",
"transactionIndex": 3,
"logIndex": 37
},
{
"ownerAddress": "0xa7ca2c8673bcfa5a26d8ceec2887f2cc2b0db22a",
"spenderAddress": "0x1111111254eeb25477b68fb85ed929f73a960582",
"value": "4888515232",
"blockHash": "0xe2ea1391899a9864098187d5a58d4a27fa5718aeea6203061a2b6908682ae29c",
"blockNumber": 18463752,
"blockTimestamp": "2023-10-30T15:05:47.000Z",
"transactionHash": "0x485bcad3efea526a7c5998ea654705aeb713d129b1d192355c59a7ec1bd542f6",
"transactionIndex": 2,
"logIndex": 18
},
{
"ownerAddress": "0xa7ca2c8673bcfa5a26d8ceec2887f2cc2b0db22a",
"spenderAddress": "0x1111111254eeb25477b68fb85ed929f73a960582",
"value": "500000000",
"blockHash": "0x4e086970ce4d1ad19b8664fab4f280b2cb5f367fbb3380108846b685e42b06c9",
"blockNumber": 18463750,
"blockTimestamp": "2023-10-30T15:05:23.000Z",
"transactionHash": "0xbbbe00289cda583d84fdefeb0b3f1e21526ffbf4db1f87b9f676fb7d3b808370",
"transactionIndex": 141,
"logIndex": 340
},
{
"ownerAddress": "0xa7ca2c8673bcfa5a26d8ceec2887f2cc2b0db22a",
"spenderAddress": "0x1111111254eeb25477b68fb85ed929f73a960582",
"value": "3633110952",
"blockHash": "0xc0f92c13fe953abe636258b5396b1fa7982ed89c13873e3f085664f04eac6704",
"blockNumber": 18463726,
"blockTimestamp": "2023-10-30T15:00:11.000Z",
"transactionHash": "0x69e945c29ff490f34b8a44445363bbb0d98da6319aff41972de3607c60aa0aac",
"transactionIndex": 259,
"logIndex": 511
},
{
"ownerAddress": "0xa7ca2c8673bcfa5a26d8ceec2887f2cc2b0db22a",
"spenderAddress": "0x1111111254eeb25477b68fb85ed929f73a960582",
"value": "60500000",
"blockHash": "0x39ac3bfdf0b2ce9752d650f83fa10d8de82578bb9c84df91479379674c7374ec",
"blockNumber": 18463691,
"blockTimestamp": "2023-10-30T14:52:59.000Z",
"transactionHash": "0x27dac0502209b46da2225c3aeb6fef0dfbbea604747071ac8654272f9bd08194",
"transactionIndex": 143,
"logIndex": 349
},
{
"ownerAddress": "0xa7ca2c8673bcfa5a26d8ceec2887f2cc2b0db22a",
"spenderAddress": "0x1111111254eeb25477b68fb85ed929f73a960582",
"value": "1850000000",
"blockHash": "0x599b58087b003655555fe90503ea7132effd5a327fbe923702e4e258aea9a59a",
"blockNumber": 18463576,
"blockTimestamp": "2023-10-30T14:29:47.000Z",
"transactionHash": "0xd0a3145e54da95d125f3ca1c9e488af7ab0dfa85103c0f07d6f3f15df013712d",
"transactionIndex": 199,
"logIndex": 405
},
{
"ownerAddress": "0xa7ca2c8673bcfa5a26d8ceec2887f2cc2b0db22a",
"spenderAddress": "0x1111111254eeb25477b68fb85ed929f73a960582",
"value": "3469368750",
"blockHash": "0x140b3b976026b0c9571c27d5155ba851a9563e9eeb9017a78e8cd0b1664be2b7",
"blockNumber": 18463545,
"blockTimestamp": "2023-10-30T14:23:23.000Z",
"transactionHash": "0xedb55e94af453031e2c0af542e2361e2c544f58b3bb3fcef2dd3af03747fdfe8",
"transactionIndex": 110,
"logIndex": 264
},
```