@ensnode/ensnode-sdk 1.10.1 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +739 -306
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +289 -93
- package/dist/index.d.ts +289 -93
- package/dist/index.js +655 -225
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
import { ENSNamespaceIds as
|
|
2
|
+
import { ENSNamespaceIds as ENSNamespaceIds4 } from "@ensnode/datasources";
|
|
3
3
|
|
|
4
4
|
// src/ens/index.ts
|
|
5
5
|
import { ENSNamespaceIds, getENSRootChainId } from "@ensnode/datasources";
|
|
@@ -76,7 +76,8 @@ function scaleBigintByNumber(value, scaleFactor) {
|
|
|
76
76
|
var CurrencyIds = {
|
|
77
77
|
ETH: "ETH",
|
|
78
78
|
USDC: "USDC",
|
|
79
|
-
DAI: "DAI"
|
|
79
|
+
DAI: "DAI",
|
|
80
|
+
ENSTokens: "ENSTokens"
|
|
80
81
|
};
|
|
81
82
|
var currencyInfo = {
|
|
82
83
|
[CurrencyIds.ETH]: {
|
|
@@ -93,6 +94,11 @@ var currencyInfo = {
|
|
|
93
94
|
id: CurrencyIds.DAI,
|
|
94
95
|
name: "Dai Stablecoin",
|
|
95
96
|
decimals: 18
|
|
97
|
+
},
|
|
98
|
+
[CurrencyIds.ENSTokens]: {
|
|
99
|
+
id: CurrencyIds.ENSTokens,
|
|
100
|
+
name: "$ENS Tokens",
|
|
101
|
+
decimals: 18
|
|
96
102
|
}
|
|
97
103
|
};
|
|
98
104
|
function getCurrencyInfo(currencyId) {
|
|
@@ -116,6 +122,12 @@ function priceDai(amount) {
|
|
|
116
122
|
currency: CurrencyIds.DAI
|
|
117
123
|
};
|
|
118
124
|
}
|
|
125
|
+
function priceEnsTokens(amount) {
|
|
126
|
+
return {
|
|
127
|
+
amount,
|
|
128
|
+
currency: CurrencyIds.ENSTokens
|
|
129
|
+
};
|
|
130
|
+
}
|
|
119
131
|
function isPriceCurrencyEqual(priceA, priceB) {
|
|
120
132
|
return priceA.currency === priceB.currency;
|
|
121
133
|
}
|
|
@@ -203,6 +215,12 @@ function parseDai(value) {
|
|
|
203
215
|
const amount = parseUnits(value, currencyInfo2.decimals);
|
|
204
216
|
return priceDai(amount);
|
|
205
217
|
}
|
|
218
|
+
function parseEnsTokens(value) {
|
|
219
|
+
validateAmountToParse(value);
|
|
220
|
+
const currencyInfo2 = getCurrencyInfo(CurrencyIds.ENSTokens);
|
|
221
|
+
const amount = parseUnits(value, currencyInfo2.decimals);
|
|
222
|
+
return priceEnsTokens(amount);
|
|
223
|
+
}
|
|
206
224
|
|
|
207
225
|
// src/shared/zod-schemas.ts
|
|
208
226
|
var makeIntegerSchema = (valueLabel = "Value") => z.int({
|
|
@@ -263,6 +281,7 @@ var makePriceCurrencySchema = (currency, valueLabel = "Price Currency") => z.str
|
|
|
263
281
|
var makePriceEthSchema = (valueLabel = "Price ETH") => makePriceCurrencySchema(CurrencyIds.ETH, valueLabel).transform((v) => v);
|
|
264
282
|
var makePriceUsdcSchema = (valueLabel = "Price USDC") => makePriceCurrencySchema(CurrencyIds.USDC, valueLabel).transform((v) => v);
|
|
265
283
|
var makePriceDaiSchema = (valueLabel = "Price DAI") => makePriceCurrencySchema(CurrencyIds.DAI, valueLabel).transform((v) => v);
|
|
284
|
+
var makePriceEnsTokensSchema = (valueLabel = "Price ENSTokens") => makePriceCurrencySchema(CurrencyIds.ENSTokens, valueLabel).transform((v) => v);
|
|
266
285
|
var makeAccountIdSchema = (valueLabel = "AccountId") => z.strictObject({
|
|
267
286
|
chainId: makeChainIdSchema(`${valueLabel} chain ID`),
|
|
268
287
|
address: makeNormalizedAddressSchema(`${valueLabel} address`)
|
|
@@ -317,14 +336,15 @@ var makeLabelSetIdSchema = (valueLabel = "Label set ID") => {
|
|
|
317
336
|
var makeLabelSetVersionSchema = (valueLabel = "Label set version") => makeNonNegativeIntegerSchema(valueLabel);
|
|
318
337
|
var makeLabelSetVersionStringSchema = (valueLabel = "Label set version") => z2.coerce.number({ error: `${valueLabel} must be a non-negative integer` }).pipe(makeLabelSetVersionSchema(valueLabel));
|
|
319
338
|
var makeEnsRainbowPublicConfigSchema = (valueLabel = "EnsRainbowPublicConfig") => z2.object({
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
labelSetId: makeLabelSetIdSchema(`${valueLabel}.labelSet.labelSetId`),
|
|
339
|
+
serverLabelSet: z2.object({
|
|
340
|
+
labelSetId: makeLabelSetIdSchema(`${valueLabel}.serverLabelSet.labelSetId`),
|
|
323
341
|
highestLabelSetVersion: makeLabelSetVersionSchema(
|
|
324
|
-
`${valueLabel}.
|
|
342
|
+
`${valueLabel}.serverLabelSet.highestLabelSetVersion`
|
|
325
343
|
)
|
|
326
344
|
}),
|
|
327
|
-
|
|
345
|
+
versionInfo: z2.object({
|
|
346
|
+
ensRainbow: z2.string().nonempty({ error: `${valueLabel}.versionInfo.ensRainbow must be a non-empty string.` })
|
|
347
|
+
})
|
|
328
348
|
});
|
|
329
349
|
|
|
330
350
|
// src/shared/collections.ts
|
|
@@ -349,8 +369,8 @@ var PluginName = /* @__PURE__ */ ((PluginName2) => {
|
|
|
349
369
|
// src/ensindexer/config/is-subgraph-compatible.ts
|
|
350
370
|
function isSubgraphCompatible(config) {
|
|
351
371
|
const onlySubgraphPluginActivated = config.plugins.length === 1 && config.plugins[0] === "subgraph" /* Subgraph */;
|
|
352
|
-
const isSubgraphLabelSet = config.
|
|
353
|
-
const isEnsTestEnvLabelSet = config.
|
|
372
|
+
const isSubgraphLabelSet = config.clientLabelSet.labelSetId === "subgraph" && config.clientLabelSet.labelSetVersion === 0;
|
|
373
|
+
const isEnsTestEnvLabelSet = config.clientLabelSet.labelSetId === "ens-test-env" && config.clientLabelSet.labelSetVersion === 0;
|
|
354
374
|
const labelSetIsSubgraphCompatible = isSubgraphLabelSet || config.namespace === ENSNamespaceIds2.EnsTestEnv && isEnsTestEnvLabelSet;
|
|
355
375
|
return onlySubgraphPluginActivated && labelSetIsSubgraphCompatible;
|
|
356
376
|
}
|
|
@@ -448,13 +468,13 @@ function invariant_isSubgraphCompatibleRequirements(ctx) {
|
|
|
448
468
|
ctx.issues.push({
|
|
449
469
|
code: "custom",
|
|
450
470
|
input: config,
|
|
451
|
-
message: `'isSubgraphCompatible' requires only the '${"subgraph" /* Subgraph */}' plugin to be active and
|
|
471
|
+
message: `'isSubgraphCompatible' requires only the '${"subgraph" /* Subgraph */}' plugin to be active and 'clientLabelSet' must be {labelSetId: "subgraph", labelSetVersion: 0}`
|
|
452
472
|
});
|
|
453
473
|
}
|
|
454
474
|
}
|
|
455
475
|
function invariant_ensRainbowSupportedLabelSetAndVersion(ctx) {
|
|
456
|
-
const clientLabelSet = ctx.value
|
|
457
|
-
const serverLabelSet = ctx.value.ensRainbowPublicConfig
|
|
476
|
+
const { clientLabelSet } = ctx.value;
|
|
477
|
+
const { serverLabelSet } = ctx.value.ensRainbowPublicConfig;
|
|
458
478
|
try {
|
|
459
479
|
validateSupportedLabelSetAndVersion(serverLabelSet, clientLabelSet);
|
|
460
480
|
} catch (error) {
|
|
@@ -475,7 +495,7 @@ var makeEnsIndexerPublicConfigSchema = (valueLabel = "ENSIndexerPublicConfig") =
|
|
|
475
495
|
isSubgraphCompatible: z3.boolean({
|
|
476
496
|
error: `${valueLabel}.isSubgraphCompatible must be a boolean value.`
|
|
477
497
|
}),
|
|
478
|
-
|
|
498
|
+
clientLabelSet: makeFullyPinnedLabelSetSchema(`${valueLabel}.clientLabelSet`),
|
|
479
499
|
namespace: makeENSNamespaceIdSchema(`${valueLabel}.namespace`),
|
|
480
500
|
plugins: makePluginsListSchema(`${valueLabel}.plugins`),
|
|
481
501
|
versionInfo: makeEnsIndexerVersionInfoSchema(`${valueLabel}.versionInfo`)
|
|
@@ -489,7 +509,7 @@ var makeSerializedEnsIndexerPublicConfigSchema = (valueLabel = "Serialized ENSIn
|
|
|
489
509
|
isSubgraphCompatible: z3.boolean({
|
|
490
510
|
error: `${valueLabel}.isSubgraphCompatible must be a boolean value.`
|
|
491
511
|
}),
|
|
492
|
-
|
|
512
|
+
clientLabelSet: makeFullyPinnedLabelSetSchema(`${valueLabel}.clientLabelSet`),
|
|
493
513
|
namespace: makeENSNamespaceIdSchema(`${valueLabel}.namespace`),
|
|
494
514
|
plugins: makePluginsListSchema(`${valueLabel}.plugins`),
|
|
495
515
|
versionInfo: makeEnsIndexerVersionInfoSchema(`${valueLabel}.versionInfo`)
|
|
@@ -589,7 +609,7 @@ function serializeEnsIndexerPublicConfig(config) {
|
|
|
589
609
|
ensRainbowPublicConfig,
|
|
590
610
|
indexedChainIds,
|
|
591
611
|
isSubgraphCompatible: isSubgraphCompatible2,
|
|
592
|
-
|
|
612
|
+
clientLabelSet,
|
|
593
613
|
namespace,
|
|
594
614
|
plugins,
|
|
595
615
|
versionInfo
|
|
@@ -599,7 +619,7 @@ function serializeEnsIndexerPublicConfig(config) {
|
|
|
599
619
|
ensRainbowPublicConfig,
|
|
600
620
|
indexedChainIds: serializeIndexedChainIds(indexedChainIds),
|
|
601
621
|
isSubgraphCompatible: isSubgraphCompatible2,
|
|
602
|
-
|
|
622
|
+
clientLabelSet,
|
|
603
623
|
namespace,
|
|
604
624
|
plugins,
|
|
605
625
|
versionInfo
|
|
@@ -1638,6 +1658,9 @@ function serializePriceUsdc(price) {
|
|
|
1638
1658
|
function serializePriceDai(price) {
|
|
1639
1659
|
return serializePrice(price);
|
|
1640
1660
|
}
|
|
1661
|
+
function serializePriceEnsTokens(price) {
|
|
1662
|
+
return serializePrice(price);
|
|
1663
|
+
}
|
|
1641
1664
|
|
|
1642
1665
|
// src/indexing-status/serialize/chain-indexing-status-snapshot.ts
|
|
1643
1666
|
function serializeChainIndexingSnapshots(chains) {
|
|
@@ -1844,21 +1867,21 @@ function validateEnsIndexerPublicConfigCompatibility(configA, configB) {
|
|
|
1844
1867
|
].join(" ")
|
|
1845
1868
|
);
|
|
1846
1869
|
}
|
|
1847
|
-
if (configA.
|
|
1870
|
+
if (configA.clientLabelSet.labelSetId !== configB.clientLabelSet.labelSetId) {
|
|
1848
1871
|
throw new Error(
|
|
1849
1872
|
[
|
|
1850
|
-
`'
|
|
1851
|
-
`Stored Config '
|
|
1852
|
-
`Current Config '
|
|
1873
|
+
`'clientLabelSet.labelSetId' must be compatible.`,
|
|
1874
|
+
`Stored Config 'clientLabelSet.labelSetId': '${configA.clientLabelSet.labelSetId}'.`,
|
|
1875
|
+
`Current Config 'clientLabelSet.labelSetId': '${configB.clientLabelSet.labelSetId}'.`
|
|
1853
1876
|
].join(" ")
|
|
1854
1877
|
);
|
|
1855
1878
|
}
|
|
1856
|
-
if (configA.
|
|
1879
|
+
if (configA.clientLabelSet.labelSetVersion !== configB.clientLabelSet.labelSetVersion) {
|
|
1857
1880
|
throw new Error(
|
|
1858
1881
|
[
|
|
1859
|
-
`'
|
|
1860
|
-
`Stored Config '
|
|
1861
|
-
`Current Config '
|
|
1882
|
+
`'clientLabelSet.labelSetVersion' must be compatible.`,
|
|
1883
|
+
`Stored Config 'clientLabelSet.labelSetVersion': '${configA.clientLabelSet.labelSetVersion}'.`,
|
|
1884
|
+
`Current Config 'clientLabelSet.labelSetVersion': '${configB.clientLabelSet.labelSetVersion}'.`
|
|
1862
1885
|
].join(" ")
|
|
1863
1886
|
);
|
|
1864
1887
|
}
|
|
@@ -1949,12 +1972,12 @@ function validateEnsIndexerVersionInfo(unvalidatedVersionInfo) {
|
|
|
1949
1972
|
}
|
|
1950
1973
|
|
|
1951
1974
|
// src/ensnode/api/indexing-status/deserialize.ts
|
|
1952
|
-
import { prettifyError as
|
|
1975
|
+
import { prettifyError as prettifyError14 } from "zod/v4";
|
|
1953
1976
|
|
|
1954
1977
|
// src/stack-info/deserialize/ensnode-stack-info.ts
|
|
1955
|
-
import { prettifyError as
|
|
1978
|
+
import { prettifyError as prettifyError13 } from "zod/v4";
|
|
1956
1979
|
|
|
1957
|
-
// src/stack-info/zod-schemas/
|
|
1980
|
+
// src/stack-info/zod-schemas/ensindexer-stack-info.ts
|
|
1958
1981
|
import { z as z13 } from "zod/v4";
|
|
1959
1982
|
|
|
1960
1983
|
// src/ensdb/zod-schemas/config.ts
|
|
@@ -1963,49 +1986,134 @@ var makeEnsDbVersionInfoSchema = (valueLabel) => {
|
|
|
1963
1986
|
const label = valueLabel ?? "EnsDbVersionInfo";
|
|
1964
1987
|
return z12.object({
|
|
1965
1988
|
postgresql: z12.string().nonempty(`${label}.postgresql must be a non-empty string`).describe("Version of the PostgreSQL server hosting the ENSDb instance.")
|
|
1966
|
-
})
|
|
1989
|
+
});
|
|
1967
1990
|
};
|
|
1968
1991
|
var makeEnsDbPublicConfigSchema = (valueLabel) => {
|
|
1969
1992
|
const label = valueLabel ?? "EnsDbPublicConfig";
|
|
1970
1993
|
return z12.object({
|
|
1971
1994
|
versionInfo: makeEnsDbVersionInfoSchema(`${label}.versionInfo`)
|
|
1972
|
-
})
|
|
1995
|
+
});
|
|
1973
1996
|
};
|
|
1974
1997
|
|
|
1975
|
-
// src/stack-info/zod-schemas/
|
|
1976
|
-
function
|
|
1977
|
-
const label = valueLabel ?? "
|
|
1998
|
+
// src/stack-info/zod-schemas/ensindexer-stack-info.ts
|
|
1999
|
+
function makeSerializedEnsIndexerStackInfoSchema(valueLabel) {
|
|
2000
|
+
const label = valueLabel ?? "ENSIndexerStackInfo";
|
|
1978
2001
|
return z13.object({
|
|
1979
|
-
ensApi: makeSerializedEnsApiPublicConfigSchema(`${label}.ensApi`),
|
|
1980
2002
|
ensDb: makeEnsDbPublicConfigSchema(`${label}.ensDb`),
|
|
1981
2003
|
ensIndexer: makeSerializedEnsIndexerPublicConfigSchema(`${label}.ensIndexer`),
|
|
1982
|
-
ensRainbow: makeEnsRainbowPublicConfigSchema(`${label}.ensRainbow`)
|
|
2004
|
+
ensRainbow: makeEnsRainbowPublicConfigSchema(`${label}.ensRainbow`)
|
|
1983
2005
|
});
|
|
1984
2006
|
}
|
|
1985
|
-
function
|
|
1986
|
-
const
|
|
2007
|
+
function invariant_ensRainbowCompatibilityWithEnsIndexer(ctx) {
|
|
2008
|
+
const { ensIndexer, ensRainbow } = ctx.value;
|
|
2009
|
+
const { clientLabelSet } = ensIndexer;
|
|
2010
|
+
const { serverLabelSet } = ensRainbow;
|
|
2011
|
+
if (clientLabelSet.labelSetId !== serverLabelSet.labelSetId) {
|
|
2012
|
+
ctx.issues.push({
|
|
2013
|
+
code: "custom",
|
|
2014
|
+
input: ctx.value,
|
|
2015
|
+
message: `ENSRainbow's label set (id: ${serverLabelSet.labelSetId}) must be the same as ENSIndexer's label set (id: ${clientLabelSet.labelSetId}).`
|
|
2016
|
+
});
|
|
2017
|
+
}
|
|
2018
|
+
if (clientLabelSet.labelSetVersion > serverLabelSet.highestLabelSetVersion) {
|
|
2019
|
+
ctx.issues.push({
|
|
2020
|
+
code: "custom",
|
|
2021
|
+
input: ctx.value,
|
|
2022
|
+
message: `ENSRainbow's server label set version (highest: ${serverLabelSet.highestLabelSetVersion}) must be greater than or equal to ENSIndexer's client label set version (current: ${clientLabelSet.labelSetVersion}).`
|
|
2023
|
+
});
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
function makeEnsIndexerStackInfoSchema(valueLabel) {
|
|
2027
|
+
const label = valueLabel ?? "ENSIndexerStackInfo";
|
|
1987
2028
|
return z13.object({
|
|
1988
|
-
ensApi: makeEnsApiPublicConfigSchema(`${label}.ensApi`),
|
|
1989
2029
|
ensDb: makeEnsDbPublicConfigSchema(`${label}.ensDb`),
|
|
1990
2030
|
ensIndexer: makeEnsIndexerPublicConfigSchema(`${label}.ensIndexer`),
|
|
1991
|
-
ensRainbow: makeEnsRainbowPublicConfigSchema(`${label}.ensRainbow`)
|
|
2031
|
+
ensRainbow: makeEnsRainbowPublicConfigSchema(`${label}.ensRainbow`)
|
|
2032
|
+
}).check(invariant_ensRainbowCompatibilityWithEnsIndexer);
|
|
2033
|
+
}
|
|
2034
|
+
|
|
2035
|
+
// src/stack-info/zod-schemas/ensnode-stack-info.ts
|
|
2036
|
+
function invariant_ensApiCompatibilityWithEnsIndexerAndEnsRainbow(ctx) {
|
|
2037
|
+
const { ensApi, ensIndexer, ensRainbow } = ctx.value;
|
|
2038
|
+
if (ensIndexer.versionInfo.ensDb !== ensApi.versionInfo.ensApi) {
|
|
2039
|
+
ctx.issues.push({
|
|
2040
|
+
code: "custom",
|
|
2041
|
+
path: ["ensIndexer", "versionInfo", "ensDb"],
|
|
2042
|
+
input: ensIndexer.versionInfo.ensDb,
|
|
2043
|
+
message: `Version Mismatch: ENSDB@${ensIndexer.versionInfo.ensDb} !== ENSApi@${ensApi.versionInfo.ensApi}`
|
|
2044
|
+
});
|
|
2045
|
+
}
|
|
2046
|
+
if (ensIndexer.versionInfo.ensIndexer !== ensApi.versionInfo.ensApi) {
|
|
2047
|
+
ctx.issues.push({
|
|
2048
|
+
code: "custom",
|
|
2049
|
+
path: ["ensIndexer", "versionInfo", "ensIndexer"],
|
|
2050
|
+
input: ensIndexer.versionInfo.ensIndexer,
|
|
2051
|
+
message: `Version Mismatch: ENSIndexer@${ensIndexer.versionInfo.ensIndexer} !== ENSApi@${ensApi.versionInfo.ensApi}`
|
|
2052
|
+
});
|
|
2053
|
+
}
|
|
2054
|
+
if (ensRainbow.versionInfo.ensRainbow !== ensApi.versionInfo.ensApi) {
|
|
2055
|
+
ctx.issues.push({
|
|
2056
|
+
code: "custom",
|
|
2057
|
+
path: ["ensRainbow", "versionInfo", "ensRainbow"],
|
|
2058
|
+
input: ensRainbow.versionInfo.ensRainbow,
|
|
2059
|
+
message: `Version Mismatch: ENSRainbow@${ensRainbow.versionInfo.ensRainbow} !== ENSApi@${ensApi.versionInfo.ensApi}`
|
|
2060
|
+
});
|
|
2061
|
+
}
|
|
2062
|
+
if (ensIndexer.versionInfo.ensNormalize !== ensApi.versionInfo.ensNormalize) {
|
|
2063
|
+
ctx.issues.push({
|
|
2064
|
+
code: "custom",
|
|
2065
|
+
path: ["ensIndexer", "versionInfo", "ensNormalize"],
|
|
2066
|
+
input: ensIndexer.versionInfo.ensNormalize,
|
|
2067
|
+
message: `Dependency Version Mismatch: '@adraffy/ens-normalize' version must be the same between ENSIndexer and ENSApi. Found ENSApi@${ensApi.versionInfo.ensNormalize} and ENSIndexer@${ensIndexer.versionInfo.ensNormalize}`
|
|
2068
|
+
});
|
|
2069
|
+
}
|
|
2070
|
+
}
|
|
2071
|
+
function makeSerializedEnsNodeStackInfoSchema(valueLabel) {
|
|
2072
|
+
const label = valueLabel ?? "ENSNodeStackInfo";
|
|
2073
|
+
return makeSerializedEnsIndexerStackInfoSchema(label).extend({
|
|
2074
|
+
ensApi: makeSerializedEnsApiPublicConfigSchema(`${label}.ensApi`)
|
|
1992
2075
|
});
|
|
1993
2076
|
}
|
|
2077
|
+
function makeEnsNodeStackInfoSchema(valueLabel) {
|
|
2078
|
+
const label = valueLabel ?? "ENSNodeStackInfo";
|
|
2079
|
+
return makeEnsIndexerStackInfoSchema(label).extend({
|
|
2080
|
+
ensApi: makeEnsApiPublicConfigSchema(`${label}.ensApi`)
|
|
2081
|
+
}).check(invariant_ensApiCompatibilityWithEnsIndexerAndEnsRainbow).check(invariant_ensRainbowCompatibilityWithEnsIndexer);
|
|
2082
|
+
}
|
|
2083
|
+
|
|
2084
|
+
// src/stack-info/deserialize/ensindexer-stack-info.ts
|
|
2085
|
+
import { prettifyError as prettifyError12 } from "zod/v4";
|
|
2086
|
+
function buildUnvalidatedEnsIndexerStackInfo(serializedStackInfo) {
|
|
2087
|
+
const { ensDb, ensRainbow } = serializedStackInfo;
|
|
2088
|
+
const ensIndexer = buildUnvalidatedEnsIndexerPublicConfig(serializedStackInfo.ensIndexer);
|
|
2089
|
+
return {
|
|
2090
|
+
ensDb,
|
|
2091
|
+
ensIndexer,
|
|
2092
|
+
ensRainbow
|
|
2093
|
+
};
|
|
2094
|
+
}
|
|
2095
|
+
function deserializeEnsIndexerStackInfo(maybeStackInfo, valueLabel) {
|
|
2096
|
+
const parsed = makeSerializedEnsIndexerStackInfoSchema(valueLabel).transform(buildUnvalidatedEnsIndexerStackInfo).pipe(makeEnsIndexerStackInfoSchema(valueLabel)).safeParse(maybeStackInfo);
|
|
2097
|
+
if (parsed.error) {
|
|
2098
|
+
throw new Error(`Cannot deserialize EnsIndexerStackInfo:
|
|
2099
|
+
${prettifyError12(parsed.error)}
|
|
2100
|
+
`);
|
|
2101
|
+
}
|
|
2102
|
+
return parsed.data;
|
|
2103
|
+
}
|
|
1994
2104
|
|
|
1995
2105
|
// src/stack-info/deserialize/ensnode-stack-info.ts
|
|
1996
2106
|
function buildUnvalidatedEnsNodeStackInfo(serializedStackInfo) {
|
|
1997
|
-
const { ensApi, ensIndexer, ...rest } = serializedStackInfo;
|
|
1998
2107
|
return {
|
|
1999
|
-
...
|
|
2000
|
-
ensApi: buildUnvalidatedEnsApiPublicConfig(ensApi)
|
|
2001
|
-
ensIndexer: buildUnvalidatedEnsIndexerPublicConfig(ensIndexer)
|
|
2108
|
+
...buildUnvalidatedEnsIndexerStackInfo(serializedStackInfo),
|
|
2109
|
+
ensApi: buildUnvalidatedEnsApiPublicConfig(serializedStackInfo.ensApi)
|
|
2002
2110
|
};
|
|
2003
2111
|
}
|
|
2004
2112
|
function deserializeEnsNodeStackInfo(maybeStackInfo, valueLabel) {
|
|
2005
2113
|
const parsed = makeSerializedEnsNodeStackInfoSchema(valueLabel).transform(buildUnvalidatedEnsNodeStackInfo).pipe(makeEnsNodeStackInfoSchema(valueLabel)).safeParse(maybeStackInfo);
|
|
2006
2114
|
if (parsed.error) {
|
|
2007
2115
|
throw new Error(`Cannot deserialize EnsNodeStackInfo:
|
|
2008
|
-
${
|
|
2116
|
+
${prettifyError13(parsed.error)}
|
|
2009
2117
|
`);
|
|
2010
2118
|
}
|
|
2011
2119
|
return parsed.data;
|
|
@@ -2065,7 +2173,7 @@ function deserializeEnsApiIndexingStatusResponse(maybeResponse) {
|
|
|
2065
2173
|
if (parsed.error) {
|
|
2066
2174
|
throw new Error(
|
|
2067
2175
|
`Cannot deserialize EnsApiIndexingStatusResponse:
|
|
2068
|
-
${
|
|
2176
|
+
${prettifyError14(parsed.error)}
|
|
2069
2177
|
`
|
|
2070
2178
|
);
|
|
2071
2179
|
}
|
|
@@ -2073,13 +2181,26 @@ ${prettifyError13(parsed.error)}
|
|
|
2073
2181
|
}
|
|
2074
2182
|
var deserializeIndexingStatusResponse = deserializeEnsApiIndexingStatusResponse;
|
|
2075
2183
|
|
|
2184
|
+
// src/stack-info/serialize/ensindexer-stack-info.ts
|
|
2185
|
+
function serializeEnsIndexerStackInfo(stackInfo) {
|
|
2186
|
+
const {
|
|
2187
|
+
ensDb: serializedEnsDbPublicConfig,
|
|
2188
|
+
ensRainbow: serializedEnsRainbowPublicConfig,
|
|
2189
|
+
ensIndexer
|
|
2190
|
+
} = stackInfo;
|
|
2191
|
+
const serializedEnsIndexerPublicConfig = serializeEnsIndexerPublicConfig(ensIndexer);
|
|
2192
|
+
return {
|
|
2193
|
+
ensDb: serializedEnsDbPublicConfig,
|
|
2194
|
+
ensIndexer: serializedEnsIndexerPublicConfig,
|
|
2195
|
+
ensRainbow: serializedEnsRainbowPublicConfig
|
|
2196
|
+
};
|
|
2197
|
+
}
|
|
2198
|
+
|
|
2076
2199
|
// src/stack-info/serialize/ensnode-stack-info.ts
|
|
2077
2200
|
function serializeEnsNodeStackInfo(stackInfo) {
|
|
2078
2201
|
return {
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
ensIndexer: serializeEnsIndexerPublicConfig(stackInfo.ensIndexer),
|
|
2082
|
-
ensRainbow: stackInfo.ensRainbow
|
|
2202
|
+
...serializeEnsIndexerStackInfo(stackInfo),
|
|
2203
|
+
ensApi: serializeEnsApiPublicConfig(stackInfo.ensApi)
|
|
2083
2204
|
};
|
|
2084
2205
|
}
|
|
2085
2206
|
|
|
@@ -2099,7 +2220,7 @@ function serializeEnsApiIndexingStatusResponse(response) {
|
|
|
2099
2220
|
var serializeIndexingStatusResponse = serializeEnsApiIndexingStatusResponse;
|
|
2100
2221
|
|
|
2101
2222
|
// src/ensnode/api/name-tokens/deserialize.ts
|
|
2102
|
-
import { prettifyError as
|
|
2223
|
+
import { prettifyError as prettifyError16 } from "zod/v4";
|
|
2103
2224
|
|
|
2104
2225
|
// src/ensnode/api/name-tokens/zod-schemas.ts
|
|
2105
2226
|
import { namehashInterpretedName } from "enssdk";
|
|
@@ -2149,7 +2270,7 @@ import {
|
|
|
2149
2270
|
stringifyAssetId
|
|
2150
2271
|
} from "enssdk";
|
|
2151
2272
|
import { isAddressEqual as isAddressEqual2, zeroAddress as zeroAddress2 } from "viem";
|
|
2152
|
-
import { prettifyError as
|
|
2273
|
+
import { prettifyError as prettifyError15 } from "zod/v4";
|
|
2153
2274
|
|
|
2154
2275
|
// src/tokenscope/zod-schemas.ts
|
|
2155
2276
|
import { AssetId as CaipAssetId } from "caip";
|
|
@@ -2250,7 +2371,7 @@ function deserializeAssetId(maybeAssetId, valueLabel) {
|
|
|
2250
2371
|
const parsed = schema.safeParse(maybeAssetId);
|
|
2251
2372
|
if (parsed.error) {
|
|
2252
2373
|
throw new RangeError(`Cannot deserialize AssetId:
|
|
2253
|
-
${
|
|
2374
|
+
${prettifyError15(parsed.error)}
|
|
2254
2375
|
`);
|
|
2255
2376
|
}
|
|
2256
2377
|
return parsed.data;
|
|
@@ -2260,7 +2381,7 @@ function parseAssetId(maybeAssetId, valueLabel) {
|
|
|
2260
2381
|
const parsed = schema.safeParse(maybeAssetId);
|
|
2261
2382
|
if (parsed.error) {
|
|
2262
2383
|
throw new RangeError(`Cannot parse AssetId:
|
|
2263
|
-
${
|
|
2384
|
+
${prettifyError15(parsed.error)}
|
|
2264
2385
|
`);
|
|
2265
2386
|
}
|
|
2266
2387
|
return parsed.data;
|
|
@@ -2686,7 +2807,7 @@ function deserializedNameTokensResponse(maybeResponse) {
|
|
|
2686
2807
|
);
|
|
2687
2808
|
if (parsed.error) {
|
|
2688
2809
|
throw new Error(`Cannot deserialize NameTokensResponse:
|
|
2689
|
-
${
|
|
2810
|
+
${prettifyError16(parsed.error)}
|
|
2690
2811
|
`);
|
|
2691
2812
|
}
|
|
2692
2813
|
return parsed.data;
|
|
@@ -2760,7 +2881,7 @@ function serializeNameTokensResponse(response) {
|
|
|
2760
2881
|
}
|
|
2761
2882
|
|
|
2762
2883
|
// src/ensnode/api/registrar-actions/deserialize.ts
|
|
2763
|
-
import { prettifyError as
|
|
2884
|
+
import { prettifyError as prettifyError17 } from "zod/v4";
|
|
2764
2885
|
|
|
2765
2886
|
// src/ensnode/api/registrar-actions/zod-schemas.ts
|
|
2766
2887
|
import { namehashInterpretedName as namehashInterpretedName2 } from "enssdk";
|
|
@@ -3064,7 +3185,7 @@ function deserializeRegistrarActionsResponse(maybeResponse) {
|
|
|
3064
3185
|
if (parsed.error) {
|
|
3065
3186
|
throw new Error(
|
|
3066
3187
|
`Cannot deserialize RegistrarActionsResponse:
|
|
3067
|
-
${
|
|
3188
|
+
${prettifyError17(parsed.error)}
|
|
3068
3189
|
`
|
|
3069
3190
|
);
|
|
3070
3191
|
}
|
|
@@ -3201,12 +3322,12 @@ function serializeRegistrarActionsResponse(response) {
|
|
|
3201
3322
|
}
|
|
3202
3323
|
|
|
3203
3324
|
// src/ensnode/api/shared/errors/deserialize.ts
|
|
3204
|
-
import { prettifyError as
|
|
3325
|
+
import { prettifyError as prettifyError18 } from "zod/v4";
|
|
3205
3326
|
function deserializeErrorResponse2(maybeErrorResponse) {
|
|
3206
3327
|
const parsed = makeErrorResponseSchema().safeParse(maybeErrorResponse);
|
|
3207
3328
|
if (parsed.error) {
|
|
3208
3329
|
throw new Error(`Cannot deserialize ErrorResponse:
|
|
3209
|
-
${
|
|
3330
|
+
${prettifyError18(parsed.error)}
|
|
3210
3331
|
`);
|
|
3211
3332
|
}
|
|
3212
3333
|
return parsed.data;
|
|
@@ -3736,51 +3857,18 @@ var EnsNodeClient = class _EnsNodeClient {
|
|
|
3736
3857
|
}
|
|
3737
3858
|
};
|
|
3738
3859
|
|
|
3739
|
-
// src/
|
|
3740
|
-
import {
|
|
3741
|
-
|
|
3742
|
-
// src/identity/types.ts
|
|
3743
|
-
var ResolutionStatusIds = {
|
|
3744
|
-
/**
|
|
3745
|
-
* Represents that the `Identity` is not resolved yet.
|
|
3746
|
-
*/
|
|
3747
|
-
Unresolved: "unresolved",
|
|
3748
|
-
/**
|
|
3749
|
-
* Represents that resolution of the `Identity` resulted in a named identity.
|
|
3750
|
-
*/
|
|
3751
|
-
Named: "named",
|
|
3752
|
-
/**
|
|
3753
|
-
* Represents that resolution of the `Identity` resulted in an unnamed identity.
|
|
3754
|
-
*/
|
|
3755
|
-
Unnamed: "unnamed",
|
|
3756
|
-
/**
|
|
3757
|
-
* Represents that attempted resolution of the `Identity` resulted in an error
|
|
3758
|
-
* and therefore it is unknown if the `Identity` resolves to a named or unnamed identity.
|
|
3759
|
-
*/
|
|
3760
|
-
Unknown: "unknown"
|
|
3761
|
-
};
|
|
3762
|
-
|
|
3763
|
-
// src/identity/identity.ts
|
|
3764
|
-
function buildUnresolvedIdentity(address, namespaceId, chainId) {
|
|
3765
|
-
return {
|
|
3766
|
-
resolutionStatus: ResolutionStatusIds.Unresolved,
|
|
3767
|
-
chainId: chainId ?? getENSRootChainId2(namespaceId),
|
|
3768
|
-
address
|
|
3769
|
-
};
|
|
3770
|
-
}
|
|
3771
|
-
function isResolvedIdentity(identity) {
|
|
3772
|
-
return identity.resolutionStatus !== ResolutionStatusIds.Unresolved;
|
|
3773
|
-
}
|
|
3860
|
+
// src/ensnode/metadata/deserialize/indexing-metadata-context.ts
|
|
3861
|
+
import { prettifyError as prettifyError25 } from "zod/v4";
|
|
3774
3862
|
|
|
3775
3863
|
// src/indexing-status/deserialize/chain-indexing-status-snapshot.ts
|
|
3776
|
-
import { prettifyError as
|
|
3864
|
+
import { prettifyError as prettifyError19 } from "zod/v4";
|
|
3777
3865
|
function deserializeChainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
3778
3866
|
const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
|
|
3779
3867
|
const parsed = schema.safeParse(maybeSnapshot);
|
|
3780
3868
|
if (parsed.error) {
|
|
3781
3869
|
throw new Error(
|
|
3782
3870
|
`Cannot deserialize into ChainIndexingStatusSnapshot:
|
|
3783
|
-
${
|
|
3871
|
+
${prettifyError19(parsed.error)}
|
|
3784
3872
|
`
|
|
3785
3873
|
);
|
|
3786
3874
|
}
|
|
@@ -3798,133 +3886,256 @@ function createRealtimeIndexingStatusProjection(snapshot, now) {
|
|
|
3798
3886
|
}
|
|
3799
3887
|
|
|
3800
3888
|
// src/indexing-status/validate/chain-indexing-status-snapshot.ts
|
|
3801
|
-
import { prettifyError as
|
|
3889
|
+
import { prettifyError as prettifyError20 } from "zod/v4";
|
|
3802
3890
|
function validateChainIndexingStatusSnapshot(unvalidatedSnapshot, valueLabel) {
|
|
3803
3891
|
const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
|
|
3804
3892
|
const parsed = schema.safeParse(unvalidatedSnapshot);
|
|
3805
3893
|
if (parsed.error) {
|
|
3806
3894
|
throw new Error(`Invalid ChainIndexingStatusSnapshot:
|
|
3807
|
-
${
|
|
3895
|
+
${prettifyError20(parsed.error)}
|
|
3808
3896
|
`);
|
|
3809
3897
|
}
|
|
3810
3898
|
return parsed.data;
|
|
3811
3899
|
}
|
|
3812
3900
|
|
|
3813
3901
|
// src/indexing-status/validate/realtime-indexing-status-projection.ts
|
|
3814
|
-
import { prettifyError as
|
|
3902
|
+
import { prettifyError as prettifyError21 } from "zod/v4";
|
|
3815
3903
|
function validateRealtimeIndexingStatusProjection(unvalidatedProjection, valueLabel) {
|
|
3816
3904
|
const schema = makeRealtimeIndexingStatusProjectionSchema(valueLabel);
|
|
3817
3905
|
const parsed = schema.safeParse(unvalidatedProjection);
|
|
3818
3906
|
if (parsed.error) {
|
|
3819
3907
|
throw new Error(`Invalid RealtimeIndexingStatusProjection:
|
|
3820
|
-
${
|
|
3908
|
+
${prettifyError21(parsed.error)}
|
|
3821
3909
|
`);
|
|
3822
3910
|
}
|
|
3823
3911
|
return parsed.data;
|
|
3824
3912
|
}
|
|
3825
3913
|
|
|
3826
|
-
// src/
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3914
|
+
// src/stack-info/validate/ensindexer-stack-info.ts
|
|
3915
|
+
import { prettifyError as prettifyError22 } from "zod/v4";
|
|
3916
|
+
function validateEnsIndexerStackInfo(maybeStackInfo, valueLabel) {
|
|
3917
|
+
const parsed = makeEnsIndexerStackInfoSchema(valueLabel).safeParse(maybeStackInfo);
|
|
3918
|
+
if (parsed.error) {
|
|
3919
|
+
throw new Error(`Cannot validate EnsIndexerStackInfo:
|
|
3920
|
+
${prettifyError22(parsed.error)}
|
|
3921
|
+
`);
|
|
3922
|
+
}
|
|
3923
|
+
return parsed.data;
|
|
3834
3924
|
}
|
|
3835
3925
|
|
|
3836
|
-
// src/
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
}
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
const
|
|
3849
|
-
if (
|
|
3850
|
-
throw new Error(`
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
}
|
|
3854
|
-
function getBasenamesSubregistryManagedName(namespaceId) {
|
|
3855
|
-
switch (namespaceId) {
|
|
3856
|
-
case ENSNamespaceIds4.Mainnet:
|
|
3857
|
-
return asInterpretedName("base.eth");
|
|
3858
|
-
case ENSNamespaceIds4.Sepolia:
|
|
3859
|
-
case ENSNamespaceIds4.SepoliaV2:
|
|
3860
|
-
return asInterpretedName("basetest.eth");
|
|
3861
|
-
case ENSNamespaceIds4.EnsTestEnv:
|
|
3862
|
-
throw new Error(
|
|
3863
|
-
`No registrar managed name is known for the 'basenames' subregistry within the "${namespaceId}" namespace.`
|
|
3864
|
-
);
|
|
3926
|
+
// src/stack-info/ensindexer-stack-info.ts
|
|
3927
|
+
function buildEnsIndexerStackInfo(ensDbPublicConfig, ensIndexerPublicConfig, ensRainbowPublicConfig) {
|
|
3928
|
+
return validateEnsIndexerStackInfo({
|
|
3929
|
+
ensDb: ensDbPublicConfig,
|
|
3930
|
+
ensIndexer: ensIndexerPublicConfig,
|
|
3931
|
+
ensRainbow: ensRainbowPublicConfig
|
|
3932
|
+
});
|
|
3933
|
+
}
|
|
3934
|
+
|
|
3935
|
+
// src/stack-info/validate/ensnode-stack-info.ts
|
|
3936
|
+
import { prettifyError as prettifyError23 } from "zod/v4";
|
|
3937
|
+
function validateEnsNodeStackInfo(maybeStackInfo, valueLabel) {
|
|
3938
|
+
const parsed = makeEnsNodeStackInfoSchema(valueLabel).safeParse(maybeStackInfo);
|
|
3939
|
+
if (parsed.error) {
|
|
3940
|
+
throw new Error(`Cannot validate EnsNodeStackInfo:
|
|
3941
|
+
${prettifyError23(parsed.error)}
|
|
3942
|
+
`);
|
|
3865
3943
|
}
|
|
3944
|
+
return parsed.data;
|
|
3866
3945
|
}
|
|
3867
3946
|
|
|
3868
|
-
// src/
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
}
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3947
|
+
// src/stack-info/ensnode-stack-info.ts
|
|
3948
|
+
function buildEnsNodeStackInfo(ensApiPublicConfig, ensDbPublicConfig, ensIndexerPublicConfig, ensRainbowPublicConfig) {
|
|
3949
|
+
return validateEnsNodeStackInfo({
|
|
3950
|
+
...buildEnsIndexerStackInfo(ensDbPublicConfig, ensIndexerPublicConfig, ensRainbowPublicConfig),
|
|
3951
|
+
ensApi: ensApiPublicConfig
|
|
3952
|
+
});
|
|
3953
|
+
}
|
|
3954
|
+
|
|
3955
|
+
// src/ensnode/metadata/validate/indexing-metadata-context.ts
|
|
3956
|
+
import { prettifyError as prettifyError24 } from "zod/v4";
|
|
3957
|
+
|
|
3958
|
+
// src/ensnode/metadata/zod-schemas/indexing-metadata-context.ts
|
|
3959
|
+
import { z as z21 } from "zod/v4";
|
|
3960
|
+
var makeSerializedIndexingMetadataContextUninitializedSchema = (valueLabel) => {
|
|
3961
|
+
const label = valueLabel ?? "SerializedIndexingMetadataContextUninitialized";
|
|
3962
|
+
return z21.object({
|
|
3963
|
+
statusCode: z21.literal(IndexingMetadataContextStatusCodes.Uninitialized, {
|
|
3964
|
+
error: `${label} must have status code ${IndexingMetadataContextStatusCodes.Uninitialized}`
|
|
3965
|
+
})
|
|
3966
|
+
});
|
|
3967
|
+
};
|
|
3968
|
+
var makeSerializedIndexingMetadataContextInitializedSchema = (valueLabel) => {
|
|
3969
|
+
const label = valueLabel ?? "SerializedIndexingMetadataContextInitialized";
|
|
3970
|
+
return z21.object({
|
|
3971
|
+
statusCode: z21.literal(IndexingMetadataContextStatusCodes.Initialized, {
|
|
3972
|
+
error: `${label} must have status code ${IndexingMetadataContextStatusCodes.Initialized}`
|
|
3973
|
+
}),
|
|
3974
|
+
indexingStatus: makeSerializedCrossChainIndexingStatusSnapshotSchema(`${label}.indexingStatus`),
|
|
3975
|
+
stackInfo: makeSerializedEnsIndexerStackInfoSchema(`${label}.stackInfo`)
|
|
3976
|
+
});
|
|
3977
|
+
};
|
|
3978
|
+
var makeSerializedIndexingMetadataContextSchema = (valueLabel) => {
|
|
3979
|
+
const label = valueLabel ?? "SerializedIndexingMetadataContext";
|
|
3980
|
+
return z21.discriminatedUnion("statusCode", [
|
|
3981
|
+
makeSerializedIndexingMetadataContextUninitializedSchema(label),
|
|
3982
|
+
makeSerializedIndexingMetadataContextInitializedSchema(label)
|
|
3983
|
+
]);
|
|
3984
|
+
};
|
|
3985
|
+
var makeIndexingMetadataContextUninitializedSchema = makeSerializedIndexingMetadataContextUninitializedSchema;
|
|
3986
|
+
var makeIndexingMetadataContextInitializedSchema = (valueLabel) => {
|
|
3987
|
+
const label = valueLabel ?? "IndexingMetadataContextInitialized";
|
|
3988
|
+
return z21.object({
|
|
3989
|
+
statusCode: z21.literal(IndexingMetadataContextStatusCodes.Initialized, {
|
|
3990
|
+
error: `${label} must have status code ${IndexingMetadataContextStatusCodes.Initialized}`
|
|
3991
|
+
}),
|
|
3992
|
+
indexingStatus: makeCrossChainIndexingStatusSnapshotSchema(`${label}.indexingStatus`),
|
|
3993
|
+
stackInfo: makeEnsIndexerStackInfoSchema(`${label}.stackInfo`)
|
|
3994
|
+
});
|
|
3995
|
+
};
|
|
3996
|
+
var makeIndexingMetadataContextSchema = (valueLabel) => {
|
|
3997
|
+
const label = valueLabel ?? "IndexingMetadataContext";
|
|
3998
|
+
return z21.discriminatedUnion("statusCode", [
|
|
3999
|
+
makeIndexingMetadataContextUninitializedSchema(label),
|
|
4000
|
+
makeIndexingMetadataContextInitializedSchema(label)
|
|
4001
|
+
]);
|
|
4002
|
+
};
|
|
4003
|
+
|
|
4004
|
+
// src/ensnode/metadata/validate/indexing-metadata-context.ts
|
|
4005
|
+
function validateIndexingMetadataContextInitialized(maybeIndexingMetadataContext, valueLabel) {
|
|
4006
|
+
const label = valueLabel ?? "IndexingMetadataContextInitialized";
|
|
4007
|
+
const result = makeIndexingMetadataContextInitializedSchema(label).safeParse(
|
|
4008
|
+
maybeIndexingMetadataContext
|
|
4009
|
+
);
|
|
4010
|
+
if (result.error) {
|
|
4011
|
+
throw new Error(`Cannot validate ${label}:
|
|
4012
|
+
${prettifyError24(result.error)}
|
|
4013
|
+
`);
|
|
3879
4014
|
}
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
4015
|
+
return result.data;
|
|
4016
|
+
}
|
|
4017
|
+
|
|
4018
|
+
// src/ensnode/metadata/indexing-metadata-context.ts
|
|
4019
|
+
var IndexingMetadataContextStatusCodes = {
|
|
4020
|
+
/**
|
|
4021
|
+
* Represents that no indexing metadata context has been initialized
|
|
4022
|
+
* for the ENSIndexer Schema Name in the ENSNode Metadata table in ENSDb.
|
|
4023
|
+
*/
|
|
4024
|
+
Uninitialized: "uninitialized",
|
|
4025
|
+
/**
|
|
4026
|
+
* Represents that the indexing metadata context has been initialized
|
|
4027
|
+
* for the ENSIndexer Schema Name in the ENSNode Metadata table in ENSDb.
|
|
4028
|
+
*/
|
|
4029
|
+
Initialized: "initialized"
|
|
4030
|
+
};
|
|
4031
|
+
function buildIndexingMetadataContextUninitialized() {
|
|
4032
|
+
return {
|
|
4033
|
+
statusCode: IndexingMetadataContextStatusCodes.Uninitialized
|
|
4034
|
+
};
|
|
4035
|
+
}
|
|
4036
|
+
function buildIndexingMetadataContextInitialized(indexingStatus, stackInfo) {
|
|
4037
|
+
return validateIndexingMetadataContextInitialized({
|
|
4038
|
+
statusCode: IndexingMetadataContextStatusCodes.Initialized,
|
|
4039
|
+
indexingStatus,
|
|
4040
|
+
stackInfo
|
|
4041
|
+
});
|
|
4042
|
+
}
|
|
4043
|
+
|
|
4044
|
+
// src/ensnode/metadata/deserialize/indexing-metadata-context.ts
|
|
4045
|
+
function buildUnvalidatedIndexingMetadataContextInitialized(serializedIndexingMetadataContext) {
|
|
4046
|
+
return {
|
|
4047
|
+
statusCode: serializedIndexingMetadataContext.statusCode,
|
|
4048
|
+
indexingStatus: buildUnvalidatedCrossChainIndexingStatusSnapshot(
|
|
4049
|
+
serializedIndexingMetadataContext.indexingStatus
|
|
4050
|
+
),
|
|
4051
|
+
stackInfo: buildUnvalidatedEnsIndexerStackInfo(serializedIndexingMetadataContext.stackInfo)
|
|
4052
|
+
};
|
|
4053
|
+
}
|
|
4054
|
+
function buildUnvalidatedIndexingMetadataContext(serializedIndexingMetadataContext) {
|
|
4055
|
+
switch (serializedIndexingMetadataContext.statusCode) {
|
|
4056
|
+
case IndexingMetadataContextStatusCodes.Uninitialized:
|
|
4057
|
+
return serializedIndexingMetadataContext;
|
|
4058
|
+
case IndexingMetadataContextStatusCodes.Initialized:
|
|
4059
|
+
return buildUnvalidatedIndexingMetadataContextInitialized(serializedIndexingMetadataContext);
|
|
3883
4060
|
}
|
|
3884
|
-
return { chainId: datasource.chain.id, address };
|
|
3885
4061
|
}
|
|
3886
|
-
function
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
4062
|
+
function deserializeIndexingMetadataContext(serializedIndexingMetadataContext, valueLabel) {
|
|
4063
|
+
const label = valueLabel ?? "IndexingMetadataContext";
|
|
4064
|
+
const parsed = makeSerializedIndexingMetadataContextSchema(label).transform(buildUnvalidatedIndexingMetadataContext).pipe(makeIndexingMetadataContextSchema(label)).safeParse(serializedIndexingMetadataContext);
|
|
4065
|
+
if (parsed.error) {
|
|
4066
|
+
throw new Error(
|
|
4067
|
+
`Cannot deserialize IndexingMetadataContext:
|
|
4068
|
+
${prettifyError25(parsed.error)}
|
|
4069
|
+
`
|
|
4070
|
+
);
|
|
3893
4071
|
}
|
|
4072
|
+
return parsed.data;
|
|
3894
4073
|
}
|
|
3895
4074
|
|
|
3896
|
-
// src/
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
}
|
|
3912
|
-
return { chainId: datasource.chain.id, address };
|
|
3913
|
-
}
|
|
3914
|
-
function getLineanamesSubregistryManagedName(namespaceId) {
|
|
3915
|
-
switch (namespaceId) {
|
|
3916
|
-
case ENSNamespaceIds6.Mainnet:
|
|
3917
|
-
return asInterpretedName3("linea.eth");
|
|
3918
|
-
case ENSNamespaceIds6.Sepolia:
|
|
3919
|
-
case ENSNamespaceIds6.SepoliaV2:
|
|
3920
|
-
return asInterpretedName3("linea-sepolia.eth");
|
|
3921
|
-
case ENSNamespaceIds6.EnsTestEnv:
|
|
3922
|
-
throw new Error(
|
|
3923
|
-
`No registrar managed name is known for the 'Lineanames' subregistry within the "${namespaceId}" namespace.`
|
|
3924
|
-
);
|
|
4075
|
+
// src/ensnode/metadata/serialize/indexing-metadata-context.ts
|
|
4076
|
+
function serializeIndexingMetadataContextInitialized(context) {
|
|
4077
|
+
const { statusCode, indexingStatus, stackInfo } = context;
|
|
4078
|
+
return {
|
|
4079
|
+
statusCode,
|
|
4080
|
+
indexingStatus: serializeCrossChainIndexingStatusSnapshot(indexingStatus),
|
|
4081
|
+
stackInfo: serializeEnsIndexerStackInfo(stackInfo)
|
|
4082
|
+
};
|
|
4083
|
+
}
|
|
4084
|
+
function serializeIndexingMetadataContext(context) {
|
|
4085
|
+
switch (context.statusCode) {
|
|
4086
|
+
case IndexingMetadataContextStatusCodes.Uninitialized:
|
|
4087
|
+
return context;
|
|
4088
|
+
case IndexingMetadataContextStatusCodes.Initialized:
|
|
4089
|
+
return serializeIndexingMetadataContextInitialized(context);
|
|
3925
4090
|
}
|
|
3926
4091
|
}
|
|
3927
4092
|
|
|
4093
|
+
// src/identity/identity.ts
|
|
4094
|
+
import { getENSRootChainId as getENSRootChainId2 } from "@ensnode/datasources";
|
|
4095
|
+
|
|
4096
|
+
// src/identity/types.ts
|
|
4097
|
+
var ResolutionStatusIds = {
|
|
4098
|
+
/**
|
|
4099
|
+
* Represents that the `Identity` is not resolved yet.
|
|
4100
|
+
*/
|
|
4101
|
+
Unresolved: "unresolved",
|
|
4102
|
+
/**
|
|
4103
|
+
* Represents that resolution of the `Identity` resulted in a named identity.
|
|
4104
|
+
*/
|
|
4105
|
+
Named: "named",
|
|
4106
|
+
/**
|
|
4107
|
+
* Represents that resolution of the `Identity` resulted in an unnamed identity.
|
|
4108
|
+
*/
|
|
4109
|
+
Unnamed: "unnamed",
|
|
4110
|
+
/**
|
|
4111
|
+
* Represents that attempted resolution of the `Identity` resulted in an error
|
|
4112
|
+
* and therefore it is unknown if the `Identity` resolves to a named or unnamed identity.
|
|
4113
|
+
*/
|
|
4114
|
+
Unknown: "unknown"
|
|
4115
|
+
};
|
|
4116
|
+
|
|
4117
|
+
// src/identity/identity.ts
|
|
4118
|
+
function buildUnresolvedIdentity(address, namespaceId, chainId) {
|
|
4119
|
+
return {
|
|
4120
|
+
resolutionStatus: ResolutionStatusIds.Unresolved,
|
|
4121
|
+
chainId: chainId ?? getENSRootChainId2(namespaceId),
|
|
4122
|
+
address
|
|
4123
|
+
};
|
|
4124
|
+
}
|
|
4125
|
+
function isResolvedIdentity(identity) {
|
|
4126
|
+
return identity.resolutionStatus !== ResolutionStatusIds.Unresolved;
|
|
4127
|
+
}
|
|
4128
|
+
|
|
4129
|
+
// src/omnigraph-api/prerequisites.ts
|
|
4130
|
+
function hasOmnigraphApiConfigSupport(config) {
|
|
4131
|
+
const supported = config.plugins.includes("ensv2" /* ENSv2 */);
|
|
4132
|
+
if (supported) return { supported };
|
|
4133
|
+
return {
|
|
4134
|
+
supported: false,
|
|
4135
|
+
reason: `The connected ENSNode's Config must have the '${"ensv2" /* ENSv2 */}' plugin enabled.`
|
|
4136
|
+
};
|
|
4137
|
+
}
|
|
4138
|
+
|
|
3928
4139
|
// src/registrars/registration-expiration.ts
|
|
3929
4140
|
function isRegistrationExpired(info, now) {
|
|
3930
4141
|
if (info.expiry == null) return false;
|
|
@@ -4012,13 +4223,13 @@ import { getUnixTime as getUnixTime2 } from "date-fns/getUnixTime";
|
|
|
4012
4223
|
import { getUnixTime } from "date-fns/getUnixTime";
|
|
4013
4224
|
|
|
4014
4225
|
// src/shared/deserialize.ts
|
|
4015
|
-
import
|
|
4226
|
+
import z22, { prettifyError as prettifyError26 } from "zod/v4";
|
|
4016
4227
|
function deserializeChainId(maybeChainId, valueLabel) {
|
|
4017
4228
|
const schema = makeChainIdStringSchema(valueLabel);
|
|
4018
4229
|
const parsed = schema.safeParse(maybeChainId);
|
|
4019
4230
|
if (parsed.error) {
|
|
4020
4231
|
throw new Error(`Cannot deserialize ChainId:
|
|
4021
|
-
${
|
|
4232
|
+
${prettifyError26(parsed.error)}
|
|
4022
4233
|
`);
|
|
4023
4234
|
}
|
|
4024
4235
|
return parsed.data;
|
|
@@ -4028,7 +4239,7 @@ function deserializeDatetime(maybeDatetime, valueLabel) {
|
|
|
4028
4239
|
const parsed = schema.safeParse(maybeDatetime);
|
|
4029
4240
|
if (parsed.error) {
|
|
4030
4241
|
throw new Error(`Cannot deserialize Datetime:
|
|
4031
|
-
${
|
|
4242
|
+
${prettifyError26(parsed.error)}
|
|
4032
4243
|
`);
|
|
4033
4244
|
}
|
|
4034
4245
|
return parsed.data;
|
|
@@ -4038,7 +4249,7 @@ function deserializeUnixTimestamp(maybeTimestamp, valueLabel) {
|
|
|
4038
4249
|
const parsed = schema.safeParse(maybeTimestamp);
|
|
4039
4250
|
if (parsed.error) {
|
|
4040
4251
|
throw new Error(`Cannot deserialize Unix Timestamp:
|
|
4041
|
-
${
|
|
4252
|
+
${prettifyError26(parsed.error)}
|
|
4042
4253
|
`);
|
|
4043
4254
|
}
|
|
4044
4255
|
return parsed.data;
|
|
@@ -4048,7 +4259,7 @@ function deserializeUrl(maybeUrl, valueLabel) {
|
|
|
4048
4259
|
const parsed = schema.safeParse(maybeUrl);
|
|
4049
4260
|
if (parsed.error) {
|
|
4050
4261
|
throw new Error(`Cannot deserialize URL:
|
|
4051
|
-
${
|
|
4262
|
+
${prettifyError26(parsed.error)}
|
|
4052
4263
|
`);
|
|
4053
4264
|
}
|
|
4054
4265
|
return parsed.data;
|
|
@@ -4058,7 +4269,7 @@ function deserializeBlockNumber(maybeBlockNumber, valueLabel) {
|
|
|
4058
4269
|
const parsed = schema.safeParse(maybeBlockNumber);
|
|
4059
4270
|
if (parsed.error) {
|
|
4060
4271
|
throw new Error(`Cannot deserialize BlockNumber:
|
|
4061
|
-
${
|
|
4272
|
+
${prettifyError26(parsed.error)}
|
|
4062
4273
|
`);
|
|
4063
4274
|
}
|
|
4064
4275
|
return parsed.data;
|
|
@@ -4068,17 +4279,17 @@ function deserializeBlockRef(maybeBlockRef, valueLabel) {
|
|
|
4068
4279
|
const parsed = schema.safeParse(maybeBlockRef);
|
|
4069
4280
|
if (parsed.error) {
|
|
4070
4281
|
throw new Error(`Cannot deserialize BlockRef:
|
|
4071
|
-
${
|
|
4282
|
+
${prettifyError26(parsed.error)}
|
|
4072
4283
|
`);
|
|
4073
4284
|
}
|
|
4074
4285
|
return parsed.data;
|
|
4075
4286
|
}
|
|
4076
4287
|
function deserializeDuration(maybeDuration, valueLabel) {
|
|
4077
|
-
const schema =
|
|
4288
|
+
const schema = z22.coerce.number().pipe(makeDurationSchema(valueLabel));
|
|
4078
4289
|
const parsed = schema.safeParse(maybeDuration);
|
|
4079
4290
|
if (parsed.error) {
|
|
4080
4291
|
throw new RangeError(`Cannot deserialize Duration:
|
|
4081
|
-
${
|
|
4292
|
+
${prettifyError26(parsed.error)}
|
|
4082
4293
|
`);
|
|
4083
4294
|
}
|
|
4084
4295
|
return parsed.data;
|
|
@@ -4088,7 +4299,7 @@ function parseAccountId(maybeAccountId, valueLabel) {
|
|
|
4088
4299
|
const parsed = schema.safeParse(maybeAccountId);
|
|
4089
4300
|
if (parsed.error) {
|
|
4090
4301
|
throw new RangeError(`Cannot deserialize AccountId:
|
|
4091
|
-
${
|
|
4302
|
+
${prettifyError26(parsed.error)}
|
|
4092
4303
|
`);
|
|
4093
4304
|
}
|
|
4094
4305
|
return parsed.data;
|
|
@@ -4098,7 +4309,7 @@ function deserializePriceEth(maybePrice, valueLabel) {
|
|
|
4098
4309
|
const parsed = schema.safeParse(maybePrice);
|
|
4099
4310
|
if (parsed.error) {
|
|
4100
4311
|
throw new Error(`Cannot deserialize PriceEth:
|
|
4101
|
-
${
|
|
4312
|
+
${prettifyError26(parsed.error)}
|
|
4102
4313
|
`);
|
|
4103
4314
|
}
|
|
4104
4315
|
return parsed.data;
|
|
@@ -4108,7 +4319,7 @@ function deserializePriceUsdc(maybePrice, valueLabel) {
|
|
|
4108
4319
|
const parsed = schema.safeParse(maybePrice);
|
|
4109
4320
|
if (parsed.error) {
|
|
4110
4321
|
throw new Error(`Cannot deserialize PriceUsdc:
|
|
4111
|
-
${
|
|
4322
|
+
${prettifyError26(parsed.error)}
|
|
4112
4323
|
`);
|
|
4113
4324
|
}
|
|
4114
4325
|
return parsed.data;
|
|
@@ -4118,7 +4329,17 @@ function deserializePriceDai(maybePrice, valueLabel) {
|
|
|
4118
4329
|
const parsed = schema.safeParse(maybePrice);
|
|
4119
4330
|
if (parsed.error) {
|
|
4120
4331
|
throw new Error(`Cannot deserialize PriceDai:
|
|
4121
|
-
${
|
|
4332
|
+
${prettifyError26(parsed.error)}
|
|
4333
|
+
`);
|
|
4334
|
+
}
|
|
4335
|
+
return parsed.data;
|
|
4336
|
+
}
|
|
4337
|
+
function deserializePriceEnsTokens(maybePrice, valueLabel) {
|
|
4338
|
+
const schema = makePriceEnsTokensSchema(valueLabel);
|
|
4339
|
+
const parsed = schema.safeParse(maybePrice);
|
|
4340
|
+
if (parsed.error) {
|
|
4341
|
+
throw new Error(`Cannot deserialize PriceEnsTokens:
|
|
4342
|
+
${prettifyError26(parsed.error)}
|
|
4122
4343
|
`);
|
|
4123
4344
|
}
|
|
4124
4345
|
return parsed.data;
|
|
@@ -4271,13 +4492,13 @@ var TtlCache = class {
|
|
|
4271
4492
|
|
|
4272
4493
|
// src/shared/config/indexed-blockranges.ts
|
|
4273
4494
|
import {
|
|
4274
|
-
maybeGetDatasource as
|
|
4495
|
+
maybeGetDatasource as maybeGetDatasource2
|
|
4275
4496
|
} from "@ensnode/datasources";
|
|
4276
4497
|
function buildIndexedBlockranges(namespace, pluginsDatasourceNames) {
|
|
4277
4498
|
const indexedBlockranges = /* @__PURE__ */ new Map();
|
|
4278
4499
|
for (const [, datasourceNames] of pluginsDatasourceNames) {
|
|
4279
4500
|
for (const datasourceName of datasourceNames) {
|
|
4280
|
-
const datasource =
|
|
4501
|
+
const datasource = maybeGetDatasource2(namespace, datasourceName);
|
|
4281
4502
|
if (!datasource) continue;
|
|
4282
4503
|
const datasourceChainId = datasource.chain.id;
|
|
4283
4504
|
const datasourceContracts = Object.values(datasource.contracts);
|
|
@@ -4352,24 +4573,225 @@ function interpretDnszonehashValue(value) {
|
|
|
4352
4573
|
return value;
|
|
4353
4574
|
}
|
|
4354
4575
|
|
|
4576
|
+
// src/shared/managed-names.ts
|
|
4577
|
+
import {
|
|
4578
|
+
asInterpretedName,
|
|
4579
|
+
ENS_ROOT_NAME,
|
|
4580
|
+
namehashInterpretedName as namehashInterpretedName3,
|
|
4581
|
+
stringifyAccountId
|
|
4582
|
+
} from "enssdk";
|
|
4583
|
+
import { DatasourceNames as DatasourceNames2 } from "@ensnode/datasources";
|
|
4584
|
+
|
|
4585
|
+
// src/shared/to-json.ts
|
|
4586
|
+
var toJson = (value, options) => JSON.stringify(
|
|
4587
|
+
value,
|
|
4588
|
+
(_key, val) => typeof val === "bigint" ? String(val) : val,
|
|
4589
|
+
options?.pretty ? 2 : void 0
|
|
4590
|
+
);
|
|
4591
|
+
|
|
4592
|
+
// src/shared/managed-names.ts
|
|
4593
|
+
var MANAGED_NAME_BY_NAMESPACE = {
|
|
4594
|
+
sepolia: {
|
|
4595
|
+
"base.eth": "basetest.eth",
|
|
4596
|
+
"linea.eth": "linea-sepolia.eth"
|
|
4597
|
+
}
|
|
4598
|
+
};
|
|
4599
|
+
var getContractsByManagedName = (namespace) => {
|
|
4600
|
+
const ensRootRegistry = getDatasourceContract(
|
|
4601
|
+
namespace,
|
|
4602
|
+
DatasourceNames2.ENSRoot,
|
|
4603
|
+
"ENSv1Registry"
|
|
4604
|
+
);
|
|
4605
|
+
const ensRootRegistryOld = getDatasourceContract(
|
|
4606
|
+
namespace,
|
|
4607
|
+
DatasourceNames2.ENSRoot,
|
|
4608
|
+
"ENSv1RegistryOld"
|
|
4609
|
+
);
|
|
4610
|
+
const ethnamesNameWrapper = getDatasourceContract(
|
|
4611
|
+
namespace,
|
|
4612
|
+
DatasourceNames2.ENSRoot,
|
|
4613
|
+
"NameWrapper"
|
|
4614
|
+
);
|
|
4615
|
+
const basenamesRegistry = maybeGetDatasourceContract(
|
|
4616
|
+
namespace,
|
|
4617
|
+
DatasourceNames2.Basenames,
|
|
4618
|
+
"Registry"
|
|
4619
|
+
);
|
|
4620
|
+
const lineanamesRegistry = maybeGetDatasourceContract(
|
|
4621
|
+
namespace,
|
|
4622
|
+
DatasourceNames2.Lineanames,
|
|
4623
|
+
"Registry"
|
|
4624
|
+
);
|
|
4625
|
+
const lineanamesNameWrapper = maybeGetDatasourceContract(
|
|
4626
|
+
namespace,
|
|
4627
|
+
DatasourceNames2.Lineanames,
|
|
4628
|
+
"NameWrapper"
|
|
4629
|
+
);
|
|
4630
|
+
return {
|
|
4631
|
+
[ENS_ROOT_NAME]: {
|
|
4632
|
+
registry: ensRootRegistry,
|
|
4633
|
+
contracts: [ensRootRegistry, ensRootRegistryOld]
|
|
4634
|
+
},
|
|
4635
|
+
eth: {
|
|
4636
|
+
registry: ensRootRegistry,
|
|
4637
|
+
contracts: [
|
|
4638
|
+
getDatasourceContract(namespace, DatasourceNames2.ENSRoot, "BaseRegistrar"),
|
|
4639
|
+
getDatasourceContract(
|
|
4640
|
+
namespace,
|
|
4641
|
+
DatasourceNames2.ENSRoot,
|
|
4642
|
+
"UnwrappedEthRegistrarController"
|
|
4643
|
+
),
|
|
4644
|
+
maybeGetDatasourceContract(
|
|
4645
|
+
namespace,
|
|
4646
|
+
DatasourceNames2.ENSRoot,
|
|
4647
|
+
"LegacyEthRegistrarController"
|
|
4648
|
+
),
|
|
4649
|
+
maybeGetDatasourceContract(
|
|
4650
|
+
namespace,
|
|
4651
|
+
DatasourceNames2.ENSRoot,
|
|
4652
|
+
"WrappedEthRegistrarController"
|
|
4653
|
+
),
|
|
4654
|
+
maybeGetDatasourceContract(
|
|
4655
|
+
namespace,
|
|
4656
|
+
DatasourceNames2.ENSRoot,
|
|
4657
|
+
"UniversalRegistrarRenewalWithReferrer"
|
|
4658
|
+
),
|
|
4659
|
+
ethnamesNameWrapper
|
|
4660
|
+
].filter((c) => !!c)
|
|
4661
|
+
},
|
|
4662
|
+
...basenamesRegistry && {
|
|
4663
|
+
"base.eth": {
|
|
4664
|
+
registry: basenamesRegistry,
|
|
4665
|
+
contracts: [
|
|
4666
|
+
basenamesRegistry,
|
|
4667
|
+
maybeGetDatasourceContract(namespace, DatasourceNames2.Basenames, "BaseRegistrar"),
|
|
4668
|
+
maybeGetDatasourceContract(namespace, DatasourceNames2.Basenames, "EARegistrarController"),
|
|
4669
|
+
maybeGetDatasourceContract(namespace, DatasourceNames2.Basenames, "RegistrarController"),
|
|
4670
|
+
maybeGetDatasourceContract(
|
|
4671
|
+
namespace,
|
|
4672
|
+
DatasourceNames2.Basenames,
|
|
4673
|
+
"UpgradeableRegistrarController"
|
|
4674
|
+
)
|
|
4675
|
+
].filter((c) => !!c)
|
|
4676
|
+
}
|
|
4677
|
+
},
|
|
4678
|
+
...lineanamesRegistry && {
|
|
4679
|
+
"linea.eth": {
|
|
4680
|
+
registry: lineanamesRegistry,
|
|
4681
|
+
contracts: [
|
|
4682
|
+
lineanamesRegistry,
|
|
4683
|
+
maybeGetDatasourceContract(namespace, DatasourceNames2.Lineanames, "BaseRegistrar"),
|
|
4684
|
+
maybeGetDatasourceContract(
|
|
4685
|
+
namespace,
|
|
4686
|
+
DatasourceNames2.Lineanames,
|
|
4687
|
+
"EthRegistrarController"
|
|
4688
|
+
),
|
|
4689
|
+
lineanamesNameWrapper
|
|
4690
|
+
].filter((c) => !!c)
|
|
4691
|
+
}
|
|
4692
|
+
}
|
|
4693
|
+
};
|
|
4694
|
+
};
|
|
4695
|
+
var cache = /* @__PURE__ */ new Map();
|
|
4696
|
+
var getManagedName = (namespace, contract) => {
|
|
4697
|
+
const cacheKey = `${namespace}:${stringifyAccountId(contract)}`;
|
|
4698
|
+
const cached = cache.get(cacheKey);
|
|
4699
|
+
if (cached !== void 0) return cached;
|
|
4700
|
+
for (const [managedName, group] of Object.entries(getContractsByManagedName(namespace))) {
|
|
4701
|
+
const isAnyOfTheContracts = group.contracts.some(
|
|
4702
|
+
(_contract) => accountIdEqual(_contract, contract)
|
|
4703
|
+
);
|
|
4704
|
+
if (isAnyOfTheContracts) {
|
|
4705
|
+
const namespaceSpecific = MANAGED_NAME_BY_NAMESPACE[namespace]?.[managedName];
|
|
4706
|
+
const name = asInterpretedName(namespaceSpecific ?? managedName);
|
|
4707
|
+
const node = namehashInterpretedName3(name);
|
|
4708
|
+
const result = { name, node, registry: group.registry };
|
|
4709
|
+
cache.set(cacheKey, result);
|
|
4710
|
+
return result;
|
|
4711
|
+
}
|
|
4712
|
+
}
|
|
4713
|
+
throw new Error(
|
|
4714
|
+
`The following contract ${toJson(contract, { pretty: true })} does not have a configured Managed Name in namespace '${namespace}'.`
|
|
4715
|
+
);
|
|
4716
|
+
};
|
|
4717
|
+
var isNameWrapper = (namespace, contract) => {
|
|
4718
|
+
const ethnamesNameWrapper = getDatasourceContract(
|
|
4719
|
+
namespace,
|
|
4720
|
+
DatasourceNames2.ENSRoot,
|
|
4721
|
+
"NameWrapper"
|
|
4722
|
+
);
|
|
4723
|
+
if (accountIdEqual(ethnamesNameWrapper, contract)) return true;
|
|
4724
|
+
const lineanamesNameWrapper = maybeGetDatasourceContract(
|
|
4725
|
+
namespace,
|
|
4726
|
+
DatasourceNames2.Lineanames,
|
|
4727
|
+
"NameWrapper"
|
|
4728
|
+
);
|
|
4729
|
+
if (lineanamesNameWrapper && accountIdEqual(lineanamesNameWrapper, contract)) return true;
|
|
4730
|
+
return false;
|
|
4731
|
+
};
|
|
4732
|
+
|
|
4355
4733
|
// src/shared/namespace-specific-value.ts
|
|
4356
4734
|
function getNamespaceSpecificValue(namespace, value) {
|
|
4357
4735
|
return value[namespace] ?? value.default;
|
|
4358
4736
|
}
|
|
4359
4737
|
|
|
4738
|
+
// src/shared/replace-bigints.ts
|
|
4739
|
+
var replaceBigInts = (obj, replacer) => {
|
|
4740
|
+
if (typeof obj === "bigint") return replacer(obj);
|
|
4741
|
+
if (Array.isArray(obj))
|
|
4742
|
+
return obj.map((x) => replaceBigInts(x, replacer));
|
|
4743
|
+
if (obj && typeof obj === "object")
|
|
4744
|
+
return Object.fromEntries(
|
|
4745
|
+
Object.entries(obj).map(([k, v]) => [k, replaceBigInts(v, replacer)])
|
|
4746
|
+
);
|
|
4747
|
+
return obj;
|
|
4748
|
+
};
|
|
4749
|
+
|
|
4360
4750
|
// src/shared/root-registry.ts
|
|
4361
|
-
import {
|
|
4362
|
-
|
|
4363
|
-
|
|
4751
|
+
import {
|
|
4752
|
+
makeENSv1RegistryId,
|
|
4753
|
+
makeENSv1VirtualRegistryId,
|
|
4754
|
+
makeENSv2RegistryId
|
|
4755
|
+
} from "enssdk";
|
|
4756
|
+
import { DatasourceNames as DatasourceNames3 } from "@ensnode/datasources";
|
|
4757
|
+
var getENSv1Registry = (namespace) => getDatasourceContract(namespace, DatasourceNames3.ENSRoot, "ENSv1Registry");
|
|
4758
|
+
var getENSv1RootRegistryId = (namespace) => makeENSv1RegistryId(getENSv1Registry(namespace));
|
|
4364
4759
|
var isENSv1Registry = (namespace, contract) => accountIdEqual(getENSv1Registry(namespace), contract);
|
|
4365
|
-
var getENSv2RootRegistry = (namespace) => getDatasourceContract(namespace,
|
|
4366
|
-
var getENSv2RootRegistryId = (namespace) =>
|
|
4760
|
+
var getENSv2RootRegistry = (namespace) => getDatasourceContract(namespace, DatasourceNames3.ENSv2Root, "RootRegistry");
|
|
4761
|
+
var getENSv2RootRegistryId = (namespace) => makeENSv2RegistryId(getENSv2RootRegistry(namespace));
|
|
4367
4762
|
var isENSv2RootRegistry = (namespace, contract) => accountIdEqual(getENSv2RootRegistry(namespace), contract);
|
|
4368
|
-
var maybeGetENSv2RootRegistry = (namespace) => maybeGetDatasourceContract(namespace,
|
|
4763
|
+
var maybeGetENSv2RootRegistry = (namespace) => maybeGetDatasourceContract(namespace, DatasourceNames3.ENSv2Root, "RootRegistry");
|
|
4369
4764
|
var maybeGetENSv2RootRegistryId = (namespace) => {
|
|
4370
4765
|
const root = maybeGetENSv2RootRegistry(namespace);
|
|
4371
4766
|
if (!root) return void 0;
|
|
4372
|
-
return
|
|
4767
|
+
return makeENSv2RegistryId(root);
|
|
4768
|
+
};
|
|
4769
|
+
var getRootRegistryId = (namespace) => maybeGetENSv2RootRegistryId(namespace) ?? getENSv1RootRegistryId(namespace);
|
|
4770
|
+
var getRootRegistryIds = (namespace) => {
|
|
4771
|
+
const v1RootRegistryId = getENSv1RootRegistryId(namespace);
|
|
4772
|
+
const v2RootRegistryId = maybeGetENSv2RootRegistryId(namespace);
|
|
4773
|
+
const basenamesRegistry = maybeGetDatasourceContract(
|
|
4774
|
+
namespace,
|
|
4775
|
+
DatasourceNames3.Basenames,
|
|
4776
|
+
"Registry"
|
|
4777
|
+
);
|
|
4778
|
+
const lineanamesRegistry = maybeGetDatasourceContract(
|
|
4779
|
+
namespace,
|
|
4780
|
+
DatasourceNames3.Lineanames,
|
|
4781
|
+
"Registry"
|
|
4782
|
+
);
|
|
4783
|
+
return [
|
|
4784
|
+
v1RootRegistryId,
|
|
4785
|
+
basenamesRegistry && makeENSv1VirtualRegistryId(
|
|
4786
|
+
basenamesRegistry,
|
|
4787
|
+
getManagedName(namespace, basenamesRegistry).node
|
|
4788
|
+
),
|
|
4789
|
+
lineanamesRegistry && makeENSv1VirtualRegistryId(
|
|
4790
|
+
lineanamesRegistry,
|
|
4791
|
+
getManagedName(namespace, lineanamesRegistry).node
|
|
4792
|
+
),
|
|
4793
|
+
v2RootRegistryId
|
|
4794
|
+
].filter((id) => !!id);
|
|
4373
4795
|
};
|
|
4374
4796
|
|
|
4375
4797
|
// src/shared/url.ts
|
|
@@ -4380,16 +4802,6 @@ function isWebSocketProtocol(url) {
|
|
|
4380
4802
|
return ["ws:", "wss:"].includes(url.protocol);
|
|
4381
4803
|
}
|
|
4382
4804
|
|
|
4383
|
-
// src/stack-info/ensnode-stack-info.ts
|
|
4384
|
-
function buildEnsNodeStackInfo(ensApiPublicConfig, ensDbPublicConfig) {
|
|
4385
|
-
return {
|
|
4386
|
-
ensApi: ensApiPublicConfig,
|
|
4387
|
-
ensDb: ensDbPublicConfig,
|
|
4388
|
-
ensIndexer: ensApiPublicConfig.ensIndexerPublicConfig,
|
|
4389
|
-
ensRainbow: ensApiPublicConfig.ensIndexerPublicConfig.ensRainbowPublicConfig
|
|
4390
|
-
};
|
|
4391
|
-
}
|
|
4392
|
-
|
|
4393
4805
|
// src/subgraph-api/prerequisites.ts
|
|
4394
4806
|
function hasSubgraphApiConfigSupport(config) {
|
|
4395
4807
|
const supported = config.plugins.includes("subgraph" /* Subgraph */);
|
|
@@ -4441,13 +4853,14 @@ export {
|
|
|
4441
4853
|
DEFAULT_ENSNODE_URL_SEPOLIA,
|
|
4442
4854
|
ENCODED_REFERRER_BYTE_LENGTH,
|
|
4443
4855
|
ENCODED_REFERRER_BYTE_OFFSET,
|
|
4444
|
-
|
|
4856
|
+
ENSNamespaceIds4 as ENSNamespaceIds,
|
|
4445
4857
|
EXPECTED_ENCODED_REFERRER_PADDING,
|
|
4446
4858
|
EnsApiIndexingStatusResponseCodes,
|
|
4447
4859
|
EnsIndexerClient,
|
|
4448
4860
|
EnsIndexerIndexingStatusResponseCodes,
|
|
4449
4861
|
EnsNodeClient,
|
|
4450
4862
|
ForwardResolutionProtocolStep,
|
|
4863
|
+
IndexingMetadataContextStatusCodes,
|
|
4451
4864
|
IndexingStatusResponseCodes,
|
|
4452
4865
|
LruCache,
|
|
4453
4866
|
NFTMintStatuses,
|
|
@@ -4482,9 +4895,12 @@ export {
|
|
|
4482
4895
|
buildBlockRefRange,
|
|
4483
4896
|
buildCrossChainIndexingStatusSnapshotOmnichain,
|
|
4484
4897
|
buildEncodedReferrer,
|
|
4898
|
+
buildEnsIndexerStackInfo,
|
|
4485
4899
|
buildEnsNodeStackInfo,
|
|
4486
4900
|
buildEnsRainbowClientLabelSet,
|
|
4487
4901
|
buildIndexedBlockranges,
|
|
4902
|
+
buildIndexingMetadataContextInitialized,
|
|
4903
|
+
buildIndexingMetadataContextUninitialized,
|
|
4488
4904
|
buildLabelSetId,
|
|
4489
4905
|
buildLabelSetVersion,
|
|
4490
4906
|
buildOmnichainIndexingStatusSnapshot,
|
|
@@ -4493,6 +4909,7 @@ export {
|
|
|
4493
4909
|
buildUnvalidatedCrossChainIndexingStatusSnapshot,
|
|
4494
4910
|
buildUnvalidatedEnsApiPublicConfig,
|
|
4495
4911
|
buildUnvalidatedEnsIndexerPublicConfig,
|
|
4912
|
+
buildUnvalidatedEnsIndexerStackInfo,
|
|
4496
4913
|
buildUnvalidatedEnsNodeStackInfo,
|
|
4497
4914
|
buildUnvalidatedOmnichainIndexingStatusSnapshot,
|
|
4498
4915
|
buildUnvalidatedRealtimeIndexingStatusProjection,
|
|
@@ -4517,11 +4934,14 @@ export {
|
|
|
4517
4934
|
deserializeEnsIndexerConfigResponse,
|
|
4518
4935
|
deserializeEnsIndexerIndexingStatusResponse,
|
|
4519
4936
|
deserializeEnsIndexerPublicConfig,
|
|
4937
|
+
deserializeEnsIndexerStackInfo,
|
|
4520
4938
|
deserializeEnsNodeStackInfo,
|
|
4521
4939
|
deserializeErrorResponse2 as deserializeErrorResponse,
|
|
4940
|
+
deserializeIndexingMetadataContext,
|
|
4522
4941
|
deserializeIndexingStatusResponse,
|
|
4523
4942
|
deserializeOmnichainIndexingStatusSnapshot,
|
|
4524
4943
|
deserializePriceDai,
|
|
4944
|
+
deserializePriceEnsTokens,
|
|
4525
4945
|
deserializePriceEth,
|
|
4526
4946
|
deserializePriceUsdc,
|
|
4527
4947
|
deserializeRealtimeIndexingStatusProjection,
|
|
@@ -4531,21 +4951,17 @@ export {
|
|
|
4531
4951
|
deserializedNameTokensResponse,
|
|
4532
4952
|
durationBetween,
|
|
4533
4953
|
formatNFTTransferEventMetadata,
|
|
4534
|
-
getBasenamesSubregistryId,
|
|
4535
|
-
getBasenamesSubregistryManagedName,
|
|
4536
4954
|
getCurrencyInfo,
|
|
4537
4955
|
getDatasourceContract,
|
|
4538
4956
|
getDefaultEnsNodeUrl,
|
|
4539
4957
|
getENSRootChainId,
|
|
4540
4958
|
getENSv1Registry,
|
|
4959
|
+
getENSv1RootRegistryId,
|
|
4541
4960
|
getENSv2RootRegistry,
|
|
4542
4961
|
getENSv2RootRegistryId,
|
|
4543
|
-
getEthnamesSubregistryId,
|
|
4544
|
-
getEthnamesSubregistryManagedName,
|
|
4545
4962
|
getHighestKnownBlockTimestamp,
|
|
4546
4963
|
getLatestIndexedBlockRef,
|
|
4547
|
-
|
|
4548
|
-
getLineanamesSubregistryManagedName,
|
|
4964
|
+
getManagedName,
|
|
4549
4965
|
getNFTTransferType,
|
|
4550
4966
|
getNameTokenOwnership,
|
|
4551
4967
|
getNameWrapperAccounts,
|
|
@@ -4553,6 +4969,8 @@ export {
|
|
|
4553
4969
|
getOmnichainIndexingCursor,
|
|
4554
4970
|
getOmnichainIndexingStatus,
|
|
4555
4971
|
getResolvePrimaryNameChainIdParam,
|
|
4972
|
+
getRootRegistryId,
|
|
4973
|
+
getRootRegistryIds,
|
|
4556
4974
|
getTimestampForHighestOmnichainKnownBlock,
|
|
4557
4975
|
getTimestampForLowestOmnichainStartBlock,
|
|
4558
4976
|
hasNullByte,
|
|
@@ -4571,6 +4989,7 @@ export {
|
|
|
4571
4989
|
isENSv1Registry,
|
|
4572
4990
|
isENSv2RootRegistry,
|
|
4573
4991
|
isHttpProtocol,
|
|
4992
|
+
isNameWrapper,
|
|
4574
4993
|
isPccFuseSet,
|
|
4575
4994
|
isPriceCurrencyEqual,
|
|
4576
4995
|
isPriceEqual,
|
|
@@ -4598,14 +5017,17 @@ export {
|
|
|
4598
5017
|
parseAccountId,
|
|
4599
5018
|
parseAssetId,
|
|
4600
5019
|
parseDai,
|
|
5020
|
+
parseEnsTokens,
|
|
4601
5021
|
parseEth,
|
|
4602
5022
|
parseNonNegativeInteger,
|
|
4603
5023
|
parseTimestamp,
|
|
4604
5024
|
parseUsdc,
|
|
4605
5025
|
priceDai,
|
|
5026
|
+
priceEnsTokens,
|
|
4606
5027
|
priceEth,
|
|
4607
5028
|
priceUsdc,
|
|
4608
5029
|
registrarActionsFilter,
|
|
5030
|
+
replaceBigInts,
|
|
4609
5031
|
scaleBigintByNumber,
|
|
4610
5032
|
scalePrice,
|
|
4611
5033
|
serializeAssetId,
|
|
@@ -4622,8 +5044,11 @@ export {
|
|
|
4622
5044
|
serializeEnsIndexerConfigResponse,
|
|
4623
5045
|
serializeEnsIndexerIndexingStatusResponse,
|
|
4624
5046
|
serializeEnsIndexerPublicConfig,
|
|
5047
|
+
serializeEnsIndexerStackInfo,
|
|
4625
5048
|
serializeEnsNodeStackInfo,
|
|
4626
5049
|
serializeIndexedChainIds,
|
|
5050
|
+
serializeIndexingMetadataContext,
|
|
5051
|
+
serializeIndexingMetadataContextInitialized,
|
|
4627
5052
|
serializeIndexingStatusResponse,
|
|
4628
5053
|
serializeNameToken,
|
|
4629
5054
|
serializeNameTokensResponse,
|
|
@@ -4631,6 +5056,7 @@ export {
|
|
|
4631
5056
|
serializeOmnichainIndexingStatusSnapshot,
|
|
4632
5057
|
serializePrice,
|
|
4633
5058
|
serializePriceDai,
|
|
5059
|
+
serializePriceEnsTokens,
|
|
4634
5060
|
serializePriceEth,
|
|
4635
5061
|
serializePriceUsdc,
|
|
4636
5062
|
serializeRealtimeIndexingStatusProjection,
|
|
@@ -4642,13 +5068,17 @@ export {
|
|
|
4642
5068
|
sortChainStatusesByStartBlockAsc,
|
|
4643
5069
|
stripNullBytes,
|
|
4644
5070
|
subtractPrice,
|
|
5071
|
+
toJson,
|
|
4645
5072
|
translateDefaultableChainIdToChainId,
|
|
4646
5073
|
uniq,
|
|
4647
5074
|
validateChainIndexingStatusSnapshot,
|
|
4648
5075
|
validateCrossChainIndexingStatusSnapshot,
|
|
4649
5076
|
validateEnsIndexerPublicConfig,
|
|
4650
5077
|
validateEnsIndexerPublicConfigCompatibility,
|
|
5078
|
+
validateEnsIndexerStackInfo,
|
|
4651
5079
|
validateEnsIndexerVersionInfo,
|
|
5080
|
+
validateEnsNodeStackInfo,
|
|
5081
|
+
validateIndexingMetadataContextInitialized,
|
|
4652
5082
|
validateOmnichainIndexingStatusSnapshot,
|
|
4653
5083
|
validateRealtimeIndexingStatusProjection,
|
|
4654
5084
|
validateSupportedLabelSetAndVersion
|