getDelegations
getDelegations
is a method on the ARIO
class that retrieves all active and vaulted stakes across all gateways for a specific address, paginated and sorted by the specified criteria. The cursor
used for pagination is the last delegationId (concatenated gateway and startTimestamp of the delegation) from the previous request.
getDelegations
does not require authentication.
Parameters
Parameter | Type | Description | Optional |
---|---|---|---|
address | string - WalletAddress | Public wallet address of target gateway. | false |
cursor | string | Cursor used for paginated results | true |
limit | number | Max number of results to return in a single search. Max is 1000. | true |
sortBy | string | Property used to sort returned results | true |
sortOrder | string | Order in which sorted results are returned. valid values are `desc` or `asc` | true |
Example
getDelegations
const { ARIO } = require('@ar.io/sdk');
async function main() {
const ario = ARIO.init();
const vaults = await ario.getDelegations({
address: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
cursor: 'QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ_123456789',
limit: 2,
sortBy: 'startTimestamp',
sortOrder: 'asc',
});
console.log(vaults);
}
main();
Output
{
"sortOrder": "asc",
"hasMore": true,
"totalItems": 95,
"limit": 2,
"sortBy": "startTimestamp",
"items": [
{
"type": "stake",
"startTimestamp": 1727815440632,
"gatewayAddress": "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ",
"delegationId": "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ_1727815440632",
"balance": 1383212512
},
{
"type": "vault",
"startTimestamp": 1730996691117,
"gatewayAddress": "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ",
"delegationId": "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ_1730996691117",
"vaultId": "_sGDS7X1hyLCVpfe40GWioH9BSOb7f0XWbhHBa1q4-g",
"balance": 50000000,
"endTimestamp": 1733588691117
}
],
"nextCursor": "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ_1730996691117"
}