zcashname-sdk 0.6.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -72,21 +72,36 @@ console.log("Memo:", memo);
72
72
  ## Reading Data
73
73
 
74
74
  ```ts
75
- // Resolve name → address
75
+ // Resolve name → address (single lookup)
76
76
  const reg = await zns.resolveName("alice");
77
77
 
78
- // Resolve address → names (reverse lookup)
78
+ // Resolve address → names (reverse lookup) - supports pagination
79
79
  const names = await zns.resolveAddress("u1qqlzrf9...");
80
80
 
81
+ // Paginated address lookup (get next 50 names starting from position 50)
82
+ const namesPage2 = await zns.resolveAddress("u1qqlzrf9...", 50, 50);
83
+
84
+ // List all registered names (paginated) - useful for explorers
85
+ const allNames = await zns.listAllRegistrations();
86
+
87
+ // Paginated list (first 100 registrations)
88
+ const first100 = await zns.listAllRegistrations(100, 0);
89
+
81
90
  // Check availability
82
91
  const available = await zns.isAvailable("bob");
83
92
 
84
- // Get all listings
93
+ // Get marketplace listings - supports pagination
85
94
  const listings = await zns.listings();
86
95
 
87
- // Query events
96
+ // Paginated listings (get 50 listings starting from position 100)
97
+ const listingsPage3 = await zns.listings(50, 100);
98
+
99
+ // Query events with pagination
88
100
  const { events, total } = await zns.events({ action: "CLAIM", limit: 10 });
89
101
 
102
+ // Next page of events
103
+ const nextPage = await zns.events({ action: "CLAIM", limit: 10, offset: 10 });
104
+
90
105
  // Get current pricing from status
91
106
  const status = await zns.status();
92
107
  const cost = zns.claimCost(5, status.pricing); // cost for 5-char name
package/dist/zns.cjs CHANGED
@@ -93,9 +93,23 @@ var ZNS = class {
93
93
  async resolveName(name) {
94
94
  return this.rpc("resolve", { query: name });
95
95
  }
96
- /** Resolve a Zcash Unified Address to all names pointing to it. Returns empty array if none. */
97
- async resolveAddress(address) {
98
- return this.rpc("resolve", { query: address });
96
+ /** Resolve a Zcash Unified Address to all names pointing to it. Returns empty array if none.
97
+ * Supports pagination with limit (default 50, max 500) and offset (default 0). */
98
+ async resolveAddress(address, limit, offset) {
99
+ return this.rpc("resolve", {
100
+ query: address,
101
+ limit,
102
+ offset
103
+ });
104
+ }
105
+ /** List all registered names. Useful for explorers or browsers.
106
+ * Supports pagination with limit (default 50, max 500) and offset (default 0). */
107
+ async listAllRegistrations(limit, offset) {
108
+ return this.rpc("resolve", {
109
+ query: "",
110
+ limit,
111
+ offset
112
+ });
99
113
  }
100
114
  /** Check if a name is available for registration.
101
115
  * Returns false immediately for invalid names without hitting the server. */
@@ -119,9 +133,12 @@ var ZNS = class {
119
133
  return false;
120
134
  }
121
135
  }
122
- async listings() {
123
- const result = await this.rpc("list_for_sale");
124
- return result.listings;
136
+ async listings(limit, offset) {
137
+ const result = await this.rpc("listings", {
138
+ limit,
139
+ offset
140
+ });
141
+ return result;
125
142
  }
126
143
  async events(filter) {
127
144
  return this.rpc(
package/dist/zns.d.cts CHANGED
@@ -150,8 +150,12 @@ declare class ZNS {
150
150
  status(): Promise<Status>;
151
151
  /** Resolve a ZNS name to its registration. Returns null if not registered. */
152
152
  resolveName(name: string): Promise<Registration | null>;
153
- /** Resolve a Zcash Unified Address to all names pointing to it. Returns empty array if none. */
154
- resolveAddress(address: string): Promise<Registration[]>;
153
+ /** Resolve a Zcash Unified Address to all names pointing to it. Returns empty array if none.
154
+ * Supports pagination with limit (default 50, max 500) and offset (default 0). */
155
+ resolveAddress(address: string, limit?: number, offset?: number): Promise<Registration[]>;
156
+ /** List all registered names. Useful for explorers or browsers.
157
+ * Supports pagination with limit (default 50, max 500) and offset (default 0). */
158
+ listAllRegistrations(limit?: number, offset?: number): Promise<Registration[]>;
155
159
  /** Check if a name is available for registration.
156
160
  * Returns false immediately for invalid names without hitting the server. */
157
161
  isAvailable(name: string): Promise<boolean>;
@@ -160,7 +164,10 @@ declare class ZNS {
160
164
  * Performs basic format validation but NOT full bech32m checksum verification.
161
165
  * Returns true if the address looks like a unified address, false otherwise. */
162
166
  isValidUnifiedAddress(address: string): boolean;
163
- listings(): Promise<Listing[]>;
167
+ listings(limit?: number, offset?: number): Promise<{
168
+ listings: Listing[];
169
+ total: number;
170
+ }>;
164
171
  events(filter?: EventsFilter): Promise<EventsResult>;
165
172
  /**
166
173
  * Verify a listing's signature.
package/dist/zns.d.ts CHANGED
@@ -150,8 +150,12 @@ declare class ZNS {
150
150
  status(): Promise<Status>;
151
151
  /** Resolve a ZNS name to its registration. Returns null if not registered. */
152
152
  resolveName(name: string): Promise<Registration | null>;
153
- /** Resolve a Zcash Unified Address to all names pointing to it. Returns empty array if none. */
154
- resolveAddress(address: string): Promise<Registration[]>;
153
+ /** Resolve a Zcash Unified Address to all names pointing to it. Returns empty array if none.
154
+ * Supports pagination with limit (default 50, max 500) and offset (default 0). */
155
+ resolveAddress(address: string, limit?: number, offset?: number): Promise<Registration[]>;
156
+ /** List all registered names. Useful for explorers or browsers.
157
+ * Supports pagination with limit (default 50, max 500) and offset (default 0). */
158
+ listAllRegistrations(limit?: number, offset?: number): Promise<Registration[]>;
155
159
  /** Check if a name is available for registration.
156
160
  * Returns false immediately for invalid names without hitting the server. */
157
161
  isAvailable(name: string): Promise<boolean>;
@@ -160,7 +164,10 @@ declare class ZNS {
160
164
  * Performs basic format validation but NOT full bech32m checksum verification.
161
165
  * Returns true if the address looks like a unified address, false otherwise. */
162
166
  isValidUnifiedAddress(address: string): boolean;
163
- listings(): Promise<Listing[]>;
167
+ listings(limit?: number, offset?: number): Promise<{
168
+ listings: Listing[];
169
+ total: number;
170
+ }>;
164
171
  events(filter?: EventsFilter): Promise<EventsResult>;
165
172
  /**
166
173
  * Verify a listing's signature.
package/dist/zns.js CHANGED
@@ -56,9 +56,23 @@ var ZNS = class {
56
56
  async resolveName(name) {
57
57
  return this.rpc("resolve", { query: name });
58
58
  }
59
- /** Resolve a Zcash Unified Address to all names pointing to it. Returns empty array if none. */
60
- async resolveAddress(address) {
61
- return this.rpc("resolve", { query: address });
59
+ /** Resolve a Zcash Unified Address to all names pointing to it. Returns empty array if none.
60
+ * Supports pagination with limit (default 50, max 500) and offset (default 0). */
61
+ async resolveAddress(address, limit, offset) {
62
+ return this.rpc("resolve", {
63
+ query: address,
64
+ limit,
65
+ offset
66
+ });
67
+ }
68
+ /** List all registered names. Useful for explorers or browsers.
69
+ * Supports pagination with limit (default 50, max 500) and offset (default 0). */
70
+ async listAllRegistrations(limit, offset) {
71
+ return this.rpc("resolve", {
72
+ query: "",
73
+ limit,
74
+ offset
75
+ });
62
76
  }
63
77
  /** Check if a name is available for registration.
64
78
  * Returns false immediately for invalid names without hitting the server. */
@@ -82,9 +96,12 @@ var ZNS = class {
82
96
  return false;
83
97
  }
84
98
  }
85
- async listings() {
86
- const result = await this.rpc("list_for_sale");
87
- return result.listings;
99
+ async listings(limit, offset) {
100
+ const result = await this.rpc("listings", {
101
+ limit,
102
+ offset
103
+ });
104
+ return result;
88
105
  }
89
106
  async events(filter) {
90
107
  return this.rpc(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zcashname-sdk",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "description": "TypeScript SDK for the Zcash Name System (ZNS)",
6
6
  "main": "dist/zns.cjs",