@ensnode/ensnode-sdk 0.0.0-next-20260420155209 → 0.0.0-next-20260421160559
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -25
- package/dist/index.cjs +880 -835
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2317 -2280
- package/dist/index.d.ts +2317 -2280
- package/dist/index.js +863 -818
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -37,16 +37,16 @@ __export(index_exports, {
|
|
|
37
37
|
ClientError: () => ClientError,
|
|
38
38
|
CrossChainIndexingStrategyIds: () => CrossChainIndexingStrategyIds,
|
|
39
39
|
CurrencyIds: () => CurrencyIds,
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
DEFAULT_ENSNODE_URL_MAINNET: () => DEFAULT_ENSNODE_URL_MAINNET,
|
|
41
|
+
DEFAULT_ENSNODE_URL_SEPOLIA: () => DEFAULT_ENSNODE_URL_SEPOLIA,
|
|
42
42
|
ENCODED_REFERRER_BYTE_LENGTH: () => ENCODED_REFERRER_BYTE_LENGTH,
|
|
43
43
|
ENCODED_REFERRER_BYTE_OFFSET: () => ENCODED_REFERRER_BYTE_OFFSET,
|
|
44
44
|
ENSNamespaceIds: () => import_datasources13.ENSNamespaceIds,
|
|
45
45
|
EXPECTED_ENCODED_REFERRER_PADDING: () => EXPECTED_ENCODED_REFERRER_PADDING,
|
|
46
|
-
EnsApiClient: () => EnsApiClient,
|
|
47
46
|
EnsApiIndexingStatusResponseCodes: () => EnsApiIndexingStatusResponseCodes,
|
|
48
47
|
EnsIndexerClient: () => EnsIndexerClient,
|
|
49
48
|
EnsIndexerIndexingStatusResponseCodes: () => EnsIndexerIndexingStatusResponseCodes,
|
|
49
|
+
EnsNodeClient: () => EnsNodeClient,
|
|
50
50
|
ForwardResolutionProtocolStep: () => ForwardResolutionProtocolStep,
|
|
51
51
|
IndexingStatusResponseCodes: () => IndexingStatusResponseCodes,
|
|
52
52
|
LruCache: () => LruCache,
|
|
@@ -82,6 +82,7 @@ __export(index_exports, {
|
|
|
82
82
|
buildBlockRefRange: () => buildBlockRefRange,
|
|
83
83
|
buildCrossChainIndexingStatusSnapshotOmnichain: () => buildCrossChainIndexingStatusSnapshotOmnichain,
|
|
84
84
|
buildEncodedReferrer: () => buildEncodedReferrer,
|
|
85
|
+
buildEnsNodeStackInfo: () => buildEnsNodeStackInfo,
|
|
85
86
|
buildEnsRainbowClientLabelSet: () => buildEnsRainbowClientLabelSet,
|
|
86
87
|
buildIndexedBlockranges: () => buildIndexedBlockranges,
|
|
87
88
|
buildLabelSetId: () => buildLabelSetId,
|
|
@@ -90,7 +91,9 @@ __export(index_exports, {
|
|
|
90
91
|
buildPageContext: () => buildPageContext,
|
|
91
92
|
buildUnresolvedIdentity: () => buildUnresolvedIdentity,
|
|
92
93
|
buildUnvalidatedCrossChainIndexingStatusSnapshot: () => buildUnvalidatedCrossChainIndexingStatusSnapshot,
|
|
94
|
+
buildUnvalidatedEnsApiPublicConfig: () => buildUnvalidatedEnsApiPublicConfig,
|
|
93
95
|
buildUnvalidatedEnsIndexerPublicConfig: () => buildUnvalidatedEnsIndexerPublicConfig,
|
|
96
|
+
buildUnvalidatedEnsNodeStackInfo: () => buildUnvalidatedEnsNodeStackInfo,
|
|
94
97
|
buildUnvalidatedOmnichainIndexingStatusSnapshot: () => buildUnvalidatedOmnichainIndexingStatusSnapshot,
|
|
95
98
|
buildUnvalidatedRealtimeIndexingStatusProjection: () => buildUnvalidatedRealtimeIndexingStatusProjection,
|
|
96
99
|
checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill: () => checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill,
|
|
@@ -104,19 +107,18 @@ __export(index_exports, {
|
|
|
104
107
|
deserializeBlockRef: () => deserializeBlockRef,
|
|
105
108
|
deserializeChainId: () => deserializeChainId,
|
|
106
109
|
deserializeChainIndexingStatusSnapshot: () => deserializeChainIndexingStatusSnapshot,
|
|
107
|
-
deserializeConfigResponse: () => deserializeConfigResponse,
|
|
108
110
|
deserializeCrossChainIndexingStatusSnapshot: () => deserializeCrossChainIndexingStatusSnapshot,
|
|
109
111
|
deserializeDatetime: () => deserializeDatetime,
|
|
110
112
|
deserializeDuration: () => deserializeDuration,
|
|
111
113
|
deserializeENSApiPublicConfig: () => deserializeENSApiPublicConfig,
|
|
112
114
|
deserializeENSIndexerPublicConfig: () => deserializeENSIndexerPublicConfig,
|
|
113
|
-
deserializeEnsApiConfigResponse: () => deserializeEnsApiConfigResponse,
|
|
114
115
|
deserializeEnsApiIndexingStatusResponse: () => deserializeEnsApiIndexingStatusResponse,
|
|
115
116
|
deserializeEnsApiPublicConfig: () => deserializeEnsApiPublicConfig,
|
|
116
117
|
deserializeEnsIndexerConfigResponse: () => deserializeEnsIndexerConfigResponse,
|
|
117
118
|
deserializeEnsIndexerIndexingStatusResponse: () => deserializeEnsIndexerIndexingStatusResponse,
|
|
118
119
|
deserializeEnsIndexerPublicConfig: () => deserializeEnsIndexerPublicConfig,
|
|
119
|
-
|
|
120
|
+
deserializeEnsNodeStackInfo: () => deserializeEnsNodeStackInfo,
|
|
121
|
+
deserializeErrorResponse: () => deserializeErrorResponse2,
|
|
120
122
|
deserializeIndexingStatusResponse: () => deserializeIndexingStatusResponse,
|
|
121
123
|
deserializeOmnichainIndexingStatusSnapshot: () => deserializeOmnichainIndexingStatusSnapshot,
|
|
122
124
|
deserializePriceDai: () => deserializePriceDai,
|
|
@@ -204,19 +206,18 @@ __export(index_exports, {
|
|
|
204
206
|
serializeAssetId: () => serializeAssetId,
|
|
205
207
|
serializeChainId: () => serializeChainId,
|
|
206
208
|
serializeChainIndexingSnapshots: () => serializeChainIndexingSnapshots,
|
|
207
|
-
serializeConfigResponse: () => serializeConfigResponse,
|
|
208
209
|
serializeCrossChainIndexingStatusSnapshot: () => serializeCrossChainIndexingStatusSnapshot,
|
|
209
210
|
serializeCrossChainIndexingStatusSnapshotOmnichain: () => serializeCrossChainIndexingStatusSnapshotOmnichain,
|
|
210
211
|
serializeDatetime: () => serializeDatetime,
|
|
211
212
|
serializeDomainAssetId: () => serializeDomainAssetId,
|
|
212
213
|
serializeENSApiPublicConfig: () => serializeENSApiPublicConfig,
|
|
213
214
|
serializeENSIndexerPublicConfig: () => serializeENSIndexerPublicConfig,
|
|
214
|
-
serializeEnsApiConfigResponse: () => serializeEnsApiConfigResponse,
|
|
215
215
|
serializeEnsApiIndexingStatusResponse: () => serializeEnsApiIndexingStatusResponse,
|
|
216
216
|
serializeEnsApiPublicConfig: () => serializeEnsApiPublicConfig,
|
|
217
217
|
serializeEnsIndexerConfigResponse: () => serializeEnsIndexerConfigResponse,
|
|
218
218
|
serializeEnsIndexerIndexingStatusResponse: () => serializeEnsIndexerIndexingStatusResponse,
|
|
219
219
|
serializeEnsIndexerPublicConfig: () => serializeEnsIndexerPublicConfig,
|
|
220
|
+
serializeEnsNodeStackInfo: () => serializeEnsNodeStackInfo,
|
|
220
221
|
serializeIndexedChainIds: () => serializeIndexedChainIds,
|
|
221
222
|
serializeIndexingStatusResponse: () => serializeIndexingStatusResponse,
|
|
222
223
|
serializeNameToken: () => serializeNameToken,
|
|
@@ -536,9 +537,8 @@ var makeLabelSetIdSchema = (valueLabel = "Label set ID") => {
|
|
|
536
537
|
error: `${valueLabel} can only contain lowercase letters (a-z) and hyphens (-)`
|
|
537
538
|
});
|
|
538
539
|
};
|
|
539
|
-
var makeLabelSetVersionSchema = (valueLabel = "Label set version") =>
|
|
540
|
-
|
|
541
|
-
};
|
|
540
|
+
var makeLabelSetVersionSchema = (valueLabel = "Label set version") => makeNonNegativeIntegerSchema(valueLabel);
|
|
541
|
+
var makeLabelSetVersionStringSchema = (valueLabel = "Label set version") => import_v42.z.coerce.number({ error: `${valueLabel} must be a non-negative integer` }).pipe(makeLabelSetVersionSchema(valueLabel));
|
|
542
542
|
var makeEnsRainbowPublicConfigSchema = (valueLabel = "EnsRainbowPublicConfig") => import_v42.z.object({
|
|
543
543
|
version: import_v42.z.string().nonempty({ error: `${valueLabel}.version must be a non-empty string.` }),
|
|
544
544
|
labelSet: import_v42.z.object({
|
|
@@ -583,7 +583,7 @@ function buildLabelSetId(maybeLabelSetId) {
|
|
|
583
583
|
return makeLabelSetIdSchema("LabelSetId").parse(maybeLabelSetId);
|
|
584
584
|
}
|
|
585
585
|
function buildLabelSetVersion(maybeLabelSetVersion) {
|
|
586
|
-
return
|
|
586
|
+
return makeLabelSetVersionStringSchema("LabelSetVersion").parse(maybeLabelSetVersion);
|
|
587
587
|
}
|
|
588
588
|
function buildEnsRainbowClientLabelSet(labelSetId, labelSetVersion) {
|
|
589
589
|
if (labelSetVersion !== void 0 && labelSetId === void 0) {
|
|
@@ -650,7 +650,7 @@ var makeFullyPinnedLabelSetSchema = (valueLabel = "Label set") => {
|
|
|
650
650
|
}
|
|
651
651
|
return import_v43.z.object({
|
|
652
652
|
labelSetId: makeLabelSetIdSchema(valueLabelLabelSetId),
|
|
653
|
-
labelSetVersion:
|
|
653
|
+
labelSetVersion: makeLabelSetVersionStringSchema(valueLabelLabelSetVersion)
|
|
654
654
|
});
|
|
655
655
|
};
|
|
656
656
|
var makeNonEmptyStringSchema = (valueLabel = "Value") => import_v43.z.string().nonempty({ error: `${valueLabel} must be a non-empty string.` });
|
|
@@ -802,12 +802,6 @@ ${(0, import_v47.prettifyError)(parsed.error)}
|
|
|
802
802
|
}
|
|
803
803
|
var deserializeENSApiPublicConfig = deserializeEnsApiPublicConfig;
|
|
804
804
|
|
|
805
|
-
// src/ensapi/api/config/deserialize.ts
|
|
806
|
-
function deserializeEnsApiConfigResponse(maybeResponse) {
|
|
807
|
-
return deserializeEnsApiPublicConfig(maybeResponse);
|
|
808
|
-
}
|
|
809
|
-
var deserializeConfigResponse = deserializeEnsApiConfigResponse;
|
|
810
|
-
|
|
811
805
|
// src/ensindexer/config/serialize.ts
|
|
812
806
|
function serializeIndexedChainIds(indexedChainIds) {
|
|
813
807
|
return Array.from(indexedChainIds);
|
|
@@ -847,13 +841,17 @@ function serializeEnsApiPublicConfig(config) {
|
|
|
847
841
|
}
|
|
848
842
|
var serializeENSApiPublicConfig = serializeEnsApiPublicConfig;
|
|
849
843
|
|
|
850
|
-
// src/
|
|
851
|
-
function
|
|
852
|
-
return
|
|
844
|
+
// src/ensindexer/api/config/deserialize.ts
|
|
845
|
+
function deserializeEnsIndexerConfigResponse(maybeResponse) {
|
|
846
|
+
return deserializeEnsIndexerPublicConfig(maybeResponse, "EnsIndexerConfigResponse");
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
// src/ensindexer/api/config/serialize.ts
|
|
850
|
+
function serializeEnsIndexerConfigResponse(response) {
|
|
851
|
+
return serializeEnsIndexerPublicConfig(response);
|
|
853
852
|
}
|
|
854
|
-
var serializeConfigResponse = serializeEnsApiConfigResponse;
|
|
855
853
|
|
|
856
|
-
// src/
|
|
854
|
+
// src/ensindexer/api/indexing-status/deserialize.ts
|
|
857
855
|
var import_v418 = require("zod/v4");
|
|
858
856
|
|
|
859
857
|
// src/indexing-status/deserialize/realtime-indexing-status-projection.ts
|
|
@@ -1780,8 +1778,8 @@ ${(0, import_v416.prettifyError)(parsed.error)}
|
|
|
1780
1778
|
return parsed.data;
|
|
1781
1779
|
}
|
|
1782
1780
|
|
|
1783
|
-
// src/
|
|
1784
|
-
var
|
|
1781
|
+
// src/ensindexer/api/indexing-status/response.ts
|
|
1782
|
+
var EnsIndexerIndexingStatusResponseCodes = {
|
|
1785
1783
|
/**
|
|
1786
1784
|
* Represents that the indexing status is available.
|
|
1787
1785
|
*/
|
|
@@ -1791,33 +1789,32 @@ var EnsApiIndexingStatusResponseCodes = {
|
|
|
1791
1789
|
*/
|
|
1792
1790
|
Error: "error"
|
|
1793
1791
|
};
|
|
1794
|
-
var IndexingStatusResponseCodes = EnsApiIndexingStatusResponseCodes;
|
|
1795
1792
|
|
|
1796
|
-
// src/
|
|
1793
|
+
// src/ensindexer/api/indexing-status/zod-schemas.ts
|
|
1797
1794
|
var import_v417 = require("zod/v4");
|
|
1798
|
-
var
|
|
1799
|
-
responseCode: import_v417.z.literal(
|
|
1795
|
+
var makeEnsIndexerIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => import_v417.z.strictObject({
|
|
1796
|
+
responseCode: import_v417.z.literal(EnsIndexerIndexingStatusResponseCodes.Ok),
|
|
1800
1797
|
realtimeProjection: makeRealtimeIndexingStatusProjectionSchema(valueLabel)
|
|
1801
1798
|
});
|
|
1802
|
-
var
|
|
1803
|
-
responseCode: import_v417.z.literal(
|
|
1799
|
+
var makeEnsIndexerIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => import_v417.z.strictObject({
|
|
1800
|
+
responseCode: import_v417.z.literal(EnsIndexerIndexingStatusResponseCodes.Error)
|
|
1804
1801
|
});
|
|
1805
|
-
var
|
|
1806
|
-
|
|
1807
|
-
|
|
1802
|
+
var makeEnsIndexerIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => import_v417.z.discriminatedUnion("responseCode", [
|
|
1803
|
+
makeEnsIndexerIndexingStatusResponseOkSchema(valueLabel),
|
|
1804
|
+
makeEnsIndexerIndexingStatusResponseErrorSchema(valueLabel)
|
|
1808
1805
|
]);
|
|
1809
|
-
var
|
|
1810
|
-
responseCode: import_v417.z.literal(
|
|
1806
|
+
var makeSerializedEnsIndexerIndexingStatusResponseOkSchema = (valueLabel = "Serialized Indexing Status Response OK") => import_v417.z.strictObject({
|
|
1807
|
+
responseCode: import_v417.z.literal(EnsIndexerIndexingStatusResponseCodes.Ok),
|
|
1811
1808
|
realtimeProjection: makeSerializedRealtimeIndexingStatusProjectionSchema(valueLabel)
|
|
1812
1809
|
});
|
|
1813
|
-
var
|
|
1814
|
-
|
|
1815
|
-
|
|
1810
|
+
var makeSerializedEnsIndexerIndexingStatusResponseSchema = (valueLabel = "Serialized Indexing Status Response") => import_v417.z.discriminatedUnion("responseCode", [
|
|
1811
|
+
makeSerializedEnsIndexerIndexingStatusResponseOkSchema(valueLabel),
|
|
1812
|
+
makeEnsIndexerIndexingStatusResponseErrorSchema(valueLabel)
|
|
1816
1813
|
]);
|
|
1817
1814
|
|
|
1818
|
-
// src/
|
|
1819
|
-
function
|
|
1820
|
-
if (serializedResponse.responseCode !==
|
|
1815
|
+
// src/ensindexer/api/indexing-status/deserialize.ts
|
|
1816
|
+
function buildUnvalidatedEnsIndexerIndexingStatusResponse(serializedResponse) {
|
|
1817
|
+
if (serializedResponse.responseCode !== EnsIndexerIndexingStatusResponseCodes.Ok) {
|
|
1821
1818
|
return serializedResponse;
|
|
1822
1819
|
}
|
|
1823
1820
|
return {
|
|
@@ -1827,18 +1824,17 @@ function buildUnvalidatedEnsApiIndexingStatusResponse(serializedResponse) {
|
|
|
1827
1824
|
)
|
|
1828
1825
|
};
|
|
1829
1826
|
}
|
|
1830
|
-
function
|
|
1831
|
-
const parsed =
|
|
1827
|
+
function deserializeEnsIndexerIndexingStatusResponse(maybeResponse) {
|
|
1828
|
+
const parsed = makeSerializedEnsIndexerIndexingStatusResponseSchema().transform(buildUnvalidatedEnsIndexerIndexingStatusResponse).pipe(makeEnsIndexerIndexingStatusResponseSchema()).safeParse(maybeResponse);
|
|
1832
1829
|
if (parsed.error) {
|
|
1833
1830
|
throw new Error(
|
|
1834
|
-
`Cannot deserialize
|
|
1831
|
+
`Cannot deserialize EnsIndexerIndexingStatusResponse:
|
|
1835
1832
|
${(0, import_v418.prettifyError)(parsed.error)}
|
|
1836
1833
|
`
|
|
1837
1834
|
);
|
|
1838
1835
|
}
|
|
1839
1836
|
return parsed.data;
|
|
1840
1837
|
}
|
|
1841
|
-
var deserializeIndexingStatusResponse = deserializeEnsApiIndexingStatusResponse;
|
|
1842
1838
|
|
|
1843
1839
|
// src/shared/serialize.ts
|
|
1844
1840
|
function serializeChainId(chainId) {
|
|
@@ -1936,247 +1932,622 @@ function serializeRealtimeIndexingStatusProjection(indexingProjection) {
|
|
|
1936
1932
|
};
|
|
1937
1933
|
}
|
|
1938
1934
|
|
|
1939
|
-
// src/
|
|
1940
|
-
function
|
|
1935
|
+
// src/ensindexer/api/indexing-status/serialize.ts
|
|
1936
|
+
function serializeEnsIndexerIndexingStatusResponse(response) {
|
|
1941
1937
|
switch (response.responseCode) {
|
|
1942
|
-
case
|
|
1938
|
+
case EnsIndexerIndexingStatusResponseCodes.Ok:
|
|
1943
1939
|
return {
|
|
1944
1940
|
responseCode: response.responseCode,
|
|
1945
1941
|
realtimeProjection: serializeRealtimeIndexingStatusProjection(response.realtimeProjection)
|
|
1946
1942
|
};
|
|
1947
|
-
case
|
|
1943
|
+
case EnsIndexerIndexingStatusResponseCodes.Error:
|
|
1948
1944
|
return response;
|
|
1949
1945
|
}
|
|
1950
1946
|
}
|
|
1951
|
-
var serializeIndexingStatusResponse = serializeEnsApiIndexingStatusResponse;
|
|
1952
|
-
|
|
1953
|
-
// src/ensapi/api/name-tokens/deserialize.ts
|
|
1954
|
-
var import_v423 = require("zod/v4");
|
|
1955
|
-
|
|
1956
|
-
// src/ensapi/api/name-tokens/zod-schemas.ts
|
|
1957
|
-
var import_enssdk5 = require("enssdk");
|
|
1958
|
-
var import_v422 = require("zod/v4");
|
|
1959
|
-
|
|
1960
|
-
// src/tokenscope/name-token.ts
|
|
1961
|
-
var import_enssdk4 = require("enssdk");
|
|
1962
|
-
var import_viem6 = require("viem");
|
|
1963
|
-
var import_datasources4 = require("@ensnode/datasources");
|
|
1964
|
-
|
|
1965
|
-
// src/shared/account-id.ts
|
|
1966
|
-
var import_viem3 = require("viem");
|
|
1967
|
-
var accountIdEqual = (a, b) => {
|
|
1968
|
-
return a.chainId === b.chainId && (0, import_viem3.isAddressEqual)(a.address, b.address);
|
|
1969
|
-
};
|
|
1970
|
-
|
|
1971
|
-
// src/shared/datasource-contract.ts
|
|
1972
|
-
var import_datasources3 = require("@ensnode/datasources");
|
|
1973
|
-
var maybeGetDatasourceContract = (namespaceId, datasourceName, contractName) => {
|
|
1974
|
-
const datasource = (0, import_datasources3.maybeGetDatasource)(namespaceId, datasourceName);
|
|
1975
|
-
if (!datasource) return void 0;
|
|
1976
|
-
const address = datasource.contracts[contractName]?.address;
|
|
1977
|
-
if (address === void 0 || Array.isArray(address)) return void 0;
|
|
1978
|
-
return {
|
|
1979
|
-
chainId: datasource.chain.id,
|
|
1980
|
-
address
|
|
1981
|
-
};
|
|
1982
|
-
};
|
|
1983
|
-
var getDatasourceContract = (namespaceId, datasourceName, contractName) => {
|
|
1984
|
-
const contract = maybeGetDatasourceContract(namespaceId, datasourceName, contractName);
|
|
1985
|
-
if (!contract) {
|
|
1986
|
-
throw new Error(
|
|
1987
|
-
`Expected contract not found for ${namespaceId} ${datasourceName} ${contractName}`
|
|
1988
|
-
);
|
|
1989
|
-
}
|
|
1990
|
-
return contract;
|
|
1991
|
-
};
|
|
1992
|
-
var makeContractMatcher = (namespace, b) => (datasourceName, contractName) => {
|
|
1993
|
-
const a = maybeGetDatasourceContract(namespace, datasourceName, contractName);
|
|
1994
|
-
return a && accountIdEqual(a, b);
|
|
1995
|
-
};
|
|
1996
1947
|
|
|
1997
|
-
// src/
|
|
1998
|
-
var import_enssdk3 = require("enssdk");
|
|
1999
|
-
var import_viem5 = require("viem");
|
|
1948
|
+
// src/ensindexer/api/shared/errors/deserialize.ts
|
|
2000
1949
|
var import_v420 = require("zod/v4");
|
|
2001
1950
|
|
|
2002
|
-
// src/
|
|
2003
|
-
var import_caip2 = require("caip");
|
|
2004
|
-
var import_enssdk2 = require("enssdk");
|
|
2005
|
-
var import_viem4 = require("viem");
|
|
1951
|
+
// src/ensindexer/api/shared/errors/zod-schemas.ts
|
|
2006
1952
|
var import_v419 = require("zod/v4");
|
|
2007
|
-
var
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
import_v419.z.bigint().positive()
|
|
2011
|
-
);
|
|
2012
|
-
function makeTokenIdSchema(_valueLabel = "Token ID Schema", serializable = false) {
|
|
2013
|
-
if (serializable) {
|
|
2014
|
-
return tokenIdSchemaSerializable;
|
|
2015
|
-
} else {
|
|
2016
|
-
return tokenIdSchemaNative;
|
|
2017
|
-
}
|
|
2018
|
-
}
|
|
2019
|
-
var makeAssetIdSchema = (valueLabel = "Asset ID Schema", serializable) => {
|
|
2020
|
-
return import_v419.z.object({
|
|
2021
|
-
assetNamespace: import_v419.z.enum(import_enssdk2.AssetNamespaces),
|
|
2022
|
-
contract: makeAccountIdSchema(valueLabel),
|
|
2023
|
-
tokenId: makeTokenIdSchema(valueLabel, serializable ?? false)
|
|
2024
|
-
});
|
|
2025
|
-
};
|
|
2026
|
-
var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") => import_v419.z.preprocess((v) => {
|
|
2027
|
-
if (typeof v === "string") {
|
|
2028
|
-
const result = new import_caip2.AssetId(v);
|
|
2029
|
-
return {
|
|
2030
|
-
assetNamespace: result.assetName.namespace,
|
|
2031
|
-
contract: {
|
|
2032
|
-
chainId: Number(result.chainId.reference),
|
|
2033
|
-
address: result.assetName.reference
|
|
2034
|
-
},
|
|
2035
|
-
tokenId: result.tokenId
|
|
2036
|
-
};
|
|
2037
|
-
}
|
|
2038
|
-
return v;
|
|
2039
|
-
}, makeAssetIdSchema(valueLabel));
|
|
2040
|
-
function invariant_nameTokenOwnershipHasNonZeroAddressOwner(ctx) {
|
|
2041
|
-
const ownership = ctx.value;
|
|
2042
|
-
if (ctx.value.owner.address === import_viem4.zeroAddress) {
|
|
2043
|
-
ctx.issues.push({
|
|
2044
|
-
code: "custom",
|
|
2045
|
-
input: ctx.value,
|
|
2046
|
-
message: `Name Token Ownership with '${ownership.ownershipType}' must have 'address' other than the zero address.`
|
|
2047
|
-
});
|
|
2048
|
-
}
|
|
2049
|
-
}
|
|
2050
|
-
var makeNameTokenOwnershipNameWrapperSchema = (valueLabel = "Name Token Ownership NameWrapper") => import_v419.z.object({
|
|
2051
|
-
ownershipType: import_v419.z.literal(NameTokenOwnershipTypes.NameWrapper),
|
|
2052
|
-
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2053
|
-
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2054
|
-
var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") => import_v419.z.object({
|
|
2055
|
-
ownershipType: import_v419.z.literal(NameTokenOwnershipTypes.FullyOnchain),
|
|
2056
|
-
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2057
|
-
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2058
|
-
var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") => import_v419.z.object({
|
|
2059
|
-
ownershipType: import_v419.z.literal(NameTokenOwnershipTypes.Burned),
|
|
2060
|
-
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2061
|
-
}).check(invariant_nameTokenOwnershipHasZeroAddressOwner);
|
|
2062
|
-
var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") => import_v419.z.object({
|
|
2063
|
-
ownershipType: import_v419.z.literal(NameTokenOwnershipTypes.Unknown),
|
|
2064
|
-
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2065
|
-
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2066
|
-
function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
|
|
2067
|
-
const ownership = ctx.value;
|
|
2068
|
-
if (ctx.value.owner.address !== import_viem4.zeroAddress) {
|
|
2069
|
-
ctx.issues.push({
|
|
2070
|
-
code: "custom",
|
|
2071
|
-
input: ctx.value,
|
|
2072
|
-
message: `Name Token Ownership with '${ownership.ownershipType}' must have 'address' set to the zero address.`
|
|
2073
|
-
});
|
|
2074
|
-
}
|
|
2075
|
-
}
|
|
2076
|
-
var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") => import_v419.z.discriminatedUnion("ownershipType", [
|
|
2077
|
-
makeNameTokenOwnershipNameWrapperSchema(valueLabel),
|
|
2078
|
-
makeNameTokenOwnershipFullyOnchainSchema(valueLabel),
|
|
2079
|
-
makeNameTokenOwnershipBurnedSchema(valueLabel),
|
|
2080
|
-
makeNameTokenOwnershipUnknownSchema(valueLabel)
|
|
2081
|
-
]);
|
|
2082
|
-
var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) => import_v419.z.object({
|
|
2083
|
-
token: makeAssetIdSchema(`${valueLabel}.token`, serializable),
|
|
2084
|
-
ownership: makeNameTokenOwnershipSchema(`${valueLabel}.ownership`),
|
|
2085
|
-
mintStatus: import_v419.z.enum(NFTMintStatuses)
|
|
1953
|
+
var ErrorResponseSchema = import_v419.z.object({
|
|
1954
|
+
message: import_v419.z.string(),
|
|
1955
|
+
details: import_v419.z.optional(import_v419.z.unknown())
|
|
2086
1956
|
});
|
|
2087
1957
|
|
|
2088
|
-
// src/
|
|
2089
|
-
function
|
|
2090
|
-
|
|
2091
|
-
assetNamespace: assetId.assetNamespace,
|
|
2092
|
-
contract: assetId.contract,
|
|
2093
|
-
tokenId: assetId.tokenId.toString()
|
|
2094
|
-
};
|
|
2095
|
-
}
|
|
2096
|
-
function deserializeAssetId(maybeAssetId, valueLabel) {
|
|
2097
|
-
const schema = makeAssetIdSchema(valueLabel);
|
|
2098
|
-
const parsed = schema.safeParse(maybeAssetId);
|
|
1958
|
+
// src/ensindexer/api/shared/errors/deserialize.ts
|
|
1959
|
+
function deserializeErrorResponse(maybeErrorResponse) {
|
|
1960
|
+
const parsed = ErrorResponseSchema.safeParse(maybeErrorResponse);
|
|
2099
1961
|
if (parsed.error) {
|
|
2100
|
-
throw new
|
|
1962
|
+
throw new Error(`Cannot deserialize ErrorResponse:
|
|
2101
1963
|
${(0, import_v420.prettifyError)(parsed.error)}
|
|
2102
1964
|
`);
|
|
2103
1965
|
}
|
|
2104
1966
|
return parsed.data;
|
|
2105
1967
|
}
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
1968
|
+
|
|
1969
|
+
// src/ensindexer/client.ts
|
|
1970
|
+
var EnsIndexerClient = class {
|
|
1971
|
+
constructor(options) {
|
|
1972
|
+
this.options = options;
|
|
1973
|
+
}
|
|
1974
|
+
getOptions() {
|
|
1975
|
+
return Object.freeze({
|
|
1976
|
+
url: new URL(this.options.url.href)
|
|
1977
|
+
});
|
|
2113
1978
|
}
|
|
2114
|
-
return parsed.data;
|
|
2115
|
-
}
|
|
2116
|
-
var buildAssetId = (contract, tokenId, assetNamespace) => {
|
|
2117
|
-
return {
|
|
2118
|
-
assetNamespace,
|
|
2119
|
-
contract,
|
|
2120
|
-
tokenId
|
|
2121
|
-
};
|
|
2122
|
-
};
|
|
2123
|
-
function serializeDomainAssetId(domainAsset) {
|
|
2124
|
-
return {
|
|
2125
|
-
...serializeAssetId(domainAsset),
|
|
2126
|
-
domainId: domainAsset.domainId
|
|
2127
|
-
};
|
|
2128
|
-
}
|
|
2129
|
-
var NFTMintStatuses = {
|
|
2130
|
-
Minted: "minted",
|
|
2131
|
-
Burned: "burned"
|
|
2132
|
-
};
|
|
2133
|
-
var formatNFTTransferEventMetadata = (metadata) => {
|
|
2134
|
-
const assetIdString = (0, import_enssdk3.stringifyAssetId)(metadata.nft);
|
|
2135
|
-
return [
|
|
2136
|
-
`Event: ${metadata.eventHandlerName}`,
|
|
2137
|
-
`Chain ID: ${metadata.chainId}`,
|
|
2138
|
-
`Block Number: ${metadata.blockNumber}`,
|
|
2139
|
-
`Transaction Hash: ${metadata.transactionHash}`,
|
|
2140
|
-
`NFT: ${assetIdString}`
|
|
2141
|
-
].map((line) => ` - ${line}`).join("\n");
|
|
2142
|
-
};
|
|
2143
|
-
var NFTTransferTypes = {
|
|
2144
|
-
/**
|
|
2145
|
-
* Initial transfer from zeroAddress to a non-zeroAddress
|
|
2146
|
-
* Can happen at most once to a NFT AssetId
|
|
2147
|
-
*
|
|
2148
|
-
* Invariants:
|
|
2149
|
-
* - NFT is not indexed and therefore has no previous mint status or owner
|
|
2150
|
-
* - new NFT mint status is `minted`
|
|
2151
|
-
* - new NFT owner is a non-zeroAddress
|
|
2152
|
-
*/
|
|
2153
|
-
Mint: "mint",
|
|
2154
1979
|
/**
|
|
2155
|
-
*
|
|
2156
|
-
* Can happen any number of times to a NFT AssetId as it passes in a cycle from
|
|
2157
|
-
* mint -> burn -> remint -> burn -> remint -> ...
|
|
1980
|
+
* Fetch ENSIndexer Config
|
|
2158
1981
|
*
|
|
2159
|
-
*
|
|
2160
|
-
* - NFT is indexed
|
|
2161
|
-
* - previous NFT mint status was `burned`
|
|
2162
|
-
* - previous NFT owner is the zeroAddress
|
|
2163
|
-
* - new NFT mint status is `minted`
|
|
2164
|
-
* - new NFT owner is a non-zeroAddress
|
|
2165
|
-
*/
|
|
2166
|
-
Remint: "remint",
|
|
2167
|
-
/**
|
|
2168
|
-
* Special transfer type for improperly implemented NFT contracts that allow a NFT
|
|
2169
|
-
* that is currently minted to be reminted before an intermediate burn.
|
|
1982
|
+
* Fetch the ENSIndexer's configuration.
|
|
2170
1983
|
*
|
|
2171
|
-
*
|
|
2172
|
-
* previously indexed nft had status `minted` with a non-zeroAddress owner.
|
|
1984
|
+
* @returns {EnsIndexerConfigResponse}
|
|
2173
1985
|
*
|
|
2174
|
-
*
|
|
2175
|
-
*
|
|
2176
|
-
*
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
1986
|
+
* @throws if the ENSIndexer request fails
|
|
1987
|
+
* @throws if the ENSIndexer returns a non-ok response
|
|
1988
|
+
* @throws if the ENSIndexer response breaks required invariants
|
|
1989
|
+
*/
|
|
1990
|
+
async config() {
|
|
1991
|
+
const url = new URL(`/api/config`, this.options.url);
|
|
1992
|
+
const response = await fetch(url);
|
|
1993
|
+
let responseData;
|
|
1994
|
+
try {
|
|
1995
|
+
responseData = await response.json();
|
|
1996
|
+
} catch {
|
|
1997
|
+
throw new Error("Malformed response data: invalid JSON");
|
|
1998
|
+
}
|
|
1999
|
+
if (!response.ok) {
|
|
2000
|
+
const errorResponse = deserializeErrorResponse(responseData);
|
|
2001
|
+
throw new Error(`Fetching ENSIndexer Config Failed: ${errorResponse.message}`);
|
|
2002
|
+
}
|
|
2003
|
+
return deserializeEnsIndexerConfigResponse(
|
|
2004
|
+
responseData
|
|
2005
|
+
);
|
|
2006
|
+
}
|
|
2007
|
+
/**
|
|
2008
|
+
* Fetch ENSIndexer Indexing Status
|
|
2009
|
+
*
|
|
2010
|
+
* @returns {EnsIndexerIndexingStatusResponse}
|
|
2011
|
+
*
|
|
2012
|
+
* @throws if the ENSIndexer request fails
|
|
2013
|
+
* @throws if the ENSIndexer returns a non-ok response
|
|
2014
|
+
* @throws if the ENSIndexer response breaks required invariants
|
|
2015
|
+
*/
|
|
2016
|
+
async indexingStatus() {
|
|
2017
|
+
const url = new URL(`/api/indexing-status`, this.options.url);
|
|
2018
|
+
const response = await fetch(url);
|
|
2019
|
+
let responseData;
|
|
2020
|
+
try {
|
|
2021
|
+
responseData = await response.json();
|
|
2022
|
+
} catch {
|
|
2023
|
+
throw new Error("Malformed response data: invalid JSON");
|
|
2024
|
+
}
|
|
2025
|
+
if (!response.ok) {
|
|
2026
|
+
let errorResponse;
|
|
2027
|
+
try {
|
|
2028
|
+
errorResponse = deserializeErrorResponse(responseData);
|
|
2029
|
+
} catch {
|
|
2030
|
+
}
|
|
2031
|
+
if (typeof errorResponse !== "undefined") {
|
|
2032
|
+
throw new Error(`Fetching ENSIndexer Indexing Status Failed: ${errorResponse.message}`);
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
return deserializeEnsIndexerIndexingStatusResponse(
|
|
2036
|
+
responseData
|
|
2037
|
+
);
|
|
2038
|
+
}
|
|
2039
|
+
};
|
|
2040
|
+
|
|
2041
|
+
// src/ensindexer/config/compatibility.ts
|
|
2042
|
+
function validateEnsIndexerPublicConfigCompatibility(configA, configB) {
|
|
2043
|
+
if (configA.indexedChainIds.symmetricDifference(configB.indexedChainIds).size > 0) {
|
|
2044
|
+
throw new Error(
|
|
2045
|
+
[
|
|
2046
|
+
`'indexedChainIds' must be compatible.`,
|
|
2047
|
+
`Stored Config 'indexedChainIds': '${Array.from(configA.indexedChainIds).join(", ")}'.`,
|
|
2048
|
+
`Current Config 'indexedChainIds': '${Array.from(configB.indexedChainIds).join(", ")}'.`
|
|
2049
|
+
].join(" ")
|
|
2050
|
+
);
|
|
2051
|
+
}
|
|
2052
|
+
if (configA.isSubgraphCompatible !== configB.isSubgraphCompatible) {
|
|
2053
|
+
throw new Error(
|
|
2054
|
+
[
|
|
2055
|
+
`'isSubgraphCompatible' flag must be compatible.`,
|
|
2056
|
+
`Stored Config 'isSubgraphCompatible' flag: '${configA.isSubgraphCompatible}'.`,
|
|
2057
|
+
`Current Config 'isSubgraphCompatible' flag: '${configB.isSubgraphCompatible}'.`
|
|
2058
|
+
].join(" ")
|
|
2059
|
+
);
|
|
2060
|
+
}
|
|
2061
|
+
if (configA.namespace !== configB.namespace) {
|
|
2062
|
+
throw new Error(
|
|
2063
|
+
[
|
|
2064
|
+
`'namespace' must be compatible.`,
|
|
2065
|
+
`Stored Config 'namespace': '${configA.namespace}'.`,
|
|
2066
|
+
`Current Config 'namespace': '${configB.namespace}'.`
|
|
2067
|
+
].join(" ")
|
|
2068
|
+
);
|
|
2069
|
+
}
|
|
2070
|
+
if (configA.labelSet.labelSetId !== configB.labelSet.labelSetId) {
|
|
2071
|
+
throw new Error(
|
|
2072
|
+
[
|
|
2073
|
+
`'labelSet.labelSetId' must be compatible.`,
|
|
2074
|
+
`Stored Config 'labelSet.labelSetId': '${configA.labelSet.labelSetId}'.`,
|
|
2075
|
+
`Current Config 'labelSet.labelSetId': '${configB.labelSet.labelSetId}'.`
|
|
2076
|
+
].join(" ")
|
|
2077
|
+
);
|
|
2078
|
+
}
|
|
2079
|
+
if (configA.labelSet.labelSetVersion !== configB.labelSet.labelSetVersion) {
|
|
2080
|
+
throw new Error(
|
|
2081
|
+
[
|
|
2082
|
+
`'labelSet.labelSetVersion' must be compatible.`,
|
|
2083
|
+
`Stored Config 'labelSet.labelSetVersion': '${configA.labelSet.labelSetVersion}'.`,
|
|
2084
|
+
`Current Config 'labelSet.labelSetVersion': '${configB.labelSet.labelSetVersion}'.`
|
|
2085
|
+
].join(" ")
|
|
2086
|
+
);
|
|
2087
|
+
}
|
|
2088
|
+
const configAPluginsSet = new Set(configA.plugins);
|
|
2089
|
+
const configBPluginsSet = new Set(configB.plugins);
|
|
2090
|
+
if (configAPluginsSet.symmetricDifference(configBPluginsSet).size > 0) {
|
|
2091
|
+
throw new Error(
|
|
2092
|
+
[
|
|
2093
|
+
`'plugins' must be compatible.`,
|
|
2094
|
+
`Stored Config 'plugins': '${configA.plugins.join(", ")}'.`,
|
|
2095
|
+
`Current Config 'plugins': '${configB.plugins.join(", ")}'.`
|
|
2096
|
+
].join(" ")
|
|
2097
|
+
);
|
|
2098
|
+
}
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2101
|
+
// src/ensindexer/config/label-utils.ts
|
|
2102
|
+
var import_viem3 = require("viem");
|
|
2103
|
+
function labelHashToBytes(labelHash) {
|
|
2104
|
+
try {
|
|
2105
|
+
if (labelHash.length !== 66) {
|
|
2106
|
+
throw new Error(`Invalid labelHash length ${labelHash.length} characters (expected 66)`);
|
|
2107
|
+
}
|
|
2108
|
+
if (labelHash !== labelHash.toLowerCase()) {
|
|
2109
|
+
throw new Error("Labelhash must be in lowercase");
|
|
2110
|
+
}
|
|
2111
|
+
if (!labelHash.startsWith("0x")) {
|
|
2112
|
+
throw new Error("Labelhash must be 0x-prefixed");
|
|
2113
|
+
}
|
|
2114
|
+
const bytes = (0, import_viem3.hexToBytes)(labelHash);
|
|
2115
|
+
if (bytes.length !== 32) {
|
|
2116
|
+
throw new Error(`Invalid labelHash length ${bytes.length} bytes (expected 32)`);
|
|
2117
|
+
}
|
|
2118
|
+
return bytes;
|
|
2119
|
+
} catch (e) {
|
|
2120
|
+
if (e instanceof Error) {
|
|
2121
|
+
throw e;
|
|
2122
|
+
}
|
|
2123
|
+
throw new Error("Invalid hex format");
|
|
2124
|
+
}
|
|
2125
|
+
}
|
|
2126
|
+
|
|
2127
|
+
// src/ensindexer/config/parsing.ts
|
|
2128
|
+
function parseNonNegativeInteger(maybeNumber) {
|
|
2129
|
+
const trimmed = maybeNumber.trim();
|
|
2130
|
+
if (!trimmed) {
|
|
2131
|
+
throw new Error("Input cannot be empty");
|
|
2132
|
+
}
|
|
2133
|
+
if (trimmed === "-0") {
|
|
2134
|
+
throw new Error("Negative zero is not a valid non-negative integer");
|
|
2135
|
+
}
|
|
2136
|
+
const num = Number(maybeNumber);
|
|
2137
|
+
if (Number.isNaN(num)) {
|
|
2138
|
+
throw new Error(`"${maybeNumber}" is not a valid number`);
|
|
2139
|
+
}
|
|
2140
|
+
if (!Number.isFinite(num)) {
|
|
2141
|
+
throw new Error(`"${maybeNumber}" is not a finite number`);
|
|
2142
|
+
}
|
|
2143
|
+
if (!Number.isInteger(num)) {
|
|
2144
|
+
throw new Error(`"${maybeNumber}" is not an integer`);
|
|
2145
|
+
}
|
|
2146
|
+
if (num < 0) {
|
|
2147
|
+
throw new Error(`"${maybeNumber}" is not a non-negative integer`);
|
|
2148
|
+
}
|
|
2149
|
+
return num;
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2152
|
+
// src/ensindexer/config/validate/ensindexer-public-config.ts
|
|
2153
|
+
var import_v421 = require("zod/v4");
|
|
2154
|
+
function validateEnsIndexerPublicConfig(unvalidatedConfig) {
|
|
2155
|
+
const schema = makeEnsIndexerPublicConfigSchema();
|
|
2156
|
+
const result = schema.safeParse(unvalidatedConfig);
|
|
2157
|
+
if (!result.success) {
|
|
2158
|
+
throw new Error(`Invalid ENSIndexerPublicConfig: ${(0, import_v421.prettifyError)(result.error)}`);
|
|
2159
|
+
}
|
|
2160
|
+
return result.data;
|
|
2161
|
+
}
|
|
2162
|
+
|
|
2163
|
+
// src/ensindexer/config/validate/ensindexer-version-info.ts
|
|
2164
|
+
var import_v422 = require("zod/v4");
|
|
2165
|
+
function validateEnsIndexerVersionInfo(unvalidatedVersionInfo) {
|
|
2166
|
+
const schema = makeEnsIndexerVersionInfoSchema();
|
|
2167
|
+
const result = schema.safeParse(unvalidatedVersionInfo);
|
|
2168
|
+
if (!result.success) {
|
|
2169
|
+
throw new Error(`Invalid EnsIndexerVersionInfo: ${(0, import_v422.prettifyError)(result.error)}`);
|
|
2170
|
+
}
|
|
2171
|
+
return result.data;
|
|
2172
|
+
}
|
|
2173
|
+
|
|
2174
|
+
// src/ensnode/api/indexing-status/deserialize.ts
|
|
2175
|
+
var import_v427 = require("zod/v4");
|
|
2176
|
+
|
|
2177
|
+
// src/stack-info/deserialize/ensnode-stack-info.ts
|
|
2178
|
+
var import_v425 = require("zod/v4");
|
|
2179
|
+
|
|
2180
|
+
// src/stack-info/zod-schemas/ensnode-stack-info.ts
|
|
2181
|
+
var import_v424 = require("zod/v4");
|
|
2182
|
+
|
|
2183
|
+
// src/ensdb/zod-schemas/config.ts
|
|
2184
|
+
var import_v423 = require("zod/v4");
|
|
2185
|
+
var makeEnsDbVersionInfoSchema = (valueLabel) => {
|
|
2186
|
+
const label = valueLabel ?? "EnsDbVersionInfo";
|
|
2187
|
+
return import_v423.z.object({
|
|
2188
|
+
postgresql: import_v423.z.string().nonempty(`${label}.postgresql must be a non-empty string`).describe("Version of the PostgreSQL server hosting the ENSDb instance.")
|
|
2189
|
+
}).describe(label);
|
|
2190
|
+
};
|
|
2191
|
+
var makeEnsDbPublicConfigSchema = (valueLabel) => {
|
|
2192
|
+
const label = valueLabel ?? "EnsDbPublicConfig";
|
|
2193
|
+
return import_v423.z.object({
|
|
2194
|
+
versionInfo: makeEnsDbVersionInfoSchema(`${label}.versionInfo`)
|
|
2195
|
+
}).describe(label);
|
|
2196
|
+
};
|
|
2197
|
+
|
|
2198
|
+
// src/stack-info/zod-schemas/ensnode-stack-info.ts
|
|
2199
|
+
function makeSerializedEnsNodeStackInfoSchema(valueLabel) {
|
|
2200
|
+
const label = valueLabel ?? "ENSNodeStackInfo";
|
|
2201
|
+
return import_v424.z.object({
|
|
2202
|
+
ensApi: makeSerializedEnsApiPublicConfigSchema(`${label}.ensApi`),
|
|
2203
|
+
ensDb: makeEnsDbPublicConfigSchema(`${label}.ensDb`),
|
|
2204
|
+
ensIndexer: makeSerializedEnsIndexerPublicConfigSchema(`${label}.ensIndexer`),
|
|
2205
|
+
ensRainbow: makeEnsRainbowPublicConfigSchema(`${label}.ensRainbow`).optional()
|
|
2206
|
+
});
|
|
2207
|
+
}
|
|
2208
|
+
function makeEnsNodeStackInfoSchema(valueLabel) {
|
|
2209
|
+
const label = valueLabel ?? "ENSNodeStackInfo";
|
|
2210
|
+
return import_v424.z.object({
|
|
2211
|
+
ensApi: makeEnsApiPublicConfigSchema(`${label}.ensApi`),
|
|
2212
|
+
ensDb: makeEnsDbPublicConfigSchema(`${label}.ensDb`),
|
|
2213
|
+
ensIndexer: makeEnsIndexerPublicConfigSchema(`${label}.ensIndexer`),
|
|
2214
|
+
ensRainbow: makeEnsRainbowPublicConfigSchema(`${label}.ensRainbow`).optional()
|
|
2215
|
+
});
|
|
2216
|
+
}
|
|
2217
|
+
|
|
2218
|
+
// src/stack-info/deserialize/ensnode-stack-info.ts
|
|
2219
|
+
function buildUnvalidatedEnsNodeStackInfo(serializedStackInfo) {
|
|
2220
|
+
const { ensApi, ensIndexer, ...rest } = serializedStackInfo;
|
|
2221
|
+
return {
|
|
2222
|
+
...rest,
|
|
2223
|
+
ensApi: buildUnvalidatedEnsApiPublicConfig(ensApi),
|
|
2224
|
+
ensIndexer: buildUnvalidatedEnsIndexerPublicConfig(ensIndexer)
|
|
2225
|
+
};
|
|
2226
|
+
}
|
|
2227
|
+
function deserializeEnsNodeStackInfo(maybeStackInfo, valueLabel) {
|
|
2228
|
+
const parsed = makeSerializedEnsNodeStackInfoSchema(valueLabel).transform(buildUnvalidatedEnsNodeStackInfo).pipe(makeEnsNodeStackInfoSchema(valueLabel)).safeParse(maybeStackInfo);
|
|
2229
|
+
if (parsed.error) {
|
|
2230
|
+
throw new Error(`Cannot deserialize EnsNodeStackInfo:
|
|
2231
|
+
${(0, import_v425.prettifyError)(parsed.error)}
|
|
2232
|
+
`);
|
|
2233
|
+
}
|
|
2234
|
+
return parsed.data;
|
|
2235
|
+
}
|
|
2236
|
+
|
|
2237
|
+
// src/ensnode/api/indexing-status/response.ts
|
|
2238
|
+
var EnsApiIndexingStatusResponseCodes = {
|
|
2239
|
+
/**
|
|
2240
|
+
* Represents that the indexing status is available.
|
|
2241
|
+
*/
|
|
2242
|
+
Ok: "ok",
|
|
2243
|
+
/**
|
|
2244
|
+
* Represents that the indexing status is unavailable.
|
|
2245
|
+
*/
|
|
2246
|
+
Error: "error"
|
|
2247
|
+
};
|
|
2248
|
+
var IndexingStatusResponseCodes = EnsApiIndexingStatusResponseCodes;
|
|
2249
|
+
|
|
2250
|
+
// src/ensnode/api/indexing-status/zod-schemas.ts
|
|
2251
|
+
var import_v426 = require("zod/v4");
|
|
2252
|
+
var makeEnsApiIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => import_v426.z.strictObject({
|
|
2253
|
+
responseCode: import_v426.z.literal(EnsApiIndexingStatusResponseCodes.Ok),
|
|
2254
|
+
realtimeProjection: makeRealtimeIndexingStatusProjectionSchema(valueLabel),
|
|
2255
|
+
stackInfo: makeEnsNodeStackInfoSchema(valueLabel)
|
|
2256
|
+
});
|
|
2257
|
+
var makeEnsApiIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => import_v426.z.strictObject({
|
|
2258
|
+
responseCode: import_v426.z.literal(EnsApiIndexingStatusResponseCodes.Error)
|
|
2259
|
+
});
|
|
2260
|
+
var makeEnsApiIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => import_v426.z.discriminatedUnion("responseCode", [
|
|
2261
|
+
makeEnsApiIndexingStatusResponseOkSchema(valueLabel),
|
|
2262
|
+
makeEnsApiIndexingStatusResponseErrorSchema(valueLabel)
|
|
2263
|
+
]);
|
|
2264
|
+
var makeSerializedEnsApiIndexingStatusResponseOkSchema = (valueLabel = "Serialized Indexing Status Response OK") => import_v426.z.object({
|
|
2265
|
+
responseCode: import_v426.z.literal(EnsApiIndexingStatusResponseCodes.Ok),
|
|
2266
|
+
realtimeProjection: makeSerializedRealtimeIndexingStatusProjectionSchema(valueLabel),
|
|
2267
|
+
stackInfo: makeSerializedEnsNodeStackInfoSchema(valueLabel)
|
|
2268
|
+
});
|
|
2269
|
+
var makeSerializedEnsApiIndexingStatusResponseSchema = (valueLabel = "Serialized Indexing Status Response") => import_v426.z.discriminatedUnion("responseCode", [
|
|
2270
|
+
makeSerializedEnsApiIndexingStatusResponseOkSchema(valueLabel),
|
|
2271
|
+
makeEnsApiIndexingStatusResponseErrorSchema(valueLabel)
|
|
2272
|
+
]);
|
|
2273
|
+
|
|
2274
|
+
// src/ensnode/api/indexing-status/deserialize.ts
|
|
2275
|
+
function buildUnvalidatedEnsApiIndexingStatusResponse(serializedResponse) {
|
|
2276
|
+
if (serializedResponse.responseCode !== EnsApiIndexingStatusResponseCodes.Ok) {
|
|
2277
|
+
return serializedResponse;
|
|
2278
|
+
}
|
|
2279
|
+
const { realtimeProjection, stackInfo, ...rest } = serializedResponse;
|
|
2280
|
+
return {
|
|
2281
|
+
realtimeProjection: buildUnvalidatedRealtimeIndexingStatusProjection(realtimeProjection),
|
|
2282
|
+
stackInfo: buildUnvalidatedEnsNodeStackInfo(stackInfo),
|
|
2283
|
+
...rest
|
|
2284
|
+
};
|
|
2285
|
+
}
|
|
2286
|
+
function deserializeEnsApiIndexingStatusResponse(maybeResponse) {
|
|
2287
|
+
const parsed = makeSerializedEnsApiIndexingStatusResponseSchema().transform(buildUnvalidatedEnsApiIndexingStatusResponse).pipe(makeEnsApiIndexingStatusResponseSchema()).safeParse(maybeResponse);
|
|
2288
|
+
if (parsed.error) {
|
|
2289
|
+
throw new Error(
|
|
2290
|
+
`Cannot deserialize EnsApiIndexingStatusResponse:
|
|
2291
|
+
${(0, import_v427.prettifyError)(parsed.error)}
|
|
2292
|
+
`
|
|
2293
|
+
);
|
|
2294
|
+
}
|
|
2295
|
+
return parsed.data;
|
|
2296
|
+
}
|
|
2297
|
+
var deserializeIndexingStatusResponse = deserializeEnsApiIndexingStatusResponse;
|
|
2298
|
+
|
|
2299
|
+
// src/stack-info/serialize/ensnode-stack-info.ts
|
|
2300
|
+
function serializeEnsNodeStackInfo(stackInfo) {
|
|
2301
|
+
return {
|
|
2302
|
+
ensApi: serializeEnsApiPublicConfig(stackInfo.ensApi),
|
|
2303
|
+
ensDb: stackInfo.ensDb,
|
|
2304
|
+
ensIndexer: serializeEnsIndexerPublicConfig(stackInfo.ensIndexer),
|
|
2305
|
+
ensRainbow: stackInfo.ensRainbow
|
|
2306
|
+
};
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2309
|
+
// src/ensnode/api/indexing-status/serialize.ts
|
|
2310
|
+
function serializeEnsApiIndexingStatusResponse(response) {
|
|
2311
|
+
switch (response.responseCode) {
|
|
2312
|
+
case EnsApiIndexingStatusResponseCodes.Ok:
|
|
2313
|
+
return {
|
|
2314
|
+
responseCode: response.responseCode,
|
|
2315
|
+
realtimeProjection: serializeRealtimeIndexingStatusProjection(response.realtimeProjection),
|
|
2316
|
+
stackInfo: serializeEnsNodeStackInfo(response.stackInfo)
|
|
2317
|
+
};
|
|
2318
|
+
case EnsApiIndexingStatusResponseCodes.Error:
|
|
2319
|
+
return response;
|
|
2320
|
+
}
|
|
2321
|
+
}
|
|
2322
|
+
var serializeIndexingStatusResponse = serializeEnsApiIndexingStatusResponse;
|
|
2323
|
+
|
|
2324
|
+
// src/ensnode/api/name-tokens/deserialize.ts
|
|
2325
|
+
var import_v432 = require("zod/v4");
|
|
2326
|
+
|
|
2327
|
+
// src/ensnode/api/name-tokens/zod-schemas.ts
|
|
2328
|
+
var import_enssdk5 = require("enssdk");
|
|
2329
|
+
var import_v431 = require("zod/v4");
|
|
2330
|
+
|
|
2331
|
+
// src/tokenscope/name-token.ts
|
|
2332
|
+
var import_enssdk4 = require("enssdk");
|
|
2333
|
+
var import_viem7 = require("viem");
|
|
2334
|
+
var import_datasources4 = require("@ensnode/datasources");
|
|
2335
|
+
|
|
2336
|
+
// src/shared/account-id.ts
|
|
2337
|
+
var import_viem4 = require("viem");
|
|
2338
|
+
var accountIdEqual = (a, b) => {
|
|
2339
|
+
return a.chainId === b.chainId && (0, import_viem4.isAddressEqual)(a.address, b.address);
|
|
2340
|
+
};
|
|
2341
|
+
|
|
2342
|
+
// src/shared/datasource-contract.ts
|
|
2343
|
+
var import_datasources3 = require("@ensnode/datasources");
|
|
2344
|
+
var maybeGetDatasourceContract = (namespaceId, datasourceName, contractName) => {
|
|
2345
|
+
const datasource = (0, import_datasources3.maybeGetDatasource)(namespaceId, datasourceName);
|
|
2346
|
+
if (!datasource) return void 0;
|
|
2347
|
+
const address = datasource.contracts[contractName]?.address;
|
|
2348
|
+
if (address === void 0 || Array.isArray(address)) return void 0;
|
|
2349
|
+
return {
|
|
2350
|
+
chainId: datasource.chain.id,
|
|
2351
|
+
address
|
|
2352
|
+
};
|
|
2353
|
+
};
|
|
2354
|
+
var getDatasourceContract = (namespaceId, datasourceName, contractName) => {
|
|
2355
|
+
const contract = maybeGetDatasourceContract(namespaceId, datasourceName, contractName);
|
|
2356
|
+
if (!contract) {
|
|
2357
|
+
throw new Error(
|
|
2358
|
+
`Expected contract not found for ${namespaceId} ${datasourceName} ${contractName}`
|
|
2359
|
+
);
|
|
2360
|
+
}
|
|
2361
|
+
return contract;
|
|
2362
|
+
};
|
|
2363
|
+
var makeContractMatcher = (namespace, b) => (datasourceName, contractName) => {
|
|
2364
|
+
const a = maybeGetDatasourceContract(namespace, datasourceName, contractName);
|
|
2365
|
+
return a && accountIdEqual(a, b);
|
|
2366
|
+
};
|
|
2367
|
+
|
|
2368
|
+
// src/tokenscope/assets.ts
|
|
2369
|
+
var import_enssdk3 = require("enssdk");
|
|
2370
|
+
var import_viem6 = require("viem");
|
|
2371
|
+
var import_v429 = require("zod/v4");
|
|
2372
|
+
|
|
2373
|
+
// src/tokenscope/zod-schemas.ts
|
|
2374
|
+
var import_caip2 = require("caip");
|
|
2375
|
+
var import_enssdk2 = require("enssdk");
|
|
2376
|
+
var import_viem5 = require("viem");
|
|
2377
|
+
var import_v428 = require("zod/v4");
|
|
2378
|
+
var tokenIdSchemaSerializable = import_v428.z.string();
|
|
2379
|
+
var tokenIdSchemaNative = import_v428.z.preprocess(
|
|
2380
|
+
(v) => typeof v === "string" ? BigInt(v) : v,
|
|
2381
|
+
import_v428.z.bigint().positive()
|
|
2382
|
+
);
|
|
2383
|
+
function makeTokenIdSchema(_valueLabel = "Token ID Schema", serializable = false) {
|
|
2384
|
+
if (serializable) {
|
|
2385
|
+
return tokenIdSchemaSerializable;
|
|
2386
|
+
} else {
|
|
2387
|
+
return tokenIdSchemaNative;
|
|
2388
|
+
}
|
|
2389
|
+
}
|
|
2390
|
+
var makeAssetIdSchema = (valueLabel = "Asset ID Schema", serializable) => {
|
|
2391
|
+
return import_v428.z.object({
|
|
2392
|
+
assetNamespace: import_v428.z.enum(import_enssdk2.AssetNamespaces),
|
|
2393
|
+
contract: makeAccountIdSchema(valueLabel),
|
|
2394
|
+
tokenId: makeTokenIdSchema(valueLabel, serializable ?? false)
|
|
2395
|
+
});
|
|
2396
|
+
};
|
|
2397
|
+
var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") => import_v428.z.preprocess((v) => {
|
|
2398
|
+
if (typeof v === "string") {
|
|
2399
|
+
const result = new import_caip2.AssetId(v);
|
|
2400
|
+
return {
|
|
2401
|
+
assetNamespace: result.assetName.namespace,
|
|
2402
|
+
contract: {
|
|
2403
|
+
chainId: Number(result.chainId.reference),
|
|
2404
|
+
address: result.assetName.reference
|
|
2405
|
+
},
|
|
2406
|
+
tokenId: result.tokenId
|
|
2407
|
+
};
|
|
2408
|
+
}
|
|
2409
|
+
return v;
|
|
2410
|
+
}, makeAssetIdSchema(valueLabel));
|
|
2411
|
+
function invariant_nameTokenOwnershipHasNonZeroAddressOwner(ctx) {
|
|
2412
|
+
const ownership = ctx.value;
|
|
2413
|
+
if (ctx.value.owner.address === import_viem5.zeroAddress) {
|
|
2414
|
+
ctx.issues.push({
|
|
2415
|
+
code: "custom",
|
|
2416
|
+
input: ctx.value,
|
|
2417
|
+
message: `Name Token Ownership with '${ownership.ownershipType}' must have 'address' other than the zero address.`
|
|
2418
|
+
});
|
|
2419
|
+
}
|
|
2420
|
+
}
|
|
2421
|
+
var makeNameTokenOwnershipNameWrapperSchema = (valueLabel = "Name Token Ownership NameWrapper") => import_v428.z.object({
|
|
2422
|
+
ownershipType: import_v428.z.literal(NameTokenOwnershipTypes.NameWrapper),
|
|
2423
|
+
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2424
|
+
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2425
|
+
var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") => import_v428.z.object({
|
|
2426
|
+
ownershipType: import_v428.z.literal(NameTokenOwnershipTypes.FullyOnchain),
|
|
2427
|
+
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2428
|
+
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2429
|
+
var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") => import_v428.z.object({
|
|
2430
|
+
ownershipType: import_v428.z.literal(NameTokenOwnershipTypes.Burned),
|
|
2431
|
+
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2432
|
+
}).check(invariant_nameTokenOwnershipHasZeroAddressOwner);
|
|
2433
|
+
var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") => import_v428.z.object({
|
|
2434
|
+
ownershipType: import_v428.z.literal(NameTokenOwnershipTypes.Unknown),
|
|
2435
|
+
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2436
|
+
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2437
|
+
function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
|
|
2438
|
+
const ownership = ctx.value;
|
|
2439
|
+
if (ctx.value.owner.address !== import_viem5.zeroAddress) {
|
|
2440
|
+
ctx.issues.push({
|
|
2441
|
+
code: "custom",
|
|
2442
|
+
input: ctx.value,
|
|
2443
|
+
message: `Name Token Ownership with '${ownership.ownershipType}' must have 'address' set to the zero address.`
|
|
2444
|
+
});
|
|
2445
|
+
}
|
|
2446
|
+
}
|
|
2447
|
+
var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") => import_v428.z.discriminatedUnion("ownershipType", [
|
|
2448
|
+
makeNameTokenOwnershipNameWrapperSchema(valueLabel),
|
|
2449
|
+
makeNameTokenOwnershipFullyOnchainSchema(valueLabel),
|
|
2450
|
+
makeNameTokenOwnershipBurnedSchema(valueLabel),
|
|
2451
|
+
makeNameTokenOwnershipUnknownSchema(valueLabel)
|
|
2452
|
+
]);
|
|
2453
|
+
var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) => import_v428.z.object({
|
|
2454
|
+
token: makeAssetIdSchema(`${valueLabel}.token`, serializable),
|
|
2455
|
+
ownership: makeNameTokenOwnershipSchema(`${valueLabel}.ownership`),
|
|
2456
|
+
mintStatus: import_v428.z.enum(NFTMintStatuses)
|
|
2457
|
+
});
|
|
2458
|
+
|
|
2459
|
+
// src/tokenscope/assets.ts
|
|
2460
|
+
function serializeAssetId(assetId) {
|
|
2461
|
+
return {
|
|
2462
|
+
assetNamespace: assetId.assetNamespace,
|
|
2463
|
+
contract: assetId.contract,
|
|
2464
|
+
tokenId: assetId.tokenId.toString()
|
|
2465
|
+
};
|
|
2466
|
+
}
|
|
2467
|
+
function deserializeAssetId(maybeAssetId, valueLabel) {
|
|
2468
|
+
const schema = makeAssetIdSchema(valueLabel);
|
|
2469
|
+
const parsed = schema.safeParse(maybeAssetId);
|
|
2470
|
+
if (parsed.error) {
|
|
2471
|
+
throw new RangeError(`Cannot deserialize AssetId:
|
|
2472
|
+
${(0, import_v429.prettifyError)(parsed.error)}
|
|
2473
|
+
`);
|
|
2474
|
+
}
|
|
2475
|
+
return parsed.data;
|
|
2476
|
+
}
|
|
2477
|
+
function parseAssetId(maybeAssetId, valueLabel) {
|
|
2478
|
+
const schema = makeAssetIdStringSchema(valueLabel);
|
|
2479
|
+
const parsed = schema.safeParse(maybeAssetId);
|
|
2480
|
+
if (parsed.error) {
|
|
2481
|
+
throw new RangeError(`Cannot parse AssetId:
|
|
2482
|
+
${(0, import_v429.prettifyError)(parsed.error)}
|
|
2483
|
+
`);
|
|
2484
|
+
}
|
|
2485
|
+
return parsed.data;
|
|
2486
|
+
}
|
|
2487
|
+
var buildAssetId = (contract, tokenId, assetNamespace) => {
|
|
2488
|
+
return {
|
|
2489
|
+
assetNamespace,
|
|
2490
|
+
contract,
|
|
2491
|
+
tokenId
|
|
2492
|
+
};
|
|
2493
|
+
};
|
|
2494
|
+
function serializeDomainAssetId(domainAsset) {
|
|
2495
|
+
return {
|
|
2496
|
+
...serializeAssetId(domainAsset),
|
|
2497
|
+
domainId: domainAsset.domainId
|
|
2498
|
+
};
|
|
2499
|
+
}
|
|
2500
|
+
var NFTMintStatuses = {
|
|
2501
|
+
Minted: "minted",
|
|
2502
|
+
Burned: "burned"
|
|
2503
|
+
};
|
|
2504
|
+
var formatNFTTransferEventMetadata = (metadata) => {
|
|
2505
|
+
const assetIdString = (0, import_enssdk3.stringifyAssetId)(metadata.nft);
|
|
2506
|
+
return [
|
|
2507
|
+
`Event: ${metadata.eventHandlerName}`,
|
|
2508
|
+
`Chain ID: ${metadata.chainId}`,
|
|
2509
|
+
`Block Number: ${metadata.blockNumber}`,
|
|
2510
|
+
`Transaction Hash: ${metadata.transactionHash}`,
|
|
2511
|
+
`NFT: ${assetIdString}`
|
|
2512
|
+
].map((line) => ` - ${line}`).join("\n");
|
|
2513
|
+
};
|
|
2514
|
+
var NFTTransferTypes = {
|
|
2515
|
+
/**
|
|
2516
|
+
* Initial transfer from zeroAddress to a non-zeroAddress
|
|
2517
|
+
* Can happen at most once to a NFT AssetId
|
|
2518
|
+
*
|
|
2519
|
+
* Invariants:
|
|
2520
|
+
* - NFT is not indexed and therefore has no previous mint status or owner
|
|
2521
|
+
* - new NFT mint status is `minted`
|
|
2522
|
+
* - new NFT owner is a non-zeroAddress
|
|
2523
|
+
*/
|
|
2524
|
+
Mint: "mint",
|
|
2525
|
+
/**
|
|
2526
|
+
* Subsequent transfer from zeroAddress to a non-zeroAddress
|
|
2527
|
+
* Can happen any number of times to a NFT AssetId as it passes in a cycle from
|
|
2528
|
+
* mint -> burn -> remint -> burn -> remint -> ...
|
|
2529
|
+
*
|
|
2530
|
+
* Invariants:
|
|
2531
|
+
* - NFT is indexed
|
|
2532
|
+
* - previous NFT mint status was `burned`
|
|
2533
|
+
* - previous NFT owner is the zeroAddress
|
|
2534
|
+
* - new NFT mint status is `minted`
|
|
2535
|
+
* - new NFT owner is a non-zeroAddress
|
|
2536
|
+
*/
|
|
2537
|
+
Remint: "remint",
|
|
2538
|
+
/**
|
|
2539
|
+
* Special transfer type for improperly implemented NFT contracts that allow a NFT
|
|
2540
|
+
* that is currently minted to be reminted before an intermediate burn.
|
|
2541
|
+
*
|
|
2542
|
+
* Transfer from zeroAddress to non-zeroAddress for an indexed NFT where the
|
|
2543
|
+
* previously indexed nft had status `minted` with a non-zeroAddress owner.
|
|
2544
|
+
*
|
|
2545
|
+
* Invariants:
|
|
2546
|
+
* - NFT is indexed
|
|
2547
|
+
* - previous NFT mint status was `minted`
|
|
2548
|
+
* - previous NFT owner was a non-zeroAddress
|
|
2549
|
+
* - new NFT mint status is `minted`
|
|
2550
|
+
* - new NFT owner is a non-zeroAddress
|
|
2180
2551
|
*/
|
|
2181
2552
|
MintedRemint: "minted-remint",
|
|
2182
2553
|
/**
|
|
@@ -2243,11 +2614,11 @@ var NFTTransferTypes = {
|
|
|
2243
2614
|
};
|
|
2244
2615
|
var getNFTTransferType = (from, to, allowMintedRemint, metadata, currentlyIndexedOwner) => {
|
|
2245
2616
|
const isIndexed = currentlyIndexedOwner !== void 0;
|
|
2246
|
-
const isIndexedAsMinted = isIndexed && !(0,
|
|
2247
|
-
const isMint = (0,
|
|
2248
|
-
const isBurn = (0,
|
|
2249
|
-
const isSelfTransfer = (0,
|
|
2250
|
-
if (isIndexed && !(0,
|
|
2617
|
+
const isIndexedAsMinted = isIndexed && !(0, import_viem6.isAddressEqual)(currentlyIndexedOwner, import_viem6.zeroAddress);
|
|
2618
|
+
const isMint = (0, import_viem6.isAddressEqual)(from, import_viem6.zeroAddress);
|
|
2619
|
+
const isBurn = (0, import_viem6.isAddressEqual)(to, import_viem6.zeroAddress);
|
|
2620
|
+
const isSelfTransfer = (0, import_viem6.isAddressEqual)(from, to);
|
|
2621
|
+
if (isIndexed && !(0, import_viem6.isAddressEqual)(currentlyIndexedOwner, from)) {
|
|
2251
2622
|
if (isMint && allowMintedRemint) {
|
|
2252
2623
|
} else {
|
|
2253
2624
|
throw new Error(
|
|
@@ -2388,7 +2759,7 @@ function getNameTokenOwnership(namespaceId, name, owner) {
|
|
|
2388
2759
|
owner
|
|
2389
2760
|
};
|
|
2390
2761
|
}
|
|
2391
|
-
if ((0,
|
|
2762
|
+
if ((0, import_viem7.isAddressEqual)(owner.address, import_viem7.zeroAddress)) {
|
|
2392
2763
|
return {
|
|
2393
2764
|
ownershipType: NameTokenOwnershipTypes.Burned,
|
|
2394
2765
|
owner
|
|
@@ -2408,14 +2779,14 @@ function getNameTokenOwnership(namespaceId, name, owner) {
|
|
|
2408
2779
|
};
|
|
2409
2780
|
}
|
|
2410
2781
|
|
|
2411
|
-
// src/
|
|
2412
|
-
var
|
|
2413
|
-
var
|
|
2414
|
-
message:
|
|
2415
|
-
details:
|
|
2782
|
+
// src/ensnode/api/shared/errors/zod-schemas.ts
|
|
2783
|
+
var import_v430 = require("zod/v4");
|
|
2784
|
+
var ErrorResponseSchema2 = import_v430.z.object({
|
|
2785
|
+
message: import_v430.z.string(),
|
|
2786
|
+
details: import_v430.z.optional(import_v430.z.unknown())
|
|
2416
2787
|
});
|
|
2417
2788
|
|
|
2418
|
-
// src/
|
|
2789
|
+
// src/ensnode/api/name-tokens/response.ts
|
|
2419
2790
|
var NameTokensResponseCodes = {
|
|
2420
2791
|
/**
|
|
2421
2792
|
* Represents a response when Name Tokens API can respond with requested data.
|
|
@@ -2450,11 +2821,11 @@ var NameTokensResponseErrorCodes = {
|
|
|
2450
2821
|
IndexingStatusUnsupported: "unsupported-indexing-status"
|
|
2451
2822
|
};
|
|
2452
2823
|
|
|
2453
|
-
// src/
|
|
2454
|
-
var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) =>
|
|
2824
|
+
// src/ensnode/api/name-tokens/zod-schemas.ts
|
|
2825
|
+
var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) => import_v431.z.object({
|
|
2455
2826
|
domainId: makeNodeSchema(`${valueLabel}.domainId`),
|
|
2456
2827
|
name: makeReinterpretedNameSchema(valueLabel),
|
|
2457
|
-
tokens:
|
|
2828
|
+
tokens: import_v431.z.array(makeNameTokenSchema(`${valueLabel}.tokens`, serializable)).nonempty(),
|
|
2458
2829
|
expiresAt: makeUnixTimestampSchema(`${valueLabel}.expiresAt`),
|
|
2459
2830
|
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
|
|
2460
2831
|
}).check(function invariant_nameIsAssociatedWithDomainId(ctx) {
|
|
@@ -2496,51 +2867,51 @@ var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", seria
|
|
|
2496
2867
|
});
|
|
2497
2868
|
}
|
|
2498
2869
|
});
|
|
2499
|
-
var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) =>
|
|
2500
|
-
responseCode:
|
|
2870
|
+
var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) => import_v431.z.strictObject({
|
|
2871
|
+
responseCode: import_v431.z.literal(NameTokensResponseCodes.Ok),
|
|
2501
2872
|
registeredNameTokens: makeRegisteredNameTokenSchema(`${valueLabel}.nameTokens`, serializable)
|
|
2502
2873
|
});
|
|
2503
|
-
var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") =>
|
|
2504
|
-
responseCode:
|
|
2505
|
-
errorCode:
|
|
2506
|
-
error:
|
|
2874
|
+
var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") => import_v431.z.strictObject({
|
|
2875
|
+
responseCode: import_v431.z.literal(NameTokensResponseCodes.Error),
|
|
2876
|
+
errorCode: import_v431.z.literal(NameTokensResponseErrorCodes.NameTokensNotIndexed),
|
|
2877
|
+
error: ErrorResponseSchema2
|
|
2507
2878
|
});
|
|
2508
|
-
var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") =>
|
|
2509
|
-
responseCode:
|
|
2510
|
-
errorCode:
|
|
2511
|
-
error:
|
|
2879
|
+
var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") => import_v431.z.strictObject({
|
|
2880
|
+
responseCode: import_v431.z.literal(NameTokensResponseCodes.Error),
|
|
2881
|
+
errorCode: import_v431.z.literal(NameTokensResponseErrorCodes.EnsIndexerConfigUnsupported),
|
|
2882
|
+
error: ErrorResponseSchema2
|
|
2512
2883
|
});
|
|
2513
|
-
var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") =>
|
|
2514
|
-
responseCode:
|
|
2515
|
-
errorCode:
|
|
2516
|
-
error:
|
|
2884
|
+
var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") => import_v431.z.strictObject({
|
|
2885
|
+
responseCode: import_v431.z.literal(NameTokensResponseCodes.Error),
|
|
2886
|
+
errorCode: import_v431.z.literal(NameTokensResponseErrorCodes.IndexingStatusUnsupported),
|
|
2887
|
+
error: ErrorResponseSchema2
|
|
2517
2888
|
});
|
|
2518
|
-
var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") =>
|
|
2889
|
+
var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") => import_v431.z.discriminatedUnion("errorCode", [
|
|
2519
2890
|
makeNameTokensResponseErrorNameTokensNotIndexedSchema(valueLabel),
|
|
2520
2891
|
makeNameTokensResponseErrorEnsIndexerConfigUnsupported(valueLabel),
|
|
2521
2892
|
makeNameTokensResponseErrorNameIndexingStatusUnsupported(valueLabel)
|
|
2522
2893
|
]);
|
|
2523
2894
|
var makeNameTokensResponseSchema = (valueLabel = "Name Tokens Response", serializable) => {
|
|
2524
|
-
return
|
|
2895
|
+
return import_v431.z.discriminatedUnion("responseCode", [
|
|
2525
2896
|
makeNameTokensResponseOkSchema(valueLabel, serializable ?? false),
|
|
2526
2897
|
makeNameTokensResponseErrorSchema(valueLabel)
|
|
2527
2898
|
]);
|
|
2528
2899
|
};
|
|
2529
2900
|
|
|
2530
|
-
// src/
|
|
2901
|
+
// src/ensnode/api/name-tokens/deserialize.ts
|
|
2531
2902
|
function deserializedNameTokensResponse(maybeResponse) {
|
|
2532
2903
|
const parsed = makeNameTokensResponseSchema("Name Tokens Response", false).safeParse(
|
|
2533
2904
|
maybeResponse
|
|
2534
2905
|
);
|
|
2535
2906
|
if (parsed.error) {
|
|
2536
2907
|
throw new Error(`Cannot deserialize NameTokensResponse:
|
|
2537
|
-
${(0,
|
|
2908
|
+
${(0, import_v432.prettifyError)(parsed.error)}
|
|
2538
2909
|
`);
|
|
2539
2910
|
}
|
|
2540
2911
|
return parsed.data;
|
|
2541
2912
|
}
|
|
2542
2913
|
|
|
2543
|
-
// src/
|
|
2914
|
+
// src/ensnode/api/name-tokens/prerequisites.ts
|
|
2544
2915
|
var nameTokensPrerequisites = Object.freeze({
|
|
2545
2916
|
/**
|
|
2546
2917
|
* Required plugins to enable Name Tokens API routes.
|
|
@@ -2579,7 +2950,7 @@ var nameTokensPrerequisites = Object.freeze({
|
|
|
2579
2950
|
}
|
|
2580
2951
|
});
|
|
2581
2952
|
|
|
2582
|
-
// src/
|
|
2953
|
+
// src/ensnode/api/name-tokens/serialize.ts
|
|
2583
2954
|
function serializeRegisteredNameTokens({
|
|
2584
2955
|
domainId,
|
|
2585
2956
|
name,
|
|
@@ -2607,42 +2978,42 @@ function serializeNameTokensResponse(response) {
|
|
|
2607
2978
|
}
|
|
2608
2979
|
}
|
|
2609
2980
|
|
|
2610
|
-
// src/
|
|
2611
|
-
var
|
|
2981
|
+
// src/ensnode/api/registrar-actions/deserialize.ts
|
|
2982
|
+
var import_v436 = require("zod/v4");
|
|
2612
2983
|
|
|
2613
|
-
// src/
|
|
2984
|
+
// src/ensnode/api/registrar-actions/zod-schemas.ts
|
|
2614
2985
|
var import_enssdk7 = require("enssdk");
|
|
2615
|
-
var
|
|
2986
|
+
var import_v435 = require("zod/v4");
|
|
2616
2987
|
|
|
2617
2988
|
// src/registrars/zod-schemas.ts
|
|
2618
|
-
var
|
|
2989
|
+
var import_v433 = require("zod/v4");
|
|
2619
2990
|
|
|
2620
2991
|
// src/registrars/encoded-referrer.ts
|
|
2621
2992
|
var import_enssdk6 = require("enssdk");
|
|
2622
|
-
var
|
|
2993
|
+
var import_viem8 = require("viem");
|
|
2623
2994
|
var ENCODED_REFERRER_BYTE_OFFSET = 12;
|
|
2624
2995
|
var ENCODED_REFERRER_BYTE_LENGTH = 32;
|
|
2625
|
-
var EXPECTED_ENCODED_REFERRER_PADDING = (0,
|
|
2996
|
+
var EXPECTED_ENCODED_REFERRER_PADDING = (0, import_viem8.pad)("0x", {
|
|
2626
2997
|
size: ENCODED_REFERRER_BYTE_OFFSET,
|
|
2627
2998
|
dir: "left"
|
|
2628
2999
|
});
|
|
2629
|
-
var ZERO_ENCODED_REFERRER = (0,
|
|
3000
|
+
var ZERO_ENCODED_REFERRER = (0, import_viem8.pad)("0x", {
|
|
2630
3001
|
size: ENCODED_REFERRER_BYTE_LENGTH,
|
|
2631
3002
|
dir: "left"
|
|
2632
3003
|
});
|
|
2633
3004
|
function buildEncodedReferrer(address) {
|
|
2634
3005
|
if (!(0, import_enssdk6.isNormalizedAddress)(address)) throw new Error(`Address '${address}' is not normalized.`);
|
|
2635
|
-
return (0,
|
|
3006
|
+
return (0, import_viem8.pad)(address, { size: ENCODED_REFERRER_BYTE_LENGTH, dir: "left" });
|
|
2636
3007
|
}
|
|
2637
3008
|
function decodeEncodedReferrer(encodedReferrer) {
|
|
2638
|
-
if ((0,
|
|
3009
|
+
if ((0, import_viem8.size)(encodedReferrer) !== ENCODED_REFERRER_BYTE_LENGTH) {
|
|
2639
3010
|
throw new Error(
|
|
2640
3011
|
`Encoded referrer value must be represented by ${ENCODED_REFERRER_BYTE_LENGTH} bytes.`
|
|
2641
3012
|
);
|
|
2642
3013
|
}
|
|
2643
|
-
const padding = (0,
|
|
2644
|
-
if (padding !== EXPECTED_ENCODED_REFERRER_PADDING) return
|
|
2645
|
-
const decodedReferrer = (0,
|
|
3014
|
+
const padding = (0, import_viem8.slice)(encodedReferrer, 0, ENCODED_REFERRER_BYTE_OFFSET);
|
|
3015
|
+
if (padding !== EXPECTED_ENCODED_REFERRER_PADDING) return import_viem8.zeroAddress;
|
|
3016
|
+
const decodedReferrer = (0, import_viem8.slice)(encodedReferrer, ENCODED_REFERRER_BYTE_OFFSET);
|
|
2646
3017
|
try {
|
|
2647
3018
|
return (0, import_enssdk6.toNormalizedAddress)(decodedReferrer);
|
|
2648
3019
|
} catch {
|
|
@@ -2689,11 +3060,11 @@ function serializeRegistrarAction(registrarAction) {
|
|
|
2689
3060
|
}
|
|
2690
3061
|
|
|
2691
3062
|
// src/registrars/zod-schemas.ts
|
|
2692
|
-
var makeSubregistrySchema = (valueLabel = "Subregistry") =>
|
|
3063
|
+
var makeSubregistrySchema = (valueLabel = "Subregistry") => import_v433.z.object({
|
|
2693
3064
|
subregistryId: makeAccountIdSchema(`${valueLabel} Subregistry ID`),
|
|
2694
3065
|
node: makeNodeSchema(`${valueLabel} Node`)
|
|
2695
3066
|
});
|
|
2696
|
-
var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") =>
|
|
3067
|
+
var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") => import_v433.z.object({
|
|
2697
3068
|
subregistry: makeSubregistrySchema(`${valueLabel} Subregistry`),
|
|
2698
3069
|
node: makeNodeSchema(`${valueLabel} Node`),
|
|
2699
3070
|
expiresAt: makeUnixTimestampSchema(`${valueLabel} Expires at`)
|
|
@@ -2709,18 +3080,18 @@ function invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium(ctx) {
|
|
|
2709
3080
|
});
|
|
2710
3081
|
}
|
|
2711
3082
|
}
|
|
2712
|
-
var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") =>
|
|
3083
|
+
var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") => import_v433.z.union([
|
|
2713
3084
|
// pricing available
|
|
2714
|
-
|
|
3085
|
+
import_v433.z.object({
|
|
2715
3086
|
baseCost: makePriceEthSchema(`${valueLabel} Base Cost`),
|
|
2716
3087
|
premium: makePriceEthSchema(`${valueLabel} Premium`),
|
|
2717
3088
|
total: makePriceEthSchema(`${valueLabel} Total`)
|
|
2718
3089
|
}).check(invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium).transform((v) => v),
|
|
2719
3090
|
// pricing unknown
|
|
2720
|
-
|
|
2721
|
-
baseCost:
|
|
2722
|
-
premium:
|
|
2723
|
-
total:
|
|
3091
|
+
import_v433.z.object({
|
|
3092
|
+
baseCost: import_v433.z.null(),
|
|
3093
|
+
premium: import_v433.z.null(),
|
|
3094
|
+
total: import_v433.z.null()
|
|
2724
3095
|
}).transform((v) => v)
|
|
2725
3096
|
]);
|
|
2726
3097
|
function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
|
|
@@ -2743,9 +3114,9 @@ function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
|
|
|
2743
3114
|
});
|
|
2744
3115
|
}
|
|
2745
3116
|
}
|
|
2746
|
-
var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") =>
|
|
3117
|
+
var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") => import_v433.z.union([
|
|
2747
3118
|
// referral available
|
|
2748
|
-
|
|
3119
|
+
import_v433.z.object({
|
|
2749
3120
|
encodedReferrer: makeHexStringSchema(
|
|
2750
3121
|
{ bytesCount: ENCODED_REFERRER_BYTE_LENGTH },
|
|
2751
3122
|
`${valueLabel} Encoded Referrer`
|
|
@@ -2753,9 +3124,9 @@ var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral
|
|
|
2753
3124
|
decodedReferrer: makeNormalizedAddressSchema(`${valueLabel} Decoded Referrer`)
|
|
2754
3125
|
}).check(invariant_registrarActionDecodedReferrerBasedOnRawReferrer),
|
|
2755
3126
|
// referral not applicable
|
|
2756
|
-
|
|
2757
|
-
encodedReferrer:
|
|
2758
|
-
decodedReferrer:
|
|
3127
|
+
import_v433.z.object({
|
|
3128
|
+
encodedReferrer: import_v433.z.null(),
|
|
3129
|
+
decodedReferrer: import_v433.z.null()
|
|
2759
3130
|
})
|
|
2760
3131
|
]);
|
|
2761
3132
|
function invariant_eventIdsInitialElementIsTheActionId(ctx) {
|
|
@@ -2768,9 +3139,9 @@ function invariant_eventIdsInitialElementIsTheActionId(ctx) {
|
|
|
2768
3139
|
});
|
|
2769
3140
|
}
|
|
2770
3141
|
}
|
|
2771
|
-
var EventIdSchema =
|
|
2772
|
-
var EventIdsSchema =
|
|
2773
|
-
var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") =>
|
|
3142
|
+
var EventIdSchema = import_v433.z.string().nonempty();
|
|
3143
|
+
var EventIdsSchema = import_v433.z.array(EventIdSchema).min(1).transform((v) => v);
|
|
3144
|
+
var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => import_v433.z.object({
|
|
2774
3145
|
id: EventIdSchema,
|
|
2775
3146
|
incrementalDuration: makeDurationSchema(`${valueLabel} Incremental Duration`),
|
|
2776
3147
|
registrant: makeNormalizedAddressSchema(`${valueLabel} Registrant`),
|
|
@@ -2784,38 +3155,38 @@ var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => im
|
|
|
2784
3155
|
eventIds: EventIdsSchema
|
|
2785
3156
|
}).check(invariant_eventIdsInitialElementIsTheActionId);
|
|
2786
3157
|
var makeRegistrarActionRegistrationSchema = (valueLabel = "Registration ") => makeBaseRegistrarActionSchema(valueLabel).extend({
|
|
2787
|
-
type:
|
|
3158
|
+
type: import_v433.z.literal(RegistrarActionTypes.Registration)
|
|
2788
3159
|
});
|
|
2789
3160
|
var makeRegistrarActionRenewalSchema = (valueLabel = "Renewal") => makeBaseRegistrarActionSchema(valueLabel).extend({
|
|
2790
|
-
type:
|
|
3161
|
+
type: import_v433.z.literal(RegistrarActionTypes.Renewal)
|
|
2791
3162
|
});
|
|
2792
|
-
var makeRegistrarActionSchema = (valueLabel = "Registrar Action") =>
|
|
3163
|
+
var makeRegistrarActionSchema = (valueLabel = "Registrar Action") => import_v433.z.discriminatedUnion("type", [
|
|
2793
3164
|
makeRegistrarActionRegistrationSchema(`${valueLabel} Registration`),
|
|
2794
3165
|
makeRegistrarActionRenewalSchema(`${valueLabel} Renewal`)
|
|
2795
3166
|
]);
|
|
2796
3167
|
|
|
2797
|
-
// src/
|
|
2798
|
-
var
|
|
3168
|
+
// src/ensnode/api/shared/pagination/zod-schemas.ts
|
|
3169
|
+
var import_v434 = require("zod/v4");
|
|
2799
3170
|
|
|
2800
|
-
// src/
|
|
3171
|
+
// src/ensnode/api/shared/pagination/request.ts
|
|
2801
3172
|
var RECORDS_PER_PAGE_DEFAULT = 10;
|
|
2802
3173
|
var RECORDS_PER_PAGE_MAX = 100;
|
|
2803
3174
|
|
|
2804
|
-
// src/
|
|
2805
|
-
var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") =>
|
|
3175
|
+
// src/ensnode/api/shared/pagination/zod-schemas.ts
|
|
3176
|
+
var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") => import_v434.z.object({
|
|
2806
3177
|
page: makePositiveIntegerSchema(`${valueLabel}.page`),
|
|
2807
3178
|
recordsPerPage: makePositiveIntegerSchema(`${valueLabel}.recordsPerPage`).max(
|
|
2808
3179
|
RECORDS_PER_PAGE_MAX,
|
|
2809
3180
|
`${valueLabel}.recordsPerPage must not exceed ${RECORDS_PER_PAGE_MAX}`
|
|
2810
3181
|
)
|
|
2811
3182
|
});
|
|
2812
|
-
var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") =>
|
|
2813
|
-
totalRecords:
|
|
2814
|
-
totalPages:
|
|
2815
|
-
hasNext:
|
|
2816
|
-
hasPrev:
|
|
2817
|
-
startIndex:
|
|
2818
|
-
endIndex:
|
|
3183
|
+
var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") => import_v434.z.object({
|
|
3184
|
+
totalRecords: import_v434.z.literal(0),
|
|
3185
|
+
totalPages: import_v434.z.literal(1),
|
|
3186
|
+
hasNext: import_v434.z.literal(false),
|
|
3187
|
+
hasPrev: import_v434.z.literal(false),
|
|
3188
|
+
startIndex: import_v434.z.undefined(),
|
|
3189
|
+
endIndex: import_v434.z.undefined()
|
|
2819
3190
|
}).extend(makeRequestPageParamsSchema(valueLabel).shape);
|
|
2820
3191
|
function invariant_responsePageWithRecordsIsCorrect(ctx) {
|
|
2821
3192
|
const { hasNext, hasPrev, recordsPerPage, page, totalRecords, startIndex, endIndex } = ctx.value;
|
|
@@ -2850,20 +3221,20 @@ function invariant_responsePageWithRecordsIsCorrect(ctx) {
|
|
|
2850
3221
|
});
|
|
2851
3222
|
}
|
|
2852
3223
|
}
|
|
2853
|
-
var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") =>
|
|
3224
|
+
var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") => import_v434.z.object({
|
|
2854
3225
|
totalRecords: makePositiveIntegerSchema(`${valueLabel}.totalRecords`),
|
|
2855
3226
|
totalPages: makePositiveIntegerSchema(`${valueLabel}.totalPages`),
|
|
2856
|
-
hasNext:
|
|
2857
|
-
hasPrev:
|
|
3227
|
+
hasNext: import_v434.z.boolean(),
|
|
3228
|
+
hasPrev: import_v434.z.boolean(),
|
|
2858
3229
|
startIndex: makeNonNegativeIntegerSchema(`${valueLabel}.startIndex`),
|
|
2859
3230
|
endIndex: makeNonNegativeIntegerSchema(`${valueLabel}.endIndex`)
|
|
2860
3231
|
}).extend(makeRequestPageParamsSchema(valueLabel).shape).check(invariant_responsePageWithRecordsIsCorrect);
|
|
2861
|
-
var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") =>
|
|
3232
|
+
var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") => import_v434.z.union([
|
|
2862
3233
|
makeResponsePageContextSchemaWithNoRecords(valueLabel),
|
|
2863
3234
|
makeResponsePageContextSchemaWithRecords(valueLabel)
|
|
2864
3235
|
]);
|
|
2865
3236
|
|
|
2866
|
-
// src/
|
|
3237
|
+
// src/ensnode/api/registrar-actions/response.ts
|
|
2867
3238
|
var RegistrarActionsResponseCodes = {
|
|
2868
3239
|
/**
|
|
2869
3240
|
* Represents that Registrar Actions are available.
|
|
@@ -2875,7 +3246,7 @@ var RegistrarActionsResponseCodes = {
|
|
|
2875
3246
|
Error: "error"
|
|
2876
3247
|
};
|
|
2877
3248
|
|
|
2878
|
-
// src/
|
|
3249
|
+
// src/ensnode/api/registrar-actions/zod-schemas.ts
|
|
2879
3250
|
function invariant_registrationLifecycleNodeMatchesName(ctx) {
|
|
2880
3251
|
const { name, action } = ctx.value;
|
|
2881
3252
|
const expectedNode = action.registrationLifecycle.node;
|
|
@@ -2888,39 +3259,39 @@ function invariant_registrationLifecycleNodeMatchesName(ctx) {
|
|
|
2888
3259
|
});
|
|
2889
3260
|
}
|
|
2890
3261
|
}
|
|
2891
|
-
var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") =>
|
|
3262
|
+
var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") => import_v435.z.object({
|
|
2892
3263
|
action: makeRegistrarActionSchema(valueLabel),
|
|
2893
3264
|
name: makeReinterpretedNameSchema(valueLabel)
|
|
2894
3265
|
}).check(invariant_registrationLifecycleNodeMatchesName);
|
|
2895
|
-
var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") =>
|
|
2896
|
-
responseCode:
|
|
2897
|
-
registrarActions:
|
|
3266
|
+
var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") => import_v435.z.object({
|
|
3267
|
+
responseCode: import_v435.z.literal(RegistrarActionsResponseCodes.Ok),
|
|
3268
|
+
registrarActions: import_v435.z.array(makeNamedRegistrarActionSchema(valueLabel)),
|
|
2898
3269
|
pageContext: makeResponsePageContextSchema(`${valueLabel}.pageContext`),
|
|
2899
3270
|
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
|
|
2900
3271
|
});
|
|
2901
|
-
var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") =>
|
|
2902
|
-
responseCode:
|
|
2903
|
-
error:
|
|
3272
|
+
var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") => import_v435.z.strictObject({
|
|
3273
|
+
responseCode: import_v435.z.literal(RegistrarActionsResponseCodes.Error),
|
|
3274
|
+
error: ErrorResponseSchema2
|
|
2904
3275
|
});
|
|
2905
|
-
var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") =>
|
|
3276
|
+
var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") => import_v435.z.discriminatedUnion("responseCode", [
|
|
2906
3277
|
makeRegistrarActionsResponseOkSchema(valueLabel),
|
|
2907
3278
|
makeRegistrarActionsResponseErrorSchema(valueLabel)
|
|
2908
3279
|
]);
|
|
2909
3280
|
|
|
2910
|
-
// src/
|
|
3281
|
+
// src/ensnode/api/registrar-actions/deserialize.ts
|
|
2911
3282
|
function deserializeRegistrarActionsResponse(maybeResponse) {
|
|
2912
3283
|
const parsed = makeRegistrarActionsResponseSchema().safeParse(maybeResponse);
|
|
2913
3284
|
if (parsed.error) {
|
|
2914
3285
|
throw new Error(
|
|
2915
3286
|
`Cannot deserialize RegistrarActionsResponse:
|
|
2916
|
-
${(0,
|
|
3287
|
+
${(0, import_v436.prettifyError)(parsed.error)}
|
|
2917
3288
|
`
|
|
2918
3289
|
);
|
|
2919
3290
|
}
|
|
2920
3291
|
return parsed.data;
|
|
2921
3292
|
}
|
|
2922
3293
|
|
|
2923
|
-
// src/
|
|
3294
|
+
// src/ensnode/api/registrar-actions/request.ts
|
|
2924
3295
|
var RegistrarActionsFilterTypes = {
|
|
2925
3296
|
BySubregistryNode: "bySubregistryNode",
|
|
2926
3297
|
WithEncodedReferral: "withEncodedReferral",
|
|
@@ -2940,7 +3311,7 @@ var RegistrarActionsOrders = {
|
|
|
2940
3311
|
LatestRegistrarActions: "orderBy[timestamp]=desc"
|
|
2941
3312
|
};
|
|
2942
3313
|
|
|
2943
|
-
// src/
|
|
3314
|
+
// src/ensnode/api/registrar-actions/filters.ts
|
|
2944
3315
|
function byParentNode(parentNode) {
|
|
2945
3316
|
if (typeof parentNode === "undefined") {
|
|
2946
3317
|
return void 0;
|
|
@@ -2993,7 +3364,7 @@ var registrarActionsFilter = {
|
|
|
2993
3364
|
endTimestamp
|
|
2994
3365
|
};
|
|
2995
3366
|
|
|
2996
|
-
// src/
|
|
3367
|
+
// src/ensnode/api/registrar-actions/prerequisites.ts
|
|
2997
3368
|
var registrarActionsRequiredPlugins = [
|
|
2998
3369
|
"subgraph" /* Subgraph */,
|
|
2999
3370
|
"basenames" /* Basenames */,
|
|
@@ -3025,7 +3396,7 @@ function hasRegistrarActionsIndexingStatusSupport(omnichainIndexingStatusId) {
|
|
|
3025
3396
|
};
|
|
3026
3397
|
}
|
|
3027
3398
|
|
|
3028
|
-
// src/
|
|
3399
|
+
// src/ensnode/api/registrar-actions/serialize.ts
|
|
3029
3400
|
function serializeNamedRegistrarAction({
|
|
3030
3401
|
action,
|
|
3031
3402
|
name
|
|
@@ -3049,19 +3420,19 @@ function serializeRegistrarActionsResponse(response) {
|
|
|
3049
3420
|
}
|
|
3050
3421
|
}
|
|
3051
3422
|
|
|
3052
|
-
// src/
|
|
3053
|
-
var
|
|
3054
|
-
function
|
|
3055
|
-
const parsed =
|
|
3423
|
+
// src/ensnode/api/shared/errors/deserialize.ts
|
|
3424
|
+
var import_v437 = require("zod/v4");
|
|
3425
|
+
function deserializeErrorResponse2(maybeErrorResponse) {
|
|
3426
|
+
const parsed = ErrorResponseSchema2.safeParse(maybeErrorResponse);
|
|
3056
3427
|
if (parsed.error) {
|
|
3057
3428
|
throw new Error(`Cannot deserialize ErrorResponse:
|
|
3058
|
-
${(0,
|
|
3429
|
+
${(0, import_v437.prettifyError)(parsed.error)}
|
|
3059
3430
|
`);
|
|
3060
3431
|
}
|
|
3061
3432
|
return parsed.data;
|
|
3062
3433
|
}
|
|
3063
3434
|
|
|
3064
|
-
// src/
|
|
3435
|
+
// src/ensnode/api/shared/pagination/build-page-context.ts
|
|
3065
3436
|
function buildPageContext(page, recordsPerPage, totalRecords) {
|
|
3066
3437
|
const totalPages = Math.max(1, Math.ceil(totalRecords / recordsPerPage));
|
|
3067
3438
|
if (page > totalPages) {
|
|
@@ -3096,7 +3467,7 @@ function buildPageContext(page, recordsPerPage, totalRecords) {
|
|
|
3096
3467
|
};
|
|
3097
3468
|
}
|
|
3098
3469
|
|
|
3099
|
-
// src/
|
|
3470
|
+
// src/ensnode/client-error.ts
|
|
3100
3471
|
var ClientError = class _ClientError extends Error {
|
|
3101
3472
|
details;
|
|
3102
3473
|
constructor(message, details) {
|
|
@@ -3109,17 +3480,17 @@ var ClientError = class _ClientError extends Error {
|
|
|
3109
3480
|
}
|
|
3110
3481
|
};
|
|
3111
3482
|
|
|
3112
|
-
// src/
|
|
3483
|
+
// src/ensnode/deployments.ts
|
|
3113
3484
|
var import_datasources5 = require("@ensnode/datasources");
|
|
3114
|
-
var
|
|
3115
|
-
var
|
|
3485
|
+
var DEFAULT_ENSNODE_URL_MAINNET = "https://api.alpha.ensnode.io";
|
|
3486
|
+
var DEFAULT_ENSNODE_URL_SEPOLIA = "https://api.alpha-sepolia.ensnode.io";
|
|
3116
3487
|
var getDefaultEnsNodeUrl = (namespace) => {
|
|
3117
3488
|
const effectiveNamespace = namespace ?? import_datasources5.ENSNamespaceIds.Mainnet;
|
|
3118
3489
|
switch (effectiveNamespace) {
|
|
3119
3490
|
case import_datasources5.ENSNamespaceIds.Mainnet:
|
|
3120
|
-
return new URL(
|
|
3491
|
+
return new URL(DEFAULT_ENSNODE_URL_MAINNET);
|
|
3121
3492
|
case import_datasources5.ENSNamespaceIds.Sepolia:
|
|
3122
|
-
return new URL(
|
|
3493
|
+
return new URL(DEFAULT_ENSNODE_URL_SEPOLIA);
|
|
3123
3494
|
default:
|
|
3124
3495
|
throw new Error(
|
|
3125
3496
|
`ENSNamespaceId ${effectiveNamespace} does not have a default ENSNode URL defined`
|
|
@@ -3127,8 +3498,8 @@ var getDefaultEnsNodeUrl = (namespace) => {
|
|
|
3127
3498
|
}
|
|
3128
3499
|
};
|
|
3129
3500
|
|
|
3130
|
-
// src/
|
|
3131
|
-
var
|
|
3501
|
+
// src/ensnode/client.ts
|
|
3502
|
+
var EnsNodeClient = class _EnsNodeClient {
|
|
3132
3503
|
options;
|
|
3133
3504
|
static defaultOptions() {
|
|
3134
3505
|
return {
|
|
@@ -3137,7 +3508,7 @@ var EnsApiClient = class _EnsApiClient {
|
|
|
3137
3508
|
}
|
|
3138
3509
|
constructor(options = {}) {
|
|
3139
3510
|
this.options = {
|
|
3140
|
-
...
|
|
3511
|
+
..._EnsNodeClient.defaultOptions(),
|
|
3141
3512
|
...options
|
|
3142
3513
|
};
|
|
3143
3514
|
}
|
|
@@ -3293,43 +3664,17 @@ var EnsApiClient = class _EnsApiClient {
|
|
|
3293
3664
|
* ```
|
|
3294
3665
|
*/
|
|
3295
3666
|
async resolvePrimaryNames(address, options) {
|
|
3296
|
-
const url = new URL(`/api/resolve/primary-names/${address}`, this.options.url);
|
|
3297
|
-
if (options?.chainIds) url.searchParams.set("chainIds", options.chainIds.join(","));
|
|
3298
|
-
if (options?.trace) url.searchParams.set("trace", "true");
|
|
3299
|
-
if (options?.accelerate) url.searchParams.set("accelerate", "true");
|
|
3300
|
-
const response = await fetch(url);
|
|
3301
|
-
if (!response.ok) {
|
|
3302
|
-
const error = await response.json();
|
|
3303
|
-
throw ClientError.fromErrorResponse(error);
|
|
3304
|
-
}
|
|
3305
|
-
const data = await response.json();
|
|
3306
|
-
return data;
|
|
3307
|
-
}
|
|
3308
|
-
/**
|
|
3309
|
-
* Fetch ENSApi Config
|
|
3310
|
-
*
|
|
3311
|
-
* Fetch the ENSApi's configuration.
|
|
3312
|
-
*
|
|
3313
|
-
* @returns {EnsApiConfigResponse}
|
|
3314
|
-
*
|
|
3315
|
-
* @throws if the ENSApi request fails
|
|
3316
|
-
* @throws if the ENSApi returns a non-ok response
|
|
3317
|
-
* @throws if the ENSApi response breaks required invariants
|
|
3318
|
-
*/
|
|
3319
|
-
async config() {
|
|
3320
|
-
const url = new URL(`/api/config`, this.options.url);
|
|
3667
|
+
const url = new URL(`/api/resolve/primary-names/${address}`, this.options.url);
|
|
3668
|
+
if (options?.chainIds) url.searchParams.set("chainIds", options.chainIds.join(","));
|
|
3669
|
+
if (options?.trace) url.searchParams.set("trace", "true");
|
|
3670
|
+
if (options?.accelerate) url.searchParams.set("accelerate", "true");
|
|
3321
3671
|
const response = await fetch(url);
|
|
3322
|
-
let responseData;
|
|
3323
|
-
try {
|
|
3324
|
-
responseData = await response.json();
|
|
3325
|
-
} catch {
|
|
3326
|
-
throw new Error("Malformed response data: invalid JSON");
|
|
3327
|
-
}
|
|
3328
3672
|
if (!response.ok) {
|
|
3329
|
-
const
|
|
3330
|
-
throw
|
|
3673
|
+
const error = await response.json();
|
|
3674
|
+
throw ClientError.fromErrorResponse(error);
|
|
3331
3675
|
}
|
|
3332
|
-
|
|
3676
|
+
const data = await response.json();
|
|
3677
|
+
return data;
|
|
3333
3678
|
}
|
|
3334
3679
|
/**
|
|
3335
3680
|
* Fetch ENSApi Indexing Status
|
|
@@ -3352,7 +3697,7 @@ var EnsApiClient = class _EnsApiClient {
|
|
|
3352
3697
|
if (!response.ok) {
|
|
3353
3698
|
let errorResponse;
|
|
3354
3699
|
try {
|
|
3355
|
-
errorResponse =
|
|
3700
|
+
errorResponse = deserializeErrorResponse2(responseData);
|
|
3356
3701
|
} catch {
|
|
3357
3702
|
}
|
|
3358
3703
|
if (typeof errorResponse !== "undefined") {
|
|
@@ -3383,13 +3728,13 @@ var EnsApiClient = class _EnsApiClient {
|
|
|
3383
3728
|
* ```ts
|
|
3384
3729
|
* import {
|
|
3385
3730
|
* registrarActionsFilter,
|
|
3386
|
-
*
|
|
3731
|
+
* EnsNodeClient,
|
|
3387
3732
|
* } from "@ensnode/ensnode-sdk";
|
|
3388
3733
|
* import { ETH_NODE, namehashInterpretedName, asInterpretedName } from "enssdk";
|
|
3389
3734
|
*
|
|
3390
3735
|
* const BASE_NODE = namehashInterpretedName(asInterpretedName("base.eth"));
|
|
3391
3736
|
*
|
|
3392
|
-
* const client:
|
|
3737
|
+
* const client: EnsNodeClient;
|
|
3393
3738
|
*
|
|
3394
3739
|
* // Get first page with default page size (10 records)
|
|
3395
3740
|
* const response = await client.registrarActions();
|
|
@@ -3475,259 +3820,50 @@ var EnsApiClient = class _EnsApiClient {
|
|
|
3475
3820
|
);
|
|
3476
3821
|
return beginTimestampFilter ? { key: "beginTimestamp", value: beginTimestampFilter.value.toString() } : null;
|
|
3477
3822
|
};
|
|
3478
|
-
const buildEndTimestampArg = (filters) => {
|
|
3479
|
-
const endTimestampFilter = filters?.find(
|
|
3480
|
-
(f) => f.filterType === RegistrarActionsFilterTypes.EndTimestamp
|
|
3481
|
-
);
|
|
3482
|
-
return endTimestampFilter ? { key: "endTimestamp", value: endTimestampFilter.value.toString() } : null;
|
|
3483
|
-
};
|
|
3484
|
-
const buildOrderArg = (order) => {
|
|
3485
|
-
switch (order) {
|
|
3486
|
-
case RegistrarActionsOrders.LatestRegistrarActions: {
|
|
3487
|
-
const [field, direction] = order.split("=");
|
|
3488
|
-
return {
|
|
3489
|
-
key: `sort[${field}]`,
|
|
3490
|
-
value: `${direction}`
|
|
3491
|
-
};
|
|
3492
|
-
}
|
|
3493
|
-
}
|
|
3494
|
-
};
|
|
3495
|
-
const url = buildUrlPath(request.filters);
|
|
3496
|
-
if (request.order) {
|
|
3497
|
-
const orderArgs = buildOrderArg(request.order);
|
|
3498
|
-
url.searchParams.set(orderArgs.key, orderArgs.value);
|
|
3499
|
-
}
|
|
3500
|
-
if (request.page) {
|
|
3501
|
-
url.searchParams.set("page", request.page.toString());
|
|
3502
|
-
}
|
|
3503
|
-
if (request.recordsPerPage) {
|
|
3504
|
-
url.searchParams.set("recordsPerPage", request.recordsPerPage.toString());
|
|
3505
|
-
}
|
|
3506
|
-
const referralArg = buildWithReferralArg(request.filters);
|
|
3507
|
-
if (referralArg) {
|
|
3508
|
-
url.searchParams.set(referralArg.key, referralArg.value);
|
|
3509
|
-
}
|
|
3510
|
-
const decodedReferrerArg = buildDecodedReferrerArg(request.filters);
|
|
3511
|
-
if (decodedReferrerArg) {
|
|
3512
|
-
url.searchParams.set(decodedReferrerArg.key, decodedReferrerArg.value);
|
|
3513
|
-
}
|
|
3514
|
-
const beginTimestampArg = buildBeginTimestampArg(request.filters);
|
|
3515
|
-
if (beginTimestampArg) {
|
|
3516
|
-
url.searchParams.set(beginTimestampArg.key, beginTimestampArg.value);
|
|
3517
|
-
}
|
|
3518
|
-
const endTimestampArg = buildEndTimestampArg(request.filters);
|
|
3519
|
-
if (endTimestampArg) {
|
|
3520
|
-
url.searchParams.set(endTimestampArg.key, endTimestampArg.value);
|
|
3521
|
-
}
|
|
3522
|
-
const response = await fetch(url);
|
|
3523
|
-
let responseData;
|
|
3524
|
-
try {
|
|
3525
|
-
responseData = await response.json();
|
|
3526
|
-
} catch {
|
|
3527
|
-
throw new Error("Malformed response data: invalid JSON");
|
|
3528
|
-
}
|
|
3529
|
-
if (!response.ok) {
|
|
3530
|
-
let errorResponse;
|
|
3531
|
-
try {
|
|
3532
|
-
errorResponse = deserializeErrorResponse(responseData);
|
|
3533
|
-
} catch {
|
|
3534
|
-
console.log("Registrar Actions API: handling a known server error.");
|
|
3535
|
-
}
|
|
3536
|
-
if (typeof errorResponse !== "undefined") {
|
|
3537
|
-
throw new Error(`Fetching ENSNode Registrar Actions Failed: ${errorResponse.message}`);
|
|
3538
|
-
}
|
|
3539
|
-
}
|
|
3540
|
-
return deserializeRegistrarActionsResponse(responseData);
|
|
3541
|
-
}
|
|
3542
|
-
/**
|
|
3543
|
-
* Fetch Name Tokens for requested name.
|
|
3544
|
-
*
|
|
3545
|
-
* @param request.name - Name for which Name Tokens will be fetched.
|
|
3546
|
-
* @returns {NameTokensResponse}
|
|
3547
|
-
*
|
|
3548
|
-
* @throws if the ENSNode request fails
|
|
3549
|
-
* @throws if the ENSNode API returns an error response
|
|
3550
|
-
* @throws if the ENSNode response breaks required invariants
|
|
3551
|
-
*
|
|
3552
|
-
* @example
|
|
3553
|
-
* ```ts
|
|
3554
|
-
* import {
|
|
3555
|
-
* EnsApiClient,
|
|
3556
|
-
* } from "@ensnode/ensnode-sdk";
|
|
3557
|
-
* import { namehashInterpretedName, asInterpretedName } from "enssdk";
|
|
3558
|
-
*
|
|
3559
|
-
* const VITALIK_NAME = asInterpretedName("vitalik.eth");
|
|
3560
|
-
* const VITALIK_DOMAIN_ID = namehashInterpretedName(VITALIK_NAME);
|
|
3561
|
-
*
|
|
3562
|
-
* const client: EnsApiClient;
|
|
3563
|
-
*
|
|
3564
|
-
* // get latest name token records from the indexed subregistry based on the requested name
|
|
3565
|
-
* const response = await client.nameTokens({
|
|
3566
|
-
* name: VITALIK_NAME,
|
|
3567
|
-
* });
|
|
3568
|
-
*
|
|
3569
|
-
* const response = await client.nameTokens({
|
|
3570
|
-
* domainId: VITALIK_DOMAIN_ID,
|
|
3571
|
-
* })
|
|
3572
|
-
* ```
|
|
3573
|
-
*/
|
|
3574
|
-
async nameTokens(request) {
|
|
3575
|
-
const url = new URL(`/api/name-tokens`, this.options.url);
|
|
3576
|
-
if (request.name !== void 0) {
|
|
3577
|
-
url.searchParams.set("name", request.name);
|
|
3578
|
-
} else if (request.domainId !== void 0) {
|
|
3579
|
-
url.searchParams.set("domainId", request.domainId);
|
|
3580
|
-
}
|
|
3581
|
-
const response = await fetch(url);
|
|
3582
|
-
let responseData;
|
|
3583
|
-
try {
|
|
3584
|
-
responseData = await response.json();
|
|
3585
|
-
} catch {
|
|
3586
|
-
throw new Error("Malformed response data: invalid JSON");
|
|
3587
|
-
}
|
|
3588
|
-
if (!response.ok) {
|
|
3589
|
-
let errorResponse;
|
|
3590
|
-
try {
|
|
3591
|
-
errorResponse = deserializeErrorResponse(responseData);
|
|
3592
|
-
} catch {
|
|
3593
|
-
console.log("Name Tokens API: handling a known server error.");
|
|
3594
|
-
}
|
|
3595
|
-
if (typeof errorResponse !== "undefined") {
|
|
3596
|
-
throw new Error(`Fetching ENSNode Name Tokens Failed: ${errorResponse.message}`);
|
|
3597
|
-
}
|
|
3598
|
-
}
|
|
3599
|
-
return deserializedNameTokensResponse(responseData);
|
|
3600
|
-
}
|
|
3601
|
-
};
|
|
3602
|
-
|
|
3603
|
-
// src/ensindexer/api/config/deserialize.ts
|
|
3604
|
-
function deserializeEnsIndexerConfigResponse(maybeResponse) {
|
|
3605
|
-
return deserializeEnsIndexerPublicConfig(maybeResponse, "EnsIndexerConfigResponse");
|
|
3606
|
-
}
|
|
3607
|
-
|
|
3608
|
-
// src/ensindexer/api/config/serialize.ts
|
|
3609
|
-
function serializeEnsIndexerConfigResponse(response) {
|
|
3610
|
-
return serializeEnsIndexerPublicConfig(response);
|
|
3611
|
-
}
|
|
3612
|
-
|
|
3613
|
-
// src/ensindexer/api/indexing-status/deserialize.ts
|
|
3614
|
-
var import_v430 = require("zod/v4");
|
|
3615
|
-
|
|
3616
|
-
// src/ensindexer/api/indexing-status/response.ts
|
|
3617
|
-
var EnsIndexerIndexingStatusResponseCodes = {
|
|
3618
|
-
/**
|
|
3619
|
-
* Represents that the indexing status is available.
|
|
3620
|
-
*/
|
|
3621
|
-
Ok: "ok",
|
|
3622
|
-
/**
|
|
3623
|
-
* Represents that the indexing status is unavailable.
|
|
3624
|
-
*/
|
|
3625
|
-
Error: "error"
|
|
3626
|
-
};
|
|
3627
|
-
|
|
3628
|
-
// src/ensindexer/api/indexing-status/zod-schemas.ts
|
|
3629
|
-
var import_v429 = require("zod/v4");
|
|
3630
|
-
var makeEnsIndexerIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => import_v429.z.strictObject({
|
|
3631
|
-
responseCode: import_v429.z.literal(EnsIndexerIndexingStatusResponseCodes.Ok),
|
|
3632
|
-
realtimeProjection: makeRealtimeIndexingStatusProjectionSchema(valueLabel)
|
|
3633
|
-
});
|
|
3634
|
-
var makeEnsIndexerIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => import_v429.z.strictObject({
|
|
3635
|
-
responseCode: import_v429.z.literal(EnsIndexerIndexingStatusResponseCodes.Error)
|
|
3636
|
-
});
|
|
3637
|
-
var makeEnsIndexerIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => import_v429.z.discriminatedUnion("responseCode", [
|
|
3638
|
-
makeEnsIndexerIndexingStatusResponseOkSchema(valueLabel),
|
|
3639
|
-
makeEnsIndexerIndexingStatusResponseErrorSchema(valueLabel)
|
|
3640
|
-
]);
|
|
3641
|
-
var makeSerializedEnsIndexerIndexingStatusResponseOkSchema = (valueLabel = "Serialized Indexing Status Response OK") => import_v429.z.strictObject({
|
|
3642
|
-
responseCode: import_v429.z.literal(EnsIndexerIndexingStatusResponseCodes.Ok),
|
|
3643
|
-
realtimeProjection: makeSerializedRealtimeIndexingStatusProjectionSchema(valueLabel)
|
|
3644
|
-
});
|
|
3645
|
-
var makeSerializedEnsIndexerIndexingStatusResponseSchema = (valueLabel = "Serialized Indexing Status Response") => import_v429.z.discriminatedUnion("responseCode", [
|
|
3646
|
-
makeSerializedEnsIndexerIndexingStatusResponseOkSchema(valueLabel),
|
|
3647
|
-
makeEnsIndexerIndexingStatusResponseErrorSchema(valueLabel)
|
|
3648
|
-
]);
|
|
3649
|
-
|
|
3650
|
-
// src/ensindexer/api/indexing-status/deserialize.ts
|
|
3651
|
-
function buildUnvalidatedEnsIndexerIndexingStatusResponse(serializedResponse) {
|
|
3652
|
-
if (serializedResponse.responseCode !== EnsIndexerIndexingStatusResponseCodes.Ok) {
|
|
3653
|
-
return serializedResponse;
|
|
3654
|
-
}
|
|
3655
|
-
return {
|
|
3656
|
-
...serializedResponse,
|
|
3657
|
-
realtimeProjection: buildUnvalidatedRealtimeIndexingStatusProjection(
|
|
3658
|
-
serializedResponse.realtimeProjection
|
|
3659
|
-
)
|
|
3660
|
-
};
|
|
3661
|
-
}
|
|
3662
|
-
function deserializeEnsIndexerIndexingStatusResponse(maybeResponse) {
|
|
3663
|
-
const parsed = makeSerializedEnsIndexerIndexingStatusResponseSchema().transform(buildUnvalidatedEnsIndexerIndexingStatusResponse).pipe(makeEnsIndexerIndexingStatusResponseSchema()).safeParse(maybeResponse);
|
|
3664
|
-
if (parsed.error) {
|
|
3665
|
-
throw new Error(
|
|
3666
|
-
`Cannot deserialize EnsIndexerIndexingStatusResponse:
|
|
3667
|
-
${(0, import_v430.prettifyError)(parsed.error)}
|
|
3668
|
-
`
|
|
3669
|
-
);
|
|
3670
|
-
}
|
|
3671
|
-
return parsed.data;
|
|
3672
|
-
}
|
|
3673
|
-
|
|
3674
|
-
// src/ensindexer/api/indexing-status/serialize.ts
|
|
3675
|
-
function serializeEnsIndexerIndexingStatusResponse(response) {
|
|
3676
|
-
switch (response.responseCode) {
|
|
3677
|
-
case EnsIndexerIndexingStatusResponseCodes.Ok:
|
|
3678
|
-
return {
|
|
3679
|
-
responseCode: response.responseCode,
|
|
3680
|
-
realtimeProjection: serializeRealtimeIndexingStatusProjection(response.realtimeProjection)
|
|
3681
|
-
};
|
|
3682
|
-
case EnsIndexerIndexingStatusResponseCodes.Error:
|
|
3683
|
-
return response;
|
|
3684
|
-
}
|
|
3685
|
-
}
|
|
3686
|
-
|
|
3687
|
-
// src/ensindexer/api/shared/errors/deserialize.ts
|
|
3688
|
-
var import_v432 = require("zod/v4");
|
|
3689
|
-
|
|
3690
|
-
// src/ensindexer/api/shared/errors/zod-schemas.ts
|
|
3691
|
-
var import_v431 = require("zod/v4");
|
|
3692
|
-
var ErrorResponseSchema2 = import_v431.z.object({
|
|
3693
|
-
message: import_v431.z.string(),
|
|
3694
|
-
details: import_v431.z.optional(import_v431.z.unknown())
|
|
3695
|
-
});
|
|
3696
|
-
|
|
3697
|
-
// src/ensindexer/api/shared/errors/deserialize.ts
|
|
3698
|
-
function deserializeErrorResponse2(maybeErrorResponse) {
|
|
3699
|
-
const parsed = ErrorResponseSchema2.safeParse(maybeErrorResponse);
|
|
3700
|
-
if (parsed.error) {
|
|
3701
|
-
throw new Error(`Cannot deserialize ErrorResponse:
|
|
3702
|
-
${(0, import_v432.prettifyError)(parsed.error)}
|
|
3703
|
-
`);
|
|
3704
|
-
}
|
|
3705
|
-
return parsed.data;
|
|
3706
|
-
}
|
|
3707
|
-
|
|
3708
|
-
// src/ensindexer/client.ts
|
|
3709
|
-
var EnsIndexerClient = class {
|
|
3710
|
-
constructor(options) {
|
|
3711
|
-
this.options = options;
|
|
3712
|
-
}
|
|
3713
|
-
getOptions() {
|
|
3714
|
-
return Object.freeze({
|
|
3715
|
-
url: new URL(this.options.url.href)
|
|
3716
|
-
});
|
|
3717
|
-
}
|
|
3718
|
-
/**
|
|
3719
|
-
* Fetch ENSIndexer Config
|
|
3720
|
-
*
|
|
3721
|
-
* Fetch the ENSIndexer's configuration.
|
|
3722
|
-
*
|
|
3723
|
-
* @returns {EnsIndexerConfigResponse}
|
|
3724
|
-
*
|
|
3725
|
-
* @throws if the ENSIndexer request fails
|
|
3726
|
-
* @throws if the ENSIndexer returns a non-ok response
|
|
3727
|
-
* @throws if the ENSIndexer response breaks required invariants
|
|
3728
|
-
*/
|
|
3729
|
-
async config() {
|
|
3730
|
-
const url = new URL(`/api/config`, this.options.url);
|
|
3823
|
+
const buildEndTimestampArg = (filters) => {
|
|
3824
|
+
const endTimestampFilter = filters?.find(
|
|
3825
|
+
(f) => f.filterType === RegistrarActionsFilterTypes.EndTimestamp
|
|
3826
|
+
);
|
|
3827
|
+
return endTimestampFilter ? { key: "endTimestamp", value: endTimestampFilter.value.toString() } : null;
|
|
3828
|
+
};
|
|
3829
|
+
const buildOrderArg = (order) => {
|
|
3830
|
+
switch (order) {
|
|
3831
|
+
case RegistrarActionsOrders.LatestRegistrarActions: {
|
|
3832
|
+
const [field, direction] = order.split("=");
|
|
3833
|
+
return {
|
|
3834
|
+
key: `sort[${field}]`,
|
|
3835
|
+
value: `${direction}`
|
|
3836
|
+
};
|
|
3837
|
+
}
|
|
3838
|
+
}
|
|
3839
|
+
};
|
|
3840
|
+
const url = buildUrlPath(request.filters);
|
|
3841
|
+
if (request.order) {
|
|
3842
|
+
const orderArgs = buildOrderArg(request.order);
|
|
3843
|
+
url.searchParams.set(orderArgs.key, orderArgs.value);
|
|
3844
|
+
}
|
|
3845
|
+
if (request.page) {
|
|
3846
|
+
url.searchParams.set("page", request.page.toString());
|
|
3847
|
+
}
|
|
3848
|
+
if (request.recordsPerPage) {
|
|
3849
|
+
url.searchParams.set("recordsPerPage", request.recordsPerPage.toString());
|
|
3850
|
+
}
|
|
3851
|
+
const referralArg = buildWithReferralArg(request.filters);
|
|
3852
|
+
if (referralArg) {
|
|
3853
|
+
url.searchParams.set(referralArg.key, referralArg.value);
|
|
3854
|
+
}
|
|
3855
|
+
const decodedReferrerArg = buildDecodedReferrerArg(request.filters);
|
|
3856
|
+
if (decodedReferrerArg) {
|
|
3857
|
+
url.searchParams.set(decodedReferrerArg.key, decodedReferrerArg.value);
|
|
3858
|
+
}
|
|
3859
|
+
const beginTimestampArg = buildBeginTimestampArg(request.filters);
|
|
3860
|
+
if (beginTimestampArg) {
|
|
3861
|
+
url.searchParams.set(beginTimestampArg.key, beginTimestampArg.value);
|
|
3862
|
+
}
|
|
3863
|
+
const endTimestampArg = buildEndTimestampArg(request.filters);
|
|
3864
|
+
if (endTimestampArg) {
|
|
3865
|
+
url.searchParams.set(endTimestampArg.key, endTimestampArg.value);
|
|
3866
|
+
}
|
|
3731
3867
|
const response = await fetch(url);
|
|
3732
3868
|
let responseData;
|
|
3733
3869
|
try {
|
|
@@ -3736,24 +3872,57 @@ var EnsIndexerClient = class {
|
|
|
3736
3872
|
throw new Error("Malformed response data: invalid JSON");
|
|
3737
3873
|
}
|
|
3738
3874
|
if (!response.ok) {
|
|
3739
|
-
|
|
3740
|
-
|
|
3875
|
+
let errorResponse;
|
|
3876
|
+
try {
|
|
3877
|
+
errorResponse = deserializeErrorResponse2(responseData);
|
|
3878
|
+
} catch {
|
|
3879
|
+
console.log("Registrar Actions API: handling a known server error.");
|
|
3880
|
+
}
|
|
3881
|
+
if (typeof errorResponse !== "undefined") {
|
|
3882
|
+
throw new Error(`Fetching ENSNode Registrar Actions Failed: ${errorResponse.message}`);
|
|
3883
|
+
}
|
|
3741
3884
|
}
|
|
3742
|
-
return
|
|
3743
|
-
responseData
|
|
3744
|
-
);
|
|
3885
|
+
return deserializeRegistrarActionsResponse(responseData);
|
|
3745
3886
|
}
|
|
3746
3887
|
/**
|
|
3747
|
-
* Fetch
|
|
3888
|
+
* Fetch Name Tokens for requested name.
|
|
3748
3889
|
*
|
|
3749
|
-
* @
|
|
3890
|
+
* @param request.name - Name for which Name Tokens will be fetched.
|
|
3891
|
+
* @returns {NameTokensResponse}
|
|
3750
3892
|
*
|
|
3751
|
-
* @throws if the
|
|
3752
|
-
* @throws if the
|
|
3753
|
-
* @throws if the
|
|
3893
|
+
* @throws if the ENSNode request fails
|
|
3894
|
+
* @throws if the ENSNode API returns an error response
|
|
3895
|
+
* @throws if the ENSNode response breaks required invariants
|
|
3896
|
+
*
|
|
3897
|
+
* @example
|
|
3898
|
+
* ```ts
|
|
3899
|
+
* import {
|
|
3900
|
+
* EnsNodeClient,
|
|
3901
|
+
* } from "@ensnode/ensnode-sdk";
|
|
3902
|
+
* import { namehashInterpretedName, asInterpretedName } from "enssdk";
|
|
3903
|
+
*
|
|
3904
|
+
* const VITALIK_NAME = asInterpretedName("vitalik.eth");
|
|
3905
|
+
* const VITALIK_DOMAIN_ID = namehashInterpretedName(VITALIK_NAME);
|
|
3906
|
+
*
|
|
3907
|
+
* const client: EnsNodeClient;
|
|
3908
|
+
*
|
|
3909
|
+
* // get latest name token records from the indexed subregistry based on the requested name
|
|
3910
|
+
* const response = await client.nameTokens({
|
|
3911
|
+
* name: VITALIK_NAME,
|
|
3912
|
+
* });
|
|
3913
|
+
*
|
|
3914
|
+
* const response = await client.nameTokens({
|
|
3915
|
+
* domainId: VITALIK_DOMAIN_ID,
|
|
3916
|
+
* })
|
|
3917
|
+
* ```
|
|
3754
3918
|
*/
|
|
3755
|
-
async
|
|
3756
|
-
const url = new URL(`/api/
|
|
3919
|
+
async nameTokens(request) {
|
|
3920
|
+
const url = new URL(`/api/name-tokens`, this.options.url);
|
|
3921
|
+
if (request.name !== void 0) {
|
|
3922
|
+
url.searchParams.set("name", request.name);
|
|
3923
|
+
} else if (request.domainId !== void 0) {
|
|
3924
|
+
url.searchParams.set("domainId", request.domainId);
|
|
3925
|
+
}
|
|
3757
3926
|
const response = await fetch(url);
|
|
3758
3927
|
let responseData;
|
|
3759
3928
|
try {
|
|
@@ -3766,150 +3935,16 @@ var EnsIndexerClient = class {
|
|
|
3766
3935
|
try {
|
|
3767
3936
|
errorResponse = deserializeErrorResponse2(responseData);
|
|
3768
3937
|
} catch {
|
|
3938
|
+
console.log("Name Tokens API: handling a known server error.");
|
|
3769
3939
|
}
|
|
3770
3940
|
if (typeof errorResponse !== "undefined") {
|
|
3771
|
-
throw new Error(`Fetching
|
|
3941
|
+
throw new Error(`Fetching ENSNode Name Tokens Failed: ${errorResponse.message}`);
|
|
3772
3942
|
}
|
|
3773
3943
|
}
|
|
3774
|
-
return
|
|
3775
|
-
responseData
|
|
3776
|
-
);
|
|
3944
|
+
return deserializedNameTokensResponse(responseData);
|
|
3777
3945
|
}
|
|
3778
3946
|
};
|
|
3779
3947
|
|
|
3780
|
-
// src/ensindexer/config/compatibility.ts
|
|
3781
|
-
function validateEnsIndexerPublicConfigCompatibility(configA, configB) {
|
|
3782
|
-
if (configA.indexedChainIds.symmetricDifference(configB.indexedChainIds).size > 0) {
|
|
3783
|
-
throw new Error(
|
|
3784
|
-
[
|
|
3785
|
-
`'indexedChainIds' must be compatible.`,
|
|
3786
|
-
`Stored Config 'indexedChainIds': '${Array.from(configA.indexedChainIds).join(", ")}'.`,
|
|
3787
|
-
`Current Config 'indexedChainIds': '${Array.from(configB.indexedChainIds).join(", ")}'.`
|
|
3788
|
-
].join(" ")
|
|
3789
|
-
);
|
|
3790
|
-
}
|
|
3791
|
-
if (configA.isSubgraphCompatible !== configB.isSubgraphCompatible) {
|
|
3792
|
-
throw new Error(
|
|
3793
|
-
[
|
|
3794
|
-
`'isSubgraphCompatible' flag must be compatible.`,
|
|
3795
|
-
`Stored Config 'isSubgraphCompatible' flag: '${configA.isSubgraphCompatible}'.`,
|
|
3796
|
-
`Current Config 'isSubgraphCompatible' flag: '${configB.isSubgraphCompatible}'.`
|
|
3797
|
-
].join(" ")
|
|
3798
|
-
);
|
|
3799
|
-
}
|
|
3800
|
-
if (configA.namespace !== configB.namespace) {
|
|
3801
|
-
throw new Error(
|
|
3802
|
-
[
|
|
3803
|
-
`'namespace' must be compatible.`,
|
|
3804
|
-
`Stored Config 'namespace': '${configA.namespace}'.`,
|
|
3805
|
-
`Current Config 'namespace': '${configB.namespace}'.`
|
|
3806
|
-
].join(" ")
|
|
3807
|
-
);
|
|
3808
|
-
}
|
|
3809
|
-
if (configA.labelSet.labelSetId !== configB.labelSet.labelSetId) {
|
|
3810
|
-
throw new Error(
|
|
3811
|
-
[
|
|
3812
|
-
`'labelSet.labelSetId' must be compatible.`,
|
|
3813
|
-
`Stored Config 'labelSet.labelSetId': '${configA.labelSet.labelSetId}'.`,
|
|
3814
|
-
`Current Config 'labelSet.labelSetId': '${configB.labelSet.labelSetId}'.`
|
|
3815
|
-
].join(" ")
|
|
3816
|
-
);
|
|
3817
|
-
}
|
|
3818
|
-
if (configA.labelSet.labelSetVersion !== configB.labelSet.labelSetVersion) {
|
|
3819
|
-
throw new Error(
|
|
3820
|
-
[
|
|
3821
|
-
`'labelSet.labelSetVersion' must be compatible.`,
|
|
3822
|
-
`Stored Config 'labelSet.labelSetVersion': '${configA.labelSet.labelSetVersion}'.`,
|
|
3823
|
-
`Current Config 'labelSet.labelSetVersion': '${configB.labelSet.labelSetVersion}'.`
|
|
3824
|
-
].join(" ")
|
|
3825
|
-
);
|
|
3826
|
-
}
|
|
3827
|
-
const configAPluginsSet = new Set(configA.plugins);
|
|
3828
|
-
const configBPluginsSet = new Set(configB.plugins);
|
|
3829
|
-
if (configAPluginsSet.symmetricDifference(configBPluginsSet).size > 0) {
|
|
3830
|
-
throw new Error(
|
|
3831
|
-
[
|
|
3832
|
-
`'plugins' must be compatible.`,
|
|
3833
|
-
`Stored Config 'plugins': '${configA.plugins.join(", ")}'.`,
|
|
3834
|
-
`Current Config 'plugins': '${configB.plugins.join(", ")}'.`
|
|
3835
|
-
].join(" ")
|
|
3836
|
-
);
|
|
3837
|
-
}
|
|
3838
|
-
}
|
|
3839
|
-
|
|
3840
|
-
// src/ensindexer/config/label-utils.ts
|
|
3841
|
-
var import_viem8 = require("viem");
|
|
3842
|
-
function labelHashToBytes(labelHash) {
|
|
3843
|
-
try {
|
|
3844
|
-
if (labelHash.length !== 66) {
|
|
3845
|
-
throw new Error(`Invalid labelHash length ${labelHash.length} characters (expected 66)`);
|
|
3846
|
-
}
|
|
3847
|
-
if (labelHash !== labelHash.toLowerCase()) {
|
|
3848
|
-
throw new Error("Labelhash must be in lowercase");
|
|
3849
|
-
}
|
|
3850
|
-
if (!labelHash.startsWith("0x")) {
|
|
3851
|
-
throw new Error("Labelhash must be 0x-prefixed");
|
|
3852
|
-
}
|
|
3853
|
-
const bytes = (0, import_viem8.hexToBytes)(labelHash);
|
|
3854
|
-
if (bytes.length !== 32) {
|
|
3855
|
-
throw new Error(`Invalid labelHash length ${bytes.length} bytes (expected 32)`);
|
|
3856
|
-
}
|
|
3857
|
-
return bytes;
|
|
3858
|
-
} catch (e) {
|
|
3859
|
-
if (e instanceof Error) {
|
|
3860
|
-
throw e;
|
|
3861
|
-
}
|
|
3862
|
-
throw new Error("Invalid hex format");
|
|
3863
|
-
}
|
|
3864
|
-
}
|
|
3865
|
-
|
|
3866
|
-
// src/ensindexer/config/parsing.ts
|
|
3867
|
-
function parseNonNegativeInteger(maybeNumber) {
|
|
3868
|
-
const trimmed = maybeNumber.trim();
|
|
3869
|
-
if (!trimmed) {
|
|
3870
|
-
throw new Error("Input cannot be empty");
|
|
3871
|
-
}
|
|
3872
|
-
if (trimmed === "-0") {
|
|
3873
|
-
throw new Error("Negative zero is not a valid non-negative integer");
|
|
3874
|
-
}
|
|
3875
|
-
const num = Number(maybeNumber);
|
|
3876
|
-
if (Number.isNaN(num)) {
|
|
3877
|
-
throw new Error(`"${maybeNumber}" is not a valid number`);
|
|
3878
|
-
}
|
|
3879
|
-
if (!Number.isFinite(num)) {
|
|
3880
|
-
throw new Error(`"${maybeNumber}" is not a finite number`);
|
|
3881
|
-
}
|
|
3882
|
-
if (!Number.isInteger(num)) {
|
|
3883
|
-
throw new Error(`"${maybeNumber}" is not an integer`);
|
|
3884
|
-
}
|
|
3885
|
-
if (num < 0) {
|
|
3886
|
-
throw new Error(`"${maybeNumber}" is not a non-negative integer`);
|
|
3887
|
-
}
|
|
3888
|
-
return num;
|
|
3889
|
-
}
|
|
3890
|
-
|
|
3891
|
-
// src/ensindexer/config/validate/ensindexer-public-config.ts
|
|
3892
|
-
var import_v433 = require("zod/v4");
|
|
3893
|
-
function validateEnsIndexerPublicConfig(unvalidatedConfig) {
|
|
3894
|
-
const schema = makeEnsIndexerPublicConfigSchema();
|
|
3895
|
-
const result = schema.safeParse(unvalidatedConfig);
|
|
3896
|
-
if (!result.success) {
|
|
3897
|
-
throw new Error(`Invalid ENSIndexerPublicConfig: ${(0, import_v433.prettifyError)(result.error)}`);
|
|
3898
|
-
}
|
|
3899
|
-
return result.data;
|
|
3900
|
-
}
|
|
3901
|
-
|
|
3902
|
-
// src/ensindexer/config/validate/ensindexer-version-info.ts
|
|
3903
|
-
var import_v434 = require("zod/v4");
|
|
3904
|
-
function validateEnsIndexerVersionInfo(unvalidatedVersionInfo) {
|
|
3905
|
-
const schema = makeEnsIndexerVersionInfoSchema();
|
|
3906
|
-
const result = schema.safeParse(unvalidatedVersionInfo);
|
|
3907
|
-
if (!result.success) {
|
|
3908
|
-
throw new Error(`Invalid EnsIndexerVersionInfo: ${(0, import_v434.prettifyError)(result.error)}`);
|
|
3909
|
-
}
|
|
3910
|
-
return result.data;
|
|
3911
|
-
}
|
|
3912
|
-
|
|
3913
3948
|
// src/identity/identity.ts
|
|
3914
3949
|
var import_datasources6 = require("@ensnode/datasources");
|
|
3915
3950
|
|
|
@@ -3947,14 +3982,14 @@ function isResolvedIdentity(identity) {
|
|
|
3947
3982
|
}
|
|
3948
3983
|
|
|
3949
3984
|
// src/indexing-status/deserialize/chain-indexing-status-snapshot.ts
|
|
3950
|
-
var
|
|
3985
|
+
var import_v438 = require("zod/v4");
|
|
3951
3986
|
function deserializeChainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
3952
3987
|
const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
|
|
3953
3988
|
const parsed = schema.safeParse(maybeSnapshot);
|
|
3954
3989
|
if (parsed.error) {
|
|
3955
3990
|
throw new Error(
|
|
3956
3991
|
`Cannot deserialize into ChainIndexingStatusSnapshot:
|
|
3957
|
-
${(0,
|
|
3992
|
+
${(0, import_v438.prettifyError)(parsed.error)}
|
|
3958
3993
|
`
|
|
3959
3994
|
);
|
|
3960
3995
|
}
|
|
@@ -3972,26 +4007,26 @@ function createRealtimeIndexingStatusProjection(snapshot, now) {
|
|
|
3972
4007
|
}
|
|
3973
4008
|
|
|
3974
4009
|
// src/indexing-status/validate/chain-indexing-status-snapshot.ts
|
|
3975
|
-
var
|
|
4010
|
+
var import_v439 = require("zod/v4");
|
|
3976
4011
|
function validateChainIndexingStatusSnapshot(unvalidatedSnapshot, valueLabel) {
|
|
3977
4012
|
const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
|
|
3978
4013
|
const parsed = schema.safeParse(unvalidatedSnapshot);
|
|
3979
4014
|
if (parsed.error) {
|
|
3980
4015
|
throw new Error(`Invalid ChainIndexingStatusSnapshot:
|
|
3981
|
-
${(0,
|
|
4016
|
+
${(0, import_v439.prettifyError)(parsed.error)}
|
|
3982
4017
|
`);
|
|
3983
4018
|
}
|
|
3984
4019
|
return parsed.data;
|
|
3985
4020
|
}
|
|
3986
4021
|
|
|
3987
4022
|
// src/indexing-status/validate/realtime-indexing-status-projection.ts
|
|
3988
|
-
var
|
|
4023
|
+
var import_v440 = require("zod/v4");
|
|
3989
4024
|
function validateRealtimeIndexingStatusProjection(unvalidatedProjection, valueLabel) {
|
|
3990
4025
|
const schema = makeRealtimeIndexingStatusProjectionSchema(valueLabel);
|
|
3991
4026
|
const parsed = schema.safeParse(unvalidatedProjection);
|
|
3992
4027
|
if (parsed.error) {
|
|
3993
4028
|
throw new Error(`Invalid RealtimeIndexingStatusProjection:
|
|
3994
|
-
${(0,
|
|
4029
|
+
${(0, import_v440.prettifyError)(parsed.error)}
|
|
3995
4030
|
`);
|
|
3996
4031
|
}
|
|
3997
4032
|
return parsed.data;
|
|
@@ -4174,13 +4209,13 @@ var import_getUnixTime2 = require("date-fns/getUnixTime");
|
|
|
4174
4209
|
var import_getUnixTime = require("date-fns/getUnixTime");
|
|
4175
4210
|
|
|
4176
4211
|
// src/shared/deserialize.ts
|
|
4177
|
-
var
|
|
4212
|
+
var import_v441 = __toESM(require("zod/v4"), 1);
|
|
4178
4213
|
function deserializeChainId(maybeChainId, valueLabel) {
|
|
4179
4214
|
const schema = makeChainIdStringSchema(valueLabel);
|
|
4180
4215
|
const parsed = schema.safeParse(maybeChainId);
|
|
4181
4216
|
if (parsed.error) {
|
|
4182
4217
|
throw new Error(`Cannot deserialize ChainId:
|
|
4183
|
-
${(0,
|
|
4218
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4184
4219
|
`);
|
|
4185
4220
|
}
|
|
4186
4221
|
return parsed.data;
|
|
@@ -4190,7 +4225,7 @@ function deserializeDatetime(maybeDatetime, valueLabel) {
|
|
|
4190
4225
|
const parsed = schema.safeParse(maybeDatetime);
|
|
4191
4226
|
if (parsed.error) {
|
|
4192
4227
|
throw new Error(`Cannot deserialize Datetime:
|
|
4193
|
-
${(0,
|
|
4228
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4194
4229
|
`);
|
|
4195
4230
|
}
|
|
4196
4231
|
return parsed.data;
|
|
@@ -4200,7 +4235,7 @@ function deserializeUnixTimestamp(maybeTimestamp, valueLabel) {
|
|
|
4200
4235
|
const parsed = schema.safeParse(maybeTimestamp);
|
|
4201
4236
|
if (parsed.error) {
|
|
4202
4237
|
throw new Error(`Cannot deserialize Unix Timestamp:
|
|
4203
|
-
${(0,
|
|
4238
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4204
4239
|
`);
|
|
4205
4240
|
}
|
|
4206
4241
|
return parsed.data;
|
|
@@ -4210,7 +4245,7 @@ function deserializeUrl(maybeUrl, valueLabel) {
|
|
|
4210
4245
|
const parsed = schema.safeParse(maybeUrl);
|
|
4211
4246
|
if (parsed.error) {
|
|
4212
4247
|
throw new Error(`Cannot deserialize URL:
|
|
4213
|
-
${(0,
|
|
4248
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4214
4249
|
`);
|
|
4215
4250
|
}
|
|
4216
4251
|
return parsed.data;
|
|
@@ -4220,7 +4255,7 @@ function deserializeBlockNumber(maybeBlockNumber, valueLabel) {
|
|
|
4220
4255
|
const parsed = schema.safeParse(maybeBlockNumber);
|
|
4221
4256
|
if (parsed.error) {
|
|
4222
4257
|
throw new Error(`Cannot deserialize BlockNumber:
|
|
4223
|
-
${(0,
|
|
4258
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4224
4259
|
`);
|
|
4225
4260
|
}
|
|
4226
4261
|
return parsed.data;
|
|
@@ -4230,17 +4265,17 @@ function deserializeBlockRef(maybeBlockRef, valueLabel) {
|
|
|
4230
4265
|
const parsed = schema.safeParse(maybeBlockRef);
|
|
4231
4266
|
if (parsed.error) {
|
|
4232
4267
|
throw new Error(`Cannot deserialize BlockRef:
|
|
4233
|
-
${(0,
|
|
4268
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4234
4269
|
`);
|
|
4235
4270
|
}
|
|
4236
4271
|
return parsed.data;
|
|
4237
4272
|
}
|
|
4238
4273
|
function deserializeDuration(maybeDuration, valueLabel) {
|
|
4239
|
-
const schema =
|
|
4274
|
+
const schema = import_v441.default.coerce.number().pipe(makeDurationSchema(valueLabel));
|
|
4240
4275
|
const parsed = schema.safeParse(maybeDuration);
|
|
4241
4276
|
if (parsed.error) {
|
|
4242
4277
|
throw new RangeError(`Cannot deserialize Duration:
|
|
4243
|
-
${(0,
|
|
4278
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4244
4279
|
`);
|
|
4245
4280
|
}
|
|
4246
4281
|
return parsed.data;
|
|
@@ -4250,7 +4285,7 @@ function parseAccountId(maybeAccountId, valueLabel) {
|
|
|
4250
4285
|
const parsed = schema.safeParse(maybeAccountId);
|
|
4251
4286
|
if (parsed.error) {
|
|
4252
4287
|
throw new RangeError(`Cannot deserialize AccountId:
|
|
4253
|
-
${(0,
|
|
4288
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4254
4289
|
`);
|
|
4255
4290
|
}
|
|
4256
4291
|
return parsed.data;
|
|
@@ -4260,7 +4295,7 @@ function deserializePriceEth(maybePrice, valueLabel) {
|
|
|
4260
4295
|
const parsed = schema.safeParse(maybePrice);
|
|
4261
4296
|
if (parsed.error) {
|
|
4262
4297
|
throw new Error(`Cannot deserialize PriceEth:
|
|
4263
|
-
${(0,
|
|
4298
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4264
4299
|
`);
|
|
4265
4300
|
}
|
|
4266
4301
|
return parsed.data;
|
|
@@ -4270,7 +4305,7 @@ function deserializePriceUsdc(maybePrice, valueLabel) {
|
|
|
4270
4305
|
const parsed = schema.safeParse(maybePrice);
|
|
4271
4306
|
if (parsed.error) {
|
|
4272
4307
|
throw new Error(`Cannot deserialize PriceUsdc:
|
|
4273
|
-
${(0,
|
|
4308
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4274
4309
|
`);
|
|
4275
4310
|
}
|
|
4276
4311
|
return parsed.data;
|
|
@@ -4280,7 +4315,7 @@ function deserializePriceDai(maybePrice, valueLabel) {
|
|
|
4280
4315
|
const parsed = schema.safeParse(maybePrice);
|
|
4281
4316
|
if (parsed.error) {
|
|
4282
4317
|
throw new Error(`Cannot deserialize PriceDai:
|
|
4283
|
-
${(0,
|
|
4318
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4284
4319
|
`);
|
|
4285
4320
|
}
|
|
4286
4321
|
return parsed.data;
|
|
@@ -4525,6 +4560,16 @@ function isWebSocketProtocol(url) {
|
|
|
4525
4560
|
return ["ws:", "wss:"].includes(url.protocol);
|
|
4526
4561
|
}
|
|
4527
4562
|
|
|
4563
|
+
// src/stack-info/ensnode-stack-info.ts
|
|
4564
|
+
function buildEnsNodeStackInfo(ensApiPublicConfig, ensDbPublicConfig) {
|
|
4565
|
+
return {
|
|
4566
|
+
ensApi: ensApiPublicConfig,
|
|
4567
|
+
ensDb: ensDbPublicConfig,
|
|
4568
|
+
ensIndexer: ensApiPublicConfig.ensIndexerPublicConfig,
|
|
4569
|
+
ensRainbow: ensApiPublicConfig.ensIndexerPublicConfig.ensRainbowPublicConfig
|
|
4570
|
+
};
|
|
4571
|
+
}
|
|
4572
|
+
|
|
4528
4573
|
// src/subgraph-api/prerequisites.ts
|
|
4529
4574
|
function hasSubgraphApiConfigSupport(config) {
|
|
4530
4575
|
const supported = config.plugins.includes("subgraph" /* Subgraph */);
|