zcashname-sdk 0.2.0 → 0.2.1

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/dist/index.cjs CHANGED
@@ -36,6 +36,7 @@ __export(index_exports, {
36
36
  createClient: () => createClient,
37
37
  decodeBase64Url: () => decodeBase64Url,
38
38
  delistPayload: () => delistPayload,
39
+ events: () => events,
39
40
  getNonce: () => getNonce,
40
41
  isAvailable: () => isAvailable,
41
42
  isValidName: () => isValidName,
@@ -214,6 +215,9 @@ async function createClient(url = DEFAULT_URL, options = {}) {
214
215
  const result = await client.resolve(name);
215
216
  return result === null;
216
217
  },
218
+ async events(filter = {}) {
219
+ return call("events", filter);
220
+ },
217
221
  async getNonce(name) {
218
222
  const result = await client.resolve(name);
219
223
  return result?.nonce ?? null;
@@ -247,6 +251,9 @@ async function status() {
247
251
  async function isAvailable(name) {
248
252
  return (await getDefaultClient()).isAvailable(name);
249
253
  }
254
+ async function events(filter) {
255
+ return (await getDefaultClient()).events(filter);
256
+ }
250
257
  async function getNonce(name) {
251
258
  return (await getDefaultClient()).getNonce(name);
252
259
  }
@@ -268,6 +275,7 @@ async function getNonce(name) {
268
275
  createClient,
269
276
  decodeBase64Url,
270
277
  delistPayload,
278
+ events,
271
279
  getNonce,
272
280
  isAvailable,
273
281
  isValidName,
package/dist/index.d.cts CHANGED
@@ -26,6 +26,28 @@ interface StatusResult {
26
26
  registered: number;
27
27
  listed: number;
28
28
  }
29
+ interface Event {
30
+ id: number;
31
+ name: string;
32
+ action: "CLAIM" | "LIST" | "DELIST" | "UPDATE" | "BUY";
33
+ txid: string;
34
+ height: number;
35
+ ua: string | null;
36
+ price: number | null;
37
+ nonce: number | null;
38
+ signature: string | null;
39
+ }
40
+ interface EventsFilter {
41
+ name?: string;
42
+ action?: string | string[];
43
+ since_height?: number;
44
+ limit?: number;
45
+ offset?: number;
46
+ }
47
+ interface EventsResult {
48
+ events: Event[];
49
+ total: number;
50
+ }
29
51
 
30
52
  declare enum ErrorType {
31
53
  ParseError = -32700,
@@ -79,6 +101,7 @@ interface ZNSClient {
79
101
  resolve(query: string): Promise<ResolveResult | null>;
80
102
  listings(): Promise<Listing[]>;
81
103
  status(): Promise<StatusResult>;
104
+ events(filter?: EventsFilter): Promise<EventsResult>;
82
105
  isAvailable(name: string): Promise<boolean>;
83
106
  getNonce(name: string): Promise<number | null>;
84
107
  }
@@ -88,6 +111,7 @@ declare function resolve(query: string): Promise<ResolveResult | null>;
88
111
  declare function listings(): Promise<Listing[]>;
89
112
  declare function status(): Promise<StatusResult>;
90
113
  declare function isAvailable(name: string): Promise<boolean>;
114
+ declare function events(filter?: EventsFilter): Promise<EventsResult>;
91
115
  declare function getNonce(name: string): Promise<number | null>;
92
116
 
93
- export { CLAIM_PRICES, type ClientOptions, DEFAULT_CLAIM_PRICE, DEFAULT_URL, ErrorType, type ListForSaleResult, type Listing, type Registration, type ResolveResult, type StatusResult, UFVK, type ZNSClient, ZNSError, type Zip321Parts, buildBuyMemo, buildClaimMemo, buildDelistMemo, buildListMemo, buildUpdateMemo, buildZcashUri, claimCost, createClient, decodeBase64Url, delistPayload, getNonce, isAvailable, isValidName, listPayload, listings, parseZip321Uri, resolve, status, toBase64Url, updatePayload };
117
+ export { CLAIM_PRICES, type ClientOptions, DEFAULT_CLAIM_PRICE, DEFAULT_URL, ErrorType, type Event, type EventsFilter, type EventsResult, type ListForSaleResult, type Listing, type Registration, type ResolveResult, type StatusResult, UFVK, type ZNSClient, ZNSError, type Zip321Parts, buildBuyMemo, buildClaimMemo, buildDelistMemo, buildListMemo, buildUpdateMemo, buildZcashUri, claimCost, createClient, decodeBase64Url, delistPayload, events, getNonce, isAvailable, isValidName, listPayload, listings, parseZip321Uri, resolve, status, toBase64Url, updatePayload };
package/dist/index.d.ts CHANGED
@@ -26,6 +26,28 @@ interface StatusResult {
26
26
  registered: number;
27
27
  listed: number;
28
28
  }
29
+ interface Event {
30
+ id: number;
31
+ name: string;
32
+ action: "CLAIM" | "LIST" | "DELIST" | "UPDATE" | "BUY";
33
+ txid: string;
34
+ height: number;
35
+ ua: string | null;
36
+ price: number | null;
37
+ nonce: number | null;
38
+ signature: string | null;
39
+ }
40
+ interface EventsFilter {
41
+ name?: string;
42
+ action?: string | string[];
43
+ since_height?: number;
44
+ limit?: number;
45
+ offset?: number;
46
+ }
47
+ interface EventsResult {
48
+ events: Event[];
49
+ total: number;
50
+ }
29
51
 
30
52
  declare enum ErrorType {
31
53
  ParseError = -32700,
@@ -79,6 +101,7 @@ interface ZNSClient {
79
101
  resolve(query: string): Promise<ResolveResult | null>;
80
102
  listings(): Promise<Listing[]>;
81
103
  status(): Promise<StatusResult>;
104
+ events(filter?: EventsFilter): Promise<EventsResult>;
82
105
  isAvailable(name: string): Promise<boolean>;
83
106
  getNonce(name: string): Promise<number | null>;
84
107
  }
@@ -88,6 +111,7 @@ declare function resolve(query: string): Promise<ResolveResult | null>;
88
111
  declare function listings(): Promise<Listing[]>;
89
112
  declare function status(): Promise<StatusResult>;
90
113
  declare function isAvailable(name: string): Promise<boolean>;
114
+ declare function events(filter?: EventsFilter): Promise<EventsResult>;
91
115
  declare function getNonce(name: string): Promise<number | null>;
92
116
 
93
- export { CLAIM_PRICES, type ClientOptions, DEFAULT_CLAIM_PRICE, DEFAULT_URL, ErrorType, type ListForSaleResult, type Listing, type Registration, type ResolveResult, type StatusResult, UFVK, type ZNSClient, ZNSError, type Zip321Parts, buildBuyMemo, buildClaimMemo, buildDelistMemo, buildListMemo, buildUpdateMemo, buildZcashUri, claimCost, createClient, decodeBase64Url, delistPayload, getNonce, isAvailable, isValidName, listPayload, listings, parseZip321Uri, resolve, status, toBase64Url, updatePayload };
117
+ export { CLAIM_PRICES, type ClientOptions, DEFAULT_CLAIM_PRICE, DEFAULT_URL, ErrorType, type Event, type EventsFilter, type EventsResult, type ListForSaleResult, type Listing, type Registration, type ResolveResult, type StatusResult, UFVK, type ZNSClient, ZNSError, type Zip321Parts, buildBuyMemo, buildClaimMemo, buildDelistMemo, buildListMemo, buildUpdateMemo, buildZcashUri, claimCost, createClient, decodeBase64Url, delistPayload, events, getNonce, isAvailable, isValidName, listPayload, listings, parseZip321Uri, resolve, status, toBase64Url, updatePayload };
package/dist/index.js CHANGED
@@ -163,6 +163,9 @@ async function createClient(url = DEFAULT_URL, options = {}) {
163
163
  const result = await client.resolve(name);
164
164
  return result === null;
165
165
  },
166
+ async events(filter = {}) {
167
+ return call("events", filter);
168
+ },
166
169
  async getNonce(name) {
167
170
  const result = await client.resolve(name);
168
171
  return result?.nonce ?? null;
@@ -196,6 +199,9 @@ async function status() {
196
199
  async function isAvailable(name) {
197
200
  return (await getDefaultClient()).isAvailable(name);
198
201
  }
202
+ async function events(filter) {
203
+ return (await getDefaultClient()).events(filter);
204
+ }
199
205
  async function getNonce(name) {
200
206
  return (await getDefaultClient()).getNonce(name);
201
207
  }
@@ -216,6 +222,7 @@ export {
216
222
  createClient,
217
223
  decodeBase64Url,
218
224
  delistPayload,
225
+ events,
219
226
  getNonce,
220
227
  isAvailable,
221
228
  isValidName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zcashname-sdk",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "description": "TypeScript SDK for the Zcash Name System (ZNS) JSON-RPC API",
6
6
  "main": "dist/index.js",
@@ -13,7 +13,9 @@
13
13
  "require": "./dist/index.js"
14
14
  }
15
15
  },
16
- "files": ["dist"],
16
+ "files": [
17
+ "dist"
18
+ ],
17
19
  "scripts": {
18
20
  "build": "tsup src/index.ts --format cjs,esm --dts",
19
21
  "test": "vitest run",