getBalances
getBalances
is a method on the ARIO
class that retrieves token balances for multiple wallet addresses with pagination support.
getBalances
does not require authentication.
Parameters
← Swipe to see more →
Parameter | Type | Description | Optional | Default |
---|---|---|---|---|
cursor | string | The wallet address to use as the starting point for pagination | true | None |
limit | number | The maximum number of balances to return (max: 1000) | true | 100 |
sortBy | string | The property to sort balances by | true | balance |
sortOrder | string | The sort direction ('desc' or 'asc') | true | desc |
← Swipe to see more →
Examples
getBalances
const { ARIO } = require('@ar.io/sdk');
async function main() {
const ario = ARIO.init();
const balances = await ario.getBalances({
limit: 10,
sortBy: 'balance',
sortOrder: 'desc'
});
console.log(balances);
}
main();
Output
{
"items": [
{
"address": "t4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3",
"balance": 1000000000000
},
{
"address": "anotherWalletAddress",
"balance": 500000000000
}
],
"hasMore": true,
"nextCursor": "anotherWalletAddress",
"totalItems": 12567,
"sortBy": "balance",
"sortOrder": "desc"
}