From b4edf4768ed6d22325bb3328d9724703fa17c89a Mon Sep 17 00:00:00 2001 From: dtfiedler Date: Thu, 28 Nov 2024 10:09:58 -0600 Subject: [PATCH 1/2] fix(primary): support primary name in token cost API --- src/common/io.ts | 17 +++++++++++++++-- src/types/io.ts | 11 ++++++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/common/io.ts b/src/common/io.ts index ce286201..8105ecae 100644 --- a/src/common/io.ts +++ b/src/common/io.ts @@ -454,6 +454,14 @@ export class IOReadable implements AoIORead { quantity: number; name: string; }): Promise; + async getTokenCost(params: { + intent: 'Upgrade-Name'; + name: string; + }): Promise; + async getTokenCost(params: { + intent: 'Primary-Name-Request'; + name: string; + }): Promise; async getTokenCost({ intent, type, @@ -461,10 +469,15 @@ export class IOReadable implements AoIORead { name, quantity, }: { - intent: 'Buy-Record' | 'Extend-Lease' | 'Increase-Undername-Limit'; + intent: + | 'Buy-Record' + | 'Extend-Lease' + | 'Increase-Undername-Limit' + | 'Upgrade-Name' + | 'Primary-Name-Request'; type?: 'permabuy' | 'lease'; years?: number; - name?: string; + name: string; quantity?: number; }): Promise { const allTags = [ diff --git a/src/types/io.ts b/src/types/io.ts index cab7588b..61bfbf0f 100644 --- a/src/types/io.ts +++ b/src/types/io.ts @@ -417,12 +417,17 @@ export interface AoIORead { name, quantity, }: { - intent: 'Buy-Record' | 'Extend-Lease' | 'Increase-Undername-Limit'; + intent: + | 'Buy-Record' + | 'Extend-Lease' + | 'Increase-Undername-Limit' + | 'Upgrade-Name' + | 'Primary-Name-Request'; type?: 'permabuy' | 'lease'; years?: number; - name?: string; + name: string; quantity?: number; - }): Promise; + }): Promise; // TODO: add getCostDetails API that provides funding cost and discount details getRegistrationFees(): Promise; getDemandFactor(): Promise; getVaults( From 8fb1f2425364221cf0a56248c9e78ea0a5ef06e3 Mon Sep 17 00:00:00 2001 From: dtfiedler Date: Thu, 28 Nov 2024 10:18:26 -0600 Subject: [PATCH 2/2] chore(docs): update docs --- README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 25072fde..dfb23716 100644 --- a/README.md +++ b/README.md @@ -1577,13 +1577,15 @@ const observers = await io.getPrescribedObservers({ epochIndex: 0 }); #### `getPrimaryNames({ cursor, limit, sortBy, sortOrder })` -Retrieves all primary names across all gateways, paginated and sorted by the specified criteria. The `cursor` used for pagination is the last name from the previous request. +Retrieves all primary names paginated and sorted by the specified criteria. The `cursor` used for pagination is the last name from the previous request. ```typescript const io = IO.init(); const names = await io.getPrimaryNames({ - cursor: 'ar-io', - limit: 2, + cursor: 'ao', // this is the last name from the previous request + limit: 1, + sortBy: 'startTimestamp', + sortOrder: 'desc', }); ``` @@ -1593,10 +1595,10 @@ const names = await io.getPrimaryNames({ ```json { "sortOrder": "desc", - "hasMore": false, - "totalItems": 1, - "limit": 100, - "sortBy": "name", + "hasMore": true, + "totalItems": 100, + "limit": 1, + "sortBy": "startTimestamp", "items": [ { "owner": "HwFceQaMQnOBgKDpnFqCqgwKwEU5LBme1oXRuQOWSRA",