Get Token Transfers
Overview
The Get Token Transfers endpoint obtains data on all interactions with a specific token
by providing its contract
as a required path parameter. The range should be defined by either
block_number
, timestamp
, or block_hash
. When querying via Postman or CLI, it is recommended
to always specify the asset_type
parameter, even though the endpoint will work without it if you
are querying by an FT contract. Pass the value like so: ft
, nft
, or multi
depending on the
token standard.
When using the endpoint via Parsiq JS Client, keep in mind that asset_type
is a required parameter.
Pass the value in an array like so: [AssetType.FungibleToken]
, [AssetType.NonFungibleToken]
, or
[AssetType.MultiToken]
depending on the token standard. You can also specify origin
to get all
transfers of a particular token from an EOA wallet.
Try not to pass all asset types at once. The more asset types are specified, the more computational units are spent.
Querying via Postman
If you prefer querying via Postman, the description of PARSIQ Endpoints for Get Token Transfers (opens in a new tab) might come in handy. There you will find examples and responses for good and bad requests as well as parameter definitions and their example values.
Usage
In this example, we receive all MATIC transfers by its contract 0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0
on Ethereum Mainnet, sent from the origin
address 0x78655080b65f42e2cee5fa5673689cc44d4e1cfc
. The asset_type
field should be set to ft
as we are querying by an ERC-20 standard contract.
import * as Parsiq from '@parsiq/parsiq.js';
import {AssetType} from '@parsiq/parsiq.js';
const client = Parsiq.createClient(process.env.API_KEY, Parsiq.ChainId.ETH_MAINNET);
const tokenTransfers = client.transfers.token.getByBlockRange(
`0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0`,
1, 'latest',
{
asset_type: [AssetType.FungibleToken],
origin: '0x78655080b65f42e2cee5fa5673689cc44d4e1cfc'
},
{
limit: 10
}
);
for await (const transfer of tokenTransfers) {
console.log(transfer);
}
Output:
{
id: '0000000000740d64-0070-00000002',
tx_hash: '0x730627aaf76922ef8a46fcf511f088c4f613872a5e4821d382f28511b15e58d1',
block_hash: '0xc6f23d82564cb553808edac76db12f85e9405c33e2c5ec15f7b6b02c0ac2f66d',
block_number: 7605604,
timestamp: 1555778052,
origin: '0x78655080b65f42e2cee5fa5673689cc44d4e1cfc',
contract: '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0',
sender: '0x0000000000000000000000000000000000000000',
recipient: '0x78655080b65f42e2cee5fa5673689cc44d4e1cfc',
value: '10000000000000000000000000000',
token_id: null,
asset_type: 'ft'
}
Parameters
chainId
version
contract
block_number_start
block_number_end
asset_type
origin
offset
limit
estimate_cu