@ensnode/ensnode-sdk 0.32.0 → 0.34.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/README.md +3 -3
- package/dist/index.d.ts +387 -45
- package/dist/index.js +370 -66
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -54,7 +54,7 @@ Resolves records for an ENS name (Forward Resolution), via ENSNode, which implem
|
|
|
54
54
|
- `texts`: Array of text record keys to resolve
|
|
55
55
|
- `options`: (optional) additional options
|
|
56
56
|
- `trace`: (optional) Whether to include a trace in the response (default: false)
|
|
57
|
-
- `accelerate`: (optional) Whether to attempt Protocol Acceleration (default:
|
|
57
|
+
- `accelerate`: (optional) Whether to attempt Protocol Acceleration (default: false)
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
```ts
|
|
@@ -89,7 +89,7 @@ Resolves the primary name of the provided `address` on the specified `chainId`,
|
|
|
89
89
|
- `chainId`: The chain id within which to query the address' ENSIP-19 Multichain Primary Name
|
|
90
90
|
- `options`: (optional) additional options
|
|
91
91
|
- `trace`: (optional) Whether to include a trace in the response (default: false)
|
|
92
|
-
- `accelerate`: (optional) Whether to attempt Protocol Acceleration (default:
|
|
92
|
+
- `accelerate`: (optional) Whether to attempt Protocol Acceleration (default: false)
|
|
93
93
|
|
|
94
94
|
```ts
|
|
95
95
|
import { mainnet, base } from 'viem/chains';
|
|
@@ -116,7 +116,7 @@ Resolves the primary names of the provided `address` on the specified chainIds,
|
|
|
116
116
|
- `options`: (optional) additional options
|
|
117
117
|
- `chainIds`: The chain ids within which to query the address' ENSIP-19 Multichain Primary Name (default: all ENSIP-19 supported chains)
|
|
118
118
|
- `trace`: (optional) Whether to include a trace in the response (default: false)
|
|
119
|
-
- `accelerate`: (optional) Whether to attempt Protocol Acceleration (default:
|
|
119
|
+
- `accelerate`: (optional) Whether to attempt Protocol Acceleration (default: false)
|
|
120
120
|
|
|
121
121
|
```ts
|
|
122
122
|
import { mainnet, base } from 'viem/chains';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { Hex, Address } from 'viem';
|
|
1
|
+
import { Hex, Address, ByteArray } from 'viem';
|
|
2
|
+
import * as _ensdomains_address_encoder from '@ensdomains/address-encoder';
|
|
2
3
|
import { CoinType, EvmCoinType } from '@ensdomains/address-encoder';
|
|
3
4
|
export { CoinType, EvmCoinType } from '@ensdomains/address-encoder';
|
|
4
5
|
import { ENSNamespaceId } from '@ensnode/datasources';
|
|
5
6
|
export { ENSNamespaceId, ENSNamespaceIds } from '@ensnode/datasources';
|
|
7
|
+
import z from 'zod/v4';
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* A hash value that uniquely identifies a single ENS name.
|
|
@@ -43,6 +45,9 @@ type Label = string;
|
|
|
43
45
|
type EncodedLabelHash = `[${string}]`;
|
|
44
46
|
|
|
45
47
|
declare const ROOT_NODE: Node;
|
|
48
|
+
declare const ETH_NODE: `0x${string}`;
|
|
49
|
+
declare const BASENAMES_NODE: `0x${string}`;
|
|
50
|
+
declare const LINEANAMES_NODE: `0x${string}`;
|
|
46
51
|
/**
|
|
47
52
|
* A set of nodes whose children are used for reverse resolution.
|
|
48
53
|
*
|
|
@@ -77,7 +82,7 @@ declare const maybeHealLabelByReverseAddress: ({ maybeReverseAddress, labelHash,
|
|
|
77
82
|
* into Node or LabelHash, which is a common behavior in the ENS ecosystem.
|
|
78
83
|
* (see NameWrapper, ETHRegistrarController)
|
|
79
84
|
*/
|
|
80
|
-
declare const uint256ToHex32: (num: bigint) =>
|
|
85
|
+
declare const uint256ToHex32: (num: bigint) => Hex;
|
|
81
86
|
/**
|
|
82
87
|
* Check if any characters in `label` are "unindexable".
|
|
83
88
|
*
|
|
@@ -158,6 +163,15 @@ declare const uniq: <T>(arr: T[]) => T[];
|
|
|
158
163
|
* Guaranteed to be a positive integer.
|
|
159
164
|
**/
|
|
160
165
|
type ChainId = number;
|
|
166
|
+
/**
|
|
167
|
+
* Represents an account (contract or EOA) at `address` on chain `chainId`.
|
|
168
|
+
*
|
|
169
|
+
* @see https://chainagnostic.org/CAIPs/caip-10
|
|
170
|
+
*/
|
|
171
|
+
interface AccountId {
|
|
172
|
+
chainId: ChainId;
|
|
173
|
+
address: Address;
|
|
174
|
+
}
|
|
161
175
|
/**
|
|
162
176
|
* Block Number
|
|
163
177
|
*
|
|
@@ -286,6 +300,11 @@ declare function deserializeDuration(maybeDuration: string, valueLabel?: string)
|
|
|
286
300
|
|
|
287
301
|
declare function isNormalized(name: Name): boolean;
|
|
288
302
|
|
|
303
|
+
/**
|
|
304
|
+
* Determines where the provided AccountId values represent the same address on the same chain.
|
|
305
|
+
*/
|
|
306
|
+
declare const accountIdEqual: (a: AccountId, b: AccountId) => boolean;
|
|
307
|
+
|
|
289
308
|
/**
|
|
290
309
|
* The ETH coinType.
|
|
291
310
|
*
|
|
@@ -376,6 +395,57 @@ declare function parseReverseName(name: Name): {
|
|
|
376
395
|
coinType: CoinType;
|
|
377
396
|
} | null;
|
|
378
397
|
|
|
398
|
+
/**
|
|
399
|
+
* A label set ID identifies a set of labels that can be used for deterministic healing.
|
|
400
|
+
* A label set allows clients to deterministically heal their state against a server,
|
|
401
|
+
* ensuring that both are operating on the same version of data.
|
|
402
|
+
*
|
|
403
|
+
* It is guaranteed to be 1 to 50 characters long and contain only lowercase letters (a-z)
|
|
404
|
+
* and hyphens (-).
|
|
405
|
+
*/
|
|
406
|
+
type LabelSetId = string;
|
|
407
|
+
/**
|
|
408
|
+
* A label set version identifies a specific version of a label set. It allows clients to
|
|
409
|
+
* request data from a specific snapshot in time, ensuring deterministic results.
|
|
410
|
+
*
|
|
411
|
+
* It is guaranteed to be a non-negative integer.
|
|
412
|
+
*/
|
|
413
|
+
type LabelSetVersion = number;
|
|
414
|
+
/**
|
|
415
|
+
* The label set preferences of an ENSRainbow client.
|
|
416
|
+
*/
|
|
417
|
+
interface EnsRainbowClientLabelSet {
|
|
418
|
+
/**
|
|
419
|
+
* Optional label set ID that the ENSRainbow server is expected to use. If provided, heal
|
|
420
|
+
* operations will validate the ENSRainbow server is using this labelSetId.
|
|
421
|
+
* Required if `labelSetVersion` is defined.
|
|
422
|
+
*/
|
|
423
|
+
labelSetId?: LabelSetId;
|
|
424
|
+
/**
|
|
425
|
+
* Optional highest label set version of label set id to query. Enables deterministic heal
|
|
426
|
+
* results across time even if the ENSRainbow server ingests label sets with greater versions
|
|
427
|
+
* than this value. If provided, only labels from label sets with versions less than or equal to this
|
|
428
|
+
* value will be returned. If not provided, the server will use the latest available version.
|
|
429
|
+
* When `labelSetVersion` is defined, `labelSetId` must also be defined.
|
|
430
|
+
*/
|
|
431
|
+
labelSetVersion?: LabelSetVersion;
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* The state of label sets managed by an ENSRainbow server.
|
|
435
|
+
*/
|
|
436
|
+
interface EnsRainbowServerLabelSet {
|
|
437
|
+
/**
|
|
438
|
+
* The LabelSetId managed by the ENSRainbow server.
|
|
439
|
+
*/
|
|
440
|
+
labelSetId: LabelSetId;
|
|
441
|
+
/**
|
|
442
|
+
* The highest label set version available on the ENSRainbow server for the current
|
|
443
|
+
* label set ID. This represents the most recent version of the label set that the
|
|
444
|
+
* server has ingested and can provide label healing results for.
|
|
445
|
+
*/
|
|
446
|
+
highestLabelSetVersion: LabelSetVersion;
|
|
447
|
+
}
|
|
448
|
+
|
|
379
449
|
/**
|
|
380
450
|
* A PluginName is a unique id for a 'plugin': we use the notion of
|
|
381
451
|
* 'plugins' to describe bundles of indexing logic.
|
|
@@ -386,7 +456,8 @@ declare enum PluginName {
|
|
|
386
456
|
Lineanames = "lineanames",
|
|
387
457
|
ThreeDNS = "threedns",
|
|
388
458
|
ReverseResolvers = "reverse-resolvers",
|
|
389
|
-
Referrals = "referrals"
|
|
459
|
+
Referrals = "referrals",
|
|
460
|
+
TokenScope = "tokenscope"
|
|
390
461
|
}
|
|
391
462
|
/**
|
|
392
463
|
* Information about ENSIndexer's dependencies.
|
|
@@ -432,6 +503,10 @@ interface ENSIndexerPublicConfig {
|
|
|
432
503
|
* state about the ENSNode instance.
|
|
433
504
|
*/
|
|
434
505
|
ensNodePublicUrl: URL;
|
|
506
|
+
/**
|
|
507
|
+
* The "fully pinned" label set reference that ENSIndexer will request ENSRainbow use for deterministic label healing across time. This label set reference is "fully pinned" as it requires both the labelSetId and labelSetVersion fields to be defined.
|
|
508
|
+
*/
|
|
509
|
+
labelSet: Required<EnsRainbowClientLabelSet>;
|
|
435
510
|
/**
|
|
436
511
|
* A Postgres database schema name. This instance of ENSIndexer will write
|
|
437
512
|
* indexed data to the tables in this schema.
|
|
@@ -478,10 +553,6 @@ interface ENSIndexerPublicConfig {
|
|
|
478
553
|
* {@link indexAdditionalResolverRecords} should be `false`.
|
|
479
554
|
*/
|
|
480
555
|
indexAdditionalResolverRecords: boolean;
|
|
481
|
-
/**
|
|
482
|
-
* Experiment to enable forward/reverse resolution APIs.
|
|
483
|
-
*/
|
|
484
|
-
experimentalResolution: boolean;
|
|
485
556
|
/**
|
|
486
557
|
* Indexed Chain IDs
|
|
487
558
|
*
|
|
@@ -536,7 +607,7 @@ declare function deserializeENSIndexerPublicConfig(maybeConfig: SerializedENSInd
|
|
|
536
607
|
* Tells if indexer config guarantees data to be indexed while
|
|
537
608
|
* maintaining full subgraph-compatibility.
|
|
538
609
|
*/
|
|
539
|
-
declare function isSubgraphCompatible(config: Pick<ENSIndexerPublicConfig, "plugins" | "healReverseAddresses" | "indexAdditionalResolverRecords">): boolean;
|
|
610
|
+
declare function isSubgraphCompatible(config: Pick<ENSIndexerPublicConfig, "plugins" | "healReverseAddresses" | "indexAdditionalResolverRecords" | "labelSet">): boolean;
|
|
540
611
|
|
|
541
612
|
/**
|
|
542
613
|
* Serializes a {@link ChainConfig} object.
|
|
@@ -547,6 +618,159 @@ declare function serializeIndexedChainIds(indexedChainIds: Set<ChainId>): Serial
|
|
|
547
618
|
*/
|
|
548
619
|
declare function serializeENSIndexerPublicConfig(config: ENSIndexerPublicConfig): SerializedENSIndexerPublicConfig;
|
|
549
620
|
|
|
621
|
+
/**
|
|
622
|
+
* All zod schemas we define must remain internal implementation details.
|
|
623
|
+
* We want the freedom to move away from zod in the future without impacting
|
|
624
|
+
* any users of the ensnode-sdk package.
|
|
625
|
+
*
|
|
626
|
+
* The only way to share Zod schemas is to re-export them from
|
|
627
|
+
* `./src/internal.ts` file.
|
|
628
|
+
*/
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* Zod `.check()` function input.
|
|
632
|
+
*/
|
|
633
|
+
type ZodCheckFnInput<T> = z.core.ParsePayload<T>;
|
|
634
|
+
|
|
635
|
+
/**
|
|
636
|
+
* All zod schemas we define must remain internal implementation details.
|
|
637
|
+
* We want the freedom to move away from zod in the future without impacting
|
|
638
|
+
* any users of the ensnode-sdk package.
|
|
639
|
+
*
|
|
640
|
+
* The only way to share Zod schemas is to re-export them from
|
|
641
|
+
* `./src/internal.ts` file.
|
|
642
|
+
*/
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* Makes a schema for parsing {@link IndexedChainIds}.
|
|
646
|
+
*/
|
|
647
|
+
declare const makeIndexedChainIdsSchema: (valueLabel?: string) => z.ZodPipe<z.ZodArray<z.ZodInt>, z.ZodTransform<Set<number>, number[]>>;
|
|
648
|
+
/**
|
|
649
|
+
* Makes a schema for parsing a list of {@link PluginName} items.
|
|
650
|
+
*
|
|
651
|
+
* The list is guaranteed to include at least one item exists, and no duplicates.
|
|
652
|
+
*/
|
|
653
|
+
declare const makePluginsListSchema: (valueLabel?: string) => z.ZodArray<z.ZodEnum<typeof PluginName>>;
|
|
654
|
+
/**
|
|
655
|
+
* Makes a schema for parsing a name for a database schema.
|
|
656
|
+
*
|
|
657
|
+
* The name is guaranteed to be a non-empty string.
|
|
658
|
+
*/
|
|
659
|
+
declare const makeDatabaseSchemaNameSchema: (valueLabel?: string) => z.ZodString;
|
|
660
|
+
/**
|
|
661
|
+
* Makes a schema for parsing a label set ID.
|
|
662
|
+
*
|
|
663
|
+
* The label set ID is guaranteed to be a string between 1-50 characters
|
|
664
|
+
* containing only lowercase letters (a-z) and hyphens (-).
|
|
665
|
+
*
|
|
666
|
+
* @param valueLabel - The label to use in error messages (e.g., "Label set ID", "LABEL_SET_ID")
|
|
667
|
+
*/
|
|
668
|
+
declare const makeLabelSetIdSchema: (valueLabel: string) => z.ZodString;
|
|
669
|
+
/**
|
|
670
|
+
* Makes a schema for parsing a label set version.
|
|
671
|
+
*
|
|
672
|
+
* The label set version is guaranteed to be a non-negative integer.
|
|
673
|
+
*
|
|
674
|
+
* @param valueLabel - The label to use in error messages (e.g., "Label set version", "LABEL_SET_VERSION")
|
|
675
|
+
|
|
676
|
+
*/
|
|
677
|
+
declare const makeLabelSetVersionSchema: (valueLabel: string) => z.ZodPipe<z.coerce.ZodCoercedNumber<unknown>, z.ZodInt>;
|
|
678
|
+
/**
|
|
679
|
+
* Makes a schema for parsing a label set where both label set ID and label set version are required.
|
|
680
|
+
*
|
|
681
|
+
* @param valueLabel - The label to use in error messages (e.g., "Label set", "LABEL_SET")
|
|
682
|
+
*/
|
|
683
|
+
declare const makeFullyPinnedLabelSetSchema: (valueLabel?: string) => z.ZodObject<{
|
|
684
|
+
labelSetId: z.ZodString;
|
|
685
|
+
labelSetVersion: z.ZodPipe<z.coerce.ZodCoercedNumber<unknown>, z.ZodInt>;
|
|
686
|
+
}, z.core.$strip>;
|
|
687
|
+
declare const makeDependencyInfoSchema: (valueLabel?: string) => z.ZodObject<{
|
|
688
|
+
nodejs: z.ZodString;
|
|
689
|
+
ponder: z.ZodString;
|
|
690
|
+
ensRainbow: z.ZodString;
|
|
691
|
+
ensRainbowSchema: z.ZodInt;
|
|
692
|
+
}, z.core.$strict>;
|
|
693
|
+
declare function invariant_reverseResolversPluginNeedsResolverRecords(ctx: ZodCheckFnInput<Pick<ENSIndexerPublicConfig, "plugins" | "indexAdditionalResolverRecords">>): void;
|
|
694
|
+
declare function invariant_isSubgraphCompatibleRequirements(ctx: ZodCheckFnInput<Pick<ENSIndexerPublicConfig, "plugins" | "isSubgraphCompatible" | "healReverseAddresses" | "indexAdditionalResolverRecords" | "labelSet">>): void;
|
|
695
|
+
/**
|
|
696
|
+
* ENSIndexer Public Config Schema
|
|
697
|
+
*
|
|
698
|
+
* Makes a Zod schema definition for validating all important settings used
|
|
699
|
+
* during runtime of the ENSIndexer instance.
|
|
700
|
+
*/
|
|
701
|
+
declare const makeENSIndexerPublicConfigSchema: (valueLabel?: string) => z.ZodObject<{
|
|
702
|
+
ensAdminUrl: z.ZodPipe<z.ZodURL, z.ZodTransform<URL, string>>;
|
|
703
|
+
ensNodePublicUrl: z.ZodPipe<z.ZodURL, z.ZodTransform<URL, string>>;
|
|
704
|
+
labelSet: z.ZodObject<{
|
|
705
|
+
labelSetId: z.ZodString;
|
|
706
|
+
labelSetVersion: z.ZodPipe<z.coerce.ZodCoercedNumber<unknown>, z.ZodInt>;
|
|
707
|
+
}, z.core.$strip>;
|
|
708
|
+
healReverseAddresses: z.ZodBoolean;
|
|
709
|
+
indexAdditionalResolverRecords: z.ZodBoolean;
|
|
710
|
+
indexedChainIds: z.ZodPipe<z.ZodArray<z.ZodInt>, z.ZodTransform<Set<number>, number[]>>;
|
|
711
|
+
isSubgraphCompatible: z.ZodBoolean;
|
|
712
|
+
namespace: z.ZodEnum<{
|
|
713
|
+
readonly Mainnet: "mainnet";
|
|
714
|
+
readonly Sepolia: "sepolia";
|
|
715
|
+
readonly Holesky: "holesky";
|
|
716
|
+
readonly EnsTestEnv: "ens-test-env";
|
|
717
|
+
}>;
|
|
718
|
+
plugins: z.ZodArray<z.ZodEnum<typeof PluginName>>;
|
|
719
|
+
databaseSchemaName: z.ZodString;
|
|
720
|
+
dependencyInfo: z.ZodObject<{
|
|
721
|
+
nodejs: z.ZodString;
|
|
722
|
+
ponder: z.ZodString;
|
|
723
|
+
ensRainbow: z.ZodString;
|
|
724
|
+
ensRainbowSchema: z.ZodInt;
|
|
725
|
+
}, z.core.$strict>;
|
|
726
|
+
}, z.core.$strip>;
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* Builds a valid LabelSetId from a string.
|
|
730
|
+
* @param maybeLabelSetId - The string to validate and convert to a LabelSetId.
|
|
731
|
+
* @returns A valid LabelSetId.
|
|
732
|
+
* @throws If the input string is not a valid LabelSetId.
|
|
733
|
+
*/
|
|
734
|
+
declare function buildLabelSetId(maybeLabelSetId: string): LabelSetId;
|
|
735
|
+
/**
|
|
736
|
+
* Builds a valid LabelSetVersion from a number or string.
|
|
737
|
+
* @param maybeLabelSetVersion - The number or string to validate and convert to a LabelSetVersion.
|
|
738
|
+
* @returns A valid LabelSetVersion.
|
|
739
|
+
* @throws If the input is not a valid LabelSetVersion.
|
|
740
|
+
*/
|
|
741
|
+
declare function buildLabelSetVersion(maybeLabelSetVersion: number | string): LabelSetVersion;
|
|
742
|
+
/**
|
|
743
|
+
* Builds an EnsRainbowClientLabelSet.
|
|
744
|
+
* @param labelSetId - The label set ID.
|
|
745
|
+
* @param labelSetVersion - The label set version.
|
|
746
|
+
* @returns A valid EnsRainbowClientLabelSet object.
|
|
747
|
+
* @throws If `labelSetVersion` is defined without `labelSetId`.
|
|
748
|
+
*/
|
|
749
|
+
declare function buildEnsRainbowClientLabelSet(labelSetId?: LabelSetId, labelSetVersion?: LabelSetVersion): EnsRainbowClientLabelSet;
|
|
750
|
+
/**
|
|
751
|
+
* Validates that the server's label set is compatible with the client's requested label set.
|
|
752
|
+
* @param serverSet - The label set provided by the server.
|
|
753
|
+
* @param clientSet - The label set requested by the client.
|
|
754
|
+
* @throws If the server set is not compatible with the client set.
|
|
755
|
+
*/
|
|
756
|
+
declare function validateSupportedLabelSetAndVersion(serverSet: EnsRainbowServerLabelSet, clientSet: EnsRainbowClientLabelSet): void;
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* Converts a Labelhash to bytes, with validation
|
|
760
|
+
* @param labelHash The Labelhash to convert
|
|
761
|
+
* @returns A ByteArray containing the bytes
|
|
762
|
+
* @throws Error if `labelHash` is not a valid 32-byte hex string
|
|
763
|
+
*/
|
|
764
|
+
declare function labelHashToBytes(labelHash: LabelHash): ByteArray;
|
|
765
|
+
|
|
766
|
+
/**
|
|
767
|
+
* Parses a string into a non-negative integer.
|
|
768
|
+
* @param input The string to parse
|
|
769
|
+
* @returns The parsed non-negative integer
|
|
770
|
+
* @throws Error if the input is not a valid non-negative integer
|
|
771
|
+
*/
|
|
772
|
+
declare function parseNonNegativeInteger(maybeNumber: string): number;
|
|
773
|
+
|
|
550
774
|
declare const ChainIndexingStatusIds: {
|
|
551
775
|
readonly Unstarted: "unstarted";
|
|
552
776
|
readonly Backfill: "backfill";
|
|
@@ -662,7 +886,8 @@ interface ChainIndexingUnstartedStatus {
|
|
|
662
886
|
*
|
|
663
887
|
* Invariants:
|
|
664
888
|
* - `config.startBlock` is always before or the same as `latestIndexedBlock`
|
|
665
|
-
* - `latestIndexedBlock` is always before or the same as `
|
|
889
|
+
* - `latestIndexedBlock` is always before or the same as `latestSyncedBlock`
|
|
890
|
+
* - `latestSyncedBlock` is always before or the same as `backfillEndBlock`
|
|
666
891
|
* - `backfillEndBlock` is the same as `config.endBlock` if and only if
|
|
667
892
|
* the config is definite.
|
|
668
893
|
*/
|
|
@@ -673,6 +898,11 @@ interface ChainIndexingBackfillStatus {
|
|
|
673
898
|
* The block that was most recently indexed.
|
|
674
899
|
*/
|
|
675
900
|
latestIndexedBlock: BlockRef;
|
|
901
|
+
/**
|
|
902
|
+
* The "highest" block that has been synced into RPC cache. Backfill indexing
|
|
903
|
+
* is accelerated by cached RPC calls through this block height.
|
|
904
|
+
*/
|
|
905
|
+
latestSyncedBlock: BlockRef;
|
|
676
906
|
/**
|
|
677
907
|
* The block that is the target for finishing the backfill.
|
|
678
908
|
*/
|
|
@@ -939,6 +1169,16 @@ declare function getOverallIndexingStatus(chains: ChainIndexingStatus[]): Exclud
|
|
|
939
1169
|
* @throws an error if none of the indexed chains was in the 'following' status.
|
|
940
1170
|
*/
|
|
941
1171
|
declare function getOverallApproxRealtimeDistance(chains: ChainIndexingStatus[]): Duration;
|
|
1172
|
+
/**
|
|
1173
|
+
* Get lowest of the highest end block across all chains which status is
|
|
1174
|
+
* {@link ChainIndexingStatus}.
|
|
1175
|
+
*/
|
|
1176
|
+
declare function getTimestampForLowestOmnichainStartBlock(chains: ChainIndexingStatus[]): UnixTimestamp;
|
|
1177
|
+
/**
|
|
1178
|
+
* Get timestamp of the highest known block across all chains which status is
|
|
1179
|
+
* {@link ChainIndexingStatusForBackfillOverallStatus}.
|
|
1180
|
+
*/
|
|
1181
|
+
declare function getTimestampForHighestOmnichainKnownBlock(chains: ChainIndexingStatus[]): UnixTimestamp;
|
|
942
1182
|
/**
|
|
943
1183
|
* Get Omnichain Indexing Cursor across all chains which status is
|
|
944
1184
|
* {@link ChainIndexingActiveStatus}.
|
|
@@ -995,6 +1235,11 @@ declare function checkChainIndexingStatusesForCompletedOverallStatus(chains: Cha
|
|
|
995
1235
|
* - Any other chain can have any status.
|
|
996
1236
|
*/
|
|
997
1237
|
declare function checkChainIndexingStatusesForFollowingOverallStatus(chains: ChainIndexingStatus[]): chains is ChainIndexingStatus[];
|
|
1238
|
+
/**
|
|
1239
|
+
* Sort a list of [{@link ChainId}, {@link ChainIndexingStatus}] tuples
|
|
1240
|
+
* by the omnichain start block timestamp in ascending order.
|
|
1241
|
+
*/
|
|
1242
|
+
declare function sortAscChainStatusesByStartBlock<ChainStatusType extends ChainIndexingStatus>(chains: [ChainId, ChainStatusType][]): [ChainId, ChainStatusType][];
|
|
998
1243
|
|
|
999
1244
|
/**
|
|
1000
1245
|
* Serialize chain indexing statuses.
|
|
@@ -1016,7 +1261,7 @@ declare enum TraceableENSProtocol {
|
|
|
1016
1261
|
* Encodes the set of well-known steps in the ENS Forward Resolution protocol.
|
|
1017
1262
|
*/
|
|
1018
1263
|
declare enum ForwardResolutionProtocolStep {
|
|
1019
|
-
Operation = "
|
|
1264
|
+
Operation = "forward-resolution",
|
|
1020
1265
|
FindResolver = "find-resolver",
|
|
1021
1266
|
ActiveResolverExists = "active-resolver-exists",
|
|
1022
1267
|
AccelerateENSIP19ReverseResolver = "accelerate-ensip-19-reverse-resolver",
|
|
@@ -1029,43 +1274,46 @@ declare enum ForwardResolutionProtocolStep {
|
|
|
1029
1274
|
* Encodes the set of well-known steps in the ENS Reverse Resolution protocol.
|
|
1030
1275
|
*/
|
|
1031
1276
|
declare enum ReverseResolutionProtocolStep {
|
|
1032
|
-
Operation = "
|
|
1277
|
+
Operation = "reverse-resolution",
|
|
1033
1278
|
ResolveReverseName = "resolve-reverse-name",
|
|
1034
1279
|
NameRecordExists = "name-record-exists-check",
|
|
1035
1280
|
ForwardResolveAddressRecord = "forward-resolve-address-record",
|
|
1036
1281
|
VerifyResolvedAddressMatchesAddress = "verify-resolved-address-matches-address"
|
|
1037
1282
|
}
|
|
1283
|
+
declare const PROTOCOL_ATTRIBUTE_PREFIX = "ens";
|
|
1038
1284
|
declare const ATTR_PROTOCOL_NAME = "ens.protocol";
|
|
1039
1285
|
declare const ATTR_PROTOCOL_STEP = "ens.protocol.step";
|
|
1040
1286
|
declare const ATTR_PROTOCOL_STEP_RESULT = "ens.protocol.step.result";
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
name: any;
|
|
1287
|
+
interface SpanAttributes {
|
|
1288
|
+
[key: string]: unknown;
|
|
1289
|
+
}
|
|
1290
|
+
interface SpanEvent {
|
|
1291
|
+
name: string;
|
|
1292
|
+
attributes: SpanAttributes;
|
|
1293
|
+
time: number;
|
|
1294
|
+
}
|
|
1295
|
+
interface ProtocolSpan {
|
|
1296
|
+
scope: string;
|
|
1297
|
+
id: string;
|
|
1298
|
+
traceId: string;
|
|
1299
|
+
parentSpanContext: {
|
|
1300
|
+
traceId: string;
|
|
1301
|
+
spanId: string;
|
|
1302
|
+
} | undefined;
|
|
1303
|
+
name: string;
|
|
1059
1304
|
timestamp: number;
|
|
1060
1305
|
duration: number;
|
|
1061
|
-
attributes:
|
|
1062
|
-
|
|
1306
|
+
attributes: SpanAttributes;
|
|
1307
|
+
status: {
|
|
1308
|
+
code: number;
|
|
1309
|
+
message?: string;
|
|
1063
1310
|
};
|
|
1064
|
-
|
|
1065
|
-
|
|
1311
|
+
events: SpanEvent[];
|
|
1312
|
+
}
|
|
1313
|
+
type ProtocolSpanTreeNode = ProtocolSpan & {
|
|
1314
|
+
children: ProtocolSpanTreeNode[];
|
|
1066
1315
|
};
|
|
1067
|
-
type
|
|
1068
|
-
type ProtocolTrace = ProtocolSpan[];
|
|
1316
|
+
type ProtocolTrace = ProtocolSpanTreeNode[];
|
|
1069
1317
|
|
|
1070
1318
|
/**
|
|
1071
1319
|
* Encodes a selection of Resolver records in the context of a specific Name.
|
|
@@ -1087,10 +1335,6 @@ interface ResolverRecordsSelection {
|
|
|
1087
1335
|
*/
|
|
1088
1336
|
texts?: string[];
|
|
1089
1337
|
}
|
|
1090
|
-
declare const DEFAULT_RECORDS_SELECTION: {
|
|
1091
|
-
readonly addresses: [CoinType];
|
|
1092
|
-
readonly texts: ["url", "avatar", "header", "description", "email", "com.twitter", "com.farcaster", "com.github"];
|
|
1093
|
-
};
|
|
1094
1338
|
declare const isSelectionEmpty: (selection: ResolverRecordsSelection) => boolean;
|
|
1095
1339
|
|
|
1096
1340
|
/**
|
|
@@ -1178,6 +1422,25 @@ interface MultichainPrimaryNameResolutionArgs {
|
|
|
1178
1422
|
*/
|
|
1179
1423
|
type MultichainPrimaryNameResolutionResult = Record<ChainId, Name | null>;
|
|
1180
1424
|
|
|
1425
|
+
declare const DefaultRecordsSelection: {
|
|
1426
|
+
readonly mainnet: {
|
|
1427
|
+
readonly addresses: [_ensdomains_address_encoder.CoinType, ..._ensdomains_address_encoder.CoinType[]];
|
|
1428
|
+
readonly texts: ["url", "avatar", "header", "description", "email", "com.twitter", "com.farcaster", "com.github"];
|
|
1429
|
+
};
|
|
1430
|
+
readonly sepolia: {
|
|
1431
|
+
readonly addresses: [_ensdomains_address_encoder.CoinType, ..._ensdomains_address_encoder.CoinType[]];
|
|
1432
|
+
readonly texts: ["url", "avatar", "header", "description", "email", "com.twitter", "com.farcaster", "com.github"];
|
|
1433
|
+
};
|
|
1434
|
+
readonly holesky: {
|
|
1435
|
+
readonly addresses: [_ensdomains_address_encoder.CoinType, ..._ensdomains_address_encoder.CoinType[]];
|
|
1436
|
+
readonly texts: ["url", "avatar", "header", "description", "email", "com.twitter", "com.farcaster", "com.github"];
|
|
1437
|
+
};
|
|
1438
|
+
readonly "ens-test-env": {
|
|
1439
|
+
readonly addresses: [_ensdomains_address_encoder.CoinType, ..._ensdomains_address_encoder.CoinType[]];
|
|
1440
|
+
readonly texts: ["url", "avatar", "header", "description", "email", "com.twitter", "com.farcaster", "com.github"];
|
|
1441
|
+
};
|
|
1442
|
+
};
|
|
1443
|
+
|
|
1181
1444
|
/**
|
|
1182
1445
|
* API Error Response Type
|
|
1183
1446
|
*/
|
|
@@ -1194,6 +1457,9 @@ interface TraceableResponse {
|
|
|
1194
1457
|
interface AcceleratableRequest {
|
|
1195
1458
|
accelerate?: boolean;
|
|
1196
1459
|
}
|
|
1460
|
+
interface AcceleratableResponse {
|
|
1461
|
+
accelerationAttempted: boolean;
|
|
1462
|
+
}
|
|
1197
1463
|
/**
|
|
1198
1464
|
* Resolve Records Request Type
|
|
1199
1465
|
*/
|
|
@@ -1202,7 +1468,7 @@ interface ResolveRecordsRequest<SELECTION extends ResolverRecordsSelection> exte
|
|
|
1202
1468
|
/**
|
|
1203
1469
|
* Resolve Records Response Type
|
|
1204
1470
|
*/
|
|
1205
|
-
interface ResolveRecordsResponse<SELECTION extends ResolverRecordsSelection> extends TraceableResponse {
|
|
1471
|
+
interface ResolveRecordsResponse<SELECTION extends ResolverRecordsSelection> extends AcceleratableResponse, TraceableResponse {
|
|
1206
1472
|
records: ResolverRecordsResponse<SELECTION>;
|
|
1207
1473
|
}
|
|
1208
1474
|
/**
|
|
@@ -1213,14 +1479,49 @@ interface ResolvePrimaryNameRequest extends ReverseResolutionArgs, Acceleratable
|
|
|
1213
1479
|
/**
|
|
1214
1480
|
* Resolve Primary Name Response Type
|
|
1215
1481
|
*/
|
|
1216
|
-
interface ResolvePrimaryNameResponse extends TraceableResponse {
|
|
1482
|
+
interface ResolvePrimaryNameResponse extends AcceleratableResponse, TraceableResponse {
|
|
1217
1483
|
name: ReverseResolutionResult;
|
|
1218
1484
|
}
|
|
1219
1485
|
interface ResolvePrimaryNamesRequest extends MultichainPrimaryNameResolutionArgs, AcceleratableRequest, TraceableRequest {
|
|
1220
1486
|
}
|
|
1221
|
-
interface ResolvePrimaryNamesResponse extends TraceableResponse {
|
|
1487
|
+
interface ResolvePrimaryNamesResponse extends AcceleratableResponse, TraceableResponse {
|
|
1222
1488
|
names: MultichainPrimaryNameResolutionResult;
|
|
1223
1489
|
}
|
|
1490
|
+
/**
|
|
1491
|
+
* ENSIndexer Public Config Response
|
|
1492
|
+
*/
|
|
1493
|
+
type ConfigResponse = ENSIndexerPublicConfig;
|
|
1494
|
+
/**
|
|
1495
|
+
* ENSIndexer Overall Indexing Status Request
|
|
1496
|
+
*/
|
|
1497
|
+
interface IndexingStatusRequest {
|
|
1498
|
+
/**
|
|
1499
|
+
* Max Realtime Distance (optional)
|
|
1500
|
+
*
|
|
1501
|
+
* A duration value in seconds, representing the max allowed distance
|
|
1502
|
+
* between the latest indexed block of each chain and the “tip” of
|
|
1503
|
+
* all indexed chains. Setting this parameter influences the HTTP response
|
|
1504
|
+
* code as follows:
|
|
1505
|
+
* - Success (200 OK): The latest indexed block of each chain
|
|
1506
|
+
* is within the requested distance from realtime.
|
|
1507
|
+
* - Service Unavailable (503): The latest indexed block of each chain
|
|
1508
|
+
* is NOT within the requested distance from realtime.
|
|
1509
|
+
*/
|
|
1510
|
+
maxRealtimeDistance?: Duration;
|
|
1511
|
+
}
|
|
1512
|
+
/**
|
|
1513
|
+
* ENSIndexer Overall Indexing Status Response
|
|
1514
|
+
*/
|
|
1515
|
+
type IndexingStatusResponse = ENSIndexerOverallIndexingStatus;
|
|
1516
|
+
/**
|
|
1517
|
+
* ENSIndexer Overall Indexing Status Response Codes
|
|
1518
|
+
*
|
|
1519
|
+
* Define a custom response code for known responses.
|
|
1520
|
+
*/
|
|
1521
|
+
declare const IndexingStatusResponseCodes: {
|
|
1522
|
+
readonly IndexerError: 512;
|
|
1523
|
+
readonly RequestedDistanceNotAchievedError: 513;
|
|
1524
|
+
};
|
|
1224
1525
|
|
|
1225
1526
|
/**
|
|
1226
1527
|
* Default ENSNode API endpoint URL
|
|
@@ -1272,7 +1573,7 @@ declare class ENSNodeClient {
|
|
|
1272
1573
|
* @param name The ENS Name whose records to resolve
|
|
1273
1574
|
* @param selection selection of Resolver records
|
|
1274
1575
|
* @param options additional options
|
|
1275
|
-
* @param options.accelerate whether to attempt Protocol Acceleration (default
|
|
1576
|
+
* @param options.accelerate whether to attempt Protocol Acceleration (default false)
|
|
1276
1577
|
* @param options.trace whether to include a trace in the response (default false)
|
|
1277
1578
|
* @returns ResolveRecordsResponse<SELECTION>
|
|
1278
1579
|
* @throws If the request fails or the ENSNode API returns an error response
|
|
@@ -1307,7 +1608,7 @@ declare class ENSNodeClient {
|
|
|
1307
1608
|
* @param address The Address whose Primary Name to resolve
|
|
1308
1609
|
* @param chainId The chain id within which to query the address' ENSIP-19 Multichain Primary Name
|
|
1309
1610
|
* @param options additional options
|
|
1310
|
-
* @param options.accelerate whether to attempt Protocol Acceleration (default
|
|
1611
|
+
* @param options.accelerate whether to attempt Protocol Acceleration (default false)
|
|
1311
1612
|
* @param options.trace whether to include a trace in the response (default false)
|
|
1312
1613
|
* @returns ResolvePrimaryNameResponse
|
|
1313
1614
|
* @throws If the request fails or the ENSNode API returns an error response
|
|
@@ -1371,6 +1672,47 @@ declare class ENSNodeClient {
|
|
|
1371
1672
|
* ```
|
|
1372
1673
|
*/
|
|
1373
1674
|
resolvePrimaryNames(address: ResolvePrimaryNamesRequest["address"], options?: Omit<ResolvePrimaryNamesRequest, "address">): Promise<ResolvePrimaryNamesResponse>;
|
|
1675
|
+
/**
|
|
1676
|
+
* Fetch ENSNode Config
|
|
1677
|
+
*
|
|
1678
|
+
* Fetch the ENSNode's configuration.
|
|
1679
|
+
*
|
|
1680
|
+
* @returns {ConfigResponse}
|
|
1681
|
+
*
|
|
1682
|
+
* @throws if the ENSNode request fails
|
|
1683
|
+
* @throws if the ENSNode API returns an error response
|
|
1684
|
+
* @throws if the ENSNode response breaks required invariants
|
|
1685
|
+
*/
|
|
1686
|
+
config(): Promise<ConfigResponse>;
|
|
1687
|
+
/**
|
|
1688
|
+
* Fetch ENSNode Indexing Status
|
|
1689
|
+
*
|
|
1690
|
+
* Fetch the ENSNode's multichain indexing status.
|
|
1691
|
+
*
|
|
1692
|
+
* @param options additional options
|
|
1693
|
+
* @param options.maxRealtimeDistance the max allowed distance between the
|
|
1694
|
+
* latest indexed block of each chain and the "tip" of all indexed chains.
|
|
1695
|
+
* Setting this parameter influences the HTTP response code as follows:
|
|
1696
|
+
* - Success (200 OK): The latest indexed block of each chain is within the
|
|
1697
|
+
* requested distance from realtime.
|
|
1698
|
+
* - Service Unavailable (503): The latest indexed block of each chain is NOT
|
|
1699
|
+
* within the requested distance from realtime.
|
|
1700
|
+
*
|
|
1701
|
+
* @returns {IndexingStatusResponse}
|
|
1702
|
+
*
|
|
1703
|
+
* @throws if the ENSNode request fails
|
|
1704
|
+
* @throws if the ENSNode API returns an error response
|
|
1705
|
+
* @throws if the ENSNode response breaks required invariants
|
|
1706
|
+
*/
|
|
1707
|
+
indexingStatus(options?: IndexingStatusRequest): Promise<IndexingStatusResponse>;
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1710
|
+
declare function deserializeErrorResponse(maybeErrorResponse: unknown): ErrorResponse;
|
|
1711
|
+
|
|
1712
|
+
declare class ClientError extends Error {
|
|
1713
|
+
details?: unknown;
|
|
1714
|
+
constructor(message: string, details?: unknown);
|
|
1715
|
+
static fromErrorResponse({ message, details }: ErrorResponse): ClientError;
|
|
1374
1716
|
}
|
|
1375
1717
|
|
|
1376
|
-
export { ATTR_PROTOCOL_NAME, ATTR_PROTOCOL_STEP, ATTR_PROTOCOL_STEP_RESULT, type AcceleratableRequest, type BlockNumber, type BlockRef, type Blockrange, type Cache, type ChainId, type ChainIdString, type ChainIndexingActiveStatus, type ChainIndexingBackfillStatus, type ChainIndexingCompletedStatus, type ChainIndexingConfig, type ChainIndexingDefiniteConfig, type ChainIndexingFollowingStatus, type ChainIndexingIndefiniteConfig, type ChainIndexingStandbyStatus, type ChainIndexingStatus, type ChainIndexingStatusForBackfillOverallStatus, type ChainIndexingStatusId, ChainIndexingStatusIds, type ChainIndexingStrategyId, ChainIndexingStrategyIds, type ChainIndexingUnstartedStatus, type ClientOptions, DEFAULT_ENSNODE_API_URL, DEFAULT_EVM_CHAIN_ID, DEFAULT_EVM_COIN_TYPE,
|
|
1718
|
+
export { 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 ChainIndexingActiveStatus, type ChainIndexingBackfillStatus, type ChainIndexingCompletedStatus, type ChainIndexingConfig, type ChainIndexingDefiniteConfig, type ChainIndexingFollowingStatus, type ChainIndexingIndefiniteConfig, type ChainIndexingStandbyStatus, type ChainIndexingStatus, type ChainIndexingStatusForBackfillOverallStatus, type ChainIndexingStatusId, ChainIndexingStatusIds, type ChainIndexingStrategyId, ChainIndexingStrategyIds, type ChainIndexingUnstartedStatus, ClientError, type ClientOptions, type ConfigResponse, DEFAULT_ENSNODE_API_URL, DEFAULT_EVM_CHAIN_ID, DEFAULT_EVM_COIN_TYPE, type Datetime, type DatetimeISO8601, type DeepPartial, DefaultRecordsSelection, type DependencyInfo, type Duration, type ENSIndexerOverallIndexingBackfillStatus, type ENSIndexerOverallIndexingCompletedStatus, type ENSIndexerOverallIndexingErrorStatus, type ENSIndexerOverallIndexingFollowingStatus, type ENSIndexerOverallIndexingStatus, type ENSIndexerOverallIndexingUnstartedStatus, type ENSIndexerPublicConfig, ENSNodeClient, ETH_COIN_TYPE, ETH_NODE, type EncodedLabelHash, type EnsRainbowClientLabelSet, type EnsRainbowServerLabelSet, type ErrorResponse, type ForwardResolutionArgs, ForwardResolutionProtocolStep, type ForwardResolutionResult, type IndexingStatusRequest, type IndexingStatusResponse, IndexingStatusResponseCodes, LINEANAMES_NODE, type Label, type LabelHash, type LabelSetId, type LabelSetVersion, LruCache, type MultichainPrimaryNameResolutionArgs, type MultichainPrimaryNameResolutionResult, type Name, type Node, type OverallIndexingStatusId, OverallIndexingStatusIds, PROTOCOL_ATTRIBUTE_PREFIX, PluginName, type ProtocolSpan, type ProtocolSpanTreeNode, type ProtocolTrace, REVERSE_ROOT_NODES, ROOT_NODE, type ResolvePrimaryNameRequest, type ResolvePrimaryNameResponse, type ResolvePrimaryNamesRequest, type ResolvePrimaryNamesResponse, type ResolveRecordsRequest, type ResolveRecordsResponse, type ResolverRecordsResponse, type ResolverRecordsResponseBase, type ResolverRecordsSelection, type ReverseResolutionArgs, ReverseResolutionProtocolStep, type ReverseResolutionResult, type RpcUrl, type SerializedENSIndexerOverallIndexingBackfillStatus, type SerializedENSIndexerOverallIndexingCompletedStatus, type SerializedENSIndexerOverallIndexingErrorStatus, type SerializedENSIndexerOverallIndexingFollowingStatus, type SerializedENSIndexerOverallIndexingStatus, type SerializedENSIndexerOverallIndexingUnstartedStatus, type SerializedENSIndexerPublicConfig, type SerializedIndexedChainIds, TraceableENSProtocol, type TraceableRequest, type TraceableResponse, type UnixTimestamp, type UrlString, accountIdEqual, addrReverseLabel, bigintToCoinType, buildEnsRainbowClientLabelSet, buildLabelSetId, buildLabelSetVersion, checkChainIndexingStatusesForBackfillOverallStatus, checkChainIndexingStatusesForCompletedOverallStatus, checkChainIndexingStatusesForFollowingOverallStatus, checkChainIndexingStatusesForUnstartedOverallStatus, coinTypeReverseLabel, coinTypeToEvmChainId, createIndexingConfig, deserializeBlockNumber, deserializeBlockRef, deserializeBlockrange, deserializeChainId, deserializeDatetime, deserializeDuration, deserializeENSIndexerIndexingStatus, deserializeENSIndexerPublicConfig, deserializeErrorResponse, deserializeUrl, evmChainIdToCoinType, getActiveChains, getNameHierarchy, getOmnichainIndexingCursor, getOverallApproxRealtimeDistance, getOverallIndexingStatus, getStandbyChains, getTimestampForHighestOmnichainKnownBlock, getTimestampForLowestOmnichainStartBlock, invariant_isSubgraphCompatibleRequirements, invariant_reverseResolversPluginNeedsResolverRecords, isLabelIndexable, isNormalized, isSelectionEmpty, isSubgraphCompatible, labelHashToBytes, makeDatabaseSchemaNameSchema, makeDependencyInfoSchema, makeENSIndexerPublicConfigSchema, makeFullyPinnedLabelSetSchema, makeIndexedChainIdsSchema, makeLabelSetIdSchema, makeLabelSetVersionSchema, makePluginsListSchema, makeSubdomainNode, maybeHealLabelByReverseAddress, parseNonNegativeInteger, parseReverseName, reverseName, serializeChainId, serializeChainIndexingStatuses, serializeDatetime, serializeENSIndexerIndexingStatus, serializeENSIndexerPublicConfig, serializeIndexedChainIds, serializeUrl, sortAscChainStatusesByStartBlock, uint256ToHex32, uniq, validateSupportedLabelSetAndVersion };
|