@ensnode/ensnode-sdk 0.0.0-next-20260130145445 → 0.0.0-next-20260202030222
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.cjs +1563 -1445
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1836 -1704
- package/dist/index.d.ts +1836 -1704
- package/dist/index.js +981 -863
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -781,312 +781,282 @@ type RequiredAndNotNull<T, K extends keyof T> = T & {
|
|
|
781
781
|
};
|
|
782
782
|
|
|
783
783
|
/**
|
|
784
|
-
*
|
|
784
|
+
* A label set ID identifies a label set (see https://ensnode.io/ensrainbow/concepts/glossary#label-set for definition).
|
|
785
|
+
* It is guaranteed to be 1 to 50 characters long and contain only lowercase letters (a-z)
|
|
786
|
+
* and hyphens (-).
|
|
785
787
|
*/
|
|
786
|
-
|
|
787
|
-
|
|
788
|
+
type LabelSetId = string;
|
|
788
789
|
/**
|
|
789
|
-
*
|
|
790
|
+
* A label set version identifies a specific version of a label set. It allows clients to
|
|
791
|
+
* request data from a specific snapshot in time, ensuring deterministic results.
|
|
790
792
|
*
|
|
791
|
-
*
|
|
792
|
-
* @returns The lowercase representation of the EVM address.
|
|
793
|
+
* It is guaranteed to be a non-negative integer.
|
|
793
794
|
*/
|
|
794
|
-
|
|
795
|
-
|
|
795
|
+
type LabelSetVersion = number;
|
|
796
796
|
/**
|
|
797
|
-
*
|
|
797
|
+
* The label set preferences of an ENSRainbow client.
|
|
798
798
|
*/
|
|
799
|
-
interface
|
|
800
|
-
/**
|
|
801
|
-
* Store a value in the cache with the given key.
|
|
802
|
-
*
|
|
803
|
-
* @param key Cache key
|
|
804
|
-
* @param value Value to store
|
|
805
|
-
*/
|
|
806
|
-
set(key: KeyType, value: ValueType): void;
|
|
799
|
+
interface EnsRainbowClientLabelSet {
|
|
807
800
|
/**
|
|
808
|
-
*
|
|
809
|
-
*
|
|
810
|
-
*
|
|
811
|
-
* @returns The cached value if it exists, otherwise undefined
|
|
801
|
+
* Optional label set ID that the ENSRainbow server is expected to use. If provided, heal
|
|
802
|
+
* operations will validate the ENSRainbow server is using this labelSetId.
|
|
803
|
+
* Required if `labelSetVersion` is defined.
|
|
812
804
|
*/
|
|
813
|
-
|
|
805
|
+
labelSetId?: LabelSetId;
|
|
814
806
|
/**
|
|
815
|
-
*
|
|
807
|
+
* Optional highest label set version of label set id to query. Enables deterministic heal
|
|
808
|
+
* results across time even if the ENSRainbow server ingests label sets with greater versions
|
|
809
|
+
* than this value. If provided, only labels from label sets with versions less than or equal to this
|
|
810
|
+
* value will be returned. If not provided, the server will use the latest available version.
|
|
811
|
+
* When `labelSetVersion` is defined, `labelSetId` must also be defined.
|
|
816
812
|
*/
|
|
817
|
-
|
|
813
|
+
labelSetVersion?: LabelSetVersion;
|
|
814
|
+
}
|
|
815
|
+
/**
|
|
816
|
+
* The state of label sets managed by an ENSRainbow server.
|
|
817
|
+
*/
|
|
818
|
+
interface EnsRainbowServerLabelSet {
|
|
818
819
|
/**
|
|
819
|
-
* The
|
|
820
|
+
* The LabelSetId managed by the ENSRainbow server.
|
|
820
821
|
*/
|
|
821
|
-
|
|
822
|
+
labelSetId: LabelSetId;
|
|
822
823
|
/**
|
|
823
|
-
* The
|
|
824
|
+
* The highest label set version available on the ENSRainbow server for the current
|
|
825
|
+
* label set ID. This represents the most recent version of the label set that the
|
|
826
|
+
* server has ingested and can provide label healing results for.
|
|
824
827
|
*/
|
|
825
|
-
|
|
828
|
+
highestLabelSetVersion: LabelSetVersion;
|
|
826
829
|
}
|
|
827
830
|
|
|
828
831
|
/**
|
|
829
|
-
*
|
|
830
|
-
*
|
|
831
|
-
* `get` and `set` are O(1) operations.
|
|
832
|
-
*
|
|
833
|
-
* @link https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU
|
|
832
|
+
* A PluginName is a unique id for a 'plugin': we use the notion of
|
|
833
|
+
* 'plugins' to describe bundles of indexing logic.
|
|
834
834
|
*/
|
|
835
|
-
declare
|
|
836
|
-
|
|
837
|
-
|
|
835
|
+
declare enum PluginName {
|
|
836
|
+
Subgraph = "subgraph",
|
|
837
|
+
Basenames = "basenames",
|
|
838
|
+
Lineanames = "lineanames",
|
|
839
|
+
ThreeDNS = "threedns",
|
|
840
|
+
ProtocolAcceleration = "protocol-acceleration",
|
|
841
|
+
Registrars = "registrars",
|
|
842
|
+
TokenScope = "tokenscope",
|
|
843
|
+
ENSv2 = "ensv2"
|
|
844
|
+
}
|
|
845
|
+
/**
|
|
846
|
+
* Version info about ENSIndexer and its dependencies.
|
|
847
|
+
*/
|
|
848
|
+
interface ENSIndexerVersionInfo {
|
|
838
849
|
/**
|
|
839
|
-
*
|
|
850
|
+
* Node.js runtime version
|
|
840
851
|
*
|
|
841
|
-
* @
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
constructor(capacity: number);
|
|
845
|
-
set(key: string, value: ValueType): void;
|
|
846
|
-
get(key: string): ValueType | undefined;
|
|
847
|
-
clear(): void;
|
|
848
|
-
get size(): number;
|
|
849
|
-
get capacity(): number;
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
interface SWRCacheOptions<ValueType> {
|
|
852
|
+
* @see https://nodejs.org/en/about/previous-releases
|
|
853
|
+
**/
|
|
854
|
+
nodejs: string;
|
|
853
855
|
/**
|
|
854
|
-
*
|
|
855
|
-
*
|
|
856
|
-
|
|
857
|
-
|
|
856
|
+
* Ponder framework version
|
|
857
|
+
*
|
|
858
|
+
* @see https://www.npmjs.com/package/ponder
|
|
859
|
+
**/
|
|
860
|
+
ponder: string;
|
|
858
861
|
/**
|
|
859
|
-
*
|
|
860
|
-
*
|
|
861
|
-
*
|
|
862
|
-
*
|
|
863
|
-
|
|
864
|
-
* attempt will be made.
|
|
865
|
-
*/
|
|
866
|
-
ttl: Duration;
|
|
862
|
+
* ENSDb service version
|
|
863
|
+
*
|
|
864
|
+
* Guaranteed to be the same as {@link ENSIndexerVersionInfo.ensIndexer}.
|
|
865
|
+
* */
|
|
866
|
+
ensDb: string;
|
|
867
867
|
/**
|
|
868
|
-
*
|
|
869
|
-
*
|
|
870
|
-
*
|
|
871
|
-
|
|
872
|
-
|
|
868
|
+
* ENSIndexer service version
|
|
869
|
+
*
|
|
870
|
+
* @see https://ghcr.io/namehash/ensnode/ensindexer
|
|
871
|
+
**/
|
|
872
|
+
ensIndexer: string;
|
|
873
873
|
/**
|
|
874
|
-
*
|
|
874
|
+
* ENSRainbow service version
|
|
875
875
|
*
|
|
876
|
-
*
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
876
|
+
* @see https://ghcr.io/namehash/ensnode/ensindexer
|
|
877
|
+
**/
|
|
878
|
+
ensRainbow: string;
|
|
879
|
+
/**
|
|
880
|
+
* ENSRainbow schema version
|
|
881
|
+
**/
|
|
882
|
+
ensRainbowSchema: number;
|
|
883
|
+
/**
|
|
884
|
+
* ENS Normalize package version
|
|
885
|
+
*
|
|
886
|
+
* Available on NPM as: `@adraffy/ens-normalize`
|
|
887
|
+
*
|
|
888
|
+
* @see https://www.npmjs.com/package/@adraffy/ens-normalize
|
|
889
|
+
**/
|
|
890
|
+
ensNormalize: string;
|
|
880
891
|
}
|
|
881
892
|
/**
|
|
882
|
-
*
|
|
883
|
-
*
|
|
884
|
-
* This caching strategy serves cached data immediately (even if stale) while
|
|
885
|
-
* asynchronously revalidating the cache in the background. This provides:
|
|
886
|
-
* - Sub-millisecond response times (after first fetch)
|
|
887
|
-
* - Always available data (serves stale data during revalidation)
|
|
888
|
-
* - Automatic background updates via configurable intervals
|
|
889
|
-
*
|
|
890
|
-
* @example
|
|
891
|
-
* ```typescript
|
|
892
|
-
* const cache = new SWRCache({
|
|
893
|
-
* fn: async () => fetch('/api/data').then(r => r.json()),
|
|
894
|
-
* ttl: 60, // 1 minute TTL
|
|
895
|
-
* proactiveRevalidationInterval: 300 // proactively revalidate every 5 minutes
|
|
896
|
-
* });
|
|
897
|
-
*
|
|
898
|
-
* // Returns cached data or waits for initial fetch
|
|
899
|
-
* const data = await cache.read();
|
|
900
|
-
*
|
|
901
|
-
* if (data instanceof Error) { ... }
|
|
902
|
-
* ```
|
|
893
|
+
* Complete public configuration object for ENSIndexer.
|
|
903
894
|
*
|
|
904
|
-
*
|
|
905
|
-
*
|
|
895
|
+
* We use parameter types to maintain fields layout and documentation across
|
|
896
|
+
* the domain model and its serialized counterpart.
|
|
906
897
|
*/
|
|
907
|
-
|
|
908
|
-
private readonly options;
|
|
909
|
-
private cache;
|
|
910
|
-
private inProgressRevalidate;
|
|
911
|
-
private backgroundInterval;
|
|
912
|
-
constructor(options: SWRCacheOptions<ValueType>);
|
|
913
|
-
private revalidate;
|
|
898
|
+
interface ENSIndexerPublicConfig {
|
|
914
899
|
/**
|
|
915
|
-
*
|
|
900
|
+
* The ENS namespace that ENSNode operates in the context of.
|
|
916
901
|
*
|
|
917
|
-
* @
|
|
918
|
-
* has never successfully returned.
|
|
902
|
+
* See {@link ENSNamespaceIds} for available namespace identifiers.
|
|
919
903
|
*/
|
|
920
|
-
|
|
904
|
+
namespace: ENSNamespaceId;
|
|
921
905
|
/**
|
|
922
|
-
*
|
|
906
|
+
* 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.
|
|
923
907
|
*/
|
|
924
|
-
|
|
925
|
-
}
|
|
926
|
-
|
|
927
|
-
/**
|
|
928
|
-
* Cache that maps from string -> ValueType with TTL (time-to-live) expiration.
|
|
929
|
-
*
|
|
930
|
-
* Items are automatically removed when they expire.
|
|
931
|
-
*/
|
|
932
|
-
declare class TtlCache<KeyType extends string, ValueType> implements Cache<KeyType, ValueType> {
|
|
933
|
-
private readonly _cache;
|
|
934
|
-
private readonly _ttl;
|
|
908
|
+
labelSet: Required<EnsRainbowClientLabelSet>;
|
|
935
909
|
/**
|
|
936
|
-
*
|
|
910
|
+
* A Postgres database schema name. This instance of ENSIndexer will write
|
|
911
|
+
* indexed data to the tables in this schema.
|
|
937
912
|
*
|
|
938
|
-
*
|
|
913
|
+
* Invariants:
|
|
914
|
+
* - Must be a non-empty string that is a valid Postgres database schema
|
|
915
|
+
* identifier.
|
|
939
916
|
*/
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
/**
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
*/
|
|
1000
|
-
interface SerializedPriceDai extends Omit<PriceDai, "amount"> {
|
|
1001
|
-
amount: SerializedCurrencyAmount;
|
|
917
|
+
databaseSchemaName: string;
|
|
918
|
+
/**
|
|
919
|
+
* A set of strings referring to the names of plugins that are active.
|
|
920
|
+
*
|
|
921
|
+
* For future-proofing, this is a list of strings that may or may
|
|
922
|
+
* not be currently valid {@link PluginName} values.
|
|
923
|
+
*
|
|
924
|
+
* Invariants:
|
|
925
|
+
* - A set of strings with at least one value.
|
|
926
|
+
*/
|
|
927
|
+
plugins: string[];
|
|
928
|
+
/**
|
|
929
|
+
* Indexed Chain IDs
|
|
930
|
+
*
|
|
931
|
+
* Includes the {@link ChainId} for each chain being indexed.
|
|
932
|
+
*/
|
|
933
|
+
indexedChainIds: Set<ChainId>;
|
|
934
|
+
/**
|
|
935
|
+
* A feature flag to enable/disable ENSIndexer's Subgraph Compatible Indexing Behavior.
|
|
936
|
+
*
|
|
937
|
+
* If {@link isSubgraphCompatible} is true, indexing behavior will match that of the legacy ENS
|
|
938
|
+
* Subgraph.
|
|
939
|
+
*
|
|
940
|
+
* ENSIndexer will store and return Literal Labels and Literal Names without further interpretation.
|
|
941
|
+
* @see https://ensnode.io/docs/reference/terminology#literal-label
|
|
942
|
+
* @see https://ensnode.io/docs/reference/terminology#literal-name
|
|
943
|
+
*
|
|
944
|
+
* If {@link isSubgraphCompatible} is true, the following invariants are true for the ENSIndexerConfig:
|
|
945
|
+
* 1. only the 'subgraph' plugin is enabled, and
|
|
946
|
+
* 2. the labelSet must be { labelSetId: 'subgraph', labelSetVersion: 0 }
|
|
947
|
+
*
|
|
948
|
+
* If {@link isSubgraphCompatible} is false, ENSIndexer will additionally:
|
|
949
|
+
*
|
|
950
|
+
* 1. ENSIndexer will heal all subnames of addr.reverse on the ENS Root Chain.
|
|
951
|
+
*
|
|
952
|
+
* 2. ENSIndexer will track both the keys and the values of Resolver records.
|
|
953
|
+
*
|
|
954
|
+
* WARNING: Special care must be taken when interacting with indexed resolver record values. It
|
|
955
|
+
* is unsafe to naively assume that indexed resolver record values are equivalent to the
|
|
956
|
+
* resolver record values that would be returned through dynamic lookups via the ENS protocol.
|
|
957
|
+
* For example, if a resolver implements CCIP-Read, the resolver records may not be
|
|
958
|
+
* discoverable through onchain indexing.
|
|
959
|
+
*
|
|
960
|
+
* 3. Literal Labels and Literal Names encountered by ENSIndexer will be Interpreted.
|
|
961
|
+
* @see https://ensnode.io/docs/reference/terminology#interpreted-label
|
|
962
|
+
* @see https://ensnode.io/docs/reference/terminology#interpreted-name
|
|
963
|
+
*
|
|
964
|
+
* That is,
|
|
965
|
+
* a) all Labels stored and returned by ENSIndexer will be Interpreted Labels, which are either:
|
|
966
|
+
* i. normalized, or
|
|
967
|
+
* ii. represented as an Encoded LabelHash of the Literal Label value found onchain, and
|
|
968
|
+
* b) all Names stored and returned by ENSIndexer will be Interpreted Names, which are exclusively
|
|
969
|
+
* composed of Interpreted Labels.
|
|
970
|
+
*/
|
|
971
|
+
isSubgraphCompatible: boolean;
|
|
972
|
+
/**
|
|
973
|
+
* Version info about ENSIndexer.
|
|
974
|
+
*/
|
|
975
|
+
versionInfo: ENSIndexerVersionInfo;
|
|
1002
976
|
}
|
|
977
|
+
|
|
978
|
+
type SerializedIndexedChainIds = Array<ChainId>;
|
|
1003
979
|
/**
|
|
1004
|
-
* Serialized representation of {@link
|
|
980
|
+
* Serialized representation of {@link ENSIndexerPublicConfig}
|
|
1005
981
|
*/
|
|
1006
|
-
interface
|
|
1007
|
-
|
|
982
|
+
interface SerializedENSIndexerPublicConfig extends Omit<ENSIndexerPublicConfig, "indexedChainIds"> {
|
|
983
|
+
/**
|
|
984
|
+
* Array representation of {@link ENSIndexerPublicConfig.indexedChainIds}.
|
|
985
|
+
*/
|
|
986
|
+
indexedChainIds: ChainId[];
|
|
1008
987
|
}
|
|
1009
988
|
/**
|
|
1010
|
-
* Serialized representation of {@link
|
|
989
|
+
* Serialized representation of {@link ENSIndexerVersionInfo}
|
|
1011
990
|
*/
|
|
1012
|
-
type
|
|
1013
|
-
|
|
1014
|
-
id: CurrencyId;
|
|
1015
|
-
name: string;
|
|
1016
|
-
decimals: number;
|
|
1017
|
-
}
|
|
991
|
+
type SerializedENSIndexerVersionInfo = ENSIndexerVersionInfo;
|
|
992
|
+
|
|
1018
993
|
/**
|
|
1019
|
-
*
|
|
994
|
+
* Serialize a {@link ENSIndexerPublicConfig} object.
|
|
1020
995
|
*/
|
|
1021
|
-
declare function
|
|
996
|
+
declare function deserializeENSIndexerPublicConfig(maybeConfig: SerializedENSIndexerPublicConfig, valueLabel?: string): ENSIndexerPublicConfig;
|
|
997
|
+
|
|
1022
998
|
/**
|
|
1023
|
-
*
|
|
999
|
+
* Determines if the provided `config` results in indexing behavior compatible with the legacy ENS
|
|
1000
|
+
* Subgraph.
|
|
1001
|
+
*
|
|
1002
|
+
* @see https://ensnode.io/docs/concepts/what-is-the-ens-subgraph/
|
|
1024
1003
|
*/
|
|
1025
|
-
declare function
|
|
1004
|
+
declare function isSubgraphCompatible(config: Pick<ENSIndexerPublicConfig, "namespace" | "plugins" | "labelSet">): boolean;
|
|
1005
|
+
|
|
1026
1006
|
/**
|
|
1027
|
-
*
|
|
1007
|
+
* Converts a Labelhash to bytes, with validation
|
|
1008
|
+
* @param labelHash The Labelhash to convert
|
|
1009
|
+
* @returns A ByteArray containing the bytes
|
|
1010
|
+
* @throws Error if `labelHash` is not a valid 32-byte hex string
|
|
1028
1011
|
*/
|
|
1029
|
-
declare function
|
|
1012
|
+
declare function labelHashToBytes(labelHash: LabelHash): ByteArray;
|
|
1013
|
+
|
|
1030
1014
|
/**
|
|
1031
|
-
*
|
|
1015
|
+
* Builds a valid LabelSetId from a string.
|
|
1016
|
+
* @param maybeLabelSetId - The string to validate and convert to a LabelSetId.
|
|
1017
|
+
* @returns A valid LabelSetId.
|
|
1018
|
+
* @throws If the input string is not a valid LabelSetId.
|
|
1032
1019
|
*/
|
|
1033
|
-
declare function
|
|
1020
|
+
declare function buildLabelSetId(maybeLabelSetId: string): LabelSetId;
|
|
1034
1021
|
/**
|
|
1035
|
-
*
|
|
1022
|
+
* Builds a valid LabelSetVersion from a number or string.
|
|
1023
|
+
* @param maybeLabelSetVersion - The number or string to validate and convert to a LabelSetVersion.
|
|
1024
|
+
* @returns A valid LabelSetVersion.
|
|
1025
|
+
* @throws If the input is not a valid LabelSetVersion.
|
|
1036
1026
|
*/
|
|
1037
|
-
declare function
|
|
1027
|
+
declare function buildLabelSetVersion(maybeLabelSetVersion: number | string): LabelSetVersion;
|
|
1038
1028
|
/**
|
|
1039
|
-
*
|
|
1029
|
+
* Builds an EnsRainbowClientLabelSet.
|
|
1030
|
+
* @param labelSetId - The label set ID.
|
|
1031
|
+
* @param labelSetVersion - The label set version.
|
|
1032
|
+
* @returns A valid EnsRainbowClientLabelSet object.
|
|
1033
|
+
* @throws If `labelSetVersion` is defined without `labelSetId`.
|
|
1040
1034
|
*/
|
|
1041
|
-
declare function
|
|
1035
|
+
declare function buildEnsRainbowClientLabelSet(labelSetId?: LabelSetId, labelSetVersion?: LabelSetVersion): EnsRainbowClientLabelSet;
|
|
1042
1036
|
/**
|
|
1043
|
-
*
|
|
1044
|
-
*
|
|
1045
|
-
* @param
|
|
1046
|
-
* @
|
|
1047
|
-
* @throws if not all prices have the same currency.
|
|
1037
|
+
* Validates that the server's label set is compatible with the client's requested label set.
|
|
1038
|
+
* @param serverSet - The label set provided by the server.
|
|
1039
|
+
* @param clientSet - The label set requested by the client.
|
|
1040
|
+
* @throws If the server set is not compatible with the client set.
|
|
1048
1041
|
*/
|
|
1049
|
-
declare function
|
|
1042
|
+
declare function validateSupportedLabelSetAndVersion(serverSet: EnsRainbowServerLabelSet, clientSet: EnsRainbowClientLabelSet): void;
|
|
1050
1043
|
|
|
1051
1044
|
/**
|
|
1052
|
-
*
|
|
1053
|
-
*
|
|
1054
|
-
*
|
|
1055
|
-
*
|
|
1056
|
-
* where it may or may not actually be defined for the given namespace and datasource.
|
|
1057
|
-
*
|
|
1058
|
-
* @param namespaceId - The ENSNamespace identifier (e.g. 'mainnet', 'sepolia', 'ens-test-env')
|
|
1059
|
-
* @param datasourceName - The name of the Datasource to search for contractName in
|
|
1060
|
-
* @param contractName - The name of the contract to retrieve
|
|
1061
|
-
* @returns The AccountId of the contract with the given namespace, datasource,
|
|
1062
|
-
* and contract name, or undefined if it is not found or is not a single AccountId
|
|
1063
|
-
*/
|
|
1064
|
-
declare const maybeGetDatasourceContract: <N extends ENSNamespaceId, D extends DatasourceName, C extends string>(namespaceId: N, datasourceName: D, contractName: C) => AccountId | undefined;
|
|
1065
|
-
/**
|
|
1066
|
-
* Gets the AccountId for the contract in the specified namespace, datasource, and
|
|
1067
|
-
* contract name, or throws an error if it is not defined or is not a single AccountId.
|
|
1068
|
-
*
|
|
1069
|
-
* @param namespaceId - The ENSNamespace identifier (e.g. 'mainnet', 'sepolia', 'ens-test-env')
|
|
1070
|
-
* @param datasourceName - The name of the Datasource to search for contractName in
|
|
1071
|
-
* @param contractName - The name of the contract to retrieve
|
|
1072
|
-
* @returns The AccountId of the contract with the given namespace, datasource,
|
|
1073
|
-
* and contract name
|
|
1074
|
-
* @throws Error if the contract is not found or is not a single AccountId
|
|
1075
|
-
*/
|
|
1076
|
-
declare const getDatasourceContract: (namespaceId: ENSNamespaceId, datasourceName: DatasourceName, contractName: string) => AccountId;
|
|
1077
|
-
/**
|
|
1078
|
-
* Makes a comparator fn for `b` against the contract described by `namespace`, `datasourceName`, and `contractName`.
|
|
1045
|
+
* Parses a string into a non-negative integer.
|
|
1046
|
+
* @param input The string to parse
|
|
1047
|
+
* @returns The parsed non-negative integer
|
|
1048
|
+
* @throws Error if the input is not a valid non-negative integer
|
|
1079
1049
|
*/
|
|
1080
|
-
declare
|
|
1050
|
+
declare function parseNonNegativeInteger(maybeNumber: string): number;
|
|
1081
1051
|
|
|
1082
1052
|
/**
|
|
1083
|
-
*
|
|
1053
|
+
* Serializes a {@link ChainConfig} object.
|
|
1084
1054
|
*/
|
|
1085
|
-
declare function
|
|
1055
|
+
declare function serializeIndexedChainIds(indexedChainIds: Set<ChainId>): SerializedIndexedChainIds;
|
|
1086
1056
|
/**
|
|
1087
|
-
*
|
|
1057
|
+
* Serialize a {@link ENSIndexerPublicConfig} object.
|
|
1088
1058
|
*/
|
|
1089
|
-
declare function
|
|
1059
|
+
declare function serializeENSIndexerPublicConfig(config: ENSIndexerPublicConfig): SerializedENSIndexerPublicConfig;
|
|
1090
1060
|
|
|
1091
1061
|
/**
|
|
1092
1062
|
* Serialized representation of {@link ChainId}.
|
|
@@ -1121,1679 +1091,1154 @@ type AccountIdString = string;
|
|
|
1121
1091
|
*/
|
|
1122
1092
|
type AssetIdString = string;
|
|
1123
1093
|
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
declare
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1094
|
+
/**
|
|
1095
|
+
* The type of indexing configuration for a chain.
|
|
1096
|
+
*/
|
|
1097
|
+
declare const ChainIndexingConfigTypeIds: {
|
|
1098
|
+
/**
|
|
1099
|
+
* Represents that indexing of the chain should be performed for an indefinite range.
|
|
1100
|
+
*/
|
|
1101
|
+
readonly Indefinite: "indefinite";
|
|
1102
|
+
/**
|
|
1103
|
+
* Represents that indexing of the chain should be performed for a definite range.
|
|
1104
|
+
*/
|
|
1105
|
+
readonly Definite: "definite";
|
|
1132
1106
|
};
|
|
1133
|
-
declare function deserializeBlockRef(maybeBlockRef: Partial<BlockRef>, valueLabel?: string): BlockRef;
|
|
1134
|
-
declare function deserializeDuration(maybeDuration: unknown, valueLabel?: string): Duration;
|
|
1135
|
-
declare function parseAccountId(maybeAccountId: unknown, valueLabel?: string): AccountId;
|
|
1136
|
-
|
|
1137
1107
|
/**
|
|
1138
|
-
*
|
|
1108
|
+
* The derived string union of possible {@link ChainIndexingConfigTypeIds}.
|
|
1139
1109
|
*/
|
|
1140
|
-
|
|
1141
|
-
|
|
1110
|
+
type ChainIndexingConfigTypeId = (typeof ChainIndexingConfigTypeIds)[keyof typeof ChainIndexingConfigTypeIds];
|
|
1142
1111
|
/**
|
|
1143
|
-
*
|
|
1144
|
-
*
|
|
1145
|
-
* The interpreted record value is either:
|
|
1146
|
-
* a) null, representing a non-existant or deletion of the record, or
|
|
1147
|
-
* b) a normalized, non-empty-string Name.
|
|
1112
|
+
* Chain indexing config for a chain whose indexing config `configType` is
|
|
1113
|
+
* {@link ChainIndexingConfigTypeIds.Indefinite}.
|
|
1148
1114
|
*
|
|
1149
|
-
*
|
|
1150
|
-
*
|
|
1115
|
+
* Invariants:
|
|
1116
|
+
* - `configType` is always `ChainIndexingConfigTypeIds.Indefinite`.
|
|
1151
1117
|
*/
|
|
1152
|
-
|
|
1118
|
+
interface ChainIndexingConfigIndefinite {
|
|
1119
|
+
/**
|
|
1120
|
+
* The type of chain indexing config.
|
|
1121
|
+
*/
|
|
1122
|
+
configType: typeof ChainIndexingConfigTypeIds.Indefinite;
|
|
1123
|
+
/**
|
|
1124
|
+
* A {@link BlockRef} to the block where indexing of the chain should start.
|
|
1125
|
+
*/
|
|
1126
|
+
startBlock: BlockRef;
|
|
1127
|
+
}
|
|
1153
1128
|
/**
|
|
1154
|
-
*
|
|
1129
|
+
* Chain indexing config for a chain whose indexing config `configType` is
|
|
1130
|
+
* {@link ChainIndexingConfigTypeIds.Definite}.
|
|
1155
1131
|
*
|
|
1156
|
-
*
|
|
1157
|
-
*
|
|
1158
|
-
*
|
|
1159
|
-
* ii. empty string
|
|
1160
|
-
* iii. empty hex (0x)
|
|
1161
|
-
* iv. zeroAddress
|
|
1162
|
-
* b) an address record value that
|
|
1163
|
-
* i. does not contain null bytes
|
|
1164
|
-
* ii. (if is an EVM address) is lowercase
|
|
1165
|
-
*
|
|
1166
|
-
* @param value - The address record value to interpret.
|
|
1167
|
-
* @returns The interpreted address string or null if deleted.
|
|
1132
|
+
* Invariants:
|
|
1133
|
+
* - `configType` is always `ChainIndexingConfigTypeIds.Definite`.
|
|
1134
|
+
* - `startBlock` is always before or the same as `endBlock`.
|
|
1168
1135
|
*/
|
|
1169
|
-
|
|
1136
|
+
interface ChainIndexingConfigDefinite {
|
|
1137
|
+
/**
|
|
1138
|
+
* The type of chain indexing config.
|
|
1139
|
+
*/
|
|
1140
|
+
configType: typeof ChainIndexingConfigTypeIds.Definite;
|
|
1141
|
+
/**
|
|
1142
|
+
* A {@link BlockRef} to the block where indexing of the chain should start.
|
|
1143
|
+
*/
|
|
1144
|
+
startBlock: BlockRef;
|
|
1145
|
+
/**
|
|
1146
|
+
* A {@link BlockRef} to the block where indexing of the chain should end.
|
|
1147
|
+
*/
|
|
1148
|
+
endBlock: BlockRef;
|
|
1149
|
+
}
|
|
1170
1150
|
/**
|
|
1171
|
-
*
|
|
1172
|
-
*
|
|
1173
|
-
* The interpreted text record key is either:
|
|
1174
|
-
* a) null, representing a text record key that should be ignored, or
|
|
1175
|
-
* i. contains null bytes
|
|
1176
|
-
* ii. empty string
|
|
1177
|
-
* b) a text record key that
|
|
1178
|
-
* i. does not contain null bytes
|
|
1151
|
+
* Indexing configuration for a chain.
|
|
1179
1152
|
*
|
|
1180
|
-
*
|
|
1181
|
-
*
|
|
1153
|
+
* Use the `configType` field to determine the specific type interpretation
|
|
1154
|
+
* at runtime.
|
|
1182
1155
|
*/
|
|
1183
|
-
|
|
1156
|
+
type ChainIndexingConfig = ChainIndexingConfigIndefinite | ChainIndexingConfigDefinite;
|
|
1184
1157
|
/**
|
|
1185
|
-
*
|
|
1186
|
-
*
|
|
1187
|
-
* The interpreted record value is either:
|
|
1188
|
-
* a) null, representing a non-existant or deletion of the record, or
|
|
1189
|
-
* i. contains null bytes
|
|
1190
|
-
* ii. empty string
|
|
1191
|
-
* b) a text record value that
|
|
1192
|
-
* i. does not contain null bytes
|
|
1193
|
-
*
|
|
1194
|
-
* @param value - The text record value to interpret.
|
|
1195
|
-
* @returns The interpreted text string or null if deleted.
|
|
1158
|
+
* The status of indexing a chain at the time an indexing status snapshot
|
|
1159
|
+
* is captured.
|
|
1196
1160
|
*/
|
|
1197
|
-
declare
|
|
1198
|
-
|
|
1161
|
+
declare const ChainIndexingStatusIds: {
|
|
1162
|
+
/**
|
|
1163
|
+
* Represents that indexing of the chain is not ready to begin yet because:
|
|
1164
|
+
* - ENSIndexer is in its initialization phase and the data to build a
|
|
1165
|
+
* "true" {@link ChainIndexingSnapshot} for the chain is still being loaded; or
|
|
1166
|
+
* - ENSIndexer is using an omnichain indexing strategy and the
|
|
1167
|
+
* `omnichainIndexingCursor` is <= `config.startBlock.timestamp` for the chain's
|
|
1168
|
+
* {@link ChainIndexingSnapshot}.
|
|
1169
|
+
*/
|
|
1170
|
+
readonly Queued: "chain-queued";
|
|
1171
|
+
/**
|
|
1172
|
+
* Represents that indexing of the chain is in progress and under a special
|
|
1173
|
+
* "backfill" phase that optimizes for accelerated indexing until reaching the
|
|
1174
|
+
* "fixed target" `backfillEndBlock`.
|
|
1175
|
+
*/
|
|
1176
|
+
readonly Backfill: "chain-backfill";
|
|
1177
|
+
/**
|
|
1178
|
+
* Represents that the "backfill" phase of indexing the chain is completed
|
|
1179
|
+
* and that the chain is configured to be indexed for an indefinite range.
|
|
1180
|
+
* Therefore, indexing of the chain remains indefinitely in progress where
|
|
1181
|
+
* ENSIndexer will continuously work to discover and index new blocks as they
|
|
1182
|
+
* are added to the chain across time.
|
|
1183
|
+
*/
|
|
1184
|
+
readonly Following: "chain-following";
|
|
1185
|
+
/**
|
|
1186
|
+
* Represents that indexing of the chain is completed as the chain is configured
|
|
1187
|
+
* to be indexed for a definite range and the indexing of all blocks through
|
|
1188
|
+
* that definite range is completed.
|
|
1189
|
+
*/
|
|
1190
|
+
readonly Completed: "chain-completed";
|
|
1191
|
+
};
|
|
1199
1192
|
/**
|
|
1200
|
-
*
|
|
1201
|
-
*
|
|
1202
|
-
* Remember that contracts that operate in the context of a Managed Name frequently store and operate
|
|
1203
|
-
* over _LabelHashes_ that represent a direct subname of a Managed Name. These contracts also frequently
|
|
1204
|
-
* implement ERC721 or ERC1155 to represent ownership of these Names. As such, to construct the
|
|
1205
|
-
* ERC721/ERC1155 tokenId, they may encode the direct subnames's LabelHash as a uint256.
|
|
1206
|
-
*
|
|
1207
|
-
* This is true for the ENSv1 BaseRegistrar, RegistrarControllers, as well as any
|
|
1208
|
-
* contracts forked from it (which includes Basenames' and Lineanames' implementations).
|
|
1209
|
-
*
|
|
1210
|
-
* So, in order to turn the tokenId into a LabelHash, we perform the opposite operation, decoding
|
|
1211
|
-
* from a uint256 into a Hex (of size 32) and cast it as our semantic {@link LabelHash} type.
|
|
1212
|
-
*
|
|
1213
|
-
* @see https://github.com/ensdomains/ens-contracts/blob/db613bc/contracts/ethregistrar/ETHRegistrarController.sol#L215
|
|
1214
|
-
* @see https://github.com/base/basenames/blob/1b5c1ad/src/L2/RegistrarController.sol#L488
|
|
1215
|
-
* @see https://github.com/Consensys/linea-ens/blob/3a4f02f/packages/linea-ens-contracts/contracts/ethregistrar/ETHRegistrarController.sol#L447
|
|
1193
|
+
* The derived string union of possible {@link ChainIndexingStatusIds}.
|
|
1216
1194
|
*/
|
|
1217
|
-
|
|
1195
|
+
type ChainIndexingStatusId = (typeof ChainIndexingStatusIds)[keyof typeof ChainIndexingStatusIds];
|
|
1218
1196
|
/**
|
|
1219
|
-
*
|
|
1220
|
-
*
|
|
1221
|
-
* Contracts in the ENSv1 ecosystem frequently implement ERC721 or ERC1155 to represent
|
|
1222
|
-
* ownership of a Domain. As such, to construct the ERC721/ERC1155 tokenId, they may encode the
|
|
1223
|
-
* domain's {@link Node} as a uint256.
|
|
1224
|
-
*
|
|
1225
|
-
* This is true for the ENSv1 NameWrapper, as well as any contracts forked from it (which includes
|
|
1226
|
-
* Lineanames' implementation).
|
|
1227
|
-
*
|
|
1228
|
-
* So, in order to turn the tokenId into a Node, we perform the opposite operation, decoding
|
|
1229
|
-
* from a uint256 into a Hex (of size 32) and cast it as our semantic {@link Node} type.
|
|
1197
|
+
* Chain indexing status snapshot for a chain whose `chainStatus` is
|
|
1198
|
+
* {@link ChainIndexingStatusIds.Queued}.
|
|
1230
1199
|
*
|
|
1231
|
-
*
|
|
1200
|
+
* Invariants:
|
|
1201
|
+
* - `chainStatus` is always {@link ChainIndexingStatusIds.Queued}.
|
|
1232
1202
|
*/
|
|
1233
|
-
|
|
1234
|
-
|
|
1203
|
+
interface ChainIndexingStatusSnapshotQueued {
|
|
1204
|
+
/**
|
|
1205
|
+
* The status of indexing the chain at the time the indexing status snapshot
|
|
1206
|
+
* was captured.
|
|
1207
|
+
*/
|
|
1208
|
+
chainStatus: typeof ChainIndexingStatusIds.Queued;
|
|
1209
|
+
/**
|
|
1210
|
+
* The indexing configuration of the chain.
|
|
1211
|
+
*/
|
|
1212
|
+
config: ChainIndexingConfig;
|
|
1213
|
+
}
|
|
1235
1214
|
/**
|
|
1236
|
-
*
|
|
1237
|
-
*
|
|
1238
|
-
* @see https://ensnode.io/docs/reference/terminology#literal-label
|
|
1239
|
-
* @see https://ensnode.io/docs/reference/terminology#interpreted-label
|
|
1215
|
+
* Chain indexing status snapshot for a chain whose `chainStatus` is
|
|
1216
|
+
* {@link ChainIndexingStatusIds.Backfill}.
|
|
1240
1217
|
*
|
|
1241
|
-
*
|
|
1242
|
-
*
|
|
1243
|
-
|
|
1244
|
-
declare function literalLabelToInterpretedLabel(label: LiteralLabel): InterpretedLabel;
|
|
1245
|
-
/**
|
|
1246
|
-
* Interprets an ordered list of Literal Labels, producing an Interpreted Name.
|
|
1218
|
+
* During a backfill, special performance optimizations are applied to
|
|
1219
|
+
* index all blocks between `config.startBlock` and `backfillEndBlock`
|
|
1220
|
+
* as fast as possible.
|
|
1247
1221
|
*
|
|
1248
|
-
* Note
|
|
1249
|
-
*
|
|
1222
|
+
* Note how `backfillEndBlock` is a "fixed target" that does not change during
|
|
1223
|
+
* the lifetime of an ENSIndexer process instance:
|
|
1224
|
+
* - If the `config` is {@link ChainIndexingConfigDefinite}:
|
|
1225
|
+
* `backfillEndBlock` is always the same as `config.endBlock`.
|
|
1226
|
+
* - If the `config` is {@link ChainIndexingConfigIndefinite}:
|
|
1227
|
+
* `backfillEndBlock` is a {@link BlockRef} to what was the latest block on the
|
|
1228
|
+
* chain when the ENSIndexer process was performing its initialization. Note how
|
|
1229
|
+
* this means that if the backfill process takes X hours to complete, because the
|
|
1230
|
+
* `backfillEndBlock` is a "fixed target", when `chainStatus` transitions to
|
|
1231
|
+
* {@link ChainIndexingStatusIds.Following} the chain will be X hours behind
|
|
1232
|
+
* "realtime" indexing.
|
|
1250
1233
|
*
|
|
1251
|
-
*
|
|
1252
|
-
*
|
|
1253
|
-
*
|
|
1234
|
+
* When `latestIndexedBlock` reaches `backfillEndBlock` the backfill is complete.
|
|
1235
|
+
* The moment backfill is complete the `chainStatus` may not immediately transition.
|
|
1236
|
+
* Instead, internal processing is completed for a period of time while
|
|
1237
|
+
* `chainStatus` remains {@link ChainIndexingStatusIds.Backfill}. After this internal
|
|
1238
|
+
* processing is completed `chainStatus` will transition:
|
|
1239
|
+
* - to {@link ChainIndexingStatusIds.Following} if the `config` is
|
|
1240
|
+
* {@link ChainIndexingConfigIndefinite}.
|
|
1241
|
+
* - to {@link ChainIndexingStatusIds.Completed} if the `config` is
|
|
1242
|
+
* {@link ChainIndexingConfigDefinite}.
|
|
1254
1243
|
*
|
|
1255
|
-
*
|
|
1256
|
-
* @
|
|
1244
|
+
* Invariants:
|
|
1245
|
+
* - `chainStatus` is always {@link ChainIndexingStatusIds.Backfill}.
|
|
1246
|
+
* - `config.startBlock` is always before or the same as `latestIndexedBlock`
|
|
1247
|
+
* - `config.endBlock` is always the same as `backfillEndBlock` if and only if
|
|
1248
|
+
* the config is {@link ChainIndexingConfigDefinite}.
|
|
1249
|
+
* - `latestIndexedBlock` is always before or the same as `backfillEndBlock`
|
|
1257
1250
|
*/
|
|
1258
|
-
|
|
1251
|
+
interface ChainIndexingStatusSnapshotBackfill {
|
|
1252
|
+
/**
|
|
1253
|
+
* The status of indexing the chain at the time the indexing status snapshot
|
|
1254
|
+
* was captured.
|
|
1255
|
+
*/
|
|
1256
|
+
chainStatus: typeof ChainIndexingStatusIds.Backfill;
|
|
1257
|
+
/**
|
|
1258
|
+
* The indexing configuration of the chain.
|
|
1259
|
+
*/
|
|
1260
|
+
config: ChainIndexingConfig;
|
|
1261
|
+
/**
|
|
1262
|
+
* A {@link BlockRef} to the block that was most recently indexed as of the time the
|
|
1263
|
+
* indexing status snapshot was captured.
|
|
1264
|
+
*/
|
|
1265
|
+
latestIndexedBlock: BlockRef;
|
|
1266
|
+
/**
|
|
1267
|
+
* A {@link BlockRef} to the block where the backfill will end.
|
|
1268
|
+
*/
|
|
1269
|
+
backfillEndBlock: BlockRef;
|
|
1270
|
+
}
|
|
1259
1271
|
/**
|
|
1260
|
-
*
|
|
1272
|
+
* Chain indexing status snapshot for a chain whose `chainStatus` is
|
|
1273
|
+
* {@link ChainIndexingStatusIds.Following}.
|
|
1261
1274
|
*
|
|
1262
|
-
*
|
|
1263
|
-
* @
|
|
1275
|
+
* Invariants:
|
|
1276
|
+
* - `chainStatus` is always {@link ChainIndexingStatusIds.Following}.
|
|
1277
|
+
* - `config` is always {@link ChainIndexingConfigIndefinite}
|
|
1278
|
+
* - `config.startBlock` is always before or the same as `latestIndexedBlock`
|
|
1279
|
+
* - `latestIndexedBlock` is always before or the same as `latestKnownBlock`
|
|
1264
1280
|
*/
|
|
1265
|
-
|
|
1281
|
+
interface ChainIndexingStatusSnapshotFollowing {
|
|
1282
|
+
/**
|
|
1283
|
+
* The status of indexing the chain at the time the indexing status snapshot
|
|
1284
|
+
* was captured.
|
|
1285
|
+
*/
|
|
1286
|
+
chainStatus: typeof ChainIndexingStatusIds.Following;
|
|
1287
|
+
/**
|
|
1288
|
+
* The indexing configuration of the chain.
|
|
1289
|
+
*/
|
|
1290
|
+
config: ChainIndexingConfigIndefinite;
|
|
1291
|
+
/**
|
|
1292
|
+
* A {@link BlockRef} to the block that was most recently indexed as of the time the
|
|
1293
|
+
* indexing status snapshot was captured.
|
|
1294
|
+
*/
|
|
1295
|
+
latestIndexedBlock: BlockRef;
|
|
1296
|
+
/**
|
|
1297
|
+
* A {@link BlockRef} to the "highest" block that has been discovered by RPCs
|
|
1298
|
+
* and stored in the RPC cache as of the time the indexing status snapshot was
|
|
1299
|
+
* captured.
|
|
1300
|
+
*/
|
|
1301
|
+
latestKnownBlock: BlockRef;
|
|
1302
|
+
}
|
|
1266
1303
|
/**
|
|
1267
|
-
*
|
|
1304
|
+
* Chain indexing status snapshot for a chain whose `chainStatus` is
|
|
1305
|
+
* {@link ChainIndexingStatusIds.Completed}.
|
|
1268
1306
|
*
|
|
1269
|
-
*
|
|
1270
|
-
*
|
|
1271
|
-
*
|
|
1307
|
+
* After the backfill of a chain is completed, if the chain was configured
|
|
1308
|
+
* to be indexed for a definite range, the chain indexing status will transition to
|
|
1309
|
+
* {@link ChainIndexingStatusIds.Completed}.
|
|
1272
1310
|
*
|
|
1273
|
-
*
|
|
1274
|
-
* @
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
* Converts an Interpreted Name into a list of Interpreted Labels.
|
|
1311
|
+
* Invariants:
|
|
1312
|
+
* - `chainStatus` is always {@link ChainIndexingStatusIds.Completed}.
|
|
1313
|
+
* - `config` is always {@link ChainIndexingConfigDefinite}
|
|
1314
|
+
* - `config.startBlock` is always before or the same as `latestIndexedBlock`
|
|
1315
|
+
* - `latestIndexedBlock` is always the same as `config.endBlock`.
|
|
1279
1316
|
*/
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
*/
|
|
1297
|
-
declare const labelhashLiteralLabel: (label: LiteralLabel) => LabelHash;
|
|
1298
|
-
|
|
1299
|
-
declare const hasNullByte: (value: string) => boolean;
|
|
1300
|
-
declare const stripNullBytes: (value: string) => string;
|
|
1301
|
-
|
|
1317
|
+
interface ChainIndexingStatusSnapshotCompleted {
|
|
1318
|
+
/**
|
|
1319
|
+
* The status of indexing the chain at the time the indexing status snapshot
|
|
1320
|
+
* was captured.
|
|
1321
|
+
*/
|
|
1322
|
+
chainStatus: typeof ChainIndexingStatusIds.Completed;
|
|
1323
|
+
/**
|
|
1324
|
+
* The indexing configuration of the chain.
|
|
1325
|
+
*/
|
|
1326
|
+
config: ChainIndexingConfigDefinite;
|
|
1327
|
+
/**
|
|
1328
|
+
* A {@link BlockRef} to the block that was most recently indexed as of the time the
|
|
1329
|
+
* indexing status snapshot was captured.
|
|
1330
|
+
*/
|
|
1331
|
+
latestIndexedBlock: BlockRef;
|
|
1332
|
+
}
|
|
1302
1333
|
/**
|
|
1303
|
-
*
|
|
1334
|
+
* Indexing status snapshot for a single chain.
|
|
1304
1335
|
*
|
|
1305
|
-
*
|
|
1306
|
-
*
|
|
1307
|
-
*/
|
|
1308
|
-
declare function bigIntToNumber(n: bigint): number;
|
|
1309
|
-
|
|
1310
|
-
/**
|
|
1311
|
-
* Gets the AccountId representing the ENSv1 Registry in the selected `namespace`.
|
|
1312
|
-
*/
|
|
1313
|
-
declare const getENSv1Registry: (namespace: ENSNamespaceId) => AccountId;
|
|
1314
|
-
/**
|
|
1315
|
-
* Determines whether `contract` is the ENSv1 Registry in `namespace`.
|
|
1316
|
-
*/
|
|
1317
|
-
declare const isENSv1Registry: (namespace: ENSNamespaceId, contract: AccountId) => boolean;
|
|
1318
|
-
/**
|
|
1319
|
-
* Gets the AccountId representing the ENSv2 Root Registry in the selected `namespace`.
|
|
1320
|
-
*/
|
|
1321
|
-
declare const getENSv2RootRegistry: (namespace: ENSNamespaceId) => AccountId;
|
|
1322
|
-
/**
|
|
1323
|
-
* Gets the RegistryId representing the ENSv2 Root Registry in the selected `namespace`.
|
|
1324
|
-
*/
|
|
1325
|
-
declare const getENSv2RootRegistryId: (namespace: ENSNamespaceId) => RegistryId;
|
|
1326
|
-
/**
|
|
1327
|
-
* Determines whether `contract` is the ENSv2 Root Registry in `namespace`.
|
|
1328
|
-
*/
|
|
1329
|
-
declare const isENSv2RootRegistry: (namespace: ENSNamespaceId, contract: AccountId) => boolean;
|
|
1330
|
-
|
|
1331
|
-
/**
|
|
1332
|
-
* Serializes a {@link ChainId} value into its string representation.
|
|
1333
|
-
*/
|
|
1334
|
-
declare function serializeChainId(chainId: ChainId): ChainIdString;
|
|
1335
|
-
/**
|
|
1336
|
-
* Serializes a {@link Datetime} value into its string representation.
|
|
1337
|
-
*/
|
|
1338
|
-
declare function serializeDatetime(datetime: Datetime): DatetimeISO8601;
|
|
1339
|
-
/**
|
|
1340
|
-
* Serializes a {@link URL} value into its string representation.
|
|
1336
|
+
* Use the `chainStatus` field to determine the specific type interpretation
|
|
1337
|
+
* at runtime.
|
|
1341
1338
|
*/
|
|
1342
|
-
|
|
1339
|
+
type ChainIndexingStatusSnapshot = ChainIndexingStatusSnapshotQueued | ChainIndexingStatusSnapshotBackfill | ChainIndexingStatusSnapshotFollowing | ChainIndexingStatusSnapshotCompleted;
|
|
1343
1340
|
/**
|
|
1344
|
-
*
|
|
1341
|
+
* The status of omnichain indexing at the time an omnichain indexing status
|
|
1342
|
+
* snapshot is captured.
|
|
1345
1343
|
*/
|
|
1346
|
-
declare
|
|
1344
|
+
declare const OmnichainIndexingStatusIds: {
|
|
1345
|
+
/**
|
|
1346
|
+
* Represents that omnichain indexing is not ready to begin yet because
|
|
1347
|
+
* ENSIndexer is in its initialization phase and the data to build a "true"
|
|
1348
|
+
* {@link OmnichainIndexingStatusSnapshot} is still being loaded.
|
|
1349
|
+
*/
|
|
1350
|
+
readonly Unstarted: "omnichain-unstarted";
|
|
1351
|
+
/**
|
|
1352
|
+
* Represents that omnichain indexing is in an overall "backfill" status because
|
|
1353
|
+
* - At least one indexed chain has a `chainStatus` of
|
|
1354
|
+
* {@link ChainIndexingStatusIds.Backfill}; and
|
|
1355
|
+
* - No indexed chain has a `chainStatus` of {@link ChainIndexingStatusIds.Following}.
|
|
1356
|
+
*/
|
|
1357
|
+
readonly Backfill: "omnichain-backfill";
|
|
1358
|
+
/**
|
|
1359
|
+
* Represents that omnichain indexing is in an overall "following" status because
|
|
1360
|
+
* at least one indexed chain has a `chainStatus` of
|
|
1361
|
+
* {@link ChainIndexingStatusIds.Following}.
|
|
1362
|
+
*/
|
|
1363
|
+
readonly Following: "omnichain-following";
|
|
1364
|
+
/**
|
|
1365
|
+
* Represents that omnichain indexing has completed because all indexed chains have
|
|
1366
|
+
* a `chainStatus` of {@link ChainIndexingStatusIds.Completed}.
|
|
1367
|
+
*/
|
|
1368
|
+
readonly Completed: "omnichain-completed";
|
|
1369
|
+
};
|
|
1347
1370
|
/**
|
|
1348
|
-
*
|
|
1371
|
+
* The derived string union of possible {@link OmnichainIndexingStatusIds}.
|
|
1349
1372
|
*/
|
|
1350
|
-
|
|
1373
|
+
type OmnichainIndexingStatusId = (typeof OmnichainIndexingStatusIds)[keyof typeof OmnichainIndexingStatusIds];
|
|
1351
1374
|
/**
|
|
1352
|
-
*
|
|
1353
|
-
*
|
|
1354
|
-
* Formatted as a fully lowercase CAIP-10 AccountId.
|
|
1375
|
+
* Omnichain indexing status snapshot when the overall `omnichainStatus` is
|
|
1376
|
+
* {@link OmnichainIndexingStatusIds.Unstarted}.
|
|
1355
1377
|
*
|
|
1356
|
-
*
|
|
1378
|
+
* Invariants:
|
|
1379
|
+
* - `omnichainStatus` is always {@link OmnichainIndexingStatusIds.Unstarted}.
|
|
1380
|
+
* - `chains` is always a map to {@link ChainIndexingStatusSnapshotQueued} values exclusively.
|
|
1381
|
+
* - `omnichainIndexingCursor` is always < the `config.startBlock.timestamp` for all
|
|
1382
|
+
* chains with `chainStatus` of {@link ChainIndexingStatusIds.Queued}.
|
|
1357
1383
|
*/
|
|
1358
|
-
|
|
1384
|
+
interface OmnichainIndexingStatusSnapshotUnstarted {
|
|
1385
|
+
/**
|
|
1386
|
+
* The status of omnichain indexing.
|
|
1387
|
+
*/
|
|
1388
|
+
omnichainStatus: typeof OmnichainIndexingStatusIds.Unstarted;
|
|
1389
|
+
/**
|
|
1390
|
+
* The indexing status snapshot for each indexed chain.
|
|
1391
|
+
*/
|
|
1392
|
+
chains: Map<ChainId, ChainIndexingStatusSnapshotQueued>;
|
|
1393
|
+
/**
|
|
1394
|
+
* The timestamp of omnichain indexing progress across all indexed chains.
|
|
1395
|
+
*/
|
|
1396
|
+
omnichainIndexingCursor: UnixTimestamp;
|
|
1397
|
+
}
|
|
1359
1398
|
/**
|
|
1360
|
-
*
|
|
1361
|
-
*
|
|
1362
|
-
* Formatted as a fully lowercase CAIP-19 AssetId.
|
|
1399
|
+
* The range of {@link ChainIndexingSnapshot} types allowed when the
|
|
1400
|
+
* overall omnichain indexing status is {@link OmnichainIndexingStatusIds.Backfill}.
|
|
1363
1401
|
*
|
|
1364
|
-
* @
|
|
1365
|
-
|
|
1366
|
-
declare function formatAssetId({ assetNamespace, contract: { chainId, address }, tokenId, }: AssetId): AssetIdString;
|
|
1367
|
-
|
|
1368
|
-
declare function isHttpProtocol(url: URL): boolean;
|
|
1369
|
-
declare function isWebSocketProtocol(url: URL): boolean;
|
|
1370
|
-
|
|
1371
|
-
/**
|
|
1372
|
-
* A label set ID identifies a label set (see https://ensnode.io/ensrainbow/concepts/glossary#label-set for definition).
|
|
1373
|
-
* It is guaranteed to be 1 to 50 characters long and contain only lowercase letters (a-z)
|
|
1374
|
-
* and hyphens (-).
|
|
1402
|
+
* Note that this is all of the {@link ChainIndexingSnapshot} types with the exception
|
|
1403
|
+
* of {@link ChainIndexingStatusSnapshotFollowing}.
|
|
1375
1404
|
*/
|
|
1376
|
-
type
|
|
1405
|
+
type ChainIndexingStatusSnapshotForOmnichainIndexingStatusSnapshotBackfill = ChainIndexingStatusSnapshotQueued | ChainIndexingStatusSnapshotBackfill | ChainIndexingStatusSnapshotCompleted;
|
|
1377
1406
|
/**
|
|
1378
|
-
*
|
|
1379
|
-
*
|
|
1407
|
+
* Omnichain indexing status snapshot when the `omnichainStatus` is
|
|
1408
|
+
* {@link OmnichainIndexingStatusIds.Backfill}.
|
|
1380
1409
|
*
|
|
1381
|
-
*
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
*
|
|
1410
|
+
* Invariants:
|
|
1411
|
+
* - `omnichainStatus` is always {@link OmnichainIndexingStatusIds.Backfill}.
|
|
1412
|
+
* - `chains` is guaranteed to contain at least one chain with a `chainStatus` of
|
|
1413
|
+
* {@link ChainIndexingStatusIds.Backfill}.
|
|
1414
|
+
* - `chains` is guaranteed to not to contain any chain with a `chainStatus` of
|
|
1415
|
+
* {@link ChainIndexingStatusIds.Following}
|
|
1416
|
+
* - `omnichainIndexingCursor` is always < the `config.startBlock.timestamp` for all
|
|
1417
|
+
* chains with `chainStatus` of {@link ChainIndexingStatusIds.Queued}.
|
|
1418
|
+
* - `omnichainIndexingCursor` is always <= the `backfillEndBlock.timestamp` for all
|
|
1419
|
+
* chains with `chainStatus` of {@link ChainIndexingStatusIds.Backfill}.
|
|
1420
|
+
* - `omnichainIndexingCursor` is always >= the `latestIndexedBlock.timestamp` for all
|
|
1421
|
+
* chains with `chainStatus` of {@link ChainIndexingStatusIds.Completed}.
|
|
1422
|
+
* - `omnichainIndexingCursor` is always equal to the timestamp of the highest
|
|
1423
|
+
* `latestIndexedBlock` across all chains that have started indexing
|
|
1424
|
+
* (`chainStatus` is not {@link ChainIndexingStatusIds.Queued}).
|
|
1386
1425
|
*/
|
|
1387
|
-
interface
|
|
1426
|
+
interface OmnichainIndexingStatusSnapshotBackfill {
|
|
1388
1427
|
/**
|
|
1389
|
-
*
|
|
1390
|
-
* operations will validate the ENSRainbow server is using this labelSetId.
|
|
1391
|
-
* Required if `labelSetVersion` is defined.
|
|
1428
|
+
* The status of omnichain indexing.
|
|
1392
1429
|
*/
|
|
1393
|
-
|
|
1430
|
+
omnichainStatus: typeof OmnichainIndexingStatusIds.Backfill;
|
|
1394
1431
|
/**
|
|
1395
|
-
*
|
|
1396
|
-
* results across time even if the ENSRainbow server ingests label sets with greater versions
|
|
1397
|
-
* than this value. If provided, only labels from label sets with versions less than or equal to this
|
|
1398
|
-
* value will be returned. If not provided, the server will use the latest available version.
|
|
1399
|
-
* When `labelSetVersion` is defined, `labelSetId` must also be defined.
|
|
1432
|
+
* The indexing status snapshot for each indexed chain.
|
|
1400
1433
|
*/
|
|
1401
|
-
|
|
1434
|
+
chains: Map<ChainId, ChainIndexingStatusSnapshotForOmnichainIndexingStatusSnapshotBackfill>;
|
|
1435
|
+
/**
|
|
1436
|
+
* The timestamp of omnichain indexing progress across all indexed chains.
|
|
1437
|
+
*/
|
|
1438
|
+
omnichainIndexingCursor: UnixTimestamp;
|
|
1402
1439
|
}
|
|
1403
1440
|
/**
|
|
1404
|
-
*
|
|
1441
|
+
* Omnichain indexing status snapshot when the overall `omnichainStatus` is
|
|
1442
|
+
* {@link OmnichainIndexingStatusIds.Following}.
|
|
1443
|
+
*
|
|
1444
|
+
* Invariants:
|
|
1445
|
+
* - `omnichainStatus` is always {@link OmnichainIndexingStatusIds.Following}.
|
|
1446
|
+
* - `chains` is guaranteed to contain at least one chain with a `status` of
|
|
1447
|
+
* {@link ChainIndexingStatusIds.Following}.
|
|
1448
|
+
* - `omnichainIndexingCursor` is always < the `config.startBlock.timestamp` for all
|
|
1449
|
+
* chains with `chainStatus` of {@link ChainIndexingStatusIds.Queued}.
|
|
1450
|
+
* - `omnichainIndexingCursor` is always <= the `backfillEndBlock.timestamp` for all
|
|
1451
|
+
* chains with `chainStatus` of {@link ChainIndexingStatusIds.Backfill}.
|
|
1452
|
+
* - `omnichainIndexingCursor` is always >= the `latestIndexedBlock.timestamp` for all
|
|
1453
|
+
* chains with `chainStatus` of {@link ChainIndexingStatusIds.Completed}.
|
|
1454
|
+
* - `omnichainIndexingCursor` is always equal to the timestamp of the highest
|
|
1455
|
+
* `latestIndexedBlock` across all chains that have started indexing
|
|
1456
|
+
* (`chainStatus` is not {@link ChainIndexingStatusIds.Queued}).
|
|
1405
1457
|
*/
|
|
1406
|
-
interface
|
|
1458
|
+
interface OmnichainIndexingStatusSnapshotFollowing {
|
|
1407
1459
|
/**
|
|
1408
|
-
* The
|
|
1460
|
+
* The status of omnichain indexing.
|
|
1409
1461
|
*/
|
|
1410
|
-
|
|
1462
|
+
omnichainStatus: typeof OmnichainIndexingStatusIds.Following;
|
|
1411
1463
|
/**
|
|
1412
|
-
* The
|
|
1413
|
-
* label set ID. This represents the most recent version of the label set that the
|
|
1414
|
-
* server has ingested and can provide label healing results for.
|
|
1464
|
+
* The indexing status snapshot for each indexed chain.
|
|
1415
1465
|
*/
|
|
1416
|
-
|
|
1466
|
+
chains: Map<ChainId, ChainIndexingStatusSnapshot>;
|
|
1467
|
+
/**
|
|
1468
|
+
* The timestamp of omnichain indexing progress across all indexed chains.
|
|
1469
|
+
*/
|
|
1470
|
+
omnichainIndexingCursor: UnixTimestamp;
|
|
1417
1471
|
}
|
|
1418
|
-
|
|
1419
1472
|
/**
|
|
1420
|
-
*
|
|
1421
|
-
*
|
|
1473
|
+
* Omnichain indexing status snapshot when the overall `omnichainStatus` is
|
|
1474
|
+
* {@link OmnichainIndexingStatusIds.Completed}.
|
|
1475
|
+
*
|
|
1476
|
+
* Invariants:
|
|
1477
|
+
* - `omnichainStatus` is always {@link OmnichainIndexingStatusIds.Completed}.
|
|
1478
|
+
* - `chains` is always a map to {@link ChainIndexingStatusSnapshotCompleted} values exclusively.
|
|
1479
|
+
* - `omnichainIndexingCursor` is always equal to the highest
|
|
1480
|
+
* `latestIndexedBlock.timestamp` for all chains.
|
|
1422
1481
|
*/
|
|
1423
|
-
|
|
1424
|
-
Subgraph = "subgraph",
|
|
1425
|
-
Basenames = "basenames",
|
|
1426
|
-
Lineanames = "lineanames",
|
|
1427
|
-
ThreeDNS = "threedns",
|
|
1428
|
-
ProtocolAcceleration = "protocol-acceleration",
|
|
1429
|
-
Registrars = "registrars",
|
|
1430
|
-
TokenScope = "tokenscope",
|
|
1431
|
-
ENSv2 = "ensv2"
|
|
1432
|
-
}
|
|
1433
|
-
/**
|
|
1434
|
-
* Version info about ENSIndexer and its dependencies.
|
|
1435
|
-
*/
|
|
1436
|
-
interface ENSIndexerVersionInfo {
|
|
1437
|
-
/**
|
|
1438
|
-
* Node.js runtime version
|
|
1439
|
-
*
|
|
1440
|
-
* @see https://nodejs.org/en/about/previous-releases
|
|
1441
|
-
**/
|
|
1442
|
-
nodejs: string;
|
|
1443
|
-
/**
|
|
1444
|
-
* Ponder framework version
|
|
1445
|
-
*
|
|
1446
|
-
* @see https://www.npmjs.com/package/ponder
|
|
1447
|
-
**/
|
|
1448
|
-
ponder: string;
|
|
1449
|
-
/**
|
|
1450
|
-
* ENSDb service version
|
|
1451
|
-
*
|
|
1452
|
-
* Guaranteed to be the same as {@link ENSIndexerVersionInfo.ensIndexer}.
|
|
1453
|
-
* */
|
|
1454
|
-
ensDb: string;
|
|
1455
|
-
/**
|
|
1456
|
-
* ENSIndexer service version
|
|
1457
|
-
*
|
|
1458
|
-
* @see https://ghcr.io/namehash/ensnode/ensindexer
|
|
1459
|
-
**/
|
|
1460
|
-
ensIndexer: string;
|
|
1482
|
+
interface OmnichainIndexingStatusSnapshotCompleted {
|
|
1461
1483
|
/**
|
|
1462
|
-
*
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
**/
|
|
1466
|
-
ensRainbow: string;
|
|
1484
|
+
* The status of omnichain indexing.
|
|
1485
|
+
*/
|
|
1486
|
+
omnichainStatus: typeof OmnichainIndexingStatusIds.Completed;
|
|
1467
1487
|
/**
|
|
1468
|
-
*
|
|
1469
|
-
|
|
1470
|
-
|
|
1488
|
+
* The indexing status snapshot for each indexed chain.
|
|
1489
|
+
*/
|
|
1490
|
+
chains: Map<ChainId, ChainIndexingStatusSnapshotCompleted>;
|
|
1471
1491
|
/**
|
|
1472
|
-
*
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
*
|
|
1476
|
-
* @see https://www.npmjs.com/package/@adraffy/ens-normalize
|
|
1477
|
-
**/
|
|
1478
|
-
ensNormalize: string;
|
|
1492
|
+
* The timestamp of omnichain indexing progress across all indexed chains.
|
|
1493
|
+
*/
|
|
1494
|
+
omnichainIndexingCursor: UnixTimestamp;
|
|
1479
1495
|
}
|
|
1480
1496
|
/**
|
|
1481
|
-
*
|
|
1497
|
+
* Omnichain indexing status snapshot for one or more chains.
|
|
1482
1498
|
*
|
|
1483
|
-
*
|
|
1484
|
-
*
|
|
1499
|
+
* Use the `omnichainStatus` field to determine the specific type interpretation
|
|
1500
|
+
* at runtime.
|
|
1485
1501
|
*/
|
|
1486
|
-
|
|
1502
|
+
type OmnichainIndexingStatusSnapshot = OmnichainIndexingStatusSnapshotUnstarted | OmnichainIndexingStatusSnapshotBackfill | OmnichainIndexingStatusSnapshotCompleted | OmnichainIndexingStatusSnapshotFollowing;
|
|
1503
|
+
/**
|
|
1504
|
+
* The strategy used for indexing one or more chains.
|
|
1505
|
+
*
|
|
1506
|
+
* @see https://ponder.sh/docs/api-reference/ponder/config#parameters
|
|
1507
|
+
*/
|
|
1508
|
+
declare const CrossChainIndexingStrategyIds: {
|
|
1487
1509
|
/**
|
|
1488
|
-
*
|
|
1510
|
+
* Represents that the indexing of events across all indexed chains will
|
|
1511
|
+
* proceed in a deterministic "omnichain" ordering by block timestamp, chain ID,
|
|
1512
|
+
* and block number.
|
|
1489
1513
|
*
|
|
1490
|
-
*
|
|
1514
|
+
* This strategy is "deterministic" in that the order of processing cross-chain indexed
|
|
1515
|
+
* events and each resulting indexed data state transition recorded in ENSDb is always
|
|
1516
|
+
* the same for each ENSIndexer instance operating with an equivalent
|
|
1517
|
+
* `ENSIndexerConfig` and ENSIndexer version. However it also has the drawbacks of:
|
|
1518
|
+
* - increased indexing latency that must wait for the slowest indexed chain to
|
|
1519
|
+
* add new blocks or to discover new blocks through the configured RPCs.
|
|
1520
|
+
* - if any indexed chain gets "stuck" due to chain or RPC failures, all indexed chains
|
|
1521
|
+
* will be affected.
|
|
1491
1522
|
*/
|
|
1492
|
-
|
|
1523
|
+
readonly Omnichain: "omnichain";
|
|
1524
|
+
};
|
|
1525
|
+
/**
|
|
1526
|
+
* The derived string union of possible {@link CrossChainIndexingStrategyIds}.
|
|
1527
|
+
*/
|
|
1528
|
+
type CrossChainIndexingStrategyId = (typeof CrossChainIndexingStrategyIds)[keyof typeof CrossChainIndexingStrategyIds];
|
|
1529
|
+
/**
|
|
1530
|
+
* Cross-chain indexing status snapshot when the `strategy` is
|
|
1531
|
+
* {@link CrossChainIndexingStrategyId.Omnichain}.
|
|
1532
|
+
*
|
|
1533
|
+
* Invariants:
|
|
1534
|
+
* - `strategy` is always {@link CrossChainIndexingStrategyId.Omnichain}.
|
|
1535
|
+
* - `slowestChainIndexingCursor` is always equal to
|
|
1536
|
+
* `omnichainSnapshot.omnichainIndexingCursor`.
|
|
1537
|
+
* - `snapshotTime` is always >= the "highest known block timestamp", defined as the max of:
|
|
1538
|
+
* - the `slowestChainIndexingCursor`.
|
|
1539
|
+
* - the `config.startBlock.timestamp` for all indexed chains.
|
|
1540
|
+
* - the `config.endBlock.timestamp` for all indexed chains with a `config.configType` of
|
|
1541
|
+
* {@link ChainIndexingConfigTypeIds.Definite}.
|
|
1542
|
+
* - the `backfillEndBlock.timestamp` for all chains with `chainStatus` of
|
|
1543
|
+
* {@link ChainIndexingStatusIds.Backfill}.
|
|
1544
|
+
* - the `latestKnownBlock.timestamp` for all chains with `chainStatus` of
|
|
1545
|
+
* {@link ChainIndexingStatusIds.Following}.
|
|
1546
|
+
*/
|
|
1547
|
+
interface CrossChainIndexingStatusSnapshotOmnichain {
|
|
1493
1548
|
/**
|
|
1494
|
-
* The
|
|
1549
|
+
* The strategy used for indexing one or more chains.
|
|
1495
1550
|
*/
|
|
1496
|
-
|
|
1551
|
+
strategy: typeof CrossChainIndexingStrategyIds.Omnichain;
|
|
1497
1552
|
/**
|
|
1498
|
-
*
|
|
1499
|
-
*
|
|
1500
|
-
*
|
|
1501
|
-
* Invariants:
|
|
1502
|
-
* - Must be a non-empty string that is a valid Postgres database schema
|
|
1503
|
-
* identifier.
|
|
1553
|
+
* The timestamp of the "slowest" latest indexed block timestamp
|
|
1554
|
+
* across all indexed chains.
|
|
1504
1555
|
*/
|
|
1505
|
-
|
|
1556
|
+
slowestChainIndexingCursor: UnixTimestamp;
|
|
1506
1557
|
/**
|
|
1507
|
-
*
|
|
1508
|
-
*
|
|
1509
|
-
* For future-proofing, this is a list of strings that may or may
|
|
1510
|
-
* not be currently valid {@link PluginName} values.
|
|
1558
|
+
* The timestamp when the cross-chain indexing status snapshot was generated.
|
|
1511
1559
|
*
|
|
1512
|
-
*
|
|
1513
|
-
*
|
|
1560
|
+
* Due to possible clock skew between different systems this value must be set
|
|
1561
|
+
* to the max of each of the following values to ensure all invariants are followed:
|
|
1562
|
+
* - the current system time of the system generating this cross-chain indexing
|
|
1563
|
+
* status snapshot.
|
|
1564
|
+
* - the "highest known block timestamp" (see invariants above for full definition).
|
|
1514
1565
|
*/
|
|
1515
|
-
|
|
1566
|
+
snapshotTime: UnixTimestamp;
|
|
1516
1567
|
/**
|
|
1517
|
-
*
|
|
1518
|
-
*
|
|
1519
|
-
* Includes the {@link ChainId} for each chain being indexed.
|
|
1568
|
+
* The omnichain indexing status snapshot for one or more chains.
|
|
1520
1569
|
*/
|
|
1521
|
-
|
|
1570
|
+
omnichainSnapshot: OmnichainIndexingStatusSnapshot;
|
|
1571
|
+
}
|
|
1572
|
+
/**
|
|
1573
|
+
* Cross-chain indexing status snapshot for one or more chains.
|
|
1574
|
+
*
|
|
1575
|
+
* Use the `strategy` field to determine the specific type interpretation
|
|
1576
|
+
* at runtime.
|
|
1577
|
+
*
|
|
1578
|
+
* Currently, only omnichain indexing is supported. This type could theoretically
|
|
1579
|
+
* be extended to support other cross-chain indexing strategies in the future,
|
|
1580
|
+
* such as Ponder's "multichain" indexing strategy that indexes each chain
|
|
1581
|
+
* independently without deterministic ordering.
|
|
1582
|
+
*/
|
|
1583
|
+
type CrossChainIndexingStatusSnapshot = CrossChainIndexingStatusSnapshotOmnichain;
|
|
1584
|
+
/**
|
|
1585
|
+
* A "realtime" indexing status projection based on worst-case assumptions
|
|
1586
|
+
* from the `snapshot`.
|
|
1587
|
+
*
|
|
1588
|
+
* Invariants:
|
|
1589
|
+
* - `projectedAt` is always >= `snapshot.snapshotTime`.
|
|
1590
|
+
* - `worstCaseDistance` is always equal to
|
|
1591
|
+
* `projectedAt - snapshot.slowestChainIndexingCursor`.
|
|
1592
|
+
*/
|
|
1593
|
+
type RealtimeIndexingStatusProjection = {
|
|
1522
1594
|
/**
|
|
1523
|
-
*
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
*
|
|
1528
|
-
* ENSIndexer will store and return Literal Labels and Literal Names without further interpretation.
|
|
1529
|
-
* @see https://ensnode.io/docs/reference/terminology#literal-label
|
|
1530
|
-
* @see https://ensnode.io/docs/reference/terminology#literal-name
|
|
1531
|
-
*
|
|
1532
|
-
* If {@link isSubgraphCompatible} is true, the following invariants are true for the ENSIndexerConfig:
|
|
1533
|
-
* 1. only the 'subgraph' plugin is enabled, and
|
|
1534
|
-
* 2. the labelSet must be { labelSetId: 'subgraph', labelSetVersion: 0 }
|
|
1535
|
-
*
|
|
1536
|
-
* If {@link isSubgraphCompatible} is false, ENSIndexer will additionally:
|
|
1537
|
-
*
|
|
1538
|
-
* 1. ENSIndexer will heal all subnames of addr.reverse on the ENS Root Chain.
|
|
1539
|
-
*
|
|
1540
|
-
* 2. ENSIndexer will track both the keys and the values of Resolver records.
|
|
1541
|
-
*
|
|
1542
|
-
* WARNING: Special care must be taken when interacting with indexed resolver record values. It
|
|
1543
|
-
* is unsafe to naively assume that indexed resolver record values are equivalent to the
|
|
1544
|
-
* resolver record values that would be returned through dynamic lookups via the ENS protocol.
|
|
1545
|
-
* For example, if a resolver implements CCIP-Read, the resolver records may not be
|
|
1546
|
-
* discoverable through onchain indexing.
|
|
1547
|
-
*
|
|
1548
|
-
* 3. Literal Labels and Literal Names encountered by ENSIndexer will be Interpreted.
|
|
1549
|
-
* @see https://ensnode.io/docs/reference/terminology#interpreted-label
|
|
1550
|
-
* @see https://ensnode.io/docs/reference/terminology#interpreted-name
|
|
1595
|
+
* The timestamp representing "now" as of the time this projection was generated.
|
|
1596
|
+
*/
|
|
1597
|
+
projectedAt: UnixTimestamp;
|
|
1598
|
+
/**
|
|
1599
|
+
* The distance between `projectedAt` and `snapshot.slowestChainIndexingCursor`.
|
|
1551
1600
|
*
|
|
1552
|
-
*
|
|
1553
|
-
*
|
|
1554
|
-
*
|
|
1555
|
-
*
|
|
1556
|
-
* b) all Names stored and returned by ENSIndexer will be Interpreted Names, which are exclusively
|
|
1557
|
-
* composed of Interpreted Labels.
|
|
1601
|
+
* This is "worst-case" because it assumes all of the following:
|
|
1602
|
+
* - the `snapshot` (which may have `snapshot.snapshotTime < projectedAt`) is still the
|
|
1603
|
+
* latest snapshot and no indexing progress has been made since `snapshotTime`.
|
|
1604
|
+
* - each indexed chain has added a new block as of `projectedAt`.
|
|
1558
1605
|
*/
|
|
1559
|
-
|
|
1606
|
+
worstCaseDistance: Duration;
|
|
1560
1607
|
/**
|
|
1561
|
-
*
|
|
1608
|
+
* The {@link CrossChainIndexingStatusSnapshot} that this projection is based on.
|
|
1562
1609
|
*/
|
|
1563
|
-
|
|
1564
|
-
}
|
|
1610
|
+
snapshot: CrossChainIndexingStatusSnapshot;
|
|
1611
|
+
};
|
|
1565
1612
|
|
|
1566
|
-
type SerializedIndexedChainIds = Array<ChainId>;
|
|
1567
1613
|
/**
|
|
1568
|
-
* Serialized representation of {@link
|
|
1614
|
+
* Serialized representation of {@link ChainIndexingStatusSnapshot}
|
|
1569
1615
|
*/
|
|
1570
|
-
|
|
1571
|
-
/**
|
|
1572
|
-
* Array representation of {@link ENSIndexerPublicConfig.indexedChainIds}.
|
|
1573
|
-
*/
|
|
1574
|
-
indexedChainIds: ChainId[];
|
|
1575
|
-
}
|
|
1616
|
+
type SerializedChainIndexingStatusSnapshot = ChainIndexingStatusSnapshot;
|
|
1576
1617
|
/**
|
|
1577
|
-
* Serialized representation of {@link
|
|
1618
|
+
* Serialized representation of {@link ChainIndexingStatusSnapshotQueued}
|
|
1578
1619
|
*/
|
|
1579
|
-
type
|
|
1580
|
-
|
|
1620
|
+
type SerializedChainIndexingStatusSnapshotQueued = ChainIndexingStatusSnapshotQueued;
|
|
1581
1621
|
/**
|
|
1582
|
-
*
|
|
1622
|
+
* Serialized representation of {@link ChainIndexingStatusSnapshotBackfill}
|
|
1583
1623
|
*/
|
|
1584
|
-
|
|
1585
|
-
|
|
1624
|
+
type SerializedChainIndexingStatusSnapshotBackfill = ChainIndexingStatusSnapshotBackfill;
|
|
1586
1625
|
/**
|
|
1587
|
-
*
|
|
1588
|
-
* Subgraph.
|
|
1589
|
-
*
|
|
1590
|
-
* @see https://ensnode.io/docs/concepts/what-is-the-ens-subgraph/
|
|
1626
|
+
* Serialized representation of {@link ChainIndexingStatusSnapshotCompleted}
|
|
1591
1627
|
*/
|
|
1592
|
-
|
|
1593
|
-
|
|
1628
|
+
type SerializedChainIndexingStatusSnapshotCompleted = ChainIndexingStatusSnapshotCompleted;
|
|
1594
1629
|
/**
|
|
1595
|
-
*
|
|
1596
|
-
* @param labelHash The Labelhash to convert
|
|
1597
|
-
* @returns A ByteArray containing the bytes
|
|
1598
|
-
* @throws Error if `labelHash` is not a valid 32-byte hex string
|
|
1630
|
+
* Serialized representation of {@link ChainIndexingStatusSnapshotFollowing}
|
|
1599
1631
|
*/
|
|
1600
|
-
|
|
1601
|
-
|
|
1632
|
+
type SerializedChainIndexingStatusSnapshotFollowing = ChainIndexingStatusSnapshotFollowing;
|
|
1602
1633
|
/**
|
|
1603
|
-
*
|
|
1604
|
-
* @param maybeLabelSetId - The string to validate and convert to a LabelSetId.
|
|
1605
|
-
* @returns A valid LabelSetId.
|
|
1606
|
-
* @throws If the input string is not a valid LabelSetId.
|
|
1634
|
+
* Serialized representation of {@link OmnichainIndexingStatusSnapshotUnstarted}
|
|
1607
1635
|
*/
|
|
1608
|
-
|
|
1636
|
+
interface SerializedOmnichainIndexingStatusSnapshotUnstarted extends Omit<OmnichainIndexingStatusSnapshotUnstarted, "chains"> {
|
|
1637
|
+
chains: Record<ChainIdString, ChainIndexingStatusSnapshotQueued>;
|
|
1638
|
+
}
|
|
1609
1639
|
/**
|
|
1610
|
-
*
|
|
1611
|
-
* @param maybeLabelSetVersion - The number or string to validate and convert to a LabelSetVersion.
|
|
1612
|
-
* @returns A valid LabelSetVersion.
|
|
1613
|
-
* @throws If the input is not a valid LabelSetVersion.
|
|
1640
|
+
* Serialized representation of {@link OmnichainIndexingStatusSnapshotBackfill}
|
|
1614
1641
|
*/
|
|
1615
|
-
|
|
1642
|
+
interface SerializedOmnichainIndexingStatusSnapshotBackfill extends Omit<OmnichainIndexingStatusSnapshotBackfill, "chains"> {
|
|
1643
|
+
chains: Record<ChainIdString, ChainIndexingStatusSnapshotForOmnichainIndexingStatusSnapshotBackfill>;
|
|
1644
|
+
}
|
|
1616
1645
|
/**
|
|
1617
|
-
*
|
|
1618
|
-
* @param labelSetId - The label set ID.
|
|
1619
|
-
* @param labelSetVersion - The label set version.
|
|
1620
|
-
* @returns A valid EnsRainbowClientLabelSet object.
|
|
1621
|
-
* @throws If `labelSetVersion` is defined without `labelSetId`.
|
|
1646
|
+
* Serialized representation of {@link OmnichainIndexingStatusSnapshotCompleted}
|
|
1622
1647
|
*/
|
|
1623
|
-
|
|
1648
|
+
interface SerializedOmnichainIndexingStatusSnapshotCompleted extends Omit<OmnichainIndexingStatusSnapshotCompleted, "chains"> {
|
|
1649
|
+
chains: Record<ChainIdString, ChainIndexingStatusSnapshotCompleted>;
|
|
1650
|
+
}
|
|
1624
1651
|
/**
|
|
1625
|
-
*
|
|
1626
|
-
* @param serverSet - The label set provided by the server.
|
|
1627
|
-
* @param clientSet - The label set requested by the client.
|
|
1628
|
-
* @throws If the server set is not compatible with the client set.
|
|
1652
|
+
* Serialized representation of {@link OmnichainIndexingStatusSnapshotFollowing}
|
|
1629
1653
|
*/
|
|
1630
|
-
|
|
1631
|
-
|
|
1654
|
+
interface SerializedOmnichainIndexingStatusSnapshotFollowing extends Omit<OmnichainIndexingStatusSnapshotFollowing, "chains"> {
|
|
1655
|
+
chains: Record<ChainIdString, ChainIndexingStatusSnapshot>;
|
|
1656
|
+
}
|
|
1632
1657
|
/**
|
|
1633
|
-
*
|
|
1634
|
-
* @param input The string to parse
|
|
1635
|
-
* @returns The parsed non-negative integer
|
|
1636
|
-
* @throws Error if the input is not a valid non-negative integer
|
|
1658
|
+
* Serialized representation of {@link OmnichainIndexingStatusSnapshot}
|
|
1637
1659
|
*/
|
|
1638
|
-
|
|
1639
|
-
|
|
1660
|
+
type SerializedOmnichainIndexingStatusSnapshot = SerializedOmnichainIndexingStatusSnapshotUnstarted | SerializedOmnichainIndexingStatusSnapshotBackfill | SerializedOmnichainIndexingStatusSnapshotCompleted | SerializedOmnichainIndexingStatusSnapshotFollowing;
|
|
1640
1661
|
/**
|
|
1641
|
-
*
|
|
1662
|
+
* Serialized representation of {@link CrossChainIndexingStatusSnapshotOmnichain}
|
|
1642
1663
|
*/
|
|
1643
|
-
|
|
1664
|
+
interface SerializedCrossChainIndexingStatusSnapshotOmnichain extends Omit<CrossChainIndexingStatusSnapshotOmnichain, "omnichainSnapshot"> {
|
|
1665
|
+
omnichainSnapshot: SerializedOmnichainIndexingStatusSnapshot;
|
|
1666
|
+
}
|
|
1644
1667
|
/**
|
|
1645
|
-
*
|
|
1668
|
+
* Serialized representation of {@link CrossChainIndexingStatusSnapshot}
|
|
1646
1669
|
*/
|
|
1647
|
-
|
|
1648
|
-
|
|
1670
|
+
type SerializedCrossChainIndexingStatusSnapshot = SerializedCrossChainIndexingStatusSnapshotOmnichain;
|
|
1649
1671
|
/**
|
|
1650
|
-
*
|
|
1672
|
+
* Serialized representation of {@link RealtimeIndexingStatusProjection}
|
|
1651
1673
|
*/
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
*/
|
|
1656
|
-
readonly Indefinite: "indefinite";
|
|
1657
|
-
/**
|
|
1658
|
-
* Represents that indexing of the chain should be performed for a definite range.
|
|
1659
|
-
*/
|
|
1660
|
-
readonly Definite: "definite";
|
|
1661
|
-
};
|
|
1674
|
+
interface SerializedCurrentIndexingProjectionOmnichain extends Omit<RealtimeIndexingStatusProjection, "snapshot"> {
|
|
1675
|
+
snapshot: SerializedOmnichainIndexingStatusSnapshot;
|
|
1676
|
+
}
|
|
1662
1677
|
/**
|
|
1663
|
-
*
|
|
1678
|
+
* Serialized representation of {@link RealtimeIndexingStatusProjection}
|
|
1664
1679
|
*/
|
|
1665
|
-
|
|
1680
|
+
interface SerializedRealtimeIndexingStatusProjection extends Omit<RealtimeIndexingStatusProjection, "snapshot"> {
|
|
1681
|
+
snapshot: SerializedCrossChainIndexingStatusSnapshot;
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1666
1684
|
/**
|
|
1667
|
-
*
|
|
1668
|
-
* {@link ChainIndexingConfigTypeIds.Indefinite}.
|
|
1669
|
-
*
|
|
1670
|
-
* Invariants:
|
|
1671
|
-
* - `configType` is always `ChainIndexingConfigTypeIds.Indefinite`.
|
|
1685
|
+
* Deserialize into a {@link ChainIndexingSnapshot} object.
|
|
1672
1686
|
*/
|
|
1673
|
-
|
|
1674
|
-
/**
|
|
1675
|
-
* The type of chain indexing config.
|
|
1676
|
-
*/
|
|
1677
|
-
configType: typeof ChainIndexingConfigTypeIds.Indefinite;
|
|
1678
|
-
/**
|
|
1679
|
-
* A {@link BlockRef} to the block where indexing of the chain should start.
|
|
1680
|
-
*/
|
|
1681
|
-
startBlock: BlockRef;
|
|
1682
|
-
}
|
|
1687
|
+
declare function deserializeChainIndexingStatusSnapshot(maybeSnapshot: SerializedChainIndexingStatusSnapshot, valueLabel?: string): ChainIndexingStatusSnapshot;
|
|
1683
1688
|
/**
|
|
1684
|
-
*
|
|
1685
|
-
* {@link ChainIndexingConfigTypeIds.Definite}.
|
|
1686
|
-
*
|
|
1687
|
-
* Invariants:
|
|
1688
|
-
* - `configType` is always `ChainIndexingConfigTypeIds.Definite`.
|
|
1689
|
-
* - `startBlock` is always before or the same as `endBlock`.
|
|
1689
|
+
* Deserialize an {@link OmnichainIndexingStatusSnapshot} object.
|
|
1690
1690
|
*/
|
|
1691
|
-
|
|
1692
|
-
/**
|
|
1693
|
-
* The type of chain indexing config.
|
|
1694
|
-
*/
|
|
1695
|
-
configType: typeof ChainIndexingConfigTypeIds.Definite;
|
|
1696
|
-
/**
|
|
1697
|
-
* A {@link BlockRef} to the block where indexing of the chain should start.
|
|
1698
|
-
*/
|
|
1699
|
-
startBlock: BlockRef;
|
|
1700
|
-
/**
|
|
1701
|
-
* A {@link BlockRef} to the block where indexing of the chain should end.
|
|
1702
|
-
*/
|
|
1703
|
-
endBlock: BlockRef;
|
|
1704
|
-
}
|
|
1691
|
+
declare function deserializeOmnichainIndexingStatusSnapshot(maybeSnapshot: SerializedOmnichainIndexingStatusSnapshot, valueLabel?: string): OmnichainIndexingStatusSnapshot;
|
|
1705
1692
|
/**
|
|
1706
|
-
*
|
|
1707
|
-
*
|
|
1708
|
-
* Use the `configType` field to determine the specific type interpretation
|
|
1709
|
-
* at runtime.
|
|
1693
|
+
* Deserialize an {@link CrossChainIndexingStatusSnapshot} object.
|
|
1710
1694
|
*/
|
|
1711
|
-
|
|
1695
|
+
declare function deserializeCrossChainIndexingStatusSnapshot(maybeSnapshot: SerializedCrossChainIndexingStatusSnapshot, valueLabel?: string): CrossChainIndexingStatusSnapshot;
|
|
1712
1696
|
/**
|
|
1713
|
-
*
|
|
1714
|
-
* is captured.
|
|
1697
|
+
* Deserialize into a {@link RealtimeIndexingStatusProjection} object.
|
|
1715
1698
|
*/
|
|
1716
|
-
declare
|
|
1717
|
-
|
|
1718
|
-
* Represents that indexing of the chain is not ready to begin yet because:
|
|
1719
|
-
* - ENSIndexer is in its initialization phase and the data to build a
|
|
1720
|
-
* "true" {@link ChainIndexingSnapshot} for the chain is still being loaded; or
|
|
1721
|
-
* - ENSIndexer is using an omnichain indexing strategy and the
|
|
1722
|
-
* `omnichainIndexingCursor` is <= `config.startBlock.timestamp` for the chain's
|
|
1723
|
-
* {@link ChainIndexingSnapshot}.
|
|
1724
|
-
*/
|
|
1725
|
-
readonly Queued: "chain-queued";
|
|
1726
|
-
/**
|
|
1727
|
-
* Represents that indexing of the chain is in progress and under a special
|
|
1728
|
-
* "backfill" phase that optimizes for accelerated indexing until reaching the
|
|
1729
|
-
* "fixed target" `backfillEndBlock`.
|
|
1730
|
-
*/
|
|
1731
|
-
readonly Backfill: "chain-backfill";
|
|
1732
|
-
/**
|
|
1733
|
-
* Represents that the "backfill" phase of indexing the chain is completed
|
|
1734
|
-
* and that the chain is configured to be indexed for an indefinite range.
|
|
1735
|
-
* Therefore, indexing of the chain remains indefinitely in progress where
|
|
1736
|
-
* ENSIndexer will continuously work to discover and index new blocks as they
|
|
1737
|
-
* are added to the chain across time.
|
|
1738
|
-
*/
|
|
1739
|
-
readonly Following: "chain-following";
|
|
1740
|
-
/**
|
|
1741
|
-
* Represents that indexing of the chain is completed as the chain is configured
|
|
1742
|
-
* to be indexed for a definite range and the indexing of all blocks through
|
|
1743
|
-
* that definite range is completed.
|
|
1744
|
-
*/
|
|
1745
|
-
readonly Completed: "chain-completed";
|
|
1746
|
-
};
|
|
1699
|
+
declare function deserializeRealtimeIndexingStatusProjection(maybeProjection: SerializedRealtimeIndexingStatusProjection, valueLabel?: string): RealtimeIndexingStatusProjection;
|
|
1700
|
+
|
|
1747
1701
|
/**
|
|
1748
|
-
*
|
|
1702
|
+
* Get {@link OmnichainIndexingStatusId} based on indexed chains' statuses.
|
|
1703
|
+
*
|
|
1704
|
+
* This function decides what is the `OmnichainIndexingStatusId` is,
|
|
1705
|
+
* based on provided chain indexing statuses.
|
|
1706
|
+
*
|
|
1707
|
+
* @throws an error if unable to determine overall indexing status
|
|
1749
1708
|
*/
|
|
1750
|
-
|
|
1709
|
+
declare function getOmnichainIndexingStatus(chains: ChainIndexingStatusSnapshot[]): OmnichainIndexingStatusId;
|
|
1751
1710
|
/**
|
|
1752
|
-
*
|
|
1753
|
-
* {@link
|
|
1711
|
+
* Get the timestamp of the lowest `config.startBlock` across all chains
|
|
1712
|
+
* in the provided array of {@link ChainIndexingStatusSnapshot}.
|
|
1754
1713
|
*
|
|
1755
|
-
*
|
|
1756
|
-
*
|
|
1714
|
+
* Such timestamp is useful when presenting the "lowest" block
|
|
1715
|
+
* to be indexed across all chains.
|
|
1757
1716
|
*/
|
|
1758
|
-
|
|
1759
|
-
/**
|
|
1760
|
-
* The status of indexing the chain at the time the indexing status snapshot
|
|
1761
|
-
* was captured.
|
|
1762
|
-
*/
|
|
1763
|
-
chainStatus: typeof ChainIndexingStatusIds.Queued;
|
|
1764
|
-
/**
|
|
1765
|
-
* The indexing configuration of the chain.
|
|
1766
|
-
*/
|
|
1767
|
-
config: ChainIndexingConfig;
|
|
1768
|
-
}
|
|
1717
|
+
declare function getTimestampForLowestOmnichainStartBlock(chains: ChainIndexingStatusSnapshot[]): UnixTimestamp;
|
|
1769
1718
|
/**
|
|
1770
|
-
*
|
|
1771
|
-
* {@link
|
|
1719
|
+
* Get the timestamp of the "highest known block" across all chains
|
|
1720
|
+
* in the provided array of {@link ChainIndexingStatusSnapshot}.
|
|
1772
1721
|
*
|
|
1773
|
-
*
|
|
1774
|
-
*
|
|
1775
|
-
* as fast as possible.
|
|
1722
|
+
* Such timestamp is useful when presenting the "highest known block"
|
|
1723
|
+
* to be indexed across all chains.
|
|
1776
1724
|
*
|
|
1777
|
-
*
|
|
1778
|
-
*
|
|
1779
|
-
* -
|
|
1780
|
-
*
|
|
1781
|
-
* -
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
*
|
|
1786
|
-
* {@link ChainIndexingStatusIds.Following} the chain will be X hours behind
|
|
1787
|
-
* "realtime" indexing.
|
|
1725
|
+
* The "highest known block" for a chain depends on its status:
|
|
1726
|
+
* - `config.endBlock` for a "queued" chain,
|
|
1727
|
+
* - `backfillEndBlock` for a "backfill" chain,
|
|
1728
|
+
* - `latestIndexedBlock` for a "completed" chain,
|
|
1729
|
+
* - `latestKnownBlock` for a "following" chain.
|
|
1730
|
+
*/
|
|
1731
|
+
declare function getTimestampForHighestOmnichainKnownBlock(chains: ChainIndexingStatusSnapshot[]): UnixTimestamp;
|
|
1732
|
+
/**
|
|
1733
|
+
* Get Omnichain Indexing Cursor
|
|
1788
1734
|
*
|
|
1789
|
-
*
|
|
1790
|
-
*
|
|
1791
|
-
*
|
|
1792
|
-
* `chainStatus` remains {@link ChainIndexingStatusIds.Backfill}. After this internal
|
|
1793
|
-
* processing is completed `chainStatus` will transition:
|
|
1794
|
-
* - to {@link ChainIndexingStatusIds.Following} if the `config` is
|
|
1795
|
-
* {@link ChainIndexingConfigIndefinite}.
|
|
1796
|
-
* - to {@link ChainIndexingStatusIds.Completed} if the `config` is
|
|
1797
|
-
* {@link ChainIndexingConfigDefinite}.
|
|
1735
|
+
* The cursor tracks the "highest" latest indexed block timestamp across
|
|
1736
|
+
* all indexed chains. If all chains are queued, the cursor tracks the moment
|
|
1737
|
+
* just before the earliest start block timestamp across those chains.
|
|
1798
1738
|
*
|
|
1799
|
-
*
|
|
1800
|
-
* - `chainStatus` is always {@link ChainIndexingStatusIds.Backfill}.
|
|
1801
|
-
* - `config.startBlock` is always before or the same as `latestIndexedBlock`
|
|
1802
|
-
* - `config.endBlock` is always the same as `backfillEndBlock` if and only if
|
|
1803
|
-
* the config is {@link ChainIndexingConfigDefinite}.
|
|
1804
|
-
* - `latestIndexedBlock` is always before or the same as `backfillEndBlock`
|
|
1739
|
+
* @throws an error if no chains are provided
|
|
1805
1740
|
*/
|
|
1806
|
-
|
|
1807
|
-
/**
|
|
1808
|
-
* The status of indexing the chain at the time the indexing status snapshot
|
|
1809
|
-
* was captured.
|
|
1810
|
-
*/
|
|
1811
|
-
chainStatus: typeof ChainIndexingStatusIds.Backfill;
|
|
1812
|
-
/**
|
|
1813
|
-
* The indexing configuration of the chain.
|
|
1814
|
-
*/
|
|
1815
|
-
config: ChainIndexingConfig;
|
|
1816
|
-
/**
|
|
1817
|
-
* A {@link BlockRef} to the block that was most recently indexed as of the time the
|
|
1818
|
-
* indexing status snapshot was captured.
|
|
1819
|
-
*/
|
|
1820
|
-
latestIndexedBlock: BlockRef;
|
|
1821
|
-
/**
|
|
1822
|
-
* A {@link BlockRef} to the block where the backfill will end.
|
|
1823
|
-
*/
|
|
1824
|
-
backfillEndBlock: BlockRef;
|
|
1825
|
-
}
|
|
1741
|
+
declare function getOmnichainIndexingCursor(chains: ChainIndexingStatusSnapshot[]): UnixTimestamp;
|
|
1826
1742
|
/**
|
|
1827
|
-
*
|
|
1828
|
-
* {@link ChainIndexingStatusIds.Following}.
|
|
1743
|
+
* Create {@link ChainIndexingConfig} for given block refs.
|
|
1829
1744
|
*
|
|
1830
|
-
*
|
|
1831
|
-
*
|
|
1832
|
-
* - `config` is always {@link ChainIndexingConfigIndefinite}
|
|
1833
|
-
* - `config.startBlock` is always before or the same as `latestIndexedBlock`
|
|
1834
|
-
* - `latestIndexedBlock` is always before or the same as `latestKnownBlock`
|
|
1745
|
+
* @param startBlock required block ref
|
|
1746
|
+
* @param endBlock optional block ref
|
|
1835
1747
|
*/
|
|
1836
|
-
|
|
1837
|
-
/**
|
|
1838
|
-
* The status of indexing the chain at the time the indexing status snapshot
|
|
1839
|
-
* was captured.
|
|
1840
|
-
*/
|
|
1841
|
-
chainStatus: typeof ChainIndexingStatusIds.Following;
|
|
1842
|
-
/**
|
|
1843
|
-
* The indexing configuration of the chain.
|
|
1844
|
-
*/
|
|
1845
|
-
config: ChainIndexingConfigIndefinite;
|
|
1846
|
-
/**
|
|
1847
|
-
* A {@link BlockRef} to the block that was most recently indexed as of the time the
|
|
1848
|
-
* indexing status snapshot was captured.
|
|
1849
|
-
*/
|
|
1850
|
-
latestIndexedBlock: BlockRef;
|
|
1851
|
-
/**
|
|
1852
|
-
* A {@link BlockRef} to the "highest" block that has been discovered by RPCs
|
|
1853
|
-
* and stored in the RPC cache as of the time the indexing status snapshot was
|
|
1854
|
-
* captured.
|
|
1855
|
-
*/
|
|
1856
|
-
latestKnownBlock: BlockRef;
|
|
1857
|
-
}
|
|
1748
|
+
declare function createIndexingConfig(startBlock: BlockRef, endBlock: BlockRef | null): ChainIndexingConfig;
|
|
1858
1749
|
/**
|
|
1859
|
-
* Chain
|
|
1860
|
-
*
|
|
1750
|
+
* Check if Chain Indexing Status Snapshots fit the 'unstarted' overall status
|
|
1751
|
+
* snapshot requirements:
|
|
1752
|
+
* - All chains are guaranteed to have a status of "queued".
|
|
1861
1753
|
*
|
|
1862
|
-
*
|
|
1863
|
-
*
|
|
1864
|
-
|
|
1754
|
+
* Note: This function narrows the {@link ChainIndexingStatusSnapshot} type to
|
|
1755
|
+
* {@link ChainIndexingStatusSnapshotQueued}.
|
|
1756
|
+
*/
|
|
1757
|
+
declare function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted(chains: ChainIndexingStatusSnapshot[]): chains is ChainIndexingStatusSnapshotQueued[];
|
|
1758
|
+
/**
|
|
1759
|
+
* Check if Chain Indexing Status Snapshots fit the 'backfill' overall status
|
|
1760
|
+
* snapshot requirements:
|
|
1761
|
+
* - At least one chain is guaranteed to be in the "backfill" status.
|
|
1762
|
+
* - Each chain is guaranteed to have a status of either "queued",
|
|
1763
|
+
* "backfill" or "completed".
|
|
1865
1764
|
*
|
|
1866
|
-
*
|
|
1867
|
-
*
|
|
1868
|
-
* - `config` is always {@link ChainIndexingConfigDefinite}
|
|
1869
|
-
* - `config.startBlock` is always before or the same as `latestIndexedBlock`
|
|
1870
|
-
* - `latestIndexedBlock` is always the same as `config.endBlock`.
|
|
1765
|
+
* Note: This function narrows the {@link ChainIndexingStatusSnapshot} type to
|
|
1766
|
+
* {@link ChainIndexingStatusSnapshotForOmnichainIndexingStatusSnapshotBackfill}.
|
|
1871
1767
|
*/
|
|
1872
|
-
|
|
1873
|
-
/**
|
|
1874
|
-
* The status of indexing the chain at the time the indexing status snapshot
|
|
1875
|
-
* was captured.
|
|
1876
|
-
*/
|
|
1877
|
-
chainStatus: typeof ChainIndexingStatusIds.Completed;
|
|
1878
|
-
/**
|
|
1879
|
-
* The indexing configuration of the chain.
|
|
1880
|
-
*/
|
|
1881
|
-
config: ChainIndexingConfigDefinite;
|
|
1882
|
-
/**
|
|
1883
|
-
* A {@link BlockRef} to the block that was most recently indexed as of the time the
|
|
1884
|
-
* indexing status snapshot was captured.
|
|
1885
|
-
*/
|
|
1886
|
-
latestIndexedBlock: BlockRef;
|
|
1887
|
-
}
|
|
1768
|
+
declare function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill(chains: ChainIndexingStatusSnapshot[]): chains is ChainIndexingStatusSnapshotForOmnichainIndexingStatusSnapshotBackfill[];
|
|
1888
1769
|
/**
|
|
1889
|
-
* Indexing
|
|
1770
|
+
* Checks if Chain Indexing Status Snapshots fit the 'completed' overall status
|
|
1771
|
+
* snapshot requirements:
|
|
1772
|
+
* - All chains are guaranteed to have a status of "completed".
|
|
1890
1773
|
*
|
|
1891
|
-
*
|
|
1892
|
-
*
|
|
1774
|
+
* Note: This function narrows the {@link ChainIndexingStatusSnapshot} type to
|
|
1775
|
+
* {@link ChainIndexingStatusSnapshotCompleted}.
|
|
1893
1776
|
*/
|
|
1894
|
-
|
|
1777
|
+
declare function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted(chains: ChainIndexingStatusSnapshot[]): chains is ChainIndexingStatusSnapshotCompleted[];
|
|
1895
1778
|
/**
|
|
1896
|
-
*
|
|
1897
|
-
* snapshot
|
|
1779
|
+
* Checks Chain Indexing Status Snapshots fit the 'following' overall status
|
|
1780
|
+
* snapshot requirements:
|
|
1781
|
+
* - At least one chain is guaranteed to be in the "following" status.
|
|
1782
|
+
* - Any other chain can have any status.
|
|
1898
1783
|
*/
|
|
1899
|
-
declare
|
|
1900
|
-
/**
|
|
1901
|
-
* Represents that omnichain indexing is not ready to begin yet because
|
|
1902
|
-
* ENSIndexer is in its initialization phase and the data to build a "true"
|
|
1903
|
-
* {@link OmnichainIndexingStatusSnapshot} is still being loaded.
|
|
1904
|
-
*/
|
|
1905
|
-
readonly Unstarted: "omnichain-unstarted";
|
|
1906
|
-
/**
|
|
1907
|
-
* Represents that omnichain indexing is in an overall "backfill" status because
|
|
1908
|
-
* - At least one indexed chain has a `chainStatus` of
|
|
1909
|
-
* {@link ChainIndexingStatusIds.Backfill}; and
|
|
1910
|
-
* - No indexed chain has a `chainStatus` of {@link ChainIndexingStatusIds.Following}.
|
|
1911
|
-
*/
|
|
1912
|
-
readonly Backfill: "omnichain-backfill";
|
|
1913
|
-
/**
|
|
1914
|
-
* Represents that omnichain indexing is in an overall "following" status because
|
|
1915
|
-
* at least one indexed chain has a `chainStatus` of
|
|
1916
|
-
* {@link ChainIndexingStatusIds.Following}.
|
|
1917
|
-
*/
|
|
1918
|
-
readonly Following: "omnichain-following";
|
|
1919
|
-
/**
|
|
1920
|
-
* Represents that omnichain indexing has completed because all indexed chains have
|
|
1921
|
-
* a `chainStatus` of {@link ChainIndexingStatusIds.Completed}.
|
|
1922
|
-
*/
|
|
1923
|
-
readonly Completed: "omnichain-completed";
|
|
1924
|
-
};
|
|
1784
|
+
declare function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing(chains: ChainIndexingStatusSnapshot[]): chains is ChainIndexingStatusSnapshot[];
|
|
1925
1785
|
/**
|
|
1926
|
-
*
|
|
1786
|
+
* Sort a list of [{@link ChainId}, {@link ChainIndexingStatusSnapshot}] tuples
|
|
1787
|
+
* by the omnichain start block timestamp in ascending order.
|
|
1927
1788
|
*/
|
|
1928
|
-
|
|
1789
|
+
declare function sortChainStatusesByStartBlockAsc<ChainStatusType extends ChainIndexingStatusSnapshot>(chains: [ChainId, ChainStatusType][]): [ChainId, ChainStatusType][];
|
|
1929
1790
|
/**
|
|
1930
|
-
*
|
|
1931
|
-
* {@link OmnichainIndexingStatusIds.Unstarted}.
|
|
1791
|
+
* Gets the latest indexed {@link BlockRef} for the given {@link ChainId}.
|
|
1932
1792
|
*
|
|
1933
|
-
*
|
|
1934
|
-
*
|
|
1935
|
-
* - `chains` is always a map to {@link ChainIndexingStatusSnapshotQueued} values exclusively.
|
|
1936
|
-
* - `omnichainIndexingCursor` is always < the `config.startBlock.timestamp` for all
|
|
1937
|
-
* chains with `chainStatus` of {@link ChainIndexingStatusIds.Queued}.
|
|
1793
|
+
* @returns the latest indexed {@link BlockRef} for the given {@link ChainId}, or null if the chain
|
|
1794
|
+
* isn't being indexed at all or is queued and therefore hasn't started indexing yet.
|
|
1938
1795
|
*/
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
* The status of omnichain indexing.
|
|
1942
|
-
*/
|
|
1943
|
-
omnichainStatus: typeof OmnichainIndexingStatusIds.Unstarted;
|
|
1944
|
-
/**
|
|
1945
|
-
* The indexing status snapshot for each indexed chain.
|
|
1946
|
-
*/
|
|
1947
|
-
chains: Map<ChainId, ChainIndexingStatusSnapshotQueued>;
|
|
1948
|
-
/**
|
|
1949
|
-
* The timestamp of omnichain indexing progress across all indexed chains.
|
|
1950
|
-
*/
|
|
1951
|
-
omnichainIndexingCursor: UnixTimestamp;
|
|
1952
|
-
}
|
|
1796
|
+
declare function getLatestIndexedBlockRef(indexingStatus: CrossChainIndexingStatusSnapshot, chainId: ChainId): BlockRef | null;
|
|
1797
|
+
|
|
1953
1798
|
/**
|
|
1954
|
-
*
|
|
1955
|
-
*
|
|
1956
|
-
*
|
|
1957
|
-
* Note that this is all of the {@link ChainIndexingSnapshot} types with the exception
|
|
1958
|
-
* of {@link ChainIndexingStatusSnapshotFollowing}.
|
|
1799
|
+
* Create realtime indexing status projection from
|
|
1800
|
+
* a {@link CrossChainIndexingStatusSnapshot}.
|
|
1959
1801
|
*/
|
|
1960
|
-
|
|
1802
|
+
declare function createRealtimeIndexingStatusProjection(snapshot: CrossChainIndexingStatusSnapshot, now: UnixTimestamp): RealtimeIndexingStatusProjection;
|
|
1803
|
+
|
|
1804
|
+
declare function serializeCrossChainIndexingStatusSnapshotOmnichain({ strategy, slowestChainIndexingCursor, snapshotTime, omnichainSnapshot, }: CrossChainIndexingStatusSnapshot): SerializedCrossChainIndexingStatusSnapshot;
|
|
1805
|
+
declare function serializeRealtimeIndexingStatusProjection(indexingProjection: RealtimeIndexingStatusProjection): SerializedRealtimeIndexingStatusProjection;
|
|
1961
1806
|
/**
|
|
1962
|
-
*
|
|
1963
|
-
|
|
1807
|
+
* Serialize chain indexing snapshots.
|
|
1808
|
+
*/
|
|
1809
|
+
declare function serializeChainIndexingSnapshots<ChainIndexingStatusSnapshotType extends ChainIndexingStatusSnapshot>(chains: Map<ChainId, ChainIndexingStatusSnapshotType>): Record<ChainIdString, ChainIndexingStatusSnapshotType>;
|
|
1810
|
+
/**
|
|
1811
|
+
* Serialize a {@link OmnichainIndexingStatusSnapshot} object.
|
|
1812
|
+
*/
|
|
1813
|
+
declare function serializeOmnichainIndexingStatusSnapshot(indexingStatus: OmnichainIndexingStatusSnapshot): SerializedOmnichainIndexingStatusSnapshot;
|
|
1814
|
+
|
|
1815
|
+
/**
|
|
1816
|
+
* Reasons why TheGraph fallback cannot be used.
|
|
1817
|
+
*/
|
|
1818
|
+
declare const TheGraphCannotFallbackReasonSchema: z.ZodEnum<{
|
|
1819
|
+
readonly NotSubgraphCompatible: "not-subgraph-compatible";
|
|
1820
|
+
readonly NoApiKey: "no-api-key";
|
|
1821
|
+
readonly NoSubgraphUrl: "no-subgraph-url";
|
|
1822
|
+
}>;
|
|
1823
|
+
type TheGraphCannotFallbackReason = z.infer<typeof TheGraphCannotFallbackReasonSchema>;
|
|
1824
|
+
/**
|
|
1825
|
+
* Configuration for TheGraph fallback behavior.
|
|
1826
|
+
* Indicates whether fallback to TheGraph is possible and the reason if not.
|
|
1827
|
+
*/
|
|
1828
|
+
declare const TheGraphFallbackSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1829
|
+
canFallback: z.ZodLiteral<true>;
|
|
1830
|
+
url: z.ZodString;
|
|
1831
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1832
|
+
canFallback: z.ZodLiteral<false>;
|
|
1833
|
+
reason: z.ZodEnum<{
|
|
1834
|
+
readonly NotSubgraphCompatible: "not-subgraph-compatible";
|
|
1835
|
+
readonly NoApiKey: "no-api-key";
|
|
1836
|
+
readonly NoSubgraphUrl: "no-subgraph-url";
|
|
1837
|
+
}>;
|
|
1838
|
+
}, z.core.$strict>], "canFallback">;
|
|
1839
|
+
type TheGraphFallback = z.infer<typeof TheGraphFallbackSchema>;
|
|
1840
|
+
|
|
1841
|
+
/**
|
|
1842
|
+
* Complete public configuration object for ENSApi.
|
|
1964
1843
|
*
|
|
1965
|
-
*
|
|
1966
|
-
*
|
|
1967
|
-
* - `chains` is guaranteed to contain at least one chain with a `chainStatus` of
|
|
1968
|
-
* {@link ChainIndexingStatusIds.Backfill}.
|
|
1969
|
-
* - `chains` is guaranteed to not to contain any chain with a `chainStatus` of
|
|
1970
|
-
* {@link ChainIndexingStatusIds.Following}
|
|
1971
|
-
* - `omnichainIndexingCursor` is always < the `config.startBlock.timestamp` for all
|
|
1972
|
-
* chains with `chainStatus` of {@link ChainIndexingStatusIds.Queued}.
|
|
1973
|
-
* - `omnichainIndexingCursor` is always <= the `backfillEndBlock.timestamp` for all
|
|
1974
|
-
* chains with `chainStatus` of {@link ChainIndexingStatusIds.Backfill}.
|
|
1975
|
-
* - `omnichainIndexingCursor` is always >= the `latestIndexedBlock.timestamp` for all
|
|
1976
|
-
* chains with `chainStatus` of {@link ChainIndexingStatusIds.Completed}.
|
|
1977
|
-
* - `omnichainIndexingCursor` is always equal to the timestamp of the highest
|
|
1978
|
-
* `latestIndexedBlock` across all chains that have started indexing
|
|
1979
|
-
* (`chainStatus` is not {@link ChainIndexingStatusIds.Queued}).
|
|
1844
|
+
* Contains ENSApi-specific configuration at the top level and
|
|
1845
|
+
* embeds the complete ENSIndexer public configuration.
|
|
1980
1846
|
*/
|
|
1981
|
-
interface
|
|
1847
|
+
interface ENSApiPublicConfig {
|
|
1982
1848
|
/**
|
|
1983
|
-
*
|
|
1849
|
+
* ENSApi service version
|
|
1850
|
+
*
|
|
1851
|
+
* @see https://ghcr.io/namehash/ensnode/ensapi
|
|
1984
1852
|
*/
|
|
1985
|
-
|
|
1853
|
+
version: string;
|
|
1986
1854
|
/**
|
|
1987
|
-
* The
|
|
1855
|
+
* The Graph Fallback-related info.
|
|
1988
1856
|
*/
|
|
1989
|
-
|
|
1857
|
+
theGraphFallback: TheGraphFallback;
|
|
1990
1858
|
/**
|
|
1991
|
-
*
|
|
1859
|
+
* Complete ENSIndexer public configuration
|
|
1860
|
+
*
|
|
1861
|
+
* Contains all ENSIndexer public configuration including
|
|
1862
|
+
* namespace, plugins, version info, etc.
|
|
1992
1863
|
*/
|
|
1993
|
-
|
|
1864
|
+
ensIndexerPublicConfig: ENSIndexerPublicConfig;
|
|
1994
1865
|
}
|
|
1866
|
+
|
|
1995
1867
|
/**
|
|
1996
|
-
*
|
|
1997
|
-
* {@link OmnichainIndexingStatusIds.Following}.
|
|
1998
|
-
*
|
|
1999
|
-
* Invariants:
|
|
2000
|
-
* - `omnichainStatus` is always {@link OmnichainIndexingStatusIds.Following}.
|
|
2001
|
-
* - `chains` is guaranteed to contain at least one chain with a `status` of
|
|
2002
|
-
* {@link ChainIndexingStatusIds.Following}.
|
|
2003
|
-
* - `omnichainIndexingCursor` is always < the `config.startBlock.timestamp` for all
|
|
2004
|
-
* chains with `chainStatus` of {@link ChainIndexingStatusIds.Queued}.
|
|
2005
|
-
* - `omnichainIndexingCursor` is always <= the `backfillEndBlock.timestamp` for all
|
|
2006
|
-
* chains with `chainStatus` of {@link ChainIndexingStatusIds.Backfill}.
|
|
2007
|
-
* - `omnichainIndexingCursor` is always >= the `latestIndexedBlock.timestamp` for all
|
|
2008
|
-
* chains with `chainStatus` of {@link ChainIndexingStatusIds.Completed}.
|
|
2009
|
-
* - `omnichainIndexingCursor` is always equal to the timestamp of the highest
|
|
2010
|
-
* `latestIndexedBlock` across all chains that have started indexing
|
|
2011
|
-
* (`chainStatus` is not {@link ChainIndexingStatusIds.Queued}).
|
|
1868
|
+
* Serialized representation of {@link ENSApiPublicConfig}
|
|
2012
1869
|
*/
|
|
2013
|
-
interface
|
|
1870
|
+
interface SerializedENSApiPublicConfig extends Omit<ENSApiPublicConfig, "ensIndexerPublicConfig"> {
|
|
2014
1871
|
/**
|
|
2015
|
-
*
|
|
1872
|
+
* Serialized representation of {@link ENSApiPublicConfig.ensIndexerPublicConfig}.
|
|
2016
1873
|
*/
|
|
2017
|
-
|
|
2018
|
-
/**
|
|
2019
|
-
* The indexing status snapshot for each indexed chain.
|
|
2020
|
-
*/
|
|
2021
|
-
chains: Map<ChainId, ChainIndexingStatusSnapshot>;
|
|
2022
|
-
/**
|
|
2023
|
-
* The timestamp of omnichain indexing progress across all indexed chains.
|
|
2024
|
-
*/
|
|
2025
|
-
omnichainIndexingCursor: UnixTimestamp;
|
|
1874
|
+
ensIndexerPublicConfig: SerializedENSIndexerPublicConfig;
|
|
2026
1875
|
}
|
|
1876
|
+
|
|
2027
1877
|
/**
|
|
2028
|
-
*
|
|
2029
|
-
* {@link OmnichainIndexingStatusIds.Completed}.
|
|
2030
|
-
*
|
|
2031
|
-
* Invariants:
|
|
2032
|
-
* - `omnichainStatus` is always {@link OmnichainIndexingStatusIds.Completed}.
|
|
2033
|
-
* - `chains` is always a map to {@link ChainIndexingStatusSnapshotCompleted} values exclusively.
|
|
2034
|
-
* - `omnichainIndexingCursor` is always equal to the highest
|
|
2035
|
-
* `latestIndexedBlock.timestamp` for all chains.
|
|
1878
|
+
* Deserialize a {@link ENSApiPublicConfig} object.
|
|
2036
1879
|
*/
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
* The status of omnichain indexing.
|
|
2040
|
-
*/
|
|
2041
|
-
omnichainStatus: typeof OmnichainIndexingStatusIds.Completed;
|
|
2042
|
-
/**
|
|
2043
|
-
* The indexing status snapshot for each indexed chain.
|
|
2044
|
-
*/
|
|
2045
|
-
chains: Map<ChainId, ChainIndexingStatusSnapshotCompleted>;
|
|
2046
|
-
/**
|
|
2047
|
-
* The timestamp of omnichain indexing progress across all indexed chains.
|
|
2048
|
-
*/
|
|
2049
|
-
omnichainIndexingCursor: UnixTimestamp;
|
|
2050
|
-
}
|
|
1880
|
+
declare function deserializeENSApiPublicConfig(maybeConfig: SerializedENSApiPublicConfig, valueLabel?: string): ENSApiPublicConfig;
|
|
1881
|
+
|
|
2051
1882
|
/**
|
|
2052
|
-
*
|
|
2053
|
-
*
|
|
2054
|
-
* Use the `omnichainStatus` field to determine the specific type interpretation
|
|
2055
|
-
* at runtime.
|
|
1883
|
+
* Serialize a {@link ENSApiPublicConfig} object.
|
|
2056
1884
|
*/
|
|
2057
|
-
|
|
1885
|
+
declare function serializeENSApiPublicConfig(config: ENSApiPublicConfig): SerializedENSApiPublicConfig;
|
|
1886
|
+
|
|
2058
1887
|
/**
|
|
2059
|
-
*
|
|
1888
|
+
* Create a Zod schema for validating a serialized ENSApiPublicConfig.
|
|
2060
1889
|
*
|
|
2061
|
-
* @
|
|
2062
|
-
*/
|
|
2063
|
-
declare const CrossChainIndexingStrategyIds: {
|
|
2064
|
-
/**
|
|
2065
|
-
* Represents that the indexing of events across all indexed chains will
|
|
2066
|
-
* proceed in a deterministic "omnichain" ordering by block timestamp, chain ID,
|
|
2067
|
-
* and block number.
|
|
2068
|
-
*
|
|
2069
|
-
* This strategy is "deterministic" in that the order of processing cross-chain indexed
|
|
2070
|
-
* events and each resulting indexed data state transition recorded in ENSDb is always
|
|
2071
|
-
* the same for each ENSIndexer instance operating with an equivalent
|
|
2072
|
-
* `ENSIndexerConfig` and ENSIndexer version. However it also has the drawbacks of:
|
|
2073
|
-
* - increased indexing latency that must wait for the slowest indexed chain to
|
|
2074
|
-
* add new blocks or to discover new blocks through the configured RPCs.
|
|
2075
|
-
* - if any indexed chain gets "stuck" due to chain or RPC failures, all indexed chains
|
|
2076
|
-
* will be affected.
|
|
2077
|
-
*/
|
|
2078
|
-
readonly Omnichain: "omnichain";
|
|
2079
|
-
};
|
|
2080
|
-
/**
|
|
2081
|
-
* The derived string union of possible {@link CrossChainIndexingStrategyIds}.
|
|
1890
|
+
* @param valueLabel - Optional label for the value being validated (used in error messages)
|
|
2082
1891
|
*/
|
|
2083
|
-
|
|
1892
|
+
declare function makeENSApiPublicConfigSchema(valueLabel?: string): z.ZodObject<{
|
|
1893
|
+
version: z.ZodString;
|
|
1894
|
+
theGraphFallback: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1895
|
+
canFallback: z.ZodLiteral<true>;
|
|
1896
|
+
url: z.ZodString;
|
|
1897
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1898
|
+
canFallback: z.ZodLiteral<false>;
|
|
1899
|
+
reason: z.ZodEnum<{
|
|
1900
|
+
readonly NotSubgraphCompatible: "not-subgraph-compatible";
|
|
1901
|
+
readonly NoApiKey: "no-api-key";
|
|
1902
|
+
readonly NoSubgraphUrl: "no-subgraph-url";
|
|
1903
|
+
}>;
|
|
1904
|
+
}, z.core.$strict>], "canFallback">;
|
|
1905
|
+
ensIndexerPublicConfig: z.ZodObject<{
|
|
1906
|
+
labelSet: z.ZodObject<{
|
|
1907
|
+
labelSetId: z.ZodString;
|
|
1908
|
+
labelSetVersion: z.ZodPipe<z.ZodCoercedNumber<unknown>, z.ZodInt>;
|
|
1909
|
+
}, z.core.$strip>;
|
|
1910
|
+
indexedChainIds: z.ZodPipe<z.ZodArray<z.ZodPipe<z.ZodInt, z.ZodTransform<number, number>>>, z.ZodTransform<Set<number>, number[]>>;
|
|
1911
|
+
isSubgraphCompatible: z.ZodBoolean;
|
|
1912
|
+
namespace: z.ZodEnum<{
|
|
1913
|
+
readonly Mainnet: "mainnet";
|
|
1914
|
+
readonly Sepolia: "sepolia";
|
|
1915
|
+
readonly SepoliaV2: "sepolia-v2";
|
|
1916
|
+
readonly EnsTestEnv: "ens-test-env";
|
|
1917
|
+
}>;
|
|
1918
|
+
plugins: z.ZodArray<z.ZodString>;
|
|
1919
|
+
databaseSchemaName: z.ZodString;
|
|
1920
|
+
versionInfo: z.ZodObject<{
|
|
1921
|
+
nodejs: z.ZodString;
|
|
1922
|
+
ponder: z.ZodString;
|
|
1923
|
+
ensDb: z.ZodString;
|
|
1924
|
+
ensIndexer: z.ZodString;
|
|
1925
|
+
ensNormalize: z.ZodString;
|
|
1926
|
+
ensRainbow: z.ZodString;
|
|
1927
|
+
ensRainbowSchema: z.ZodInt;
|
|
1928
|
+
}, z.core.$strict>;
|
|
1929
|
+
}, z.core.$strip>;
|
|
1930
|
+
}, z.core.$strict>;
|
|
1931
|
+
|
|
2084
1932
|
/**
|
|
2085
|
-
*
|
|
2086
|
-
* {@link CrossChainIndexingStrategyId.Omnichain}.
|
|
2087
|
-
*
|
|
2088
|
-
* Invariants:
|
|
2089
|
-
* - `strategy` is always {@link CrossChainIndexingStrategyId.Omnichain}.
|
|
2090
|
-
* - `slowestChainIndexingCursor` is always equal to
|
|
2091
|
-
* `omnichainSnapshot.omnichainIndexingCursor`.
|
|
2092
|
-
* - `snapshotTime` is always >= the "highest known block timestamp", defined as the max of:
|
|
2093
|
-
* - the `slowestChainIndexingCursor`.
|
|
2094
|
-
* - the `config.startBlock.timestamp` for all indexed chains.
|
|
2095
|
-
* - the `config.endBlock.timestamp` for all indexed chains with a `config.configType` of
|
|
2096
|
-
* {@link ChainIndexingConfigTypeIds.Definite}.
|
|
2097
|
-
* - the `backfillEndBlock.timestamp` for all chains with `chainStatus` of
|
|
2098
|
-
* {@link ChainIndexingStatusIds.Backfill}.
|
|
2099
|
-
* - the `latestKnownBlock.timestamp` for all chains with `chainStatus` of
|
|
2100
|
-
* {@link ChainIndexingStatusIds.Following}.
|
|
1933
|
+
* ENSApi Public Config Response
|
|
2101
1934
|
*/
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
strategy: typeof CrossChainIndexingStrategyIds.Omnichain;
|
|
2107
|
-
/**
|
|
2108
|
-
* The timestamp of the "slowest" latest indexed block timestamp
|
|
2109
|
-
* across all indexed chains.
|
|
2110
|
-
*/
|
|
2111
|
-
slowestChainIndexingCursor: UnixTimestamp;
|
|
2112
|
-
/**
|
|
2113
|
-
* The timestamp when the cross-chain indexing status snapshot was generated.
|
|
2114
|
-
*
|
|
2115
|
-
* Due to possible clock skew between different systems this value must be set
|
|
2116
|
-
* to the max of each of the following values to ensure all invariants are followed:
|
|
2117
|
-
* - the current system time of the system generating this cross-chain indexing
|
|
2118
|
-
* status snapshot.
|
|
2119
|
-
* - the "highest known block timestamp" (see invariants above for full definition).
|
|
2120
|
-
*/
|
|
2121
|
-
snapshotTime: UnixTimestamp;
|
|
2122
|
-
/**
|
|
2123
|
-
* The omnichain indexing status snapshot for one or more chains.
|
|
2124
|
-
*/
|
|
2125
|
-
omnichainSnapshot: OmnichainIndexingStatusSnapshot;
|
|
2126
|
-
}
|
|
1935
|
+
type ConfigResponse = ENSApiPublicConfig;
|
|
1936
|
+
|
|
1937
|
+
type SerializedConfigResponse = SerializedENSApiPublicConfig;
|
|
1938
|
+
|
|
2127
1939
|
/**
|
|
2128
|
-
*
|
|
2129
|
-
*
|
|
2130
|
-
* Use the `strategy` field to determine the specific type interpretation
|
|
2131
|
-
* at runtime.
|
|
2132
|
-
*
|
|
2133
|
-
* Currently, only omnichain indexing is supported. This type could theoretically
|
|
2134
|
-
* be extended to support other cross-chain indexing strategies in the future,
|
|
2135
|
-
* such as Ponder's "multichain" indexing strategy that indexes each chain
|
|
2136
|
-
* independently without deterministic ordering.
|
|
1940
|
+
* Deserialize a {@link ConfigResponse} object.
|
|
2137
1941
|
*/
|
|
2138
|
-
|
|
1942
|
+
declare function deserializeConfigResponse(serializedResponse: SerializedConfigResponse): ConfigResponse;
|
|
1943
|
+
|
|
1944
|
+
declare function serializeConfigResponse(response: ConfigResponse): SerializedConfigResponse;
|
|
1945
|
+
|
|
2139
1946
|
/**
|
|
2140
|
-
* A
|
|
2141
|
-
* from the `snapshot`.
|
|
2142
|
-
*
|
|
2143
|
-
* Invariants:
|
|
2144
|
-
* - `projectedAt` is always >= `snapshot.snapshotTime`.
|
|
2145
|
-
* - `worstCaseDistance` is always equal to
|
|
2146
|
-
* `projectedAt - snapshot.slowestChainIndexingCursor`.
|
|
1947
|
+
* A status code for indexing status responses.
|
|
2147
1948
|
*/
|
|
2148
|
-
|
|
2149
|
-
/**
|
|
2150
|
-
* The timestamp representing "now" as of the time this projection was generated.
|
|
2151
|
-
*/
|
|
2152
|
-
projectedAt: UnixTimestamp;
|
|
1949
|
+
declare const IndexingStatusResponseCodes: {
|
|
2153
1950
|
/**
|
|
2154
|
-
*
|
|
2155
|
-
*
|
|
2156
|
-
* This is "worst-case" because it assumes all of the following:
|
|
2157
|
-
* - the `snapshot` (which may have `snapshot.snapshotTime < projectedAt`) is still the
|
|
2158
|
-
* latest snapshot and no indexing progress has been made since `snapshotTime`.
|
|
2159
|
-
* - each indexed chain has added a new block as of `projectedAt`.
|
|
1951
|
+
* Represents that the indexing status is available.
|
|
2160
1952
|
*/
|
|
2161
|
-
|
|
1953
|
+
readonly Ok: "ok";
|
|
2162
1954
|
/**
|
|
2163
|
-
*
|
|
1955
|
+
* Represents that the indexing status is unavailable.
|
|
2164
1956
|
*/
|
|
2165
|
-
|
|
1957
|
+
readonly Error: "error";
|
|
2166
1958
|
};
|
|
2167
|
-
|
|
2168
1959
|
/**
|
|
2169
|
-
*
|
|
1960
|
+
* The derived string union of possible {@link IndexingStatusResponseCodes}.
|
|
2170
1961
|
*/
|
|
2171
|
-
type
|
|
1962
|
+
type IndexingStatusResponseCode = (typeof IndexingStatusResponseCodes)[keyof typeof IndexingStatusResponseCodes];
|
|
2172
1963
|
/**
|
|
2173
|
-
*
|
|
1964
|
+
* An indexing status response when the indexing status is available.
|
|
2174
1965
|
*/
|
|
2175
|
-
type
|
|
1966
|
+
type IndexingStatusResponseOk = {
|
|
1967
|
+
responseCode: typeof IndexingStatusResponseCodes.Ok;
|
|
1968
|
+
realtimeProjection: RealtimeIndexingStatusProjection;
|
|
1969
|
+
};
|
|
2176
1970
|
/**
|
|
2177
|
-
*
|
|
1971
|
+
* An indexing status response when the indexing status is unavailable.
|
|
2178
1972
|
*/
|
|
2179
|
-
type
|
|
1973
|
+
type IndexingStatusResponseError = {
|
|
1974
|
+
responseCode: typeof IndexingStatusResponseCodes.Error;
|
|
1975
|
+
};
|
|
2180
1976
|
/**
|
|
2181
|
-
*
|
|
1977
|
+
* Indexing status response.
|
|
1978
|
+
*
|
|
1979
|
+
* Use the `responseCode` field to determine the specific type interpretation
|
|
1980
|
+
* at runtime.
|
|
2182
1981
|
*/
|
|
2183
|
-
type
|
|
1982
|
+
type IndexingStatusResponse = IndexingStatusResponseOk | IndexingStatusResponseError;
|
|
1983
|
+
|
|
2184
1984
|
/**
|
|
2185
|
-
* Serialized representation of {@link
|
|
1985
|
+
* Serialized representation of {@link IndexingStatusResponseError}.
|
|
2186
1986
|
*/
|
|
2187
|
-
type
|
|
1987
|
+
type SerializedIndexingStatusResponseError = IndexingStatusResponseError;
|
|
2188
1988
|
/**
|
|
2189
|
-
* Serialized representation of {@link
|
|
1989
|
+
* Serialized representation of {@link IndexingStatusResponseOk}.
|
|
2190
1990
|
*/
|
|
2191
|
-
interface
|
|
2192
|
-
|
|
1991
|
+
interface SerializedIndexingStatusResponseOk extends Omit<IndexingStatusResponseOk, "realtimeProjection"> {
|
|
1992
|
+
realtimeProjection: SerializedRealtimeIndexingStatusProjection;
|
|
2193
1993
|
}
|
|
2194
1994
|
/**
|
|
2195
|
-
* Serialized representation of {@link
|
|
1995
|
+
* Serialized representation of {@link IndexingStatusResponse}.
|
|
2196
1996
|
*/
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
}
|
|
1997
|
+
type SerializedIndexingStatusResponse = SerializedIndexingStatusResponseOk | SerializedIndexingStatusResponseError;
|
|
1998
|
+
|
|
2200
1999
|
/**
|
|
2201
|
-
*
|
|
2000
|
+
* Deserialize a {@link IndexingStatusResponse} object.
|
|
2202
2001
|
*/
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
}
|
|
2002
|
+
declare function deserializeIndexingStatusResponse(maybeResponse: SerializedIndexingStatusResponse): IndexingStatusResponse;
|
|
2003
|
+
|
|
2206
2004
|
/**
|
|
2207
|
-
*
|
|
2005
|
+
* Represents a request to Indexing Status API.
|
|
2208
2006
|
*/
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2007
|
+
type IndexingStatusRequest = {};
|
|
2008
|
+
|
|
2009
|
+
declare function serializeIndexingStatusResponse(response: IndexingStatusResponse): SerializedIndexingStatusResponse;
|
|
2010
|
+
|
|
2212
2011
|
/**
|
|
2213
|
-
*
|
|
2214
|
-
*/
|
|
2215
|
-
type SerializedOmnichainIndexingStatusSnapshot = SerializedOmnichainIndexingStatusSnapshotUnstarted | SerializedOmnichainIndexingStatusSnapshotBackfill | SerializedOmnichainIndexingStatusSnapshotCompleted | SerializedOmnichainIndexingStatusSnapshotFollowing;
|
|
2216
|
-
/**
|
|
2217
|
-
* Serialized representation of {@link CrossChainIndexingStatusSnapshotOmnichain}
|
|
2218
|
-
*/
|
|
2219
|
-
interface SerializedCrossChainIndexingStatusSnapshotOmnichain extends Omit<CrossChainIndexingStatusSnapshotOmnichain, "omnichainSnapshot"> {
|
|
2220
|
-
omnichainSnapshot: SerializedOmnichainIndexingStatusSnapshot;
|
|
2221
|
-
}
|
|
2222
|
-
/**
|
|
2223
|
-
* Serialized representation of {@link CrossChainIndexingStatusSnapshot}
|
|
2224
|
-
*/
|
|
2225
|
-
type SerializedCrossChainIndexingStatusSnapshot = SerializedCrossChainIndexingStatusSnapshotOmnichain;
|
|
2226
|
-
/**
|
|
2227
|
-
* Serialized representation of {@link RealtimeIndexingStatusProjection}
|
|
2228
|
-
*/
|
|
2229
|
-
interface SerializedCurrentIndexingProjectionOmnichain extends Omit<RealtimeIndexingStatusProjection, "snapshot"> {
|
|
2230
|
-
snapshot: SerializedOmnichainIndexingStatusSnapshot;
|
|
2231
|
-
}
|
|
2232
|
-
/**
|
|
2233
|
-
* Serialized representation of {@link RealtimeIndexingStatusProjection}
|
|
2012
|
+
* Deserialize a {@link NameTokensResponse} object.
|
|
2234
2013
|
*/
|
|
2235
|
-
|
|
2236
|
-
snapshot: SerializedCrossChainIndexingStatusSnapshot;
|
|
2237
|
-
}
|
|
2014
|
+
declare function deserializedNameTokensResponse(maybeResponse: SerializedNameTokensResponse): NameTokensResponse;
|
|
2238
2015
|
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2016
|
+
declare const nameTokensPrerequisites: Readonly<{
|
|
2017
|
+
/**
|
|
2018
|
+
* Required plugins to enable Name Tokens API routes.
|
|
2019
|
+
*
|
|
2020
|
+
* 1. `registrars` plugin is required so that data in the `registrationLifecycles`
|
|
2021
|
+
* table is populated.
|
|
2022
|
+
* 2. `tokenscope` plugin is required so that data in the `nameTokens`
|
|
2023
|
+
* table is populated.
|
|
2024
|
+
*/
|
|
2025
|
+
requiredPlugins: readonly [PluginName.Registrars, PluginName.TokenScope];
|
|
2026
|
+
/**
|
|
2027
|
+
* Check if provided ENSApiPublicConfig supports the Name Tokens API.
|
|
2028
|
+
*/
|
|
2029
|
+
hasEnsIndexerConfigSupport(config: ENSIndexerPublicConfig): boolean;
|
|
2030
|
+
/**
|
|
2031
|
+
* Required Indexing Status IDs
|
|
2032
|
+
*
|
|
2033
|
+
* Database indexes are created by the time the omnichain indexing status
|
|
2034
|
+
* is either `completed` or `following`.
|
|
2035
|
+
*/
|
|
2036
|
+
supportedIndexingStatusIds: ("omnichain-following" | "omnichain-completed")[];
|
|
2037
|
+
/**
|
|
2038
|
+
* Check if provided indexing status supports the Name Tokens API.
|
|
2039
|
+
*/
|
|
2040
|
+
hasIndexingStatusSupport(omnichainIndexingStatusId: OmnichainIndexingStatusId): boolean;
|
|
2041
|
+
}>;
|
|
2255
2042
|
|
|
2256
2043
|
/**
|
|
2257
|
-
*
|
|
2258
|
-
*
|
|
2259
|
-
* This function decides what is the `OmnichainIndexingStatusId` is,
|
|
2260
|
-
* based on provided chain indexing statuses.
|
|
2261
|
-
*
|
|
2262
|
-
* @throws an error if unable to determine overall indexing status
|
|
2263
|
-
*/
|
|
2264
|
-
declare function getOmnichainIndexingStatus(chains: ChainIndexingStatusSnapshot[]): OmnichainIndexingStatusId;
|
|
2265
|
-
/**
|
|
2266
|
-
* Get the timestamp of the lowest `config.startBlock` across all chains
|
|
2267
|
-
* in the provided array of {@link ChainIndexingStatusSnapshot}.
|
|
2044
|
+
* Represents request to Name Tokens API.
|
|
2268
2045
|
*
|
|
2269
|
-
*
|
|
2270
|
-
* to be indexed across all chains.
|
|
2046
|
+
* Either `domainId` or `name` must be provided, but not both.
|
|
2271
2047
|
*/
|
|
2272
|
-
|
|
2048
|
+
interface NameTokensRequest {
|
|
2049
|
+
/**
|
|
2050
|
+
* Domain ID (namehash) for which name tokens were requested.
|
|
2051
|
+
*/
|
|
2052
|
+
domainId?: Node;
|
|
2053
|
+
/**
|
|
2054
|
+
* Name for which name tokens were requested.
|
|
2055
|
+
*/
|
|
2056
|
+
name?: Name;
|
|
2057
|
+
}
|
|
2058
|
+
|
|
2273
2059
|
/**
|
|
2274
|
-
*
|
|
2275
|
-
* in the provided array of {@link ChainIndexingStatusSnapshot}.
|
|
2276
|
-
*
|
|
2277
|
-
* Such timestamp is useful when presenting the "highest known block"
|
|
2278
|
-
* to be indexed across all chains.
|
|
2279
|
-
*
|
|
2280
|
-
* The "highest known block" for a chain depends on its status:
|
|
2281
|
-
* - `config.endBlock` for a "queued" chain,
|
|
2282
|
-
* - `backfillEndBlock` for a "backfill" chain,
|
|
2283
|
-
* - `latestIndexedBlock` for a "completed" chain,
|
|
2284
|
-
* - `latestKnownBlock` for a "following" chain.
|
|
2060
|
+
* Serialized representation of {@link TokenId}.
|
|
2285
2061
|
*/
|
|
2286
|
-
|
|
2062
|
+
type SerializedTokenId = string;
|
|
2287
2063
|
/**
|
|
2288
|
-
*
|
|
2289
|
-
*
|
|
2290
|
-
* The cursor tracks the "highest" latest indexed block timestamp across
|
|
2291
|
-
* all indexed chains. If all chains are queued, the cursor tracks the moment
|
|
2292
|
-
* just before the earliest start block timestamp across those chains.
|
|
2293
|
-
*
|
|
2294
|
-
* @throws an error if no chains are provided
|
|
2064
|
+
* Serialized representation of {@link AssetId}.
|
|
2295
2065
|
*/
|
|
2296
|
-
|
|
2066
|
+
interface SerializedAssetId extends Omit<AssetId, "tokenId"> {
|
|
2067
|
+
tokenId: SerializedTokenId;
|
|
2068
|
+
}
|
|
2297
2069
|
/**
|
|
2298
|
-
*
|
|
2299
|
-
*
|
|
2300
|
-
* @param startBlock required block ref
|
|
2301
|
-
* @param endBlock optional block ref
|
|
2070
|
+
* Serializes {@link AssetId} object to a structured form.
|
|
2302
2071
|
*/
|
|
2303
|
-
declare function
|
|
2072
|
+
declare function serializeAssetId(assetId: AssetId): SerializedAssetId;
|
|
2304
2073
|
/**
|
|
2305
|
-
*
|
|
2306
|
-
* snapshot requirements:
|
|
2307
|
-
* - All chains are guaranteed to have a status of "queued".
|
|
2308
|
-
*
|
|
2309
|
-
* Note: This function narrows the {@link ChainIndexingStatusSnapshot} type to
|
|
2310
|
-
* {@link ChainIndexingStatusSnapshotQueued}.
|
|
2074
|
+
* Deserialize a {@link AssetId} object.
|
|
2311
2075
|
*/
|
|
2312
|
-
declare function
|
|
2076
|
+
declare function deserializeAssetId(maybeAssetId: unknown, valueLabel?: string): AssetId;
|
|
2313
2077
|
/**
|
|
2314
|
-
*
|
|
2315
|
-
* snapshot requirements:
|
|
2316
|
-
* - At least one chain is guaranteed to be in the "backfill" status.
|
|
2317
|
-
* - Each chain is guaranteed to have a status of either "queued",
|
|
2318
|
-
* "backfill" or "completed".
|
|
2319
|
-
*
|
|
2320
|
-
* Note: This function narrows the {@link ChainIndexingStatusSnapshot} type to
|
|
2321
|
-
* {@link ChainIndexingStatusSnapshotForOmnichainIndexingStatusSnapshotBackfill}.
|
|
2078
|
+
* Parse a stringified representation of {@link AssetId} object.
|
|
2322
2079
|
*/
|
|
2323
|
-
declare function
|
|
2080
|
+
declare function parseAssetId(maybeAssetId: AssetIdString, valueLabel?: string): AssetId;
|
|
2324
2081
|
/**
|
|
2325
|
-
*
|
|
2326
|
-
*
|
|
2327
|
-
* - All chains are guaranteed to have a status of "completed".
|
|
2082
|
+
* Builds an AssetId for the NFT represented by the given contract,
|
|
2083
|
+
* tokenId, and assetNamespace.
|
|
2328
2084
|
*
|
|
2329
|
-
*
|
|
2330
|
-
*
|
|
2085
|
+
* @param contract - The contract that manages the NFT
|
|
2086
|
+
* @param tokenId - The tokenId of the NFT
|
|
2087
|
+
* @param assetNamespace - The assetNamespace of the NFT
|
|
2088
|
+
* @returns The AssetId for the NFT represented by the given contract,
|
|
2089
|
+
* tokenId, and assetNamespace
|
|
2331
2090
|
*/
|
|
2332
|
-
declare
|
|
2091
|
+
declare const buildAssetId: (contract: AccountId, tokenId: TokenId, assetNamespace: AssetNamespace) => AssetId;
|
|
2333
2092
|
/**
|
|
2334
|
-
*
|
|
2335
|
-
* snapshot requirements:
|
|
2336
|
-
* - At least one chain is guaranteed to be in the "following" status.
|
|
2337
|
-
* - Any other chain can have any status.
|
|
2093
|
+
* A globally unique reference to an NFT tokenizing the ownership of a domain.
|
|
2338
2094
|
*/
|
|
2339
|
-
|
|
2095
|
+
interface DomainAssetId extends AssetId {
|
|
2096
|
+
/**
|
|
2097
|
+
* The namehash (node) of the domain who's ownership is tokenized by
|
|
2098
|
+
* this `AssetId`.
|
|
2099
|
+
*/
|
|
2100
|
+
domainId: Node;
|
|
2101
|
+
}
|
|
2340
2102
|
/**
|
|
2341
|
-
*
|
|
2342
|
-
* by the omnichain start block timestamp in ascending order.
|
|
2103
|
+
* Serialized representation of {@link DomainAssetId}.
|
|
2343
2104
|
*/
|
|
2344
|
-
|
|
2105
|
+
interface SerializedDomainAssetId extends SerializedAssetId {
|
|
2106
|
+
domainId: Node;
|
|
2107
|
+
}
|
|
2108
|
+
declare function serializeDomainAssetId(domainAsset: DomainAssetId): SerializedDomainAssetId;
|
|
2345
2109
|
/**
|
|
2346
|
-
*
|
|
2110
|
+
* An enum representing the mint status of a DomainAssetId.
|
|
2347
2111
|
*
|
|
2348
|
-
*
|
|
2349
|
-
*
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
/**
|
|
2354
|
-
* Create realtime indexing status projection from
|
|
2355
|
-
* a {@link CrossChainIndexingStatusSnapshot}.
|
|
2356
|
-
*/
|
|
2357
|
-
declare function createRealtimeIndexingStatusProjection(snapshot: CrossChainIndexingStatusSnapshot, now: UnixTimestamp): RealtimeIndexingStatusProjection;
|
|
2358
|
-
|
|
2359
|
-
declare function serializeCrossChainIndexingStatusSnapshotOmnichain({ strategy, slowestChainIndexingCursor, snapshotTime, omnichainSnapshot, }: CrossChainIndexingStatusSnapshot): SerializedCrossChainIndexingStatusSnapshot;
|
|
2360
|
-
declare function serializeRealtimeIndexingStatusProjection(indexingProjection: RealtimeIndexingStatusProjection): SerializedRealtimeIndexingStatusProjection;
|
|
2361
|
-
/**
|
|
2362
|
-
* Serialize chain indexing snapshots.
|
|
2363
|
-
*/
|
|
2364
|
-
declare function serializeChainIndexingSnapshots<ChainIndexingStatusSnapshotType extends ChainIndexingStatusSnapshot>(chains: Map<ChainId, ChainIndexingStatusSnapshotType>): Record<ChainIdString, ChainIndexingStatusSnapshotType>;
|
|
2365
|
-
/**
|
|
2366
|
-
* Serialize a {@link OmnichainIndexingStatusSnapshot} object.
|
|
2367
|
-
*/
|
|
2368
|
-
declare function serializeOmnichainIndexingStatusSnapshot(indexingStatus: OmnichainIndexingStatusSnapshot): SerializedOmnichainIndexingStatusSnapshot;
|
|
2369
|
-
|
|
2370
|
-
/**
|
|
2371
|
-
* Reasons why TheGraph fallback cannot be used.
|
|
2112
|
+
* After we index a NFT we never delete it from our index. Instead, when an
|
|
2113
|
+
* indexed NFT is burned onchain we retain its record and update its mint
|
|
2114
|
+
* status as `burned`. If a NFT is minted again after it is burned its mint
|
|
2115
|
+
* status is updated to `minted`.
|
|
2372
2116
|
*/
|
|
2373
|
-
declare const
|
|
2374
|
-
readonly
|
|
2375
|
-
readonly
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
type TheGraphCannotFallbackReason = z.infer<typeof TheGraphCannotFallbackReasonSchema>;
|
|
2117
|
+
declare const NFTMintStatuses: {
|
|
2118
|
+
readonly Minted: "minted";
|
|
2119
|
+
readonly Burned: "burned";
|
|
2120
|
+
};
|
|
2121
|
+
type NFTMintStatus = (typeof NFTMintStatuses)[keyof typeof NFTMintStatuses];
|
|
2379
2122
|
/**
|
|
2380
|
-
*
|
|
2381
|
-
*
|
|
2123
|
+
* Metadata about a NFT transfer event.
|
|
2124
|
+
*
|
|
2125
|
+
* This metadata can be used for building more helpful messages when processing
|
|
2126
|
+
* NFT transfer events.
|
|
2382
2127
|
*/
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
readonly NoSubgraphUrl: "no-subgraph-url";
|
|
2392
|
-
}>;
|
|
2393
|
-
}, z.core.$strict>], "canFallback">;
|
|
2394
|
-
type TheGraphFallback = z.infer<typeof TheGraphFallbackSchema>;
|
|
2395
|
-
|
|
2128
|
+
interface NFTTransferEventMetadata {
|
|
2129
|
+
chainId: ChainId;
|
|
2130
|
+
blockNumber: bigint;
|
|
2131
|
+
transactionHash: Hex;
|
|
2132
|
+
eventHandlerName: string;
|
|
2133
|
+
nft: DomainAssetId;
|
|
2134
|
+
}
|
|
2135
|
+
declare const formatNFTTransferEventMetadata: (metadata: NFTTransferEventMetadata) => string;
|
|
2396
2136
|
/**
|
|
2397
|
-
*
|
|
2398
|
-
*
|
|
2399
|
-
* Contains ENSApi-specific configuration at the top level and
|
|
2400
|
-
* embeds the complete ENSIndexer public configuration.
|
|
2137
|
+
* An enum representing the type of transfer that has occurred to a DomainAssetId.
|
|
2401
2138
|
*/
|
|
2402
|
-
|
|
2139
|
+
declare const NFTTransferTypes: {
|
|
2403
2140
|
/**
|
|
2404
|
-
*
|
|
2141
|
+
* Initial transfer from zeroAddress to a non-zeroAddress
|
|
2142
|
+
* Can happen at most once to a NFT AssetId
|
|
2405
2143
|
*
|
|
2406
|
-
*
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
* The Graph Fallback-related info.
|
|
2144
|
+
* Invariants:
|
|
2145
|
+
* - NFT is not indexed and therefore has no previous mint status or owner
|
|
2146
|
+
* - new NFT mint status is `minted`
|
|
2147
|
+
* - new NFT owner is a non-zeroAddress
|
|
2411
2148
|
*/
|
|
2412
|
-
|
|
2149
|
+
readonly Mint: "mint";
|
|
2413
2150
|
/**
|
|
2414
|
-
*
|
|
2151
|
+
* Subsequent transfer from zeroAddress to a non-zeroAddress
|
|
2152
|
+
* Can happen any number of times to a NFT AssetId as it passes in a cycle from
|
|
2153
|
+
* mint -> burn -> remint -> burn -> remint -> ...
|
|
2415
2154
|
*
|
|
2416
|
-
*
|
|
2417
|
-
*
|
|
2155
|
+
* Invariants:
|
|
2156
|
+
* - NFT is indexed
|
|
2157
|
+
* - previous NFT mint status was `burned`
|
|
2158
|
+
* - previous NFT owner is the zeroAddress
|
|
2159
|
+
* - new NFT mint status is `minted`
|
|
2160
|
+
* - new NFT owner is a non-zeroAddress
|
|
2418
2161
|
*/
|
|
2419
|
-
|
|
2420
|
-
}
|
|
2421
|
-
|
|
2422
|
-
/**
|
|
2423
|
-
* Serialized representation of {@link ENSApiPublicConfig}
|
|
2424
|
-
*/
|
|
2425
|
-
interface SerializedENSApiPublicConfig extends Omit<ENSApiPublicConfig, "ensIndexerPublicConfig"> {
|
|
2162
|
+
readonly Remint: "remint";
|
|
2426
2163
|
/**
|
|
2427
|
-
*
|
|
2164
|
+
* Special transfer type for improperly implemented NFT contracts that allow a NFT
|
|
2165
|
+
* that is currently minted to be reminted before an intermediate burn.
|
|
2166
|
+
*
|
|
2167
|
+
* Transfer from zeroAddress to non-zeroAddress for an indexed NFT where the
|
|
2168
|
+
* previously indexed nft had status `minted` with a non-zeroAddress owner.
|
|
2169
|
+
*
|
|
2170
|
+
* Invariants:
|
|
2171
|
+
* - NFT is indexed
|
|
2172
|
+
* - previous NFT mint status was `minted`
|
|
2173
|
+
* - previous NFT owner was a non-zeroAddress
|
|
2174
|
+
* - new NFT mint status is `minted`
|
|
2175
|
+
* - new NFT owner is a non-zeroAddress
|
|
2428
2176
|
*/
|
|
2429
|
-
|
|
2430
|
-
}
|
|
2431
|
-
|
|
2432
|
-
/**
|
|
2433
|
-
* Deserialize a {@link ENSApiPublicConfig} object.
|
|
2434
|
-
*/
|
|
2435
|
-
declare function deserializeENSApiPublicConfig(maybeConfig: SerializedENSApiPublicConfig, valueLabel?: string): ENSApiPublicConfig;
|
|
2436
|
-
|
|
2437
|
-
/**
|
|
2438
|
-
* Serialize a {@link ENSApiPublicConfig} object.
|
|
2439
|
-
*/
|
|
2440
|
-
declare function serializeENSApiPublicConfig(config: ENSApiPublicConfig): SerializedENSApiPublicConfig;
|
|
2441
|
-
|
|
2442
|
-
/**
|
|
2443
|
-
* Create a Zod schema for validating a serialized ENSApiPublicConfig.
|
|
2444
|
-
*
|
|
2445
|
-
* @param valueLabel - Optional label for the value being validated (used in error messages)
|
|
2446
|
-
*/
|
|
2447
|
-
declare function makeENSApiPublicConfigSchema(valueLabel?: string): z.ZodObject<{
|
|
2448
|
-
version: z.ZodString;
|
|
2449
|
-
theGraphFallback: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2450
|
-
canFallback: z.ZodLiteral<true>;
|
|
2451
|
-
url: z.ZodString;
|
|
2452
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
2453
|
-
canFallback: z.ZodLiteral<false>;
|
|
2454
|
-
reason: z.ZodEnum<{
|
|
2455
|
-
readonly NotSubgraphCompatible: "not-subgraph-compatible";
|
|
2456
|
-
readonly NoApiKey: "no-api-key";
|
|
2457
|
-
readonly NoSubgraphUrl: "no-subgraph-url";
|
|
2458
|
-
}>;
|
|
2459
|
-
}, z.core.$strict>], "canFallback">;
|
|
2460
|
-
ensIndexerPublicConfig: z.ZodObject<{
|
|
2461
|
-
labelSet: z.ZodObject<{
|
|
2462
|
-
labelSetId: z.ZodString;
|
|
2463
|
-
labelSetVersion: z.ZodPipe<z.ZodCoercedNumber<unknown>, z.ZodInt>;
|
|
2464
|
-
}, z.core.$strip>;
|
|
2465
|
-
indexedChainIds: z.ZodPipe<z.ZodArray<z.ZodPipe<z.ZodInt, z.ZodTransform<number, number>>>, z.ZodTransform<Set<number>, number[]>>;
|
|
2466
|
-
isSubgraphCompatible: z.ZodBoolean;
|
|
2467
|
-
namespace: z.ZodEnum<{
|
|
2468
|
-
readonly Mainnet: "mainnet";
|
|
2469
|
-
readonly Sepolia: "sepolia";
|
|
2470
|
-
readonly SepoliaV2: "sepolia-v2";
|
|
2471
|
-
readonly EnsTestEnv: "ens-test-env";
|
|
2472
|
-
}>;
|
|
2473
|
-
plugins: z.ZodArray<z.ZodString>;
|
|
2474
|
-
databaseSchemaName: z.ZodString;
|
|
2475
|
-
versionInfo: z.ZodObject<{
|
|
2476
|
-
nodejs: z.ZodString;
|
|
2477
|
-
ponder: z.ZodString;
|
|
2478
|
-
ensDb: z.ZodString;
|
|
2479
|
-
ensIndexer: z.ZodString;
|
|
2480
|
-
ensNormalize: z.ZodString;
|
|
2481
|
-
ensRainbow: z.ZodString;
|
|
2482
|
-
ensRainbowSchema: z.ZodInt;
|
|
2483
|
-
}, z.core.$strict>;
|
|
2484
|
-
}, z.core.$strip>;
|
|
2485
|
-
}, z.core.$strict>;
|
|
2486
|
-
|
|
2487
|
-
/**
|
|
2488
|
-
* ENSApi Public Config Response
|
|
2489
|
-
*/
|
|
2490
|
-
type ConfigResponse = ENSApiPublicConfig;
|
|
2491
|
-
|
|
2492
|
-
type SerializedConfigResponse = SerializedENSApiPublicConfig;
|
|
2493
|
-
|
|
2494
|
-
/**
|
|
2495
|
-
* Deserialize a {@link ConfigResponse} object.
|
|
2496
|
-
*/
|
|
2497
|
-
declare function deserializeConfigResponse(serializedResponse: SerializedConfigResponse): ConfigResponse;
|
|
2498
|
-
|
|
2499
|
-
declare function serializeConfigResponse(response: ConfigResponse): SerializedConfigResponse;
|
|
2500
|
-
|
|
2501
|
-
/**
|
|
2502
|
-
* A status code for indexing status responses.
|
|
2503
|
-
*/
|
|
2504
|
-
declare const IndexingStatusResponseCodes: {
|
|
2177
|
+
readonly MintedRemint: "minted-remint";
|
|
2505
2178
|
/**
|
|
2506
|
-
*
|
|
2179
|
+
* Transfer from a non-zeroAddress to zeroAddress
|
|
2180
|
+
*
|
|
2181
|
+
* Invariants:
|
|
2182
|
+
* - NFT is indexed
|
|
2183
|
+
* - previous NFT mint status was `minted`
|
|
2184
|
+
* - previous NFT owner is a non-zeroAddress
|
|
2185
|
+
* - new NFT mint status is `burned`
|
|
2186
|
+
* - new NFT owner is the zeroAddress
|
|
2507
2187
|
*/
|
|
2508
|
-
readonly
|
|
2188
|
+
readonly Burn: "burn";
|
|
2509
2189
|
/**
|
|
2510
|
-
*
|
|
2190
|
+
* Transfer from a non-zeroAddress to a distinct non-zeroAddress
|
|
2191
|
+
*
|
|
2192
|
+
* Invariants:
|
|
2193
|
+
* - NFT is indexed
|
|
2194
|
+
* - previous and new NFT mint status is `minted`
|
|
2195
|
+
* - previous and new NFT owner are distinct non-zeroAddress
|
|
2511
2196
|
*/
|
|
2512
|
-
readonly
|
|
2513
|
-
};
|
|
2514
|
-
/**
|
|
2515
|
-
* The derived string union of possible {@link IndexingStatusResponseCodes}.
|
|
2516
|
-
*/
|
|
2517
|
-
type IndexingStatusResponseCode = (typeof IndexingStatusResponseCodes)[keyof typeof IndexingStatusResponseCodes];
|
|
2518
|
-
/**
|
|
2519
|
-
* An indexing status response when the indexing status is available.
|
|
2520
|
-
*/
|
|
2521
|
-
type IndexingStatusResponseOk = {
|
|
2522
|
-
responseCode: typeof IndexingStatusResponseCodes.Ok;
|
|
2523
|
-
realtimeProjection: RealtimeIndexingStatusProjection;
|
|
2524
|
-
};
|
|
2525
|
-
/**
|
|
2526
|
-
* An indexing status response when the indexing status is unavailable.
|
|
2527
|
-
*/
|
|
2528
|
-
type IndexingStatusResponseError = {
|
|
2529
|
-
responseCode: typeof IndexingStatusResponseCodes.Error;
|
|
2530
|
-
};
|
|
2531
|
-
/**
|
|
2532
|
-
* Indexing status response.
|
|
2533
|
-
*
|
|
2534
|
-
* Use the `responseCode` field to determine the specific type interpretation
|
|
2535
|
-
* at runtime.
|
|
2536
|
-
*/
|
|
2537
|
-
type IndexingStatusResponse = IndexingStatusResponseOk | IndexingStatusResponseError;
|
|
2538
|
-
|
|
2539
|
-
/**
|
|
2540
|
-
* Serialized representation of {@link IndexingStatusResponseError}.
|
|
2541
|
-
*/
|
|
2542
|
-
type SerializedIndexingStatusResponseError = IndexingStatusResponseError;
|
|
2543
|
-
/**
|
|
2544
|
-
* Serialized representation of {@link IndexingStatusResponseOk}.
|
|
2545
|
-
*/
|
|
2546
|
-
interface SerializedIndexingStatusResponseOk extends Omit<IndexingStatusResponseOk, "realtimeProjection"> {
|
|
2547
|
-
realtimeProjection: SerializedRealtimeIndexingStatusProjection;
|
|
2548
|
-
}
|
|
2549
|
-
/**
|
|
2550
|
-
* Serialized representation of {@link IndexingStatusResponse}.
|
|
2551
|
-
*/
|
|
2552
|
-
type SerializedIndexingStatusResponse = SerializedIndexingStatusResponseOk | SerializedIndexingStatusResponseError;
|
|
2553
|
-
|
|
2554
|
-
/**
|
|
2555
|
-
* Deserialize a {@link IndexingStatusResponse} object.
|
|
2556
|
-
*/
|
|
2557
|
-
declare function deserializeIndexingStatusResponse(maybeResponse: SerializedIndexingStatusResponse): IndexingStatusResponse;
|
|
2558
|
-
|
|
2559
|
-
/**
|
|
2560
|
-
* Represents a request to Indexing Status API.
|
|
2561
|
-
*/
|
|
2562
|
-
type IndexingStatusRequest = {};
|
|
2563
|
-
|
|
2564
|
-
declare function serializeIndexingStatusResponse(response: IndexingStatusResponse): SerializedIndexingStatusResponse;
|
|
2565
|
-
|
|
2566
|
-
/**
|
|
2567
|
-
* Deserialize a {@link NameTokensResponse} object.
|
|
2568
|
-
*/
|
|
2569
|
-
declare function deserializedNameTokensResponse(maybeResponse: SerializedNameTokensResponse): NameTokensResponse;
|
|
2570
|
-
|
|
2571
|
-
declare const nameTokensPrerequisites: Readonly<{
|
|
2197
|
+
readonly Transfer: "transfer";
|
|
2572
2198
|
/**
|
|
2573
|
-
*
|
|
2199
|
+
* Transfer from a non-zeroAddress to the same non-zeroAddress
|
|
2574
2200
|
*
|
|
2575
|
-
*
|
|
2576
|
-
*
|
|
2577
|
-
*
|
|
2578
|
-
*
|
|
2201
|
+
* Invariants:
|
|
2202
|
+
* - NFT is indexed
|
|
2203
|
+
* - previous and new NFT mint status is `minted`
|
|
2204
|
+
* - previous and new NFT owner are equivalent non-zeroAddress
|
|
2579
2205
|
*/
|
|
2580
|
-
|
|
2206
|
+
readonly SelfTransfer: "self-transfer";
|
|
2581
2207
|
/**
|
|
2582
|
-
*
|
|
2208
|
+
* Transfer from zeroAddress to zeroAddress for an indexed NFT
|
|
2209
|
+
*
|
|
2210
|
+
* Invariants:
|
|
2211
|
+
* - NFT is indexed
|
|
2212
|
+
* - previous and new NFT mint status is `burned`
|
|
2213
|
+
* - previous and new NFT owner are zeroAddress
|
|
2583
2214
|
*/
|
|
2584
|
-
|
|
2215
|
+
readonly RemintBurn: "remint-burn";
|
|
2585
2216
|
/**
|
|
2586
|
-
*
|
|
2217
|
+
* Special transfer type for improperly implemented NFT contracts that allow a NFT
|
|
2218
|
+
* that is currently minted to be reminted again before an intermediate burn.
|
|
2587
2219
|
*
|
|
2588
|
-
*
|
|
2589
|
-
*
|
|
2220
|
+
* Transfer from zeroAddress to zeroAddress for an indexed NFT where the
|
|
2221
|
+
* previously indexed nft had status `minted` with a non-zeroAddress owner.
|
|
2222
|
+
*
|
|
2223
|
+
* Invariants:
|
|
2224
|
+
* - NFT is indexed
|
|
2225
|
+
* - previous NFT mint status was `minted`
|
|
2226
|
+
* - previous NFT owner was a non-zeroAddress
|
|
2227
|
+
* - new NFT mint status is `burned`
|
|
2228
|
+
* - new NFT owner is the zeroAddress
|
|
2590
2229
|
*/
|
|
2591
|
-
|
|
2230
|
+
readonly MintedRemintBurn: "minted-remint-burn";
|
|
2592
2231
|
/**
|
|
2593
|
-
*
|
|
2232
|
+
* Transfer from zeroAddress to zeroAddress for an unindexed NFT
|
|
2233
|
+
*
|
|
2234
|
+
* Invariants:
|
|
2235
|
+
* - NFT is not indexed and therefore has no previous mint status or owner
|
|
2236
|
+
* - NFT should remain unindexed and without any mint status or owner
|
|
2594
2237
|
*/
|
|
2595
|
-
|
|
2596
|
-
}
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
* Represents request to Name Tokens API.
|
|
2600
|
-
*
|
|
2601
|
-
* Either `domainId` or `name` must be provided, but not both.
|
|
2602
|
-
*/
|
|
2603
|
-
interface NameTokensRequest {
|
|
2604
|
-
/**
|
|
2605
|
-
* Domain ID (namehash) for which name tokens were requested.
|
|
2606
|
-
*/
|
|
2607
|
-
domainId?: Node;
|
|
2608
|
-
/**
|
|
2609
|
-
* Name for which name tokens were requested.
|
|
2610
|
-
*/
|
|
2611
|
-
name?: Name;
|
|
2612
|
-
}
|
|
2613
|
-
|
|
2614
|
-
/**
|
|
2615
|
-
* Serialized representation of {@link TokenId}.
|
|
2616
|
-
*/
|
|
2617
|
-
type SerializedTokenId = string;
|
|
2618
|
-
/**
|
|
2619
|
-
* Serialized representation of {@link AssetId}.
|
|
2620
|
-
*/
|
|
2621
|
-
interface SerializedAssetId extends Omit<AssetId, "tokenId"> {
|
|
2622
|
-
tokenId: SerializedTokenId;
|
|
2623
|
-
}
|
|
2624
|
-
/**
|
|
2625
|
-
* Serializes {@link AssetId} object to a structured form.
|
|
2626
|
-
*/
|
|
2627
|
-
declare function serializeAssetId(assetId: AssetId): SerializedAssetId;
|
|
2628
|
-
/**
|
|
2629
|
-
* Deserialize a {@link AssetId} object.
|
|
2630
|
-
*/
|
|
2631
|
-
declare function deserializeAssetId(maybeAssetId: unknown, valueLabel?: string): AssetId;
|
|
2632
|
-
/**
|
|
2633
|
-
* Parse a stringified representation of {@link AssetId} object.
|
|
2634
|
-
*/
|
|
2635
|
-
declare function parseAssetId(maybeAssetId: AssetIdString, valueLabel?: string): AssetId;
|
|
2636
|
-
/**
|
|
2637
|
-
* Builds an AssetId for the NFT represented by the given contract,
|
|
2638
|
-
* tokenId, and assetNamespace.
|
|
2639
|
-
*
|
|
2640
|
-
* @param contract - The contract that manages the NFT
|
|
2641
|
-
* @param tokenId - The tokenId of the NFT
|
|
2642
|
-
* @param assetNamespace - The assetNamespace of the NFT
|
|
2643
|
-
* @returns The AssetId for the NFT represented by the given contract,
|
|
2644
|
-
* tokenId, and assetNamespace
|
|
2645
|
-
*/
|
|
2646
|
-
declare const buildAssetId: (contract: AccountId, tokenId: TokenId, assetNamespace: AssetNamespace) => AssetId;
|
|
2647
|
-
/**
|
|
2648
|
-
* A globally unique reference to an NFT tokenizing the ownership of a domain.
|
|
2649
|
-
*/
|
|
2650
|
-
interface DomainAssetId extends AssetId {
|
|
2651
|
-
/**
|
|
2652
|
-
* The namehash (node) of the domain who's ownership is tokenized by
|
|
2653
|
-
* this `AssetId`.
|
|
2654
|
-
*/
|
|
2655
|
-
domainId: Node;
|
|
2656
|
-
}
|
|
2657
|
-
/**
|
|
2658
|
-
* Serialized representation of {@link DomainAssetId}.
|
|
2659
|
-
*/
|
|
2660
|
-
interface SerializedDomainAssetId extends SerializedAssetId {
|
|
2661
|
-
domainId: Node;
|
|
2662
|
-
}
|
|
2663
|
-
declare function serializeDomainAssetId(domainAsset: DomainAssetId): SerializedDomainAssetId;
|
|
2664
|
-
/**
|
|
2665
|
-
* An enum representing the mint status of a DomainAssetId.
|
|
2666
|
-
*
|
|
2667
|
-
* After we index a NFT we never delete it from our index. Instead, when an
|
|
2668
|
-
* indexed NFT is burned onchain we retain its record and update its mint
|
|
2669
|
-
* status as `burned`. If a NFT is minted again after it is burned its mint
|
|
2670
|
-
* status is updated to `minted`.
|
|
2671
|
-
*/
|
|
2672
|
-
declare const NFTMintStatuses: {
|
|
2673
|
-
readonly Minted: "minted";
|
|
2674
|
-
readonly Burned: "burned";
|
|
2675
|
-
};
|
|
2676
|
-
type NFTMintStatus = (typeof NFTMintStatuses)[keyof typeof NFTMintStatuses];
|
|
2677
|
-
/**
|
|
2678
|
-
* Metadata about a NFT transfer event.
|
|
2679
|
-
*
|
|
2680
|
-
* This metadata can be used for building more helpful messages when processing
|
|
2681
|
-
* NFT transfer events.
|
|
2682
|
-
*/
|
|
2683
|
-
interface NFTTransferEventMetadata {
|
|
2684
|
-
chainId: ChainId;
|
|
2685
|
-
blockNumber: bigint;
|
|
2686
|
-
transactionHash: Hex;
|
|
2687
|
-
eventHandlerName: string;
|
|
2688
|
-
nft: DomainAssetId;
|
|
2689
|
-
}
|
|
2690
|
-
declare const formatNFTTransferEventMetadata: (metadata: NFTTransferEventMetadata) => string;
|
|
2691
|
-
/**
|
|
2692
|
-
* An enum representing the type of transfer that has occurred to a DomainAssetId.
|
|
2693
|
-
*/
|
|
2694
|
-
declare const NFTTransferTypes: {
|
|
2695
|
-
/**
|
|
2696
|
-
* Initial transfer from zeroAddress to a non-zeroAddress
|
|
2697
|
-
* Can happen at most once to a NFT AssetId
|
|
2698
|
-
*
|
|
2699
|
-
* Invariants:
|
|
2700
|
-
* - NFT is not indexed and therefore has no previous mint status or owner
|
|
2701
|
-
* - new NFT mint status is `minted`
|
|
2702
|
-
* - new NFT owner is a non-zeroAddress
|
|
2703
|
-
*/
|
|
2704
|
-
readonly Mint: "mint";
|
|
2705
|
-
/**
|
|
2706
|
-
* Subsequent transfer from zeroAddress to a non-zeroAddress
|
|
2707
|
-
* Can happen any number of times to a NFT AssetId as it passes in a cycle from
|
|
2708
|
-
* mint -> burn -> remint -> burn -> remint -> ...
|
|
2709
|
-
*
|
|
2710
|
-
* Invariants:
|
|
2711
|
-
* - NFT is indexed
|
|
2712
|
-
* - previous NFT mint status was `burned`
|
|
2713
|
-
* - previous NFT owner is the zeroAddress
|
|
2714
|
-
* - new NFT mint status is `minted`
|
|
2715
|
-
* - new NFT owner is a non-zeroAddress
|
|
2716
|
-
*/
|
|
2717
|
-
readonly Remint: "remint";
|
|
2718
|
-
/**
|
|
2719
|
-
* Special transfer type for improperly implemented NFT contracts that allow a NFT
|
|
2720
|
-
* that is currently minted to be reminted before an intermediate burn.
|
|
2721
|
-
*
|
|
2722
|
-
* Transfer from zeroAddress to non-zeroAddress for an indexed NFT where the
|
|
2723
|
-
* previously indexed nft had status `minted` with a non-zeroAddress owner.
|
|
2724
|
-
*
|
|
2725
|
-
* Invariants:
|
|
2726
|
-
* - NFT is indexed
|
|
2727
|
-
* - previous NFT mint status was `minted`
|
|
2728
|
-
* - previous NFT owner was a non-zeroAddress
|
|
2729
|
-
* - new NFT mint status is `minted`
|
|
2730
|
-
* - new NFT owner is a non-zeroAddress
|
|
2731
|
-
*/
|
|
2732
|
-
readonly MintedRemint: "minted-remint";
|
|
2733
|
-
/**
|
|
2734
|
-
* Transfer from a non-zeroAddress to zeroAddress
|
|
2735
|
-
*
|
|
2736
|
-
* Invariants:
|
|
2737
|
-
* - NFT is indexed
|
|
2738
|
-
* - previous NFT mint status was `minted`
|
|
2739
|
-
* - previous NFT owner is a non-zeroAddress
|
|
2740
|
-
* - new NFT mint status is `burned`
|
|
2741
|
-
* - new NFT owner is the zeroAddress
|
|
2742
|
-
*/
|
|
2743
|
-
readonly Burn: "burn";
|
|
2744
|
-
/**
|
|
2745
|
-
* Transfer from a non-zeroAddress to a distinct non-zeroAddress
|
|
2746
|
-
*
|
|
2747
|
-
* Invariants:
|
|
2748
|
-
* - NFT is indexed
|
|
2749
|
-
* - previous and new NFT mint status is `minted`
|
|
2750
|
-
* - previous and new NFT owner are distinct non-zeroAddress
|
|
2751
|
-
*/
|
|
2752
|
-
readonly Transfer: "transfer";
|
|
2753
|
-
/**
|
|
2754
|
-
* Transfer from a non-zeroAddress to the same non-zeroAddress
|
|
2755
|
-
*
|
|
2756
|
-
* Invariants:
|
|
2757
|
-
* - NFT is indexed
|
|
2758
|
-
* - previous and new NFT mint status is `minted`
|
|
2759
|
-
* - previous and new NFT owner are equivalent non-zeroAddress
|
|
2760
|
-
*/
|
|
2761
|
-
readonly SelfTransfer: "self-transfer";
|
|
2762
|
-
/**
|
|
2763
|
-
* Transfer from zeroAddress to zeroAddress for an indexed NFT
|
|
2764
|
-
*
|
|
2765
|
-
* Invariants:
|
|
2766
|
-
* - NFT is indexed
|
|
2767
|
-
* - previous and new NFT mint status is `burned`
|
|
2768
|
-
* - previous and new NFT owner are zeroAddress
|
|
2769
|
-
*/
|
|
2770
|
-
readonly RemintBurn: "remint-burn";
|
|
2771
|
-
/**
|
|
2772
|
-
* Special transfer type for improperly implemented NFT contracts that allow a NFT
|
|
2773
|
-
* that is currently minted to be reminted again before an intermediate burn.
|
|
2774
|
-
*
|
|
2775
|
-
* Transfer from zeroAddress to zeroAddress for an indexed NFT where the
|
|
2776
|
-
* previously indexed nft had status `minted` with a non-zeroAddress owner.
|
|
2777
|
-
*
|
|
2778
|
-
* Invariants:
|
|
2779
|
-
* - NFT is indexed
|
|
2780
|
-
* - previous NFT mint status was `minted`
|
|
2781
|
-
* - previous NFT owner was a non-zeroAddress
|
|
2782
|
-
* - new NFT mint status is `burned`
|
|
2783
|
-
* - new NFT owner is the zeroAddress
|
|
2784
|
-
*/
|
|
2785
|
-
readonly MintedRemintBurn: "minted-remint-burn";
|
|
2786
|
-
/**
|
|
2787
|
-
* Transfer from zeroAddress to zeroAddress for an unindexed NFT
|
|
2788
|
-
*
|
|
2789
|
-
* Invariants:
|
|
2790
|
-
* - NFT is not indexed and therefore has no previous mint status or owner
|
|
2791
|
-
* - NFT should remain unindexed and without any mint status or owner
|
|
2792
|
-
*/
|
|
2793
|
-
readonly MintBurn: "mint-burn";
|
|
2794
|
-
};
|
|
2795
|
-
type NFTTransferType = (typeof NFTTransferTypes)[keyof typeof NFTTransferTypes];
|
|
2796
|
-
declare const getNFTTransferType: (from: Address, to: Address, allowMintedRemint: boolean, metadata: NFTTransferEventMetadata, currentlyIndexedOwner?: Address) => NFTTransferType;
|
|
2238
|
+
readonly MintBurn: "mint-burn";
|
|
2239
|
+
};
|
|
2240
|
+
type NFTTransferType = (typeof NFTTransferTypes)[keyof typeof NFTTransferTypes];
|
|
2241
|
+
declare const getNFTTransferType: (from: Address, to: Address, allowMintedRemint: boolean, metadata: NFTTransferEventMetadata, currentlyIndexedOwner?: Address) => NFTTransferType;
|
|
2797
2242
|
|
|
2798
2243
|
/**
|
|
2799
2244
|
* An enum representing the possible Name Token Ownership types.
|
|
@@ -3252,57 +2697,241 @@ declare function getLineanamesSubregistryId(namespace: ENSNamespaceId): AccountI
|
|
|
3252
2697
|
declare function getLineanamesSubregistryManagedName(namespaceId: ENSNamespaceId): Name;
|
|
3253
2698
|
|
|
3254
2699
|
/**
|
|
3255
|
-
*
|
|
2700
|
+
* Identifiers for supported currencies.
|
|
2701
|
+
*
|
|
2702
|
+
* TODO: Add support for WETH
|
|
3256
2703
|
*/
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
* Identifies the chainId and address of the associated subregistry smart
|
|
3264
|
-
* contract.
|
|
3265
|
-
*/
|
|
3266
|
-
subregistryId: AccountId;
|
|
3267
|
-
/**
|
|
3268
|
-
* The node (namehash) of the name the subregistry manages subnames of.
|
|
3269
|
-
* Example subregistry managed names:
|
|
3270
|
-
* - `eth`
|
|
3271
|
-
* - `base.eth`
|
|
3272
|
-
* - `linea.eth`
|
|
3273
|
-
*/
|
|
3274
|
-
node: Node;
|
|
3275
|
-
}
|
|
3276
|
-
|
|
2704
|
+
declare const CurrencyIds: {
|
|
2705
|
+
readonly ETH: "ETH";
|
|
2706
|
+
readonly USDC: "USDC";
|
|
2707
|
+
readonly DAI: "DAI";
|
|
2708
|
+
};
|
|
2709
|
+
type CurrencyId = (typeof CurrencyIds)[keyof typeof CurrencyIds];
|
|
3277
2710
|
/**
|
|
3278
|
-
*
|
|
2711
|
+
* The amount of the currency in the smallest unit of the currency
|
|
2712
|
+
* (see {@link CurrencyInfo.decimals} for the currency).
|
|
3279
2713
|
*
|
|
3280
|
-
*
|
|
3281
|
-
* It's only here to capture some ideas that were shared in the team.
|
|
2714
|
+
* Guaranteed to be non-negative.
|
|
3282
2715
|
*/
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
2716
|
+
type CurrencyAmount = bigint;
|
|
2717
|
+
/**
|
|
2718
|
+
* Serialized representation of {@link CurrencyAmount}.
|
|
2719
|
+
*/
|
|
2720
|
+
type SerializedCurrencyAmount = string;
|
|
2721
|
+
interface PriceEth {
|
|
2722
|
+
currency: typeof CurrencyIds.ETH;
|
|
2723
|
+
amount: CurrencyAmount;
|
|
2724
|
+
}
|
|
2725
|
+
interface PriceDai {
|
|
2726
|
+
currency: typeof CurrencyIds.DAI;
|
|
2727
|
+
amount: CurrencyAmount;
|
|
2728
|
+
}
|
|
2729
|
+
interface PriceUsdc {
|
|
2730
|
+
currency: typeof CurrencyIds.USDC;
|
|
2731
|
+
amount: CurrencyAmount;
|
|
2732
|
+
}
|
|
2733
|
+
type Price = PriceEth | PriceDai | PriceUsdc;
|
|
2734
|
+
/**
|
|
2735
|
+
* Serialized representation of {@link PriceEth}.
|
|
2736
|
+
*/
|
|
2737
|
+
interface SerializedPriceEth extends Omit<PriceEth, "amount"> {
|
|
2738
|
+
amount: SerializedCurrencyAmount;
|
|
2739
|
+
}
|
|
2740
|
+
/**
|
|
2741
|
+
* Serialized representation of {@link PriceDai}.
|
|
2742
|
+
*/
|
|
2743
|
+
interface SerializedPriceDai extends Omit<PriceDai, "amount"> {
|
|
2744
|
+
amount: SerializedCurrencyAmount;
|
|
2745
|
+
}
|
|
2746
|
+
/**
|
|
2747
|
+
* Serialized representation of {@link PriceUsdc}.
|
|
2748
|
+
*/
|
|
2749
|
+
interface SerializedPriceUsdc extends Omit<PriceUsdc, "amount"> {
|
|
2750
|
+
amount: SerializedCurrencyAmount;
|
|
2751
|
+
}
|
|
2752
|
+
/**
|
|
2753
|
+
* Serialized representation of {@link Price}.
|
|
2754
|
+
*/
|
|
2755
|
+
type SerializedPrice = SerializedPriceEth | SerializedPriceDai | SerializedPriceUsdc;
|
|
2756
|
+
interface CurrencyInfo {
|
|
2757
|
+
id: CurrencyId;
|
|
2758
|
+
name: string;
|
|
2759
|
+
decimals: number;
|
|
2760
|
+
}
|
|
2761
|
+
/**
|
|
2762
|
+
* Get currency info for a provided currency.
|
|
2763
|
+
*/
|
|
2764
|
+
declare function getCurrencyInfo(currencyId: CurrencyId): CurrencyInfo;
|
|
2765
|
+
/**
|
|
2766
|
+
* Create price in ETH for given amount.
|
|
2767
|
+
*/
|
|
2768
|
+
declare function priceEth(amount: Price["amount"]): PriceEth;
|
|
2769
|
+
/**
|
|
2770
|
+
* Create price in USDC for given amount.
|
|
2771
|
+
*/
|
|
2772
|
+
declare function priceUsdc(amount: Price["amount"]): PriceUsdc;
|
|
2773
|
+
/**
|
|
2774
|
+
* Create price in DAI for given amount.
|
|
2775
|
+
*/
|
|
2776
|
+
declare function priceDai(amount: Price["amount"]): PriceDai;
|
|
2777
|
+
/**
|
|
2778
|
+
* Check if two prices have the same currency.
|
|
2779
|
+
*/
|
|
2780
|
+
declare function isPriceCurrencyEqual(priceA: Price, priceB: Price): boolean;
|
|
2781
|
+
/**
|
|
2782
|
+
* Check if two {@link Price} values have the same currency and amount.
|
|
2783
|
+
*/
|
|
2784
|
+
declare function isPriceEqual(priceA: Price, priceB: Price): boolean;
|
|
2785
|
+
/**
|
|
2786
|
+
* Add prices
|
|
2787
|
+
*
|
|
2788
|
+
* @param prices at least two {@link Price} values to be added together.
|
|
2789
|
+
* @returns total of all prices.
|
|
2790
|
+
* @throws if not all prices have the same currency.
|
|
2791
|
+
*/
|
|
2792
|
+
declare function addPrices<const PriceType extends Price = Price>(...prices: [PriceType, PriceType, ...PriceType[]]): PriceType;
|
|
2793
|
+
/**
|
|
2794
|
+
* Scales a Price object by a floating-point number while maintaining precision.
|
|
2795
|
+
*
|
|
2796
|
+
* **Important:** The precision of this method is bound to the precision of float
|
|
2797
|
+
* in JavaScript. For more information, see {@link scaleBigintByNumber}.
|
|
2798
|
+
*
|
|
2799
|
+
* @param price - The Price object to scale
|
|
2800
|
+
* @param scaleFactor - The number to multiply by (can be a decimal like 0.5)
|
|
2801
|
+
* @returns A new Price object with the scaled amount and same currency
|
|
2802
|
+
*
|
|
2803
|
+
* @throws {Error} If scaleFactor is negative, NaN, or infinite
|
|
2804
|
+
* @throws {Error} If price amount is negative
|
|
2805
|
+
*
|
|
2806
|
+
* @example
|
|
2807
|
+
* // Scale USDC price by 0.5
|
|
2808
|
+
* const price = priceUsdc(1000000n); // 1 USDC
|
|
2809
|
+
* const scaled = scalePrice(price, 0.5); // 0.5 USDC
|
|
2810
|
+
* // scaled = { currency: "USDC", amount: 500000n }
|
|
2811
|
+
*
|
|
2812
|
+
* @example
|
|
2813
|
+
* // Calculate 33.3% of ETH price
|
|
2814
|
+
* const ethPrice = priceEth(1000000000000000000n); // 1 ETH
|
|
2815
|
+
* const share = scalePrice(ethPrice, 0.333);
|
|
2816
|
+
* // share = { currency: "ETH", amount: 333000000000000000n }
|
|
2817
|
+
*/
|
|
2818
|
+
declare function scalePrice<T extends Price>(price: T, scaleFactor: number): T;
|
|
2819
|
+
/**
|
|
2820
|
+
* Parses a string representation of ETH into a {@link PriceEth} object.
|
|
2821
|
+
*
|
|
2822
|
+
* Uses {@link getCurrencyInfo} to get the correct number of decimals (18) for ETH
|
|
2823
|
+
* and {@link parseUnits} from viem to convert the decimal string to a bigint.
|
|
2824
|
+
*
|
|
2825
|
+
* **Note:** Values with more than 18 decimal places will be truncated/rounded by viem's `parseUnits`.
|
|
2826
|
+
*
|
|
2827
|
+
* @param value - The decimal string to parse (e.g., "0.015" for 0.015 ETH)
|
|
2828
|
+
* @returns A PriceEth object with the amount in wei (smallest unit)
|
|
2829
|
+
*
|
|
2830
|
+
* @throws {Error} If value is empty, whitespace-only or untrimmed
|
|
2831
|
+
* @throws {Error} If value represents a negative number
|
|
2832
|
+
* @throws {Error} If value is not a valid decimal string (e.g., "abc", "1.2.3")
|
|
2833
|
+
*
|
|
2834
|
+
* @example
|
|
2835
|
+
* parseEth("0.015") // returns { currency: "ETH", amount: 15000000000000000n }
|
|
2836
|
+
* parseEth("1") // returns { currency: "ETH", amount: 1000000000000000000n }
|
|
2837
|
+
* parseEth("123.456789012345678") // returns { currency: "ETH", amount: 123456789012345678000n }
|
|
2838
|
+
*/
|
|
2839
|
+
declare function parseEth(value: string): PriceEth;
|
|
2840
|
+
/**
|
|
2841
|
+
* Parses a string representation of USDC into a {@link PriceUsdc} object.
|
|
2842
|
+
*
|
|
2843
|
+
* Uses {@link getCurrencyInfo} to get the correct number of decimals (6) for USDC
|
|
2844
|
+
* and {@link parseUnits} from viem to convert the decimal string to a bigint.
|
|
2845
|
+
*
|
|
2846
|
+
* **Note:** Values with more than 6 decimal places will be truncated/rounded by viem's `parseUnits`.
|
|
2847
|
+
*
|
|
2848
|
+
* @param value - The decimal string to parse (e.g., "123.45678" for $123.45678)
|
|
2849
|
+
* @returns A PriceUsdc object with the amount in the smallest unit (6 decimals)
|
|
2850
|
+
*
|
|
2851
|
+
* @throws {Error} If value is empty, whitespace-only or untrimmed
|
|
2852
|
+
* @throws {Error} If value represents a negative number
|
|
2853
|
+
* @throws {Error} If value is not a valid decimal string (e.g., "abc", "1.2.3")
|
|
2854
|
+
*
|
|
2855
|
+
* @example
|
|
2856
|
+
* parseUsdc("123.45678") // returns { currency: "USDC", amount: 123456780n }
|
|
2857
|
+
* parseUsdc("1") // returns { currency: "USDC", amount: 1000000n }
|
|
2858
|
+
* parseUsdc("0.001") // returns { currency: "USDC", amount: 1000n }
|
|
2859
|
+
*/
|
|
2860
|
+
declare function parseUsdc(value: string): PriceUsdc;
|
|
2861
|
+
/**
|
|
2862
|
+
* Parses a string representation of DAI into a {@link PriceDai} object.
|
|
2863
|
+
*
|
|
2864
|
+
* Uses {@link getCurrencyInfo} to get the correct number of decimals (18) for DAI
|
|
2865
|
+
* and {@link parseUnits} from viem to convert the decimal string to a bigint.
|
|
2866
|
+
*
|
|
2867
|
+
* **Note:** Values with more than 18 decimal places will be truncated/rounded by viem's `parseUnits`.
|
|
2868
|
+
*
|
|
2869
|
+
* @param value - The decimal string to parse (e.g., "123.456789012345678" for 123.456789012345678 DAI)
|
|
2870
|
+
* @returns A PriceDai object with the amount in the smallest unit (18 decimals)
|
|
2871
|
+
*
|
|
2872
|
+
* @throws {Error} If value is empty, whitespace-only or untrimmed
|
|
2873
|
+
* @throws {Error} If value represents a negative number
|
|
2874
|
+
* @throws {Error} If value is not a valid decimal string (e.g., "abc", "1.2.3")
|
|
2875
|
+
*
|
|
2876
|
+
* @example
|
|
2877
|
+
* parseDai("123.456789012345678") // returns { currency: "DAI", amount: 123456789012345678000n }
|
|
2878
|
+
* parseDai("1") // returns { currency: "DAI", amount: 1000000000000000000n }
|
|
2879
|
+
* parseDai("0.001") // returns { currency: "DAI", amount: 1000000000000000n }
|
|
2880
|
+
*/
|
|
2881
|
+
declare function parseDai(value: string): PriceDai;
|
|
2882
|
+
|
|
2883
|
+
/**
|
|
2884
|
+
* Subregistry
|
|
2885
|
+
*/
|
|
2886
|
+
interface Subregistry {
|
|
2887
|
+
/**
|
|
2888
|
+
* Subregistry ID
|
|
2889
|
+
*
|
|
2890
|
+
* The ID of the subregistry the "logical registrar action" was taken on.
|
|
2891
|
+
*
|
|
2892
|
+
* Identifies the chainId and address of the associated subregistry smart
|
|
2893
|
+
* contract.
|
|
2894
|
+
*/
|
|
2895
|
+
subregistryId: AccountId;
|
|
2896
|
+
/**
|
|
2897
|
+
* The node (namehash) of the name the subregistry manages subnames of.
|
|
2898
|
+
* Example subregistry managed names:
|
|
2899
|
+
* - `eth`
|
|
2900
|
+
* - `base.eth`
|
|
2901
|
+
* - `linea.eth`
|
|
2902
|
+
*/
|
|
2903
|
+
node: Node;
|
|
2904
|
+
}
|
|
2905
|
+
|
|
2906
|
+
/**
|
|
2907
|
+
* Registration Lifecycle Stages
|
|
2908
|
+
*
|
|
2909
|
+
* Important: this definition should not be used anywhere.
|
|
2910
|
+
* It's only here to capture some ideas that were shared in the team.
|
|
2911
|
+
*/
|
|
2912
|
+
declare const RegistrationLifecycleStages: {
|
|
2913
|
+
/**
|
|
2914
|
+
* Active
|
|
2915
|
+
*
|
|
2916
|
+
* Happens when
|
|
2917
|
+
* the current timestamp <= expiry.
|
|
2918
|
+
*/
|
|
2919
|
+
readonly Active: "registrationLifecycle_active";
|
|
2920
|
+
/**
|
|
2921
|
+
* Grace Period
|
|
2922
|
+
*
|
|
2923
|
+
* Happens when
|
|
2924
|
+
* `expiry < the current timestamp <= expiry + 90 days`.
|
|
2925
|
+
*/
|
|
2926
|
+
readonly GracePeriod: "registrationLifecycle_gracePeriod";
|
|
2927
|
+
/**
|
|
2928
|
+
* Released with Temporary Premium Price
|
|
2929
|
+
*
|
|
2930
|
+
* Happens when
|
|
2931
|
+
* `expiry + 90 days < the current timestamp <= expiry + 120 days`.
|
|
2932
|
+
*/
|
|
2933
|
+
readonly ReleasedWithTempPrice: "registrationLifecycle_releasedWithTempPrice";
|
|
2934
|
+
/**
|
|
3306
2935
|
* Fully Released (Regular Price)
|
|
3307
2936
|
*
|
|
3308
2937
|
* Happens when
|
|
@@ -4689,4 +4318,507 @@ declare const DEFAULT_ENSNODE_API_URL_SEPOLIA: "https://api.alpha-sepolia.ensnod
|
|
|
4689
4318
|
*/
|
|
4690
4319
|
declare const getDefaultEnsNodeUrl: (namespace?: ENSNamespaceId) => URL;
|
|
4691
4320
|
|
|
4692
|
-
export { ADDR_REVERSE_NODE, ATTR_PROTOCOL_NAME, ATTR_PROTOCOL_STEP, ATTR_PROTOCOL_STEP_RESULT, type AcceleratableRequest, type AcceleratableResponse, type AccountId, type AccountIdString, type AssetId, type AssetIdString, type AssetNamespace, AssetNamespaces, BASENAMES_NODE, type BlockNumber, type BlockRef, type Blockrange, type Cache, type CanonicalId, type CanonicalPath, 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_ENSNODE_API_URL_MAINNET, DEFAULT_ENSNODE_API_URL_SEPOLIA, DEFAULT_EVM_CHAIN_ID, DEFAULT_EVM_COIN_TYPE, type DNSEncodedLiteralName, type DNSEncodedName, type DNSEncodedPartiallyInterpretedName, type Datetime, type DatetimeISO8601, type DeepPartial, type DefaultableChainId, type DomainAssetId, type DomainId, type Duration, ENCODED_REFERRER_BYTE_LENGTH, ENCODED_REFERRER_BYTE_OFFSET, type ENSApiPublicConfig, type ENSIndexerPublicConfig, type ENSIndexerVersionInfo, ENSNodeClient, ENS_ROOT, type ENSv1DomainId, type ENSv2DomainId, ETH_COIN_TYPE, ETH_NODE, EXPECTED_ENCODED_REFERRER_PADDING, type EncodedLabelHash, type EncodedReferrer, type EnsRainbowClientLabelSet, type EnsRainbowServerLabelSet, type ErrorResponse, type ForwardResolutionArgs, ForwardResolutionProtocolStep, type ForwardResolutionResult, type Identity, type IndexingStatusRequest, type IndexingStatusResponse, type IndexingStatusResponseCode, IndexingStatusResponseCodes, type IndexingStatusResponseError, type IndexingStatusResponseOk, type InterpretedLabel, type InterpretedName, LINEANAMES_NODE, type Label, type LabelHash, type LabelHashPath, type LabelSetId, type LabelSetVersion, type LiteralLabel, type LiteralName, LruCache, type MultichainPrimaryNameResolutionArgs, type MultichainPrimaryNameResolutionResult, type NFTMintStatus, NFTMintStatuses, type NFTTransferEventMetadata, type NFTTransferType, NFTTransferTypes, NODE_ANY, type Name, type NameToken, type NameTokenOwnership, type NameTokenOwnershipBurned, type NameTokenOwnershipFullyOnchain, type NameTokenOwnershipNameWrapper, type NameTokenOwnershipType, NameTokenOwnershipTypes, type NameTokenOwnershipUnknown, type NameTokensRequest, type NameTokensResponse, type NameTokensResponseCode, NameTokensResponseCodes, type NameTokensResponseError, type NameTokensResponseErrorCode, NameTokensResponseErrorCodes, type NameTokensResponseErrorEnsIndexerConfigUnsupported, type NameTokensResponseErrorIndexingStatusUnsupported, type NameTokensResponseErrorNameTokensNotIndexed, type NameTokensResponseOk, 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 PermissionsId, type PermissionsResourceId, type PermissionsUserId, PluginName, type Price, type PriceDai, type PriceEth, type PriceUsdc, RECORDS_PER_PAGE_DEFAULT, RECORDS_PER_PAGE_MAX, ROOT_NODE, ROOT_RESOURCE, type RealtimeIndexingStatusProjection, type RegisteredNameTokens, type RegistrarAction, type RegistrarActionEventId, type RegistrarActionPricing, type RegistrarActionPricingAvailable, type RegistrarActionPricingUnknown, type RegistrarActionReferral, type RegistrarActionReferralAvailable, type RegistrarActionReferralNotApplicable, type RegistrarActionType, RegistrarActionTypes, type RegistrarActionsFilter, type RegistrarActionsFilterBeginTimestamp, type RegistrarActionsFilterByDecodedReferrer, type RegistrarActionsFilterBySubregistryNode, type RegistrarActionsFilterEndTimestamp, type RegistrarActionsFilterType, RegistrarActionsFilterTypes, type RegistrarActionsFilterWithEncodedReferral, type RegistrarActionsOrder, RegistrarActionsOrders, type RegistrarActionsRequest, type RegistrarActionsResponse, type RegistrarActionsResponseCode, RegistrarActionsResponseCodes, type RegistrarActionsResponseError, type RegistrarActionsResponseOk, type RegistrationExpiryInfo, type RegistrationId, type RegistrationLifecycle, type RegistrationLifecycleStage, type RegistryId, type RenewalId, type RequestPageParams, type RequiredAndNotNull, type ResolutionStatusId, ResolutionStatusIds, type ResolvePrimaryNameRequest, type ResolvePrimaryNameResponse, type ResolvePrimaryNamesRequest, type ResolvePrimaryNamesResponse, type ResolveRecordsRequest, type ResolveRecordsResponse, type ResolvedIdentity, type ResolverId, type ResolverRecordsId, type ResolverRecordsResponse, type ResolverRecordsResponseBase, type ResolverRecordsSelection, type ResponsePageContext, type ResponsePageContextWithNoRecords, type ResponsePageContextWithRecords, type ReverseResolutionArgs, ReverseResolutionProtocolStep, type ReverseResolutionResult, type RpcUrl, SWRCache, type SWRCacheOptions, type SerializedAssetId, type SerializedChainIndexingStatusSnapshot, type SerializedChainIndexingStatusSnapshotBackfill, type SerializedChainIndexingStatusSnapshotCompleted, type SerializedChainIndexingStatusSnapshotFollowing, type SerializedChainIndexingStatusSnapshotQueued, type SerializedConfigResponse, type SerializedCrossChainIndexingStatusSnapshot, type SerializedCrossChainIndexingStatusSnapshotOmnichain, type SerializedCurrencyAmount, type SerializedCurrentIndexingProjectionOmnichain, type SerializedDomainAssetId, type SerializedENSApiPublicConfig, type SerializedENSIndexerPublicConfig, type SerializedENSIndexerVersionInfo, type SerializedIndexedChainIds, type SerializedIndexingStatusResponse, type SerializedIndexingStatusResponseError, type SerializedIndexingStatusResponseOk, type SerializedNameToken, type SerializedNameTokensResponse, type SerializedNameTokensResponseError, type SerializedNameTokensResponseOk, type SerializedNamedRegistrarAction, type SerializedOmnichainIndexingStatusSnapshot, type SerializedOmnichainIndexingStatusSnapshotBackfill, type SerializedOmnichainIndexingStatusSnapshotCompleted, type SerializedOmnichainIndexingStatusSnapshotFollowing, type SerializedOmnichainIndexingStatusSnapshotUnstarted, type SerializedPrice, type SerializedPriceDai, type SerializedPriceEth, type SerializedPriceUsdc, type SerializedRealtimeIndexingStatusProjection, type SerializedRegisteredNameTokens, type SerializedRegistrarAction, type SerializedRegistrarActionPricing, type SerializedRegistrarActionPricingAvailable, type SerializedRegistrarActionPricingUnknown, type SerializedRegistrarActionsResponse, type SerializedRegistrarActionsResponseError, type SerializedRegistrarActionsResponseOk, type SerializedTokenId, type SubgraphInterpretedLabel, type SubgraphInterpretedName, type Subregistry, type TheGraphCannotFallbackReason, TheGraphCannotFallbackReasonSchema, type TheGraphFallback, TheGraphFallbackSchema, type TokenId, TraceableENSProtocol, type TraceableRequest, type TraceableResponse, type TracingNode, type TracingSpan, type TracingTrace, TtlCache, type UnixTimestamp, type UnknownIdentity, type UnnamedIdentity, type UnresolvedIdentity, type UrlString, ZERO_ENCODED_REFERRER, accountIdEqual, addDuration, addPrices, addrReverseLabel, asLowerCaseAddress, beautifyName, bigIntToNumber, bigintToCoinType, buildAssetId, buildEncodedReferrer, buildEnsRainbowClientLabelSet, buildLabelSetId, buildLabelSetVersion, buildPageContext, buildUnresolvedIdentity, checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill, checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted, checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing, checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted, coinTypeReverseLabel, coinTypeToEvmChainId, createIndexingConfig, createRealtimeIndexingStatusProjection, decodeDNSEncodedLiteralName, decodeDNSEncodedName, decodeEncodedReferrer, deserializeAssetId, deserializeBlockNumber, deserializeBlockRef, deserializeBlockrange, deserializeChainId, deserializeChainIndexingStatusSnapshot, deserializeConfigResponse, deserializeCrossChainIndexingStatusSnapshot, deserializeDatetime, deserializeDuration, deserializeENSApiPublicConfig, deserializeENSIndexerPublicConfig, deserializeErrorResponse, deserializeIndexingStatusResponse, deserializeOmnichainIndexingStatusSnapshot, deserializeRealtimeIndexingStatusProjection, deserializeRegistrarActionsResponse, deserializeUnixTimestamp, deserializeUrl, deserializedNameTokensResponse, durationBetween, encodeLabelHash, encodedLabelToLabelhash, evmChainIdToCoinType, formatAccountId, formatAssetId, formatNFTTransferEventMetadata, getBasenamesSubregistryId, getBasenamesSubregistryManagedName, getCanonicalId, getCurrencyInfo, getDatasourceContract, getDefaultEnsNodeUrl, getENSv1Registry, getENSv2RootRegistry, getENSv2RootRegistryId, getEthnamesSubregistryId, getEthnamesSubregistryManagedName, getLatestIndexedBlockRef, getLineanamesSubregistryId, getLineanamesSubregistryManagedName, getNFTTransferType, getNameHierarchy, getNameTokenOwnership, getNameWrapperAccounts, getOmnichainIndexingCursor, getOmnichainIndexingStatus, getParentNameFQDN, getResolvePrimaryNameChainIdParam, getTimestampForHighestOmnichainKnownBlock, getTimestampForLowestOmnichainStartBlock, hasNullByte, interpretAddress, interpretAddressRecordValue, interpretNameRecordValue, interpretTextRecordKey, interpretTextRecordValue, interpretTokenIdAsLabelHash, interpretTokenIdAsNode, interpretedLabelsToInterpretedName, interpretedNameToInterpretedLabels, interpretedNameToLabelHashPath, isENSv1Registry, isENSv2RootRegistry, isEncodedLabelHash, isHttpProtocol, isInterpetedLabel, isInterpretedName, isLabelHash, isNormalizedLabel, isNormalizedName, isPccFuseSet, isPriceCurrencyEqual, isPriceEqual, isRegistrarActionPricingAvailable, isRegistrarActionReferralAvailable, isRegistrationExpired, isRegistrationFullyExpired, isRegistrationInGracePeriod, isResolvedIdentity, isSelectionEmpty, isSubgraphCompatible, isWebSocketProtocol, labelHashToBytes, labelhashLiteralLabel, literalLabelToInterpretedLabel, literalLabelsToInterpretedName, literalLabelsToLiteralName, makeContractMatcher, makeENSApiPublicConfigSchema, makeENSv1DomainId, makeENSv2DomainId, makeLatestRegistrationId, makeLatestRenewalId, makePermissionsId, makePermissionsResourceId, makePermissionsUserId, makeRegistrationId, makeRegistryId, makeRenewalId, makeResolverId, makeResolverRecordsId, makeSubdomainNode, maybeGetDatasourceContract, nameTokensPrerequisites, parseAccountId, parseAssetId, parseNonNegativeInteger, parseReverseName, priceDai, priceEth, priceUsdc, registrarActionsFilter, registrarActionsPrerequisites, reverseName, serializeAssetId, serializeChainId, serializeChainIndexingSnapshots, serializeConfigResponse, serializeCrossChainIndexingStatusSnapshotOmnichain, serializeDatetime, serializeDomainAssetId, serializeENSApiPublicConfig, serializeENSIndexerPublicConfig, serializeIndexedChainIds, serializeIndexingStatusResponse, serializeNameToken, serializeNameTokensResponse, serializeNamedRegistrarAction, serializeOmnichainIndexingStatusSnapshot, serializePrice, serializePriceEth, serializeRealtimeIndexingStatusProjection, serializeRegisteredNameTokens, serializeRegistrarAction, serializeRegistrarActionPricing, serializeRegistrarActionsResponse, serializeUrl, sortChainStatusesByStartBlockAsc, stripNullBytes, translateDefaultableChainIdToChainId, uint256ToHex32, uniq, validateSupportedLabelSetAndVersion };
|
|
4321
|
+
/**
|
|
4322
|
+
* Determines where the provided AccountId values represent the same address on the same chain.
|
|
4323
|
+
*/
|
|
4324
|
+
declare const accountIdEqual: (a: AccountId, b: AccountId) => boolean;
|
|
4325
|
+
|
|
4326
|
+
/**
|
|
4327
|
+
* Converts an EVM address to its lowercase representation.
|
|
4328
|
+
*
|
|
4329
|
+
* @param address - EVM address to convert.
|
|
4330
|
+
* @returns The lowercase representation of the EVM address.
|
|
4331
|
+
*/
|
|
4332
|
+
declare function asLowerCaseAddress(address: Address): Address;
|
|
4333
|
+
|
|
4334
|
+
/**
|
|
4335
|
+
* Cache that maps from string -> ValueType.
|
|
4336
|
+
*/
|
|
4337
|
+
interface Cache<KeyType extends string, ValueType> {
|
|
4338
|
+
/**
|
|
4339
|
+
* Store a value in the cache with the given key.
|
|
4340
|
+
*
|
|
4341
|
+
* @param key Cache key
|
|
4342
|
+
* @param value Value to store
|
|
4343
|
+
*/
|
|
4344
|
+
set(key: KeyType, value: ValueType): void;
|
|
4345
|
+
/**
|
|
4346
|
+
* Retrieve a value from the cache with the given key.
|
|
4347
|
+
*
|
|
4348
|
+
* @param key Cache key
|
|
4349
|
+
* @returns The cached value if it exists, otherwise undefined
|
|
4350
|
+
*/
|
|
4351
|
+
get(key: KeyType): ValueType | undefined;
|
|
4352
|
+
/**
|
|
4353
|
+
* Clear the cache.
|
|
4354
|
+
*/
|
|
4355
|
+
clear(): void;
|
|
4356
|
+
/**
|
|
4357
|
+
* The current number of items in the cache. Always a non-negative integer.
|
|
4358
|
+
*/
|
|
4359
|
+
get size(): number;
|
|
4360
|
+
/**
|
|
4361
|
+
* The maximum number of items in the cache. Always a non-negative integer that is >= size().
|
|
4362
|
+
*/
|
|
4363
|
+
get capacity(): number;
|
|
4364
|
+
}
|
|
4365
|
+
|
|
4366
|
+
/**
|
|
4367
|
+
* Cache that maps from string -> ValueType with a LRU (least recently used) eviction policy.
|
|
4368
|
+
*
|
|
4369
|
+
* `get` and `set` are O(1) operations.
|
|
4370
|
+
*
|
|
4371
|
+
* @link https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU
|
|
4372
|
+
*/
|
|
4373
|
+
declare class LruCache<KeyType extends string, ValueType> implements Cache<KeyType, ValueType> {
|
|
4374
|
+
private readonly _cache;
|
|
4375
|
+
private readonly _capacity;
|
|
4376
|
+
/**
|
|
4377
|
+
* Create a new LRU cache with the given capacity.
|
|
4378
|
+
*
|
|
4379
|
+
* @param capacity The maximum number of items in the cache. If set to 0, the cache is effectively disabled.
|
|
4380
|
+
* @throws Error if capacity is not a non-negative integer.
|
|
4381
|
+
*/
|
|
4382
|
+
constructor(capacity: number);
|
|
4383
|
+
set(key: string, value: ValueType): void;
|
|
4384
|
+
get(key: string): ValueType | undefined;
|
|
4385
|
+
clear(): void;
|
|
4386
|
+
get size(): number;
|
|
4387
|
+
get capacity(): number;
|
|
4388
|
+
}
|
|
4389
|
+
|
|
4390
|
+
interface SWRCacheOptions<ValueType> {
|
|
4391
|
+
/**
|
|
4392
|
+
* The async function generating a value of `ValueType` to wrap with SWR caching. It may throw an
|
|
4393
|
+
* Error type.
|
|
4394
|
+
*/
|
|
4395
|
+
fn: () => Promise<ValueType>;
|
|
4396
|
+
/**
|
|
4397
|
+
* Time-to-live duration of a cached result in seconds. After this duration:
|
|
4398
|
+
* - the currently cached result is considered "stale" but is still retained in the cache
|
|
4399
|
+
* until successfully replaced.
|
|
4400
|
+
* - Each time the cache is read, if the cached result is "stale" and no background
|
|
4401
|
+
* revalidation attempt is already in progress, a new background revalidation
|
|
4402
|
+
* attempt will be made.
|
|
4403
|
+
*/
|
|
4404
|
+
ttl: Duration;
|
|
4405
|
+
/**
|
|
4406
|
+
* Optional time-to-proactively-revalidate duration in seconds. After a cached result is
|
|
4407
|
+
* initialized, and this duration has passed, attempts to asynchronously revalidate
|
|
4408
|
+
* the cached result will be proactively made in the background on this interval.
|
|
4409
|
+
*/
|
|
4410
|
+
proactiveRevalidationInterval?: Duration;
|
|
4411
|
+
/**
|
|
4412
|
+
* Optional proactive initialization. Defaults to `false`.
|
|
4413
|
+
*
|
|
4414
|
+
* If `true`: The SWR cache will proactively initialize itself.
|
|
4415
|
+
* If `false`: The SWR cache will lazily wait to initialize itself until the first read.
|
|
4416
|
+
*/
|
|
4417
|
+
proactivelyInitialize?: boolean;
|
|
4418
|
+
}
|
|
4419
|
+
/**
|
|
4420
|
+
* Stale-While-Revalidate (SWR) cache for async functions.
|
|
4421
|
+
*
|
|
4422
|
+
* This caching strategy serves cached data immediately (even if stale) while
|
|
4423
|
+
* asynchronously revalidating the cache in the background. This provides:
|
|
4424
|
+
* - Sub-millisecond response times (after first fetch)
|
|
4425
|
+
* - Always available data (serves stale data during revalidation)
|
|
4426
|
+
* - Automatic background updates via configurable intervals
|
|
4427
|
+
*
|
|
4428
|
+
* @example
|
|
4429
|
+
* ```typescript
|
|
4430
|
+
* const cache = new SWRCache({
|
|
4431
|
+
* fn: async () => fetch('/api/data').then(r => r.json()),
|
|
4432
|
+
* ttl: 60, // 1 minute TTL
|
|
4433
|
+
* proactiveRevalidationInterval: 300 // proactively revalidate every 5 minutes
|
|
4434
|
+
* });
|
|
4435
|
+
*
|
|
4436
|
+
* // Returns cached data or waits for initial fetch
|
|
4437
|
+
* const data = await cache.read();
|
|
4438
|
+
*
|
|
4439
|
+
* if (data instanceof Error) { ... }
|
|
4440
|
+
* ```
|
|
4441
|
+
*
|
|
4442
|
+
* @link https://web.dev/stale-while-revalidate/
|
|
4443
|
+
* @link https://datatracker.ietf.org/doc/html/rfc5861
|
|
4444
|
+
*/
|
|
4445
|
+
declare class SWRCache<ValueType> {
|
|
4446
|
+
private readonly options;
|
|
4447
|
+
private cache;
|
|
4448
|
+
private inProgressRevalidate;
|
|
4449
|
+
private backgroundInterval;
|
|
4450
|
+
constructor(options: SWRCacheOptions<ValueType>);
|
|
4451
|
+
private revalidate;
|
|
4452
|
+
/**
|
|
4453
|
+
* Read the most recently cached result from the `SWRCache`.
|
|
4454
|
+
*
|
|
4455
|
+
* @returns a `ValueType` that was most recently successfully returned by `fn` or `Error` if `fn`
|
|
4456
|
+
* has never successfully returned.
|
|
4457
|
+
*/
|
|
4458
|
+
read(): Promise<ValueType | Error>;
|
|
4459
|
+
/**
|
|
4460
|
+
* Destroys the background revalidation interval, if exists.
|
|
4461
|
+
*/
|
|
4462
|
+
destroy(): void;
|
|
4463
|
+
}
|
|
4464
|
+
|
|
4465
|
+
/**
|
|
4466
|
+
* Cache that maps from string -> ValueType with TTL (time-to-live) expiration.
|
|
4467
|
+
*
|
|
4468
|
+
* Items are automatically removed when they expire.
|
|
4469
|
+
*/
|
|
4470
|
+
declare class TtlCache<KeyType extends string, ValueType> implements Cache<KeyType, ValueType> {
|
|
4471
|
+
private readonly _cache;
|
|
4472
|
+
private readonly _ttl;
|
|
4473
|
+
/**
|
|
4474
|
+
* Create a new TTL cache with the given TTL.
|
|
4475
|
+
*
|
|
4476
|
+
* @param ttl Time-to-live duration in seconds. Items expire after this duration.
|
|
4477
|
+
*/
|
|
4478
|
+
constructor(ttl: Duration);
|
|
4479
|
+
private _cleanup;
|
|
4480
|
+
set(key: string, value: ValueType): void;
|
|
4481
|
+
get(key: string): ValueType | undefined;
|
|
4482
|
+
clear(): void;
|
|
4483
|
+
get size(): number;
|
|
4484
|
+
get capacity(): number;
|
|
4485
|
+
has(key: string): boolean;
|
|
4486
|
+
delete(key: string): boolean;
|
|
4487
|
+
}
|
|
4488
|
+
|
|
4489
|
+
/**
|
|
4490
|
+
* Filter out duplicates.
|
|
4491
|
+
*/
|
|
4492
|
+
declare const uniq: <T>(arr: T[]) => T[];
|
|
4493
|
+
|
|
4494
|
+
/**
|
|
4495
|
+
* Gets the AccountId for the contract in the specified namespace, datasource, and
|
|
4496
|
+
* contract name, or undefined if it is not defined or is not a single AccountId.
|
|
4497
|
+
*
|
|
4498
|
+
* This is useful when you want to retrieve the AccountId for a contract by its name
|
|
4499
|
+
* where it may or may not actually be defined for the given namespace and datasource.
|
|
4500
|
+
*
|
|
4501
|
+
* @param namespaceId - The ENSNamespace identifier (e.g. 'mainnet', 'sepolia', 'ens-test-env')
|
|
4502
|
+
* @param datasourceName - The name of the Datasource to search for contractName in
|
|
4503
|
+
* @param contractName - The name of the contract to retrieve
|
|
4504
|
+
* @returns The AccountId of the contract with the given namespace, datasource,
|
|
4505
|
+
* and contract name, or undefined if it is not found or is not a single AccountId
|
|
4506
|
+
*/
|
|
4507
|
+
declare const maybeGetDatasourceContract: <N extends ENSNamespaceId, D extends DatasourceName, C extends string>(namespaceId: N, datasourceName: D, contractName: C) => AccountId | undefined;
|
|
4508
|
+
/**
|
|
4509
|
+
* Gets the AccountId for the contract in the specified namespace, datasource, and
|
|
4510
|
+
* contract name, or throws an error if it is not defined or is not a single AccountId.
|
|
4511
|
+
*
|
|
4512
|
+
* @param namespaceId - The ENSNamespace identifier (e.g. 'mainnet', 'sepolia', 'ens-test-env')
|
|
4513
|
+
* @param datasourceName - The name of the Datasource to search for contractName in
|
|
4514
|
+
* @param contractName - The name of the contract to retrieve
|
|
4515
|
+
* @returns The AccountId of the contract with the given namespace, datasource,
|
|
4516
|
+
* and contract name
|
|
4517
|
+
* @throws Error if the contract is not found or is not a single AccountId
|
|
4518
|
+
*/
|
|
4519
|
+
declare const getDatasourceContract: (namespaceId: ENSNamespaceId, datasourceName: DatasourceName, contractName: string) => AccountId;
|
|
4520
|
+
/**
|
|
4521
|
+
* Makes a comparator fn for `b` against the contract described by `namespace`, `datasourceName`, and `contractName`.
|
|
4522
|
+
*/
|
|
4523
|
+
declare const makeContractMatcher: (namespace: ENSNamespaceId, b: AccountId) => (datasourceName: DatasourceName, contractName: string) => boolean | undefined;
|
|
4524
|
+
|
|
4525
|
+
/**
|
|
4526
|
+
* Duration between two moments in time.
|
|
4527
|
+
*/
|
|
4528
|
+
declare function durationBetween(start: UnixTimestamp, end: UnixTimestamp): Duration;
|
|
4529
|
+
/**
|
|
4530
|
+
* Add a duration to a timestamp.
|
|
4531
|
+
*/
|
|
4532
|
+
declare function addDuration(timestamp: UnixTimestamp, duration: Duration): UnixTimestamp;
|
|
4533
|
+
|
|
4534
|
+
declare function deserializeChainId(maybeChainId: ChainIdString, valueLabel?: string): ChainId;
|
|
4535
|
+
declare function deserializeDatetime(maybeDatetime: string, valueLabel?: string): Datetime;
|
|
4536
|
+
declare function deserializeUnixTimestamp(maybeTimestamp: number, valueLabel?: string): number;
|
|
4537
|
+
declare function deserializeUrl(maybeUrl: UrlString, valueLabel?: string): URL;
|
|
4538
|
+
declare function deserializeBlockNumber(maybeBlockNumber: number, valueLabel?: string): BlockNumber;
|
|
4539
|
+
declare function deserializeBlockrange(maybeBlockrange: Partial<Blockrange>, valueLabel?: string): {
|
|
4540
|
+
startBlock?: number | undefined;
|
|
4541
|
+
endBlock?: number | undefined;
|
|
4542
|
+
};
|
|
4543
|
+
declare function deserializeBlockRef(maybeBlockRef: Partial<BlockRef>, valueLabel?: string): BlockRef;
|
|
4544
|
+
declare function deserializeDuration(maybeDuration: unknown, valueLabel?: string): Duration;
|
|
4545
|
+
declare function parseAccountId(maybeAccountId: unknown, valueLabel?: string): AccountId;
|
|
4546
|
+
declare function deserializePriceEth(maybePrice: unknown, valueLabel?: string): PriceEth;
|
|
4547
|
+
declare function deserializePriceUsdc(maybePrice: unknown, valueLabel?: string): PriceUsdc;
|
|
4548
|
+
declare function deserializePriceDai(maybePrice: unknown, valueLabel?: string): PriceDai;
|
|
4549
|
+
|
|
4550
|
+
/**
|
|
4551
|
+
* Interprets a viem#Address. zeroAddress is interpreted as null, otherwise Address.
|
|
4552
|
+
*/
|
|
4553
|
+
declare const interpretAddress: (owner: Address) => `0x${string}` | null;
|
|
4554
|
+
|
|
4555
|
+
/**
|
|
4556
|
+
* Interprets a name record value string and returns null if the value is interpreted as a deletion.
|
|
4557
|
+
*
|
|
4558
|
+
* The interpreted record value is either:
|
|
4559
|
+
* a) null, representing a non-existant or deletion of the record, or
|
|
4560
|
+
* b) a normalized, non-empty-string Name.
|
|
4561
|
+
*
|
|
4562
|
+
* @param value - The name record value string to interpret.
|
|
4563
|
+
* @returns The interpreted name string, or null if deleted.
|
|
4564
|
+
*/
|
|
4565
|
+
declare function interpretNameRecordValue(value: string): NormalizedName | null;
|
|
4566
|
+
/**
|
|
4567
|
+
* Interprets an address record value string and returns null if the value is interpreted as a deletion.
|
|
4568
|
+
*
|
|
4569
|
+
* The interpreted record value is either:
|
|
4570
|
+
* a) null, representing a non-existant or deletion of the record, or
|
|
4571
|
+
* i. contains null bytes
|
|
4572
|
+
* ii. empty string
|
|
4573
|
+
* iii. empty hex (0x)
|
|
4574
|
+
* iv. zeroAddress
|
|
4575
|
+
* b) an address record value that
|
|
4576
|
+
* i. does not contain null bytes
|
|
4577
|
+
* ii. (if is an EVM address) is lowercase
|
|
4578
|
+
*
|
|
4579
|
+
* @param value - The address record value to interpret.
|
|
4580
|
+
* @returns The interpreted address string or null if deleted.
|
|
4581
|
+
*/
|
|
4582
|
+
declare function interpretAddressRecordValue(value: string): string | null;
|
|
4583
|
+
/**
|
|
4584
|
+
* Interprets a text record key string and returns null if the key should be ignored.
|
|
4585
|
+
*
|
|
4586
|
+
* The interpreted text record key is either:
|
|
4587
|
+
* a) null, representing a text record key that should be ignored, or
|
|
4588
|
+
* i. contains null bytes
|
|
4589
|
+
* ii. empty string
|
|
4590
|
+
* b) a text record key that
|
|
4591
|
+
* i. does not contain null bytes
|
|
4592
|
+
*
|
|
4593
|
+
* @param value - The text record key to interpret.
|
|
4594
|
+
* @returns The interpreted text string or null if ignored.
|
|
4595
|
+
*/
|
|
4596
|
+
declare function interpretTextRecordKey(key: string): string | null;
|
|
4597
|
+
/**
|
|
4598
|
+
* Interprets a text record value string and returns null if the value is interpreted as a deletion.
|
|
4599
|
+
*
|
|
4600
|
+
* The interpreted record value is either:
|
|
4601
|
+
* a) null, representing a non-existant or deletion of the record, or
|
|
4602
|
+
* i. contains null bytes
|
|
4603
|
+
* ii. empty string
|
|
4604
|
+
* b) a text record value that
|
|
4605
|
+
* i. does not contain null bytes
|
|
4606
|
+
*
|
|
4607
|
+
* @param value - The text record value to interpret.
|
|
4608
|
+
* @returns The interpreted text string or null if deleted.
|
|
4609
|
+
*/
|
|
4610
|
+
declare function interpretTextRecordValue(value: string): string | null;
|
|
4611
|
+
|
|
4612
|
+
/**
|
|
4613
|
+
* Decodes a uint256-encoded-LabelHash (eg. from a tokenId) into a {@link LabelHash}.
|
|
4614
|
+
*
|
|
4615
|
+
* Remember that contracts that operate in the context of a Managed Name frequently store and operate
|
|
4616
|
+
* over _LabelHashes_ that represent a direct subname of a Managed Name. These contracts also frequently
|
|
4617
|
+
* implement ERC721 or ERC1155 to represent ownership of these Names. As such, to construct the
|
|
4618
|
+
* ERC721/ERC1155 tokenId, they may encode the direct subnames's LabelHash as a uint256.
|
|
4619
|
+
*
|
|
4620
|
+
* This is true for the ENSv1 BaseRegistrar, RegistrarControllers, as well as any
|
|
4621
|
+
* contracts forked from it (which includes Basenames' and Lineanames' implementations).
|
|
4622
|
+
*
|
|
4623
|
+
* So, in order to turn the tokenId into a LabelHash, we perform the opposite operation, decoding
|
|
4624
|
+
* from a uint256 into a Hex (of size 32) and cast it as our semantic {@link LabelHash} type.
|
|
4625
|
+
*
|
|
4626
|
+
* @see https://github.com/ensdomains/ens-contracts/blob/db613bc/contracts/ethregistrar/ETHRegistrarController.sol#L215
|
|
4627
|
+
* @see https://github.com/base/basenames/blob/1b5c1ad/src/L2/RegistrarController.sol#L488
|
|
4628
|
+
* @see https://github.com/Consensys/linea-ens/blob/3a4f02f/packages/linea-ens-contracts/contracts/ethregistrar/ETHRegistrarController.sol#L447
|
|
4629
|
+
*/
|
|
4630
|
+
declare const interpretTokenIdAsLabelHash: (tokenId: bigint) => LabelHash;
|
|
4631
|
+
/**
|
|
4632
|
+
* Decodes a uint256-encoded-Node (eg. from a tokenId) into a {@link Node}.
|
|
4633
|
+
*
|
|
4634
|
+
* Contracts in the ENSv1 ecosystem frequently implement ERC721 or ERC1155 to represent
|
|
4635
|
+
* ownership of a Domain. As such, to construct the ERC721/ERC1155 tokenId, they may encode the
|
|
4636
|
+
* domain's {@link Node} as a uint256.
|
|
4637
|
+
*
|
|
4638
|
+
* This is true for the ENSv1 NameWrapper, as well as any contracts forked from it (which includes
|
|
4639
|
+
* Lineanames' implementation).
|
|
4640
|
+
*
|
|
4641
|
+
* So, in order to turn the tokenId into a Node, we perform the opposite operation, decoding
|
|
4642
|
+
* from a uint256 into a Hex (of size 32) and cast it as our semantic {@link Node} type.
|
|
4643
|
+
*
|
|
4644
|
+
* @see https://github.com/ensdomains/ens-contracts/blob/db613bc/contracts/wrapper/ERC1155Fuse.sol#L262
|
|
4645
|
+
*/
|
|
4646
|
+
declare const interpretTokenIdAsNode: (tokenId: bigint) => Node;
|
|
4647
|
+
|
|
4648
|
+
/**
|
|
4649
|
+
* Interprets a Literal Label, producing an Interpreted Label.
|
|
4650
|
+
*
|
|
4651
|
+
* @see https://ensnode.io/docs/reference/terminology#literal-label
|
|
4652
|
+
* @see https://ensnode.io/docs/reference/terminology#interpreted-label
|
|
4653
|
+
*
|
|
4654
|
+
* @param label - The Literal Label string to interpret
|
|
4655
|
+
* @returns The provided label if it is a normalized label, else the EncodedLabelHash of the label
|
|
4656
|
+
*/
|
|
4657
|
+
declare function literalLabelToInterpretedLabel(label: LiteralLabel): InterpretedLabel;
|
|
4658
|
+
/**
|
|
4659
|
+
* Interprets an ordered list of Literal Labels, producing an Interpreted Name.
|
|
4660
|
+
*
|
|
4661
|
+
* Note that it's important that the Literal Labels are provided as an array, otherwise it's
|
|
4662
|
+
* impossible to differentiate between 'a.label.eth' being ['a.label', 'eth'] or ['a', 'label', 'eth'].
|
|
4663
|
+
*
|
|
4664
|
+
* Note that the input is an ordered list of _Literal_ Labels: in this context, any literal label
|
|
4665
|
+
* that is formatted as an Encoded LabelHash will NOT be interpreted as such. Instead it will be
|
|
4666
|
+
* interpreted into an Encoded LabelHash that encodes the literal labelhash of the Literal Label.
|
|
4667
|
+
*
|
|
4668
|
+
* @param labels An ordered list of 0 or more Literal Labels
|
|
4669
|
+
* @returns An InterpretedName
|
|
4670
|
+
*/
|
|
4671
|
+
declare function literalLabelsToInterpretedName(labels: LiteralLabel[]): InterpretedName;
|
|
4672
|
+
/**
|
|
4673
|
+
* Joins the list of Interpreted Labels with '.' to form an Interpreted Name.
|
|
4674
|
+
*
|
|
4675
|
+
* @param labels An ordered list of 0 or more Interpreted Labels
|
|
4676
|
+
* @returns An InterpretedName
|
|
4677
|
+
*/
|
|
4678
|
+
declare function interpretedLabelsToInterpretedName(labels: InterpretedLabel[]): InterpretedName;
|
|
4679
|
+
/**
|
|
4680
|
+
* Joins the list of Literal Labels with '.' to form a Literal Name.
|
|
4681
|
+
*
|
|
4682
|
+
* Note: LiteralLabel values may contain '.' characters, which will be preserved
|
|
4683
|
+
* in the resulting LiteralName. Therefore, the number of labels in the returned
|
|
4684
|
+
* LiteralName may be greater than the number of LiteralLabels in the input array.
|
|
4685
|
+
*
|
|
4686
|
+
* @param labels An ordered list of 0 or more Literal Labels
|
|
4687
|
+
* @returns An LiteralName
|
|
4688
|
+
*/
|
|
4689
|
+
declare function literalLabelsToLiteralName(labels: LiteralLabel[]): LiteralName;
|
|
4690
|
+
/**
|
|
4691
|
+
* Converts an Interpreted Name into a list of Interpreted Labels.
|
|
4692
|
+
*/
|
|
4693
|
+
declare function interpretedNameToInterpretedLabels(name: InterpretedName): InterpretedLabel[];
|
|
4694
|
+
declare function encodedLabelToLabelhash(label: string): LabelHash | null;
|
|
4695
|
+
declare function isInterpetedLabel(label: Label): label is InterpretedLabel;
|
|
4696
|
+
declare function isInterpretedName(name: Name): name is InterpretedName;
|
|
4697
|
+
/**
|
|
4698
|
+
* Converts an InterpretedName into a LabelHashPath.
|
|
4699
|
+
*/
|
|
4700
|
+
declare function interpretedNameToLabelHashPath(name: InterpretedName): LabelHashPath;
|
|
4701
|
+
|
|
4702
|
+
/**
|
|
4703
|
+
* Implements the ENS `labelhash` function for Literal Labels.
|
|
4704
|
+
* @see https://docs.ens.domains/ensip/1
|
|
4705
|
+
*
|
|
4706
|
+
* @param label the Literal Label to hash
|
|
4707
|
+
* @returns the hash of the provided label
|
|
4708
|
+
* @dev This function is viem/ens#labelhash but without the special-case handling of Encoded LabelHashes.
|
|
4709
|
+
*/
|
|
4710
|
+
declare const labelhashLiteralLabel: (label: LiteralLabel) => LabelHash;
|
|
4711
|
+
|
|
4712
|
+
declare const hasNullByte: (value: string) => boolean;
|
|
4713
|
+
declare const stripNullBytes: (value: string) => string;
|
|
4714
|
+
|
|
4715
|
+
/**
|
|
4716
|
+
* Converts a bigint value into a number value.
|
|
4717
|
+
*
|
|
4718
|
+
* @throws when value is outside the range of `Number.MIN_SAFE_INTEGER` and
|
|
4719
|
+
* `Number.MAX_SAFE_INTEGER`.
|
|
4720
|
+
*/
|
|
4721
|
+
declare function bigIntToNumber(n: bigint): number;
|
|
4722
|
+
/**
|
|
4723
|
+
* Scales a bigint value by a floating-point number while maintaining precision.
|
|
4724
|
+
*
|
|
4725
|
+
* **How it works:**
|
|
4726
|
+
* Converts the float to a fixed-point decimal string, extracts the decimal digits,
|
|
4727
|
+
* and performs multiplication using bigint arithmetic: `(value * numerator) / denominator`.
|
|
4728
|
+
*
|
|
4729
|
+
* **Important:** JavaScript floats (IEEE 754 double-precision) have ~15-17 significant
|
|
4730
|
+
* decimal digits. Any imprecision in the input `scaleFactor` will be reflected in the result.
|
|
4731
|
+
* For example, `1/3` in JavaScript is `0.3333333333333333...` (not infinite threes), and
|
|
4732
|
+
* this function accurately preserves that limitation.
|
|
4733
|
+
*
|
|
4734
|
+
* @param value - The bigint value to scale (must be non-negative)
|
|
4735
|
+
* @param scaleFactor - The non-negative number to multiply by (can be a decimal like 0.5 or 0.333)
|
|
4736
|
+
* @returns The scaled bigint value, rounded down via integer division
|
|
4737
|
+
*
|
|
4738
|
+
* @throws {Error} If value is negative
|
|
4739
|
+
* @throws {Error} If scaleFactor is negative, NaN, infinite, or >= 1e21
|
|
4740
|
+
*
|
|
4741
|
+
* @example
|
|
4742
|
+
* // Scale by 0.5
|
|
4743
|
+
* scaleBigintByNumber(1000n, 0.5) // returns 500n
|
|
4744
|
+
*
|
|
4745
|
+
* @example
|
|
4746
|
+
* // Scale by 1/3 (uses JavaScript's float representation)
|
|
4747
|
+
* scaleBigintByNumber(1000n, 1/3) // returns 333n
|
|
4748
|
+
*
|
|
4749
|
+
* @example
|
|
4750
|
+
* // Scale USDC amount (6 decimals) by percentage
|
|
4751
|
+
* scaleBigintByNumber(5000000000n, 0.4) // 5000 USDC * 0.4 = 2000000000n (2000 USDC)
|
|
4752
|
+
*/
|
|
4753
|
+
declare function scaleBigintByNumber(value: bigint, scaleFactor: number): bigint;
|
|
4754
|
+
|
|
4755
|
+
/**
|
|
4756
|
+
* Gets the AccountId representing the ENSv1 Registry in the selected `namespace`.
|
|
4757
|
+
*/
|
|
4758
|
+
declare const getENSv1Registry: (namespace: ENSNamespaceId) => AccountId;
|
|
4759
|
+
/**
|
|
4760
|
+
* Determines whether `contract` is the ENSv1 Registry in `namespace`.
|
|
4761
|
+
*/
|
|
4762
|
+
declare const isENSv1Registry: (namespace: ENSNamespaceId, contract: AccountId) => boolean;
|
|
4763
|
+
/**
|
|
4764
|
+
* Gets the AccountId representing the ENSv2 Root Registry in the selected `namespace`.
|
|
4765
|
+
*/
|
|
4766
|
+
declare const getENSv2RootRegistry: (namespace: ENSNamespaceId) => AccountId;
|
|
4767
|
+
/**
|
|
4768
|
+
* Gets the RegistryId representing the ENSv2 Root Registry in the selected `namespace`.
|
|
4769
|
+
*/
|
|
4770
|
+
declare const getENSv2RootRegistryId: (namespace: ENSNamespaceId) => RegistryId;
|
|
4771
|
+
/**
|
|
4772
|
+
* Determines whether `contract` is the ENSv2 Root Registry in `namespace`.
|
|
4773
|
+
*/
|
|
4774
|
+
declare const isENSv2RootRegistry: (namespace: ENSNamespaceId, contract: AccountId) => boolean;
|
|
4775
|
+
|
|
4776
|
+
/**
|
|
4777
|
+
* Serializes a {@link ChainId} value into its string representation.
|
|
4778
|
+
*/
|
|
4779
|
+
declare function serializeChainId(chainId: ChainId): ChainIdString;
|
|
4780
|
+
/**
|
|
4781
|
+
* Serializes a {@link Datetime} value into its string representation.
|
|
4782
|
+
*/
|
|
4783
|
+
declare function serializeDatetime(datetime: Datetime): DatetimeISO8601;
|
|
4784
|
+
/**
|
|
4785
|
+
* Serializes a {@link URL} value into its string representation.
|
|
4786
|
+
*/
|
|
4787
|
+
declare function serializeUrl(url: URL): UrlString;
|
|
4788
|
+
/**
|
|
4789
|
+
* Serializes a {@link Price} object.
|
|
4790
|
+
*/
|
|
4791
|
+
declare function serializePrice(price: Price): SerializedPrice;
|
|
4792
|
+
/**
|
|
4793
|
+
* Serializes a {@link PriceEth} object.
|
|
4794
|
+
*/
|
|
4795
|
+
declare function serializePriceEth(price: PriceEth): SerializedPriceEth;
|
|
4796
|
+
/**
|
|
4797
|
+
* Serializes a {@link PriceUsdc} object.
|
|
4798
|
+
*/
|
|
4799
|
+
declare function serializePriceUsdc(price: PriceUsdc): SerializedPriceUsdc;
|
|
4800
|
+
/**
|
|
4801
|
+
* Serializes a {@link PriceDai} object.
|
|
4802
|
+
*/
|
|
4803
|
+
declare function serializePriceDai(price: PriceDai): SerializedPriceDai;
|
|
4804
|
+
/**
|
|
4805
|
+
* Format {@link AccountId} object as a string.
|
|
4806
|
+
*
|
|
4807
|
+
* Formatted as a fully lowercase CAIP-10 AccountId.
|
|
4808
|
+
*
|
|
4809
|
+
* @see https://chainagnostic.org/CAIPs/caip-10
|
|
4810
|
+
*/
|
|
4811
|
+
declare function formatAccountId(accountId: AccountId): AccountIdString;
|
|
4812
|
+
/**
|
|
4813
|
+
* Format {@link AssetId} object as a string.
|
|
4814
|
+
*
|
|
4815
|
+
* Formatted as a fully lowercase CAIP-19 AssetId.
|
|
4816
|
+
*
|
|
4817
|
+
* @see https://chainagnostic.org/CAIPs/caip-19
|
|
4818
|
+
*/
|
|
4819
|
+
declare function formatAssetId({ assetNamespace, contract: { chainId, address }, tokenId, }: AssetId): AssetIdString;
|
|
4820
|
+
|
|
4821
|
+
declare function isHttpProtocol(url: URL): boolean;
|
|
4822
|
+
declare function isWebSocketProtocol(url: URL): boolean;
|
|
4823
|
+
|
|
4824
|
+
export { ADDR_REVERSE_NODE, ATTR_PROTOCOL_NAME, ATTR_PROTOCOL_STEP, ATTR_PROTOCOL_STEP_RESULT, type AcceleratableRequest, type AcceleratableResponse, type AccountId, type AccountIdString, type AssetId, type AssetIdString, type AssetNamespace, AssetNamespaces, BASENAMES_NODE, type BlockNumber, type BlockRef, type Blockrange, type Cache, type CanonicalId, type CanonicalPath, 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_ENSNODE_API_URL_MAINNET, DEFAULT_ENSNODE_API_URL_SEPOLIA, DEFAULT_EVM_CHAIN_ID, DEFAULT_EVM_COIN_TYPE, type DNSEncodedLiteralName, type DNSEncodedName, type DNSEncodedPartiallyInterpretedName, type Datetime, type DatetimeISO8601, type DeepPartial, type DefaultableChainId, type DomainAssetId, type DomainId, type Duration, ENCODED_REFERRER_BYTE_LENGTH, ENCODED_REFERRER_BYTE_OFFSET, type ENSApiPublicConfig, type ENSIndexerPublicConfig, type ENSIndexerVersionInfo, ENSNodeClient, ENS_ROOT, type ENSv1DomainId, type ENSv2DomainId, ETH_COIN_TYPE, ETH_NODE, EXPECTED_ENCODED_REFERRER_PADDING, type EncodedLabelHash, type EncodedReferrer, type EnsRainbowClientLabelSet, type EnsRainbowServerLabelSet, type ErrorResponse, type ForwardResolutionArgs, ForwardResolutionProtocolStep, type ForwardResolutionResult, type Identity, type IndexingStatusRequest, type IndexingStatusResponse, type IndexingStatusResponseCode, IndexingStatusResponseCodes, type IndexingStatusResponseError, type IndexingStatusResponseOk, type InterpretedLabel, type InterpretedName, LINEANAMES_NODE, type Label, type LabelHash, type LabelHashPath, type LabelSetId, type LabelSetVersion, type LiteralLabel, type LiteralName, LruCache, type MultichainPrimaryNameResolutionArgs, type MultichainPrimaryNameResolutionResult, type NFTMintStatus, NFTMintStatuses, type NFTTransferEventMetadata, type NFTTransferType, NFTTransferTypes, NODE_ANY, type Name, type NameToken, type NameTokenOwnership, type NameTokenOwnershipBurned, type NameTokenOwnershipFullyOnchain, type NameTokenOwnershipNameWrapper, type NameTokenOwnershipType, NameTokenOwnershipTypes, type NameTokenOwnershipUnknown, type NameTokensRequest, type NameTokensResponse, type NameTokensResponseCode, NameTokensResponseCodes, type NameTokensResponseError, type NameTokensResponseErrorCode, NameTokensResponseErrorCodes, type NameTokensResponseErrorEnsIndexerConfigUnsupported, type NameTokensResponseErrorIndexingStatusUnsupported, type NameTokensResponseErrorNameTokensNotIndexed, type NameTokensResponseOk, 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 PermissionsId, type PermissionsResourceId, type PermissionsUserId, PluginName, type Price, type PriceDai, type PriceEth, type PriceUsdc, RECORDS_PER_PAGE_DEFAULT, RECORDS_PER_PAGE_MAX, ROOT_NODE, ROOT_RESOURCE, type RealtimeIndexingStatusProjection, type RegisteredNameTokens, type RegistrarAction, type RegistrarActionEventId, type RegistrarActionPricing, type RegistrarActionPricingAvailable, type RegistrarActionPricingUnknown, type RegistrarActionReferral, type RegistrarActionReferralAvailable, type RegistrarActionReferralNotApplicable, type RegistrarActionType, RegistrarActionTypes, type RegistrarActionsFilter, type RegistrarActionsFilterBeginTimestamp, type RegistrarActionsFilterByDecodedReferrer, type RegistrarActionsFilterBySubregistryNode, type RegistrarActionsFilterEndTimestamp, type RegistrarActionsFilterType, RegistrarActionsFilterTypes, type RegistrarActionsFilterWithEncodedReferral, type RegistrarActionsOrder, RegistrarActionsOrders, type RegistrarActionsRequest, type RegistrarActionsResponse, type RegistrarActionsResponseCode, RegistrarActionsResponseCodes, type RegistrarActionsResponseError, type RegistrarActionsResponseOk, type RegistrationExpiryInfo, type RegistrationId, type RegistrationLifecycle, type RegistrationLifecycleStage, type RegistryId, type RenewalId, type RequestPageParams, type RequiredAndNotNull, type ResolutionStatusId, ResolutionStatusIds, type ResolvePrimaryNameRequest, type ResolvePrimaryNameResponse, type ResolvePrimaryNamesRequest, type ResolvePrimaryNamesResponse, type ResolveRecordsRequest, type ResolveRecordsResponse, type ResolvedIdentity, type ResolverId, type ResolverRecordsId, type ResolverRecordsResponse, type ResolverRecordsResponseBase, type ResolverRecordsSelection, type ResponsePageContext, type ResponsePageContextWithNoRecords, type ResponsePageContextWithRecords, type ReverseResolutionArgs, ReverseResolutionProtocolStep, type ReverseResolutionResult, type RpcUrl, SWRCache, type SWRCacheOptions, type SerializedAssetId, type SerializedChainIndexingStatusSnapshot, type SerializedChainIndexingStatusSnapshotBackfill, type SerializedChainIndexingStatusSnapshotCompleted, type SerializedChainIndexingStatusSnapshotFollowing, type SerializedChainIndexingStatusSnapshotQueued, type SerializedConfigResponse, type SerializedCrossChainIndexingStatusSnapshot, type SerializedCrossChainIndexingStatusSnapshotOmnichain, type SerializedCurrencyAmount, type SerializedCurrentIndexingProjectionOmnichain, type SerializedDomainAssetId, type SerializedENSApiPublicConfig, type SerializedENSIndexerPublicConfig, type SerializedENSIndexerVersionInfo, type SerializedIndexedChainIds, type SerializedIndexingStatusResponse, type SerializedIndexingStatusResponseError, type SerializedIndexingStatusResponseOk, type SerializedNameToken, type SerializedNameTokensResponse, type SerializedNameTokensResponseError, type SerializedNameTokensResponseOk, type SerializedNamedRegistrarAction, type SerializedOmnichainIndexingStatusSnapshot, type SerializedOmnichainIndexingStatusSnapshotBackfill, type SerializedOmnichainIndexingStatusSnapshotCompleted, type SerializedOmnichainIndexingStatusSnapshotFollowing, type SerializedOmnichainIndexingStatusSnapshotUnstarted, type SerializedPrice, type SerializedPriceDai, type SerializedPriceEth, type SerializedPriceUsdc, type SerializedRealtimeIndexingStatusProjection, type SerializedRegisteredNameTokens, type SerializedRegistrarAction, type SerializedRegistrarActionPricing, type SerializedRegistrarActionPricingAvailable, type SerializedRegistrarActionPricingUnknown, type SerializedRegistrarActionsResponse, type SerializedRegistrarActionsResponseError, type SerializedRegistrarActionsResponseOk, type SerializedTokenId, type SubgraphInterpretedLabel, type SubgraphInterpretedName, type Subregistry, type TheGraphCannotFallbackReason, TheGraphCannotFallbackReasonSchema, type TheGraphFallback, TheGraphFallbackSchema, type TokenId, TraceableENSProtocol, type TraceableRequest, type TraceableResponse, type TracingNode, type TracingSpan, type TracingTrace, TtlCache, type UnixTimestamp, type UnknownIdentity, type UnnamedIdentity, type UnresolvedIdentity, type UrlString, ZERO_ENCODED_REFERRER, accountIdEqual, addDuration, addPrices, addrReverseLabel, asLowerCaseAddress, beautifyName, bigIntToNumber, bigintToCoinType, buildAssetId, buildEncodedReferrer, buildEnsRainbowClientLabelSet, buildLabelSetId, buildLabelSetVersion, buildPageContext, buildUnresolvedIdentity, checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill, checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted, checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing, checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted, coinTypeReverseLabel, coinTypeToEvmChainId, createIndexingConfig, createRealtimeIndexingStatusProjection, decodeDNSEncodedLiteralName, decodeDNSEncodedName, decodeEncodedReferrer, deserializeAssetId, deserializeBlockNumber, deserializeBlockRef, deserializeBlockrange, deserializeChainId, deserializeChainIndexingStatusSnapshot, deserializeConfigResponse, deserializeCrossChainIndexingStatusSnapshot, deserializeDatetime, deserializeDuration, deserializeENSApiPublicConfig, deserializeENSIndexerPublicConfig, deserializeErrorResponse, deserializeIndexingStatusResponse, deserializeOmnichainIndexingStatusSnapshot, deserializePriceDai, deserializePriceEth, deserializePriceUsdc, deserializeRealtimeIndexingStatusProjection, deserializeRegistrarActionsResponse, deserializeUnixTimestamp, deserializeUrl, deserializedNameTokensResponse, durationBetween, encodeLabelHash, encodedLabelToLabelhash, evmChainIdToCoinType, formatAccountId, formatAssetId, formatNFTTransferEventMetadata, getBasenamesSubregistryId, getBasenamesSubregistryManagedName, getCanonicalId, getCurrencyInfo, getDatasourceContract, getDefaultEnsNodeUrl, getENSv1Registry, getENSv2RootRegistry, getENSv2RootRegistryId, getEthnamesSubregistryId, getEthnamesSubregistryManagedName, getLatestIndexedBlockRef, getLineanamesSubregistryId, getLineanamesSubregistryManagedName, getNFTTransferType, getNameHierarchy, getNameTokenOwnership, getNameWrapperAccounts, getOmnichainIndexingCursor, getOmnichainIndexingStatus, getParentNameFQDN, getResolvePrimaryNameChainIdParam, getTimestampForHighestOmnichainKnownBlock, getTimestampForLowestOmnichainStartBlock, hasNullByte, interpretAddress, interpretAddressRecordValue, interpretNameRecordValue, interpretTextRecordKey, interpretTextRecordValue, interpretTokenIdAsLabelHash, interpretTokenIdAsNode, interpretedLabelsToInterpretedName, interpretedNameToInterpretedLabels, interpretedNameToLabelHashPath, isENSv1Registry, isENSv2RootRegistry, isEncodedLabelHash, isHttpProtocol, isInterpetedLabel, isInterpretedName, isLabelHash, isNormalizedLabel, isNormalizedName, isPccFuseSet, isPriceCurrencyEqual, isPriceEqual, isRegistrarActionPricingAvailable, isRegistrarActionReferralAvailable, isRegistrationExpired, isRegistrationFullyExpired, isRegistrationInGracePeriod, isResolvedIdentity, isSelectionEmpty, isSubgraphCompatible, isWebSocketProtocol, labelHashToBytes, labelhashLiteralLabel, literalLabelToInterpretedLabel, literalLabelsToInterpretedName, literalLabelsToLiteralName, makeContractMatcher, makeENSApiPublicConfigSchema, makeENSv1DomainId, makeENSv2DomainId, makeLatestRegistrationId, makeLatestRenewalId, makePermissionsId, makePermissionsResourceId, makePermissionsUserId, makeRegistrationId, makeRegistryId, makeRenewalId, makeResolverId, makeResolverRecordsId, makeSubdomainNode, maybeGetDatasourceContract, nameTokensPrerequisites, parseAccountId, parseAssetId, parseDai, parseEth, parseNonNegativeInteger, parseReverseName, parseUsdc, priceDai, priceEth, priceUsdc, registrarActionsFilter, registrarActionsPrerequisites, reverseName, scaleBigintByNumber, scalePrice, serializeAssetId, serializeChainId, serializeChainIndexingSnapshots, serializeConfigResponse, serializeCrossChainIndexingStatusSnapshotOmnichain, serializeDatetime, serializeDomainAssetId, serializeENSApiPublicConfig, serializeENSIndexerPublicConfig, serializeIndexedChainIds, serializeIndexingStatusResponse, serializeNameToken, serializeNameTokensResponse, serializeNamedRegistrarAction, serializeOmnichainIndexingStatusSnapshot, serializePrice, serializePriceDai, serializePriceEth, serializePriceUsdc, serializeRealtimeIndexingStatusProjection, serializeRegisteredNameTokens, serializeRegistrarAction, serializeRegistrarActionPricing, serializeRegistrarActionsResponse, serializeUrl, sortChainStatusesByStartBlockAsc, stripNullBytes, translateDefaultableChainIdToChainId, uint256ToHex32, uniq, validateSupportedLabelSetAndVersion };
|