getArNSRecords
getArNSRecords
is a method on the ARIO
class that retrieves all registered ArNS records, with support for pagination and custom sorting. Pagination is handled using a cursor system, where the cursor is the ArNS name from the last record of the previous request.
getArNSRecords
does not require authentication.
Parameters
Parameter | Type | Description | Optional | Default |
---|---|---|---|---|
cursor | string | The ArNS name to use as the starting point for the next page of results | true | None |
limit | number | The maximum number of records to return (max: 1000) | true | 100 |
sortBy | string | The property to sort results by | true | startTimestamp |
sortOrder | string | The sort direction ('desc' or 'asc') | true | desc |
Example
getArNSRecords
const { ARIO } = require('@ar.io/sdk');
async function main() {
const ario = ARIO.init();
// get the newest 100 names
const records = await ario.getArNSRecords({
limit: 100,
sortBy: 'startTimestamp',
sortOrder: 'desc',
});
console.log(records);
}
main();
Output
{
"items": [
{
"name": "ao",
"processId": "eNey-H9RB9uCdoJUvPULb35qhZVXZcEXv8xds4aHhkQ",
"purchasePrice": 75541282285,
"startTimestamp": 1720720621424,
"type": "permabuy",
"undernames": 10
},
{
"name": "ardrive",
"processId": "bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM",
"endTimestamp": 1720720819969,
"startTimestamp": 1720720620813,
"type": "lease",
"undernames": 100
},
{
"name": "arweave",
"processId": "bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM",
"endTimestamp": 1720720819969,
"startTimestamp": 1720720620800,
"type": "lease",
"undernames": 100
},
{
"name": "ar-io",
"processId": "bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM",
"endTimestamp": 1720720819969,
"startTimestamp": 1720720619000,
"type": "lease",
"undernames": 100
},
{
"name": "fwd",
"processId": "bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM",
"endTimestamp": 1720720819969,
"startTimestamp": 1720720220811,
"type": "lease",
"undernames": 100
}
// ...95 other records
],
"hasMore": true,
"nextCursor": "fwdresearch",
"totalItems": 21740,
"sortBy": "startTimestamp",
"sortOrder": "desc"
}