Get Balances by Contract
Overview
The Get Balances By Contract endpoint retrieves the balances of every holder for a specific ERC-20 token using its contract address, which is a required path parameter.
A successful request to the endpoint will return a JSON response with balances data
labeled as items, which will include fields such as an EOA address
, value_raw
,
value_calculated
, seen_at_block_number
, and estimated_usd_value
. The token
data
will be shown at the top of the response.
The current calculation of total supply relies on transfers to
and from
the zeroth address.
This method might not yield accurate results for tokens with unique minting mechanics, such as USDT
or BNB.
Querying via Postman
If you prefer querying via Postman, the description of PARSIQ Endpoints for Get Balances by Contract (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 obtain the balances of all EOA wallets that own PRQ tokens
by querying its contract 0x362bc847A3a9637d3af6624EeC853618a43ed7D2
.
import * as Parsiq from '@parsiq/parsiq.js';
const client = Parsiq.createClient(process.env.API_KEY, Parsiq.ChainId.ETH_MAINNET);
const contractBalances = client.balances.getByContract(
`0x362bc847A3a9637d3af6624EeC853618a43ed7D2`,
{limit: 1}
);
for await (const balance of contractBalances) {
console.log(balance);
}
Output:
{
id: '0000000000a810a2-0113-00000016-1',
address: '0x2c91ad40a7fd656122910df8f4c1a96b6ca64d99',
value_raw: '67490389387653800000000',
value_calculated: '67490.3893876538',
seen_at_block_number: 11014306,
estimated_usd_value: null
}
Parameters
chainId
version
contract
offset
limit
estimate_cu