@ensnode/ensnode-sdk 1.13.1 → 1.14.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.
@@ -0,0 +1,1260 @@
1
+ import { UnixTimestamp, ChainId, Hex, NormalizedAddress, AccountId, Node, Duration, Address, LiteralName, InterpretedName } from 'enssdk';
2
+ import { ENSNamespaceId } from '@ensnode/datasources';
3
+ import { z } from 'zod/v4';
4
+ import { Hash } from 'viem';
5
+
6
+ /**
7
+ * Block Number
8
+ *
9
+ * Guaranteed to be a non-negative integer.
10
+ */
11
+ type BlockNumber = number;
12
+ /**
13
+ * Datetime value
14
+ */
15
+ type Datetime = Date;
16
+ /**
17
+ * Represents a URL that is used for RPC endpoints.
18
+ */
19
+ type RpcUrl = URL;
20
+ /**
21
+ * BlockRef
22
+ *
23
+ * Describes a block.
24
+ *
25
+ * We use parameter types to maintain fields layout and documentation across
26
+ * the domain model and its serialized counterpart.
27
+ */
28
+ interface BlockRef {
29
+ /** Block number (height) */
30
+ number: BlockNumber;
31
+ /** Block timestamp */
32
+ timestamp: UnixTimestamp;
33
+ }
34
+ /**
35
+ * A utility type that makes all properties of a type optional recursively,
36
+ * including nested objects and arrays.
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * type Config = {
41
+ * a: string;
42
+ * b: {
43
+ * x: number;
44
+ * y: { z: boolean };
45
+ * };
46
+ * c: { id: string }[];
47
+ * }
48
+ *
49
+ * type PartialConfig = DeepPartial<Config>;
50
+ * // Results in:
51
+ * // {
52
+ * // a?: string;
53
+ * // b?: {
54
+ * // x?: number;
55
+ * // y?: { z?: boolean };
56
+ * // };
57
+ * // c?: { id?: string }[];
58
+ * // }
59
+ *
60
+ * // Usage:
61
+ * const update: PartialConfig = { b: { y: { z: true } } };
62
+ * ```
63
+ */
64
+ type DeepPartial<T> = {
65
+ [P in keyof T]?: T[P] extends (infer U)[] ? DeepPartial<U>[] : T[P] extends object ? DeepPartial<T[P]> : T[P];
66
+ };
67
+ /**
68
+ * Helper type to represent an unvalidated version of a business layer type `T`,
69
+ * where all properties are optional.
70
+ *
71
+ * This is useful for building a validated object `T` from partial input,
72
+ * where the input may be missing required fields or have fields that
73
+ * are not yet validated.
74
+ *
75
+ * For example, transforming serialized representation of type `T` into
76
+ * an unvalidated version of `T` that can be later validated against
77
+ * defined business rules and constraints.
78
+ *
79
+ * ```ts
80
+ * function buildUnvalidatedValue(serialized: SerializedChainId): Unvalidated<ChainId> {
81
+ * // transform serialized chainId into unvalidated number (e.g. parseInt)
82
+ * return parseInt(serialized, 10);
83
+ * }
84
+ *
85
+ * // Later, we can validate the unvalidated value against our business rules
86
+ * function validateChainId(unvalidatedChainId: Unvalidated<ChainId>): ChainId {
87
+ * if (typeof unvalidatedChainId !== "number" || unvalidatedChainId <= 0) {
88
+ * throw new Error("Invalid ChainId");
89
+ * }
90
+ *
91
+ * return unvalidatedChainId as ChainId;
92
+ * }
93
+ *
94
+ * ```
95
+ */
96
+ type Unvalidated<T> = DeepPartial<T>;
97
+ /**
98
+ * Marks keys in K as required (not undefined) and not null.
99
+ */
100
+ type RequiredAndNotNull<T, K extends keyof T> = T & {
101
+ [P in K]-?: NonNullable<T[P]>;
102
+ };
103
+ /**
104
+ * Marks keys in K as required (not undefined) and null.
105
+ */
106
+ type RequiredAndNull<T, K extends keyof T> = T & {
107
+ [P in K]-?: null;
108
+ };
109
+
110
+ /**
111
+ * A label set ID identifies a label set (see https://ensnode.io/ensrainbow/concepts/glossary#label-set for definition).
112
+ * It is guaranteed to be 1 to 50 characters long and contain only lowercase letters (a-z)
113
+ * and hyphens (-).
114
+ */
115
+ type LabelSetId = string;
116
+ /**
117
+ * A label set version identifies a specific version of a label set. It allows clients to
118
+ * request data from a specific snapshot in time, ensuring deterministic results.
119
+ *
120
+ * It is guaranteed to be a non-negative integer.
121
+ */
122
+ type LabelSetVersion = number;
123
+ /**
124
+ * The label set preferences of an ENSRainbow client.
125
+ */
126
+ interface EnsRainbowClientLabelSet {
127
+ /**
128
+ * Optional label set ID that the ENSRainbow server is expected to use. If provided, heal
129
+ * operations will validate the ENSRainbow server is using this labelSetId.
130
+ * Required if `labelSetVersion` is defined.
131
+ */
132
+ labelSetId?: LabelSetId;
133
+ /**
134
+ * Optional highest label set version of label set id to query. Enables deterministic heal
135
+ * results across time even if the ENSRainbow server ingests label sets with greater versions
136
+ * than this value. If provided, only labels from label sets with versions less than or equal to this
137
+ * value will be returned. If not provided, the server will use the latest available version.
138
+ * When `labelSetVersion` is defined, `labelSetId` must also be defined.
139
+ */
140
+ labelSetVersion?: LabelSetVersion;
141
+ }
142
+ /**
143
+ * The state of label sets managed by an ENSRainbow server.
144
+ */
145
+ interface EnsRainbowServerLabelSet {
146
+ /**
147
+ * The LabelSetId managed by the ENSRainbow server.
148
+ */
149
+ labelSetId: LabelSetId;
150
+ /**
151
+ * The highest label set version available on the ENSRainbow server for the current
152
+ * label set ID. This represents the most recent version of the label set that the
153
+ * server has ingested and can provide label healing results for.
154
+ */
155
+ highestLabelSetVersion: LabelSetVersion;
156
+ }
157
+
158
+ /**
159
+ * Version info about ENSRainbow and its dependencies.
160
+ */
161
+ interface EnsRainbowVersionInfo {
162
+ /**
163
+ * ENSRainbow service version
164
+ *
165
+ * @see https://ghcr.io/namehash/ensnode/ensrainbow
166
+ **/
167
+ ensRainbow: string;
168
+ }
169
+ /**
170
+ * Complete public configuration object for ENSRainbow.
171
+ *
172
+ * Contains all public configuration information about the ENSRainbow service instance.
173
+ */
174
+ interface EnsRainbowPublicConfig {
175
+ /**
176
+ * The label set reference managed by the ENSRainbow server.
177
+ */
178
+ serverLabelSet: EnsRainbowServerLabelSet;
179
+ /**
180
+ * ENSRainbow version info
181
+ */
182
+ versionInfo: EnsRainbowVersionInfo;
183
+ }
184
+
185
+ /**
186
+ * A PluginName is a unique id for a 'plugin': we use the notion of
187
+ * 'plugins' to describe bundles of indexing logic.
188
+ */
189
+ declare enum PluginName {
190
+ Subgraph = "subgraph",
191
+ Basenames = "basenames",
192
+ Lineanames = "lineanames",
193
+ ThreeDNS = "threedns",
194
+ ProtocolAcceleration = "protocol-acceleration",
195
+ Registrars = "registrars",
196
+ TokenScope = "tokenscope",
197
+ /** @deprecated use {@link PluginName.Unigraph} instead */
198
+ ENSv2 = "ensv2",
199
+ Unigraph = "unigraph"
200
+ }
201
+ /**
202
+ * Version info about ENSIndexer and its dependencies.
203
+ */
204
+ interface EnsIndexerVersionInfo {
205
+ /**
206
+ * Ponder framework version
207
+ *
208
+ * @see https://www.npmjs.com/package/ponder
209
+ **/
210
+ ponder: string;
211
+ /**
212
+ * ENSDb service version
213
+ *
214
+ * Guaranteed to be the same as {@link ENSIndexerVersionInfo.ensIndexer}.
215
+ * */
216
+ ensDb: string;
217
+ /**
218
+ * ENSIndexer service version
219
+ *
220
+ * @see https://ghcr.io/namehash/ensnode/ensindexer
221
+ **/
222
+ ensIndexer: string;
223
+ /**
224
+ * ENS Normalize package version
225
+ *
226
+ * Available on NPM as: `@adraffy/ens-normalize`
227
+ *
228
+ * @see https://www.npmjs.com/package/@adraffy/ens-normalize
229
+ **/
230
+ ensNormalize: string;
231
+ }
232
+ /**
233
+ * Version info about ENSIndexer and its dependencies.
234
+ *
235
+ * @deprecated Use {@link EnsIndexerVersionInfo} instead.
236
+ */
237
+ type ENSIndexerVersionInfo = EnsIndexerVersionInfo;
238
+ /**
239
+ * Complete public configuration object for ENSIndexer.
240
+ *
241
+ * We use parameter types to maintain fields layout and documentation across
242
+ * the domain model and its serialized counterpart.
243
+ */
244
+ interface EnsIndexerPublicConfig {
245
+ /**
246
+ * The ENS namespace that ENSNode operates in the context of.
247
+ *
248
+ * See {@link ENSNamespaceIds} for available namespace identifiers.
249
+ */
250
+ namespace: ENSNamespaceId;
251
+ /**
252
+ * The "fully pinned" label set reference that ENSIndexer will request ENSRainbow use for deterministic label healing across time. This label set reference is "fully pinned" as it requires both the labelSetId and labelSetVersion fields to be defined.
253
+ */
254
+ clientLabelSet: Required<EnsRainbowClientLabelSet>;
255
+ /**
256
+ * The name of the ENSIndexer Schema in the ENSDb instance,
257
+ * where the ENSIndexer instance writes indexed data.
258
+ *
259
+ * Invariants:
260
+ * - Must be a non-empty string that is a valid Postgres database schema
261
+ * identifier.
262
+ */
263
+ ensIndexerSchemaName: string;
264
+ /**
265
+ * ENSRainbow public config
266
+ *
267
+ * Represents the public config of the connected ENSRainbow instance.
268
+ */
269
+ ensRainbowPublicConfig: EnsRainbowPublicConfig;
270
+ /**
271
+ * A set of strings referring to the names of plugins that are active.
272
+ *
273
+ * For future-proofing, this is a list of strings that may or may
274
+ * not be currently valid {@link PluginName} values.
275
+ *
276
+ * Invariants:
277
+ * - A set of strings with at least one value.
278
+ */
279
+ plugins: string[];
280
+ /**
281
+ * Indexed Chain IDs
282
+ *
283
+ * Includes the {@link ChainId} for each chain being indexed.
284
+ */
285
+ indexedChainIds: Set<ChainId>;
286
+ /**
287
+ * A feature flag to enable/disable ENSIndexer's Subgraph Compatible Indexing Behavior.
288
+ *
289
+ * If {@link isSubgraphCompatible} is true, indexing behavior will match that of the legacy ENS
290
+ * Subgraph.
291
+ *
292
+ * ENSIndexer will store and return Literal Labels and Literal Names without further interpretation.
293
+ * @see https://ensnode.io/docs/reference/terminology#literal-label
294
+ * @see https://ensnode.io/docs/reference/terminology#literal-name
295
+ *
296
+ * If {@link isSubgraphCompatible} is true, the following invariants are true for the ENSIndexerConfig:
297
+ * 1. only the 'subgraph' plugin is enabled, and
298
+ * 2. the {@link clientLabelSet} must be { labelSetId: 'subgraph', labelSetVersion: 0 }
299
+ *
300
+ * If {@link isSubgraphCompatible} is false, ENSIndexer will additionally:
301
+ *
302
+ * 1. ENSIndexer will heal all subnames of addr.reverse on the ENS Root Chain.
303
+ *
304
+ * 2. ENSIndexer will track both the keys and the values of Resolver records.
305
+ *
306
+ * WARNING: Special care must be taken when interacting with indexed resolver record values. It
307
+ * is unsafe to naively assume that indexed resolver record values are equivalent to the
308
+ * resolver record values that would be returned through dynamic lookups via the ENS protocol.
309
+ * For example, if a resolver implements CCIP-Read, the resolver records may not be
310
+ * discoverable through onchain indexing.
311
+ *
312
+ * 3. Literal Labels and Literal Names encountered by ENSIndexer will be Interpreted.
313
+ * @see https://ensnode.io/docs/reference/terminology#interpreted-label
314
+ * @see https://ensnode.io/docs/reference/terminology#interpreted-name
315
+ *
316
+ * That is,
317
+ * a) all Labels stored and returned by ENSIndexer will be Interpreted Labels, which are either:
318
+ * i. normalized, or
319
+ * ii. represented as an Encoded LabelHash of the Literal Label value found onchain, and
320
+ * b) all Names stored and returned by ENSIndexer will be Interpreted Names, which are exclusively
321
+ * composed of Interpreted Labels.
322
+ */
323
+ isSubgraphCompatible: boolean;
324
+ /**
325
+ * Version info about ENSIndexer.
326
+ */
327
+ versionInfo: EnsIndexerVersionInfo;
328
+ }
329
+ /**
330
+ * Complete public configuration object for ENSIndexer.
331
+ *
332
+ * @deprecated Use {@link EnsIndexerPublicConfig} instead.
333
+ */
334
+ type ENSIndexerPublicConfig = EnsIndexerPublicConfig;
335
+
336
+ /**
337
+ * Reasons why TheGraph fallback cannot be used.
338
+ */
339
+ declare const TheGraphCannotFallbackReasonSchema: z.ZodEnum<{
340
+ readonly NotSubgraphCompatible: "not-subgraph-compatible";
341
+ readonly NoApiKey: "no-api-key";
342
+ readonly NoSubgraphUrl: "no-subgraph-url";
343
+ }>;
344
+ type TheGraphCannotFallbackReason = z.infer<typeof TheGraphCannotFallbackReasonSchema>;
345
+ /**
346
+ * Configuration for TheGraph fallback behavior.
347
+ * Indicates whether fallback to TheGraph is possible and the reason if not.
348
+ */
349
+ declare const TheGraphFallbackSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
350
+ canFallback: z.ZodLiteral<true>;
351
+ url: z.ZodString;
352
+ }, z.core.$strict>, z.ZodObject<{
353
+ canFallback: z.ZodLiteral<false>;
354
+ reason: z.ZodEnum<{
355
+ readonly NotSubgraphCompatible: "not-subgraph-compatible";
356
+ readonly NoApiKey: "no-api-key";
357
+ readonly NoSubgraphUrl: "no-subgraph-url";
358
+ }>;
359
+ }, z.core.$strict>], "canFallback">;
360
+ type TheGraphFallback = z.infer<typeof TheGraphFallbackSchema>;
361
+
362
+ /**
363
+ * Create a Zod schema for validating ENSApiPublicConfig.
364
+ *
365
+ * @param valueLabel - Optional label for the value being validated (used in error messages)
366
+ */
367
+ declare function makeEnsApiPublicConfigSchema(valueLabel?: string): z.ZodObject<{
368
+ theGraphFallback: z.ZodDiscriminatedUnion<[z.ZodObject<{
369
+ canFallback: z.ZodLiteral<true>;
370
+ url: z.ZodString;
371
+ }, z.core.$strict>, z.ZodObject<{
372
+ canFallback: z.ZodLiteral<false>;
373
+ reason: z.ZodEnum<{
374
+ readonly NotSubgraphCompatible: "not-subgraph-compatible";
375
+ readonly NoApiKey: "no-api-key";
376
+ readonly NoSubgraphUrl: "no-subgraph-url";
377
+ }>;
378
+ }, z.core.$strict>], "canFallback">;
379
+ ensIndexerPublicConfig: z.ZodObject<{
380
+ ensIndexerSchemaName: z.ZodString;
381
+ ensRainbowPublicConfig: z.ZodObject<{
382
+ serverLabelSet: z.ZodObject<{
383
+ labelSetId: z.ZodString;
384
+ highestLabelSetVersion: z.ZodInt;
385
+ }, z.core.$strip>;
386
+ versionInfo: z.ZodObject<{
387
+ ensRainbow: z.ZodString;
388
+ }, z.core.$strip>;
389
+ }, z.core.$strip>;
390
+ indexedChainIds: z.ZodSet<z.ZodPipe<z.ZodInt, z.ZodTransform<number, number>>>;
391
+ isSubgraphCompatible: z.ZodBoolean;
392
+ clientLabelSet: z.ZodObject<{
393
+ labelSetId: z.ZodString;
394
+ labelSetVersion: z.ZodPipe<z.ZodCoercedNumber<number>, z.ZodInt>;
395
+ }, z.core.$strip>;
396
+ namespace: z.ZodEnum<{
397
+ readonly Mainnet: "mainnet";
398
+ readonly Sepolia: "sepolia";
399
+ readonly SepoliaV2: "sepolia-v2";
400
+ readonly EnsTestEnv: "ens-test-env";
401
+ }>;
402
+ plugins: z.ZodArray<z.ZodString>;
403
+ versionInfo: z.ZodObject<{
404
+ ponder: z.ZodString;
405
+ ensDb: z.ZodString;
406
+ ensIndexer: z.ZodString;
407
+ ensNormalize: z.ZodString;
408
+ }, z.core.$strip>;
409
+ }, z.core.$strip>;
410
+ versionInfo: z.ZodObject<{
411
+ ensApi: z.ZodString;
412
+ ensNormalize: z.ZodString;
413
+ }, z.core.$strip>;
414
+ }, z.core.$strip>;
415
+ /**
416
+ * Create a Zod schema for validating a serialized ENSApiPublicConfig.
417
+ *
418
+ * @deprecated Use {@link makeEnsApiPublicConfigSchema} instead.
419
+ */
420
+ declare const makeENSApiPublicConfigSchema: typeof makeEnsApiPublicConfigSchema;
421
+ declare function makeSerializedEnsApiPublicConfigSchema(valueLabel?: string): z.ZodObject<{
422
+ ensIndexerPublicConfig: z.ZodObject<{
423
+ ensIndexerSchemaName: z.ZodString;
424
+ ensRainbowPublicConfig: z.ZodObject<{
425
+ serverLabelSet: z.ZodObject<{
426
+ labelSetId: z.ZodString;
427
+ highestLabelSetVersion: z.ZodInt;
428
+ }, z.core.$strip>;
429
+ versionInfo: z.ZodObject<{
430
+ ensRainbow: z.ZodString;
431
+ }, z.core.$strip>;
432
+ }, z.core.$strip>;
433
+ indexedChainIds: z.ZodArray<z.ZodPipe<z.ZodInt, z.ZodTransform<number, number>>>;
434
+ isSubgraphCompatible: z.ZodBoolean;
435
+ clientLabelSet: z.ZodObject<{
436
+ labelSetId: z.ZodString;
437
+ labelSetVersion: z.ZodPipe<z.ZodCoercedNumber<number>, z.ZodInt>;
438
+ }, z.core.$strip>;
439
+ namespace: z.ZodEnum<{
440
+ readonly Mainnet: "mainnet";
441
+ readonly Sepolia: "sepolia";
442
+ readonly SepoliaV2: "sepolia-v2";
443
+ readonly EnsTestEnv: "ens-test-env";
444
+ }>;
445
+ plugins: z.ZodArray<z.ZodString>;
446
+ versionInfo: z.ZodObject<{
447
+ ponder: z.ZodString;
448
+ ensDb: z.ZodString;
449
+ ensIndexer: z.ZodString;
450
+ ensNormalize: z.ZodString;
451
+ }, z.core.$strip>;
452
+ }, z.core.$strip>;
453
+ theGraphFallback: z.ZodDiscriminatedUnion<[z.ZodObject<{
454
+ canFallback: z.ZodLiteral<true>;
455
+ url: z.ZodString;
456
+ }, z.core.$strict>, z.ZodObject<{
457
+ canFallback: z.ZodLiteral<false>;
458
+ reason: z.ZodEnum<{
459
+ readonly NotSubgraphCompatible: "not-subgraph-compatible";
460
+ readonly NoApiKey: "no-api-key";
461
+ readonly NoSubgraphUrl: "no-subgraph-url";
462
+ }>;
463
+ }, z.core.$strict>], "canFallback">;
464
+ versionInfo: z.ZodObject<{
465
+ ensApi: z.ZodString;
466
+ ensNormalize: z.ZodString;
467
+ }, z.core.$strip>;
468
+ }, z.core.$strip>;
469
+
470
+ /**
471
+ * Schema for {@link ErrorResponse}.
472
+ */
473
+ declare const makeErrorResponseSchema: () => z.ZodObject<{
474
+ message: z.ZodString;
475
+ details: z.ZodOptional<z.ZodUnknown>;
476
+ }, z.core.$strip>;
477
+
478
+ /**
479
+ * Encoded Referrer
480
+ *
481
+ * Represents a "raw" ENS referrer value.
482
+ *
483
+ * Registrar controllers emit referrer data as bytes32 values. This type represents
484
+ * that raw 32-byte hex string.
485
+ *
486
+ * @invariant Guaranteed to be a hex string representation of a 32-byte value.
487
+ */
488
+ type EncodedReferrer = Hex;
489
+ /**
490
+ * Encoded Referrer byte offset
491
+ *
492
+ * The count of left-padded bytes in an {@link EncodedReferrer} value.
493
+ */
494
+ declare const ENCODED_REFERRER_BYTE_OFFSET = 12;
495
+ /**
496
+ * Encoded Referrer byte length
497
+ *
498
+ * The count of bytes the {@link EncodedReferrer} value consists of.
499
+ */
500
+ declare const ENCODED_REFERRER_BYTE_LENGTH = 32;
501
+ /**
502
+ * Expected padding for a valid encoded referrer
503
+ *
504
+ * Properly encoded referrers must have exactly 12 zero bytes of left padding
505
+ * before the 20-byte Ethereum address.
506
+ */
507
+ declare const EXPECTED_ENCODED_REFERRER_PADDING: Hex;
508
+ /**
509
+ * Zero Encoded Referrer
510
+ *
511
+ * Guaranteed to be a hex string representation of a 32-byte zero value.
512
+ */
513
+ declare const ZERO_ENCODED_REFERRER: EncodedReferrer;
514
+ /**
515
+ * Build an {@link EncodedReferrer} value for the given {@link NormalizedAddress}
516
+ * according to the referrer encoding with left-zero-padding.
517
+ */
518
+ declare function buildEncodedReferrer(address: NormalizedAddress): EncodedReferrer;
519
+ /**
520
+ * Decode an {@link EncodedReferrer} value into a {@link NormalizedAddress}
521
+ * according to the referrer encoding with left-zero-padding.
522
+ *
523
+ * @param encodedReferrer - The "raw" {@link EncodedReferrer} value to decode.
524
+ * @returns The decoded referrer address.
525
+ * @throws when encodedReferrer value is not represented by
526
+ * {@link ENCODED_REFERRER_BYTE_LENGTH} bytes.
527
+ * @throws when decodedReferrer is not a valid EVM address.
528
+ */
529
+ declare function decodeEncodedReferrer(encodedReferrer: EncodedReferrer): NormalizedAddress;
530
+
531
+ /**
532
+ * Identifiers for supported currencies.
533
+ *
534
+ * TODO: Add support for WETH
535
+ */
536
+ declare const CurrencyIds: {
537
+ readonly ETH: "ETH";
538
+ readonly USDC: "USDC";
539
+ readonly DAI: "DAI";
540
+ readonly ENSTokens: "ENSTokens";
541
+ };
542
+ type CurrencyId = (typeof CurrencyIds)[keyof typeof CurrencyIds];
543
+ /**
544
+ * The amount of the currency in the smallest unit of the currency
545
+ * (see {@link CurrencyInfo.decimals} for the currency).
546
+ *
547
+ * Guaranteed to be non-negative.
548
+ */
549
+ type CurrencyAmount = bigint;
550
+ /**
551
+ * Serialized representation of {@link CurrencyAmount}.
552
+ */
553
+ type SerializedCurrencyAmount = string;
554
+ interface PriceEth {
555
+ currency: typeof CurrencyIds.ETH;
556
+ amount: CurrencyAmount;
557
+ }
558
+ interface PriceDai {
559
+ currency: typeof CurrencyIds.DAI;
560
+ amount: CurrencyAmount;
561
+ }
562
+ interface PriceUsdc {
563
+ currency: typeof CurrencyIds.USDC;
564
+ amount: CurrencyAmount;
565
+ }
566
+ interface PriceEnsTokens {
567
+ currency: typeof CurrencyIds.ENSTokens;
568
+ amount: CurrencyAmount;
569
+ }
570
+ type Price = PriceEth | PriceDai | PriceUsdc | PriceEnsTokens;
571
+ /**
572
+ * Serialized representation of {@link PriceEth}.
573
+ */
574
+ interface SerializedPriceEth extends Omit<PriceEth, "amount"> {
575
+ amount: SerializedCurrencyAmount;
576
+ }
577
+ /**
578
+ * Serialized representation of {@link PriceDai}.
579
+ */
580
+ interface SerializedPriceDai extends Omit<PriceDai, "amount"> {
581
+ amount: SerializedCurrencyAmount;
582
+ }
583
+ /**
584
+ * Serialized representation of {@link PriceUsdc}.
585
+ */
586
+ interface SerializedPriceUsdc extends Omit<PriceUsdc, "amount"> {
587
+ amount: SerializedCurrencyAmount;
588
+ }
589
+ /**
590
+ * Serialized representation of {@link PriceEnsTokens}.
591
+ */
592
+ interface SerializedPriceEnsTokens extends Omit<PriceEnsTokens, "amount"> {
593
+ amount: SerializedCurrencyAmount;
594
+ }
595
+ /**
596
+ * Serialized representation of {@link Price}.
597
+ */
598
+ type SerializedPrice = SerializedPriceEth | SerializedPriceDai | SerializedPriceUsdc | SerializedPriceEnsTokens;
599
+ interface CurrencyInfo {
600
+ id: CurrencyId;
601
+ name: string;
602
+ decimals: number;
603
+ }
604
+ /**
605
+ * Get currency info for a provided currency.
606
+ */
607
+ declare function getCurrencyInfo(currencyId: CurrencyId): CurrencyInfo;
608
+ /**
609
+ * Create price in ETH for given amount.
610
+ */
611
+ declare function priceEth(amount: Price["amount"]): PriceEth;
612
+ /**
613
+ * Create price in USDC for given amount.
614
+ */
615
+ declare function priceUsdc(amount: Price["amount"]): PriceUsdc;
616
+ /**
617
+ * Create price in DAI for given amount.
618
+ */
619
+ declare function priceDai(amount: Price["amount"]): PriceDai;
620
+ /**
621
+ * Create price in ENS Tokens for given amount.
622
+ */
623
+ declare function priceEnsTokens(amount: Price["amount"]): PriceEnsTokens;
624
+ /**
625
+ * Check if two prices have the same currency.
626
+ */
627
+ declare function isPriceCurrencyEqual(priceA: Price, priceB: Price): boolean;
628
+ /**
629
+ * Check if two {@link Price} values have the same currency and amount.
630
+ */
631
+ declare function isPriceEqual(priceA: Price, priceB: Price): boolean;
632
+ /**
633
+ * Add prices
634
+ *
635
+ * @param prices at least two {@link Price} values to be added together.
636
+ * @returns total of all prices.
637
+ * @throws if not all prices have the same currency.
638
+ */
639
+ declare function addPrices<const PriceType extends Price = Price>(...prices: [PriceType, PriceType, ...PriceType[]]): PriceType;
640
+ /**
641
+ * Subtract price B from price A.
642
+ *
643
+ * @param a the minuend {@link Price} value.
644
+ * @param b the subtrahend {@link Price} value.
645
+ * @returns the resulting {@link Price} (`a - b`) with the same currency as the inputs.
646
+ * @throws if the prices have different currencies.
647
+ * @throws if the result would be negative ({@link CurrencyAmount} must be non-negative).
648
+ */
649
+ declare function subtractPrice<const PriceType extends Price = Price>(a: PriceType, b: PriceType): PriceType;
650
+ /**
651
+ * Return the smallest of the given {@link Price} values.
652
+ *
653
+ * @param prices at least two {@link Price} values to compare.
654
+ * @returns the {@link Price} with the smallest amount. Ties return the first
655
+ * such value in argument order.
656
+ * @throws if not all prices have the same currency.
657
+ */
658
+ declare function minPrice<const PriceType extends Price = Price>(...prices: [PriceType, PriceType, ...PriceType[]]): PriceType;
659
+ /**
660
+ * Return the largest of the given {@link Price} values.
661
+ *
662
+ * @param prices at least two {@link Price} values to compare.
663
+ * @returns the {@link Price} with the largest amount. Ties return the first
664
+ * such value in argument order.
665
+ * @throws if not all prices have the same currency.
666
+ */
667
+ declare function maxPrice<const PriceType extends Price = Price>(...prices: [PriceType, PriceType, ...PriceType[]]): PriceType;
668
+ /**
669
+ * Scales a Price object by a floating-point number while maintaining precision.
670
+ *
671
+ * **Important:** The precision of this method is bound to the precision of float
672
+ * in JavaScript. For more information, see {@link scaleBigintByNumber}.
673
+ *
674
+ * @param price - The Price object to scale
675
+ * @param scaleFactor - The number to multiply by (can be a decimal like 0.5)
676
+ * @returns A new Price object with the scaled amount and same currency
677
+ *
678
+ * @throws {Error} If scaleFactor is negative, NaN, or infinite
679
+ * @throws {Error} If price amount is negative
680
+ *
681
+ * @example
682
+ * // Scale USDC price by 0.5
683
+ * const price = priceUsdc(1000000n); // 1 USDC
684
+ * const scaled = scalePrice(price, 0.5); // 0.5 USDC
685
+ * // scaled = { currency: "USDC", amount: 500000n }
686
+ *
687
+ * @example
688
+ * // Calculate 33.3% of ETH price
689
+ * const ethPrice = priceEth(1000000000000000000n); // 1 ETH
690
+ * const share = scalePrice(ethPrice, 0.333);
691
+ * // share = { currency: "ETH", amount: 333000000000000000n }
692
+ */
693
+ declare function scalePrice<T extends Price>(price: T, scaleFactor: number): T;
694
+ /**
695
+ * Parses a string representation of ETH into a {@link PriceEth} object.
696
+ *
697
+ * Uses {@link getCurrencyInfo} to get the correct number of decimals (18) for ETH
698
+ * and {@link parseUnits} from viem to convert the decimal string to a bigint.
699
+ *
700
+ * **Note:** Values with more than 18 decimal places will be truncated/rounded by viem's `parseUnits`.
701
+ *
702
+ * @param value - The decimal string to parse (e.g., "0.015" for 0.015 ETH)
703
+ * @returns A PriceEth object with the amount in wei (smallest unit)
704
+ *
705
+ * @throws {Error} If value is empty, whitespace-only or untrimmed
706
+ * @throws {Error} If value represents a negative number
707
+ * @throws {Error} If value is not a valid decimal string (e.g., "abc", "1.2.3")
708
+ *
709
+ * @example
710
+ * parseEth("0.015") // returns { currency: "ETH", amount: 15000000000000000n }
711
+ * parseEth("1") // returns { currency: "ETH", amount: 1000000000000000000n }
712
+ * parseEth("123.456789012345678") // returns { currency: "ETH", amount: 123456789012345678000n }
713
+ */
714
+ declare function parseEth(value: string): PriceEth;
715
+ /**
716
+ * Parses a string representation of USDC into a {@link PriceUsdc} object.
717
+ *
718
+ * Uses {@link getCurrencyInfo} to get the correct number of decimals (6) for USDC
719
+ * and {@link parseUnits} from viem to convert the decimal string to a bigint.
720
+ *
721
+ * **Note:** Values with more than 6 decimal places will be truncated/rounded by viem's `parseUnits`.
722
+ *
723
+ * @param value - The decimal string to parse (e.g., "123.45678" for $123.45678)
724
+ * @returns A PriceUsdc object with the amount in the smallest unit (6 decimals)
725
+ *
726
+ * @throws {Error} If value is empty, whitespace-only or untrimmed
727
+ * @throws {Error} If value represents a negative number
728
+ * @throws {Error} If value is not a valid decimal string (e.g., "abc", "1.2.3")
729
+ *
730
+ * @example
731
+ * parseUsdc("123.45678") // returns { currency: "USDC", amount: 123456780n }
732
+ * parseUsdc("1") // returns { currency: "USDC", amount: 1000000n }
733
+ * parseUsdc("0.001") // returns { currency: "USDC", amount: 1000n }
734
+ */
735
+ declare function parseUsdc(value: string): PriceUsdc;
736
+ /**
737
+ * Parses a string representation of DAI into a {@link PriceDai} object.
738
+ *
739
+ * Uses {@link getCurrencyInfo} to get the correct number of decimals (18) for DAI
740
+ * and {@link parseUnits} from viem to convert the decimal string to a bigint.
741
+ *
742
+ * **Note:** Values with more than 18 decimal places will be truncated/rounded by viem's `parseUnits`.
743
+ *
744
+ * @param value - The decimal string to parse (e.g., "123.456789012345678" for 123.456789012345678 DAI)
745
+ * @returns A PriceDai object with the amount in the smallest unit (18 decimals)
746
+ *
747
+ * @throws {Error} If value is empty, whitespace-only or untrimmed
748
+ * @throws {Error} If value represents a negative number
749
+ * @throws {Error} If value is not a valid decimal string (e.g., "abc", "1.2.3")
750
+ *
751
+ * @example
752
+ * parseDai("123.456789012345678") // returns { currency: "DAI", amount: 123456789012345678000n }
753
+ * parseDai("1") // returns { currency: "DAI", amount: 1000000000000000000n }
754
+ * parseDai("0.001") // returns { currency: "DAI", amount: 1000000000000000n }
755
+ */
756
+ declare function parseDai(value: string): PriceDai;
757
+ /**
758
+ * Parses a string representation of ENS Tokens into a {@link PriceEnsTokens} object.
759
+ *
760
+ * Uses {@link getCurrencyInfo} to get the correct number of decimals (18) for ENS Tokens
761
+ * and {@link parseUnits} from viem to convert the decimal string to a bigint.
762
+ *
763
+ * **Note:** Values with more than 18 decimal places will be truncated/rounded by viem's `parseUnits`.
764
+ *
765
+ * @param value - The decimal string to parse (e.g., "123.456789012345678" for 123.456789012345678 ENS Tokens)
766
+ * @returns A PriceEnsTokens object with the amount in the smallest unit (18 decimals)
767
+ *
768
+ * @throws {Error} If value is empty, whitespace-only or untrimmed
769
+ * @throws {Error} If value represents a negative number
770
+ * @throws {Error} If value is not a valid decimal string (e.g., "abc", "1.2.3")
771
+ *
772
+ * @example
773
+ * parseEnsTokens("123.456789012345678") // returns { currency: "ENSTokens", amount: 123456789012345678000n }
774
+ * parseEnsTokens("1") // returns { currency: "ENSTokens", amount: 1000000000000000000n }
775
+ * parseEnsTokens("0.001") // returns { currency: "ENSTokens", amount: 1000000000000000n }
776
+ */
777
+ declare function parseEnsTokens(value: string): PriceEnsTokens;
778
+
779
+ /**
780
+ * Subregistry
781
+ */
782
+ interface Subregistry {
783
+ /**
784
+ * Subregistry ID
785
+ *
786
+ * The ID of the subregistry the "logical registrar action" was taken on.
787
+ *
788
+ * Identifies the chainId and address of the associated subregistry smart
789
+ * contract.
790
+ */
791
+ subregistryId: AccountId;
792
+ /**
793
+ * The node (namehash) of the name the subregistry manages subnames of.
794
+ * Example subregistry managed names:
795
+ * - `eth`
796
+ * - `base.eth`
797
+ * - `linea.eth`
798
+ */
799
+ node: Node;
800
+ }
801
+
802
+ /**
803
+ * Registration Lifecycle Stages
804
+ *
805
+ * Important: this definition should not be used anywhere.
806
+ * It's only here to capture some ideas that were shared in the team.
807
+ */
808
+ declare const RegistrationLifecycleStages: {
809
+ /**
810
+ * Active
811
+ *
812
+ * Happens when
813
+ * the current timestamp <= expiry.
814
+ */
815
+ readonly Active: "registrationLifecycle_active";
816
+ /**
817
+ * Grace Period
818
+ *
819
+ * Happens when
820
+ * `expiry < the current timestamp <= expiry + 90 days`.
821
+ */
822
+ readonly GracePeriod: "registrationLifecycle_gracePeriod";
823
+ /**
824
+ * Released with Temporary Premium Price
825
+ *
826
+ * Happens when
827
+ * `expiry + 90 days < the current timestamp <= expiry + 120 days`.
828
+ */
829
+ readonly ReleasedWithTempPrice: "registrationLifecycle_releasedWithTempPrice";
830
+ /**
831
+ * Fully Released (Regular Price)
832
+ *
833
+ * Happens when
834
+ * ` expiry + 120 days < the current timestamp`.
835
+ */
836
+ readonly FullyReleased: "registrationLifecycle_fullyReleased";
837
+ };
838
+ type RegistrationLifecycleStage = (typeof RegistrationLifecycleStages)[keyof typeof RegistrationLifecycleStages];
839
+ /**
840
+ * Registration Lifecycle
841
+ */
842
+ interface RegistrationLifecycle {
843
+ /**
844
+ * Subregistry that manages this Registration Lifecycle.
845
+ */
846
+ subregistry: Subregistry;
847
+ /**
848
+ * The node (namehash) of the FQDN of the domain the registration lifecycle
849
+ * is associated with.
850
+ *
851
+ * Guaranteed to be a subname of the node (namehash) of the subregistry
852
+ * identified by `subregistryId.subregistryId`.
853
+ */
854
+ node: Node;
855
+ /**
856
+ * Expires at
857
+ *
858
+ * Identifies when the Registration Lifecycle is scheduled to expire.
859
+ */
860
+ expiresAt: UnixTimestamp;
861
+ }
862
+
863
+ /**
864
+ * Globally unique, deterministic ID of an indexed onchain event
865
+ * associated with the "logical registrar action".
866
+ */
867
+ type RegistrarActionEventId = string;
868
+ /**
869
+ * Types of "logical registrar action".
870
+ */
871
+ declare const RegistrarActionTypes: {
872
+ readonly Registration: "registration";
873
+ readonly Renewal: "renewal";
874
+ };
875
+ type RegistrarActionType = (typeof RegistrarActionTypes)[keyof typeof RegistrarActionTypes];
876
+ /**
877
+ * Pricing information for a "logical registrar action".
878
+ */
879
+ interface RegistrarActionPricingAvailable {
880
+ /**
881
+ * Base cost
882
+ *
883
+ * Base cost (before any `premium`) of Ether measured in units of Wei
884
+ * paid to execute the "logical registrar action".
885
+ *
886
+ * May be 0.
887
+ */
888
+ baseCost: PriceEth;
889
+ /**
890
+ * Premium
891
+ *
892
+ * "premium" cost (in excesses of the `baseCost`) of Ether measured in
893
+ * units of Wei paid to execute the "logical registrar action".
894
+ *
895
+ * May be 0.
896
+ */
897
+ premium: PriceEth;
898
+ /**
899
+ * Total
900
+ *
901
+ * Total cost of Ether measured in units of Wei paid to execute
902
+ * the "logical registrar action".
903
+ *
904
+ * May be 0.
905
+ */
906
+ total: PriceEth;
907
+ }
908
+ /**
909
+ * Pricing information for a "logical registrar action" when
910
+ * there is no known pricing data.
911
+ */
912
+ interface RegistrarActionPricingUnknown {
913
+ /**
914
+ * Base cost
915
+ *
916
+ * Base cost (before any `premium`) of Ether measured in units of Wei
917
+ * paid to execute the "logical registrar action".
918
+ */
919
+ baseCost: null;
920
+ /**
921
+ * Premium
922
+ *
923
+ * "premium" cost (in excesses of the `baseCost`) of Ether measured in
924
+ * units of Wei paid to execute the "logical registrar action".
925
+ */
926
+ premium: null;
927
+ /**
928
+ * Total
929
+ *
930
+ * Total cost of Ether measured in units of Wei paid to execute
931
+ * the "logical registrar action".
932
+ */
933
+ total: null;
934
+ }
935
+ type RegistrarActionPricing = RegistrarActionPricingAvailable | RegistrarActionPricingUnknown;
936
+ declare function isRegistrarActionPricingAvailable(registrarActionPricing: RegistrarActionPricing): registrarActionPricing is RegistrarActionPricingAvailable;
937
+ /**
938
+ * * Referral information for performing a "logical registrar action".
939
+ */
940
+ interface RegistrarActionReferralAvailable {
941
+ /**
942
+ * Encoded Referrer
943
+ *
944
+ * Represents the "raw" 32-byte "referrer" value emitted onchain in
945
+ * association with the registrar action.
946
+ */
947
+ encodedReferrer: EncodedReferrer;
948
+ /**
949
+ * Decoded Referrer
950
+ *
951
+ * The referrer address decoded from {@link encodedReferrer} using strict
952
+ * left-zero-padding validation.
953
+ *
954
+ * Identifies the interpreted address of the referrer.
955
+ * The "chainId" of this address is the same as is referenced in
956
+ * `subregistryId`.
957
+ *
958
+ * May be the "zero address" to represent that an `encodedReferrer` is
959
+ * defined but that it is interpreted as no referrer.
960
+ */
961
+ decodedReferrer: Address;
962
+ }
963
+ /**
964
+ * Referral information for performing a "logical registrar action" when
965
+ * registrar controller does not implement referrals.
966
+ */
967
+ interface RegistrarActionReferralNotApplicable {
968
+ /**
969
+ * Encoded Referrer
970
+ *
971
+ * Represents the "raw" 32-byte "referrer" value emitted onchain in
972
+ * association with the registrar action.
973
+ */
974
+ encodedReferrer: null;
975
+ /**
976
+ * Decoded Referrer
977
+ *
978
+ * The referrer address decoded from {@link encodedReferrer} using strict
979
+ * left-zero-padding validation. Null when the registrar controller does not implement referrals.
980
+ */
981
+ decodedReferrer: null;
982
+ }
983
+ type RegistrarActionReferral = RegistrarActionReferralAvailable | RegistrarActionReferralNotApplicable;
984
+ declare function isRegistrarActionReferralAvailable(registrarActionReferral: RegistrarActionReferral): registrarActionReferral is RegistrarActionReferralAvailable;
985
+ /**
986
+ * "Logical registrar action"
987
+ *
988
+ * Represents a state of "logical registrar action". May be built using data
989
+ * from multiple events within the same "logical" registration / renewal action.
990
+ */
991
+ interface RegistrarAction {
992
+ /**
993
+ * "Logical registrar action" ID
994
+ *
995
+ * The `id` value is a deterministic and globally unique identifier for
996
+ * the "logical registrar action".
997
+ *
998
+ * The `id` value represents the *initial* onchain event associated with
999
+ * the "logical registrar action", but the full state of
1000
+ * the "logical registrar action" is an aggregate across each of
1001
+ * the onchain events referenced in the `eventIds` field.
1002
+ *
1003
+ * Guaranteed to be the very first element in `eventIds` array.
1004
+ */
1005
+ id: RegistrarActionEventId;
1006
+ /**
1007
+ * The type of the "logical registrar action".
1008
+ */
1009
+ type: RegistrarActionType;
1010
+ /**
1011
+ *
1012
+ * Incremental Duration
1013
+ *
1014
+ * If `type` is "registration":
1015
+ * - Represents the duration between `block.timestamp` and
1016
+ * the initial `registrationLifecycle.expiresAt` value that the associated
1017
+ * "registration lifecycle" will be initialized with.
1018
+ * If `type` is "renewal":
1019
+ * - Represents the incremental increase in duration made to
1020
+ * the `registrationLifecycle.expiresAt` value in the associated
1021
+ * "registration lifecycle".
1022
+ *
1023
+ * A "registration lifecycle" may be extended via renewal even after it
1024
+ * expires if it is still within its grace period.
1025
+ *
1026
+ * Consider the following scenario:
1027
+ *
1028
+ * The "registration lifecycle" of a direct subname of .eth is scheduled to
1029
+ * expire on Jan 1, midnight UTC. It is currently 30 days after this
1030
+ * expiration time. Therefore, there are currently another 60 days of grace
1031
+ * period remaining for this name. Anyone can still make a renewal to
1032
+ * extend the "registration lifecycle" of this name.
1033
+ *
1034
+ * Given this scenario, consider the following examples:
1035
+ *
1036
+ * 1. If a renewal is made with 10 days incremental duration,
1037
+ * the "registration lifecycle" for this name will remain in
1038
+ * an "expired" state, but it will now have another 70 days of
1039
+ * grace period remaining.
1040
+ *
1041
+ * 2. If a renewal is made with 50 days incremental duration,
1042
+ * the "registration lifecycle" for this name will no longer be
1043
+ * "expired" and will become "active", but the "registration lifecycle"
1044
+ * will now be scheduled to expire again in 20 days.
1045
+ *
1046
+ * After the "registration lifecycle" for a name becomes expired by more
1047
+ * than its grace period, it can no longer be renewed by anyone and is
1048
+ * considered "released". The name must first be registered again, starting
1049
+ * a new "registration lifecycle" of
1050
+ * active / expired / grace period / released.
1051
+ *
1052
+ * May be 0.
1053
+ *
1054
+ * Guaranteed to be a non-negative bigint value.
1055
+ */
1056
+ incrementalDuration: Duration;
1057
+ /**
1058
+ * Registrant
1059
+ *
1060
+ * Identifies the address that initiated the "logical registrar action" and
1061
+ * is paying the `pricing.total` cost (if applicable).
1062
+ *
1063
+ * It may not be the owner of the name:
1064
+ * 1. When a name is registered, the initial owner of the name may be
1065
+ * distinct from the registrant.
1066
+ * 2. There are no restrictions on who may renew a name.
1067
+ * Therefore the owner of the name may be distinct from the registrant.
1068
+ *
1069
+ * The "chainId" of this address is the same as is referenced in
1070
+ * `registrationLifecycle.subregistry.subregistryId`.
1071
+ */
1072
+ registrant: Address;
1073
+ /**
1074
+ * Registration Lifecycle associated with this "logical registrar action".
1075
+ */
1076
+ registrationLifecycle: RegistrationLifecycle;
1077
+ /**
1078
+ * Pricing information associated with this "logical registrar action".
1079
+ */
1080
+ pricing: RegistrarActionPricing;
1081
+ /**
1082
+ * Referral information associated with this "logical registrar action".
1083
+ */
1084
+ referral: RegistrarActionReferral;
1085
+ /**
1086
+ * Block ref
1087
+ *
1088
+ * References the block where the "logical registrar action" was executed.
1089
+ *
1090
+ * The "chainId" of this block is the same as is referenced in
1091
+ * `registrationLifecycle.subregistry.subregistryId`.
1092
+ */
1093
+ block: BlockRef;
1094
+ /**
1095
+ * Transaction hash
1096
+ *
1097
+ * Transaction hash of the transaction associated with
1098
+ * the "logical registrar action".
1099
+ *
1100
+ * The "chainId" of this transaction is the same as is referenced in
1101
+ * `registrationLifecycle.subregistry.subregistryId`.
1102
+ *
1103
+ * Note that a single transaction may be associated with any number of
1104
+ * "logical registrar actions".
1105
+ */
1106
+ transactionHash: Hash;
1107
+ /**
1108
+ * Event IDs
1109
+ *
1110
+ * Array of the eventIds that have contributed to the state of
1111
+ * the "logical registrar action" record.
1112
+ *
1113
+ * Each eventId is a deterministic and globally unique onchain event
1114
+ * identifier.
1115
+ *
1116
+ * Guarantees:
1117
+ * - Each eventId is of events that occurred within the block
1118
+ * referenced by `block.number`.
1119
+ * - At least 1 eventId.
1120
+ * - Ordered chronologically (ascending) by logIndex within `block.number`.
1121
+ * - The first element in the array is equal to the `id` of
1122
+ * the overall "logical registrar action" record.
1123
+ *
1124
+ * The following ideas are not generalized for ENS overall but happen to
1125
+ * be a characteristic of the scope of our current indexing logic:
1126
+ * 1. These id's always reference events emitted by
1127
+ * a related "BaseRegistrar" contract.
1128
+ * 2. These id's optionally reference events emitted by
1129
+ * a related "Registrar Controller" contract. This is because our
1130
+ * current indexing logic doesn't guarantee to index
1131
+ * all "Registrar Controller" contracts.
1132
+ */
1133
+ eventIds: [RegistrarActionEventId, ...RegistrarActionEventId[]];
1134
+ }
1135
+ /**
1136
+ * Serialized representation of {@link RegistrarActionPricingUnknown}.
1137
+ */
1138
+ type SerializedRegistrarActionPricingUnknown = RegistrarActionPricingUnknown;
1139
+ /**
1140
+ * Serialized representation of {@link RegistrarActionPricingAvailable}.
1141
+ */
1142
+ interface SerializedRegistrarActionPricingAvailable {
1143
+ baseCost: SerializedPriceEth;
1144
+ premium: SerializedPriceEth;
1145
+ total: SerializedPriceEth;
1146
+ }
1147
+ /**
1148
+ * Serialized representation of {@link RegistrarActionPricing}.
1149
+ */
1150
+ type SerializedRegistrarActionPricing = SerializedRegistrarActionPricingAvailable | SerializedRegistrarActionPricingUnknown;
1151
+ /**
1152
+ * Serialized representation of {@link RegistrarAction}.
1153
+ */
1154
+ interface SerializedRegistrarAction extends Omit<RegistrarAction, "pricing"> {
1155
+ pricing: SerializedRegistrarActionPricing;
1156
+ }
1157
+ declare function serializeRegistrarActionPricing(pricing: RegistrarActionPricing): SerializedRegistrarActionPricing;
1158
+ declare function serializeRegistrarAction(registrarAction: RegistrarAction): SerializedRegistrarAction;
1159
+
1160
+ /**
1161
+ * Interprets a NormalizedAddress. zeroAddress is interpreted as null, otherwise as-is.
1162
+ */
1163
+ declare const interpretAddress: (owner: NormalizedAddress) => NormalizedAddress | null;
1164
+
1165
+ /**
1166
+ * Interprets a name record value string and returns null if the value is interpreted as a deletion.
1167
+ *
1168
+ * The interpreted record value is either:
1169
+ * a) null, representing a non-existent or deletion of the record, or
1170
+ * b) an {@link InterpretedName}.
1171
+ *
1172
+ * @param value - The name record value string to interpret.
1173
+ * @returns The interpreted name string, or null if deleted.
1174
+ */
1175
+ declare function interpretNameRecordValue(value: LiteralName): InterpretedName | null;
1176
+ /**
1177
+ * Interprets an address record value string and returns null if the value is interpreted as a deletion.
1178
+ *
1179
+ * The interpreted record value is either:
1180
+ * a) null, representing a non-existent or deletion of the record, or
1181
+ * i. contains null bytes
1182
+ * ii. empty string
1183
+ * iii. empty hex (0x)
1184
+ * iv. zeroAddress
1185
+ * b) an address record value that
1186
+ * i. does not contain null bytes
1187
+ * ii. (if is an EVM address) is lowercase
1188
+ *
1189
+ * @param value - The address record value to interpret.
1190
+ * @returns The interpreted address string or null if deleted.
1191
+ */
1192
+ declare function interpretAddressRecordValue(value: string): string | null;
1193
+ /**
1194
+ * Interprets a text record key string and returns null if the key should be ignored.
1195
+ *
1196
+ * The interpreted text record key is either:
1197
+ * a) null, representing a text record key that should be ignored, or
1198
+ * i. contains null bytes
1199
+ * ii. empty string
1200
+ * b) a text record key that
1201
+ * i. does not contain null bytes
1202
+ *
1203
+ * @param value - The text record key to interpret.
1204
+ * @returns The interpreted text string or null if ignored.
1205
+ */
1206
+ declare function interpretTextRecordKey(key: string): string | null;
1207
+ /**
1208
+ * Interprets a text record value string and returns null if the value is interpreted as a deletion.
1209
+ *
1210
+ * The interpreted record value is either:
1211
+ * a) null, representing a non-existent or deletion of the record, or
1212
+ * i. contains null bytes
1213
+ * ii. empty string
1214
+ * b) a text record value that
1215
+ * i. does not contain null bytes
1216
+ *
1217
+ * @param value - The text record value to interpret.
1218
+ * @returns The interpreted text string or null if deleted.
1219
+ */
1220
+ declare function interpretTextRecordValue(value: string): string | null;
1221
+
1222
+ /**
1223
+ * Interprets an ENSIP-7 contenthash value. Empty bytes are interpreted as deletion.
1224
+ */
1225
+ declare function interpretContenthashValue(value: Hex): Hex | null;
1226
+ /**
1227
+ * Interprets a PubkeyResolver (x, y) pair. A (zeroHash, zeroHash) pair is interpreted as deletion.
1228
+ *
1229
+ * Invariant: both null together, or both set together.
1230
+ */
1231
+ declare function interpretPubkeyValue(x: Hex, y: Hex): {
1232
+ x: Hex;
1233
+ y: Hex;
1234
+ } | null;
1235
+ /**
1236
+ * Interprets an IDNSZoneResolver zonehash value. Empty bytes are interpreted as deletion.
1237
+ */
1238
+ declare function interpretDnszonehashValue(value: Hex): Hex | null;
1239
+
1240
+ /**
1241
+ * A value that varies by ENS namespace, with a required default.
1242
+ *
1243
+ * @example
1244
+ * ```ts
1245
+ * const exampleNames: NamespaceSpecificValue<string[]> = {
1246
+ * default: ["vitalik.eth", "nick.eth"],
1247
+ * [ENSNamespaceIds.EnsTestEnv]: ["test.eth", "demo.eth"],
1248
+ * };
1249
+ * ```
1250
+ */
1251
+ type NamespaceSpecificValue<T> = {
1252
+ default: T;
1253
+ } & Partial<Record<ENSNamespaceId, T>>;
1254
+ /**
1255
+ * Resolves a {@link NamespaceSpecificValue} for a given namespace,
1256
+ * falling back to the default.
1257
+ */
1258
+ declare function getNamespaceSpecificValue<T>(namespace: ENSNamespaceId, value: NamespaceSpecificValue<T>): T;
1259
+
1260
+ export { type SerializedCurrencyAmount as $, type EncodedReferrer as A, type BlockNumber as B, type CurrencyAmount as C, type Datetime as D, type EnsRainbowPublicConfig as E, type EnsRainbowVersionInfo as F, type RegistrarActionEventId as G, type RegistrarActionPricing as H, type RegistrarActionPricingAvailable as I, type RegistrarActionPricingUnknown as J, type RegistrarActionReferral as K, type LabelSetId as L, type RegistrarActionReferralAvailable as M, type NamespaceSpecificValue as N, type RegistrarActionReferralNotApplicable as O, PluginName as P, type RegistrarActionType as Q, type RegistrarAction as R, type SerializedRegistrarAction as S, type TheGraphFallback as T, type Unvalidated as U, RegistrarActionTypes as V, type RegistrationLifecycle as W, type RegistrationLifecycleStage as X, type RequiredAndNotNull as Y, type RequiredAndNull as Z, type RpcUrl as _, type EnsIndexerPublicConfig as a, type SerializedRegistrarActionPricing as a0, type SerializedRegistrarActionPricingAvailable as a1, type SerializedRegistrarActionPricingUnknown as a2, type Subregistry as a3, type TheGraphCannotFallbackReason as a4, TheGraphCannotFallbackReasonSchema as a5, TheGraphFallbackSchema as a6, ZERO_ENCODED_REFERRER as a7, addPrices as a8, buildEncodedReferrer as a9, priceEth as aA, priceUsdc as aB, scalePrice as aC, serializeRegistrarAction as aD, serializeRegistrarActionPricing as aE, subtractPrice as aF, decodeEncodedReferrer as aa, getCurrencyInfo as ab, getNamespaceSpecificValue as ac, interpretAddress as ad, interpretAddressRecordValue as ae, interpretContenthashValue as af, interpretDnszonehashValue as ag, interpretNameRecordValue as ah, interpretPubkeyValue as ai, interpretTextRecordKey as aj, interpretTextRecordValue as ak, isPriceCurrencyEqual as al, isPriceEqual as am, isRegistrarActionPricingAvailable as an, isRegistrarActionReferralAvailable as ao, makeENSApiPublicConfigSchema as ap, makeEnsApiPublicConfigSchema as aq, makeSerializedEnsApiPublicConfigSchema as ar, maxPrice as as, minPrice as at, parseDai as au, parseEnsTokens as av, parseEth as aw, parseUsdc as ax, priceDai as ay, priceEnsTokens as az, type EnsIndexerVersionInfo as b, type BlockRef as c, type LabelSetVersion as d, type EnsRainbowClientLabelSet as e, type EnsRainbowServerLabelSet as f, type PriceDai as g, type PriceEnsTokens as h, type PriceEth as i, type PriceUsdc as j, type Price as k, type SerializedPrice as l, makeErrorResponseSchema as m, type SerializedPriceDai as n, type SerializedPriceEnsTokens as o, type SerializedPriceEth as p, type SerializedPriceUsdc as q, type CurrencyId as r, CurrencyIds as s, type CurrencyInfo as t, type DeepPartial as u, ENCODED_REFERRER_BYTE_LENGTH as v, ENCODED_REFERRER_BYTE_OFFSET as w, type ENSIndexerPublicConfig as x, type ENSIndexerVersionInfo as y, EXPECTED_ENCODED_REFERRER_PADDING as z };