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 →
ParameterTypeDescriptionOptionalDefault
cursorstring

The wallet address to use as the starting point for pagination

trueNone
limitnumber

The maximum number of balances to return (max: 1000)

true100
sortBystringThe property to sort balances bytruebalance
sortOrderstringThe sort direction ('desc' or 'asc')truedesc
← 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"
}