@ensnode/ensnode-sdk 1.0.1 → 1.0.3

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,3556 @@
1
+ import { Hex, Address, ByteArray, Hash } from 'viem';
2
+ import { CoinType, EvmCoinType } from '@ensdomains/address-encoder';
3
+ export { CoinType, EvmCoinType } from '@ensdomains/address-encoder';
4
+ import { EncodedReferrer } from '@namehash/ens-referrals';
5
+ export { EncodedReferrer, decodeEncodedReferrer, zeroEncodedReferrer } from '@namehash/ens-referrals';
6
+ import z$1, { z } from 'zod/v4';
7
+ import { ENSNamespaceId } from '@ensnode/datasources';
8
+ export { ENSNamespaceId, ENSNamespaceIds, getENSRootChainId } from '@ensnode/datasources';
9
+
10
+ /**
11
+ * A hash value that uniquely identifies a single ENS name.
12
+ * Result of `namehash` function as specified in ENSIP-1.
13
+ *
14
+ * @example
15
+ * ```
16
+ * namehash("vitalik.eth") === "0xee6c4522aab0003e8d14cd40a6af439055fd2577951148c14b6cea9a53475835"
17
+ * ```
18
+ * @see https://docs.ens.domains/ensip/1#namehash-algorithm
19
+ * @see https://ensnode.io/docs/reference/terminology#name-node-namehash
20
+ */
21
+ type Node = Hex;
22
+ /**
23
+ * An ENS Name that may or may not be normalized.
24
+ *
25
+ * @example vitalik.eth
26
+ * @see https://ensnode.io/docs/reference/terminology#name-node-namehash
27
+ * @see https://docs.ens.domains/ensip/15
28
+ */
29
+ type Name = string;
30
+ /**
31
+ * A Normalized Name is an ENS Name that is guaranteed to be normalized.
32
+ *
33
+ * @example vitalik.eth
34
+ * @see https://ensnode.io/docs/reference/terminology#name-node-namehash
35
+ * @see https://docs.ens.domains/ensip/15
36
+ * @dev nominally typed to enforce usage & enhance codebase clarity
37
+ */
38
+ type NormalizedName = Name & {
39
+ __brand: "NormalizedName";
40
+ };
41
+ /**
42
+ * A LabelHash is the result of the labelhash function (which is just keccak256) on a Label.
43
+ *
44
+ * @example
45
+ * ```
46
+ * labelhash('vitalik') === '0xaf2caa1c2ca1d027f1ac823b529d0a67cd144264b2789fa2ea4d63a67c7103cc'
47
+ * ```
48
+ *
49
+ * @see https://docs.ens.domains/terminology#labelhash
50
+ * @see https://ensnode.io/docs/reference/terminology#labels-labelhashes-labelhash-function
51
+ */
52
+ type LabelHash = Hex;
53
+ /**
54
+ * A Label is a single part of an ENS Name.
55
+ *
56
+ * @example vitalik
57
+ *
58
+ * @see https://docs.ens.domains/terminology#label
59
+ * @see https://ensnode.io/docs/reference/terminology#labels-labelhashes-labelhash-function
60
+ */
61
+ type Label = string;
62
+ /**
63
+ * An EncodedLabelHash is a specially formatted (unnormalized) Label formatted
64
+ * as a non-0x prefixed 32-byte hex string enclosed in square brackets.
65
+ *
66
+ * Care should be taken to distinguish Label values formatted as an
67
+ * EncodedLabelHash as either a LiteralLabel or an InterpretedLabel:
68
+ * - If a LiteralLabel is formatted as an EncodedLabelHash it does NOT
69
+ * symbolically represent the encoding of a LabelHash literal.
70
+ * - If an InterpretedLabel is formatted as an EncodedLabelHash it should be
71
+ * interpreted as encoding a LabelHash literal.
72
+ *
73
+ * An InterpretedLabel may be formatted as an EncodedLabelHash if the related
74
+ * LiteralLabel is:
75
+ * - not a normalized label
76
+ * - is an unknown value that could not be healed.
77
+ * - is too long for DNS-Encoding in contexts where DNS-Encoding was required.
78
+ *
79
+ * @example [af2caa1c2ca1d027f1ac823b529d0a67cd144264b2789fa2ea4d63a67c7103cc]
80
+ *
81
+ * @see https://ensnode.io/docs/reference/terminology#encoded-labelhash
82
+ */
83
+ type EncodedLabelHash = `[${string}]`;
84
+ /**
85
+ * A Literal Label is a Label as it literally appears onchain, without any interpretation
86
+ * or normalization processing. It may be an unnormalized label for reasons including:
87
+ * - being an empty label,
88
+ * - containing '.' characters,
89
+ * - being formatted as an EncodedLabelHash (which are not normalizable). Note that
90
+ * when LiteralLabel are formatted as an EncodedLabelHash they do NOT symbolically
91
+ * represent the encoding of a LabelHash literal, or
92
+ * - containing other unnormalized characters such as null bytes or other characters
93
+ * not suitable for display.
94
+ *
95
+ *
96
+ * @see https://ensnode.io/docs/reference/terminology#literal-label
97
+ * @dev nominally typed to enforce usage & enhance codebase clarity
98
+ */
99
+ type LiteralLabel = Label & {
100
+ __brand: "LiteralLabel";
101
+ };
102
+ /**
103
+ * An Interpreted Label is a Label that is either:
104
+ * a) a Normalized Label, or
105
+ * b) an Unnormalizable Label exclusively for the reason that it is formatted
106
+ * as an Encoded LabelHash that should be interpreted as encoding a
107
+ * LabelHash literal, where the encoded LabelHash literal is the `labelhash`
108
+ * of the related LiteralLabel.
109
+ *
110
+ * @see https://ensnode.io/docs/reference/terminology#interpreted-label
111
+ * @dev nominally typed to enforce usage & enhance codebase clarity
112
+ */
113
+ type InterpretedLabel = Label & {
114
+ __brand: "InterpretedLabel";
115
+ };
116
+ /**
117
+ * A Literal Name is a Name as it literally appears onchain, composed of 0 or more Literal Labels
118
+ * joined by dots. It may be an unnormalized name for reasons including:
119
+ * - containing empty labels,
120
+ * - containing LiteralLabel values formatted as an EncodedLabelHash (which are
121
+ * not normalizable)). Note that when LiteralLabel values are formatted as an
122
+ * EncodedLabelHash they do NOT symbolically represent the encoding of a
123
+ * LabelHash literal, or
124
+ * - containing other unnormalized characters such as null bytes or other characters
125
+ * not suitable for display.
126
+ *
127
+ * @see https://ensnode.io/docs/reference/terminology#literal-name
128
+ * @dev nominally typed to enforce usage & enhance codebase clarity
129
+ */
130
+ type LiteralName = Name & {
131
+ __brand: "LiteralName";
132
+ };
133
+ /**
134
+ * An Interpreted Name is a Name that is entirely composed of 0 or more Interpreted Labels.
135
+ *
136
+ * That is, it is either:
137
+ * a) a Normalized Name, or
138
+ * b) an Unnormalizable Name exclusively for the reason that it contains 1 or
139
+ * more labels formatted as Encoded LabelHashes that should be interpreted
140
+ * as encoding a LabelHash literal, where the encoded LabelHash literal is
141
+ * the `labelhash` of the related LiteralLabel.
142
+ *
143
+ * @see https://ensnode.io/docs/reference/terminology#interpreted-name
144
+ * @dev nominally typed to enforce usage & enhance codebase clarity
145
+ */
146
+ type InterpretedName = Name & {
147
+ __brand: "InterpretedName";
148
+ };
149
+ /**
150
+ * A Subgraph Interpreted Label is a Literal Label that is either:
151
+ * a) (if subgraph-indexable): a Literal Label, of unknown normalization status, guaranteed to not
152
+ * contain any of the subgraph-unindexable UTF-8 characters (and therefore guaranteed not to be
153
+ * an Encoded LabelHash), or
154
+ * b) (if subgraph-unindexable): an Encoded LabelHash.
155
+ *
156
+ * @see https://ensnode.io/docs/reference/terminology#subgraph-interpreted-label
157
+ * @dev nominally typed to enforce usage & enhance codebase clarity
158
+ */
159
+ type SubgraphInterpretedLabel = Label & {
160
+ __brand: "SubgraphInterpretedLabel";
161
+ };
162
+ /**
163
+ * A Subgraph Interpreted Name is a name exclusively composed of 0 or more Subgraph Interpreted Labels.
164
+ *
165
+ * @see https://ensnode.io/docs/reference/terminology#subgraph-interpreted-name
166
+ * @dev nominally typed to enforce usage & enhance codebase clarity
167
+ */
168
+ type SubgraphInterpretedName = Name & {
169
+ __brand: "SubgraphInterpretedName";
170
+ };
171
+ /**
172
+ * A DNS-Encoded Name as a hex string, representing the binary DNS wire format encoding
173
+ * of a domain name. Used in ENS contracts for efficient name storage and transmission.
174
+ * Each label is prefixed with a length byte, and the entire sequence is null-terminated.
175
+ *
176
+ * @example "0x076578616d706c650365746800" represents "example.eth"
177
+ *
178
+ * @see https://docs.ens.domains/resolution/names/#dns-encoding
179
+ * @see https://github.com/ensdomains/ens-contracts/blob/staging/contracts/utils/NameCoder.sol
180
+ *
181
+ * DNS Packet Format for Domain Names:
182
+ * - Domain names are encoded as a sequence of 0 or more labels
183
+ * - Each label begins with a length byte (1 byte) indicating how many bytes follow for that label
184
+ * Note how this constrains each label in DNS encoded names to a max byte length of 255 bytes.
185
+ * - The bytes after the length byte represent the label, as a UTF-8 byte array
186
+ * - Labels are concatenated with no separators
187
+ * - The sequence ends with a null byte (0x00)
188
+ *
189
+ * Example: "example.eth" is encoded as:
190
+ * [0x07, 'e', 'x', 'a', 'm', 'p', 'l', 'e', 0x03, 'e', 't', 'h', 0x00]
191
+ * Where 0x07 is the length of "example", 0x03 is the length of "eth", and 0x00 marks the end
192
+ *
193
+ * Example: "" (empty string, i.e. root node) is encoded as:
194
+ * [0x00]
195
+ *
196
+ * Example: "👩🏼‍❤‍💋‍👨🏼.eth" (multi-byte unicode character) is encoded as:
197
+ * [0x20, 240, 159, 145, 169, 240, 159, 143, 188, 226, 128, 141, 226, 157, 164, 226,
198
+ * 128, 141, 240, 159, 146, 139, 226, 128, 141, 240, 159, 145, 168, 240, 159, 143,
199
+ * 188, 3, 'e', 't', 'h', 0x00]
200
+ *
201
+ * A DNS-Encoded Name Packet may be malformed if it does not exactly follow that specification.
202
+ * Possible reasons a DNS-Encoded Name may be malfomed include:
203
+ * - 'empty' packet
204
+ * - e.g. []
205
+ * ^-- that's empty!
206
+ * - 'length' byte overflowing packet byte length
207
+ * - e.g. [0x06, 'e', 't', 'h', 0x00]
208
+ * ^-- length overflows available bytes!
209
+ * - 'junk' at the end of the dns-encoded
210
+ * - e.g. [0x03, 'e', 't', 'h', 0x00, 0x01]
211
+ * ^-- junk!
212
+ *
213
+ * @dev This type is _structurally_ typed to aid Event Argument Typing — consumers should further
214
+ * cast the type of the event argument to a _nominally_ typed DNSEncodedName like {@link DNSEncodedLiteralName}
215
+ * or {@link DNSEncodedPartiallyInterpretedName} depending on the context.
216
+ */
217
+ type DNSEncodedName = Hex;
218
+ /**
219
+ * A DNSEncodedName that encodes a name containing 0 or more {@link LiteralLabel}s.
220
+ *
221
+ * In a DNSEncodedLiteralName, all labels are Literal Labels, including any Encoded-LabelHash-looking
222
+ * labels. Any Encoded-LabelHash-looking Literal Label values, when interpreted, will be formatted as
223
+ * the `labelhash` of the Literal Label value.
224
+ *
225
+ * The NameWrapper contract emits DNSEncodedLiteralNames:
226
+ * @see https://github.com/ensdomains/ens-contracts/blob/staging/contracts/utils/BytesUtils_LEGACY.sol
227
+ *
228
+ * The ThreeDNSToken contract emits DNSEncodedLiteralNames:
229
+ * @see https://github.com/3dns-xyz/contracts/blob/44937318ae26cc036982e8c6a496cd82ebdc2b12/src/regcontrol/libraries/BytesUtils.sol
230
+ *
231
+ * @dev nominally typed to enforce usage & enhance codebase clarity
232
+ */
233
+ type DNSEncodedLiteralName = DNSEncodedName & {
234
+ __brand: "DNSEncodedLiteralName";
235
+ };
236
+ /**
237
+ * A DNSEncodedName that encodes a name consisting of 0 or more labels that are either:
238
+ * a) Literal Labels, or
239
+ * b) Encoded LabelHashes, which are already an Interpreted Label.
240
+ *
241
+ * In a DNSEncodedPartiallyInterpretedName, any Encoded-LabelHash-looking decoded Labels (i.e. ones
242
+ * that match the regex /^\[[\da-f]{64}\]$/) represent an Encoded LabelHash. When decoding a
243
+ * DNSEncodedPartiallyInterpretedName, these labels are already considered Interpreted.
244
+ *
245
+ * NOTE: This type is unused in ENSv1, but its usage is anticipated in ENSv2 due to Encoded
246
+ * LabelHash support in the ENSv2 implementation of the NameCoder contract.
247
+ *
248
+ * @see https://github.com/ensdomains/ens-contracts/blob/staging/contracts/utils/NameCoder.sol
249
+ *
250
+ * @dev nominally typed to enforce usage & enhance codebase clarity
251
+ */
252
+ type DNSEncodedPartiallyInterpretedName = DNSEncodedName & {
253
+ __brand: "DNSEncodedPartiallyInterpretedName";
254
+ };
255
+
256
+ /**
257
+ * Determines whether the Name is normalized.
258
+ *
259
+ * @param name - The Name to check for normalization
260
+ * @returns True if the name is normalized according to ENS normalization rules, false otherwise
261
+ */
262
+ declare function isNormalizedName(name: Name): name is NormalizedName;
263
+ /**
264
+ * Determines whether the Label is normalized.
265
+ *
266
+ * @param label - The Label to check for normalization
267
+ * @returns True if the label is normalized according to ENS normalization rules, false otherwise
268
+ */
269
+ declare function isNormalizedLabel(label: Label): boolean;
270
+
271
+ /**
272
+ * The ETH coinType.
273
+ *
274
+ * @see https://docs.ens.domains/ensip/9
275
+ */
276
+ declare const ETH_COIN_TYPE: CoinType;
277
+ /**
278
+ * The 'default' chainId corresponding to the below {@link DEFAULT_EVM_COIN_TYPE} in the context of
279
+ * ENSIP-19.
280
+ *
281
+ * @see https://docs.ens.domains/ensip/19
282
+ */
283
+ declare const DEFAULT_EVM_CHAIN_ID = 0;
284
+ /**
285
+ * ENSIP-19 EVM CoinType representing the 'default' coinType for EVM chains in ENS.
286
+ *
287
+ * @see https://docs.ens.domains/ensip/19/#reverse-resolution
288
+ */
289
+ declare const DEFAULT_EVM_COIN_TYPE: EvmCoinType;
290
+ /**
291
+ * Converts a CoinType to an EVM Chain Id.
292
+ *
293
+ * NOTE: for whatever reason @ensdomains/address-encoder#coinTypeToEvmChainId doesn't handle the
294
+ * mainnet case so we implement that here
295
+ *
296
+ * @see https://docs.ens.domains/ensip/11/
297
+ */
298
+ declare const coinTypeToEvmChainId: (coinType: CoinType) => ChainId;
299
+ /**
300
+ * Converts an EVM Chain Id to a CoinType.
301
+ *
302
+ * NOTE: for whatever reason @ensdomains/address-encoder#evmChainIdToCoinType doesn't handle the
303
+ * mainnet case so we implement that here
304
+ */
305
+ declare const evmChainIdToCoinType: (chainId: ChainId) => CoinType;
306
+ /**
307
+ * Converts a bigint value representing a CoinType into a valid CoinType.
308
+ *
309
+ * This is useful when onchain events emit coinTypes as bigint but we want to constrain them to
310
+ * the CoinType type.
311
+ *
312
+ * @throws if `value` is too large to fit in Number.MAX_SAFE_INTEGER
313
+ */
314
+ declare const bigintToCoinType: (value: bigint) => CoinType;
315
+
316
+ declare const ROOT_NODE: Node;
317
+ declare const ETH_NODE: Node;
318
+ declare const BASENAMES_NODE: Node;
319
+ declare const LINEANAMES_NODE: Node;
320
+ declare const ADDR_REVERSE_NODE: Node;
321
+
322
+ /**
323
+ * Decodes a DNS-Encoded name consisting of Literal Labels into an ordered list of Literal Labels.
324
+ *
325
+ * For discussion on DNS-Encoding, see the {@link DNSEncodedName} and {@link DNSEncodedLiteralName} types.
326
+ *
327
+ * Due to the constraints of DNS-Encoding, there is an additional guarantee that each Literal Label
328
+ * in the resulting list is guaranteed to have a maximum byte length of 255.
329
+ *
330
+ * @param packet a hex string that encodes a DNSEncodedLiteralName
331
+ * @returns A list of the LiteralLabels contained in packet
332
+ * @throws If the packet is malformed
333
+ * @dev This is just `decodeDNSEncodedName` with semantic input/output
334
+ */
335
+ declare function decodeDNSEncodedLiteralName(packet: DNSEncodedLiteralName): LiteralLabel[];
336
+ /**
337
+ * Decodes a DNS-Encoded Name into an ordered list of string segments.
338
+ *
339
+ * For discussion on DNS-Encoding, see the {@link DNSEncodedName} type.
340
+ *
341
+ * Due to the constraints of DNS-Encoding, there is an additional guarantee that each segment
342
+ * in the resulting list is guaranteed to have a maximum byte length of 255.
343
+ *
344
+ * @param packet a hex string that encodes a DNSEncodedName
345
+ * @returns A UTF-8 string array of the segments contained in packet
346
+ * @throws If the packet is malformed
347
+ * @dev This is the generic implementation of DNS-Encoded Name Decoding
348
+ */
349
+ declare function decodeDNSEncodedName(packet: DNSEncodedName): string[];
350
+
351
+ /**
352
+ * Formats a LabelHash as an Encoded LabelHash.
353
+ *
354
+ * @see https://ensnode.io/docs/reference/terminology#encoded-labelhash
355
+ *
356
+ * @param labelHash - A 32-byte lowercase hash string starting with '0x'
357
+ * @returns The encoded label hash in format `[hash_without_0x_prefix]`
358
+ */
359
+ declare const encodeLabelHash: (labelHash: LabelHash) => EncodedLabelHash;
360
+ /**
361
+ * Checks if the input value is an {@link EncodedLabelHash}.
362
+ */
363
+ declare function isEncodedLabelHash(maybeEncodedLabelHash: string): maybeEncodedLabelHash is EncodedLabelHash;
364
+
365
+ /**
366
+ * Checks if the input is a {@link LabelHash}.
367
+ *
368
+ * @see https://ensnode.io/docs/reference/terminology#label-processing-and-classification
369
+ */
370
+ declare function isLabelHash(maybeLabelHash: string): maybeLabelHash is LabelHash;
371
+
372
+ /**
373
+ * Constructs a name hierarchy from a given NormalizedName.
374
+ *
375
+ * @example
376
+ * ```
377
+ * getNameHierarchy("sub.example.eth") -> ["sub.example.eth", "example.eth", "eth"]
378
+ * ```
379
+ *
380
+ * @dev by restricting the input type to NormalizedName we guarantee that we can split and join
381
+ * on '.' and receive NormalizedNames as a result
382
+ */
383
+ declare const getNameHierarchy: (name: NormalizedName) => NormalizedName[];
384
+ /**
385
+ * Beautifies a name by converting each normalized label in the provided name to
386
+ * its "beautified" form. Labels that are not normalized retain their original value.
387
+ *
388
+ * Invariants:
389
+ * - The number of labels in the returned name is the same as the number of labels in the input name.
390
+ * - The order of the labels in the returned name is the same as the order of the labels in the input name.
391
+ * - If a label in the input is normalized, it is returned in its "beautified" form.
392
+ * - If a label in the input name is not normalized, it is returned without modification.
393
+ * - Therefore, the result of ens_normalize(beautifyName(name)) is the same as the result of ens_normalize(name).
394
+ *
395
+ * The "beautified form" of a normalized label converts special sequences of
396
+ * emojis and other special characters to their "beautified" equivalents. All
397
+ * such conversions transform X -> Y where Y is normalizable and normalizes back to X.
398
+ * Ex: '1⃣2⃣' (normalized) to '1️⃣2️⃣' (normalizable but not normalized).
399
+ * Ex: 'ξethereum' (normalized) to 'Ξethereum' (normalizable, but not normalized).
400
+ * Ex: 'abc' (normalized) to 'abc' (also normalized, no conversion).
401
+ * Ex: 'ABC' (normalizable but not normalized) to 'ABC' (no conversion).
402
+ * Ex: 'invalid|label' (not normalizable) to 'invalid|label' (no conversion).
403
+ * Ex: '' (unnormalized as a label) to '' (no conversion).
404
+ *
405
+ * @param name - The name to beautify.
406
+ * @returns The beautified name.
407
+ */
408
+ declare const beautifyName: (name: Name) => Name;
409
+
410
+ /**
411
+ * Parse the address and coinType out of an ENSIP-19 reverse name.
412
+ */
413
+ declare function parseReverseName(name: Name): {
414
+ address: Address;
415
+ coinType: CoinType;
416
+ } | null;
417
+
418
+ /**
419
+ * Gets the Label used for the reverse names of subnames as per ENSIP-11 & ENSIP-19.
420
+ *
421
+ * @see https://docs.ens.domains/ensip/19/#reverse-resolution
422
+ */
423
+ declare const addrReverseLabel: (address: Address) => LiteralLabel;
424
+ /**
425
+ * Converts `coinType` to prefix-free hex string.
426
+ *
427
+ * @see https://docs.ens.domains/ensip/19
428
+ */
429
+ declare const coinTypeReverseLabel: (coinType: CoinType) => Label;
430
+ /**
431
+ * Gets the reverse name for an address according to ENSIP-11 & ENSIP-19.
432
+ *
433
+ * @see https://docs.ens.domains/ensip/11#specification
434
+ * @see https://docs.ens.domains/ensip/19#specification
435
+ *
436
+ * @param address - The address to get the reverse name for
437
+ * @param coinType - The coin type to use for the reverse name
438
+ * @returns The reverse name for the address
439
+ *
440
+ * @example
441
+ * ```ts
442
+ * reverseName("0x1234", BigInt(ETH_COIN_TYPE)) // "1234.addr.reverse"
443
+ * reverseName("0x1234", BigInt(0x80000000)) // "1234.default.reverse"
444
+ * reverseName("0x1234", BigInt(0x5678)) // "1234.5678.reverse"
445
+ * ```
446
+ */
447
+ declare function reverseName(address: Address, coinType: CoinType): Name;
448
+
449
+ /**
450
+ * Implements one step of the namehash algorithm, combining `labelHash` with `node` to produce
451
+ * the `node` of a given subdomain. Note that the order of the arguments is 'reversed' (as compared to
452
+ * the actual concatenation) in order to improve readability (i.e. read as [labelHash].[node]).
453
+ */
454
+ declare const makeSubdomainNode: (labelHash: LabelHash, node: Node) => Node;
455
+ /**
456
+ * Encodes a uint256 bigint as hex string sized to 32 bytes.
457
+ * Uses include, in the context of ENS, decoding the uint256-encoded tokenId of NFT-issuing contracts
458
+ * into Node or LabelHash, which is a common behavior in the ENS ecosystem.
459
+ * (see NameWrapper, ETHRegistrarController)
460
+ */
461
+ declare const uint256ToHex32: (num: bigint) => Hex;
462
+
463
+ /**
464
+ * Chain ID
465
+ *
466
+ * Represents a unique identifier for a chain.
467
+ * Guaranteed to be a positive integer.
468
+ **/
469
+ type ChainId = number;
470
+ /**
471
+ * Defaultable Chain ID
472
+ *
473
+ * Represents a unique identifier for a chain, or
474
+ * the default chain as defined by ENSIP-19.
475
+ *
476
+ * @see https://docs.ens.domains/ensip/19/#annex-supported-chains
477
+ *
478
+ * Guaranteed to be a non-negative integer.
479
+ **/
480
+ type DefaultableChainId = typeof DEFAULT_EVM_CHAIN_ID | ChainId;
481
+ /**
482
+ * Represents an account (contract or EOA) at `address` on chain `chainId`.
483
+ *
484
+ * @see https://chainagnostic.org/CAIPs/caip-10
485
+ */
486
+ interface AccountId {
487
+ chainId: ChainId;
488
+ address: Address;
489
+ }
490
+ /**
491
+ * Block Number
492
+ *
493
+ * Guaranteed to be a non-negative integer.
494
+ */
495
+ type BlockNumber = number;
496
+ /**
497
+ * Datetime value
498
+ */
499
+ type Datetime = Date;
500
+ /**
501
+ * Unix timestamp value
502
+ *
503
+ * Represents the number of seconds that have elapsed
504
+ * since January 1, 1970 (midnight UTC/GMT).
505
+ *
506
+ * Guaranteed to be an integer. May be zero or negative to represent a time at or
507
+ * before Jan 1, 1970.
508
+ */
509
+ type UnixTimestamp = number;
510
+ /**
511
+ * Represents a URL that is used for RPC endpoints.
512
+ */
513
+ type RpcUrl = URL;
514
+ /**
515
+ * BlockRef
516
+ *
517
+ * Describes a block.
518
+ *
519
+ * We use parameter types to maintain fields layout and documentation across
520
+ * the domain model and its serialized counterpart.
521
+ */
522
+ interface BlockRef {
523
+ /** Block number (height) */
524
+ number: BlockNumber;
525
+ /** Block timestamp */
526
+ timestamp: UnixTimestamp;
527
+ }
528
+ /**
529
+ * Block range
530
+ *
531
+ * Represents a range of blocks
532
+ */
533
+ interface Blockrange<BlockType = BlockNumber> {
534
+ /** Start block number */
535
+ startBlock?: BlockType;
536
+ /** End block number */
537
+ endBlock?: BlockType;
538
+ }
539
+ /**
540
+ * Duration
541
+ *
542
+ * Representing a duration in seconds.
543
+ *
544
+ * Guaranteed to be a non-negative integer.
545
+ */
546
+ type Duration = number;
547
+ /**
548
+ * A utility type that makes all properties of a type optional recursively,
549
+ * including nested objects and arrays.
550
+ *
551
+ * @example
552
+ * ```typescript
553
+ * type Config = {
554
+ * a: string;
555
+ * b: {
556
+ * x: number;
557
+ * y: { z: boolean };
558
+ * };
559
+ * c: { id: string }[];
560
+ * }
561
+ *
562
+ * type PartialConfig = DeepPartial<Config>;
563
+ * // Results in:
564
+ * // {
565
+ * // a?: string;
566
+ * // b?: {
567
+ * // x?: number;
568
+ * // y?: { z?: boolean };
569
+ * // };
570
+ * // c?: { id?: string }[];
571
+ * // }
572
+ *
573
+ * // Usage:
574
+ * const update: PartialConfig = { b: { y: { z: true } } };
575
+ * ```
576
+ */
577
+ type DeepPartial<T> = {
578
+ [P in keyof T]?: T[P] extends (infer U)[] ? DeepPartial<U>[] : T[P] extends object ? DeepPartial<T[P]> : T[P];
579
+ };
580
+
581
+ /**
582
+ * Determines where the provided AccountId values represent the same address on the same chain.
583
+ */
584
+ declare const accountIdEqual: (a: AccountId, b: AccountId) => boolean;
585
+
586
+ /**
587
+ * Converts an EVM address to its lowercase representation.
588
+ *
589
+ * @param address - EVM address to convert.
590
+ * @returns The lowercase representation of the EVM address.
591
+ */
592
+ declare function asLowerCaseAddress(address: Address): Address;
593
+
594
+ /**
595
+ * Cache that maps from string -> ValueType.
596
+ */
597
+ interface Cache<KeyType extends string, ValueType> {
598
+ /**
599
+ * Store a value in the cache with the given key.
600
+ *
601
+ * @param key Cache key
602
+ * @param value Value to store
603
+ */
604
+ set(key: KeyType, value: ValueType): void;
605
+ /**
606
+ * Retrieve a value from the cache with the given key.
607
+ *
608
+ * @param key Cache key
609
+ * @returns The cached value if it exists, otherwise undefined
610
+ */
611
+ get(key: KeyType): ValueType | undefined;
612
+ /**
613
+ * Clear the cache.
614
+ */
615
+ clear(): void;
616
+ /**
617
+ * The current number of items in the cache. Always a non-negative integer.
618
+ */
619
+ get size(): number;
620
+ /**
621
+ * The maximum number of items in the cache. Always a non-negative integer that is >= size().
622
+ */
623
+ get capacity(): number;
624
+ }
625
+ /**
626
+ * Cache that maps from string -> ValueType with a LRU (least recently used) eviction policy.
627
+ *
628
+ * `get` and `set` are O(1) operations.
629
+ *
630
+ * @link https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU
631
+ */
632
+ declare class LruCache<KeyType extends string, ValueType> implements Cache<KeyType, ValueType> {
633
+ private readonly _cache;
634
+ private readonly _capacity;
635
+ /**
636
+ * Create a new LRU cache with the given capacity.
637
+ *
638
+ * @param capacity The maximum number of items in the cache. If set to 0, the cache is effectively disabled.
639
+ * @throws Error if capacity is not a non-negative integer.
640
+ */
641
+ constructor(capacity: number);
642
+ set(key: string, value: ValueType): void;
643
+ get(key: string): ValueType | undefined;
644
+ clear(): void;
645
+ get size(): number;
646
+ get capacity(): number;
647
+ }
648
+ /**
649
+ * Cache that maps from string -> ValueType with TTL (time-to-live) expiration.
650
+ *
651
+ * Items are automatically removed when they expire.
652
+ */
653
+ declare class TtlCache<KeyType extends string, ValueType> implements Cache<KeyType, ValueType> {
654
+ private readonly _cache;
655
+ private readonly _ttl;
656
+ /**
657
+ * Create a new TTL cache with the given TTL.
658
+ *
659
+ * @param ttl Time-to-live duration in seconds. Items expire after this duration.
660
+ */
661
+ constructor(ttl: Duration);
662
+ private _cleanup;
663
+ set(key: string, value: ValueType): void;
664
+ get(key: string): ValueType | undefined;
665
+ clear(): void;
666
+ get size(): number;
667
+ get capacity(): number;
668
+ has(key: string): boolean;
669
+ delete(key: string): boolean;
670
+ }
671
+ interface StaleWhileRevalidateOptions<ValueType> {
672
+ /**
673
+ * The async function to wrap with SWR caching.
674
+ * On success this function returns a value of type `ValueType` to store in the `SWRCache`.
675
+ * On error, this function throws an error and no changes will be made to the `SWRCache`.
676
+ */
677
+ fn: () => Promise<ValueType>;
678
+ /**
679
+ * Time-to-live duration in seconds. After this duration, data in the `SWRCache` is
680
+ * considered stale but is still retained in the cache until replaced with a new value.
681
+ */
682
+ ttl: Duration;
683
+ }
684
+ /**
685
+ * Stale-While-Revalidate (SWR) cache wrapper for async functions.
686
+ *
687
+ * This caching strategy serves cached data immediately (even if stale) while
688
+ * asynchronously revalidating the cache in the background. This provides:
689
+ * - Sub-millisecond response times (after first fetch)
690
+ * - Always available data (serves stale data during revalidation)
691
+ * - Automatic background updates (currently only triggered lazily when new requests
692
+ * are made for the cached data after it becomes stale)
693
+ *
694
+ * Error Handling:
695
+ * - If a new invocation of the provided `fn` throws an error and a cached value exists
696
+ * from a previous successfully invocation of the provided `fn`, the stale cached value is returned.
697
+ * - If a new invocation of the provided `fn` throws an error and NO cached value exists,
698
+ * from any prior invocations of the provided `fn`, such that the provided `fn` has never
699
+ * successfully returned a value for the lifetime of the `SWRCache`, then `null` is returned.
700
+ * - Therefore, errors occuring within the provided `fn` are handled internally within
701
+ * `staleWhileRevalidate` and do not propagate to the caller.
702
+ *
703
+ * @example
704
+ * ```typescript
705
+ * const fetchExpensiveData = async () => {
706
+ * const response = await fetch('/api/data');
707
+ * return response.json();
708
+ * };
709
+ *
710
+ * const cachedFetch = staleWhileRevalidate(fetchExpensiveData, 60); // 60 second TTL
711
+ *
712
+ * // First call: fetches data (slow)
713
+ * const data1 = await cachedFetch();
714
+ *
715
+ * // Within TTL: returns cached data (fast)
716
+ * const data2 = await cachedFetch();
717
+ *
718
+ * // After TTL: returns stale data immediately, revalidates asynchronously in the background
719
+ * const data3 = await cachedFetch(); // Still fast!
720
+ * ```
721
+ *
722
+ * @param fn The async function to wrap with SWR caching
723
+ * @param ttl Time-to-live duration in seconds. After this duration, data is considered stale
724
+ * @returns a value of `ValueType` that was most recently successfully returned by `fn`
725
+ * or `null` if `fn` has never successfully returned and has always thrown an error.
726
+ *
727
+ * @link https://web.dev/stale-while-revalidate/
728
+ * @link https://datatracker.ietf.org/doc/html/rfc5861
729
+ */
730
+ declare function staleWhileRevalidate<ValueType>(options: StaleWhileRevalidateOptions<ValueType>): () => Promise<ValueType | null>;
731
+
732
+ /**
733
+ * Filter out duplicates.
734
+ */
735
+ declare const uniq: <T>(arr: T[]) => T[];
736
+
737
+ /**
738
+ * Identifiers for supported currencies.
739
+ *
740
+ * TODO: Add support for WETH
741
+ */
742
+ declare const CurrencyIds: {
743
+ readonly ETH: "ETH";
744
+ readonly USDC: "USDC";
745
+ readonly DAI: "DAI";
746
+ };
747
+ type CurrencyId = (typeof CurrencyIds)[keyof typeof CurrencyIds];
748
+ /**
749
+ * The amount of the currency in the smallest unit of the currency
750
+ * (see {@link CurrencyInfo.decimals} for the currency).
751
+ *
752
+ * Guaranteed to be non-negative.
753
+ */
754
+ type CurrencyAmount = bigint;
755
+ /**
756
+ * Serialized representation of {@link CurrencyAmount}.
757
+ */
758
+ type SerializedCurrencyAmount = string;
759
+ interface PriceEth {
760
+ currency: typeof CurrencyIds.ETH;
761
+ amount: CurrencyAmount;
762
+ }
763
+ interface PriceDai {
764
+ currency: typeof CurrencyIds.DAI;
765
+ amount: CurrencyAmount;
766
+ }
767
+ interface PriceUsdc {
768
+ currency: typeof CurrencyIds.USDC;
769
+ amount: CurrencyAmount;
770
+ }
771
+ type Price = PriceEth | PriceDai | PriceUsdc;
772
+ /**
773
+ * Serialized representation of {@link PriceEth}.
774
+ */
775
+ interface SerializedPriceEth extends Omit<PriceEth, "amount"> {
776
+ amount: SerializedCurrencyAmount;
777
+ }
778
+ /**
779
+ * Serialized representation of {@link PriceDai}.
780
+ */
781
+ interface SerializedPriceDai extends Omit<PriceDai, "amount"> {
782
+ amount: SerializedCurrencyAmount;
783
+ }
784
+ /**
785
+ * Serialized representation of {@link PriceUsdc}.
786
+ */
787
+ interface SerializedPriceUsdc extends Omit<PriceUsdc, "amount"> {
788
+ amount: SerializedCurrencyAmount;
789
+ }
790
+ /**
791
+ * Serialized representation of {@link Price}.
792
+ */
793
+ type SerializedPrice = SerializedPriceEth | SerializedPriceDai | SerializedPriceUsdc;
794
+ interface CurrencyInfo {
795
+ id: CurrencyId;
796
+ name: string;
797
+ decimals: number;
798
+ }
799
+ /**
800
+ * Get currency info for a provided currency.
801
+ */
802
+ declare function getCurrencyInfo(currencyId: CurrencyId): CurrencyInfo;
803
+ /**
804
+ * Create price in ETH for given amount.
805
+ */
806
+ declare function priceEth(amount: Price["amount"]): PriceEth;
807
+ /**
808
+ * Create price in USDC for given amount.
809
+ */
810
+ declare function priceUsdc(amount: Price["amount"]): PriceUsdc;
811
+ /**
812
+ * Create price in DAI for given amount.
813
+ */
814
+ declare function priceDai(amount: Price["amount"]): PriceDai;
815
+ /**
816
+ * Check if two prices have the same currency.
817
+ */
818
+ declare function isPriceCurrencyEqual(priceA: Price, priceB: Price): boolean;
819
+ /**
820
+ * Check if two {@link Price} values have the same currency and amount.
821
+ */
822
+ declare function isPriceEqual(priceA: Price, priceB: Price): boolean;
823
+ /**
824
+ * Add prices
825
+ *
826
+ * @param prices at least two {@link Price} values to be added together.
827
+ * @returns total of all prices.
828
+ * @throws if not all prices have the same currency.
829
+ */
830
+ declare function addPrices<const PriceType extends Price = Price>(...prices: [PriceType, PriceType, ...PriceType[]]): PriceType;
831
+
832
+ /**
833
+ * Duration between two moments in time.
834
+ */
835
+ declare function durationBetween(start: UnixTimestamp, end: UnixTimestamp): Duration;
836
+ /**
837
+ * Add a duration to a timestamp.
838
+ */
839
+ declare function addDuration(timestamp: UnixTimestamp, duration: Duration): UnixTimestamp;
840
+
841
+ /**
842
+ * Serialized representation of {@link ChainId}.
843
+ **/
844
+ type ChainIdString = string;
845
+ /**
846
+ * Datetime value following the ISO 8601 standard.
847
+ *
848
+ * @see https://www.iso.org/iso-8601-date-and-time-format.html
849
+ */
850
+ type DatetimeISO8601 = string;
851
+ /**
852
+ * Serialized representation of a {@link URL}.
853
+ */
854
+ type UrlString = string;
855
+ /**
856
+ * Serialized representation of {@link AccountId}.
857
+ *
858
+ * Formatted as a fully lowercase CAIP-10 AccountId.
859
+ *
860
+ * @see https://chainagnostic.org/CAIPs/caip-10
861
+ */
862
+ type SerializedAccountId = string;
863
+
864
+ declare function deserializeChainId(maybeChainId: ChainIdString, valueLabel?: string): ChainId;
865
+ declare function deserializeDatetime(maybeDatetime: string, valueLabel?: string): Datetime;
866
+ declare function deserializeUnixTimestamp(maybeTimestamp: number, valueLabel?: string): number;
867
+ declare function deserializeUrl(maybeUrl: UrlString, valueLabel?: string): URL;
868
+ declare function deserializeBlockNumber(maybeBlockNumber: number, valueLabel?: string): BlockNumber;
869
+ declare function deserializeBlockrange(maybeBlockrange: Partial<Blockrange>, valueLabel?: string): {
870
+ startBlock?: number | undefined;
871
+ endBlock?: number | undefined;
872
+ };
873
+ declare function deserializeBlockRef(maybeBlockRef: Partial<BlockRef>, valueLabel?: string): BlockRef;
874
+ declare function deserializeDuration(maybeDuration: unknown, valueLabel?: string): Duration;
875
+ declare function deserializeAccountId(maybeAccountId: unknown, valueLabel?: string): AccountId;
876
+
877
+ /**
878
+ * Interprets a Literal Label, producing an Interpreted Label.
879
+ *
880
+ * @see https://ensnode.io/docs/reference/terminology#literal-label
881
+ * @see https://ensnode.io/docs/reference/terminology#interpreted-label
882
+ *
883
+ * @param label - The Literal Label string to interpret
884
+ * @returns The provided label if it is a normalized label, else the EncodedLabelHash of the label
885
+ */
886
+ declare function literalLabelToInterpretedLabel(label: LiteralLabel): InterpretedLabel;
887
+ /**
888
+ * Interprets an ordered list of Literal Labels, producing an Interpreted Name.
889
+ *
890
+ * Note that it's important that the Literal Labels are provided as an array, otherwise it's
891
+ * impossible to differentiate between 'a.label.eth' being ['a.label', 'eth'] or ['a', 'label', 'eth'].
892
+ *
893
+ * Note that the input is an ordered list of _Literal_ Labels: in this context, any literal label
894
+ * that is formatted as an Encoded LabelHash will NOT be interpreted as such. Instead it will be
895
+ * interpreted into an Encoded LabelHash that encodes the literal labelhash of the Literal Label.
896
+ *
897
+ * @param labels An ordered list of 0 or more Literal Labels
898
+ * @returns An InterpretedName
899
+ */
900
+ declare function literalLabelsToInterpretedName(labels: LiteralLabel[]): InterpretedName;
901
+ /**
902
+ * Joins the list of Interpreted Labels with '.' to form an Interpreted Name.
903
+ *
904
+ * @param labels An ordered list of 0 or more Interpreted Labels
905
+ * @returns An InterpretedName
906
+ */
907
+ declare function interpretedLabelsToInterpretedName(labels: InterpretedLabel[]): InterpretedName;
908
+ /**
909
+ * Joins the list of Literal Labels with '.' to form a Literal Name.
910
+ *
911
+ * Note: LiteralLabel values may contain '.' characters, which will be preserved
912
+ * in the resulting LiteralName. Therefore, the number of labels in the returned
913
+ * LiteralName may be greater than the number of LiteralLabels in the input array.
914
+ *
915
+ * @param labels An ordered list of 0 or more Literal Labels
916
+ * @returns An LiteralName
917
+ */
918
+ declare function literalLabelsToLiteralName(labels: LiteralLabel[]): LiteralName;
919
+
920
+ /**
921
+ * Implements the ENS `labelhash` function for Literal Labels.
922
+ * @see https://docs.ens.domains/ensip/1
923
+ *
924
+ * @param label the Literal Label to hash
925
+ * @returns the hash of the provided label
926
+ * @dev This function is viem/ens#labelhash but without the special-case handling of Encoded LabelHashes.
927
+ */
928
+ declare const labelhashLiteralLabel: (label: LiteralLabel) => LabelHash;
929
+
930
+ declare const hasNullByte: (value: string) => boolean;
931
+ declare const stripNullBytes: (value: string) => string;
932
+
933
+ /**
934
+ * Converts a bigint value into a number value.
935
+ *
936
+ * @throws when value is outside the range of `Number.MIN_SAFE_INTEGER` and
937
+ * `Number.MAX_SAFE_INTEGER`.
938
+ */
939
+ declare function bigIntToNumber(n: bigint): number;
940
+
941
+ /**
942
+ * Serializes a {@link ChainId} value into its string representation.
943
+ */
944
+ declare function serializeChainId(chainId: ChainId): ChainIdString;
945
+ /**
946
+ * Serializes a {@link Datetime} value into its string representation.
947
+ */
948
+ declare function serializeDatetime(datetime: Datetime): DatetimeISO8601;
949
+ /**
950
+ * Serializes a {@link URL} value into its string representation.
951
+ */
952
+ declare function serializeUrl(url: URL): UrlString;
953
+ /**
954
+ * Serializes a {@link Price} object.
955
+ */
956
+ declare function serializePrice(price: Price): SerializedPrice;
957
+ /**
958
+ * Serializes a {@link PriceEth} object.
959
+ */
960
+ declare function serializePriceEth(price: PriceEth): SerializedPriceEth;
961
+ /**
962
+ * Serializes {@link AccountId} object.
963
+ *
964
+ * Formatted as a fully lowercase CAIP-10 AccountId.
965
+ *
966
+ * @see https://chainagnostic.org/CAIPs/caip-10
967
+ */
968
+ declare function serializeAccountId(accountId: AccountId): SerializedAccountId;
969
+
970
+ declare function isHttpProtocol(url: URL): boolean;
971
+ declare function isWebSocketProtocol(url: URL): boolean;
972
+
973
+ /**
974
+ * A label set ID identifies a set of labels that can be used for deterministic healing.
975
+ * A label set allows clients to deterministically heal their state against a server,
976
+ * ensuring that both are operating on the same version of data.
977
+ *
978
+ * It is guaranteed to be 1 to 50 characters long and contain only lowercase letters (a-z)
979
+ * and hyphens (-).
980
+ */
981
+ type LabelSetId = string;
982
+ /**
983
+ * A label set version identifies a specific version of a label set. It allows clients to
984
+ * request data from a specific snapshot in time, ensuring deterministic results.
985
+ *
986
+ * It is guaranteed to be a non-negative integer.
987
+ */
988
+ type LabelSetVersion = number;
989
+ /**
990
+ * The label set preferences of an ENSRainbow client.
991
+ */
992
+ interface EnsRainbowClientLabelSet {
993
+ /**
994
+ * Optional label set ID that the ENSRainbow server is expected to use. If provided, heal
995
+ * operations will validate the ENSRainbow server is using this labelSetId.
996
+ * Required if `labelSetVersion` is defined.
997
+ */
998
+ labelSetId?: LabelSetId;
999
+ /**
1000
+ * Optional highest label set version of label set id to query. Enables deterministic heal
1001
+ * results across time even if the ENSRainbow server ingests label sets with greater versions
1002
+ * than this value. If provided, only labels from label sets with versions less than or equal to this
1003
+ * value will be returned. If not provided, the server will use the latest available version.
1004
+ * When `labelSetVersion` is defined, `labelSetId` must also be defined.
1005
+ */
1006
+ labelSetVersion?: LabelSetVersion;
1007
+ }
1008
+ /**
1009
+ * The state of label sets managed by an ENSRainbow server.
1010
+ */
1011
+ interface EnsRainbowServerLabelSet {
1012
+ /**
1013
+ * The LabelSetId managed by the ENSRainbow server.
1014
+ */
1015
+ labelSetId: LabelSetId;
1016
+ /**
1017
+ * The highest label set version available on the ENSRainbow server for the current
1018
+ * label set ID. This represents the most recent version of the label set that the
1019
+ * server has ingested and can provide label healing results for.
1020
+ */
1021
+ highestLabelSetVersion: LabelSetVersion;
1022
+ }
1023
+
1024
+ /**
1025
+ * A PluginName is a unique id for a 'plugin': we use the notion of
1026
+ * 'plugins' to describe bundles of indexing logic.
1027
+ */
1028
+ declare enum PluginName {
1029
+ Subgraph = "subgraph",
1030
+ Basenames = "basenames",
1031
+ Lineanames = "lineanames",
1032
+ ThreeDNS = "threedns",
1033
+ ProtocolAcceleration = "protocol-acceleration",
1034
+ Registrars = "registrars",
1035
+ TokenScope = "tokenscope"
1036
+ }
1037
+ /**
1038
+ * Version info about ENSIndexer and its dependencies.
1039
+ */
1040
+ interface ENSIndexerVersionInfo {
1041
+ /**
1042
+ * Node.js runtime version
1043
+ *
1044
+ * @see https://nodejs.org/en/about/previous-releases
1045
+ **/
1046
+ nodejs: string;
1047
+ /**
1048
+ * Ponder framework version
1049
+ *
1050
+ * @see https://www.npmjs.com/package/ponder
1051
+ **/
1052
+ ponder: string;
1053
+ /**
1054
+ * ENSDb service version
1055
+ *
1056
+ * Guaranteed to be the same as {@link ENSIndexerVersionInfo.ensIndexer}.
1057
+ * */
1058
+ ensDb: string;
1059
+ /**
1060
+ * ENSIndexer service version
1061
+ *
1062
+ * @see https://ghcr.io/namehash/ensnode/ensindexer
1063
+ **/
1064
+ ensIndexer: string;
1065
+ /**
1066
+ * ENSRainbow service version
1067
+ *
1068
+ * @see https://ghcr.io/namehash/ensnode/ensindexer
1069
+ **/
1070
+ ensRainbow: string;
1071
+ /**
1072
+ * ENSRainbow schema version
1073
+ **/
1074
+ ensRainbowSchema: number;
1075
+ /**
1076
+ * ENS Normalize package version
1077
+ *
1078
+ * Available on NPM as: `@adraffy/ens-normalize`
1079
+ *
1080
+ * @see https://www.npmjs.com/package/@adraffy/ens-normalize
1081
+ **/
1082
+ ensNormalize: string;
1083
+ }
1084
+ /**
1085
+ * Complete public configuration object for ENSIndexer.
1086
+ *
1087
+ * We use parameter types to maintain fields layout and documentation across
1088
+ * the domain model and its serialized counterpart.
1089
+ */
1090
+ interface ENSIndexerPublicConfig {
1091
+ /**
1092
+ * The ENS namespace that ENSNode operates in the context of.
1093
+ *
1094
+ * See {@link ENSNamespaceIds} for available namespace identifiers.
1095
+ */
1096
+ namespace: ENSNamespaceId;
1097
+ /**
1098
+ * 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.
1099
+ */
1100
+ labelSet: Required<EnsRainbowClientLabelSet>;
1101
+ /**
1102
+ * A Postgres database schema name. This instance of ENSIndexer will write
1103
+ * indexed data to the tables in this schema.
1104
+ *
1105
+ * Invariants:
1106
+ * - Must be a non-empty string that is a valid Postgres database schema
1107
+ * identifier.
1108
+ */
1109
+ databaseSchemaName: string;
1110
+ /**
1111
+ * A set of strings referring to the names of plugins that are active.
1112
+ *
1113
+ * For future-proofing, this is a list of strings that may or may
1114
+ * not be currently valid {@link PluginName} values.
1115
+ *
1116
+ * Invariants:
1117
+ * - A set of strings with at least one value.
1118
+ */
1119
+ plugins: string[];
1120
+ /**
1121
+ * Indexed Chain IDs
1122
+ *
1123
+ * Includes the {@link ChainId} for each chain being indexed.
1124
+ */
1125
+ indexedChainIds: Set<ChainId>;
1126
+ /**
1127
+ * A feature flag to enable/disable ENSIndexer's Subgraph Compatible Indexing Behavior.
1128
+ *
1129
+ * If {@link isSubgraphCompatible} is true, indexing behavior will match that of the legacy ENS
1130
+ * Subgraph.
1131
+ *
1132
+ * ENSIndexer will store and return Literal Labels and Literal Names without further interpretation.
1133
+ * @see https://ensnode.io/docs/reference/terminology#literal-label
1134
+ * @see https://ensnode.io/docs/reference/terminology#literal-name
1135
+ *
1136
+ * If {@link isSubgraphCompatible} is true, the following invariants are true for the ENSIndexerConfig:
1137
+ * 1. only the 'subgraph' plugin is enabled, and
1138
+ * 2. the labelSet must be { labelSetId: 'subgraph', labelSetVersion: 0 }
1139
+ *
1140
+ * If {@link isSubgraphCompatible} is false, ENSIndexer will additionally:
1141
+ *
1142
+ * 1. ENSIndexer will heal all subnames of addr.reverse on the ENS Root Chain.
1143
+ *
1144
+ * 2. ENSIndexer will track both the keys and the values of Resolver records.
1145
+ *
1146
+ * WARNING: Special care must be taken when interacting with indexed resolver record values. It
1147
+ * is unsafe to naively assume that indexed resolver record values are equivalent to the
1148
+ * resolver record values that would be returned through dynamic lookups via the ENS protocol.
1149
+ * For example, if a resolver implements CCIP-Read, the resolver records may not be
1150
+ * discoverable through onchain indexing.
1151
+ *
1152
+ * 3. Literal Labels and Literal Names encountered by ENSIndexer will be Interpreted.
1153
+ * @see https://ensnode.io/docs/reference/terminology#interpreted-label
1154
+ * @see https://ensnode.io/docs/reference/terminology#interpreted-name
1155
+ *
1156
+ * That is,
1157
+ * a) all Labels stored and returned by ENSIndexer will be Interpreted Labels, which are either:
1158
+ * i. normalized, or
1159
+ * ii. represented as an Encoded LabelHash of the Literal Label value found onchain, and
1160
+ * b) all Names stored and returned by ENSIndexer will be Interpreted Names, which are exclusively
1161
+ * composed of Interpreted Labels.
1162
+ */
1163
+ isSubgraphCompatible: boolean;
1164
+ /**
1165
+ * Version info about ENSIndexer.
1166
+ */
1167
+ versionInfo: ENSIndexerVersionInfo;
1168
+ }
1169
+
1170
+ type SerializedIndexedChainIds = Array<ChainId>;
1171
+ /**
1172
+ * Serialized representation of {@link ENSIndexerPublicConfig}
1173
+ */
1174
+ interface SerializedENSIndexerPublicConfig extends Omit<ENSIndexerPublicConfig, "indexedChainIds"> {
1175
+ /**
1176
+ * Array representation of {@link ENSIndexerPublicConfig.indexedChainIds}.
1177
+ */
1178
+ indexedChainIds: ChainId[];
1179
+ }
1180
+ /**
1181
+ * Serialized representation of {@link ENSIndexerVersionInfo}
1182
+ */
1183
+ type SerializedENSIndexerVersionInfo = ENSIndexerVersionInfo;
1184
+
1185
+ /**
1186
+ * Serialize a {@link ENSIndexerPublicConfig} object.
1187
+ */
1188
+ declare function deserializeENSIndexerPublicConfig(maybeConfig: SerializedENSIndexerPublicConfig, valueLabel?: string): ENSIndexerPublicConfig;
1189
+
1190
+ /**
1191
+ * Determines if the provided `config` results in indexing behavior compatible with the legacy ENS
1192
+ * Subgraph.
1193
+ *
1194
+ * @see https://ensnode.io/docs/reference/subgraph-compatibility/
1195
+ */
1196
+ declare function isSubgraphCompatible(config: Pick<ENSIndexerPublicConfig, "namespace" | "plugins" | "labelSet">): boolean;
1197
+
1198
+ /**
1199
+ * Converts a Labelhash to bytes, with validation
1200
+ * @param labelHash The Labelhash to convert
1201
+ * @returns A ByteArray containing the bytes
1202
+ * @throws Error if `labelHash` is not a valid 32-byte hex string
1203
+ */
1204
+ declare function labelHashToBytes(labelHash: LabelHash): ByteArray;
1205
+
1206
+ /**
1207
+ * Builds a valid LabelSetId from a string.
1208
+ * @param maybeLabelSetId - The string to validate and convert to a LabelSetId.
1209
+ * @returns A valid LabelSetId.
1210
+ * @throws If the input string is not a valid LabelSetId.
1211
+ */
1212
+ declare function buildLabelSetId(maybeLabelSetId: string): LabelSetId;
1213
+ /**
1214
+ * Builds a valid LabelSetVersion from a number or string.
1215
+ * @param maybeLabelSetVersion - The number or string to validate and convert to a LabelSetVersion.
1216
+ * @returns A valid LabelSetVersion.
1217
+ * @throws If the input is not a valid LabelSetVersion.
1218
+ */
1219
+ declare function buildLabelSetVersion(maybeLabelSetVersion: number | string): LabelSetVersion;
1220
+ /**
1221
+ * Builds an EnsRainbowClientLabelSet.
1222
+ * @param labelSetId - The label set ID.
1223
+ * @param labelSetVersion - The label set version.
1224
+ * @returns A valid EnsRainbowClientLabelSet object.
1225
+ * @throws If `labelSetVersion` is defined without `labelSetId`.
1226
+ */
1227
+ declare function buildEnsRainbowClientLabelSet(labelSetId?: LabelSetId, labelSetVersion?: LabelSetVersion): EnsRainbowClientLabelSet;
1228
+ /**
1229
+ * Validates that the server's label set is compatible with the client's requested label set.
1230
+ * @param serverSet - The label set provided by the server.
1231
+ * @param clientSet - The label set requested by the client.
1232
+ * @throws If the server set is not compatible with the client set.
1233
+ */
1234
+ declare function validateSupportedLabelSetAndVersion(serverSet: EnsRainbowServerLabelSet, clientSet: EnsRainbowClientLabelSet): void;
1235
+
1236
+ /**
1237
+ * Parses a string into a non-negative integer.
1238
+ * @param input The string to parse
1239
+ * @returns The parsed non-negative integer
1240
+ * @throws Error if the input is not a valid non-negative integer
1241
+ */
1242
+ declare function parseNonNegativeInteger(maybeNumber: string): number;
1243
+
1244
+ /**
1245
+ * Serializes a {@link ChainConfig} object.
1246
+ */
1247
+ declare function serializeIndexedChainIds(indexedChainIds: Set<ChainId>): SerializedIndexedChainIds;
1248
+ /**
1249
+ * Serialize a {@link ENSIndexerPublicConfig} object.
1250
+ */
1251
+ declare function serializeENSIndexerPublicConfig(config: ENSIndexerPublicConfig): SerializedENSIndexerPublicConfig;
1252
+
1253
+ /**
1254
+ * The type of indexing configuration for a chain.
1255
+ */
1256
+ declare const ChainIndexingConfigTypeIds: {
1257
+ /**
1258
+ * Represents that indexing of the chain should be performed for an indefinite range.
1259
+ */
1260
+ readonly Indefinite: "indefinite";
1261
+ /**
1262
+ * Represents that indexing of the chain should be performed for a definite range.
1263
+ */
1264
+ readonly Definite: "definite";
1265
+ };
1266
+ /**
1267
+ * The derived string union of possible {@link ChainIndexingConfigTypeIds}.
1268
+ */
1269
+ type ChainIndexingConfigTypeId = (typeof ChainIndexingConfigTypeIds)[keyof typeof ChainIndexingConfigTypeIds];
1270
+ /**
1271
+ * Chain indexing config for a chain whose indexing config `configType` is
1272
+ * {@link ChainIndexingConfigTypeIds.Indefinite}.
1273
+ *
1274
+ * Invariants:
1275
+ * - `configType` is always `ChainIndexingConfigTypeIds.Indefinite`.
1276
+ */
1277
+ interface ChainIndexingConfigIndefinite {
1278
+ /**
1279
+ * The type of chain indexing config.
1280
+ */
1281
+ configType: typeof ChainIndexingConfigTypeIds.Indefinite;
1282
+ /**
1283
+ * A {@link BlockRef} to the block where indexing of the chain should start.
1284
+ */
1285
+ startBlock: BlockRef;
1286
+ }
1287
+ /**
1288
+ * Chain indexing config for a chain whose indexing config `configType` is
1289
+ * {@link ChainIndexingConfigTypeIds.Definite}.
1290
+ *
1291
+ * Invariants:
1292
+ * - `configType` is always `ChainIndexingConfigTypeIds.Definite`.
1293
+ * - `startBlock` is always before or the same as `endBlock`.
1294
+ */
1295
+ interface ChainIndexingConfigDefinite {
1296
+ /**
1297
+ * The type of chain indexing config.
1298
+ */
1299
+ configType: typeof ChainIndexingConfigTypeIds.Definite;
1300
+ /**
1301
+ * A {@link BlockRef} to the block where indexing of the chain should start.
1302
+ */
1303
+ startBlock: BlockRef;
1304
+ /**
1305
+ * A {@link BlockRef} to the block where indexing of the chain should end.
1306
+ */
1307
+ endBlock: BlockRef;
1308
+ }
1309
+ /**
1310
+ * Indexing configuration for a chain.
1311
+ *
1312
+ * Use the `configType` field to determine the specific type interpretation
1313
+ * at runtime.
1314
+ */
1315
+ type ChainIndexingConfig = ChainIndexingConfigIndefinite | ChainIndexingConfigDefinite;
1316
+ /**
1317
+ * The status of indexing a chain at the time an indexing status snapshot
1318
+ * is captured.
1319
+ */
1320
+ declare const ChainIndexingStatusIds: {
1321
+ /**
1322
+ * Represents that indexing of the chain is not ready to begin yet because:
1323
+ * - ENSIndexer is in its initialization phase and the data to build a
1324
+ * "true" {@link ChainIndexingSnapshot} for the chain is still being loaded; or
1325
+ * - ENSIndexer is using an omnichain indexing strategy and the
1326
+ * `omnichainIndexingCursor` is <= `config.startBlock.timestamp` for the chain's
1327
+ * {@link ChainIndexingSnapshot}.
1328
+ */
1329
+ readonly Queued: "chain-queued";
1330
+ /**
1331
+ * Represents that indexing of the chain is in progress and under a special
1332
+ * "backfill" phase that optimizes for accelerated indexing until reaching the
1333
+ * "fixed target" `backfillEndBlock`.
1334
+ */
1335
+ readonly Backfill: "chain-backfill";
1336
+ /**
1337
+ * Represents that the "backfill" phase of indexing the chain is completed
1338
+ * and that the chain is configured to be indexed for an indefinite range.
1339
+ * Therefore, indexing of the chain remains indefinitely in progress where
1340
+ * ENSIndexer will continuously work to discover and index new blocks as they
1341
+ * are added to the chain across time.
1342
+ */
1343
+ readonly Following: "chain-following";
1344
+ /**
1345
+ * Represents that indexing of the chain is completed as the chain is configured
1346
+ * to be indexed for a definite range and the indexing of all blocks through
1347
+ * that definite range is completed.
1348
+ */
1349
+ readonly Completed: "chain-completed";
1350
+ };
1351
+ /**
1352
+ * The derived string union of possible {@link ChainIndexingStatusIds}.
1353
+ */
1354
+ type ChainIndexingStatusId = (typeof ChainIndexingStatusIds)[keyof typeof ChainIndexingStatusIds];
1355
+ /**
1356
+ * Chain indexing status snapshot for a chain whose `chainStatus` is
1357
+ * {@link ChainIndexingStatusIds.Queued}.
1358
+ *
1359
+ * Invariants:
1360
+ * - `chainStatus` is always {@link ChainIndexingStatusIds.Queued}.
1361
+ */
1362
+ interface ChainIndexingStatusSnapshotQueued {
1363
+ /**
1364
+ * The status of indexing the chain at the time the indexing status snapshot
1365
+ * was captured.
1366
+ */
1367
+ chainStatus: typeof ChainIndexingStatusIds.Queued;
1368
+ /**
1369
+ * The indexing configuration of the chain.
1370
+ */
1371
+ config: ChainIndexingConfig;
1372
+ }
1373
+ /**
1374
+ * Chain indexing status snapshot for a chain whose `chainStatus` is
1375
+ * {@link ChainIndexingStatusIds.Backfill}.
1376
+ *
1377
+ * During a backfill, special performance optimizations are applied to
1378
+ * index all blocks between `config.startBlock` and `backfillEndBlock`
1379
+ * as fast as possible.
1380
+ *
1381
+ * Note how `backfillEndBlock` is a "fixed target" that does not change during
1382
+ * the lifetime of an ENSIndexer process instance:
1383
+ * - If the `config` is {@link ChainIndexingConfigDefinite}:
1384
+ * `backfillEndBlock` is always the same as `config.endBlock`.
1385
+ * - If the `config` is {@link ChainIndexingConfigIndefinite}:
1386
+ * `backfillEndBlock` is a {@link BlockRef} to what was the latest block on the
1387
+ * chain when the ENSIndexer process was performing its initialization. Note how
1388
+ * this means that if the backfill process takes X hours to complete, because the
1389
+ * `backfillEndBlock` is a "fixed target", when `chainStatus` transitions to
1390
+ * {@link ChainIndexingStatusIds.Following} the chain will be X hours behind
1391
+ * "realtime" indexing.
1392
+ *
1393
+ * When `latestIndexedBlock` reaches `backfillEndBlock` the backfill is complete.
1394
+ * The moment backfill is complete the `chainStatus` may not immediately transition.
1395
+ * Instead, internal processing is completed for a period of time while
1396
+ * `chainStatus` remains {@link ChainIndexingStatusIds.Backfill}. After this internal
1397
+ * processing is completed `chainStatus` will transition:
1398
+ * - to {@link ChainIndexingStatusIds.Following} if the `config` is
1399
+ * {@link ChainIndexingConfigIndefinite}.
1400
+ * - to {@link ChainIndexingStatusIds.Completed} if the `config` is
1401
+ * {@link ChainIndexingConfigDefinite}.
1402
+ *
1403
+ * Invariants:
1404
+ * - `chainStatus` is always {@link ChainIndexingStatusIds.Backfill}.
1405
+ * - `config.startBlock` is always before or the same as `latestIndexedBlock`
1406
+ * - `config.endBlock` is always the same as `backfillEndBlock` if and only if
1407
+ * the config is {@link ChainIndexingConfigDefinite}.
1408
+ * - `latestIndexedBlock` is always before or the same as `backfillEndBlock`
1409
+ */
1410
+ interface ChainIndexingStatusSnapshotBackfill {
1411
+ /**
1412
+ * The status of indexing the chain at the time the indexing status snapshot
1413
+ * was captured.
1414
+ */
1415
+ chainStatus: typeof ChainIndexingStatusIds.Backfill;
1416
+ /**
1417
+ * The indexing configuration of the chain.
1418
+ */
1419
+ config: ChainIndexingConfig;
1420
+ /**
1421
+ * A {@link BlockRef} to the block that was most recently indexed as of the time the
1422
+ * indexing status snapshot was captured.
1423
+ */
1424
+ latestIndexedBlock: BlockRef;
1425
+ /**
1426
+ * A {@link BlockRef} to the block where the backfill will end.
1427
+ */
1428
+ backfillEndBlock: BlockRef;
1429
+ }
1430
+ /**
1431
+ * Chain indexing status snapshot for a chain whose `chainStatus` is
1432
+ * {@link ChainIndexingStatusIds.Following}.
1433
+ *
1434
+ * Invariants:
1435
+ * - `chainStatus` is always {@link ChainIndexingStatusIds.Following}.
1436
+ * - `config` is always {@link ChainIndexingConfigIndefinite}
1437
+ * - `config.startBlock` is always before or the same as `latestIndexedBlock`
1438
+ * - `latestIndexedBlock` is always before or the same as `latestKnownBlock`
1439
+ */
1440
+ interface ChainIndexingStatusSnapshotFollowing {
1441
+ /**
1442
+ * The status of indexing the chain at the time the indexing status snapshot
1443
+ * was captured.
1444
+ */
1445
+ chainStatus: typeof ChainIndexingStatusIds.Following;
1446
+ /**
1447
+ * The indexing configuration of the chain.
1448
+ */
1449
+ config: ChainIndexingConfigIndefinite;
1450
+ /**
1451
+ * A {@link BlockRef} to the block that was most recently indexed as of the time the
1452
+ * indexing status snapshot was captured.
1453
+ */
1454
+ latestIndexedBlock: BlockRef;
1455
+ /**
1456
+ * A {@link BlockRef} to the "highest" block that has been discovered by RPCs
1457
+ * and stored in the RPC cache as of the time the indexing status snapshot was
1458
+ * captured.
1459
+ */
1460
+ latestKnownBlock: BlockRef;
1461
+ }
1462
+ /**
1463
+ * Chain indexing status snapshot for a chain whose `chainStatus` is
1464
+ * {@link ChainIndexingStatusIds.Completed}.
1465
+ *
1466
+ * After the backfill of a chain is completed, if the chain was configured
1467
+ * to be indexed for a definite range, the chain indexing status will transition to
1468
+ * {@link ChainIndexingStatusIds.Completed}.
1469
+ *
1470
+ * Invariants:
1471
+ * - `chainStatus` is always {@link ChainIndexingStatusIds.Completed}.
1472
+ * - `config` is always {@link ChainIndexingConfigDefinite}
1473
+ * - `config.startBlock` is always before or the same as `latestIndexedBlock`
1474
+ * - `latestIndexedBlock` is always the same as `config.endBlock`.
1475
+ */
1476
+ interface ChainIndexingStatusSnapshotCompleted {
1477
+ /**
1478
+ * The status of indexing the chain at the time the indexing status snapshot
1479
+ * was captured.
1480
+ */
1481
+ chainStatus: typeof ChainIndexingStatusIds.Completed;
1482
+ /**
1483
+ * The indexing configuration of the chain.
1484
+ */
1485
+ config: ChainIndexingConfigDefinite;
1486
+ /**
1487
+ * A {@link BlockRef} to the block that was most recently indexed as of the time the
1488
+ * indexing status snapshot was captured.
1489
+ */
1490
+ latestIndexedBlock: BlockRef;
1491
+ }
1492
+ /**
1493
+ * Indexing status snapshot for a single chain.
1494
+ *
1495
+ * Use the `chainStatus` field to determine the specific type interpretation
1496
+ * at runtime.
1497
+ */
1498
+ type ChainIndexingStatusSnapshot = ChainIndexingStatusSnapshotQueued | ChainIndexingStatusSnapshotBackfill | ChainIndexingStatusSnapshotFollowing | ChainIndexingStatusSnapshotCompleted;
1499
+ /**
1500
+ * The status of omnichain indexing at the time an omnichain indexing status
1501
+ * snapshot is captured.
1502
+ */
1503
+ declare const OmnichainIndexingStatusIds: {
1504
+ /**
1505
+ * Represents that omnichain indexing is not ready to begin yet because
1506
+ * ENSIndexer is in its initialization phase and the data to build a "true"
1507
+ * {@link OmnichainIndexingStatusSnapshot} is still being loaded.
1508
+ */
1509
+ readonly Unstarted: "omnichain-unstarted";
1510
+ /**
1511
+ * Represents that omnichain indexing is in an overall "backfill" status because
1512
+ * - At least one indexed chain has a `chainStatus` of
1513
+ * {@link ChainIndexingStatusIds.Backfill}; and
1514
+ * - No indexed chain has a `chainStatus` of {@link ChainIndexingStatusIds.Following}.
1515
+ */
1516
+ readonly Backfill: "omnichain-backfill";
1517
+ /**
1518
+ * Represents that omnichain indexing is in an overall "following" status because
1519
+ * at least one indexed chain has a `chainStatus` of
1520
+ * {@link ChainIndexingStatusIds.Following}.
1521
+ */
1522
+ readonly Following: "omnichain-following";
1523
+ /**
1524
+ * Represents that omnichain indexing has completed because all indexed chains have
1525
+ * a `chainStatus` of {@link ChainIndexingStatusIds.Completed}.
1526
+ */
1527
+ readonly Completed: "omnichain-completed";
1528
+ };
1529
+ /**
1530
+ * The derived string union of possible {@link OmnichainIndexingStatusIds}.
1531
+ */
1532
+ type OmnichainIndexingStatusId = (typeof OmnichainIndexingStatusIds)[keyof typeof OmnichainIndexingStatusIds];
1533
+ /**
1534
+ * Omnichain indexing status snapshot when the overall `omnichainStatus` is
1535
+ * {@link OmnichainIndexingStatusIds.Unstarted}.
1536
+ *
1537
+ * Invariants:
1538
+ * - `omnichainStatus` is always {@link OmnichainIndexingStatusIds.Unstarted}.
1539
+ * - `chains` is always a map to {@link ChainIndexingStatusSnapshotQueued} values exclusively.
1540
+ * - `omnichainIndexingCursor` is always < the `config.startBlock.timestamp` for all
1541
+ * chains with `chainStatus` of {@link ChainIndexingStatusIds.Queued}.
1542
+ */
1543
+ interface OmnichainIndexingStatusSnapshotUnstarted {
1544
+ /**
1545
+ * The status of omnichain indexing.
1546
+ */
1547
+ omnichainStatus: typeof OmnichainIndexingStatusIds.Unstarted;
1548
+ /**
1549
+ * The indexing status snapshot for each indexed chain.
1550
+ */
1551
+ chains: Map<ChainId, ChainIndexingStatusSnapshotQueued>;
1552
+ /**
1553
+ * The timestamp of omnichain indexing progress across all indexed chains.
1554
+ */
1555
+ omnichainIndexingCursor: UnixTimestamp;
1556
+ }
1557
+ /**
1558
+ * The range of {@link ChainIndexingSnapshot} types allowed when the
1559
+ * overall omnichain indexing status is {@link OmnichainIndexingStatusIds.Backfill}.
1560
+ *
1561
+ * Note that this is all of the {@link ChainIndexingSnapshot} types with the exception
1562
+ * of {@link ChainIndexingStatusSnapshotFollowing}.
1563
+ */
1564
+ type ChainIndexingStatusSnapshotForOmnichainIndexingStatusSnapshotBackfill = ChainIndexingStatusSnapshotQueued | ChainIndexingStatusSnapshotBackfill | ChainIndexingStatusSnapshotCompleted;
1565
+ /**
1566
+ * Omnichain indexing status snapshot when the `omnichainStatus` is
1567
+ * {@link OmnichainIndexingStatusIds.Backfill}.
1568
+ *
1569
+ * Invariants:
1570
+ * - `omnichainStatus` is always {@link OmnichainIndexingStatusIds.Backfill}.
1571
+ * - `chains` is guaranteed to contain at least one chain with a `chainStatus` of
1572
+ * {@link ChainIndexingStatusIds.Backfill}.
1573
+ * - `chains` is guaranteed to not to contain any chain with a `chainStatus` of
1574
+ * {@link ChainIndexingStatusIds.Following}
1575
+ * - `omnichainIndexingCursor` is always < the `config.startBlock.timestamp` for all
1576
+ * chains with `chainStatus` of {@link ChainIndexingStatusIds.Queued}.
1577
+ * - `omnichainIndexingCursor` is always <= the `backfillEndBlock.timestamp` for all
1578
+ * chains with `chainStatus` of {@link ChainIndexingStatusIds.Backfill}.
1579
+ * - `omnichainIndexingCursor` is always >= the `latestIndexedBlock.timestamp` for all
1580
+ * chains with `chainStatus` of {@link ChainIndexingStatusIds.Completed}.
1581
+ * - `omnichainIndexingCursor` is always equal to the timestamp of the highest
1582
+ * `latestIndexedBlock` across all chains that have started indexing
1583
+ * (`chainStatus` is not {@link ChainIndexingStatusIds.Queued}).
1584
+ */
1585
+ interface OmnichainIndexingStatusSnapshotBackfill {
1586
+ /**
1587
+ * The status of omnichain indexing.
1588
+ */
1589
+ omnichainStatus: typeof OmnichainIndexingStatusIds.Backfill;
1590
+ /**
1591
+ * The indexing status snapshot for each indexed chain.
1592
+ */
1593
+ chains: Map<ChainId, ChainIndexingStatusSnapshotForOmnichainIndexingStatusSnapshotBackfill>;
1594
+ /**
1595
+ * The timestamp of omnichain indexing progress across all indexed chains.
1596
+ */
1597
+ omnichainIndexingCursor: UnixTimestamp;
1598
+ }
1599
+ /**
1600
+ * Omnichain indexing status snapshot when the overall `omnichainStatus` is
1601
+ * {@link OmnichainIndexingStatusIds.Following}.
1602
+ *
1603
+ * Invariants:
1604
+ * - `omnichainStatus` is always {@link OmnichainIndexingStatusIds.Following}.
1605
+ * - `chains` is guaranteed to contain at least one chain with a `status` of
1606
+ * {@link ChainIndexingStatusIds.Following}.
1607
+ * - `omnichainIndexingCursor` is always < the `config.startBlock.timestamp` for all
1608
+ * chains with `chainStatus` of {@link ChainIndexingStatusIds.Queued}.
1609
+ * - `omnichainIndexingCursor` is always <= the `backfillEndBlock.timestamp` for all
1610
+ * chains with `chainStatus` of {@link ChainIndexingStatusIds.Backfill}.
1611
+ * - `omnichainIndexingCursor` is always >= the `latestIndexedBlock.timestamp` for all
1612
+ * chains with `chainStatus` of {@link ChainIndexingStatusIds.Completed}.
1613
+ * - `omnichainIndexingCursor` is always equal to the timestamp of the highest
1614
+ * `latestIndexedBlock` across all chains that have started indexing
1615
+ * (`chainStatus` is not {@link ChainIndexingStatusIds.Queued}).
1616
+ */
1617
+ interface OmnichainIndexingStatusSnapshotFollowing {
1618
+ /**
1619
+ * The status of omnichain indexing.
1620
+ */
1621
+ omnichainStatus: typeof OmnichainIndexingStatusIds.Following;
1622
+ /**
1623
+ * The indexing status snapshot for each indexed chain.
1624
+ */
1625
+ chains: Map<ChainId, ChainIndexingStatusSnapshot>;
1626
+ /**
1627
+ * The timestamp of omnichain indexing progress across all indexed chains.
1628
+ */
1629
+ omnichainIndexingCursor: UnixTimestamp;
1630
+ }
1631
+ /**
1632
+ * Omnichain indexing status snapshot when the overall `omnichainStatus` is
1633
+ * {@link OmnichainIndexingStatusIds.Completed}.
1634
+ *
1635
+ * Invariants:
1636
+ * - `omnichainStatus` is always {@link OmnichainIndexingStatusIds.Completed}.
1637
+ * - `chains` is always a map to {@link ChainIndexingStatusSnapshotCompleted} values exclusively.
1638
+ * - `omnichainIndexingCursor` is always equal to the highest
1639
+ * `latestIndexedBlock.timestamp` for all chains.
1640
+ */
1641
+ interface OmnichainIndexingStatusSnapshotCompleted {
1642
+ /**
1643
+ * The status of omnichain indexing.
1644
+ */
1645
+ omnichainStatus: typeof OmnichainIndexingStatusIds.Completed;
1646
+ /**
1647
+ * The indexing status snapshot for each indexed chain.
1648
+ */
1649
+ chains: Map<ChainId, ChainIndexingStatusSnapshotCompleted>;
1650
+ /**
1651
+ * The timestamp of omnichain indexing progress across all indexed chains.
1652
+ */
1653
+ omnichainIndexingCursor: UnixTimestamp;
1654
+ }
1655
+ /**
1656
+ * Omnichain indexing status snapshot for one or more chains.
1657
+ *
1658
+ * Use the `omnichainStatus` field to determine the specific type interpretation
1659
+ * at runtime.
1660
+ */
1661
+ type OmnichainIndexingStatusSnapshot = OmnichainIndexingStatusSnapshotUnstarted | OmnichainIndexingStatusSnapshotBackfill | OmnichainIndexingStatusSnapshotCompleted | OmnichainIndexingStatusSnapshotFollowing;
1662
+ /**
1663
+ * The strategy used for indexing one or more chains.
1664
+ *
1665
+ * @see https://ponder.sh/docs/api-reference/ponder/config#parameters
1666
+ */
1667
+ declare const CrossChainIndexingStrategyIds: {
1668
+ /**
1669
+ * Represents that the indexing of events across all indexed chains will
1670
+ * proceed in a deterministic "omnichain" ordering by block timestamp, chain ID,
1671
+ * and block number.
1672
+ *
1673
+ * This strategy is "deterministic" in that the order of processing cross-chain indexed
1674
+ * events and each resulting indexed data state transition recorded in ENSDb is always
1675
+ * the same for each ENSIndexer instance operating with an equivalent
1676
+ * `ENSIndexerConfig` and ENSIndexer version. However it also has the drawbacks of:
1677
+ * - increased indexing latency that must wait for the slowest indexed chain to
1678
+ * add new blocks or to discover new blocks through the configured RPCs.
1679
+ * - if any indexed chain gets "stuck" due to chain or RPC failures, all indexed chains
1680
+ * will be affected.
1681
+ */
1682
+ readonly Omnichain: "omnichain";
1683
+ };
1684
+ /**
1685
+ * The derived string union of possible {@link CrossChainIndexingStrategyIds}.
1686
+ */
1687
+ type CrossChainIndexingStrategyId = (typeof CrossChainIndexingStrategyIds)[keyof typeof CrossChainIndexingStrategyIds];
1688
+ /**
1689
+ * Cross-chain indexing status snapshot when the `strategy` is
1690
+ * {@link CrossChainIndexingStrategyId.Omnichain}.
1691
+ *
1692
+ * Invariants:
1693
+ * - `strategy` is always {@link CrossChainIndexingStrategyId.Omnichain}.
1694
+ * - `slowestChainIndexingCursor` is always equal to
1695
+ * `omnichainSnapshot.omnichainIndexingCursor`.
1696
+ * - `snapshotTime` is always >= the "highest known block timestamp", defined as the max of:
1697
+ * - the `slowestChainIndexingCursor`.
1698
+ * - the `config.startBlock.timestamp` for all indexed chains.
1699
+ * - the `config.endBlock.timestamp` for all indexed chains with a `config.configType` of
1700
+ * {@link ChainIndexingConfigTypeIds.Definite}.
1701
+ * - the `backfillEndBlock.timestamp` for all chains with `chainStatus` of
1702
+ * {@link ChainIndexingStatusIds.Backfill}.
1703
+ * - the `latestKnownBlock.timestamp` for all chains with `chainStatus` of
1704
+ * {@link ChainIndexingStatusIds.Following}.
1705
+ */
1706
+ interface CrossChainIndexingStatusSnapshotOmnichain {
1707
+ /**
1708
+ * The strategy used for indexing one or more chains.
1709
+ */
1710
+ strategy: typeof CrossChainIndexingStrategyIds.Omnichain;
1711
+ /**
1712
+ * The timestamp of the "slowest" latest indexed block timestamp
1713
+ * across all indexed chains.
1714
+ */
1715
+ slowestChainIndexingCursor: UnixTimestamp;
1716
+ /**
1717
+ * The timestamp when the cross-chain indexing status snapshot was generated.
1718
+ *
1719
+ * Due to possible clock skew between different systems this value must be set
1720
+ * to the max of each of the following values to ensure all invariants are followed:
1721
+ * - the current system time of the system generating this cross-chain indexing
1722
+ * status snapshot.
1723
+ * - the "highest known block timestamp" (see invariants above for full definition).
1724
+ */
1725
+ snapshotTime: UnixTimestamp;
1726
+ /**
1727
+ * The omnichain indexing status snapshot for one or more chains.
1728
+ */
1729
+ omnichainSnapshot: OmnichainIndexingStatusSnapshot;
1730
+ }
1731
+ /**
1732
+ * Cross-chain indexing status snapshot for one or more chains.
1733
+ *
1734
+ * Use the `strategy` field to determine the specific type interpretation
1735
+ * at runtime.
1736
+ *
1737
+ * Currently, only omnichain indexing is supported. This type could theoretically
1738
+ * be extended to support other cross-chain indexing strategies in the future,
1739
+ * such as Ponder's "multichain" indexing strategy that indexes each chain
1740
+ * independently without deterministic ordering.
1741
+ */
1742
+ type CrossChainIndexingStatusSnapshot = CrossChainIndexingStatusSnapshotOmnichain;
1743
+ /**
1744
+ * A "realtime" indexing status projection based on worst-case assumptions
1745
+ * from the `snapshot`.
1746
+ *
1747
+ * Invariants:
1748
+ * - `projectedAt` is always >= `snapshot.snapshotTime`.
1749
+ * - `worstCaseDistance` is always equal to
1750
+ * `projectedAt - snapshot.slowestChainIndexingCursor`.
1751
+ */
1752
+ type RealtimeIndexingStatusProjection = {
1753
+ /**
1754
+ * The timestamp representing "now" as of the time this projection was generated.
1755
+ */
1756
+ projectedAt: UnixTimestamp;
1757
+ /**
1758
+ * The distance between `projectedAt` and `snapshot.slowestChainIndexingCursor`.
1759
+ *
1760
+ * This is "worst-case" because it assumes all of the following:
1761
+ * - the `snapshot` (which may have `snapshot.snapshotTime < projectedAt`) is still the
1762
+ * latest snapshot and no indexing progress has been made since `snapshotTime`.
1763
+ * - each indexed chain has added a new block as of `projectedAt`.
1764
+ */
1765
+ worstCaseDistance: Duration;
1766
+ /**
1767
+ * The {@link CrossChainIndexingStatusSnapshot} that this projection is based on.
1768
+ */
1769
+ snapshot: CrossChainIndexingStatusSnapshot;
1770
+ };
1771
+
1772
+ /**
1773
+ * Serialized representation of {@link ChainIndexingStatusSnapshot}
1774
+ */
1775
+ type SerializedChainIndexingStatusSnapshot = ChainIndexingStatusSnapshot;
1776
+ /**
1777
+ * Serialized representation of {@link ChainIndexingStatusSnapshotQueued}
1778
+ */
1779
+ type SerializedChainIndexingStatusSnapshotQueued = ChainIndexingStatusSnapshotQueued;
1780
+ /**
1781
+ * Serialized representation of {@link ChainIndexingStatusSnapshotBackfill}
1782
+ */
1783
+ type SerializedChainIndexingStatusSnapshotBackfill = ChainIndexingStatusSnapshotBackfill;
1784
+ /**
1785
+ * Serialized representation of {@link ChainIndexingStatusSnapshotCompleted}
1786
+ */
1787
+ type SerializedChainIndexingStatusSnapshotCompleted = ChainIndexingStatusSnapshotCompleted;
1788
+ /**
1789
+ * Serialized representation of {@link ChainIndexingStatusSnapshotFollowing}
1790
+ */
1791
+ type SerializedChainIndexingStatusSnapshotFollowing = ChainIndexingStatusSnapshotFollowing;
1792
+ /**
1793
+ * Serialized representation of {@link OmnichainIndexingStatusSnapshotUnstarted}
1794
+ */
1795
+ interface SerializedOmnichainIndexingStatusSnapshotUnstarted extends Omit<OmnichainIndexingStatusSnapshotUnstarted, "chains"> {
1796
+ chains: Record<ChainIdString, ChainIndexingStatusSnapshotQueued>;
1797
+ }
1798
+ /**
1799
+ * Serialized representation of {@link OmnichainIndexingStatusSnapshotBackfill}
1800
+ */
1801
+ interface SerializedOmnichainIndexingStatusSnapshotBackfill extends Omit<OmnichainIndexingStatusSnapshotBackfill, "chains"> {
1802
+ chains: Record<ChainIdString, ChainIndexingStatusSnapshotForOmnichainIndexingStatusSnapshotBackfill>;
1803
+ }
1804
+ /**
1805
+ * Serialized representation of {@link OmnichainIndexingStatusSnapshotCompleted}
1806
+ */
1807
+ interface SerializedOmnichainIndexingStatusSnapshotCompleted extends Omit<OmnichainIndexingStatusSnapshotCompleted, "chains"> {
1808
+ chains: Record<ChainIdString, ChainIndexingStatusSnapshotCompleted>;
1809
+ }
1810
+ /**
1811
+ * Serialized representation of {@link OmnichainIndexingStatusSnapshotFollowing}
1812
+ */
1813
+ interface SerializedOmnichainIndexingStatusSnapshotFollowing extends Omit<OmnichainIndexingStatusSnapshotFollowing, "chains"> {
1814
+ chains: Record<ChainIdString, ChainIndexingStatusSnapshot>;
1815
+ }
1816
+ /**
1817
+ * Serialized representation of {@link OmnichainIndexingStatusSnapshot}
1818
+ */
1819
+ type SerializedOmnichainIndexingStatusSnapshot = SerializedOmnichainIndexingStatusSnapshotUnstarted | SerializedOmnichainIndexingStatusSnapshotBackfill | SerializedOmnichainIndexingStatusSnapshotCompleted | SerializedOmnichainIndexingStatusSnapshotFollowing;
1820
+ /**
1821
+ * Serialized representation of {@link CrossChainIndexingStatusSnapshotOmnichain}
1822
+ */
1823
+ interface SerializedCrossChainIndexingStatusSnapshotOmnichain extends Omit<CrossChainIndexingStatusSnapshotOmnichain, "omnichainSnapshot"> {
1824
+ omnichainSnapshot: SerializedOmnichainIndexingStatusSnapshot;
1825
+ }
1826
+ /**
1827
+ * Serialized representation of {@link CrossChainIndexingStatusSnapshot}
1828
+ */
1829
+ type SerializedCrossChainIndexingStatusSnapshot = SerializedCrossChainIndexingStatusSnapshotOmnichain;
1830
+ /**
1831
+ * Serialized representation of {@link RealtimeIndexingStatusProjection}
1832
+ */
1833
+ interface SerializedCurrentIndexingProjectionOmnichain extends Omit<RealtimeIndexingStatusProjection, "snapshot"> {
1834
+ snapshot: SerializedOmnichainIndexingStatusSnapshot;
1835
+ }
1836
+ /**
1837
+ * Serialized representation of {@link RealtimeIndexingStatusProjection}
1838
+ */
1839
+ interface SerializedRealtimeIndexingStatusProjection extends Omit<RealtimeIndexingStatusProjection, "snapshot"> {
1840
+ snapshot: SerializedCrossChainIndexingStatusSnapshot;
1841
+ }
1842
+
1843
+ /**
1844
+ * Deserialize into a {@link ChainIndexingSnapshot} object.
1845
+ */
1846
+ declare function deserializeChainIndexingStatusSnapshot(maybeSnapshot: SerializedChainIndexingStatusSnapshot, valueLabel?: string): ChainIndexingStatusSnapshot;
1847
+ /**
1848
+ * Deserialize an {@link OmnichainIndexingStatusSnapshot} object.
1849
+ */
1850
+ declare function deserializeOmnichainIndexingStatusSnapshot(maybeSnapshot: SerializedOmnichainIndexingStatusSnapshot, valueLabel?: string): OmnichainIndexingStatusSnapshot;
1851
+ /**
1852
+ * Deserialize an {@link CrossChainIndexingStatusSnapshot} object.
1853
+ */
1854
+ declare function deserializeCrossChainIndexingStatusSnapshot(maybeSnapshot: SerializedCrossChainIndexingStatusSnapshot, valueLabel?: string): CrossChainIndexingStatusSnapshot;
1855
+ /**
1856
+ * Deserialize into a {@link RealtimeIndexingStatusProjection} object.
1857
+ */
1858
+ declare function deserializeRealtimeIndexingStatusProjection(maybeProjection: SerializedRealtimeIndexingStatusProjection, valueLabel?: string): RealtimeIndexingStatusProjection;
1859
+
1860
+ /**
1861
+ * Get {@link OmnichainIndexingStatusId} based on indexed chains' statuses.
1862
+ *
1863
+ * This function decides what is the `OmnichainIndexingStatusId` is,
1864
+ * based on provided chain indexing statuses.
1865
+ *
1866
+ * @throws an error if unable to determine overall indexing status
1867
+ */
1868
+ declare function getOmnichainIndexingStatus(chains: ChainIndexingStatusSnapshot[]): OmnichainIndexingStatusId;
1869
+ /**
1870
+ * Get the timestamp of the lowest `config.startBlock` across all chains
1871
+ * in the provided array of {@link ChainIndexingStatusSnapshot}.
1872
+ *
1873
+ * Such timestamp is useful when presenting the "lowest" block
1874
+ * to be indexed across all chains.
1875
+ */
1876
+ declare function getTimestampForLowestOmnichainStartBlock(chains: ChainIndexingStatusSnapshot[]): UnixTimestamp;
1877
+ /**
1878
+ * Get the timestamp of the "highest known block" across all chains
1879
+ * in the provided array of {@link ChainIndexingStatusSnapshot}.
1880
+ *
1881
+ * Such timestamp is useful when presenting the "highest known block"
1882
+ * to be indexed across all chains.
1883
+ *
1884
+ * The "highest known block" for a chain depends on its status:
1885
+ * - `config.endBlock` for a "queued" chain,
1886
+ * - `backfillEndBlock` for a "backfill" chain,
1887
+ * - `latestIndexedBlock` for a "completed" chain,
1888
+ * - `latestKnownBlock` for a "following" chain.
1889
+ */
1890
+ declare function getTimestampForHighestOmnichainKnownBlock(chains: ChainIndexingStatusSnapshot[]): UnixTimestamp;
1891
+ /**
1892
+ * Get Omnichain Indexing Cursor
1893
+ *
1894
+ * The cursor tracks the "highest" latest indexed block timestamp across
1895
+ * all indexed chains. If all chains are queued, the cursor tracks the moment
1896
+ * just before the earliest start block timestamp across those chains.
1897
+ *
1898
+ * @throws an error if no chains are provided
1899
+ */
1900
+ declare function getOmnichainIndexingCursor(chains: ChainIndexingStatusSnapshot[]): UnixTimestamp;
1901
+ /**
1902
+ * Create {@link ChainIndexingConfig} for given block refs.
1903
+ *
1904
+ * @param startBlock required block ref
1905
+ * @param endBlock optional block ref
1906
+ */
1907
+ declare function createIndexingConfig(startBlock: BlockRef, endBlock: BlockRef | null): ChainIndexingConfig;
1908
+ /**
1909
+ * Check if Chain Indexing Status Snapshots fit the 'unstarted' overall status
1910
+ * snapshot requirements:
1911
+ * - All chains are guaranteed to have a status of "queued".
1912
+ *
1913
+ * Note: This function narrows the {@link ChainIndexingStatusSnapshot} type to
1914
+ * {@link ChainIndexingStatusSnapshotQueued}.
1915
+ */
1916
+ declare function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted(chains: ChainIndexingStatusSnapshot[]): chains is ChainIndexingStatusSnapshotQueued[];
1917
+ /**
1918
+ * Check if Chain Indexing Status Snapshots fit the 'backfill' overall status
1919
+ * snapshot requirements:
1920
+ * - At least one chain is guaranteed to be in the "backfill" status.
1921
+ * - Each chain is guaranteed to have a status of either "queued",
1922
+ * "backfill" or "completed".
1923
+ *
1924
+ * Note: This function narrows the {@link ChainIndexingStatusSnapshot} type to
1925
+ * {@link ChainIndexingStatusSnapshotForOmnichainIndexingStatusSnapshotBackfill}.
1926
+ */
1927
+ declare function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill(chains: ChainIndexingStatusSnapshot[]): chains is ChainIndexingStatusSnapshotForOmnichainIndexingStatusSnapshotBackfill[];
1928
+ /**
1929
+ * Checks if Chain Indexing Status Snapshots fit the 'completed' overall status
1930
+ * snapshot requirements:
1931
+ * - All chains are guaranteed to have a status of "completed".
1932
+ *
1933
+ * Note: This function narrows the {@link ChainIndexingStatusSnapshot} type to
1934
+ * {@link ChainIndexingStatusSnapshotCompleted}.
1935
+ */
1936
+ declare function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted(chains: ChainIndexingStatusSnapshot[]): chains is ChainIndexingStatusSnapshotCompleted[];
1937
+ /**
1938
+ * Checks Chain Indexing Status Snapshots fit the 'following' overall status
1939
+ * snapshot requirements:
1940
+ * - At least one chain is guaranteed to be in the "following" status.
1941
+ * - Any other chain can have any status.
1942
+ */
1943
+ declare function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing(chains: ChainIndexingStatusSnapshot[]): chains is ChainIndexingStatusSnapshot[];
1944
+ /**
1945
+ * Sort a list of [{@link ChainId}, {@link ChainIndexingStatusSnapshot}] tuples
1946
+ * by the omnichain start block timestamp in ascending order.
1947
+ */
1948
+ declare function sortChainStatusesByStartBlockAsc<ChainStatusType extends ChainIndexingStatusSnapshot>(chains: [ChainId, ChainStatusType][]): [ChainId, ChainStatusType][];
1949
+
1950
+ /**
1951
+ * Create realtime indexing status projection from
1952
+ * a {@link CrossChainIndexingStatusSnapshot}.
1953
+ */
1954
+ declare function createRealtimeIndexingStatusProjection(snapshot: CrossChainIndexingStatusSnapshot, now: UnixTimestamp): RealtimeIndexingStatusProjection;
1955
+
1956
+ declare function serializeCrossChainIndexingStatusSnapshotOmnichain({ strategy, slowestChainIndexingCursor, snapshotTime, omnichainSnapshot, }: CrossChainIndexingStatusSnapshot): SerializedCrossChainIndexingStatusSnapshot;
1957
+ declare function serializeRealtimeIndexingStatusProjection(indexingProjection: RealtimeIndexingStatusProjection): SerializedRealtimeIndexingStatusProjection;
1958
+ /**
1959
+ * Serialize chain indexing snapshots.
1960
+ */
1961
+ declare function serializeChainIndexingSnapshots<ChainIndexingStatusSnapshotType extends ChainIndexingStatusSnapshot>(chains: Map<ChainId, ChainIndexingStatusSnapshotType>): Record<ChainIdString, ChainIndexingStatusSnapshotType>;
1962
+ /**
1963
+ * Serialize a {@link OmnichainIndexingStatusSnapshot} object.
1964
+ */
1965
+ declare function serializeOmnichainIndexingStatusSnapshot(indexingStatus: OmnichainIndexingStatusSnapshot): SerializedOmnichainIndexingStatusSnapshot;
1966
+
1967
+ /**
1968
+ * Gets the SubregistryId (an AccountId) of the Ethnames Subregistry contract (this is the
1969
+ * "BaseRegistrar" contract for direct subnames of .eth) for the provided namespace.
1970
+ *
1971
+ * @param namespace The ENS namespace to get the Ethnames Subregistry ID for
1972
+ * @returns The AccountId for the Ethnames Subregistry contract for the provided namespace.
1973
+ * @throws Error if the contract is not found for the given namespace.
1974
+ */
1975
+ declare function getEthnamesSubregistryId(namespace: ENSNamespaceId): AccountId;
1976
+
1977
+ /**
1978
+ * Subregistry
1979
+ */
1980
+ interface Subregistry {
1981
+ /**
1982
+ * Subregistry ID
1983
+ *
1984
+ * The ID of the subregistry the "logical registrar action" was taken on.
1985
+ *
1986
+ * Identifies the chainId and address of the associated subregistry smart
1987
+ * contract.
1988
+ */
1989
+ subregistryId: AccountId;
1990
+ /**
1991
+ * The node (namehash) of the name the subregistry manages subnames of.
1992
+ * Example subregistry managed names:
1993
+ * - `eth`
1994
+ * - `base.eth`
1995
+ * - `linea.eth`
1996
+ */
1997
+ node: Node;
1998
+ }
1999
+ /**
2000
+ * Serialized representation of {@link Subregistry}.
2001
+ */
2002
+ interface SerializedSubregistry extends Omit<Subregistry, "subregistryId"> {
2003
+ subregistryId: SerializedAccountId;
2004
+ }
2005
+ declare function serializeSubregistry(subregistry: Subregistry): SerializedSubregistry;
2006
+
2007
+ /**
2008
+ * Registration Lifecycle Stages
2009
+ *
2010
+ * Important: this definition should not be used anywhere.
2011
+ * It's only here to capture some ideas that were shared in the team.
2012
+ */
2013
+ declare const RegistrationLifecycleStages: {
2014
+ /**
2015
+ * Active
2016
+ *
2017
+ * Happens when
2018
+ * the current timestamp <= expiry.
2019
+ */
2020
+ readonly Active: "registrationLifecycle_active";
2021
+ /**
2022
+ * Grace Period
2023
+ *
2024
+ * Happens when
2025
+ * `expiry < the current timestamp <= expiry + 90 days`.
2026
+ */
2027
+ readonly GracePeriod: "registrationLifecycle_gracePeriod";
2028
+ /**
2029
+ * Released with Temporary Premium Price
2030
+ *
2031
+ * Happens when
2032
+ * `expiry + 90 days < the current timestamp <= expiry + 120 days`.
2033
+ */
2034
+ readonly ReleasedWithTempPrice: "registrationLifecycle_releasedWithTempPrice";
2035
+ /**
2036
+ * Fully Released (Regular Price)
2037
+ *
2038
+ * Happens when
2039
+ * ` expiry + 120 days < the current timestamp`.
2040
+ */
2041
+ readonly FullyReleased: "registrationLifecycle_fullyReleased";
2042
+ };
2043
+ type RegistrationLifecycleStage = (typeof RegistrationLifecycleStages)[keyof typeof RegistrationLifecycleStages];
2044
+ /**
2045
+ * Registration Lifecycle
2046
+ */
2047
+ interface RegistrationLifecycle {
2048
+ /**
2049
+ * Subregistry that manages this Registration Lifecycle.
2050
+ */
2051
+ subregistry: Subregistry;
2052
+ /**
2053
+ * The node (namehash) of the FQDN of the domain the registration lifecycle
2054
+ * is associated with.
2055
+ *
2056
+ * Guaranteed to be a subname of the node (namehash) of the subregistry
2057
+ * identified by `subregistryId.subregistryId`.
2058
+ */
2059
+ node: Node;
2060
+ /**
2061
+ * Expires at
2062
+ *
2063
+ * Identifies when the Registration Lifecycle is scheduled to expire.
2064
+ */
2065
+ expiresAt: UnixTimestamp;
2066
+ }
2067
+ /**
2068
+ * Serialized representation of {@link RegistrationLifecycle}.
2069
+ */
2070
+ interface SerializedRegistrationLifecycle extends Omit<RegistrationLifecycle, "subregistry"> {
2071
+ subregistry: SerializedSubregistry;
2072
+ }
2073
+ declare function serializeRegistrationLifecycle(registrationLifecycle: RegistrationLifecycle): SerializedRegistrationLifecycle;
2074
+
2075
+ /**
2076
+ * Globally unique, deterministic ID of an indexed onchain event
2077
+ * associated with the "logical registrar action".
2078
+ */
2079
+ type RegistrarActionEventId = string;
2080
+ /**
2081
+ * Types of "logical registrar action".
2082
+ */
2083
+ declare const RegistrarActionTypes: {
2084
+ readonly Registration: "registration";
2085
+ readonly Renewal: "renewal";
2086
+ };
2087
+ type RegistrarActionType = (typeof RegistrarActionTypes)[keyof typeof RegistrarActionTypes];
2088
+ /**
2089
+ * Pricing information for a "logical registrar action".
2090
+ */
2091
+ interface RegistrarActionPricingAvailable {
2092
+ /**
2093
+ * Base cost
2094
+ *
2095
+ * Base cost (before any `premium`) of Ether measured in units of Wei
2096
+ * paid to execute the "logical registrar action".
2097
+ *
2098
+ * May be 0.
2099
+ */
2100
+ baseCost: PriceEth;
2101
+ /**
2102
+ * Premium
2103
+ *
2104
+ * "premium" cost (in excesses of the `baseCost`) of Ether measured in
2105
+ * units of Wei paid to execute the "logical registrar action".
2106
+ *
2107
+ * May be 0.
2108
+ */
2109
+ premium: PriceEth;
2110
+ /**
2111
+ * Total
2112
+ *
2113
+ * Total cost of Ether measured in units of Wei paid to execute
2114
+ * the "logical registrar action".
2115
+ *
2116
+ * May be 0.
2117
+ */
2118
+ total: PriceEth;
2119
+ }
2120
+ /**
2121
+ * Pricing information for a "logical registrar action" when
2122
+ * there is no known pricing data.
2123
+ */
2124
+ interface RegistrarActionPricingUnknown {
2125
+ /**
2126
+ * Base cost
2127
+ *
2128
+ * Base cost (before any `premium`) of Ether measured in units of Wei
2129
+ * paid to execute the "logical registrar action".
2130
+ */
2131
+ baseCost: null;
2132
+ /**
2133
+ * Premium
2134
+ *
2135
+ * "premium" cost (in excesses of the `baseCost`) of Ether measured in
2136
+ * units of Wei paid to execute the "logical registrar action".
2137
+ */
2138
+ premium: null;
2139
+ /**
2140
+ * Total
2141
+ *
2142
+ * Total cost of Ether measured in units of Wei paid to execute
2143
+ * the "logical registrar action".
2144
+ */
2145
+ total: null;
2146
+ }
2147
+ type RegistrarActionPricing = RegistrarActionPricingAvailable | RegistrarActionPricingUnknown;
2148
+ declare function isRegistrarActionPricingAvailable(registrarActionPricing: RegistrarActionPricing): registrarActionPricing is RegistrarActionPricingAvailable;
2149
+ /**
2150
+ * * Referral information for performing a "logical registrar action".
2151
+ */
2152
+ interface RegistrarActionReferralAvailable {
2153
+ /**
2154
+ * Encoded Referrer
2155
+ *
2156
+ * Represents the "raw" 32-byte "referrer" value emitted onchain in
2157
+ * association with the registrar action.
2158
+ */
2159
+ encodedReferrer: EncodedReferrer;
2160
+ /**
2161
+ * Decoded Referrer
2162
+ *
2163
+ * Decoded referrer according to the subjective interpretation of
2164
+ * `encodedReferrer` defined for ENS Holiday Awards.
2165
+ *
2166
+ * Identifies the interpreted address of the referrer.
2167
+ * The "chainId" of this address is the same as is referenced in
2168
+ * `subregistryId`.
2169
+ *
2170
+ * May be the "zero address" to represent that an `encodedReferrer` is
2171
+ * defined but that it is interpreted as no referrer.
2172
+ */
2173
+ decodedReferrer: Address;
2174
+ }
2175
+ /**
2176
+ * Referral information for performing a "logical registrar action" when
2177
+ * registrar controller does not implement referrals.
2178
+ */
2179
+ interface RegistrarActionReferralNotApplicable {
2180
+ /**
2181
+ * Encoded Referrer
2182
+ *
2183
+ * Represents the "raw" 32-byte "referrer" value emitted onchain in
2184
+ * association with the registrar action.
2185
+ */
2186
+ encodedReferrer: null;
2187
+ /**
2188
+ * Decoded Referrer
2189
+ *
2190
+ * Decoded referrer according to the subjective interpretation of
2191
+ * `encodedReferrer` defined for ENS Holiday Awards.
2192
+ *
2193
+ */
2194
+ decodedReferrer: null;
2195
+ }
2196
+ type RegistrarActionReferral = RegistrarActionReferralAvailable | RegistrarActionReferralNotApplicable;
2197
+ declare function isRegistrarActionReferralAvailable(registrarActionReferral: RegistrarActionReferral): registrarActionReferral is RegistrarActionReferralAvailable;
2198
+ /**
2199
+ * "Logical registrar action"
2200
+ *
2201
+ * Represents a state of "logical registrar action". May be built using data
2202
+ * from multiple events within the same "logical" registration / renewal action.
2203
+ */
2204
+ interface RegistrarAction {
2205
+ /**
2206
+ * "Logical registrar action" ID
2207
+ *
2208
+ * The `id` value is a deterministic and globally unique identifier for
2209
+ * the "logical registrar action".
2210
+ *
2211
+ * The `id` value represents the *initial* onchain event associated with
2212
+ * the "logical registrar action", but the full state of
2213
+ * the "logical registrar action" is an aggregate across each of
2214
+ * the onchain events referenced in the `eventIds` field.
2215
+ *
2216
+ * Guaranteed to be the very first element in `eventIds` array.
2217
+ */
2218
+ id: RegistrarActionEventId;
2219
+ /**
2220
+ * The type of the "logical registrar action".
2221
+ */
2222
+ type: RegistrarActionType;
2223
+ /**
2224
+ *
2225
+ * Incremental Duration
2226
+ *
2227
+ * If `type` is "registration":
2228
+ * - Represents the duration between `block.timestamp` and
2229
+ * the initial `registrationLifecycle.expiresAt` value that the associated
2230
+ * "registration lifecycle" will be initialized with.
2231
+ * If `type` is "renewal":
2232
+ * - Represents the incremental increase in duration made to
2233
+ * the `registrationLifecycle.expiresAt` value in the associated
2234
+ * "registration lifecycle".
2235
+ *
2236
+ * A "registration lifecycle" may be extended via renewal even after it
2237
+ * expires if it is still within its grace period.
2238
+ *
2239
+ * Consider the following scenario:
2240
+ *
2241
+ * The "registration lifecycle" of a direct subname of .eth is scheduled to
2242
+ * expire on Jan 1, midnight UTC. It is currently 30 days after this
2243
+ * expiration time. Therefore, there are currently another 60 days of grace
2244
+ * period remaining for this name. Anyone can still make a renewal to
2245
+ * extend the "registration lifecycle" of this name.
2246
+ *
2247
+ * Given this scenario, consider the following examples:
2248
+ *
2249
+ * 1. If a renewal is made with 10 days incremental duration,
2250
+ * the "registration lifecycle" for this name will remain in
2251
+ * an "expired" state, but it will now have another 70 days of
2252
+ * grace period remaining.
2253
+ *
2254
+ * 2. If a renewal is made with 50 days incremental duration,
2255
+ * the "registration lifecycle" for this name will no longer be
2256
+ * "expired" and will become "active", but the "registration lifecycle"
2257
+ * will now be scheduled to expire again in 20 days.
2258
+ *
2259
+ * After the "registration lifecycle" for a name becomes expired by more
2260
+ * than its grace period, it can no longer be renewed by anyone and is
2261
+ * considered "released". The name must first be registered again, starting
2262
+ * a new "registration lifecycle" of
2263
+ * active / expired / grace period / released.
2264
+ *
2265
+ * May be 0.
2266
+ *
2267
+ * Guaranteed to be a non-negative bigint value.
2268
+ */
2269
+ incrementalDuration: Duration;
2270
+ /**
2271
+ * Registrant
2272
+ *
2273
+ * Identifies the address that initiated the "logical registrar action" and
2274
+ * is paying the `pricing.total` cost (if applicable).
2275
+ *
2276
+ * It may not be the owner of the name:
2277
+ * 1. When a name is registered, the initial owner of the name may be
2278
+ * distinct from the registrant.
2279
+ * 2. There are no restrictions on who may renew a name.
2280
+ * Therefore the owner of the name may be distinct from the registrant.
2281
+ *
2282
+ * The "chainId" of this address is the same as is referenced in
2283
+ * `registrationLifecycle.subregistry.subregistryId`.
2284
+ */
2285
+ registrant: Address;
2286
+ /**
2287
+ * Registration Lifecycle associated with this "logical registrar action".
2288
+ */
2289
+ registrationLifecycle: RegistrationLifecycle;
2290
+ /**
2291
+ * Pricing information associated with this "logical registrar action".
2292
+ */
2293
+ pricing: RegistrarActionPricing;
2294
+ /**
2295
+ * Referral information associated with this "logical registrar action".
2296
+ */
2297
+ referral: RegistrarActionReferral;
2298
+ /**
2299
+ * Block ref
2300
+ *
2301
+ * References the block where the "logical registrar action" was executed.
2302
+ *
2303
+ * The "chainId" of this block is the same as is referenced in
2304
+ * `registrationLifecycle.subregistry.subregistryId`.
2305
+ */
2306
+ block: BlockRef;
2307
+ /**
2308
+ * Transaction hash
2309
+ *
2310
+ * Transaction hash of the transaction associated with
2311
+ * the "logical registrar action".
2312
+ *
2313
+ * The "chainId" of this transaction is the same as is referenced in
2314
+ * `registrationLifecycle.subregistry.subregistryId`.
2315
+ *
2316
+ * Note that a single transaction may be associated with any number of
2317
+ * "logical registrar actions".
2318
+ */
2319
+ transactionHash: Hash;
2320
+ /**
2321
+ * Event IDs
2322
+ *
2323
+ * Array of the eventIds that have contributed to the state of
2324
+ * the "logical registrar action" record.
2325
+ *
2326
+ * Each eventId is a deterministic and globally unique onchain event
2327
+ * identifier.
2328
+ *
2329
+ * Guarantees:
2330
+ * - Each eventId is of events that occurred within the block
2331
+ * referenced by `block.number`.
2332
+ * - At least 1 eventId.
2333
+ * - Ordered chronologically (ascending) by logIndex within `block.number`.
2334
+ * - The first element in the array is equal to the `id` of
2335
+ * the overall "logical registrar action" record.
2336
+ *
2337
+ * The following ideas are not generalized for ENS overall but happen to
2338
+ * be a characteristic of the scope of our current indexing logic:
2339
+ * 1. These id's always reference events emitted by
2340
+ * a related "BaseRegistrar" contract.
2341
+ * 2. These id's optionally reference events emitted by
2342
+ * a related "Registrar Controller" contract. This is because our
2343
+ * current indexing logic doesn't guarantee to index
2344
+ * all "Registrar Controller" contracts.
2345
+ */
2346
+ eventIds: [RegistrarActionEventId, ...RegistrarActionEventId[]];
2347
+ }
2348
+ /**
2349
+ * Serialized representation of {@link RegistrarActionPricingUnknown}.
2350
+ */
2351
+ type SerializedRegistrarActionPricingUnknown = RegistrarActionPricingUnknown;
2352
+ /**
2353
+ * Serialized representation of {@link RegistrarActionPricingAvailable}.
2354
+ */
2355
+ interface SerializedRegistrarActionPricingAvailable {
2356
+ baseCost: SerializedPriceEth;
2357
+ premium: SerializedPriceEth;
2358
+ total: SerializedPriceEth;
2359
+ }
2360
+ /**
2361
+ * Serialized representation of {@link RegistrarActionPricing}.
2362
+ */
2363
+ type SerializedRegistrarActionPricing = SerializedRegistrarActionPricingAvailable | SerializedRegistrarActionPricingUnknown;
2364
+ /**
2365
+ * Serialized representation of {@link RegistrarAction}.
2366
+ */
2367
+ interface SerializedRegistrarAction extends Omit<RegistrarAction, "registrationLifecycle" | "pricing"> {
2368
+ registrationLifecycle: SerializedRegistrationLifecycle;
2369
+ pricing: SerializedRegistrarActionPricing;
2370
+ }
2371
+ declare function serializeRegistrarActionPricing(pricing: RegistrarActionPricing): SerializedRegistrarActionPricing;
2372
+ declare function serializeRegistrarAction(registrarAction: RegistrarAction): SerializedRegistrarAction;
2373
+
2374
+ declare const TheGraphCannotFallbackReasonSchema: z.ZodEnum<{
2375
+ readonly NotSubgraphCompatible: "not-subgraph-compatible";
2376
+ readonly NoApiKey: "no-api-key";
2377
+ readonly NoSubgraphUrl: "no-subgraph-url";
2378
+ }>;
2379
+ declare const TheGraphFallbackSchema: z.ZodObject<{
2380
+ canFallback: z.ZodBoolean;
2381
+ reason: z.ZodNullable<z.ZodEnum<{
2382
+ readonly NotSubgraphCompatible: "not-subgraph-compatible";
2383
+ readonly NoApiKey: "no-api-key";
2384
+ readonly NoSubgraphUrl: "no-subgraph-url";
2385
+ }>>;
2386
+ }, z.core.$strict>;
2387
+ /**
2388
+ * Create a Zod schema for validating a serialized ENSApiPublicConfig.
2389
+ *
2390
+ * @param valueLabel - Optional label for the value being validated (used in error messages)
2391
+ */
2392
+ declare function makeENSApiPublicConfigSchema(valueLabel?: string): z.ZodObject<{
2393
+ version: z.ZodString;
2394
+ theGraphFallback: z.ZodObject<{
2395
+ canFallback: z.ZodBoolean;
2396
+ reason: z.ZodNullable<z.ZodEnum<{
2397
+ readonly NotSubgraphCompatible: "not-subgraph-compatible";
2398
+ readonly NoApiKey: "no-api-key";
2399
+ readonly NoSubgraphUrl: "no-subgraph-url";
2400
+ }>>;
2401
+ }, z.core.$strict>;
2402
+ ensIndexerPublicConfig: z.ZodObject<{
2403
+ labelSet: z.ZodObject<{
2404
+ labelSetId: z.ZodString;
2405
+ labelSetVersion: z.ZodPipe<z.ZodCoercedNumber<unknown>, z.ZodInt>;
2406
+ }, z.core.$strip>;
2407
+ indexedChainIds: z.ZodPipe<z.ZodArray<z.ZodPipe<z.ZodInt, z.ZodTransform<number, number>>>, z.ZodTransform<Set<number>, number[]>>;
2408
+ isSubgraphCompatible: z.ZodBoolean;
2409
+ namespace: z.ZodEnum<{
2410
+ readonly Mainnet: "mainnet";
2411
+ readonly Sepolia: "sepolia";
2412
+ readonly Holesky: "holesky";
2413
+ readonly EnsTestEnv: "ens-test-env";
2414
+ }>;
2415
+ plugins: z.ZodArray<z.ZodString>;
2416
+ databaseSchemaName: z.ZodString;
2417
+ versionInfo: z.ZodObject<{
2418
+ nodejs: z.ZodString;
2419
+ ponder: z.ZodString;
2420
+ ensDb: z.ZodString;
2421
+ ensIndexer: z.ZodString;
2422
+ ensNormalize: z.ZodString;
2423
+ ensRainbow: z.ZodString;
2424
+ ensRainbowSchema: z.ZodInt;
2425
+ }, z.core.$strict>;
2426
+ }, z.core.$strip>;
2427
+ }, z.core.$strict>;
2428
+
2429
+ type TheGraphCannotFallbackReason = z.infer<typeof TheGraphCannotFallbackReasonSchema>;
2430
+ type TheGraphFallback = z.infer<typeof TheGraphFallbackSchema>;
2431
+ /**
2432
+ * Complete public configuration object for ENSApi.
2433
+ *
2434
+ * Contains ENSApi-specific configuration at the top level and
2435
+ * embeds the complete ENSIndexer public configuration.
2436
+ */
2437
+ interface ENSApiPublicConfig {
2438
+ /**
2439
+ * ENSApi service version
2440
+ *
2441
+ * @see https://ghcr.io/namehash/ensnode/ensapi
2442
+ */
2443
+ version: string;
2444
+ /**
2445
+ * The Graph Fallback-related info.
2446
+ */
2447
+ theGraphFallback: TheGraphFallback;
2448
+ /**
2449
+ * Complete ENSIndexer public configuration
2450
+ *
2451
+ * Contains all ENSIndexer public configuration including
2452
+ * namespace, plugins, version info, etc.
2453
+ */
2454
+ ensIndexerPublicConfig: ENSIndexerPublicConfig;
2455
+ }
2456
+
2457
+ /**
2458
+ * Serialized representation of {@link ENSApiPublicConfig}
2459
+ */
2460
+ interface SerializedENSApiPublicConfig extends Omit<ENSApiPublicConfig, "ensIndexerPublicConfig"> {
2461
+ /**
2462
+ * Serialized representation of {@link ENSApiPublicConfig.ensIndexerPublicConfig}.
2463
+ */
2464
+ ensIndexerPublicConfig: SerializedENSIndexerPublicConfig;
2465
+ }
2466
+
2467
+ /**
2468
+ * Deserialize a {@link ENSApiPublicConfig} object.
2469
+ */
2470
+ declare function deserializeENSApiPublicConfig(maybeConfig: SerializedENSApiPublicConfig, valueLabel?: string): ENSApiPublicConfig;
2471
+
2472
+ /**
2473
+ * Serialize a {@link ENSApiPublicConfig} object.
2474
+ */
2475
+ declare function serializeENSApiPublicConfig(config: ENSApiPublicConfig): SerializedENSApiPublicConfig;
2476
+
2477
+ /**
2478
+ * The resolution status for an `Identity`.
2479
+ */
2480
+ declare const ResolutionStatusIds: {
2481
+ /**
2482
+ * Represents that the `Identity` is not resolved yet.
2483
+ */
2484
+ readonly Unresolved: "unresolved";
2485
+ /**
2486
+ * Represents that resolution of the `Identity` resulted in a named identity.
2487
+ */
2488
+ readonly Named: "named";
2489
+ /**
2490
+ * Represents that resolution of the `Identity` resulted in an unnamed identity.
2491
+ */
2492
+ readonly Unnamed: "unnamed";
2493
+ /**
2494
+ * Represents that attempted resolution of the `Identity` resulted in an error
2495
+ * and therefore it is unknown if the `Identity` resolves to a named or unnamed identity.
2496
+ */
2497
+ readonly Unknown: "unknown";
2498
+ };
2499
+ /**
2500
+ * The derived string union of possible {@link ResolutionStatusIds}.
2501
+ */
2502
+ type ResolutionStatusId = (typeof ResolutionStatusIds)[keyof typeof ResolutionStatusIds];
2503
+ /**
2504
+ * Represents an {@link Identity} that has not become a {@link ResolvedIdentity} yet.
2505
+ *
2506
+ * Invariants:
2507
+ * - `resolutionStatus` is always {@link ResolutionStatusIds.Unresolved}.
2508
+ */
2509
+ interface UnresolvedIdentity {
2510
+ resolutionStatus: typeof ResolutionStatusIds.Unresolved;
2511
+ /**
2512
+ * The {@link DefaultableChainId} for an ENSIP-19 primary name lookup of the
2513
+ * identity associated with `address`.
2514
+ */
2515
+ chainId: DefaultableChainId;
2516
+ /**
2517
+ * The {@link Address} of the identity.
2518
+ */
2519
+ address: Address;
2520
+ }
2521
+ /**
2522
+ * Represents an `Identity` that resolved to a primary name.
2523
+ *
2524
+ * Invariants:
2525
+ * - `resolutionStatus` is always {@link ResolutionStatusIds.Named}.
2526
+ */
2527
+ interface NamedIdentity {
2528
+ resolutionStatus: typeof ResolutionStatusIds.Named;
2529
+ /**
2530
+ * The {@link DefaultableChainId} for an ENSIP-19 primary name lookup of the
2531
+ * identity associated with `address`.
2532
+ */
2533
+ chainId: DefaultableChainId;
2534
+ /**
2535
+ * The address of the identity.
2536
+ */
2537
+ address: Address;
2538
+ /**
2539
+ * The ENSIP-19 primary name lookup result of `address` on `chainId`.
2540
+ */
2541
+ name: Name;
2542
+ }
2543
+ /**
2544
+ * Represents an `Identity` that did not resolve to a primary name.
2545
+ *
2546
+ * Invariants:
2547
+ * - `resolutionStatus` is always {@link ResolutionStatusIds.Unnamed}.
2548
+ * - `name` is always `null`.
2549
+ */
2550
+ interface UnnamedIdentity {
2551
+ resolutionStatus: typeof ResolutionStatusIds.Unnamed;
2552
+ /**
2553
+ * The {@link DefaultableChainId} for an ENSIP-19 primary name lookup of the
2554
+ * identity associated with `address`.
2555
+ */
2556
+ chainId: DefaultableChainId;
2557
+ /**
2558
+ * The address of the identity.
2559
+ */
2560
+ address: Address;
2561
+ /**
2562
+ * The ENSIP-19 primary name lookup result of `address` on `chainId`.
2563
+ */
2564
+ name: null;
2565
+ }
2566
+ /**
2567
+ * Represents an `Identity` that was attempted to be resolved but the resolution attempt
2568
+ * resulted in an error and therefore it is unknown if the `Identity` resolves to a named
2569
+ * or unnamed identity.
2570
+ *
2571
+ * Invariants:
2572
+ * - `resolutionStatus` is always {@link ResolutionStatusIds.Unknown}.
2573
+ */
2574
+ interface UnknownIdentity {
2575
+ resolutionStatus: typeof ResolutionStatusIds.Unknown;
2576
+ /**
2577
+ * The {@link DefaultableChainId} for an ENSIP-19 primary name lookup of the
2578
+ * identity associated with `address`.
2579
+ */
2580
+ chainId: DefaultableChainId;
2581
+ /**
2582
+ * The address of the identity.
2583
+ */
2584
+ address: Address;
2585
+ }
2586
+ /**
2587
+ * Represents an ENSIP-19 identity resolution result.
2588
+ *
2589
+ * Use the `resolutionStatus` field to determine the specific type interpretation
2590
+ * at runtime.
2591
+ */
2592
+ type ResolvedIdentity = NamedIdentity | UnnamedIdentity | UnknownIdentity;
2593
+ /**
2594
+ * Represents an ENSIP-19 identity resolution (which may or not have been
2595
+ * resolved to a result yet).
2596
+ *
2597
+ * Use the `resolutionStatus` field to determine the specific type interpretation
2598
+ * at runtime.
2599
+ */
2600
+ type Identity = UnresolvedIdentity | ResolvedIdentity;
2601
+
2602
+ /**
2603
+ * Builds an {@link UnresolvedIdentity} for the provided {@link Address},
2604
+ * {@link DefaultableChainId} and {@link ENSNamespaceId}.
2605
+ *
2606
+ * If no `chainId` is provided, uses the ENS Root Chain Id for the provided
2607
+ * `namespaceId`.
2608
+ */
2609
+ declare function buildUnresolvedIdentity(address: Address, namespaceId: ENSNamespaceId, chainId?: DefaultableChainId): UnresolvedIdentity;
2610
+ /**
2611
+ * Returns whether the provided {@link Identity} is a {@link ResolvedIdentity}.
2612
+ *
2613
+ * @param identity - The {@link Identity} to check.
2614
+ * @returns Whether the provided {@link Identity} is a {@link ResolvedIdentity}.
2615
+ */
2616
+ declare function isResolvedIdentity(identity: Identity): identity is ResolvedIdentity;
2617
+
2618
+ /**
2619
+ * Gets the "chainId param" that should be used for a primary name resolution
2620
+ * request.
2621
+ *
2622
+ * ENSIP-19 defines special rules for the "chainId param" used
2623
+ * in primary name resolutions for the case that the `chainId` is the
2624
+ * ENS Root Chain Id for the provided `namespaceId`.
2625
+ *
2626
+ * Whenever this case happens, ENSIP-19 requires that the
2627
+ * "chainId param" is always set to chainId: 1 (mainnet), even if the
2628
+ * `chainId` where the primary name lookup is actually happening
2629
+ * on a non-mainnet ENS Root Chain, such as on a testnet or
2630
+ * the ens-test-env.
2631
+ *
2632
+ * @param namespaceId The namespace id for the primary name lookup.
2633
+ * @param chainId The chain id where the primary name lookup will actually happen.
2634
+ * @returns The "chainId param" that should be used for the primary name lookup.
2635
+ */
2636
+ declare const getResolvePrimaryNameChainIdParam: (chainId: DefaultableChainId, namespaceId: ENSNamespaceId) => DefaultableChainId;
2637
+ /**
2638
+ * Translates a `DefaultableChainId` a `ChainId`
2639
+ * such that if the provided `chainId` is `DEFAULT_EVM_CHAIN_ID`,
2640
+ * the `ChainId` of the ENS Root Chain for the provided `namespaceId` is returned.
2641
+ *
2642
+ * @param chainId The `DefaultableChainId` to translate.
2643
+ * @param namespaceId The namespace id for the translation.
2644
+ * @returns the translated `ChainId`.
2645
+ */
2646
+ declare const translateDefaultableChainIdToChainId: (chainId: DefaultableChainId, namespaceId: ENSNamespaceId) => ChainId;
2647
+
2648
+ /**
2649
+ * Encodes a selection of Resolver records in the context of a specific Name.
2650
+ */
2651
+ interface ResolverRecordsSelection {
2652
+ /**
2653
+ * Whether to fetch the name's `name` record. This value is primarily used in the context of
2654
+ * Reverse Resolution.
2655
+ *
2656
+ * @see https://docs.ens.domains/ensip/19/#reverse-resolution
2657
+ */
2658
+ name?: boolean;
2659
+ /**
2660
+ * Which coinTypes to fetch address records for.
2661
+ */
2662
+ addresses?: CoinType[];
2663
+ /**
2664
+ * Which keys to fetch text records for.
2665
+ */
2666
+ texts?: string[];
2667
+ }
2668
+ declare const isSelectionEmpty: (selection: ResolverRecordsSelection) => boolean;
2669
+
2670
+ /**
2671
+ * An internal type representing a non-inferred ResolverRecordsResponse, used in situations where
2672
+ * access to the more specific inferred type (ResolverRecordsResponse<SELECTION>) is difficult or
2673
+ * unnecessary.
2674
+ */
2675
+ type ResolverRecordsResponseBase = {
2676
+ /**
2677
+ * The name record, relevant in the context of Reverse Resolution.
2678
+ * Null if no name record is set.
2679
+ */
2680
+ name: Name | null;
2681
+ /**
2682
+ * Address records, keyed by CoinType.
2683
+ * Value is null if no record for the specified CoinType is set.
2684
+ *
2685
+ * NOTE: ENS resolver address records can store arbitrary string values,
2686
+ * including non-EVM addresses — always validate the record value against
2687
+ * the format your application expects.
2688
+ */
2689
+ addresses: Record<CoinType, string | null>;
2690
+ /**
2691
+ * Text records, keyed by key.
2692
+ * Value is null if no record for the specified key is set.
2693
+ */
2694
+ texts: Record<string, string | null>;
2695
+ };
2696
+ /**
2697
+ * Represents the strongly-typed set of records based on the provided SELECTION
2698
+ *
2699
+ * @example
2700
+ * ```typescript
2701
+ * const selection = {
2702
+ * name: true,
2703
+ * addresses: [60],
2704
+ * texts: ["com.twitter", "avatar"],
2705
+ * } as const satisfies ResolverRecordsSelection;
2706
+ *
2707
+ * type Response = ResolverRecordsResponse<typeof selection>;
2708
+ *
2709
+ * // results in the following type
2710
+ * type Response = {
2711
+ * readonly name: Name | null;
2712
+ * readonly addresses: Record<"60", string | null>;
2713
+ * readonly texts: Record<"avatar" | "com.twitter", string | null>;
2714
+ * }
2715
+ * ```
2716
+ */
2717
+ type ResolverRecordsResponse<T extends ResolverRecordsSelection = ResolverRecordsSelection> = {
2718
+ [K in keyof T as T[K] extends true | any[] ? K : never]: K extends "addresses" ? Record<`${T["addresses"] extends readonly CoinType[] ? T["addresses"][number] : never}`, string | null> : K extends "texts" ? Record<T["texts"] extends readonly string[] ? T["texts"][number] : never, string | null> : ResolverRecordsResponseBase[K & keyof ResolverRecordsResponseBase];
2719
+ };
2720
+
2721
+ /**
2722
+ * Arguments required to perform Forward Resolution
2723
+ */
2724
+ interface ForwardResolutionArgs<SELECTION extends ResolverRecordsSelection> {
2725
+ name: Name;
2726
+ selection: SELECTION;
2727
+ }
2728
+ /**
2729
+ * The result of performing ForwardResolution
2730
+ */
2731
+ type ForwardResolutionResult<SELECTION extends ResolverRecordsSelection> = ResolverRecordsResponse<SELECTION>;
2732
+ /**
2733
+ * Arguments required to perform Reverse Resolution
2734
+ */
2735
+ interface ReverseResolutionArgs {
2736
+ address: Address;
2737
+ chainId: ChainId;
2738
+ }
2739
+ /**
2740
+ * The result of performing ReverseResolution
2741
+ */
2742
+ type ReverseResolutionResult = Name | null;
2743
+ /**
2744
+ * Arguments required to perform Multichain Primary Name Resolution
2745
+ */
2746
+ interface MultichainPrimaryNameResolutionArgs {
2747
+ address: Address;
2748
+ chainIds?: ChainId[];
2749
+ }
2750
+ /**
2751
+ * The result of performing MultichainPrimaryNameResolution
2752
+ */
2753
+ type MultichainPrimaryNameResolutionResult = Record<ChainId, Name | null>;
2754
+
2755
+ /**
2756
+ * Identifiers for each traceable ENS protocol.
2757
+ */
2758
+ declare enum TraceableENSProtocol {
2759
+ ForwardResolution = "forward-resolution",
2760
+ ReverseResolution = "reverse-resolution"
2761
+ }
2762
+ /**
2763
+ * Encodes the set of well-known steps in the ENS Forward Resolution protocol.
2764
+ */
2765
+ declare enum ForwardResolutionProtocolStep {
2766
+ Operation = "forward-resolution",
2767
+ FindResolver = "find-resolver",
2768
+ ActiveResolverExists = "active-resolver-exists",
2769
+ AccelerateENSIP19ReverseResolver = "accelerate-ensip-19-reverse-resolver",
2770
+ AccelerateKnownOffchainLookupResolver = "accelerate-known-offchain-lookup-resolver",
2771
+ AccelerateKnownOnchainStaticResolver = "accelerate-known-onchain-static-resolver",
2772
+ RequireResolver = "require-resolver",
2773
+ ExecuteResolveCalls = "execute-resolve-calls"
2774
+ }
2775
+ /**
2776
+ * Encodes the set of well-known steps in the ENS Reverse Resolution protocol.
2777
+ */
2778
+ declare enum ReverseResolutionProtocolStep {
2779
+ Operation = "reverse-resolution",
2780
+ ResolveReverseName = "resolve-reverse-name",
2781
+ NameRecordExists = "name-record-exists-check",
2782
+ ForwardResolveAddressRecord = "forward-resolve-address-record",
2783
+ VerifyResolvedAddressMatchesAddress = "verify-resolved-address-matches-address"
2784
+ }
2785
+ declare const PROTOCOL_ATTRIBUTE_PREFIX = "ens";
2786
+ declare const ATTR_PROTOCOL_NAME = "ens.protocol";
2787
+ declare const ATTR_PROTOCOL_STEP = "ens.protocol.step";
2788
+ declare const ATTR_PROTOCOL_STEP_RESULT = "ens.protocol.step.result";
2789
+ interface SpanAttributes {
2790
+ [key: string]: unknown;
2791
+ }
2792
+ interface SpanEvent {
2793
+ name: string;
2794
+ attributes: SpanAttributes;
2795
+ time: number;
2796
+ }
2797
+ interface ProtocolSpan {
2798
+ scope: string;
2799
+ id: string;
2800
+ traceId: string;
2801
+ parentSpanContext: {
2802
+ traceId: string;
2803
+ spanId: string;
2804
+ } | undefined;
2805
+ name: string;
2806
+ timestamp: number;
2807
+ duration: number;
2808
+ attributes: SpanAttributes;
2809
+ status: {
2810
+ code: number;
2811
+ message?: string;
2812
+ };
2813
+ events: SpanEvent[];
2814
+ }
2815
+ type ProtocolSpanTreeNode = ProtocolSpan & {
2816
+ children: ProtocolSpanTreeNode[];
2817
+ };
2818
+ type ProtocolTrace = ProtocolSpanTreeNode[];
2819
+
2820
+ declare const ErrorResponseSchema: z$1.ZodObject<{
2821
+ message: z$1.ZodString;
2822
+ details: z$1.ZodOptional<z$1.ZodUnknown>;
2823
+ }, z$1.core.$strip>;
2824
+
2825
+ /**
2826
+ * API Error Response Type
2827
+ */
2828
+ type ErrorResponse = z$1.infer<typeof ErrorResponseSchema>;
2829
+ interface TraceableRequest {
2830
+ trace?: boolean;
2831
+ }
2832
+ interface TraceableResponse {
2833
+ trace?: ProtocolTrace;
2834
+ }
2835
+ interface AcceleratableRequest {
2836
+ accelerate?: boolean;
2837
+ }
2838
+ interface AcceleratableResponse {
2839
+ accelerationRequested: boolean;
2840
+ accelerationAttempted: boolean;
2841
+ }
2842
+ /**
2843
+ * Resolve Records Request Type
2844
+ */
2845
+ interface ResolveRecordsRequest<SELECTION extends ResolverRecordsSelection> extends ForwardResolutionArgs<SELECTION>, AcceleratableRequest, TraceableRequest {
2846
+ }
2847
+ /**
2848
+ * Resolve Records Response Type
2849
+ */
2850
+ interface ResolveRecordsResponse<SELECTION extends ResolverRecordsSelection> extends AcceleratableResponse, TraceableResponse {
2851
+ records: ResolverRecordsResponse<SELECTION>;
2852
+ }
2853
+ /**
2854
+ * Resolve Primary Name Request Type
2855
+ */
2856
+ interface ResolvePrimaryNameRequest extends ReverseResolutionArgs, AcceleratableRequest, TraceableRequest {
2857
+ }
2858
+ /**
2859
+ * Resolve Primary Name Response Type
2860
+ */
2861
+ interface ResolvePrimaryNameResponse extends AcceleratableResponse, TraceableResponse {
2862
+ name: ReverseResolutionResult;
2863
+ }
2864
+ interface ResolvePrimaryNamesRequest extends MultichainPrimaryNameResolutionArgs, AcceleratableRequest, TraceableRequest {
2865
+ }
2866
+ interface ResolvePrimaryNamesResponse extends AcceleratableResponse, TraceableResponse {
2867
+ names: MultichainPrimaryNameResolutionResult;
2868
+ }
2869
+ /**
2870
+ * ENSIndexer Public Config Response
2871
+ */
2872
+ type ConfigResponse = ENSApiPublicConfig;
2873
+ /**
2874
+ * Represents a request to Indexing Status API.
2875
+ */
2876
+ type IndexingStatusRequest = {};
2877
+ /**
2878
+ * A status code for indexing status responses.
2879
+ */
2880
+ declare const IndexingStatusResponseCodes: {
2881
+ /**
2882
+ * Represents that the indexing status is available.
2883
+ */
2884
+ readonly Ok: "ok";
2885
+ /**
2886
+ * Represents that the indexing status is unavailable.
2887
+ */
2888
+ readonly Error: "error";
2889
+ };
2890
+ /**
2891
+ * The derived string union of possible {@link IndexingStatusResponseCodes}.
2892
+ */
2893
+ type IndexingStatusResponseCode = (typeof IndexingStatusResponseCodes)[keyof typeof IndexingStatusResponseCodes];
2894
+ /**
2895
+ * An indexing status response when the indexing status is available.
2896
+ */
2897
+ type IndexingStatusResponseOk = {
2898
+ responseCode: typeof IndexingStatusResponseCodes.Ok;
2899
+ realtimeProjection: RealtimeIndexingStatusProjection;
2900
+ };
2901
+ /**
2902
+ * An indexing status response when the indexing status is unavailable.
2903
+ */
2904
+ type IndexingStatusResponseError = {
2905
+ responseCode: typeof IndexingStatusResponseCodes.Error;
2906
+ };
2907
+ /**
2908
+ * Indexing status response.
2909
+ *
2910
+ * Use the `responseCode` field to determine the specific type interpretation
2911
+ * at runtime.
2912
+ */
2913
+ type IndexingStatusResponse = IndexingStatusResponseOk | IndexingStatusResponseError;
2914
+ /**
2915
+ * Registrar Actions response
2916
+ */
2917
+ /**
2918
+ * Records Filters: Filter Types
2919
+ */
2920
+ declare const RegistrarActionsFilterTypes: {
2921
+ readonly BySubregistryNode: "bySubregistryNode";
2922
+ readonly WithEncodedReferral: "withEncodedReferral";
2923
+ };
2924
+ type RegistrarActionsFilterType = (typeof RegistrarActionsFilterTypes)[keyof typeof RegistrarActionsFilterTypes];
2925
+ type RegistrarActionsFilterBySubregistryNode = {
2926
+ filterType: typeof RegistrarActionsFilterTypes.BySubregistryNode;
2927
+ value: Node;
2928
+ };
2929
+ type RegistrarActionsFilterWithEncodedReferral = {
2930
+ filterType: typeof RegistrarActionsFilterTypes.WithEncodedReferral;
2931
+ };
2932
+ type RegistrarActionsFilter = RegistrarActionsFilterBySubregistryNode | RegistrarActionsFilterWithEncodedReferral;
2933
+ /**
2934
+ * Records Orders
2935
+ */
2936
+ declare const RegistrarActionsOrders: {
2937
+ readonly LatestRegistrarActions: "orderBy[timestamp]=desc";
2938
+ };
2939
+ type RegistrarActionsOrder = (typeof RegistrarActionsOrders)[keyof typeof RegistrarActionsOrders];
2940
+ /**
2941
+ * Represents a request to Registrar Actions API.
2942
+ */
2943
+ type RegistrarActionsRequest = {
2944
+ /**
2945
+ * Filters to be applied while generating results.
2946
+ */
2947
+ filters?: RegistrarActionsFilter[];
2948
+ /**
2949
+ * Order applied while generating results.
2950
+ */
2951
+ order?: RegistrarActionsOrder;
2952
+ /**
2953
+ * Limit the count of items per page to selected count of records.
2954
+ *
2955
+ * Guaranteed to be a positive integer (if defined).
2956
+ */
2957
+ itemsPerPage?: number;
2958
+ };
2959
+ /**
2960
+ * A status code for Registrar Actions API responses.
2961
+ */
2962
+ declare const RegistrarActionsResponseCodes: {
2963
+ /**
2964
+ * Represents that Registrar Actions are available.
2965
+ */
2966
+ readonly Ok: "ok";
2967
+ /**
2968
+ * Represents that Registrar Actions are unavailable.
2969
+ */
2970
+ readonly Error: "error";
2971
+ };
2972
+ /**
2973
+ * The derived string union of possible {@link RegistrarActionsResponseCodes}.
2974
+ */
2975
+ type RegistrarActionsResponseCode = (typeof RegistrarActionsResponseCodes)[keyof typeof RegistrarActionsResponseCodes];
2976
+ /**
2977
+ * "Logical registrar action" with its associated name.
2978
+ */
2979
+ interface NamedRegistrarAction {
2980
+ action: RegistrarAction;
2981
+ /**
2982
+ * Name
2983
+ *
2984
+ * FQDN of the name associated with `action`.
2985
+ *
2986
+ * Guarantees:
2987
+ * - `namehash(name)` is always `action.registrationLifecycle.node`.
2988
+ */
2989
+ name: InterpretedName;
2990
+ }
2991
+ /**
2992
+ * A response when Registrar Actions are available.
2993
+ */
2994
+ type RegistrarActionsResponseOk = {
2995
+ responseCode: typeof RegistrarActionsResponseCodes.Ok;
2996
+ registrarActions: NamedRegistrarAction[];
2997
+ };
2998
+ /**
2999
+ * A response when Registrar Actions are unavailable.
3000
+ */
3001
+ interface RegistrarActionsResponseError {
3002
+ responseCode: typeof IndexingStatusResponseCodes.Error;
3003
+ error: ErrorResponse;
3004
+ }
3005
+ /**
3006
+ * Registrar Actions response.
3007
+ *
3008
+ * Use the `responseCode` field to determine the specific type interpretation
3009
+ * at runtime.
3010
+ */
3011
+ type RegistrarActionsResponse = RegistrarActionsResponseOk | RegistrarActionsResponseError;
3012
+
3013
+ /**
3014
+ * Serialized representation of {@link IndexingStatusResponseError}.
3015
+ */
3016
+ type SerializedIndexingStatusResponseError = IndexingStatusResponseError;
3017
+ /**
3018
+ * Serialized representation of {@link IndexingStatusResponseOk}.
3019
+ */
3020
+ interface SerializedIndexingStatusResponseOk extends Omit<IndexingStatusResponseOk, "realtimeProjection"> {
3021
+ realtimeProjection: SerializedRealtimeIndexingStatusProjection;
3022
+ }
3023
+ /**
3024
+ * Serialized representation of {@link IndexingStatusResponse}.
3025
+ */
3026
+ type SerializedIndexingStatusResponse = SerializedIndexingStatusResponseOk | SerializedIndexingStatusResponseError;
3027
+ /**
3028
+ * Serialized representation of {@link RegistrarActionsResponseError}.
3029
+ */
3030
+ type SerializedRegistrarActionsResponseError = RegistrarActionsResponseError;
3031
+ /**
3032
+ * Serialized representation of {@link NamedRegistrarAction}.
3033
+ */
3034
+ interface SerializedNamedRegistrarAction extends Omit<NamedRegistrarAction, "action"> {
3035
+ action: SerializedRegistrarAction;
3036
+ }
3037
+ /**
3038
+ * Serialized representation of {@link RegistrarActionsResponseOk}.
3039
+ */
3040
+ interface SerializedRegistrarActionsResponseOk extends Omit<RegistrarActionsResponseOk, "registrarActions"> {
3041
+ registrarActions: SerializedNamedRegistrarAction[];
3042
+ }
3043
+ /**
3044
+ * Serialized representation of {@link SerializedRegistrarActionsResponse}.
3045
+ */
3046
+ type SerializedRegistrarActionsResponse = SerializedRegistrarActionsResponseOk | SerializedRegistrarActionsResponseError;
3047
+
3048
+ declare function deserializeErrorResponse(maybeErrorResponse: unknown): ErrorResponse;
3049
+ declare function deserializeIndexingStatusResponse(maybeResponse: SerializedIndexingStatusResponse): IndexingStatusResponse;
3050
+ declare function deserializeRegistrarActionsResponse(maybeResponse: SerializedRegistrarActionsResponse): RegistrarActionsResponse;
3051
+
3052
+ /**
3053
+ * Build a "parent node" filter object for Registrar Actions query.
3054
+ */
3055
+ declare function byParentNode(parentNode: Node): RegistrarActionsFilter;
3056
+ declare function byParentNode(parentNode: undefined): undefined;
3057
+ /**
3058
+ * Build a "with referral" filter object for Registrar Actions query.
3059
+ */
3060
+ declare function withReferral(withReferral: true): RegistrarActionsFilter;
3061
+ declare function withReferral(withReferral: false | undefined): undefined;
3062
+ declare const registrarActionsFilter: {
3063
+ byParentNode: typeof byParentNode;
3064
+ withReferral: typeof withReferral;
3065
+ };
3066
+
3067
+ declare const registrarActionsPrerequisites: Readonly<{
3068
+ /**
3069
+ * Required plugins to enable Registrar Actions API routes.
3070
+ *
3071
+ * 1. `registrars` plugin is required so that data in the `registrarActions`
3072
+ * table is populated.
3073
+ * 2. `subgraph`, `basenames`, and `lineanames` are required to get the data
3074
+ * for the name associated with each registrar action.
3075
+ * 3. In theory not all of `subgraph`, `basenames`, and `lineanames` plugins
3076
+ * might be required. Ex: At least one, but the current logic in
3077
+ * the `registrars` plugin always indexes registrar actions across
3078
+ * Ethnames (subgraph), Basenames, and Lineanames and therefore we need to
3079
+ * ensure each value in the registrar actions table has
3080
+ * an associated record in the domains table.
3081
+ */
3082
+ requiredPlugins: readonly [PluginName.Subgraph, PluginName.Basenames, PluginName.Lineanames, PluginName.Registrars];
3083
+ /**
3084
+ * Check if provided ENSApiPublicConfig supports the Registrar Actions API.
3085
+ */
3086
+ hasEnsIndexerConfigSupport(config: ENSIndexerPublicConfig): boolean;
3087
+ /**
3088
+ * Required Indexing Status IDs
3089
+ *
3090
+ * Database indexes are created by the time the omnichain indexing status
3091
+ * is either `completed` or `following`.
3092
+ */
3093
+ supportedIndexingStatusIds: ("omnichain-following" | "omnichain-completed")[];
3094
+ /**
3095
+ * Check if provided indexing status supports the Registrar Actions API.
3096
+ */
3097
+ hasIndexingStatusSupport(omnichainIndexingStatusId: OmnichainIndexingStatusId): boolean;
3098
+ }>;
3099
+
3100
+ declare function serializeIndexingStatusResponse(response: IndexingStatusResponse): SerializedIndexingStatusResponse;
3101
+ declare function serializeNamedRegistrarAction({ action, name, }: NamedRegistrarAction): SerializedNamedRegistrarAction;
3102
+ declare function serializeRegistrarActionsResponse(response: RegistrarActionsResponse): SerializedRegistrarActionsResponse;
3103
+
3104
+ /**
3105
+ * The default number of items per page for paginated aggregated referrer queries.
3106
+ */
3107
+ declare const ITEMS_PER_PAGE_DEFAULT = 25;
3108
+ /**
3109
+ * The maximum number of items per page for paginated aggregated referrer queries.
3110
+ */
3111
+ declare const ITEMS_PER_PAGE_MAX = 100;
3112
+ /**
3113
+ * Represents the aggregated metrics for a single referrer.
3114
+ */
3115
+ interface AggregatedReferrerMetrics {
3116
+ /** The Ethereum address of the referrer */
3117
+ referrer: Address;
3118
+ /**
3119
+ * The total number of qualified referrals made by this referrer
3120
+ * @invariant Guaranteed to be a positive integer (> 0)
3121
+ */
3122
+ totalReferrals: number;
3123
+ /**
3124
+ * The total incremental duration (in seconds) of all referrals made by this referrer
3125
+ * @invariant Guaranteed to be a non-negative integer (>= 0), measured in seconds
3126
+ */
3127
+ totalIncrementalDuration: Duration;
3128
+ }
3129
+ /**
3130
+ * Represents the aggregated metrics for a single referrer with contribution percentages.
3131
+ * Extends {@link AggregatedReferrerMetrics} with additional fields that show the referrer's
3132
+ * contribution as a percentage of the grand totals.
3133
+ */
3134
+ interface AggregatedReferrerMetricsContribution extends AggregatedReferrerMetrics {
3135
+ /**
3136
+ * The referrer's contribution to the grand total referrals as a decimal between 0 and 1 (inclusive).
3137
+ * Calculated as: totalReferrals / grandTotalReferrals
3138
+ * @invariant 0 <= totalReferralsContribution <= 1
3139
+ */
3140
+ totalReferralsContribution: number;
3141
+ /**
3142
+ * The referrer's contribution to the grand total incremental duration as a decimal between 0 and 1 (inclusive).
3143
+ * Calculated as: totalIncrementalDuration / grandTotalIncrementalDuration
3144
+ * @invariant 0 <= totalIncrementalDurationContribution <= 1
3145
+ */
3146
+ totalIncrementalDurationContribution: number;
3147
+ }
3148
+ /**
3149
+ * Base pagination parameters for paginated queries.
3150
+ */
3151
+ interface PaginationParams {
3152
+ /**
3153
+ * Requested page number (1-indexed)
3154
+ * @invariant Must be a positive integer (>= 1)
3155
+ * @default 1
3156
+ */
3157
+ page?: number;
3158
+ /**
3159
+ * Maximum number of items per page
3160
+ * @invariant Must be a positive integer (>= 1) and less than or equal to {@link ITEMS_PER_PAGE_MAX}
3161
+ * @default {@link ITEMS_PER_PAGE_DEFAULT}
3162
+ */
3163
+ itemsPerPage?: number;
3164
+ }
3165
+ /**
3166
+ * Request parameters for paginated aggregated referrers query.
3167
+ */
3168
+ interface PaginatedAggregatedReferrersRequest extends PaginationParams {
3169
+ }
3170
+ /**
3171
+ * Paginated aggregated referrers data with metadata.
3172
+ */
3173
+ interface PaginatedAggregatedReferrers {
3174
+ /**
3175
+ * Array of aggregated referrers for the current page with contribution percentages
3176
+ * @invariant Array may be empty for the first page if there are no qualified referrers.
3177
+ */
3178
+ referrers: AggregatedReferrerMetricsContribution[];
3179
+ /**
3180
+ * Total number of aggregated referrers across all pages
3181
+ * @invariant Guaranteed to be a non-negative integer (>= 0)
3182
+ */
3183
+ total: number;
3184
+ /**
3185
+ * Pagination parameters
3186
+ * @invariant Stores the pagination parameters from the request
3187
+ */
3188
+ paginationParams: PaginationParams;
3189
+ /**
3190
+ * Indicates whether there is a next page available
3191
+ * @invariant true if and only if (page * itemsPerPage < total)
3192
+ */
3193
+ hasNext: boolean;
3194
+ /**
3195
+ * Indicates whether there is a previous page available
3196
+ * @invariant true if and only if (page > 1)
3197
+ */
3198
+ hasPrev: boolean;
3199
+ /** Unix timestamp of when the leaderboard was last updated */
3200
+ updatedAt: UnixTimestamp;
3201
+ }
3202
+ /**
3203
+ * A status code for paginated aggregated referrers API responses.
3204
+ */
3205
+ declare const PaginatedAggregatedReferrersResponseCodes: {
3206
+ /**
3207
+ * Represents that the aggregated referrers data is available.
3208
+ * @note The response may contain an empty array for the first page if there are no qualified referrers.
3209
+ * When the array is empty, total will be 0, page will be 1, and both hasNext and hasPrev will be false.
3210
+ */
3211
+ readonly Ok: "ok";
3212
+ /**
3213
+ * Represents that the aggregated referrers data is not available.
3214
+ */
3215
+ readonly Error: "error";
3216
+ };
3217
+ /**
3218
+ * The derived string union of possible {@link PaginatedAggregatedReferrersResponseCodes}.
3219
+ */
3220
+ type PaginatedAggregatedReferrersResponseCode = (typeof PaginatedAggregatedReferrersResponseCodes)[keyof typeof PaginatedAggregatedReferrersResponseCodes];
3221
+ /**
3222
+ * A paginated aggregated referrers response when the data is available.
3223
+ */
3224
+ type PaginatedAggregatedReferrersResponseOk = {
3225
+ responseCode: typeof PaginatedAggregatedReferrersResponseCodes.Ok;
3226
+ data: PaginatedAggregatedReferrers;
3227
+ };
3228
+ /**
3229
+ * A paginated aggregated referrers response when the data is not available.
3230
+ */
3231
+ type PaginatedAggregatedReferrersResponseError = {
3232
+ responseCode: typeof PaginatedAggregatedReferrersResponseCodes.Error;
3233
+ error: string;
3234
+ errorMessage: string;
3235
+ };
3236
+ /**
3237
+ * A paginated aggregated referrers API response.
3238
+ *
3239
+ * Use the `responseCode` field to determine the specific type interpretation
3240
+ * at runtime.
3241
+ */
3242
+ type PaginatedAggregatedReferrersResponse = PaginatedAggregatedReferrersResponseOk | PaginatedAggregatedReferrersResponseError;
3243
+
3244
+ /**
3245
+ * Serialized representation of {@link PaginatedAggregatedReferrersResponseError}.
3246
+ *
3247
+ * Note: All fields are already serializable, so this type is identical to the source type.
3248
+ */
3249
+ type SerializedPaginatedAggregatedReferrersResponseError = PaginatedAggregatedReferrersResponseError;
3250
+ /**
3251
+ * Serialized representation of {@link PaginatedAggregatedReferrersResponseOk}.
3252
+ *
3253
+ * Note: All fields are already serializable, so this type is identical to the source type.
3254
+ */
3255
+ type SerializedPaginatedAggregatedReferrersResponseOk = PaginatedAggregatedReferrersResponseOk;
3256
+ /**
3257
+ * Serialized representation of {@link PaginatedAggregatedReferrersResponse}.
3258
+ */
3259
+ type SerializedPaginatedAggregatedReferrersResponse = SerializedPaginatedAggregatedReferrersResponseOk | SerializedPaginatedAggregatedReferrersResponseError;
3260
+
3261
+ /**
3262
+ * Deserialize a {@link PaginatedAggregatedReferrersResponse} object.
3263
+ *
3264
+ * Note: While the serialized and deserialized types are identical (all fields
3265
+ * are primitives), this function performs critical validation using Zod schemas
3266
+ * to enforce invariants on the data. This ensures data integrity when receiving
3267
+ * responses from the API.
3268
+ */
3269
+ declare function deserializePaginatedAggregatedReferrersResponse(maybeResponse: SerializedPaginatedAggregatedReferrersResponse, valueLabel?: string): PaginatedAggregatedReferrersResponse;
3270
+
3271
+ /**
3272
+ * Serialize a {@link PaginatedAggregatedReferrersResponse} object.
3273
+ *
3274
+ * Note: Since all fields in PaginatedAggregatedReferrersResponse are already
3275
+ * serializable primitives, this function performs an identity transformation.
3276
+ * It exists to maintain consistency with the serialization pattern used
3277
+ * throughout the codebase.
3278
+ */
3279
+ declare function serializePaginatedAggregatedReferrersResponse(response: PaginatedAggregatedReferrersResponse): SerializedPaginatedAggregatedReferrersResponse;
3280
+
3281
+ /**
3282
+ * Configuration options for ENSNode API client
3283
+ */
3284
+ interface ClientOptions {
3285
+ /** The ENSNode API URL */
3286
+ url: URL;
3287
+ }
3288
+ /**
3289
+ * ENSNode API Client
3290
+ *
3291
+ * Provides access to the following ENSNode APIs:
3292
+ * - Resolution API
3293
+ * - ENSAnalytics API
3294
+ * - 🚧 Configuration API
3295
+ * - 🚧 Indexing Status API
3296
+ *
3297
+ * @example
3298
+ * ```typescript
3299
+ * // Create client with default options
3300
+ * const client = new ENSNodeClient();
3301
+ *
3302
+ * // Use resolution methods
3303
+ * const { records } = await client.resolveRecords("jesse.base.eth", {
3304
+ * addresses: [60],
3305
+ * texts: ["avatar"]
3306
+ * });
3307
+ * ```
3308
+ *
3309
+ * @example
3310
+ * ```typescript
3311
+ * // Custom configuration
3312
+ * const client = new ENSNodeClient({
3313
+ * url: new URL("https://my-ensnode-instance.com"),
3314
+ * });
3315
+ * ```
3316
+ */
3317
+ declare class ENSNodeClient {
3318
+ private readonly options;
3319
+ static defaultOptions(): ClientOptions;
3320
+ constructor(options?: Partial<ClientOptions>);
3321
+ getOptions(): Readonly<ClientOptions>;
3322
+ /**
3323
+ * Resolves records for an ENS name (Forward Resolution).
3324
+ *
3325
+ * The returned `name` field, if set, is guaranteed to be a [Normalized Name](https://ensnode.io/docs/reference/terminology#normalized-name).
3326
+ * If the name record returned by the resolver is not normalized, `null` is returned as if no name record was set.
3327
+ *
3328
+ * @param name The ENS Name whose records to resolve
3329
+ * @param selection selection of Resolver records
3330
+ * @param options additional options
3331
+ * @param options.accelerate whether to attempt Protocol Acceleration (default false)
3332
+ * @param options.trace whether to include a trace in the response (default false)
3333
+ * @returns ResolveRecordsResponse<SELECTION>
3334
+ * @throws If the request fails or the ENSNode API returns an error response
3335
+ *
3336
+ * @example
3337
+ * ```typescript
3338
+ * const { records } = await client.resolveRecords("jesse.base.eth", {
3339
+ * addresses: [60],
3340
+ * texts: ["avatar", "com.twitter"]
3341
+ * });
3342
+ *
3343
+ * console.log(records);
3344
+ * // {
3345
+ * // addresses: {
3346
+ * // 60: "0xabcd..."
3347
+ * // },
3348
+ * // texts: {
3349
+ * // avatar: "https://example.com/image.jpg",
3350
+ * // "com.twitter": null, // if not set, for example
3351
+ * // }
3352
+ * // }
3353
+ * ```
3354
+ */
3355
+ resolveRecords<SELECTION extends ResolverRecordsSelection>(name: ResolveRecordsRequest<SELECTION>["name"], selection: ResolveRecordsRequest<SELECTION>["selection"], options?: Omit<ResolveRecordsRequest<SELECTION>, "name" | "selection">): Promise<ResolveRecordsResponse<SELECTION>>;
3356
+ /**
3357
+ * Resolves the primary name of a specified address (Reverse Resolution) on a specific chain.
3358
+ *
3359
+ * If the chainId-specific Primary Name is not defined, but the `address` specifies a valid
3360
+ * [ENSIP-19 Default Name](https://docs.ens.domains/ensip/19/#default-primary-name), the Default
3361
+ * Name will be returned. You _may_ query the Default EVM Chain Id (`0`) in order to determine the
3362
+ * `address`'s Default Name directly.
3363
+ *
3364
+ * The returned Primary Name, if set, is guaranteed to be a [Normalized Name](https://ensnode.io/docs/reference/terminology#normalized-name).
3365
+ * If the primary name set for the address is not normalized, `null` is returned as if no primary name was set.
3366
+ *
3367
+ * @param address The Address whose Primary Name to resolve
3368
+ * @param chainId The chain id within which to query the address' ENSIP-19 Multichain Primary Name
3369
+ * @param options additional options
3370
+ * @param options.accelerate whether to attempt Protocol Acceleration (default false)
3371
+ * @param options.trace whether to include a trace in the response (default false)
3372
+ * @returns ResolvePrimaryNameResponse
3373
+ * @throws If the request fails or the ENSNode API returns an error response
3374
+ *
3375
+ * @example
3376
+ * ```typescript
3377
+ * // Resolve the address' Primary Name on Ethereum Mainnet
3378
+ * const { name } = await client.resolvePrimaryName("0x179A862703a4adfb29896552DF9e307980D19285", 1);
3379
+ * // name === 'gregskril.eth'
3380
+ *
3381
+ * // Resolve the address' Primary Name on Base
3382
+ * const { name } = await client.resolvePrimaryName("0x179A862703a4adfb29896552DF9e307980D19285", 8453);
3383
+ * // name === 'greg.base.eth'
3384
+ *
3385
+ * // Resolve the address' Default Primary Name
3386
+ * const { name } = await client.resolvePrimaryName("0x179A862703a4adfb29896552DF9e307980D19285", 0);
3387
+ * // name === 'gregskril.eth'
3388
+ * ```
3389
+ */
3390
+ resolvePrimaryName(address: ResolvePrimaryNameRequest["address"], chainId: ResolvePrimaryNameRequest["chainId"], options?: Omit<ResolvePrimaryNameRequest, "address" | "chainId">): Promise<ResolvePrimaryNameResponse>;
3391
+ /**
3392
+ * Resolves the primary names of a specified address across multiple chains.
3393
+ *
3394
+ * For each Primary Name, if the chainId-specific Primary Name is not defined, but the `address`
3395
+ * specifies a valid [ENSIP-19 Default Name](https://docs.ens.domains/ensip/19/#default-primary-name),
3396
+ * the Default Name will be returned. You _may not_ query the Default EVM Chain Id (`0`) directly,
3397
+ * and should rely on the aforementioned per-chain defaulting behavior.
3398
+ *
3399
+ * Each returned Primary Name, if set, is guaranteed to be a [Normalized Name](https://ensnode.io/docs/reference/terminology#normalized-name).
3400
+ * If the primary name set for the address on any chain is not normalized, `null` is returned for
3401
+ * that chain as if no primary name was set.
3402
+ *
3403
+ * @param address The Address whose Primary Names to resolve
3404
+ * @param options additional options
3405
+ * @param options.chainIds The set of chain ids within which to query the address' ENSIP-19
3406
+ * Multichain Primary Name (default: all ENSIP-19 supported chains)
3407
+ * @param options.accelerate whether to attempt Protocol Acceleration (default: true)
3408
+ * @param options.trace whether to include a trace in the response (default: false)
3409
+ * @returns ResolvePrimaryNamesResponse
3410
+ * @throws If the request fails or the ENSNode API returns an error response
3411
+ *
3412
+ * @example
3413
+ * ```typescript
3414
+ * // Resolve the address' Primary Names on all ENSIP-19 supported chain ids
3415
+ * const { names } = await client.resolvePrimaryNames("0x179A862703a4adfb29896552DF9e307980D19285");
3416
+ *
3417
+ * console.log(names);
3418
+ * // {
3419
+ * // "1": "gregskril.eth", // Default Primary Name
3420
+ * // "10": "gregskril.eth", // Default Primary Name
3421
+ * // "8453": "greg.base.eth", // Base-specific Primary Name!
3422
+ * // "42161": "gregskril.eth", // Default Primary Name
3423
+ * // "59144": "gregskril.eth", // Default Primary Name
3424
+ * // "534352": "gregskril.eth" // Default Primary Name
3425
+ * // }
3426
+ *
3427
+ * // Resolve the address' Primary Names on specific chain Ids
3428
+ * const { names } = await client.resolvePrimaryNames("0xabcd...", [1, 8453]);
3429
+ *
3430
+ * console.log(names);
3431
+ * // {
3432
+ * // "1": "gregskril.eth",
3433
+ * // "8453": "greg.base.eth", // base-specific Primary Name!
3434
+ * // }
3435
+ * ```
3436
+ */
3437
+ resolvePrimaryNames(address: ResolvePrimaryNamesRequest["address"], options?: Omit<ResolvePrimaryNamesRequest, "address">): Promise<ResolvePrimaryNamesResponse>;
3438
+ /**
3439
+ * Fetch ENSNode Config
3440
+ *
3441
+ * Fetch the ENSNode's configuration.
3442
+ *
3443
+ * @returns {ConfigResponse}
3444
+ *
3445
+ * @throws if the ENSNode request fails
3446
+ * @throws if the ENSNode API returns an error response
3447
+ * @throws if the ENSNode response breaks required invariants
3448
+ */
3449
+ config(): Promise<ConfigResponse>;
3450
+ /**
3451
+ * Fetch ENSNode Indexing Status
3452
+ *
3453
+ * @returns {IndexingStatusResponse}
3454
+ *
3455
+ * @throws if the ENSNode request fails
3456
+ * @throws if the ENSNode API returns an error response
3457
+ * @throws if the ENSNode response breaks required invariants
3458
+ */
3459
+ indexingStatus(): Promise<IndexingStatusResponse>;
3460
+ /**
3461
+ * Fetch Paginated Aggregated Referrers
3462
+ *
3463
+ * Retrieves a paginated list of aggregated referrer metrics with contribution percentages.
3464
+ * Each referrer's contribution is calculated as a percentage of the grand totals across all referrers.
3465
+ *
3466
+ * @param request - Pagination parameters
3467
+ * @param request.page - The page number to retrieve (1-indexed, default: 1)
3468
+ * @param request.itemsPerPage - Number of items per page (default: 25, max: 100)
3469
+ * @returns {PaginatedAggregatedReferrersResponse}
3470
+ *
3471
+ * @throws if the ENSNode request fails
3472
+ * @throws if the ENSNode API returns an error response
3473
+ * @throws if the ENSNode response breaks required invariants
3474
+ *
3475
+ * @example
3476
+ * ```typescript
3477
+ * // Get first page with default page size (25 items)
3478
+ * const response = await client.getAggregatedReferrers();
3479
+ * if (response.responseCode === 'ok') {
3480
+ * console.log(response.data.referrers);
3481
+ * console.log(`Page ${response.data.paginationParams.page} of ${Math.ceil(response.data.total / response.data.paginationParams.itemsPerPage)}`);
3482
+ * }
3483
+ * ```
3484
+ *
3485
+ * @example
3486
+ * ```typescript
3487
+ * // Get second page with 50 items per page
3488
+ * const response = await client.getAggregatedReferrers({ page: 2, itemsPerPage: 50 });
3489
+ * ```
3490
+ */
3491
+ getAggregatedReferrers(request?: PaginatedAggregatedReferrersRequest): Promise<PaginatedAggregatedReferrersResponse>;
3492
+ /**
3493
+ * Fetch ENSNode Registrar Actions
3494
+ *
3495
+ * @param {RegistrarActionsRequestFilter} request.filter is
3496
+ * an optional request filter configuration.
3497
+ * @param {number} request.limit sets the maximum count of results in the response.
3498
+ * @param {RegistrarActionsRequestOrder} request.order sets the order of
3499
+ * results in the response by field and direction.
3500
+ * @returns {RegistrarActionsResponse}
3501
+ *
3502
+ * @throws if the ENSNode request fails
3503
+ * @throws if the ENSNode API returns an error response
3504
+ * @throws if the ENSNode response breaks required invariants
3505
+ *
3506
+ * @example
3507
+ * ```ts
3508
+ * import {
3509
+ * registrarActionsFilter,,
3510
+ * ENSNodeClient,
3511
+ * } from "@ensnode/ensnode-sdk";
3512
+ * import { namehash } from "viem/ens";
3513
+ *
3514
+ * const client: ENSNodeClient;
3515
+ *
3516
+ * // get latest registrar action records across all indexed subregistries
3517
+ * // NOTE: when no `limit` value is passed,
3518
+ * // the default RESPONSE_ITEMS_PER_PAGE_DEFAULT applies.
3519
+ * const registrarActions = await client.registrarActions();
3520
+ *
3521
+ * // get latest 5 registrar action records across all indexed subregistries
3522
+ * // NOTE: when a `limit` value is passed, it must be lower than or equal to
3523
+ * // the RESPONSE_ITEMS_PER_PAGE_MAX value.
3524
+ * const registrarActions = await client.registrarActions({
3525
+ * limit: 5,
3526
+ * });
3527
+ *
3528
+ * // get latest registrar action records associated with
3529
+ * // subregistry managing `eth` name
3530
+ * await client.registrarActions({
3531
+ * filters: [registrarActionsFilter.byParentNode(namehash('eth'))],
3532
+ * });
3533
+ *
3534
+ * // get latest registrar action records which include referral info
3535
+ * await client.registrarActions({
3536
+ * filters: [registrarActionsFilter.withReferral(true)],
3537
+ * });
3538
+ *
3539
+ * // get latest 10 registrar action records associated with
3540
+ * // subregistry managing `base.eth` name
3541
+ * await client.registrarActions({
3542
+ * filters: [registrarActionsFilter.byParentNode(namehash('base.eth'))],
3543
+ * limit: 10
3544
+ * });
3545
+ * ```
3546
+ */
3547
+ registrarActions(request?: RegistrarActionsRequest): Promise<RegistrarActionsResponse>;
3548
+ }
3549
+
3550
+ declare class ClientError extends Error {
3551
+ details?: unknown;
3552
+ constructor(message: string, details?: unknown);
3553
+ static fromErrorResponse({ message, details }: ErrorResponse): ClientError;
3554
+ }
3555
+
3556
+ export { ADDR_REVERSE_NODE, ATTR_PROTOCOL_NAME, ATTR_PROTOCOL_STEP, ATTR_PROTOCOL_STEP_RESULT, type AcceleratableRequest, type AcceleratableResponse, type AccountId, type AggregatedReferrerMetrics, type AggregatedReferrerMetricsContribution, BASENAMES_NODE, type BlockNumber, type BlockRef, type Blockrange, type Cache, type ChainId, type ChainIdString, type ChainIndexingConfig, type ChainIndexingConfigDefinite, type ChainIndexingConfigIndefinite, type ChainIndexingConfigTypeId, ChainIndexingConfigTypeIds, type ChainIndexingStatusId, ChainIndexingStatusIds, type ChainIndexingStatusSnapshot, type ChainIndexingStatusSnapshotBackfill, type ChainIndexingStatusSnapshotCompleted, type ChainIndexingStatusSnapshotFollowing, type ChainIndexingStatusSnapshotForOmnichainIndexingStatusSnapshotBackfill, type ChainIndexingStatusSnapshotQueued, ClientError, type ClientOptions, type ConfigResponse, type CrossChainIndexingStatusSnapshot, type CrossChainIndexingStatusSnapshotOmnichain, type CrossChainIndexingStrategyId, CrossChainIndexingStrategyIds, type CurrencyAmount, type CurrencyId, CurrencyIds, type CurrencyInfo, DEFAULT_EVM_CHAIN_ID, DEFAULT_EVM_COIN_TYPE, type DNSEncodedLiteralName, type DNSEncodedName, type DNSEncodedPartiallyInterpretedName, type Datetime, type DatetimeISO8601, type DeepPartial, type DefaultableChainId, type Duration, type ENSApiPublicConfig, type ENSIndexerPublicConfig, type ENSIndexerVersionInfo, ENSNodeClient, ETH_COIN_TYPE, ETH_NODE, type EncodedLabelHash, type EnsRainbowClientLabelSet, type EnsRainbowServerLabelSet, type ErrorResponse, type ForwardResolutionArgs, ForwardResolutionProtocolStep, type ForwardResolutionResult, ITEMS_PER_PAGE_DEFAULT, ITEMS_PER_PAGE_MAX, type Identity, type IndexingStatusRequest, type IndexingStatusResponse, type IndexingStatusResponseCode, IndexingStatusResponseCodes, type IndexingStatusResponseError, type IndexingStatusResponseOk, type InterpretedLabel, type InterpretedName, LINEANAMES_NODE, type Label, type LabelHash, type LabelSetId, type LabelSetVersion, type LiteralLabel, type LiteralName, LruCache, type MultichainPrimaryNameResolutionArgs, type MultichainPrimaryNameResolutionResult, type Name, type NamedIdentity, type NamedRegistrarAction, type Node, type NormalizedName, type OmnichainIndexingStatusId, OmnichainIndexingStatusIds, type OmnichainIndexingStatusSnapshot, type OmnichainIndexingStatusSnapshotBackfill, type OmnichainIndexingStatusSnapshotCompleted, type OmnichainIndexingStatusSnapshotFollowing, type OmnichainIndexingStatusSnapshotUnstarted, PROTOCOL_ATTRIBUTE_PREFIX, type PaginatedAggregatedReferrers, type PaginatedAggregatedReferrersRequest, type PaginatedAggregatedReferrersResponse, type PaginatedAggregatedReferrersResponseCode, PaginatedAggregatedReferrersResponseCodes, type PaginatedAggregatedReferrersResponseError, type PaginatedAggregatedReferrersResponseOk, type PaginationParams, PluginName, type Price, type PriceDai, type PriceEth, type PriceUsdc, type ProtocolSpan, type ProtocolSpanTreeNode, type ProtocolTrace, ROOT_NODE, type RealtimeIndexingStatusProjection, type RegistrarAction, type RegistrarActionEventId, type RegistrarActionPricing, type RegistrarActionPricingAvailable, type RegistrarActionPricingUnknown, type RegistrarActionReferral, type RegistrarActionReferralAvailable, type RegistrarActionReferralNotApplicable, type RegistrarActionType, RegistrarActionTypes, type RegistrarActionsFilter, type RegistrarActionsFilterBySubregistryNode, type RegistrarActionsFilterType, RegistrarActionsFilterTypes, type RegistrarActionsFilterWithEncodedReferral, type RegistrarActionsOrder, RegistrarActionsOrders, type RegistrarActionsRequest, type RegistrarActionsResponse, type RegistrarActionsResponseCode, RegistrarActionsResponseCodes, type RegistrarActionsResponseError, type RegistrarActionsResponseOk, type RegistrationLifecycle, type RegistrationLifecycleStage, type ResolutionStatusId, ResolutionStatusIds, type ResolvePrimaryNameRequest, type ResolvePrimaryNameResponse, type ResolvePrimaryNamesRequest, type ResolvePrimaryNamesResponse, type ResolveRecordsRequest, type ResolveRecordsResponse, type ResolvedIdentity, type ResolverRecordsResponse, type ResolverRecordsResponseBase, type ResolverRecordsSelection, type ReverseResolutionArgs, ReverseResolutionProtocolStep, type ReverseResolutionResult, type RpcUrl, type SerializedAccountId, type SerializedChainIndexingStatusSnapshot, type SerializedChainIndexingStatusSnapshotBackfill, type SerializedChainIndexingStatusSnapshotCompleted, type SerializedChainIndexingStatusSnapshotFollowing, type SerializedChainIndexingStatusSnapshotQueued, type SerializedCrossChainIndexingStatusSnapshot, type SerializedCrossChainIndexingStatusSnapshotOmnichain, type SerializedCurrencyAmount, type SerializedCurrentIndexingProjectionOmnichain, type SerializedENSApiPublicConfig, type SerializedENSIndexerPublicConfig, type SerializedENSIndexerVersionInfo, type SerializedIndexedChainIds, type SerializedIndexingStatusResponse, type SerializedIndexingStatusResponseError, type SerializedIndexingStatusResponseOk, type SerializedNamedRegistrarAction, type SerializedOmnichainIndexingStatusSnapshot, type SerializedOmnichainIndexingStatusSnapshotBackfill, type SerializedOmnichainIndexingStatusSnapshotCompleted, type SerializedOmnichainIndexingStatusSnapshotFollowing, type SerializedOmnichainIndexingStatusSnapshotUnstarted, type SerializedPaginatedAggregatedReferrersResponse, type SerializedPaginatedAggregatedReferrersResponseError, type SerializedPaginatedAggregatedReferrersResponseOk, type SerializedPrice, type SerializedPriceDai, type SerializedPriceEth, type SerializedPriceUsdc, type SerializedRealtimeIndexingStatusProjection, type SerializedRegistrarAction, type SerializedRegistrarActionPricing, type SerializedRegistrarActionPricingAvailable, type SerializedRegistrarActionPricingUnknown, type SerializedRegistrarActionsResponse, type SerializedRegistrarActionsResponseError, type SerializedRegistrarActionsResponseOk, type SerializedRegistrationLifecycle, type SerializedSubregistry, type SubgraphInterpretedLabel, type SubgraphInterpretedName, type Subregistry, type TheGraphCannotFallbackReason, TheGraphCannotFallbackReasonSchema, type TheGraphFallback, TheGraphFallbackSchema, TraceableENSProtocol, type TraceableRequest, type TraceableResponse, TtlCache, type UnixTimestamp, type UnknownIdentity, type UnnamedIdentity, type UnresolvedIdentity, type UrlString, accountIdEqual, addDuration, addPrices, addrReverseLabel, asLowerCaseAddress, beautifyName, bigIntToNumber, bigintToCoinType, buildEnsRainbowClientLabelSet, buildLabelSetId, buildLabelSetVersion, buildUnresolvedIdentity, checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill, checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted, checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing, checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted, coinTypeReverseLabel, coinTypeToEvmChainId, createIndexingConfig, createRealtimeIndexingStatusProjection, decodeDNSEncodedLiteralName, decodeDNSEncodedName, deserializeAccountId, deserializeBlockNumber, deserializeBlockRef, deserializeBlockrange, deserializeChainId, deserializeChainIndexingStatusSnapshot, deserializeCrossChainIndexingStatusSnapshot, deserializeDatetime, deserializeDuration, deserializeENSApiPublicConfig, deserializeENSIndexerPublicConfig, deserializeErrorResponse, deserializeIndexingStatusResponse, deserializeOmnichainIndexingStatusSnapshot, deserializePaginatedAggregatedReferrersResponse, deserializeRealtimeIndexingStatusProjection, deserializeRegistrarActionsResponse, deserializeUnixTimestamp, deserializeUrl, durationBetween, encodeLabelHash, evmChainIdToCoinType, getCurrencyInfo, getEthnamesSubregistryId, getNameHierarchy, getOmnichainIndexingCursor, getOmnichainIndexingStatus, getResolvePrimaryNameChainIdParam, getTimestampForHighestOmnichainKnownBlock, getTimestampForLowestOmnichainStartBlock, hasNullByte, interpretedLabelsToInterpretedName, isEncodedLabelHash, isHttpProtocol, isLabelHash, isNormalizedLabel, isNormalizedName, isPriceCurrencyEqual, isPriceEqual, isRegistrarActionPricingAvailable, isRegistrarActionReferralAvailable, isResolvedIdentity, isSelectionEmpty, isSubgraphCompatible, isWebSocketProtocol, labelHashToBytes, labelhashLiteralLabel, literalLabelToInterpretedLabel, literalLabelsToInterpretedName, literalLabelsToLiteralName, makeENSApiPublicConfigSchema, makeSubdomainNode, parseNonNegativeInteger, parseReverseName, priceDai, priceEth, priceUsdc, registrarActionsFilter, registrarActionsPrerequisites, reverseName, serializeAccountId, serializeChainId, serializeChainIndexingSnapshots, serializeCrossChainIndexingStatusSnapshotOmnichain, serializeDatetime, serializeENSApiPublicConfig, serializeENSIndexerPublicConfig, serializeIndexedChainIds, serializeIndexingStatusResponse, serializeNamedRegistrarAction, serializeOmnichainIndexingStatusSnapshot, serializePaginatedAggregatedReferrersResponse, serializePrice, serializePriceEth, serializeRealtimeIndexingStatusProjection, serializeRegistrarAction, serializeRegistrarActionPricing, serializeRegistrarActionsResponse, serializeRegistrationLifecycle, serializeSubregistry, serializeUrl, sortChainStatusesByStartBlockAsc, staleWhileRevalidate, stripNullBytes, translateDefaultableChainIdToChainId, uint256ToHex32, uniq, validateSupportedLabelSetAndVersion };