@parity/product-sdk 0.0.0-dev.312.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.
Files changed (88) hide show
  1. package/LICENSE +201 -0
  2. package/dist/address/index.d.ts +9 -0
  3. package/dist/address/index.js +3 -0
  4. package/dist/address/index.js.map +1 -0
  5. package/dist/chain/index.d.ts +1 -0
  6. package/dist/chain/index.js +3 -0
  7. package/dist/chain/index.js.map +1 -0
  8. package/dist/chunk-BRZNHTLQ.js +89 -0
  9. package/dist/chunk-BRZNHTLQ.js.map +1 -0
  10. package/dist/chunk-DHRCWMY5.js +240 -0
  11. package/dist/chunk-DHRCWMY5.js.map +1 -0
  12. package/dist/chunk-JVJ552RU.js +3 -0
  13. package/dist/chunk-JVJ552RU.js.map +1 -0
  14. package/dist/cloud-storage/index.d.ts +1 -0
  15. package/dist/cloud-storage/index.js +3 -0
  16. package/dist/cloud-storage/index.js.map +1 -0
  17. package/dist/contracts/index.d.ts +1 -0
  18. package/dist/contracts/index.js +3 -0
  19. package/dist/contracts/index.js.map +1 -0
  20. package/dist/core/index.d.ts +12 -0
  21. package/dist/core/index.js +5 -0
  22. package/dist/core/index.js.map +1 -0
  23. package/dist/crypto/index.d.ts +1 -0
  24. package/dist/crypto/index.js +3 -0
  25. package/dist/crypto/index.js.map +1 -0
  26. package/dist/dotns-bswWAmR2.d.ts +136 -0
  27. package/dist/host/index.d.ts +1 -0
  28. package/dist/host/index.js +3 -0
  29. package/dist/host/index.js.map +1 -0
  30. package/dist/identity/index.d.ts +491 -0
  31. package/dist/identity/index.js +691 -0
  32. package/dist/identity/index.js.map +1 -0
  33. package/dist/index.d.ts +62 -0
  34. package/dist/index.js +12 -0
  35. package/dist/index.js.map +1 -0
  36. package/dist/individuality/index.d.ts +1 -0
  37. package/dist/individuality/index.js +3 -0
  38. package/dist/individuality/index.js.map +1 -0
  39. package/dist/local-storage/index.d.ts +1 -0
  40. package/dist/local-storage/index.js +3 -0
  41. package/dist/local-storage/index.js.map +1 -0
  42. package/dist/react/index.d.ts +181 -0
  43. package/dist/react/index.js +198 -0
  44. package/dist/react/index.js.map +1 -0
  45. package/dist/testing/index.d.ts +61 -0
  46. package/dist/testing/index.js +149 -0
  47. package/dist/testing/index.js.map +1 -0
  48. package/dist/types-B5Zx4RNq.d.ts +211 -0
  49. package/dist/wallet/index.d.ts +1 -0
  50. package/dist/wallet/index.js +3 -0
  51. package/dist/wallet/index.js.map +1 -0
  52. package/package.json +118 -0
  53. package/src/address/index.ts +8 -0
  54. package/src/chain/index.ts +8 -0
  55. package/src/cloud-storage/index.ts +8 -0
  56. package/src/contracts/index.ts +8 -0
  57. package/src/core/createApp.ts +408 -0
  58. package/src/core/index.ts +12 -0
  59. package/src/core/logger.ts +15 -0
  60. package/src/core/types.ts +233 -0
  61. package/src/crypto/index.ts +8 -0
  62. package/src/host/index.ts +8 -0
  63. package/src/identity/dotns-abis.test.ts +43 -0
  64. package/src/identity/dotns-abis.ts +274 -0
  65. package/src/identity/dotns-errors.ts +34 -0
  66. package/src/identity/dotns-namehash.test.ts +155 -0
  67. package/src/identity/dotns-namehash.ts +149 -0
  68. package/src/identity/dotns-owner.test.ts +92 -0
  69. package/src/identity/dotns-registry.test.ts +1154 -0
  70. package/src/identity/dotns-registry.ts +870 -0
  71. package/src/identity/dotns.test.ts +128 -0
  72. package/src/identity/dotns.ts +221 -0
  73. package/src/identity/index.ts +61 -0
  74. package/src/identity/product-account.test.ts +130 -0
  75. package/src/identity/product-account.ts +115 -0
  76. package/src/identity/types.ts +87 -0
  77. package/src/index.ts +61 -0
  78. package/src/individuality/contract.test.ts +135 -0
  79. package/src/individuality/index.ts +8 -0
  80. package/src/local-storage/index.ts +8 -0
  81. package/src/react/context.ts +35 -0
  82. package/src/react/index.ts +43 -0
  83. package/src/react/provider.tsx +78 -0
  84. package/src/react/useChain.ts +35 -0
  85. package/src/react/useLocalStorage.ts +127 -0
  86. package/src/react/useWallet.ts +156 -0
  87. package/src/testing.ts +297 -0
  88. package/src/wallet/index.ts +11 -0
