@ensnode/ensnode-sdk 0.36.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1605 -447
- package/dist/index.js +1804 -739
- package/dist/index.js.map +1 -1
- package/package.json +7 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { Hex, Address, ByteArray } from 'viem';
|
|
1
|
+
import { Hex, Address, ByteArray, Hash } from 'viem';
|
|
2
2
|
import { CoinType, EvmCoinType } from '@ensdomains/address-encoder';
|
|
3
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';
|
|
4
7
|
import { ENSNamespaceId } from '@ensnode/datasources';
|
|
5
8
|
export { ENSNamespaceId, ENSNamespaceIds, getENSRootChainId } from '@ensnode/datasources';
|
|
6
9
|
|
|
@@ -250,6 +253,66 @@ type DNSEncodedPartiallyInterpretedName = DNSEncodedName & {
|
|
|
250
253
|
__brand: "DNSEncodedPartiallyInterpretedName";
|
|
251
254
|
};
|
|
252
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
|
+
|
|
253
316
|
declare const ROOT_NODE: Node;
|
|
254
317
|
declare const ETH_NODE: Node;
|
|
255
318
|
declare const BASENAMES_NODE: Node;
|
|
@@ -257,86 +320,145 @@ declare const LINEANAMES_NODE: Node;
|
|
|
257
320
|
declare const ADDR_REVERSE_NODE: Node;
|
|
258
321
|
|
|
259
322
|
/**
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
*
|
|
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
|
|
263
334
|
*/
|
|
264
|
-
declare
|
|
335
|
+
declare function decodeDNSEncodedLiteralName(packet: DNSEncodedLiteralName): LiteralLabel[];
|
|
265
336
|
/**
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
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
|
|
270
348
|
*/
|
|
271
|
-
declare
|
|
349
|
+
declare function decodeDNSEncodedName(packet: DNSEncodedName): string[];
|
|
272
350
|
|
|
273
351
|
/**
|
|
274
|
-
*
|
|
352
|
+
* Formats a LabelHash as an Encoded LabelHash.
|
|
275
353
|
*
|
|
276
|
-
* @
|
|
277
|
-
*
|
|
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]`
|
|
278
358
|
*/
|
|
279
|
-
declare
|
|
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;
|
|
280
364
|
|
|
281
365
|
/**
|
|
282
|
-
*
|
|
366
|
+
* Checks if the input is a {@link LabelHash}.
|
|
367
|
+
*
|
|
368
|
+
* @see https://ensnode.io/docs/reference/terminology#label-processing-and-classification
|
|
283
369
|
*/
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
* Store a value in the cache with the given key.
|
|
287
|
-
*
|
|
288
|
-
* @param key Cache key
|
|
289
|
-
* @param value Value to store
|
|
290
|
-
*/
|
|
291
|
-
set(key: KeyType, value: ValueType): void;
|
|
292
|
-
/**
|
|
293
|
-
* Retrieve a value from the cache with the given key.
|
|
294
|
-
*
|
|
295
|
-
* @param key Cache key
|
|
296
|
-
* @returns The cached value if it exists, otherwise undefined
|
|
297
|
-
*/
|
|
298
|
-
get(key: KeyType): ValueType | undefined;
|
|
299
|
-
/**
|
|
300
|
-
* Clear the cache.
|
|
301
|
-
*/
|
|
302
|
-
clear(): void;
|
|
303
|
-
/**
|
|
304
|
-
* The current number of items in the cache. Always a non-negative integer.
|
|
305
|
-
*/
|
|
306
|
-
get size(): number;
|
|
307
|
-
/**
|
|
308
|
-
* The maximum number of items in the cache. Always a non-negative integer that is >= size().
|
|
309
|
-
*/
|
|
310
|
-
get capacity(): number;
|
|
311
|
-
}
|
|
370
|
+
declare function isLabelHash(maybeLabelHash: string): maybeLabelHash is LabelHash;
|
|
371
|
+
|
|
312
372
|
/**
|
|
313
|
-
*
|
|
373
|
+
* Constructs a name hierarchy from a given NormalizedName.
|
|
314
374
|
*
|
|
315
|
-
*
|
|
375
|
+
* @example
|
|
376
|
+
* ```
|
|
377
|
+
* getNameHierarchy("sub.example.eth") -> ["sub.example.eth", "example.eth", "eth"]
|
|
378
|
+
* ```
|
|
316
379
|
*
|
|
317
|
-
* @
|
|
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
|
|
318
382
|
*/
|
|
319
|
-
declare
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
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;
|
|
335
409
|
|
|
336
410
|
/**
|
|
337
|
-
*
|
|
411
|
+
* Parse the address and coinType out of an ENSIP-19 reverse name.
|
|
338
412
|
*/
|
|
339
|
-
declare
|
|
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;
|
|
340
462
|
|
|
341
463
|
/**
|
|
342
464
|
* Chain ID
|
|
@@ -457,32 +579,287 @@ type DeepPartial<T> = {
|
|
|
457
579
|
};
|
|
458
580
|
|
|
459
581
|
/**
|
|
460
|
-
*
|
|
461
|
-
|
|
462
|
-
|
|
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
|
+
|
|
463
586
|
/**
|
|
464
|
-
*
|
|
587
|
+
* Converts an EVM address to its lowercase representation.
|
|
465
588
|
*
|
|
466
|
-
* @
|
|
589
|
+
* @param address - EVM address to convert.
|
|
590
|
+
* @returns The lowercase representation of the EVM address.
|
|
467
591
|
*/
|
|
468
|
-
|
|
592
|
+
declare function asLowerCaseAddress(address: Address): Address;
|
|
593
|
+
|
|
469
594
|
/**
|
|
470
|
-
*
|
|
595
|
+
* Cache that maps from string -> ValueType.
|
|
471
596
|
*/
|
|
472
|
-
|
|
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>;
|
|
473
731
|
|
|
474
732
|
/**
|
|
475
|
-
*
|
|
733
|
+
* Filter out duplicates.
|
|
476
734
|
*/
|
|
477
|
-
declare
|
|
735
|
+
declare const uniq: <T>(arr: T[]) => T[];
|
|
736
|
+
|
|
478
737
|
/**
|
|
479
|
-
*
|
|
738
|
+
* Identifiers for supported currencies.
|
|
739
|
+
*
|
|
740
|
+
* TODO: Add support for WETH
|
|
480
741
|
*/
|
|
481
|
-
declare
|
|
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];
|
|
482
748
|
/**
|
|
483
|
-
*
|
|
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.
|
|
484
753
|
*/
|
|
485
|
-
|
|
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;
|
|
486
863
|
|
|
487
864
|
declare function deserializeChainId(maybeChainId: ChainIdString, valueLabel?: string): ChainId;
|
|
488
865
|
declare function deserializeDatetime(maybeDatetime: string, valueLabel?: string): Datetime;
|
|
@@ -494,27 +871,8 @@ declare function deserializeBlockrange(maybeBlockrange: Partial<Blockrange>, val
|
|
|
494
871
|
endBlock?: number | undefined;
|
|
495
872
|
};
|
|
496
873
|
declare function deserializeBlockRef(maybeBlockRef: Partial<BlockRef>, valueLabel?: string): BlockRef;
|
|
497
|
-
declare function deserializeDuration(maybeDuration:
|
|
498
|
-
|
|
499
|
-
/**
|
|
500
|
-
* Determines whether the Name is normalized.
|
|
501
|
-
*
|
|
502
|
-
* @param name - The Name to check for normalization
|
|
503
|
-
* @returns True if the name is normalized according to ENS normalization rules, false otherwise
|
|
504
|
-
*/
|
|
505
|
-
declare function isNormalizedName(name: Name): name is NormalizedName;
|
|
506
|
-
/**
|
|
507
|
-
* Determines whether the Label is normalized.
|
|
508
|
-
*
|
|
509
|
-
* @param label - The Label to check for normalization
|
|
510
|
-
* @returns True if the label is normalized according to ENS normalization rules, false otherwise
|
|
511
|
-
*/
|
|
512
|
-
declare function isNormalizedLabel(label: Label): boolean;
|
|
513
|
-
|
|
514
|
-
/**
|
|
515
|
-
* Determines where the provided AccountId values represent the same address on the same chain.
|
|
516
|
-
*/
|
|
517
|
-
declare const accountIdEqual: (a: AccountId, b: AccountId) => boolean;
|
|
874
|
+
declare function deserializeDuration(maybeDuration: unknown, valueLabel?: string): Duration;
|
|
875
|
+
declare function deserializeAccountId(maybeAccountId: unknown, valueLabel?: string): AccountId;
|
|
518
876
|
|
|
519
877
|
/**
|
|
520
878
|
* Interprets a Literal Label, producing an Interpreted Label.
|
|
@@ -569,169 +927,48 @@ declare function literalLabelsToLiteralName(labels: LiteralLabel[]): LiteralName
|
|
|
569
927
|
*/
|
|
570
928
|
declare const labelhashLiteralLabel: (label: LiteralLabel) => LabelHash;
|
|
571
929
|
|
|
572
|
-
declare
|
|
573
|
-
declare
|
|
930
|
+
declare const hasNullByte: (value: string) => boolean;
|
|
931
|
+
declare const stripNullBytes: (value: string) => string;
|
|
574
932
|
|
|
575
933
|
/**
|
|
576
|
-
*
|
|
577
|
-
*
|
|
578
|
-
* @see https://docs.ens.domains/ensip/9
|
|
579
|
-
*/
|
|
580
|
-
declare const ETH_COIN_TYPE: CoinType;
|
|
581
|
-
/**
|
|
582
|
-
* The 'default' chainId corresponding to the below {@link DEFAULT_EVM_COIN_TYPE} in the context of
|
|
583
|
-
* ENSIP-19.
|
|
584
|
-
*
|
|
585
|
-
* @see https://docs.ens.domains/ensip/19
|
|
586
|
-
*/
|
|
587
|
-
declare const DEFAULT_EVM_CHAIN_ID = 0;
|
|
588
|
-
/**
|
|
589
|
-
* ENSIP-19 EVM CoinType representing the 'default' coinType for EVM chains in ENS.
|
|
934
|
+
* Converts a bigint value into a number value.
|
|
590
935
|
*
|
|
591
|
-
* @
|
|
936
|
+
* @throws when value is outside the range of `Number.MIN_SAFE_INTEGER` and
|
|
937
|
+
* `Number.MAX_SAFE_INTEGER`.
|
|
592
938
|
*/
|
|
593
|
-
declare
|
|
594
|
-
/**
|
|
595
|
-
* Converts a CoinType to an EVM Chain Id.
|
|
596
|
-
*
|
|
597
|
-
* NOTE: for whatever reason @ensdomains/address-encoder#coinTypeToEvmChainId doesn't handle the
|
|
598
|
-
* mainnet case so we implement that here
|
|
599
|
-
*
|
|
600
|
-
* @see https://docs.ens.domains/ensip/11/
|
|
601
|
-
*/
|
|
602
|
-
declare const coinTypeToEvmChainId: (coinType: CoinType) => ChainId;
|
|
603
|
-
/**
|
|
604
|
-
* Converts an EVM Chain Id to a CoinType.
|
|
605
|
-
*
|
|
606
|
-
* NOTE: for whatever reason @ensdomains/address-encoder#evmChainIdToCoinType doesn't handle the
|
|
607
|
-
* mainnet case so we implement that here
|
|
608
|
-
*/
|
|
609
|
-
declare const evmChainIdToCoinType: (chainId: ChainId) => CoinType;
|
|
610
|
-
/**
|
|
611
|
-
* Converts a bigint value representing a CoinType into a valid CoinType.
|
|
612
|
-
*
|
|
613
|
-
* This is useful when onchain events emit coinTypes as bigint but we want to constrain them to
|
|
614
|
-
* the CoinType type.
|
|
615
|
-
*
|
|
616
|
-
* @throws if `value` is too large to fit in Number.MAX_SAFE_INTEGER
|
|
617
|
-
*/
|
|
618
|
-
declare const bigintToCoinType: (value: bigint) => CoinType;
|
|
939
|
+
declare function bigIntToNumber(n: bigint): number;
|
|
619
940
|
|
|
620
941
|
/**
|
|
621
|
-
*
|
|
622
|
-
*
|
|
623
|
-
* @example
|
|
624
|
-
* ```
|
|
625
|
-
* getNameHierarchy("sub.example.eth") -> ["sub.example.eth", "example.eth", "eth"]
|
|
626
|
-
* ```
|
|
627
|
-
*
|
|
628
|
-
* @dev by restricting the input type to NormalizedName we guarantee that we can split and join
|
|
629
|
-
* on '.' and receive NormalizedNames as a result
|
|
630
|
-
*/
|
|
631
|
-
declare const getNameHierarchy: (name: NormalizedName) => NormalizedName[];
|
|
632
|
-
/**
|
|
633
|
-
* Beautifies a name by converting each normalized label in the provided name to
|
|
634
|
-
* its "beautified" form. Labels that are not normalized retain their original value.
|
|
635
|
-
*
|
|
636
|
-
* Invariants:
|
|
637
|
-
* - The number of labels in the returned name is the same as the number of labels in the input name.
|
|
638
|
-
* - The order of the labels in the returned name is the same as the order of the labels in the input name.
|
|
639
|
-
* - If a label in the input is normalized, it is returned in its "beautified" form.
|
|
640
|
-
* - If a label in the input name is not normalized, it is returned without modification.
|
|
641
|
-
* - Therefore, the result of ens_normalize(beautifyName(name)) is the same as the result of ens_normalize(name).
|
|
642
|
-
*
|
|
643
|
-
* The "beautified form" of a normalized label converts special sequences of
|
|
644
|
-
* emojis and other special characters to their "beautified" equivalents. All
|
|
645
|
-
* such conversions transform X -> Y where Y is normalizable and normalizes back to X.
|
|
646
|
-
* Ex: '1⃣2⃣' (normalized) to '1️⃣2️⃣' (normalizable but not normalized).
|
|
647
|
-
* Ex: 'ξethereum' (normalized) to 'Ξethereum' (normalizable, but not normalized).
|
|
648
|
-
* Ex: 'abc' (normalized) to 'abc' (also normalized, no conversion).
|
|
649
|
-
* Ex: 'ABC' (normalizable but not normalized) to 'ABC' (no conversion).
|
|
650
|
-
* Ex: 'invalid|label' (not normalizable) to 'invalid|label' (no conversion).
|
|
651
|
-
* Ex: '' (unnormalized as a label) to '' (no conversion).
|
|
652
|
-
*
|
|
653
|
-
* @param name - The name to beautify.
|
|
654
|
-
* @returns The beautified name.
|
|
655
|
-
*/
|
|
656
|
-
declare const beautifyName: (name: Name) => Name;
|
|
657
|
-
|
|
658
|
-
/**
|
|
659
|
-
* Gets the Label used for the reverse names of subnames as per ENSIP-11 & ENSIP-19.
|
|
660
|
-
*
|
|
661
|
-
* @see https://docs.ens.domains/ensip/19/#reverse-resolution
|
|
662
|
-
*/
|
|
663
|
-
declare const addrReverseLabel: (address: Address) => LiteralLabel;
|
|
664
|
-
/**
|
|
665
|
-
* Converts `coinType` to prefix-free hex string.
|
|
666
|
-
*
|
|
667
|
-
* @see https://docs.ens.domains/ensip/19
|
|
942
|
+
* Serializes a {@link ChainId} value into its string representation.
|
|
668
943
|
*/
|
|
669
|
-
declare
|
|
944
|
+
declare function serializeChainId(chainId: ChainId): ChainIdString;
|
|
670
945
|
/**
|
|
671
|
-
*
|
|
672
|
-
*
|
|
673
|
-
* @see https://docs.ens.domains/ensip/11#specification
|
|
674
|
-
* @see https://docs.ens.domains/ensip/19#specification
|
|
675
|
-
*
|
|
676
|
-
* @param address - The address to get the reverse name for
|
|
677
|
-
* @param coinType - The coin type to use for the reverse name
|
|
678
|
-
* @returns The reverse name for the address
|
|
679
|
-
*
|
|
680
|
-
* @example
|
|
681
|
-
* ```ts
|
|
682
|
-
* reverseName("0x1234", BigInt(ETH_COIN_TYPE)) // "1234.addr.reverse"
|
|
683
|
-
* reverseName("0x1234", BigInt(0x80000000)) // "1234.default.reverse"
|
|
684
|
-
* reverseName("0x1234", BigInt(0x5678)) // "1234.5678.reverse"
|
|
685
|
-
* ```
|
|
946
|
+
* Serializes a {@link Datetime} value into its string representation.
|
|
686
947
|
*/
|
|
687
|
-
declare function
|
|
688
|
-
|
|
948
|
+
declare function serializeDatetime(datetime: Datetime): DatetimeISO8601;
|
|
689
949
|
/**
|
|
690
|
-
*
|
|
950
|
+
* Serializes a {@link URL} value into its string representation.
|
|
691
951
|
*/
|
|
692
|
-
declare function
|
|
693
|
-
address: Address;
|
|
694
|
-
coinType: CoinType;
|
|
695
|
-
} | null;
|
|
696
|
-
|
|
952
|
+
declare function serializeUrl(url: URL): UrlString;
|
|
697
953
|
/**
|
|
698
|
-
*
|
|
699
|
-
*
|
|
700
|
-
* @see https://ensnode.io/docs/reference/terminology#encoded-labelhash
|
|
701
|
-
*
|
|
702
|
-
* @param labelHash - A 32-byte lowercase hash string starting with '0x'
|
|
703
|
-
* @returns The encoded label hash in format `[hash_without_0x_prefix]`
|
|
954
|
+
* Serializes a {@link Price} object.
|
|
704
955
|
*/
|
|
705
|
-
declare
|
|
706
|
-
|
|
956
|
+
declare function serializePrice(price: Price): SerializedPrice;
|
|
707
957
|
/**
|
|
708
|
-
*
|
|
709
|
-
*
|
|
710
|
-
* For discussion on DNS-Encoding, see the {@link DNSEncodedName} and {@link DNSEncodedLiteralName} types.
|
|
711
|
-
*
|
|
712
|
-
* Due to the constraints of DNS-Encoding, there is an additional guarantee that each Literal Label
|
|
713
|
-
* in the resulting list is guaranteed to have a maximum byte length of 255.
|
|
714
|
-
*
|
|
715
|
-
* @param packet a hex string that encodes a DNSEncodedLiteralName
|
|
716
|
-
* @returns A list of the LiteralLabels contained in packet
|
|
717
|
-
* @throws If the packet is malformed
|
|
718
|
-
* @dev This is just `decodeDNSEncodedName` with semantic input/output
|
|
958
|
+
* Serializes a {@link PriceEth} object.
|
|
719
959
|
*/
|
|
720
|
-
declare function
|
|
960
|
+
declare function serializePriceEth(price: PriceEth): SerializedPriceEth;
|
|
721
961
|
/**
|
|
722
|
-
*
|
|
723
|
-
*
|
|
724
|
-
* For discussion on DNS-Encoding, see the {@link DNSEncodedName} type.
|
|
962
|
+
* Serializes {@link AccountId} object.
|
|
725
963
|
*
|
|
726
|
-
*
|
|
727
|
-
* in the resulting list is guaranteed to have a maximum byte length of 255.
|
|
964
|
+
* Formatted as a fully lowercase CAIP-10 AccountId.
|
|
728
965
|
*
|
|
729
|
-
* @
|
|
730
|
-
* @returns A UTF-8 string array of the segments contained in packet
|
|
731
|
-
* @throws If the packet is malformed
|
|
732
|
-
* @dev This is the generic implementation of DNS-Encoded Name Decoding
|
|
966
|
+
* @see https://chainagnostic.org/CAIPs/caip-10
|
|
733
967
|
*/
|
|
734
|
-
declare function
|
|
968
|
+
declare function serializeAccountId(accountId: AccountId): SerializedAccountId;
|
|
969
|
+
|
|
970
|
+
declare function isHttpProtocol(url: URL): boolean;
|
|
971
|
+
declare function isWebSocketProtocol(url: URL): boolean;
|
|
735
972
|
|
|
736
973
|
/**
|
|
737
974
|
* A label set ID identifies a set of labels that can be used for deterministic healing.
|
|
@@ -794,7 +1031,7 @@ declare enum PluginName {
|
|
|
794
1031
|
Lineanames = "lineanames",
|
|
795
1032
|
ThreeDNS = "threedns",
|
|
796
1033
|
ProtocolAcceleration = "protocol-acceleration",
|
|
797
|
-
|
|
1034
|
+
Registrars = "registrars",
|
|
798
1035
|
TokenScope = "tokenscope"
|
|
799
1036
|
}
|
|
800
1037
|
/**
|
|
@@ -959,13 +1196,12 @@ declare function deserializeENSIndexerPublicConfig(maybeConfig: SerializedENSInd
|
|
|
959
1196
|
declare function isSubgraphCompatible(config: Pick<ENSIndexerPublicConfig, "namespace" | "plugins" | "labelSet">): boolean;
|
|
960
1197
|
|
|
961
1198
|
/**
|
|
962
|
-
*
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
* Serialize a {@link ENSIndexerPublicConfig} object.
|
|
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
|
|
967
1203
|
*/
|
|
968
|
-
declare function
|
|
1204
|
+
declare function labelHashToBytes(labelHash: LabelHash): ByteArray;
|
|
969
1205
|
|
|
970
1206
|
/**
|
|
971
1207
|
* Builds a valid LabelSetId from a string.
|
|
@@ -997,14 +1233,6 @@ declare function buildEnsRainbowClientLabelSet(labelSetId?: LabelSetId, labelSet
|
|
|
997
1233
|
*/
|
|
998
1234
|
declare function validateSupportedLabelSetAndVersion(serverSet: EnsRainbowServerLabelSet, clientSet: EnsRainbowClientLabelSet): void;
|
|
999
1235
|
|
|
1000
|
-
/**
|
|
1001
|
-
* Converts a Labelhash to bytes, with validation
|
|
1002
|
-
* @param labelHash The Labelhash to convert
|
|
1003
|
-
* @returns A ByteArray containing the bytes
|
|
1004
|
-
* @throws Error if `labelHash` is not a valid 32-byte hex string
|
|
1005
|
-
*/
|
|
1006
|
-
declare function labelHashToBytes(labelHash: LabelHash): ByteArray;
|
|
1007
|
-
|
|
1008
1236
|
/**
|
|
1009
1237
|
* Parses a string into a non-negative integer.
|
|
1010
1238
|
* @param input The string to parse
|
|
@@ -1013,6 +1241,15 @@ declare function labelHashToBytes(labelHash: LabelHash): ByteArray;
|
|
|
1013
1241
|
*/
|
|
1014
1242
|
declare function parseNonNegativeInteger(maybeNumber: string): number;
|
|
1015
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
|
+
|
|
1016
1253
|
/**
|
|
1017
1254
|
* The type of indexing configuration for a chain.
|
|
1018
1255
|
*/
|
|
@@ -1046,10 +1283,6 @@ interface ChainIndexingConfigIndefinite {
|
|
|
1046
1283
|
* A {@link BlockRef} to the block where indexing of the chain should start.
|
|
1047
1284
|
*/
|
|
1048
1285
|
startBlock: BlockRef;
|
|
1049
|
-
/**
|
|
1050
|
-
* A {@link BlockRef} to the block where indexing of the chain should end.
|
|
1051
|
-
*/
|
|
1052
|
-
endBlock?: null;
|
|
1053
1286
|
}
|
|
1054
1287
|
/**
|
|
1055
1288
|
* Chain indexing config for a chain whose indexing config `configType` is
|
|
@@ -1732,176 +1965,515 @@ declare function serializeChainIndexingSnapshots<ChainIndexingStatusSnapshotType
|
|
|
1732
1965
|
declare function serializeOmnichainIndexingStatusSnapshot(indexingStatus: OmnichainIndexingStatusSnapshot): SerializedOmnichainIndexingStatusSnapshot;
|
|
1733
1966
|
|
|
1734
1967
|
/**
|
|
1735
|
-
*
|
|
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.
|
|
1736
1974
|
*/
|
|
1737
|
-
declare
|
|
1738
|
-
|
|
1739
|
-
|
|
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;
|
|
1740
1998
|
}
|
|
1741
1999
|
/**
|
|
1742
|
-
*
|
|
2000
|
+
* Serialized representation of {@link Subregistry}.
|
|
1743
2001
|
*/
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
FindResolver = "find-resolver",
|
|
1747
|
-
ActiveResolverExists = "active-resolver-exists",
|
|
1748
|
-
AccelerateENSIP19ReverseResolver = "accelerate-ensip-19-reverse-resolver",
|
|
1749
|
-
AccelerateKnownOffchainLookupResolver = "accelerate-known-offchain-lookup-resolver",
|
|
1750
|
-
AccelerateKnownOnchainStaticResolver = "accelerate-known-onchain-static-resolver",
|
|
1751
|
-
RequireResolver = "require-resolver",
|
|
1752
|
-
ExecuteResolveCalls = "execute-resolve-calls"
|
|
2002
|
+
interface SerializedSubregistry extends Omit<Subregistry, "subregistryId"> {
|
|
2003
|
+
subregistryId: SerializedAccountId;
|
|
1753
2004
|
}
|
|
2005
|
+
declare function serializeSubregistry(subregistry: Subregistry): SerializedSubregistry;
|
|
2006
|
+
|
|
1754
2007
|
/**
|
|
1755
|
-
*
|
|
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.
|
|
1756
2012
|
*/
|
|
1757
|
-
declare
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
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;
|
|
1763
2066
|
}
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
[key: string]: unknown;
|
|
2067
|
+
/**
|
|
2068
|
+
* Serialized representation of {@link RegistrationLifecycle}.
|
|
2069
|
+
*/
|
|
2070
|
+
interface SerializedRegistrationLifecycle extends Omit<RegistrationLifecycle, "subregistry"> {
|
|
2071
|
+
subregistry: SerializedSubregistry;
|
|
1770
2072
|
}
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
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;
|
|
1775
2119
|
}
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
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;
|
|
1793
2146
|
}
|
|
1794
|
-
type
|
|
1795
|
-
|
|
1796
|
-
};
|
|
1797
|
-
type ProtocolTrace = ProtocolSpanTreeNode[];
|
|
1798
|
-
|
|
2147
|
+
type RegistrarActionPricing = RegistrarActionPricingAvailable | RegistrarActionPricingUnknown;
|
|
2148
|
+
declare function isRegistrarActionPricingAvailable(registrarActionPricing: RegistrarActionPricing): registrarActionPricing is RegistrarActionPricingAvailable;
|
|
1799
2149
|
/**
|
|
1800
|
-
*
|
|
2150
|
+
* * Referral information for performing a "logical registrar action".
|
|
1801
2151
|
*/
|
|
1802
|
-
interface
|
|
2152
|
+
interface RegistrarActionReferralAvailable {
|
|
1803
2153
|
/**
|
|
1804
|
-
*
|
|
1805
|
-
* Reverse Resolution.
|
|
2154
|
+
* Encoded Referrer
|
|
1806
2155
|
*
|
|
1807
|
-
*
|
|
2156
|
+
* Represents the "raw" 32-byte "referrer" value emitted onchain in
|
|
2157
|
+
* association with the registrar action.
|
|
1808
2158
|
*/
|
|
1809
|
-
|
|
2159
|
+
encodedReferrer: EncodedReferrer;
|
|
1810
2160
|
/**
|
|
1811
|
-
*
|
|
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.
|
|
1812
2172
|
*/
|
|
1813
|
-
|
|
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 {
|
|
1814
2180
|
/**
|
|
1815
|
-
*
|
|
2181
|
+
* Encoded Referrer
|
|
2182
|
+
*
|
|
2183
|
+
* Represents the "raw" 32-byte "referrer" value emitted onchain in
|
|
2184
|
+
* association with the registrar action.
|
|
1816
2185
|
*/
|
|
1817
|
-
|
|
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;
|
|
1818
2195
|
}
|
|
1819
|
-
|
|
1820
|
-
|
|
2196
|
+
type RegistrarActionReferral = RegistrarActionReferralAvailable | RegistrarActionReferralNotApplicable;
|
|
2197
|
+
declare function isRegistrarActionReferralAvailable(registrarActionReferral: RegistrarActionReferral): registrarActionReferral is RegistrarActionReferralAvailable;
|
|
1821
2198
|
/**
|
|
1822
|
-
*
|
|
1823
|
-
*
|
|
1824
|
-
*
|
|
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.
|
|
1825
2203
|
*/
|
|
1826
|
-
|
|
2204
|
+
interface RegistrarAction {
|
|
1827
2205
|
/**
|
|
1828
|
-
*
|
|
1829
|
-
*
|
|
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.
|
|
1830
2217
|
*/
|
|
1831
|
-
|
|
2218
|
+
id: RegistrarActionEventId;
|
|
2219
|
+
/**
|
|
2220
|
+
* The type of the "logical registrar action".
|
|
2221
|
+
*/
|
|
2222
|
+
type: RegistrarActionType;
|
|
1832
2223
|
/**
|
|
1833
|
-
* Address records, keyed by CoinType.
|
|
1834
|
-
* Value is null if no record for the specified CoinType is set.
|
|
1835
2224
|
*
|
|
1836
|
-
*
|
|
1837
|
-
*
|
|
1838
|
-
*
|
|
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.
|
|
1839
2268
|
*/
|
|
1840
|
-
|
|
2269
|
+
incrementalDuration: Duration;
|
|
1841
2270
|
/**
|
|
1842
|
-
*
|
|
1843
|
-
*
|
|
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".
|
|
1844
2318
|
*/
|
|
1845
|
-
|
|
1846
|
-
|
|
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
|
+
}
|
|
1847
2348
|
/**
|
|
1848
|
-
*
|
|
1849
|
-
*
|
|
1850
|
-
* @example
|
|
1851
|
-
* ```typescript
|
|
1852
|
-
* const selection = {
|
|
1853
|
-
* name: true,
|
|
1854
|
-
* addresses: [60],
|
|
1855
|
-
* texts: ["com.twitter", "avatar"],
|
|
1856
|
-
* } as const satisfies ResolverRecordsSelection;
|
|
1857
|
-
*
|
|
1858
|
-
* type Response = ResolverRecordsResponse<typeof selection>;
|
|
1859
|
-
*
|
|
1860
|
-
* // results in the following type
|
|
1861
|
-
* type Response = {
|
|
1862
|
-
* readonly name: Name | null;
|
|
1863
|
-
* readonly addresses: Record<"60", string | null>;
|
|
1864
|
-
* readonly texts: Record<"avatar" | "com.twitter", string | null>;
|
|
1865
|
-
* }
|
|
1866
|
-
* ```
|
|
2349
|
+
* Serialized representation of {@link RegistrarActionPricingUnknown}.
|
|
1867
2350
|
*/
|
|
1868
|
-
type
|
|
1869
|
-
[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];
|
|
1870
|
-
};
|
|
1871
|
-
|
|
2351
|
+
type SerializedRegistrarActionPricingUnknown = RegistrarActionPricingUnknown;
|
|
1872
2352
|
/**
|
|
1873
|
-
*
|
|
2353
|
+
* Serialized representation of {@link RegistrarActionPricingAvailable}.
|
|
1874
2354
|
*/
|
|
1875
|
-
interface
|
|
1876
|
-
|
|
1877
|
-
|
|
2355
|
+
interface SerializedRegistrarActionPricingAvailable {
|
|
2356
|
+
baseCost: SerializedPriceEth;
|
|
2357
|
+
premium: SerializedPriceEth;
|
|
2358
|
+
total: SerializedPriceEth;
|
|
1878
2359
|
}
|
|
1879
2360
|
/**
|
|
1880
|
-
*
|
|
2361
|
+
* Serialized representation of {@link RegistrarActionPricing}.
|
|
1881
2362
|
*/
|
|
1882
|
-
type
|
|
2363
|
+
type SerializedRegistrarActionPricing = SerializedRegistrarActionPricingAvailable | SerializedRegistrarActionPricingUnknown;
|
|
1883
2364
|
/**
|
|
1884
|
-
*
|
|
2365
|
+
* Serialized representation of {@link RegistrarAction}.
|
|
1885
2366
|
*/
|
|
1886
|
-
interface
|
|
1887
|
-
|
|
1888
|
-
|
|
2367
|
+
interface SerializedRegistrarAction extends Omit<RegistrarAction, "registrationLifecycle" | "pricing"> {
|
|
2368
|
+
registrationLifecycle: SerializedRegistrationLifecycle;
|
|
2369
|
+
pricing: SerializedRegistrarActionPricing;
|
|
1889
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>;
|
|
1890
2431
|
/**
|
|
1891
|
-
*
|
|
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.
|
|
1892
2436
|
*/
|
|
1893
|
-
|
|
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
|
+
|
|
1894
2457
|
/**
|
|
1895
|
-
*
|
|
2458
|
+
* Serialized representation of {@link ENSApiPublicConfig}
|
|
1896
2459
|
*/
|
|
1897
|
-
interface
|
|
1898
|
-
|
|
1899
|
-
|
|
2460
|
+
interface SerializedENSApiPublicConfig extends Omit<ENSApiPublicConfig, "ensIndexerPublicConfig"> {
|
|
2461
|
+
/**
|
|
2462
|
+
* Serialized representation of {@link ENSApiPublicConfig.ensIndexerPublicConfig}.
|
|
2463
|
+
*/
|
|
2464
|
+
ensIndexerPublicConfig: SerializedENSIndexerPublicConfig;
|
|
1900
2465
|
}
|
|
2466
|
+
|
|
1901
2467
|
/**
|
|
1902
|
-
*
|
|
2468
|
+
* Deserialize a {@link ENSApiPublicConfig} object.
|
|
1903
2469
|
*/
|
|
1904
|
-
|
|
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
|
+
|
|
1905
2477
|
/**
|
|
1906
2478
|
* The resolution status for an `Identity`.
|
|
1907
2479
|
*/
|
|
@@ -2027,25 +2599,21 @@ type ResolvedIdentity = NamedIdentity | UnnamedIdentity | UnknownIdentity;
|
|
|
2027
2599
|
*/
|
|
2028
2600
|
type Identity = UnresolvedIdentity | ResolvedIdentity;
|
|
2029
2601
|
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
readonly addresses: CoinType[];
|
|
2046
|
-
readonly texts: ["url", "avatar", "header", "description", "email", "com.twitter", "com.farcaster", "com.github"];
|
|
2047
|
-
};
|
|
2048
|
-
};
|
|
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;
|
|
2049
2617
|
|
|
2050
2618
|
/**
|
|
2051
2619
|
* Gets the "chainId param" that should be used for a primary name resolution
|
|
@@ -2077,29 +2645,187 @@ declare const getResolvePrimaryNameChainIdParam: (chainId: DefaultableChainId, n
|
|
|
2077
2645
|
*/
|
|
2078
2646
|
declare const translateDefaultableChainIdToChainId: (chainId: DefaultableChainId, namespaceId: ENSNamespaceId) => ChainId;
|
|
2079
2647
|
|
|
2080
|
-
/**
|
|
2081
|
-
*
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
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>;
|
|
2095
2824
|
|
|
2096
2825
|
/**
|
|
2097
2826
|
* API Error Response Type
|
|
2098
2827
|
*/
|
|
2099
|
-
|
|
2100
|
-
message: string;
|
|
2101
|
-
details?: unknown;
|
|
2102
|
-
}
|
|
2828
|
+
type ErrorResponse = z$1.infer<typeof ErrorResponseSchema>;
|
|
2103
2829
|
interface TraceableRequest {
|
|
2104
2830
|
trace?: boolean;
|
|
2105
2831
|
}
|
|
@@ -2110,6 +2836,7 @@ interface AcceleratableRequest {
|
|
|
2110
2836
|
accelerate?: boolean;
|
|
2111
2837
|
}
|
|
2112
2838
|
interface AcceleratableResponse {
|
|
2839
|
+
accelerationRequested: boolean;
|
|
2113
2840
|
accelerationAttempted: boolean;
|
|
2114
2841
|
}
|
|
2115
2842
|
/**
|
|
@@ -2142,7 +2869,7 @@ interface ResolvePrimaryNamesResponse extends AcceleratableResponse, TraceableRe
|
|
|
2142
2869
|
/**
|
|
2143
2870
|
* ENSIndexer Public Config Response
|
|
2144
2871
|
*/
|
|
2145
|
-
type ConfigResponse =
|
|
2872
|
+
type ConfigResponse = ENSApiPublicConfig;
|
|
2146
2873
|
/**
|
|
2147
2874
|
* Represents a request to Indexing Status API.
|
|
2148
2875
|
*/
|
|
@@ -2184,11 +2911,373 @@ type IndexingStatusResponseError = {
|
|
|
2184
2911
|
* at runtime.
|
|
2185
2912
|
*/
|
|
2186
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;
|
|
2187
3270
|
|
|
2188
3271
|
/**
|
|
2189
|
-
*
|
|
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.
|
|
2190
3278
|
*/
|
|
2191
|
-
declare
|
|
3279
|
+
declare function serializePaginatedAggregatedReferrersResponse(response: PaginatedAggregatedReferrersResponse): SerializedPaginatedAggregatedReferrersResponse;
|
|
3280
|
+
|
|
2192
3281
|
/**
|
|
2193
3282
|
* Configuration options for ENSNode API client
|
|
2194
3283
|
*/
|
|
@@ -2201,6 +3290,7 @@ interface ClientOptions {
|
|
|
2201
3290
|
*
|
|
2202
3291
|
* Provides access to the following ENSNode APIs:
|
|
2203
3292
|
* - Resolution API
|
|
3293
|
+
* - ENSAnalytics API
|
|
2204
3294
|
* - 🚧 Configuration API
|
|
2205
3295
|
* - 🚧 Indexing Status API
|
|
2206
3296
|
*
|
|
@@ -2367,32 +3457,100 @@ declare class ENSNodeClient {
|
|
|
2367
3457
|
* @throws if the ENSNode response breaks required invariants
|
|
2368
3458
|
*/
|
|
2369
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>;
|
|
2370
3548
|
}
|
|
2371
3549
|
|
|
2372
|
-
/**
|
|
2373
|
-
* Serialized representation of {@link IndexingStatusResponseError}.
|
|
2374
|
-
*/
|
|
2375
|
-
type SerializedIndexingStatusResponseError = IndexingStatusResponseError;
|
|
2376
|
-
/**
|
|
2377
|
-
* Serialized representation of {@link IndexingStatusResponseOk}.
|
|
2378
|
-
*/
|
|
2379
|
-
interface SerializedIndexingStatusResponseOk extends Omit<IndexingStatusResponseOk, "realtimeProjection"> {
|
|
2380
|
-
realtimeProjection: SerializedRealtimeIndexingStatusProjection;
|
|
2381
|
-
}
|
|
2382
|
-
/**
|
|
2383
|
-
* Serialized representation of {@link IndexingStatusResponse}.
|
|
2384
|
-
*/
|
|
2385
|
-
type SerializedIndexingStatusResponse = SerializedIndexingStatusResponseOk | SerializedIndexingStatusResponseError;
|
|
2386
|
-
|
|
2387
|
-
declare function deserializeErrorResponse(maybeErrorResponse: unknown): ErrorResponse;
|
|
2388
|
-
declare function deserializeIndexingStatusResponse(maybeResponse: SerializedIndexingStatusResponse): IndexingStatusResponse;
|
|
2389
|
-
|
|
2390
|
-
declare function serializeIndexingStatusResponse(response: IndexingStatusResponse): SerializedIndexingStatusResponse;
|
|
2391
|
-
|
|
2392
3550
|
declare class ClientError extends Error {
|
|
2393
3551
|
details?: unknown;
|
|
2394
3552
|
constructor(message: string, details?: unknown);
|
|
2395
3553
|
static fromErrorResponse({ message, details }: ErrorResponse): ClientError;
|
|
2396
3554
|
}
|
|
2397
3555
|
|
|
2398
|
-
export { ADDR_REVERSE_NODE, ATTR_PROTOCOL_NAME, ATTR_PROTOCOL_STEP, ATTR_PROTOCOL_STEP_RESULT, type AcceleratableRequest, type AcceleratableResponse, type AccountId, 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,
|
|
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 };
|