zcashname-sdk 0.8.2 → 0.8.4
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/zns.cjs +128 -36
- package/dist/zns.d.cts +42 -29
- package/dist/zns.d.ts +42 -29
- package/dist/zns.js +126 -35
- package/package.json +2 -2
package/dist/zns.cjs
CHANGED
|
@@ -35,7 +35,8 @@ __export(zns_exports, {
|
|
|
35
35
|
LIST_COMMISSION: () => LIST_COMMISSION,
|
|
36
36
|
MAINNET_UIVK: () => MAINNET_UIVK,
|
|
37
37
|
TESTNET_UIVK: () => TESTNET_UIVK,
|
|
38
|
-
ZNS: () => ZNS
|
|
38
|
+
ZNS: () => ZNS,
|
|
39
|
+
ZNS_ACTIONS: () => ZNS_ACTIONS
|
|
39
40
|
});
|
|
40
41
|
module.exports = __toCommonJS(zns_exports);
|
|
41
42
|
var ed25519 = __toESM(require("@noble/ed25519"), 1);
|
|
@@ -44,16 +45,99 @@ var import_bech32 = require("bech32");
|
|
|
44
45
|
// src/types.ts
|
|
45
46
|
var BUY_COMMISSION = 1e4;
|
|
46
47
|
var LIST_COMMISSION = 1e6;
|
|
48
|
+
function toPendingBuy(raw) {
|
|
49
|
+
return {
|
|
50
|
+
buyer: raw.buyer_ua,
|
|
51
|
+
price: raw.price,
|
|
52
|
+
claimHeight: raw.claim_height,
|
|
53
|
+
expiresAt: raw.expires_at,
|
|
54
|
+
txid: raw.txid
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function toListing(raw) {
|
|
58
|
+
return {
|
|
59
|
+
name: raw.name,
|
|
60
|
+
price: raw.price,
|
|
61
|
+
payTaddr: raw.pay_taddr,
|
|
62
|
+
nonce: raw.nonce,
|
|
63
|
+
txid: raw.txid,
|
|
64
|
+
height: raw.height,
|
|
65
|
+
signature: raw.signature,
|
|
66
|
+
pubkey: raw.pubkey,
|
|
67
|
+
pendingBuy: raw.pending_buy ? toPendingBuy(raw.pending_buy) : void 0
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function toRegistration(raw) {
|
|
71
|
+
return {
|
|
72
|
+
name: raw.name,
|
|
73
|
+
address: raw.address,
|
|
74
|
+
txid: raw.txid,
|
|
75
|
+
height: raw.height,
|
|
76
|
+
nonce: raw.nonce,
|
|
77
|
+
signature: raw.signature,
|
|
78
|
+
lastAction: raw.last_action,
|
|
79
|
+
pubkey: raw.pubkey,
|
|
80
|
+
listing: raw.listing ? toListing(raw.listing) : null
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function toPricing(raw) {
|
|
84
|
+
return {
|
|
85
|
+
nonce: raw.nonce,
|
|
86
|
+
height: raw.height,
|
|
87
|
+
tiers: raw.tiers
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function toStatus(raw) {
|
|
91
|
+
return {
|
|
92
|
+
syncedHeight: raw.synced_height,
|
|
93
|
+
adminPubkey: raw.admin_pubkey,
|
|
94
|
+
uivk: raw.uivk,
|
|
95
|
+
address: raw.address,
|
|
96
|
+
registered: raw.registered,
|
|
97
|
+
listed: raw.listed,
|
|
98
|
+
pricing: raw.pricing ? toPricing(raw.pricing) : null
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function toEvent(raw) {
|
|
102
|
+
return {
|
|
103
|
+
id: raw.id,
|
|
104
|
+
name: raw.name,
|
|
105
|
+
action: raw.action,
|
|
106
|
+
txid: raw.txid,
|
|
107
|
+
height: raw.height,
|
|
108
|
+
ua: raw.ua,
|
|
109
|
+
price: raw.price,
|
|
110
|
+
nonce: raw.nonce,
|
|
111
|
+
signature: raw.signature,
|
|
112
|
+
pubkey: raw.pubkey
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function toEventsFilter(raw) {
|
|
116
|
+
return {
|
|
117
|
+
name: raw.name,
|
|
118
|
+
action: raw.action,
|
|
119
|
+
since_height: raw.sinceHeight,
|
|
120
|
+
limit: raw.limit,
|
|
121
|
+
offset: raw.offset
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function toEventsResult(raw) {
|
|
125
|
+
return {
|
|
126
|
+
events: raw.events.map(toEvent),
|
|
127
|
+
total: raw.total
|
|
128
|
+
};
|
|
129
|
+
}
|
|
47
130
|
|
|
48
131
|
// src/zns.ts
|
|
49
132
|
var DEFAULT_URL = "https://light.zcash.me/zns-testnet";
|
|
50
|
-
var TESTNET_UIVK = "
|
|
51
|
-
var MAINNET_UIVK = "
|
|
133
|
+
var TESTNET_UIVK = "utest1hzw7wyadutvzfgpna80yftsk5l7jeyu2p5me5quvp28tytxueta00cx4068wnlzcv7tx9n3t3gfhsy83pe4y6jrhxtzaq0hj6xtg5zrk2dn7zen3vns2a5pgs4fxdjlletmqrhfa42";
|
|
134
|
+
var MAINNET_UIVK = "u1k0evt0ahj5qdt6y9ftsxndl8lrkm4ff6rp00u04cjpmqj6hxl9t8hfsxftmn3ht34e03lljh89czn2h8qn67rwrs8x0hm3lsxsucp9q9";
|
|
52
135
|
var KNOWN_UIVKS = [TESTNET_UIVK, MAINNET_UIVK];
|
|
53
136
|
var REGISTRY_ADDRESSES = {
|
|
54
137
|
testnet: "utest1f32kn6c4zvn54xr8wfsnxmj9hzpu2mwgtxzpzwcw34906tdccdvzs0z2dx38lly7tpan77x6udt8pjczqm22ymsdhlz9j0tk5yq664nl",
|
|
55
138
|
mainnet: "u1k0evt0ahj5qdt6y9ftsxndl8lrkm4ff6rp00u04cjpmqj6hxl9t8hfsxftmn3ht34e03lljh89czn2h8qn67rwrs8x0hm3lsxsucp9q9"
|
|
56
139
|
};
|
|
140
|
+
var ZNS_ACTIONS = ["CLAIM", "BUY", "UPDATE", "LIST", "DELIST", "RELEASE"];
|
|
57
141
|
var NAME_RE = /^[a-z0-9]{1,62}$/;
|
|
58
142
|
function isWholeNumber(value) {
|
|
59
143
|
return /^\d+$/.test(value) && !value.startsWith("0") || value === "0";
|
|
@@ -79,7 +163,7 @@ var ZNS = class {
|
|
|
79
163
|
* @throws Error if the server's UIVK is not recognized
|
|
80
164
|
*/
|
|
81
165
|
async verify() {
|
|
82
|
-
const status = await this.
|
|
166
|
+
const status = await this.status();
|
|
83
167
|
if (!KNOWN_UIVKS.includes(status.uivk)) {
|
|
84
168
|
throw new Error(
|
|
85
169
|
`UIVK mismatch: indexer returned "${status.uivk.slice(0, 20)}..." which is not a known ZNS instance`
|
|
@@ -101,29 +185,33 @@ var ZNS = class {
|
|
|
101
185
|
}
|
|
102
186
|
/** Fetch current server status including pricing and configuration. */
|
|
103
187
|
async status() {
|
|
104
|
-
|
|
188
|
+
const raw = await this.rpc("status");
|
|
189
|
+
return toStatus(raw);
|
|
105
190
|
}
|
|
106
191
|
/** Resolve a ZNS name to its registration. Returns null if not registered. */
|
|
107
192
|
async resolveName(name) {
|
|
108
|
-
|
|
193
|
+
const raw = await this.rpc("resolve", { query: name });
|
|
194
|
+
return raw ? toRegistration(raw) : null;
|
|
109
195
|
}
|
|
110
196
|
/** Resolve a Zcash Unified Address to all names pointing to it. Returns empty array if none.
|
|
111
197
|
* Supports pagination with limit (default 50, max 500) and offset (default 0). */
|
|
112
198
|
async resolveAddress(address, limit, offset) {
|
|
113
|
-
|
|
199
|
+
const raw = await this.rpc("resolve", {
|
|
114
200
|
query: address,
|
|
115
201
|
limit,
|
|
116
202
|
offset
|
|
117
203
|
});
|
|
204
|
+
return raw.map(toRegistration);
|
|
118
205
|
}
|
|
119
206
|
/** List all registered names. Useful for explorers or browsers.
|
|
120
207
|
* Supports pagination with limit (default 50, max 500) and offset (default 0). */
|
|
121
208
|
async listAllRegistrations(limit, offset) {
|
|
122
|
-
|
|
209
|
+
const raw = await this.rpc("resolve", {
|
|
123
210
|
query: "",
|
|
124
211
|
limit,
|
|
125
212
|
offset
|
|
126
213
|
});
|
|
214
|
+
return raw.map(toRegistration);
|
|
127
215
|
}
|
|
128
216
|
/** Check if a name is available for registration.
|
|
129
217
|
* Returns false immediately for invalid names without hitting the server. */
|
|
@@ -152,13 +240,33 @@ var ZNS = class {
|
|
|
152
240
|
limit,
|
|
153
241
|
offset
|
|
154
242
|
});
|
|
155
|
-
return
|
|
243
|
+
return {
|
|
244
|
+
listings: result.listings.map((l) => ({
|
|
245
|
+
name: l.name,
|
|
246
|
+
price: l.price,
|
|
247
|
+
payTaddr: l.pay_taddr,
|
|
248
|
+
nonce: l.nonce,
|
|
249
|
+
txid: l.txid,
|
|
250
|
+
height: l.height,
|
|
251
|
+
signature: l.signature,
|
|
252
|
+
pubkey: l.pubkey,
|
|
253
|
+
pendingBuy: l.pending_buy ? {
|
|
254
|
+
buyer: l.pending_buy.buyer_ua,
|
|
255
|
+
price: l.pending_buy.price,
|
|
256
|
+
claimHeight: l.pending_buy.claim_height,
|
|
257
|
+
expiresAt: l.pending_buy.expires_at,
|
|
258
|
+
txid: l.pending_buy.txid
|
|
259
|
+
} : void 0
|
|
260
|
+
})),
|
|
261
|
+
total: result.total
|
|
262
|
+
};
|
|
156
263
|
}
|
|
157
264
|
async events(filter) {
|
|
158
|
-
|
|
265
|
+
const raw = await this.rpc(
|
|
159
266
|
"events",
|
|
160
|
-
filter ?? {}
|
|
267
|
+
toEventsFilter(filter ?? {})
|
|
161
268
|
);
|
|
269
|
+
return toEventsResult(raw);
|
|
162
270
|
}
|
|
163
271
|
/**
|
|
164
272
|
* Verify a listing's signature.
|
|
@@ -168,7 +276,7 @@ var ZNS = class {
|
|
|
168
276
|
*/
|
|
169
277
|
async verifyListing(listing, adminPubkey) {
|
|
170
278
|
const pubkey = listing.pubkey ?? adminPubkey;
|
|
171
|
-
const payload = `LIST:${listing.name}:${listing.price}:${listing.
|
|
279
|
+
const payload = `LIST:${listing.name}:${listing.price}:${listing.payTaddr}:${listing.nonce}`;
|
|
172
280
|
return this.verifyEd25519(payload, listing.signature, pubkey);
|
|
173
281
|
}
|
|
174
282
|
/**
|
|
@@ -292,29 +400,12 @@ var ZNS = class {
|
|
|
292
400
|
return mk("invalid", actionUpper, "release", `Nonce must be a whole number.`);
|
|
293
401
|
return mk("valid", actionUpper, "release", "Valid RELEASE payload.");
|
|
294
402
|
}
|
|
295
|
-
case "setprice": {
|
|
296
|
-
if (parts.length < 3)
|
|
297
|
-
return mk("invalid", actionUpper, "setprice", `Expected SETPRICE:<count>:<tier1>:...:<nonce>.`);
|
|
298
|
-
const count = Number(parts[0]);
|
|
299
|
-
if (!isWholeNumber(parts[0]) || isNaN(count) || count <= 0)
|
|
300
|
-
return mk("invalid", actionUpper, "setprice", `Count must be a positive whole number.`);
|
|
301
|
-
const priceCount = parts.length - 2;
|
|
302
|
-
if (priceCount !== count)
|
|
303
|
-
return mk("invalid", actionUpper, "setprice", `SETPRICE count mismatch: header is ${count} but found ${priceCount} price tiers.`);
|
|
304
|
-
if (!isWholeNumber(parts[parts.length - 1]))
|
|
305
|
-
return mk("invalid", actionUpper, "setprice", `Nonce must be a whole number.`);
|
|
306
|
-
for (let i = 1; i < parts.length - 1; i++) {
|
|
307
|
-
if (!isWholeNumber(parts[i]) || Number(parts[i]) <= 0)
|
|
308
|
-
return mk("invalid", actionUpper, "setprice", `Tier ${i} must be a positive whole number in zats.`);
|
|
309
|
-
}
|
|
310
|
-
return mk("valid", actionUpper, "setprice", "Valid SETPRICE payload.");
|
|
311
|
-
}
|
|
312
403
|
default:
|
|
313
404
|
return {
|
|
314
405
|
valid: false,
|
|
315
406
|
action: actionUpper,
|
|
316
407
|
canonicalAction: null,
|
|
317
|
-
message: `Unrecognized action "${actionUpper}". Valid actions:
|
|
408
|
+
message: `Unrecognized action "${actionUpper}". Valid actions: ${ZNS_ACTIONS.join(", ")}.`,
|
|
318
409
|
level: "unrecognized"
|
|
319
410
|
};
|
|
320
411
|
}
|
|
@@ -375,16 +466,16 @@ var ZNS = class {
|
|
|
375
466
|
}
|
|
376
467
|
};
|
|
377
468
|
}
|
|
378
|
-
prepareList(name, price,
|
|
469
|
+
prepareList(name, price, payTaddr, nonce) {
|
|
379
470
|
this.requireValidName(name);
|
|
380
471
|
return {
|
|
381
472
|
name,
|
|
382
473
|
price,
|
|
383
|
-
|
|
474
|
+
payTaddr,
|
|
384
475
|
nonce,
|
|
385
|
-
payload: `LIST:${name}:${price}:${
|
|
476
|
+
payload: `LIST:${name}:${price}:${payTaddr}:${nonce}`,
|
|
386
477
|
complete: (signature, userPubkey) => {
|
|
387
|
-
const memo = userPubkey ? `ZNS:LIST:${name}:${price}:${
|
|
478
|
+
const memo = userPubkey ? `ZNS:LIST:${name}:${price}:${payTaddr}:${nonce}:${signature}:${userPubkey}` : `ZNS:LIST:${name}:${price}:${payTaddr}:${nonce}:${signature}`;
|
|
388
479
|
return { memo, uri: this.buildZcashUri(this.registryAddress, LIST_COMMISSION, memo) };
|
|
389
480
|
}
|
|
390
481
|
};
|
|
@@ -458,7 +549,7 @@ var ZNS = class {
|
|
|
458
549
|
}
|
|
459
550
|
// ── Private helpers ────────────────────────────────────────────────────────
|
|
460
551
|
registrationPayload(reg) {
|
|
461
|
-
switch (reg.
|
|
552
|
+
switch (reg.lastAction) {
|
|
462
553
|
case "CLAIM":
|
|
463
554
|
return `CLAIM:${reg.name}:${reg.address}`;
|
|
464
555
|
case "BUY":
|
|
@@ -553,5 +644,6 @@ var ZNS = class {
|
|
|
553
644
|
LIST_COMMISSION,
|
|
554
645
|
MAINNET_UIVK,
|
|
555
646
|
TESTNET_UIVK,
|
|
556
|
-
ZNS
|
|
647
|
+
ZNS,
|
|
648
|
+
ZNS_ACTIONS
|
|
557
649
|
});
|
package/dist/zns.d.cts
CHANGED
|
@@ -1,59 +1,67 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
1
|
+
/**
|
|
2
|
+
* Internal types that mirror the Rust indexer API exactly (snake_case).
|
|
3
|
+
* These are used for raw data passthrough and debugging.
|
|
4
|
+
* Public SDK consumers should use the camelCase types exported below.
|
|
5
|
+
*/
|
|
4
6
|
type Zats = number;
|
|
5
7
|
/** Commission sent with a BUY claim memo (0.0001 ZEC = 10,000 zats). */
|
|
6
8
|
declare const BUY_COMMISSION: Zats;
|
|
7
9
|
/** Listing commission sent with a LIST memo (0.01 ZEC = 1,000,000 zats).
|
|
8
10
|
* Mirrors the indexer's formula: min_tier × 1000. */
|
|
9
11
|
declare const LIST_COMMISSION: Zats;
|
|
10
|
-
interface Registration {
|
|
11
|
-
name: string;
|
|
12
|
-
address: string;
|
|
13
|
-
txid: string;
|
|
14
|
-
height: number;
|
|
15
|
-
nonce: number;
|
|
16
|
-
signature: string | null;
|
|
17
|
-
last_action: LastAction;
|
|
18
|
-
pubkey: string | null;
|
|
19
|
-
listing: Listing | null;
|
|
20
|
-
}
|
|
21
12
|
/** Actions that can be the 'last action' on a Registration (ownership-changing actions) */
|
|
22
13
|
type LastAction = "CLAIM" | "BUY" | "UPDATE" | "DELIST" | "RELEASE";
|
|
23
14
|
/** All actions that can appear in the Event log (includes non-ownership actions like LIST) */
|
|
24
15
|
type EventAction = "CLAIM" | "LIST" | "DELIST" | "RELEASE" | "UPDATE" | "BUY" | "SETPRICE";
|
|
16
|
+
/** Pending purchase for a listed name. */
|
|
17
|
+
interface PendingBuy {
|
|
18
|
+
buyer: string;
|
|
19
|
+
price: Zats;
|
|
20
|
+
claimHeight: number;
|
|
21
|
+
expiresAt: number;
|
|
22
|
+
txid: string;
|
|
23
|
+
}
|
|
24
|
+
/** A name listing in the marketplace. */
|
|
25
25
|
interface Listing {
|
|
26
26
|
name: string;
|
|
27
27
|
price: Zats;
|
|
28
|
-
|
|
28
|
+
payTaddr: string;
|
|
29
29
|
nonce: number;
|
|
30
30
|
txid: string;
|
|
31
31
|
height: number;
|
|
32
32
|
signature: string;
|
|
33
33
|
pubkey: string | null;
|
|
34
|
-
|
|
34
|
+
pendingBuy: PendingBuy | undefined;
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
expires_at: number;
|
|
36
|
+
/** A registered ZNS name. */
|
|
37
|
+
interface Registration {
|
|
38
|
+
name: string;
|
|
39
|
+
address: string;
|
|
41
40
|
txid: string;
|
|
41
|
+
height: number;
|
|
42
|
+
nonce: number;
|
|
43
|
+
signature: string | null;
|
|
44
|
+
lastAction: LastAction;
|
|
45
|
+
pubkey: string | null;
|
|
46
|
+
listing: Listing | null;
|
|
42
47
|
}
|
|
48
|
+
/** Pricing tiers for name registration. */
|
|
43
49
|
interface Pricing {
|
|
44
50
|
nonce: number;
|
|
45
51
|
height: number;
|
|
46
52
|
tiers: Zats[];
|
|
47
53
|
}
|
|
54
|
+
/** Current indexer status including pricing configuration. */
|
|
48
55
|
interface Status {
|
|
49
|
-
|
|
50
|
-
|
|
56
|
+
syncedHeight: number;
|
|
57
|
+
adminPubkey: string;
|
|
51
58
|
uivk: string;
|
|
52
59
|
address: string;
|
|
53
60
|
registered: number;
|
|
54
61
|
listed: number;
|
|
55
62
|
pricing: Pricing | null;
|
|
56
63
|
}
|
|
64
|
+
/** An event in the ZNS event log. */
|
|
57
65
|
interface Event {
|
|
58
66
|
id: number;
|
|
59
67
|
name: string;
|
|
@@ -66,13 +74,15 @@ interface Event {
|
|
|
66
74
|
signature: string | null;
|
|
67
75
|
pubkey: string | null;
|
|
68
76
|
}
|
|
77
|
+
/** Filter options for querying events. */
|
|
69
78
|
interface EventsFilter {
|
|
70
79
|
name?: string;
|
|
71
80
|
action?: EventAction;
|
|
72
|
-
|
|
81
|
+
sinceHeight?: number;
|
|
73
82
|
limit?: number;
|
|
74
83
|
offset?: number;
|
|
75
84
|
}
|
|
85
|
+
/** Paginated events result. */
|
|
76
86
|
interface EventsResult {
|
|
77
87
|
events: Event[];
|
|
78
88
|
total: number;
|
|
@@ -103,7 +113,7 @@ interface PreparedClaim extends PreparedAction {
|
|
|
103
113
|
interface PreparedList extends PreparedAction {
|
|
104
114
|
readonly name: string;
|
|
105
115
|
readonly price: Zats;
|
|
106
|
-
readonly
|
|
116
|
+
readonly payTaddr: string;
|
|
107
117
|
readonly nonce: number;
|
|
108
118
|
}
|
|
109
119
|
/** Prepared DELIST action */
|
|
@@ -151,8 +161,11 @@ interface PayloadValidationResult {
|
|
|
151
161
|
}
|
|
152
162
|
|
|
153
163
|
declare const DEFAULT_URL = "https://light.zcash.me/zns-testnet";
|
|
154
|
-
declare const TESTNET_UIVK = "
|
|
155
|
-
declare const MAINNET_UIVK = "
|
|
164
|
+
declare const TESTNET_UIVK = "utest1hzw7wyadutvzfgpna80yftsk5l7jeyu2p5me5quvp28tytxueta00cx4068wnlzcv7tx9n3t3gfhsy83pe4y6jrhxtzaq0hj6xtg5zrk2dn7zen3vns2a5pgs4fxdjlletmqrhfa42";
|
|
165
|
+
declare const MAINNET_UIVK = "u1k0evt0ahj5qdt6y9ftsxndl8lrkm4ff6rp00u04cjpmqj6hxl9t8hfsxftmn3ht34e03lljh89czn2h8qn67rwrs8x0hm3lsxsucp9q9";
|
|
166
|
+
/** Actions accepted by {@link validatePayload}. Exposed for consumers who need
|
|
167
|
+
* to build action selectors or dynamic validation. */
|
|
168
|
+
declare const ZNS_ACTIONS: readonly ["CLAIM", "BUY", "UPDATE", "LIST", "DELIST", "RELEASE"];
|
|
156
169
|
type Network = "testnet" | "mainnet";
|
|
157
170
|
declare class ZNS {
|
|
158
171
|
private url;
|
|
@@ -266,7 +279,7 @@ declare class ZNS {
|
|
|
266
279
|
* @returns Prepared claim ready for signature completion
|
|
267
280
|
*/
|
|
268
281
|
prepareClaim(name: string, address: string, cost: Zats): PreparedClaim;
|
|
269
|
-
prepareList(name: string, price: Zats,
|
|
282
|
+
prepareList(name: string, price: Zats, payTaddr: string, nonce: number): PreparedList;
|
|
270
283
|
prepareDelist(name: string, nonce: number): PreparedDelist;
|
|
271
284
|
prepareUpdate(name: string, newAddress: string, nonce: number): PreparedUpdate;
|
|
272
285
|
prepareBuy(name: string, buyerAddress: string, price: Zats): PreparedBuy;
|
|
@@ -283,4 +296,4 @@ declare class ZNS {
|
|
|
283
296
|
private rpc;
|
|
284
297
|
}
|
|
285
298
|
|
|
286
|
-
export { BUY_COMMISSION, type CompletedAction, DEFAULT_URL, type Event, type EventAction, type EventsFilter, type EventsResult, LIST_COMMISSION, type LastAction, type Listing, MAINNET_UIVK, type Network, type PayloadValidationLevel, type PayloadValidationResult, type PendingBuy, type PreparedBuy, type PreparedClaim, type PreparedDelist, type PreparedList, type PreparedRelease, type PreparedSetPrice, type PreparedUpdate, type Pricing, type Registration, type Status, TESTNET_UIVK, ZNS, type Zats };
|
|
299
|
+
export { BUY_COMMISSION, type CompletedAction, DEFAULT_URL, type Event, type EventAction, type EventsFilter, type EventsResult, LIST_COMMISSION, type LastAction, type Listing, MAINNET_UIVK, type Network, type PayloadValidationLevel, type PayloadValidationResult, type PendingBuy, type PreparedBuy, type PreparedClaim, type PreparedDelist, type PreparedList, type PreparedRelease, type PreparedSetPrice, type PreparedUpdate, type Pricing, type Registration, type Status, TESTNET_UIVK, ZNS, ZNS_ACTIONS, type Zats };
|
package/dist/zns.d.ts
CHANGED
|
@@ -1,59 +1,67 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
1
|
+
/**
|
|
2
|
+
* Internal types that mirror the Rust indexer API exactly (snake_case).
|
|
3
|
+
* These are used for raw data passthrough and debugging.
|
|
4
|
+
* Public SDK consumers should use the camelCase types exported below.
|
|
5
|
+
*/
|
|
4
6
|
type Zats = number;
|
|
5
7
|
/** Commission sent with a BUY claim memo (0.0001 ZEC = 10,000 zats). */
|
|
6
8
|
declare const BUY_COMMISSION: Zats;
|
|
7
9
|
/** Listing commission sent with a LIST memo (0.01 ZEC = 1,000,000 zats).
|
|
8
10
|
* Mirrors the indexer's formula: min_tier × 1000. */
|
|
9
11
|
declare const LIST_COMMISSION: Zats;
|
|
10
|
-
interface Registration {
|
|
11
|
-
name: string;
|
|
12
|
-
address: string;
|
|
13
|
-
txid: string;
|
|
14
|
-
height: number;
|
|
15
|
-
nonce: number;
|
|
16
|
-
signature: string | null;
|
|
17
|
-
last_action: LastAction;
|
|
18
|
-
pubkey: string | null;
|
|
19
|
-
listing: Listing | null;
|
|
20
|
-
}
|
|
21
12
|
/** Actions that can be the 'last action' on a Registration (ownership-changing actions) */
|
|
22
13
|
type LastAction = "CLAIM" | "BUY" | "UPDATE" | "DELIST" | "RELEASE";
|
|
23
14
|
/** All actions that can appear in the Event log (includes non-ownership actions like LIST) */
|
|
24
15
|
type EventAction = "CLAIM" | "LIST" | "DELIST" | "RELEASE" | "UPDATE" | "BUY" | "SETPRICE";
|
|
16
|
+
/** Pending purchase for a listed name. */
|
|
17
|
+
interface PendingBuy {
|
|
18
|
+
buyer: string;
|
|
19
|
+
price: Zats;
|
|
20
|
+
claimHeight: number;
|
|
21
|
+
expiresAt: number;
|
|
22
|
+
txid: string;
|
|
23
|
+
}
|
|
24
|
+
/** A name listing in the marketplace. */
|
|
25
25
|
interface Listing {
|
|
26
26
|
name: string;
|
|
27
27
|
price: Zats;
|
|
28
|
-
|
|
28
|
+
payTaddr: string;
|
|
29
29
|
nonce: number;
|
|
30
30
|
txid: string;
|
|
31
31
|
height: number;
|
|
32
32
|
signature: string;
|
|
33
33
|
pubkey: string | null;
|
|
34
|
-
|
|
34
|
+
pendingBuy: PendingBuy | undefined;
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
expires_at: number;
|
|
36
|
+
/** A registered ZNS name. */
|
|
37
|
+
interface Registration {
|
|
38
|
+
name: string;
|
|
39
|
+
address: string;
|
|
41
40
|
txid: string;
|
|
41
|
+
height: number;
|
|
42
|
+
nonce: number;
|
|
43
|
+
signature: string | null;
|
|
44
|
+
lastAction: LastAction;
|
|
45
|
+
pubkey: string | null;
|
|
46
|
+
listing: Listing | null;
|
|
42
47
|
}
|
|
48
|
+
/** Pricing tiers for name registration. */
|
|
43
49
|
interface Pricing {
|
|
44
50
|
nonce: number;
|
|
45
51
|
height: number;
|
|
46
52
|
tiers: Zats[];
|
|
47
53
|
}
|
|
54
|
+
/** Current indexer status including pricing configuration. */
|
|
48
55
|
interface Status {
|
|
49
|
-
|
|
50
|
-
|
|
56
|
+
syncedHeight: number;
|
|
57
|
+
adminPubkey: string;
|
|
51
58
|
uivk: string;
|
|
52
59
|
address: string;
|
|
53
60
|
registered: number;
|
|
54
61
|
listed: number;
|
|
55
62
|
pricing: Pricing | null;
|
|
56
63
|
}
|
|
64
|
+
/** An event in the ZNS event log. */
|
|
57
65
|
interface Event {
|
|
58
66
|
id: number;
|
|
59
67
|
name: string;
|
|
@@ -66,13 +74,15 @@ interface Event {
|
|
|
66
74
|
signature: string | null;
|
|
67
75
|
pubkey: string | null;
|
|
68
76
|
}
|
|
77
|
+
/** Filter options for querying events. */
|
|
69
78
|
interface EventsFilter {
|
|
70
79
|
name?: string;
|
|
71
80
|
action?: EventAction;
|
|
72
|
-
|
|
81
|
+
sinceHeight?: number;
|
|
73
82
|
limit?: number;
|
|
74
83
|
offset?: number;
|
|
75
84
|
}
|
|
85
|
+
/** Paginated events result. */
|
|
76
86
|
interface EventsResult {
|
|
77
87
|
events: Event[];
|
|
78
88
|
total: number;
|
|
@@ -103,7 +113,7 @@ interface PreparedClaim extends PreparedAction {
|
|
|
103
113
|
interface PreparedList extends PreparedAction {
|
|
104
114
|
readonly name: string;
|
|
105
115
|
readonly price: Zats;
|
|
106
|
-
readonly
|
|
116
|
+
readonly payTaddr: string;
|
|
107
117
|
readonly nonce: number;
|
|
108
118
|
}
|
|
109
119
|
/** Prepared DELIST action */
|
|
@@ -151,8 +161,11 @@ interface PayloadValidationResult {
|
|
|
151
161
|
}
|
|
152
162
|
|
|
153
163
|
declare const DEFAULT_URL = "https://light.zcash.me/zns-testnet";
|
|
154
|
-
declare const TESTNET_UIVK = "
|
|
155
|
-
declare const MAINNET_UIVK = "
|
|
164
|
+
declare const TESTNET_UIVK = "utest1hzw7wyadutvzfgpna80yftsk5l7jeyu2p5me5quvp28tytxueta00cx4068wnlzcv7tx9n3t3gfhsy83pe4y6jrhxtzaq0hj6xtg5zrk2dn7zen3vns2a5pgs4fxdjlletmqrhfa42";
|
|
165
|
+
declare const MAINNET_UIVK = "u1k0evt0ahj5qdt6y9ftsxndl8lrkm4ff6rp00u04cjpmqj6hxl9t8hfsxftmn3ht34e03lljh89czn2h8qn67rwrs8x0hm3lsxsucp9q9";
|
|
166
|
+
/** Actions accepted by {@link validatePayload}. Exposed for consumers who need
|
|
167
|
+
* to build action selectors or dynamic validation. */
|
|
168
|
+
declare const ZNS_ACTIONS: readonly ["CLAIM", "BUY", "UPDATE", "LIST", "DELIST", "RELEASE"];
|
|
156
169
|
type Network = "testnet" | "mainnet";
|
|
157
170
|
declare class ZNS {
|
|
158
171
|
private url;
|
|
@@ -266,7 +279,7 @@ declare class ZNS {
|
|
|
266
279
|
* @returns Prepared claim ready for signature completion
|
|
267
280
|
*/
|
|
268
281
|
prepareClaim(name: string, address: string, cost: Zats): PreparedClaim;
|
|
269
|
-
prepareList(name: string, price: Zats,
|
|
282
|
+
prepareList(name: string, price: Zats, payTaddr: string, nonce: number): PreparedList;
|
|
270
283
|
prepareDelist(name: string, nonce: number): PreparedDelist;
|
|
271
284
|
prepareUpdate(name: string, newAddress: string, nonce: number): PreparedUpdate;
|
|
272
285
|
prepareBuy(name: string, buyerAddress: string, price: Zats): PreparedBuy;
|
|
@@ -283,4 +296,4 @@ declare class ZNS {
|
|
|
283
296
|
private rpc;
|
|
284
297
|
}
|
|
285
298
|
|
|
286
|
-
export { BUY_COMMISSION, type CompletedAction, DEFAULT_URL, type Event, type EventAction, type EventsFilter, type EventsResult, LIST_COMMISSION, type LastAction, type Listing, MAINNET_UIVK, type Network, type PayloadValidationLevel, type PayloadValidationResult, type PendingBuy, type PreparedBuy, type PreparedClaim, type PreparedDelist, type PreparedList, type PreparedRelease, type PreparedSetPrice, type PreparedUpdate, type Pricing, type Registration, type Status, TESTNET_UIVK, ZNS, type Zats };
|
|
299
|
+
export { BUY_COMMISSION, type CompletedAction, DEFAULT_URL, type Event, type EventAction, type EventsFilter, type EventsResult, LIST_COMMISSION, type LastAction, type Listing, MAINNET_UIVK, type Network, type PayloadValidationLevel, type PayloadValidationResult, type PendingBuy, type PreparedBuy, type PreparedClaim, type PreparedDelist, type PreparedList, type PreparedRelease, type PreparedSetPrice, type PreparedUpdate, type Pricing, type Registration, type Status, TESTNET_UIVK, ZNS, ZNS_ACTIONS, type Zats };
|
package/dist/zns.js
CHANGED
|
@@ -5,16 +5,99 @@ import { bech32m } from "bech32";
|
|
|
5
5
|
// src/types.ts
|
|
6
6
|
var BUY_COMMISSION = 1e4;
|
|
7
7
|
var LIST_COMMISSION = 1e6;
|
|
8
|
+
function toPendingBuy(raw) {
|
|
9
|
+
return {
|
|
10
|
+
buyer: raw.buyer_ua,
|
|
11
|
+
price: raw.price,
|
|
12
|
+
claimHeight: raw.claim_height,
|
|
13
|
+
expiresAt: raw.expires_at,
|
|
14
|
+
txid: raw.txid
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function toListing(raw) {
|
|
18
|
+
return {
|
|
19
|
+
name: raw.name,
|
|
20
|
+
price: raw.price,
|
|
21
|
+
payTaddr: raw.pay_taddr,
|
|
22
|
+
nonce: raw.nonce,
|
|
23
|
+
txid: raw.txid,
|
|
24
|
+
height: raw.height,
|
|
25
|
+
signature: raw.signature,
|
|
26
|
+
pubkey: raw.pubkey,
|
|
27
|
+
pendingBuy: raw.pending_buy ? toPendingBuy(raw.pending_buy) : void 0
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function toRegistration(raw) {
|
|
31
|
+
return {
|
|
32
|
+
name: raw.name,
|
|
33
|
+
address: raw.address,
|
|
34
|
+
txid: raw.txid,
|
|
35
|
+
height: raw.height,
|
|
36
|
+
nonce: raw.nonce,
|
|
37
|
+
signature: raw.signature,
|
|
38
|
+
lastAction: raw.last_action,
|
|
39
|
+
pubkey: raw.pubkey,
|
|
40
|
+
listing: raw.listing ? toListing(raw.listing) : null
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function toPricing(raw) {
|
|
44
|
+
return {
|
|
45
|
+
nonce: raw.nonce,
|
|
46
|
+
height: raw.height,
|
|
47
|
+
tiers: raw.tiers
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function toStatus(raw) {
|
|
51
|
+
return {
|
|
52
|
+
syncedHeight: raw.synced_height,
|
|
53
|
+
adminPubkey: raw.admin_pubkey,
|
|
54
|
+
uivk: raw.uivk,
|
|
55
|
+
address: raw.address,
|
|
56
|
+
registered: raw.registered,
|
|
57
|
+
listed: raw.listed,
|
|
58
|
+
pricing: raw.pricing ? toPricing(raw.pricing) : null
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function toEvent(raw) {
|
|
62
|
+
return {
|
|
63
|
+
id: raw.id,
|
|
64
|
+
name: raw.name,
|
|
65
|
+
action: raw.action,
|
|
66
|
+
txid: raw.txid,
|
|
67
|
+
height: raw.height,
|
|
68
|
+
ua: raw.ua,
|
|
69
|
+
price: raw.price,
|
|
70
|
+
nonce: raw.nonce,
|
|
71
|
+
signature: raw.signature,
|
|
72
|
+
pubkey: raw.pubkey
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function toEventsFilter(raw) {
|
|
76
|
+
return {
|
|
77
|
+
name: raw.name,
|
|
78
|
+
action: raw.action,
|
|
79
|
+
since_height: raw.sinceHeight,
|
|
80
|
+
limit: raw.limit,
|
|
81
|
+
offset: raw.offset
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function toEventsResult(raw) {
|
|
85
|
+
return {
|
|
86
|
+
events: raw.events.map(toEvent),
|
|
87
|
+
total: raw.total
|
|
88
|
+
};
|
|
89
|
+
}
|
|
8
90
|
|
|
9
91
|
// src/zns.ts
|
|
10
92
|
var DEFAULT_URL = "https://light.zcash.me/zns-testnet";
|
|
11
|
-
var TESTNET_UIVK = "
|
|
12
|
-
var MAINNET_UIVK = "
|
|
93
|
+
var TESTNET_UIVK = "utest1hzw7wyadutvzfgpna80yftsk5l7jeyu2p5me5quvp28tytxueta00cx4068wnlzcv7tx9n3t3gfhsy83pe4y6jrhxtzaq0hj6xtg5zrk2dn7zen3vns2a5pgs4fxdjlletmqrhfa42";
|
|
94
|
+
var MAINNET_UIVK = "u1k0evt0ahj5qdt6y9ftsxndl8lrkm4ff6rp00u04cjpmqj6hxl9t8hfsxftmn3ht34e03lljh89czn2h8qn67rwrs8x0hm3lsxsucp9q9";
|
|
13
95
|
var KNOWN_UIVKS = [TESTNET_UIVK, MAINNET_UIVK];
|
|
14
96
|
var REGISTRY_ADDRESSES = {
|
|
15
97
|
testnet: "utest1f32kn6c4zvn54xr8wfsnxmj9hzpu2mwgtxzpzwcw34906tdccdvzs0z2dx38lly7tpan77x6udt8pjczqm22ymsdhlz9j0tk5yq664nl",
|
|
16
98
|
mainnet: "u1k0evt0ahj5qdt6y9ftsxndl8lrkm4ff6rp00u04cjpmqj6hxl9t8hfsxftmn3ht34e03lljh89czn2h8qn67rwrs8x0hm3lsxsucp9q9"
|
|
17
99
|
};
|
|
100
|
+
var ZNS_ACTIONS = ["CLAIM", "BUY", "UPDATE", "LIST", "DELIST", "RELEASE"];
|
|
18
101
|
var NAME_RE = /^[a-z0-9]{1,62}$/;
|
|
19
102
|
function isWholeNumber(value) {
|
|
20
103
|
return /^\d+$/.test(value) && !value.startsWith("0") || value === "0";
|
|
@@ -40,7 +123,7 @@ var ZNS = class {
|
|
|
40
123
|
* @throws Error if the server's UIVK is not recognized
|
|
41
124
|
*/
|
|
42
125
|
async verify() {
|
|
43
|
-
const status = await this.
|
|
126
|
+
const status = await this.status();
|
|
44
127
|
if (!KNOWN_UIVKS.includes(status.uivk)) {
|
|
45
128
|
throw new Error(
|
|
46
129
|
`UIVK mismatch: indexer returned "${status.uivk.slice(0, 20)}..." which is not a known ZNS instance`
|
|
@@ -62,29 +145,33 @@ var ZNS = class {
|
|
|
62
145
|
}
|
|
63
146
|
/** Fetch current server status including pricing and configuration. */
|
|
64
147
|
async status() {
|
|
65
|
-
|
|
148
|
+
const raw = await this.rpc("status");
|
|
149
|
+
return toStatus(raw);
|
|
66
150
|
}
|
|
67
151
|
/** Resolve a ZNS name to its registration. Returns null if not registered. */
|
|
68
152
|
async resolveName(name) {
|
|
69
|
-
|
|
153
|
+
const raw = await this.rpc("resolve", { query: name });
|
|
154
|
+
return raw ? toRegistration(raw) : null;
|
|
70
155
|
}
|
|
71
156
|
/** Resolve a Zcash Unified Address to all names pointing to it. Returns empty array if none.
|
|
72
157
|
* Supports pagination with limit (default 50, max 500) and offset (default 0). */
|
|
73
158
|
async resolveAddress(address, limit, offset) {
|
|
74
|
-
|
|
159
|
+
const raw = await this.rpc("resolve", {
|
|
75
160
|
query: address,
|
|
76
161
|
limit,
|
|
77
162
|
offset
|
|
78
163
|
});
|
|
164
|
+
return raw.map(toRegistration);
|
|
79
165
|
}
|
|
80
166
|
/** List all registered names. Useful for explorers or browsers.
|
|
81
167
|
* Supports pagination with limit (default 50, max 500) and offset (default 0). */
|
|
82
168
|
async listAllRegistrations(limit, offset) {
|
|
83
|
-
|
|
169
|
+
const raw = await this.rpc("resolve", {
|
|
84
170
|
query: "",
|
|
85
171
|
limit,
|
|
86
172
|
offset
|
|
87
173
|
});
|
|
174
|
+
return raw.map(toRegistration);
|
|
88
175
|
}
|
|
89
176
|
/** Check if a name is available for registration.
|
|
90
177
|
* Returns false immediately for invalid names without hitting the server. */
|
|
@@ -113,13 +200,33 @@ var ZNS = class {
|
|
|
113
200
|
limit,
|
|
114
201
|
offset
|
|
115
202
|
});
|
|
116
|
-
return
|
|
203
|
+
return {
|
|
204
|
+
listings: result.listings.map((l) => ({
|
|
205
|
+
name: l.name,
|
|
206
|
+
price: l.price,
|
|
207
|
+
payTaddr: l.pay_taddr,
|
|
208
|
+
nonce: l.nonce,
|
|
209
|
+
txid: l.txid,
|
|
210
|
+
height: l.height,
|
|
211
|
+
signature: l.signature,
|
|
212
|
+
pubkey: l.pubkey,
|
|
213
|
+
pendingBuy: l.pending_buy ? {
|
|
214
|
+
buyer: l.pending_buy.buyer_ua,
|
|
215
|
+
price: l.pending_buy.price,
|
|
216
|
+
claimHeight: l.pending_buy.claim_height,
|
|
217
|
+
expiresAt: l.pending_buy.expires_at,
|
|
218
|
+
txid: l.pending_buy.txid
|
|
219
|
+
} : void 0
|
|
220
|
+
})),
|
|
221
|
+
total: result.total
|
|
222
|
+
};
|
|
117
223
|
}
|
|
118
224
|
async events(filter) {
|
|
119
|
-
|
|
225
|
+
const raw = await this.rpc(
|
|
120
226
|
"events",
|
|
121
|
-
filter ?? {}
|
|
227
|
+
toEventsFilter(filter ?? {})
|
|
122
228
|
);
|
|
229
|
+
return toEventsResult(raw);
|
|
123
230
|
}
|
|
124
231
|
/**
|
|
125
232
|
* Verify a listing's signature.
|
|
@@ -129,7 +236,7 @@ var ZNS = class {
|
|
|
129
236
|
*/
|
|
130
237
|
async verifyListing(listing, adminPubkey) {
|
|
131
238
|
const pubkey = listing.pubkey ?? adminPubkey;
|
|
132
|
-
const payload = `LIST:${listing.name}:${listing.price}:${listing.
|
|
239
|
+
const payload = `LIST:${listing.name}:${listing.price}:${listing.payTaddr}:${listing.nonce}`;
|
|
133
240
|
return this.verifyEd25519(payload, listing.signature, pubkey);
|
|
134
241
|
}
|
|
135
242
|
/**
|
|
@@ -253,29 +360,12 @@ var ZNS = class {
|
|
|
253
360
|
return mk("invalid", actionUpper, "release", `Nonce must be a whole number.`);
|
|
254
361
|
return mk("valid", actionUpper, "release", "Valid RELEASE payload.");
|
|
255
362
|
}
|
|
256
|
-
case "setprice": {
|
|
257
|
-
if (parts.length < 3)
|
|
258
|
-
return mk("invalid", actionUpper, "setprice", `Expected SETPRICE:<count>:<tier1>:...:<nonce>.`);
|
|
259
|
-
const count = Number(parts[0]);
|
|
260
|
-
if (!isWholeNumber(parts[0]) || isNaN(count) || count <= 0)
|
|
261
|
-
return mk("invalid", actionUpper, "setprice", `Count must be a positive whole number.`);
|
|
262
|
-
const priceCount = parts.length - 2;
|
|
263
|
-
if (priceCount !== count)
|
|
264
|
-
return mk("invalid", actionUpper, "setprice", `SETPRICE count mismatch: header is ${count} but found ${priceCount} price tiers.`);
|
|
265
|
-
if (!isWholeNumber(parts[parts.length - 1]))
|
|
266
|
-
return mk("invalid", actionUpper, "setprice", `Nonce must be a whole number.`);
|
|
267
|
-
for (let i = 1; i < parts.length - 1; i++) {
|
|
268
|
-
if (!isWholeNumber(parts[i]) || Number(parts[i]) <= 0)
|
|
269
|
-
return mk("invalid", actionUpper, "setprice", `Tier ${i} must be a positive whole number in zats.`);
|
|
270
|
-
}
|
|
271
|
-
return mk("valid", actionUpper, "setprice", "Valid SETPRICE payload.");
|
|
272
|
-
}
|
|
273
363
|
default:
|
|
274
364
|
return {
|
|
275
365
|
valid: false,
|
|
276
366
|
action: actionUpper,
|
|
277
367
|
canonicalAction: null,
|
|
278
|
-
message: `Unrecognized action "${actionUpper}". Valid actions:
|
|
368
|
+
message: `Unrecognized action "${actionUpper}". Valid actions: ${ZNS_ACTIONS.join(", ")}.`,
|
|
279
369
|
level: "unrecognized"
|
|
280
370
|
};
|
|
281
371
|
}
|
|
@@ -336,16 +426,16 @@ var ZNS = class {
|
|
|
336
426
|
}
|
|
337
427
|
};
|
|
338
428
|
}
|
|
339
|
-
prepareList(name, price,
|
|
429
|
+
prepareList(name, price, payTaddr, nonce) {
|
|
340
430
|
this.requireValidName(name);
|
|
341
431
|
return {
|
|
342
432
|
name,
|
|
343
433
|
price,
|
|
344
|
-
|
|
434
|
+
payTaddr,
|
|
345
435
|
nonce,
|
|
346
|
-
payload: `LIST:${name}:${price}:${
|
|
436
|
+
payload: `LIST:${name}:${price}:${payTaddr}:${nonce}`,
|
|
347
437
|
complete: (signature, userPubkey) => {
|
|
348
|
-
const memo = userPubkey ? `ZNS:LIST:${name}:${price}:${
|
|
438
|
+
const memo = userPubkey ? `ZNS:LIST:${name}:${price}:${payTaddr}:${nonce}:${signature}:${userPubkey}` : `ZNS:LIST:${name}:${price}:${payTaddr}:${nonce}:${signature}`;
|
|
349
439
|
return { memo, uri: this.buildZcashUri(this.registryAddress, LIST_COMMISSION, memo) };
|
|
350
440
|
}
|
|
351
441
|
};
|
|
@@ -419,7 +509,7 @@ var ZNS = class {
|
|
|
419
509
|
}
|
|
420
510
|
// ── Private helpers ────────────────────────────────────────────────────────
|
|
421
511
|
registrationPayload(reg) {
|
|
422
|
-
switch (reg.
|
|
512
|
+
switch (reg.lastAction) {
|
|
423
513
|
case "CLAIM":
|
|
424
514
|
return `CLAIM:${reg.name}:${reg.address}`;
|
|
425
515
|
case "BUY":
|
|
@@ -513,5 +603,6 @@ export {
|
|
|
513
603
|
LIST_COMMISSION,
|
|
514
604
|
MAINNET_UIVK,
|
|
515
605
|
TESTNET_UIVK,
|
|
516
|
-
ZNS
|
|
606
|
+
ZNS,
|
|
607
|
+
ZNS_ACTIONS
|
|
517
608
|
};
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zcashname-sdk",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "TypeScript SDK for the Zcash Name System (ZNS)",
|
|
5
|
+
"description": "TypeScript SDK for the Zcash Name System (ZNS).",
|
|
6
6
|
"main": "dist/zns.cjs",
|
|
7
7
|
"module": "dist/zns.js",
|
|
8
8
|
"types": "dist/zns.d.ts",
|