@@ -0,0 +1,491 @@
1
+ export { P as PeopleUsernameChain, a as PeopleUsernameQueryApi, b as accountIdHexToBytes, c as accountIdToHex, i as isResolvableDotNsName, d as isValidDotNsName, n as normalizeDotNsName, r as resolvePeopleUsernameOwner } from '../dotns-bswWAmR2.js';
2
+ import { Result } from '@parity/result';
3
+ import { ContractRuntime, BatchableCall } from '@parity/product-sdk-contracts';
4
+ import { SS58String } from 'polkadot-api';
5
+ import { SdkError } from '@parity/product-sdk-errors';
6
+
7
+ /**
8
+ * Error on the `Err` channel of a DotNS registry read/write. Implements the
9
+ * cross-package {@link SdkError} marker so `isSdkError(e)` recognizes it.
10
+ *
11
+ * `reason` distinguishes the failure kind so callers can branch without string
12
+ * matching.
13
+ */
14
+ type DotNsErrorReason = "InvalidName" | "InvalidTld" | "TldMismatch" | "MissingOrigin" | "InvalidOrigin" | "NameUnavailable" | "NameReserved" | "OwnerStatusInsufficient" | "RegistryCall" | "Decode";
15
+ declare class DotNsError extends Error implements SdkError {
16
+ readonly isSdkError: true;
17
+ readonly source = "dotns";
18
+ readonly reason: DotNsErrorReason;
19
+ constructor(reason: DotNsErrorReason, message: string, options?: ErrorOptions);
20
+ }
21
+
22
+ /**
23
+ * A network's DotNS top-level domain: the suffix names are spelled with, and
24
+ * the node every one of its names hashes onto.
25
+ *
26
+ * The two must agree — `node` is `namehash(0, labelhash(label))` of `suffix`'s
27
+ * label — so build one with {@link dotNsTld} rather than by hand, and check an
28
+ * externally supplied pair with {@link isConsistentDotNsTld}. A `.paseo` suffix
29
+ * carrying the `.dot` node is exactly the defect this type exists to prevent.
30
+ */
31
+ interface DotNsTld {
32
+ /** Suffix including the leading dot, as `protocolRegistry.tld()` returns it. */
33
+ suffix: string;
34
+ /** Namehash of the TLD label, as `protocolRegistry.tldNode()` returns it. */
35
+ node: `0x${string}`;
36
+ }
37
+ /** The `.dot` TLD node. Mirrors the `DotnsConstants.DOT_NODE` the contracts removed in `b4096968`. */
38
+ declare const DOT_NODE = "0x3fce7d1364a893e213bc4212792b517ffc88f5b13b86c8ef9c8d390c3a1370ce";
39
+ /**
40
+ * Build a {@link DotNsTld} from a TLD suffix, deriving the node the same way the
41
+ * contract does.
42
+ *
43
+ * Mirrors `DotnsProtocolRegistry.initialize`, which sets
44
+ * `_tldNode = namehashUnder(bytes32(0), labelhash(tldLabel))`. Because the node
45
+ * is a pure function of the label, a client only ever needs the suffix — reading
46
+ * `tldNode()` is a cross-check, never the source.
47
+ *
48
+ * Accepts `".paseo"` or `"paseo"`: `tld()` returns the dotted form while
49
+ * `initialize` and the deploy pipeline speak the bare label.
50
+ */
51
+ declare function dotNsTld(suffix: string): DotNsTld;
52
+ /**
53
+ * Whether a {@link DotNsTld} could have come from a real deployment.
54
+ *
55
+ * Three ways a pair fails, all of which produce silently wrong nodes rather
56
+ * than errors if they reach {@link namehash}:
57
+ *
58
+ * - the node is not the derivation of the suffix (a caller mixing `.paseo`
59
+ * with `DOT_NODE`);
60
+ * - the suffix is empty, or the node is zero — what a pre-`b4096968` registry
61
+ * proxy reports after an upgrade with no reinitializer, since `_tld` and
62
+ * `_tldNode` are then still at their defaults and *both getters succeed*;
63
+ * - the suffix is not a single label, which `initialize` rejects outright.
64
+ *
65
+ * Returns a boolean rather than a `Result` to keep this module free of the
66
+ * error type; callers with an error channel (`resolveTld`) map `false` to an
67
+ * `err` carrying the offending value.
68
+ */
69
+ declare function isConsistentDotNsTld(tld: DotNsTld): boolean;
70
+ /** The `.dot` TLD, for a deployment that uses it. Not a default: pass it explicitly. */
71
+ declare const DOT_TLD: DotNsTld;
72
+ /**
73
+ * Drop `suffix` from the end of `name`, leaving the labels beneath it.
74
+ *
75
+ * Strips by the suffix's own length, which is the whole point: the same logic
76
+ * written as `slice(0, -4)` turns `alice.paseo` into `alice.pa`, and every
77
+ * lookup for that name then asks about a subname nobody registered. A name that
78
+ * does not carry the suffix is returned unchanged, so a foreign suffix stays
79
+ * visible to whatever validates next.
80
+ *
81
+ * Lives here rather than in `./dotns.js` so the one copy is reachable from this
82
+ * module without pulling its heavier imports in.
83
+ */
84
+ declare function stripSuffix(name: string, suffix: string): string;
85
+ /**
86
+ * Compute the DotNS node hash for a name like `"alice.paseo"` or
87
+ * `"bob.alice.paseo"`, rooted at `tld`.
88
+ *
89
+ * The trailing suffix is the TLD (folded into `tld.node`); remaining labels are
90
+ * hashed most-significant-last, so `bob.alice.paseo` layers `bob` on top of
91
+ * `alice` on top of the TLD. Input is used as-is — normalize with
92
+ * `normalizeDotNsName` first if needed.
93
+ *
94
+ * `tld` is required rather than defaulted, because a default that is correct on
95
+ * one deployment is the defect this module was fixed for. It is also not
96
+ * validated here: a name whose suffix belongs to another deployment hashes to a
97
+ * node under `tld` instead of being refused, since this function returns a hash
98
+ * and has nowhere to report a complaint. The entry points in
99
+ * `./dotns-registry.js` do that check, where there is an error channel.
100
+ *
101
+ * @returns the 32-byte node as a `0x`-prefixed hex string.
102
+ */
103
+ declare function namehash(name: string, tld: DotNsTld): `0x${string}`;
104
+
105
+ /**
106
+ * Identity module types
107
+ *
108
+ * Types for DotNS name resolution and context-alias derivation
109
+ */
110
+ /** DotNS name resolution result */
111
+ interface DotNsRecord {
112
+ /**
113
+ * H160 the name resolves to, `0x` and 20 bytes. Not SS58: DotNS is a set of
114
+ * Revive contracts and both address fields come back as EVM addresses.
115
+ * Convert with `h160ToSs58` from `@parity/product-sdk-address` if a
116
+ * Substrate-shaped address is needed.
117
+ *
118
+ * Absent when the name is registered but has no forward record yet, the
119
+ * state of every name just after registration. An unregistered name is
120
+ * `null` from `resolveDotNs`, not a record.
121
+ */
122
+ address?: `0x${string}`;
123
+ /**
124
+ * Name that was resolved, normalized: lowercased, and carrying the
125
+ * deployment's own TLD suffix — `.paseo` on Paseo Asset Hub Next V2, `.dot`
126
+ * on Previewnet. A bare label passed in comes back suffixed.
127
+ *
128
+ * Note for a **lite-person** registrant: the registry stores their label
129
+ * flattened, so `alice.42` is registered as `alice42` and this field reads
130
+ * `alice42.paseo`. Pass the flattened spelling when resolving; the dotted
131
+ * one derives a different node and finds nothing.
132
+ */
133
+ name: string;
134
+ /** H160 of the node's owner. Not SS58, same as {@link DotNsRecord.address}. */
135
+ owner: `0x${string}`;
136
+ /**
137
+ * Expiration timestamp, if the deployment has one.
138
+ *
139
+ * Always absent today: the Paseo Asset Hub registrar exposes no expiry
140
+ * getter, so nothing populates this.
141
+ */
142
+ expiresAt?: number;
143
+ }
144
+ /**
145
+ * Context alias info: a deterministic, context-bound alias derived from a parent account
146
+ *
147
+ * @deprecated Returned by `deriveContextAlias`, whose addresses no key can spend.
148
+ * Removal: `@parity/product-sdk` 0.23.0.
149
+ */
150
+ interface ContextAliasInfo {
151
+ /** Alias SS58 address */
152
+ address: string;
153
+ /** H160 EVM address */
154
+ h160Address: `0x${string}`;
155
+ /** Parent account address */
156
+ parentAddress: string;
157
+ /** Context string used for derivation */
158
+ context: string;
159
+ }
160
+ /** Identity verification result */
161
+ interface VerificationResult {
162
+ /** Whether identity is verified */
163
+ verified: boolean;
164
+ /** Verification method used */
165
+ method: "on-chain" | "judgement" | "social";
166
+ /** Verification details */
167
+ details?: Record<string, unknown>;
168
+ }
169
+ /** On-chain identity info */
170
+ interface OnChainIdentity {
171
+ /** Display name */
172
+ display?: string;
173
+ /** Legal name */
174
+ legal?: string;
175
+ /** Web URL */
176
+ web?: string;
177
+ /** Email */
178
+ email?: string;
179
+ /** Twitter handle */
180
+ twitter?: string;
181
+ /** Riot/Matrix handle */
182
+ riot?: string;
183
+ /** Additional fields */
184
+ additional: Array<[string, string]>;
185
+ }
186
+
187
+ /**
188
+ * DotNS registry reads and writes.
189
+ *
190
+ * DotNS is an ENS-style system on Asset Hub: a `DotnsRegistry` maps a node
191
+ * (namehash) to a resolver + owner, a `DotnsResolver` maps a node to an
192
+ * address, and a `DotnsReverseResolver` maps an account back to its name. All
193
+ * are Revive contracts, reached via `@parity/product-sdk-contracts`'
194
+ * `createContract(...).<method>.query(...)`. Contract source:
195
+ * https://github.com/paritytech/dotns
196
+ *
197
+ * **Names are rooted at the network's TLD, which is per deployment.** It is
198
+ * fixed when `DotnsProtocolRegistry.initialize` runs, has no setter, and is
199
+ * published as `tld()`. `.paseo` on Paseo Asset Hub Next V2, `.dot` on
200
+ * Previewnet, and operators can choose others. Every entry point that hashes a
201
+ * name therefore asks the chain first, through {@link resolveTld}, and callers
202
+ * can supply `opts.tld` to skip the read. Hashing under the wrong root returns a
203
+ * node the chain never wrote to, so the failure looks exactly like an
204
+ * unregistered name — which is why nothing here assumes a root.
205
+ *
206
+ * **A node's resolver pointer is not necessarily a forward resolver.** The
207
+ * deployment has several — forward, reverse, content, PoP — and only the forward
208
+ * one answers `addressOf`. `resolveDotNs` therefore calls it only when the
209
+ * pointer *is* the forward resolver, and reports every other pointer as
210
+ * "registered, no forward record". The content resolver is the common case for a
211
+ * product name.
212
+ *
213
+ * A rule this module holds to throughout: **a failed read must never become a
214
+ * plausible value.** The one deliberate exception is documented on
215
+ * {@link resolveTld}, where a missing getter identifies a deployment whose TLD
216
+ * could only have been `.dot`.
217
+ *
218
+ * Reads (`resolveDotNs` / `reverseDotNs` / `isDotNsAvailable`) query chain.
219
+ * Writes return prepared calls the caller submits with their own signer:
220
+ * `setDotNsRecord` (the resolver pointer, when it needs moving, plus the
221
+ * record) and `prepareDotNsRegistration` (the commit call plus a thunk for the
222
+ * register call, which cannot be built until the commitment is on chain).
223
+ *
224
+ * Note: this deployment has no name-expiry concept (the registrar exposes no
225
+ * expiry getter), so `DotNsRecord.expiresAt` is always omitted.
226
+ */
227
+
228
+ type HexString = `0x${string}`;
229
+ /** Shared inputs for a DotNS registry call. */
230
+ interface DotNsClientOptions {
231
+ /** A contract runtime for the chain hosting DotNS (Asset Hub). */
232
+ runtime: ContractRuntime;
233
+ /**
234
+ * SS58 account that will submit the prepared calls.
235
+ *
236
+ * Required by the write helpers, which dry-run against it: `setAddress` and
237
+ * `setResolver` are owner-gated, so a dry-run from anyone else reverts.
238
+ * Optional for reads, which fall back to the pallet-revive query account.
239
+ *
240
+ * Must be SS58, not the account's H160. pallet-revive derives `msg.sender`
241
+ * from it; convert with `h160ToSs58` from `@parity/product-sdk-address`.
242
+ */
243
+ origin?: SS58String;
244
+ /** `DotnsRegistry` address. Defaults to the deployed set, which is the same on every network. */
245
+ registryAddress?: HexString;
246
+ /** `DotnsReverseResolver` address. Defaults to the deployed set. */
247
+ reverseResolverAddress?: HexString;
248
+ /** `DotnsResolver` address (writes: setDotNsRecord). Defaults to Paseo AH. */
249
+ resolverAddress?: HexString;
250
+ /** `DotnsRegistrarController` address (registration). Defaults to Paseo AH. */
251
+ registrarControllerAddress?: HexString;
252
+ /** `PopRules` address (registration price). Defaults to Paseo AH. */
253
+ popRulesAddress?: HexString;
254
+ /**
255
+ * `DotnsProtocolRegistry` address, the contract holding this network's TLD.
256
+ * Defaults to Paseo AH — and the address is the same on every network, since
257
+ * the whole set is CREATE3-deterministic.
258
+ */
259
+ protocolRegistryAddress?: HexString;
260
+ /**
261
+ * The deployment's TLD, when you already know it.
262
+ *
263
+ * Omit it and the client reads `protocolRegistry.tld()` once per runtime and
264
+ * caches it, which is the correct default: the TLD is per network and only
265
+ * the chain knows which one is in play. Supply it to skip the read for
266
+ * offline or test use, or to pin a deployment deliberately. Build it with
267
+ * `dotNsTld(".paseo")` rather than by hand — a suffix paired with the wrong
268
+ * node is rejected, because that pairing is the defect this option could
269
+ * otherwise reintroduce.
270
+ */
271
+ tld?: DotNsTld;
272
+ }
273
+ /** Arguments for {@link prepareDotNsRegistration}. */
274
+ interface RegisterDotNsArgs {
275
+ /** The name to register, e.g. `"alice.paseo"` — or the bare label `"alice"`. */
276
+ name: string;
277
+ /**
278
+ * The account that will own the registered name: an H160, `0x` and 20
279
+ * bytes. Not SS58 — DotNS is a set of Revive contracts, and the registrar
280
+ * takes the owner as an ABI `address`. Convert with `ss58ToH160` from
281
+ * `@parity/product-sdk-address` if you hold a Substrate-shaped address.
282
+ *
283
+ * Typed `string` rather than `` `0x${string}` `` so callers need no cast,
284
+ * which means the compiler will not catch an SS58 address here: it reaches
285
+ * the contract and reverts on chain.
286
+ */
287
+ owner: string;
288
+ /** Reserved-name registration (default `false`). */
289
+ reserved?: boolean;
290
+ }
291
+ /** Arguments for {@link setDotNsRecord}. */
292
+ interface SetRecordArgs {
293
+ /** The name whose resolver record is being set. */
294
+ name: string;
295
+ /**
296
+ * The address the name should resolve to: an H160, `0x` and 20 bytes. It is
297
+ * written straight into `resolver.setAddress` as an ABI `address`, so SS58
298
+ * is not accepted — convert with `ss58ToH160` from
299
+ * `@parity/product-sdk-address` first. Unenforced by the type, as with
300
+ * {@link RegisterDotNsArgs.owner}.
301
+ */
302
+ address: string;
303
+ }
304
+ /**
305
+ * Resolve a DotNS name. `expiresAt` is omitted (no on-chain expiry here).
306
+ *
307
+ * Three outcomes, because the registry's resolver pointer is configuration, not
308
+ * proof of existence:
309
+ *
310
+ * - `ok(null)` — unregistered (`registry.owner` is zero).
311
+ * - `ok({ name, owner })` — registered, no forward record yet.
312
+ * - `ok({ name, owner, address })` — resolves.
313
+ */
314
+ declare function resolveDotNs(name: string, opts: DotNsClientOptions): Promise<Result<DotNsRecord | null, DotNsError>>;
315
+ /**
316
+ * Reverse-resolve an account to its primary DotNS name.
317
+ *
318
+ * Single call: `reverseResolver.nameOf(account)`. `ok(null)` when no primary
319
+ * name is set (empty string on-chain).
320
+ */
321
+ declare function reverseDotNs(address: string, opts: DotNsClientOptions): Promise<Result<string | null, DotNsError>>;
322
+ /**
323
+ * Whether a DotNS name is available to claim.
324
+ *
325
+ * Two reads, because "not minted" and "claimable" are different questions:
326
+ *
327
+ * - `registrarController.available(label)`, the predicate `register` enforces
328
+ * through `_requireAvailableLabel`. Deliberately not inferred from
329
+ * resolution: a registered name has no forward record until its owner sets
330
+ * one, so that would report owned names as free.
331
+ * - `PopRules.classifyName(label)`, which is pure and owner-independent.
332
+ * Labels of 5 base characters or fewer are reserved for governance and can
333
+ * never be claimed, though the registrar still reports them as unminted.
334
+ *
335
+ * `ok(true)` means the name can be registered by someone. It does not mean the
336
+ * caller can register it: labels of 6 to 8 characters additionally require a
337
+ * personhood tier, which depends on the owner and is checked by
338
+ * {@link prepareDotNsRegistration}.
339
+ *
340
+ * Validated first because both reads revert on labels we already reject.
341
+ */
342
+ declare function isDotNsAvailable(name: string, opts: DotNsClientOptions): Promise<Result<boolean, DotNsError>>;
343
+ /**
344
+ * Prepare the calls binding a name to an address. Submit them in order with the
345
+ * owner's signer via `batchSubmitAndWatch`; both are owner-gated.
346
+ *
347
+ * Returns two calls when the node still points at the reverse resolver (the
348
+ * post-registration default): `registry.setResolver` first, or the record
349
+ * written by `setAddress` is real but unreadable. One call once it is pointed.
350
+ */
351
+ declare function setDotNsRecord(args: SetRecordArgs, opts: DotNsClientOptions): Promise<Result<BatchableCall[], DotNsError>>;
352
+ /** The prepared pieces of a DotNS registration. */
353
+ interface DotNsRegistration {
354
+ /** The random secret bound into both commit and register. */
355
+ secret: HexString;
356
+ /** The commitment hash (also encoded inside `commitCall`). */
357
+ commitment: HexString;
358
+ /** Submit first, with the owner's signer. */
359
+ commitCall: BatchableCall;
360
+ /** Seconds to wait after `commit` before `register` is accepted. */
361
+ minCommitmentAge: bigint;
362
+ /** Seconds after which the commitment expires and `register` is rejected. */
363
+ maxCommitmentAge: bigint;
364
+ /** Quote at prepare time, for display. The submitted value is re-read below. */
365
+ price: bigint;
366
+ /**
367
+ * Build the register call, once `minCommitmentAge` has elapsed.
368
+ *
369
+ * Deferred rather than returned up front: `register` consumes the
370
+ * commitment, so dry-running it before `commitCall` lands reverts with
371
+ * `CommitmentNotFound` and no call could be built at all. Deferring also
372
+ * prices and sizes it against the state it will actually execute in.
373
+ */
374
+ prepareRegisterCall: () => Promise<Result<BatchableCall, DotNsError>>;
375
+ }
376
+ /**
377
+ * Prepare a DotNS registration: the commit call, the shared secret, the timing
378
+ * window, and a thunk that builds the register call afterwards.
379
+ *
380
+ * 1. submit `commitCall`
381
+ * 2. wait `minCommitmentAge`, and register before `maxCommitmentAge`
382
+ * 3. `await prepareRegisterCall()`, then submit what it returns
383
+ *
384
+ * Eligibility is checked here, before the caller pays for the commit: a
385
+ * governance-reserved label, or an owner below the tier the label requires,
386
+ * fails now rather than on the second transaction.
387
+ */
388
+ declare function prepareDotNsRegistration(args: RegisterDotNsArgs, opts: DotNsClientOptions): Promise<Result<DotNsRegistration, DotNsError>>;
389
+
390
+ /**
391
+ * Minimal ABIs for the DotNS contracts: the read and write methods this module
392
+ * calls, and nothing else. Sourced from `paritytech/dotns` (`contracts/registry`,
393
+ * `contracts/resolvers`, `contracts/registrars`, `contracts/pop`).
394
+ */
395
+
396
+ /** `IPopRules.PopStatus`. Ordering is meaningful: a user meets a tier when `userStatus >= status`. */
397
+ declare const POP_STATUS: {
398
+ readonly NoStatus: 0;
399
+ readonly PopLite: 1;
400
+ readonly PopFull: 2;
401
+ readonly Reserved: 3;
402
+ };
403
+ /**
404
+ * The deployed DotNS addresses. The same on every network.
405
+ *
406
+ * Not a per-network table, despite what the old name (`PASEO_ASSETHUB_DOTNS`)
407
+ * implied: every DotNS network is deployed through the same CREATE3 factory, so
408
+ * the addresses are identical everywhere and **only the TLD differs**. Verified
409
+ * on both Paseo Asset Hub Next V2 and Previewnet — `protocolRegistry.get(...)`
410
+ * returns the same registry on each, and all six addresses hold contracts on
411
+ * both. `paritytech/dotns` `DEPLOYMENTS.md` states the mechanism, and
412
+ * `preview-net-v1` confirms it from the deploy side: the TLD is passed only as
413
+ * registry init calldata, so it moves no address.
414
+ *
415
+ * So extending this module to another network means resolving its TLD, which
416
+ * `resolveTld` already does — not adding a second address table.
417
+ *
418
+ * Each address answers `DotnsProtocolRegistry.get(bytes32)` under its
419
+ * `DotnsConstants` key (the name below, right-padded to 32 bytes) and has a
420
+ * `Revive.AccountInfoOf` entry. They are pinned rather than resolved at runtime,
421
+ * so re-verify after a redeploy; `protocolRegistry` is the address to walk from
422
+ * if we ever resolve the rest dynamically.
423
+ */
424
+ declare const DOTNS_ADDRESSES: {
425
+ readonly registry: "0xf34054fd76BbF85f216cf9908226D5f0A72E50CA";
426
+ readonly reverseResolver: "0xee3883d7eB60Ee9BCD7F3bcD8f2f05302A9Cc035";
427
+ readonly resolver: "0xbd1165E549DF96F083c0A16f61590927bC187009";
428
+ readonly registrarController: "0xBdaA01bD1bA67d709F2b1fF286Da0d854977EA30";
429
+ readonly popRules: "0x747B456bE03aec0b42bd85C51513730FBD45DA31";
430
+ readonly protocolRegistry: "0xD19e3D0C97CF501125a04A97405e3e6592fa846E";
431
+ };
432
+
433
+ /**
434
+ * Context alias derivation (deprecated, removal in 0.23.0)
435
+ *
436
+ * Derives a deterministic, context-bound alias from a parent account using blake2b-256.
437
+ *
438
+ * The output is a hash, not a key, so no signing key exists for the addresses
439
+ * returned here. See the notes on each function for what to use instead.
440
+ *
441
+ * NOTE: this is NOT the canonical sr25519 product-account derivation used by
442
+ * mobile, desktop, and dotli hosts. For that, use
443
+ * `@parity/product-sdk-keys::deriveProductAccountPublicKey`.
444
+ */
445
+
446
+ /**
447
+ * Derive a context-bound alias from a parent account.
448
+ *
449
+ * The alias is deterministically derived using:
450
+ * aliasPublicKey = blake2b256(parentPublicKey || context)
451
+ *
452
+ * @deprecated Returns addresses that no key can spend. The alias public key is a
453
+ * blake2b-256 hash rather than a derived key, so no secret corresponds to the
454
+ * SS58 address or to the H160: both can receive value and neither can ever
455
+ * send it. Removal: `@parity/product-sdk` 0.23.0. Replace by intent:
456
+ *
457
+ * - An account that holds or spends value:
458
+ * `SignerManager.getProductAccount(dotNsIdentifier, index)` from
459
+ * `@parity/product-sdk-signer`. Host-backed and actually signable.
460
+ * - The address offline, with no host: `deriveProductAccountPublicKey` from
461
+ * `@parity/product-sdk-keys`, the canonical sr25519 soft derivation.
462
+ * - An unlinkable per-context alias: select a registered ring-VRF key, then call
463
+ * `SignerManager.getProductAccountAlias(keyHandle, context, location)` or
464
+ * `createRingVRFProof(keyHandle, context, location, message)`.
465
+ * - A context-scoped identifier, never used as an account: `blake2b256` from
466
+ * `@parity/product-sdk/crypto`. Same bytes, without address packaging that
467
+ * invites the mistake.
468
+ *
469
+ * @param parentAddress - Parent account SS58 address
470
+ * @param context - Context string for derivation (e.g. an app id or scope label)
471
+ * @param ss58Prefix - SS58 prefix (default: 42)
472
+ * @returns Context alias info
473
+ */
474
+ declare function deriveContextAlias(parentAddress: string, context: string, ss58Prefix?: number): ContextAliasInfo;
475
+ /**
476
+ * Verify that a context alias was derived from a parent account.
477
+ *
478
+ * @deprecated Recomputes {@link deriveContextAlias} from two public values and
479
+ * compares the result, so it confirms a derivation relationship and nothing
480
+ * more. No secret enters the operation at any point, which means there is
481
+ * nothing here to authenticate: a passing result does not show that anyone
482
+ * controls either account. Removal: `@parity/product-sdk` 0.23.0.
483
+ *
484
+ * @param aliasAddress - Context alias SS58 address
485
+ * @param parentAddress - Claimed parent address
486
+ * @param context - Context string used for derivation
487
+ * @returns True if derivation is valid
488
+ */
489
+ declare function verifyContextAlias(aliasAddress: string, parentAddress: string, context: string): boolean;
490
+
491
+ export { type ContextAliasInfo, DOTNS_ADDRESSES, DOT_NODE, DOT_TLD, type DotNsClientOptions, DotNsError, type DotNsErrorReason, type DotNsRecord, type DotNsRegistration, type DotNsTld, type OnChainIdentity, POP_STATUS, type RegisterDotNsArgs, type SetRecordArgs, type VerificationResult, deriveContextAlias, dotNsTld, isConsistentDotNsTld, isDotNsAvailable, namehash, prepareDotNsRegistration, resolveDotNs, reverseDotNs, setDotNsRecord, stripSuffix, verifyContextAlias };