@parity/product-sdk 0.21.0 → 0.23.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/dist/address/index.d.ts +1 -0
- package/dist/chunk-BRZNHTLQ.js +89 -0
- package/dist/chunk-BRZNHTLQ.js.map +1 -0
- package/dist/{chunk-6BI66XUJ.js → chunk-DHRCWMY5.js} +9 -10
- package/dist/chunk-DHRCWMY5.js.map +1 -0
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +2 -2
- package/dist/dotns-bswWAmR2.d.ts +136 -0
- package/dist/identity/index.d.ts +495 -49
- package/dist/identity/index.js +796 -46
- package/dist/identity/index.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/individuality/index.d.ts +1 -0
- package/dist/individuality/index.js +3 -0
- package/dist/individuality/index.js.map +1 -0
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +2 -2
- package/dist/testing/index.d.ts +2 -2
- package/dist/{types-CztPAgZT.d.ts → types-B5Zx4RNq.d.ts} +1 -1
- package/package.json +17 -12
- package/src/core/createApp.ts +10 -8
- package/src/identity/dotns-abis.test.ts +43 -0
- package/src/identity/dotns-abis.ts +309 -0
- package/src/identity/dotns-addresses.test.ts +536 -0
- package/src/identity/dotns-addresses.ts +320 -0
- package/src/identity/dotns-errors.ts +36 -0
- package/src/identity/dotns-namehash.test.ts +155 -0
- package/src/identity/dotns-namehash.ts +149 -0
- package/src/identity/dotns-owner.test.ts +92 -0
- package/src/identity/dotns-registry.test.ts +1309 -0
- package/src/identity/dotns-registry.ts +868 -0
- package/src/identity/dotns.test.ts +128 -0
- package/src/identity/dotns.ts +91 -78
- package/src/identity/index.test.ts +43 -0
- package/src/identity/index.ts +42 -16
- package/src/identity/types.ts +29 -38
- package/src/individuality/contract.test.ts +326 -0
- package/src/individuality/index.ts +8 -0
- package/dist/chunk-6BI66XUJ.js.map +0 -1
- package/dist/chunk-BIKT6X54.js +0 -70
- package/dist/chunk-BIKT6X54.js.map +0 -1
- package/dist/dotns-hLSvmo6u.d.ts +0 -178
- package/src/identity/product-account.ts +0 -164
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
// Copyright 2026 Parity Technologies (UK) Ltd.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
/**
|
|
4
|
+
* Minimal ABIs for the DotNS contracts: the read and write methods this module
|
|
5
|
+
* calls, and nothing else. Sourced from `paritytech/dotns` (`contracts/registry`,
|
|
6
|
+
* `contracts/resolvers`, `contracts/registrars`, `contracts/pop`).
|
|
7
|
+
*/
|
|
8
|
+
import type { AbiEntry } from "@parity/product-sdk-contracts";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* `DotnsRegistry` — node → resolver / owner, plus the owner-gated pointer write.
|
|
12
|
+
*
|
|
13
|
+
* `setResolver` is needed because registration parks `records[node].resolver` on
|
|
14
|
+
* the reverse resolver, so the pointer must be moved once before any address
|
|
15
|
+
* record is readable.
|
|
16
|
+
*/
|
|
17
|
+
export const DOTNS_REGISTRY_ABI: AbiEntry[] = [
|
|
18
|
+
{
|
|
19
|
+
type: "function",
|
|
20
|
+
name: "resolver",
|
|
21
|
+
inputs: [{ name: "node", type: "bytes32" }],
|
|
22
|
+
outputs: [{ name: "", type: "address" }],
|
|
23
|
+
stateMutability: "view",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
type: "function",
|
|
27
|
+
name: "owner",
|
|
28
|
+
inputs: [{ name: "node", type: "bytes32" }],
|
|
29
|
+
outputs: [{ name: "", type: "address" }],
|
|
30
|
+
stateMutability: "view",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
type: "function",
|
|
34
|
+
name: "setResolver",
|
|
35
|
+
inputs: [
|
|
36
|
+
{ name: "node", type: "bytes32" },
|
|
37
|
+
{ name: "resolverAddr", type: "address" },
|
|
38
|
+
],
|
|
39
|
+
outputs: [],
|
|
40
|
+
stateMutability: "nonpayable",
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
/** `DotnsResolver` — node → resolved address. */
|
|
45
|
+
export const DOTNS_RESOLVER_ABI: AbiEntry[] = [
|
|
46
|
+
{
|
|
47
|
+
type: "function",
|
|
48
|
+
name: "addressOf",
|
|
49
|
+
inputs: [{ name: "node", type: "bytes32" }],
|
|
50
|
+
outputs: [{ name: "value", type: "address" }],
|
|
51
|
+
stateMutability: "view",
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
/** `DotnsReverseResolver` — account → primary name. */
|
|
56
|
+
export const DOTNS_REVERSE_RESOLVER_ABI: AbiEntry[] = [
|
|
57
|
+
{
|
|
58
|
+
type: "function",
|
|
59
|
+
name: "nameOf",
|
|
60
|
+
inputs: [{ name: "addr", type: "address" }],
|
|
61
|
+
outputs: [{ name: "name", type: "string" }],
|
|
62
|
+
stateMutability: "view",
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
/** `DotnsResolver` write — set a node's resolved address (owner-gated). */
|
|
67
|
+
export const DOTNS_RESOLVER_WRITE_ABI: AbiEntry[] = [
|
|
68
|
+
{
|
|
69
|
+
type: "function",
|
|
70
|
+
name: "setAddress",
|
|
71
|
+
inputs: [
|
|
72
|
+
{ name: "node", type: "bytes32" },
|
|
73
|
+
{ name: "value", type: "address" },
|
|
74
|
+
],
|
|
75
|
+
outputs: [],
|
|
76
|
+
stateMutability: "nonpayable",
|
|
77
|
+
},
|
|
78
|
+
];
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* `DotnsRegistrarController` — the commit-reveal registration flow. `register`
|
|
82
|
+
* is payable; the value is the price from {@link DOTNS_POP_RULES_ABI}.
|
|
83
|
+
* `Registration` = (label, owner, secret, reserved).
|
|
84
|
+
*/
|
|
85
|
+
export const DOTNS_REGISTRAR_CONTROLLER_ABI: AbiEntry[] = [
|
|
86
|
+
{
|
|
87
|
+
type: "function",
|
|
88
|
+
name: "available",
|
|
89
|
+
inputs: [{ name: "label", type: "string" }],
|
|
90
|
+
outputs: [{ name: "isAvailable", type: "bool" }],
|
|
91
|
+
stateMutability: "view",
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
type: "function",
|
|
95
|
+
name: "minCommitmentAge",
|
|
96
|
+
inputs: [],
|
|
97
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
98
|
+
stateMutability: "view",
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
type: "function",
|
|
102
|
+
name: "maxCommitmentAge",
|
|
103
|
+
inputs: [],
|
|
104
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
105
|
+
stateMutability: "view",
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
type: "function",
|
|
109
|
+
name: "makeCommitment",
|
|
110
|
+
inputs: [
|
|
111
|
+
{
|
|
112
|
+
name: "registration",
|
|
113
|
+
type: "tuple",
|
|
114
|
+
components: [
|
|
115
|
+
{ name: "label", type: "string" },
|
|
116
|
+
{ name: "owner", type: "address" },
|
|
117
|
+
{ name: "secret", type: "bytes32" },
|
|
118
|
+
{ name: "reserved", type: "bool" },
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
outputs: [{ name: "commitment", type: "bytes32" }],
|
|
123
|
+
stateMutability: "pure",
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
type: "function",
|
|
127
|
+
name: "commit",
|
|
128
|
+
inputs: [{ name: "commitment", type: "bytes32" }],
|
|
129
|
+
outputs: [],
|
|
130
|
+
stateMutability: "nonpayable",
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
type: "function",
|
|
134
|
+
name: "register",
|
|
135
|
+
inputs: [
|
|
136
|
+
{
|
|
137
|
+
name: "registration",
|
|
138
|
+
type: "tuple",
|
|
139
|
+
components: [
|
|
140
|
+
{ name: "label", type: "string" },
|
|
141
|
+
{ name: "owner", type: "address" },
|
|
142
|
+
{ name: "secret", type: "bytes32" },
|
|
143
|
+
{ name: "reserved", type: "bool" },
|
|
144
|
+
],
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
outputs: [],
|
|
148
|
+
stateMutability: "payable",
|
|
149
|
+
},
|
|
150
|
+
];
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* `PopRules` — registration pricing.
|
|
154
|
+
*
|
|
155
|
+
* `price` is the label-only cost and runs no eligibility rules, so it is not
|
|
156
|
+
* what `register` charges. `register` uses the owner-aware variants and adds
|
|
157
|
+
* `transferFloor` when the payer is not the owner:
|
|
158
|
+
* `max(priceWithoutCheck(label, owner).price, transferFloor(label, payer, owner))`.
|
|
159
|
+
*
|
|
160
|
+
* `PopStatus` encodes as `uint8`: 0 NoStatus, 1 PopLite, 2 PopFull, 3 Reserved.
|
|
161
|
+
*/
|
|
162
|
+
export const DOTNS_POP_RULES_ABI: AbiEntry[] = [
|
|
163
|
+
{
|
|
164
|
+
type: "function",
|
|
165
|
+
name: "price",
|
|
166
|
+
inputs: [{ name: "name", type: "string" }],
|
|
167
|
+
outputs: [{ name: "cost", type: "uint256" }],
|
|
168
|
+
stateMutability: "view",
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
type: "function",
|
|
172
|
+
name: "priceWithoutCheck",
|
|
173
|
+
inputs: [
|
|
174
|
+
{ name: "name", type: "string" },
|
|
175
|
+
{ name: "userAddress", type: "address" },
|
|
176
|
+
],
|
|
177
|
+
outputs: [
|
|
178
|
+
{
|
|
179
|
+
name: "metadata",
|
|
180
|
+
type: "tuple",
|
|
181
|
+
components: [
|
|
182
|
+
{ name: "price", type: "uint256" },
|
|
183
|
+
{ name: "status", type: "uint8" },
|
|
184
|
+
{ name: "userStatus", type: "uint8" },
|
|
185
|
+
{ name: "message", type: "string" },
|
|
186
|
+
],
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
stateMutability: "view",
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
type: "function",
|
|
193
|
+
name: "classifyName",
|
|
194
|
+
inputs: [{ name: "name", type: "string" }],
|
|
195
|
+
outputs: [
|
|
196
|
+
{ name: "requirement", type: "uint8" },
|
|
197
|
+
{ name: "message", type: "string" },
|
|
198
|
+
],
|
|
199
|
+
stateMutability: "pure",
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
type: "function",
|
|
203
|
+
name: "transferFloor",
|
|
204
|
+
inputs: [
|
|
205
|
+
{ name: "name", type: "string" },
|
|
206
|
+
{ name: "from", type: "address" },
|
|
207
|
+
{ name: "to", type: "address" },
|
|
208
|
+
],
|
|
209
|
+
outputs: [{ name: "floor", type: "uint256" }],
|
|
210
|
+
stateMutability: "view",
|
|
211
|
+
},
|
|
212
|
+
];
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* `IDotnsProtocolRegistry`, the two TLD getters.
|
|
216
|
+
*
|
|
217
|
+
* The TLD is per network: `initialize(tldLabel)` fixes it once at deployment
|
|
218
|
+
* and there is no setter, so these are immutable for the life of a deployment.
|
|
219
|
+
* `tld()` returns the suffix with its leading dot (`".paseo"`); `tldNode()`
|
|
220
|
+
* returns `namehash(0, labelhash(label))`, which is derivable from the suffix
|
|
221
|
+
* and so is read only as a cross-check.
|
|
222
|
+
*
|
|
223
|
+
* Deployments predating `dotns` `b4096968` have neither getter — the TLD was a
|
|
224
|
+
* compile-time constant there — and revert with an empty payload.
|
|
225
|
+
*/
|
|
226
|
+
export const DOTNS_PROTOCOL_REGISTRY_ABI: AbiEntry[] = [
|
|
227
|
+
{
|
|
228
|
+
type: "function",
|
|
229
|
+
name: "tld",
|
|
230
|
+
inputs: [],
|
|
231
|
+
outputs: [{ name: "suffix", type: "string" }],
|
|
232
|
+
stateMutability: "view",
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
type: "function",
|
|
236
|
+
name: "tldNode",
|
|
237
|
+
inputs: [],
|
|
238
|
+
outputs: [{ name: "node", type: "bytes32" }],
|
|
239
|
+
stateMutability: "view",
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
type: "function",
|
|
243
|
+
name: "get",
|
|
244
|
+
inputs: [{ name: "key", type: "bytes32" }],
|
|
245
|
+
outputs: [{ name: "addr", type: "address" }],
|
|
246
|
+
stateMutability: "view",
|
|
247
|
+
},
|
|
248
|
+
];
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* `RootGatewayDispatcher.TARGET`, the PoP controller it forwards to. `immutable`,
|
|
252
|
+
* so a rotation means a new dispatcher and a new pallet value, which is why
|
|
253
|
+
* discovery starts at the pallet rather than here.
|
|
254
|
+
*/
|
|
255
|
+
export const DOTNS_ROOT_GATEWAY_DISPATCHER_ABI: AbiEntry[] = [
|
|
256
|
+
{
|
|
257
|
+
type: "function",
|
|
258
|
+
name: "TARGET",
|
|
259
|
+
inputs: [],
|
|
260
|
+
outputs: [{ name: "", type: "address" }],
|
|
261
|
+
stateMutability: "view",
|
|
262
|
+
},
|
|
263
|
+
];
|
|
264
|
+
|
|
265
|
+
/** `DotnsPopController.protocolRegistry`, the only hop that names the registry. */
|
|
266
|
+
export const DOTNS_POP_CONTROLLER_ABI: AbiEntry[] = [
|
|
267
|
+
{
|
|
268
|
+
type: "function",
|
|
269
|
+
name: "protocolRegistry",
|
|
270
|
+
inputs: [],
|
|
271
|
+
outputs: [{ name: "", type: "address" }],
|
|
272
|
+
stateMutability: "view",
|
|
273
|
+
},
|
|
274
|
+
];
|
|
275
|
+
|
|
276
|
+
/** `IPopRules.PopStatus`. Ordering is meaningful: a user meets a tier when `userStatus >= status`. */
|
|
277
|
+
export const POP_STATUS = { NoStatus: 0, PopLite: 1, PopFull: 2, Reserved: 3 } as const;
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* The deployed DotNS addresses. The same on every network.
|
|
281
|
+
*
|
|
282
|
+
* Not a per-network table, despite what the old name (`PASEO_ASSETHUB_DOTNS`)
|
|
283
|
+
* implied: every DotNS network is deployed through the same CREATE3 factory, so
|
|
284
|
+
* the addresses are identical everywhere and **only the TLD differs**, `.paseo`
|
|
285
|
+
* on Paseo Asset Hub Next V2 and `.test` on Previewnet. Verified on both:
|
|
286
|
+
* `protocolRegistry.get(...)` returns the same registry on each, and all six
|
|
287
|
+
* addresses hold contracts on both. `paritytech/dotns` `DEPLOYMENTS.md` states the mechanism, and
|
|
288
|
+
* `preview-net-v1` confirms it from the deploy side: the TLD is passed only as
|
|
289
|
+
* registry init calldata, so it moves no address.
|
|
290
|
+
*
|
|
291
|
+
* So extending this module to another network means resolving its TLD, which
|
|
292
|
+
* `resolveTld` already does — not adding a second address table.
|
|
293
|
+
*
|
|
294
|
+
* Five answer `DotnsProtocolRegistry.get(bytes32)` under the keys in
|
|
295
|
+
* `DOTNS_REGISTRY_KEYS`, two of which differ from the field name used here.
|
|
296
|
+
* `protocolRegistry` has no key and comes from the gateway walk. All six have a
|
|
297
|
+
* `Revive.AccountInfoOf` entry.
|
|
298
|
+
*
|
|
299
|
+
* Pinned, not resolved at runtime: re-verify after a redeploy, or have the
|
|
300
|
+
* client do it with `verifyDotNsAddresses`.
|
|
301
|
+
*/
|
|
302
|
+
export const DOTNS_ADDRESSES = {
|
|
303
|
+
registry: "0xf34054fd76BbF85f216cf9908226D5f0A72E50CA",
|
|
304
|
+
reverseResolver: "0xee3883d7eB60Ee9BCD7F3bcD8f2f05302A9Cc035",
|
|
305
|
+
resolver: "0xbd1165E549DF96F083c0A16f61590927bC187009",
|
|
306
|
+
registrarController: "0xBdaA01bD1bA67d709F2b1fF286Da0d854977EA30",
|
|
307
|
+
popRules: "0x747B456bE03aec0b42bd85C51513730FBD45DA31",
|
|
308
|
+
protocolRegistry: "0xD19e3D0C97CF501125a04A97405e3e6592fa846E",
|
|
309
|
+
} as const;
|