@ensnode/ensnode-sdk 1.10.0 → 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 +768 -306
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +317 -93
- package/dist/index.d.ts +317 -93
- package/dist/index.js +684 -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
|
}
|
|
@@ -140,6 +152,32 @@ function addPrices(...prices) {
|
|
|
140
152
|
}
|
|
141
153
|
);
|
|
142
154
|
}
|
|
155
|
+
function subtractPrice(a, b) {
|
|
156
|
+
if (!isPriceCurrencyEqual(a, b)) {
|
|
157
|
+
throw new Error("All prices must have the same currency to be subtracted.");
|
|
158
|
+
}
|
|
159
|
+
const resultAmount = a.amount - b.amount;
|
|
160
|
+
if (resultAmount < 0n) {
|
|
161
|
+
throw new Error("subtractPrice result must be non-negative.");
|
|
162
|
+
}
|
|
163
|
+
return { amount: resultAmount, currency: a.currency };
|
|
164
|
+
}
|
|
165
|
+
function minPrice(...prices) {
|
|
166
|
+
const firstPrice = prices[0];
|
|
167
|
+
const allPricesInSameCurrency = prices.every((price) => isPriceCurrencyEqual(firstPrice, price));
|
|
168
|
+
if (allPricesInSameCurrency === false) {
|
|
169
|
+
throw new Error("All prices must have the same currency to be compared.");
|
|
170
|
+
}
|
|
171
|
+
return prices.reduce((acc, price) => price.amount < acc.amount ? price : acc);
|
|
172
|
+
}
|
|
173
|
+
function maxPrice(...prices) {
|
|
174
|
+
const firstPrice = prices[0];
|
|
175
|
+
const allPricesInSameCurrency = prices.every((price) => isPriceCurrencyEqual(firstPrice, price));
|
|
176
|
+
if (allPricesInSameCurrency === false) {
|
|
177
|
+
throw new Error("All prices must have the same currency to be compared.");
|
|
178
|
+
}
|
|
179
|
+
return prices.reduce((acc, price) => price.amount > acc.amount ? price : acc);
|
|
180
|
+
}
|
|
143
181
|
function scalePrice(price, scaleFactor) {
|
|
144
182
|
const scaledAmount = scaleBigintByNumber(price.amount, scaleFactor);
|
|
145
183
|
return {
|
|
@@ -177,6 +215,12 @@ function parseDai(value) {
|
|
|
177
215
|
const amount = parseUnits(value, currencyInfo2.decimals);
|
|
178
216
|
return priceDai(amount);
|
|
179
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
|
+
}
|
|
180
224
|
|
|
181
225
|
// src/shared/zod-schemas.ts
|
|
182
226
|
var makeIntegerSchema = (valueLabel = "Value") => z.int({
|
|
@@ -237,6 +281,7 @@ var makePriceCurrencySchema = (currency, valueLabel = "Price Currency") => z.str
|
|
|
237
281
|
var makePriceEthSchema = (valueLabel = "Price ETH") => makePriceCurrencySchema(CurrencyIds.ETH, valueLabel).transform((v) => v);
|
|
238
282
|
var makePriceUsdcSchema = (valueLabel = "Price USDC") => makePriceCurrencySchema(CurrencyIds.USDC, valueLabel).transform((v) => v);
|
|
239
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);
|
|
240
285
|
var makeAccountIdSchema = (valueLabel = "AccountId") => z.strictObject({
|
|
241
286
|
chainId: makeChainIdSchema(`${valueLabel} chain ID`),
|
|
242
287
|
address: makeNormalizedAddressSchema(`${valueLabel} address`)
|
|
@@ -291,14 +336,15 @@ var makeLabelSetIdSchema = (valueLabel = "Label set ID") => {
|
|
|
291
336
|
var makeLabelSetVersionSchema = (valueLabel = "Label set version") => makeNonNegativeIntegerSchema(valueLabel);
|
|
292
337
|
var makeLabelSetVersionStringSchema = (valueLabel = "Label set version") => z2.coerce.number({ error: `${valueLabel} must be a non-negative integer` }).pipe(makeLabelSetVersionSchema(valueLabel));
|
|
293
338
|
var makeEnsRainbowPublicConfigSchema = (valueLabel = "EnsRainbowPublicConfig") => z2.object({
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
labelSetId: makeLabelSetIdSchema(`${valueLabel}.labelSet.labelSetId`),
|
|
339
|
+
serverLabelSet: z2.object({
|
|
340
|
+
labelSetId: makeLabelSetIdSchema(`${valueLabel}.serverLabelSet.labelSetId`),
|
|
297
341
|
highestLabelSetVersion: makeLabelSetVersionSchema(
|
|
298
|
-
`${valueLabel}.
|
|
342
|
+
`${valueLabel}.serverLabelSet.highestLabelSetVersion`
|
|
299
343
|
)
|
|
300
344
|
}),
|
|
301
|
-
|
|
345
|
+
versionInfo: z2.object({
|
|
346
|
+
ensRainbow: z2.string().nonempty({ error: `${valueLabel}.versionInfo.ensRainbow must be a non-empty string.` })
|
|
347
|
+
})
|
|
302
348
|
});
|
|
303
349
|
|
|
304
350
|
// src/shared/collections.ts
|
|
@@ -323,8 +369,8 @@ var PluginName = /* @__PURE__ */ ((PluginName2) => {
|
|
|
323
369
|
// src/ensindexer/config/is-subgraph-compatible.ts
|
|
324
370
|
function isSubgraphCompatible(config) {
|
|
325
371
|
const onlySubgraphPluginActivated = config.plugins.length === 1 && config.plugins[0] === "subgraph" /* Subgraph */;
|
|
326
|
-
const isSubgraphLabelSet = config.
|
|
327
|
-
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;
|
|
328
374
|
const labelSetIsSubgraphCompatible = isSubgraphLabelSet || config.namespace === ENSNamespaceIds2.EnsTestEnv && isEnsTestEnvLabelSet;
|
|
329
375
|
return onlySubgraphPluginActivated && labelSetIsSubgraphCompatible;
|
|
330
376
|
}
|
|
@@ -422,13 +468,13 @@ function invariant_isSubgraphCompatibleRequirements(ctx) {
|
|
|
422
468
|
ctx.issues.push({
|
|
423
469
|
code: "custom",
|
|
424
470
|
input: config,
|
|
425
|
-
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}`
|
|
426
472
|
});
|
|
427
473
|
}
|
|
428
474
|
}
|
|
429
475
|
function invariant_ensRainbowSupportedLabelSetAndVersion(ctx) {
|
|
430
|
-
const clientLabelSet = ctx.value
|
|
431
|
-
const serverLabelSet = ctx.value.ensRainbowPublicConfig
|
|
476
|
+
const { clientLabelSet } = ctx.value;
|
|
477
|
+
const { serverLabelSet } = ctx.value.ensRainbowPublicConfig;
|
|
432
478
|
try {
|
|
433
479
|
validateSupportedLabelSetAndVersion(serverLabelSet, clientLabelSet);
|
|
434
480
|
} catch (error) {
|
|
@@ -449,7 +495,7 @@ var makeEnsIndexerPublicConfigSchema = (valueLabel = "ENSIndexerPublicConfig") =
|
|
|
449
495
|
isSubgraphCompatible: z3.boolean({
|
|
450
496
|
error: `${valueLabel}.isSubgraphCompatible must be a boolean value.`
|
|
451
497
|
}),
|
|
452
|
-
|
|
498
|
+
clientLabelSet: makeFullyPinnedLabelSetSchema(`${valueLabel}.clientLabelSet`),
|
|
453
499
|
namespace: makeENSNamespaceIdSchema(`${valueLabel}.namespace`),
|
|
454
500
|
plugins: makePluginsListSchema(`${valueLabel}.plugins`),
|
|
455
501
|
versionInfo: makeEnsIndexerVersionInfoSchema(`${valueLabel}.versionInfo`)
|
|
@@ -463,7 +509,7 @@ var makeSerializedEnsIndexerPublicConfigSchema = (valueLabel = "Serialized ENSIn
|
|
|
463
509
|
isSubgraphCompatible: z3.boolean({
|
|
464
510
|
error: `${valueLabel}.isSubgraphCompatible must be a boolean value.`
|
|
465
511
|
}),
|
|
466
|
-
|
|
512
|
+
clientLabelSet: makeFullyPinnedLabelSetSchema(`${valueLabel}.clientLabelSet`),
|
|
467
513
|
namespace: makeENSNamespaceIdSchema(`${valueLabel}.namespace`),
|
|
468
514
|
plugins: makePluginsListSchema(`${valueLabel}.plugins`),
|
|
469
515
|
versionInfo: makeEnsIndexerVersionInfoSchema(`${valueLabel}.versionInfo`)
|
|
@@ -563,7 +609,7 @@ function serializeEnsIndexerPublicConfig(config) {
|
|
|
563
609
|
ensRainbowPublicConfig,
|
|
564
610
|
indexedChainIds,
|
|
565
611
|
isSubgraphCompatible: isSubgraphCompatible2,
|
|
566
|
-
|
|
612
|
+
clientLabelSet,
|
|
567
613
|
namespace,
|
|
568
614
|
plugins,
|
|
569
615
|
versionInfo
|
|
@@ -573,7 +619,7 @@ function serializeEnsIndexerPublicConfig(config) {
|
|
|
573
619
|
ensRainbowPublicConfig,
|
|
574
620
|
indexedChainIds: serializeIndexedChainIds(indexedChainIds),
|
|
575
621
|
isSubgraphCompatible: isSubgraphCompatible2,
|
|
576
|
-
|
|
622
|
+
clientLabelSet,
|
|
577
623
|
namespace,
|
|
578
624
|
plugins,
|
|
579
625
|
versionInfo
|
|
@@ -1612,6 +1658,9 @@ function serializePriceUsdc(price) {
|
|
|
1612
1658
|
function serializePriceDai(price) {
|
|
1613
1659
|
return serializePrice(price);
|
|
1614
1660
|
}
|
|
1661
|
+
function serializePriceEnsTokens(price) {
|
|
1662
|
+
return serializePrice(price);
|
|
1663
|
+
}
|
|
1615
1664
|
|
|
1616
1665
|
// src/indexing-status/serialize/chain-indexing-status-snapshot.ts
|
|
1617
1666
|
function serializeChainIndexingSnapshots(chains) {
|
|
@@ -1818,21 +1867,21 @@ function validateEnsIndexerPublicConfigCompatibility(configA, configB) {
|
|
|
1818
1867
|
].join(" ")
|
|
1819
1868
|
);
|
|
1820
1869
|
}
|
|
1821
|
-
if (configA.
|
|
1870
|
+
if (configA.clientLabelSet.labelSetId !== configB.clientLabelSet.labelSetId) {
|
|
1822
1871
|
throw new Error(
|
|
1823
1872
|
[
|
|
1824
|
-
`'
|
|
1825
|
-
`Stored Config '
|
|
1826
|
-
`Current Config '
|
|
1873
|
+
`'clientLabelSet.labelSetId' must be compatible.`,
|
|
1874
|
+
`Stored Config 'clientLabelSet.labelSetId': '${configA.clientLabelSet.labelSetId}'.`,
|
|
1875
|
+
`Current Config 'clientLabelSet.labelSetId': '${configB.clientLabelSet.labelSetId}'.`
|
|
1827
1876
|
].join(" ")
|
|
1828
1877
|
);
|
|
1829
1878
|
}
|
|
1830
|
-
if (configA.
|
|
1879
|
+
if (configA.clientLabelSet.labelSetVersion !== configB.clientLabelSet.labelSetVersion) {
|
|
1831
1880
|
throw new Error(
|
|
1832
1881
|
[
|
|
1833
|
-
`'
|
|
1834
|
-
`Stored Config '
|
|
1835
|
-
`Current Config '
|
|
1882
|
+
`'clientLabelSet.labelSetVersion' must be compatible.`,
|
|
1883
|
+
`Stored Config 'clientLabelSet.labelSetVersion': '${configA.clientLabelSet.labelSetVersion}'.`,
|
|
1884
|
+
`Current Config 'clientLabelSet.labelSetVersion': '${configB.clientLabelSet.labelSetVersion}'.`
|
|
1836
1885
|
].join(" ")
|
|
1837
1886
|
);
|
|
1838
1887
|
}
|
|
@@ -1923,12 +1972,12 @@ function validateEnsIndexerVersionInfo(unvalidatedVersionInfo) {
|
|
|
1923
1972
|
}
|
|
1924
1973
|
|
|
1925
1974
|
// src/ensnode/api/indexing-status/deserialize.ts
|
|
1926
|
-
import { prettifyError as
|
|
1975
|
+
import { prettifyError as prettifyError14 } from "zod/v4";
|
|
1927
1976
|
|
|
1928
1977
|
// src/stack-info/deserialize/ensnode-stack-info.ts
|
|
1929
|
-
import { prettifyError as
|
|
1978
|
+
import { prettifyError as prettifyError13 } from "zod/v4";
|
|
1930
1979
|
|
|
1931
|
-
// src/stack-info/zod-schemas/
|
|
1980
|
+
// src/stack-info/zod-schemas/ensindexer-stack-info.ts
|
|
1932
1981
|
import { z as z13 } from "zod/v4";
|
|
1933
1982
|
|
|
1934
1983
|
// src/ensdb/zod-schemas/config.ts
|
|
@@ -1937,49 +1986,134 @@ var makeEnsDbVersionInfoSchema = (valueLabel) => {
|
|
|
1937
1986
|
const label = valueLabel ?? "EnsDbVersionInfo";
|
|
1938
1987
|
return z12.object({
|
|
1939
1988
|
postgresql: z12.string().nonempty(`${label}.postgresql must be a non-empty string`).describe("Version of the PostgreSQL server hosting the ENSDb instance.")
|
|
1940
|
-
})
|
|
1989
|
+
});
|
|
1941
1990
|
};
|
|
1942
1991
|
var makeEnsDbPublicConfigSchema = (valueLabel) => {
|
|
1943
1992
|
const label = valueLabel ?? "EnsDbPublicConfig";
|
|
1944
1993
|
return z12.object({
|
|
1945
1994
|
versionInfo: makeEnsDbVersionInfoSchema(`${label}.versionInfo`)
|
|
1946
|
-
})
|
|
1995
|
+
});
|
|
1947
1996
|
};
|
|
1948
1997
|
|
|
1949
|
-
// src/stack-info/zod-schemas/
|
|
1950
|
-
function
|
|
1951
|
-
const label = valueLabel ?? "
|
|
1998
|
+
// src/stack-info/zod-schemas/ensindexer-stack-info.ts
|
|
1999
|
+
function makeSerializedEnsIndexerStackInfoSchema(valueLabel) {
|
|
2000
|
+
const label = valueLabel ?? "ENSIndexerStackInfo";
|
|
1952
2001
|
return z13.object({
|
|
1953
|
-
ensApi: makeSerializedEnsApiPublicConfigSchema(`${label}.ensApi`),
|
|
1954
2002
|
ensDb: makeEnsDbPublicConfigSchema(`${label}.ensDb`),
|
|
1955
2003
|
ensIndexer: makeSerializedEnsIndexerPublicConfigSchema(`${label}.ensIndexer`),
|
|
1956
|
-
ensRainbow: makeEnsRainbowPublicConfigSchema(`${label}.ensRainbow`)
|
|
2004
|
+
ensRainbow: makeEnsRainbowPublicConfigSchema(`${label}.ensRainbow`)
|
|
1957
2005
|
});
|
|
1958
2006
|
}
|
|
1959
|
-
function
|
|
1960
|
-
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";
|
|
1961
2028
|
return z13.object({
|
|
1962
|
-
ensApi: makeEnsApiPublicConfigSchema(`${label}.ensApi`),
|
|
1963
2029
|
ensDb: makeEnsDbPublicConfigSchema(`${label}.ensDb`),
|
|
1964
2030
|
ensIndexer: makeEnsIndexerPublicConfigSchema(`${label}.ensIndexer`),
|
|
1965
|
-
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`)
|
|
1966
2075
|
});
|
|
1967
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
|
+
}
|
|
1968
2104
|
|
|
1969
2105
|
// src/stack-info/deserialize/ensnode-stack-info.ts
|
|
1970
2106
|
function buildUnvalidatedEnsNodeStackInfo(serializedStackInfo) {
|
|
1971
|
-
const { ensApi, ensIndexer, ...rest } = serializedStackInfo;
|
|
1972
2107
|
return {
|
|
1973
|
-
...
|
|
1974
|
-
ensApi: buildUnvalidatedEnsApiPublicConfig(ensApi)
|
|
1975
|
-
ensIndexer: buildUnvalidatedEnsIndexerPublicConfig(ensIndexer)
|
|
2108
|
+
...buildUnvalidatedEnsIndexerStackInfo(serializedStackInfo),
|
|
2109
|
+
ensApi: buildUnvalidatedEnsApiPublicConfig(serializedStackInfo.ensApi)
|
|
1976
2110
|
};
|
|
1977
2111
|
}
|
|
1978
2112
|
function deserializeEnsNodeStackInfo(maybeStackInfo, valueLabel) {
|
|
1979
2113
|
const parsed = makeSerializedEnsNodeStackInfoSchema(valueLabel).transform(buildUnvalidatedEnsNodeStackInfo).pipe(makeEnsNodeStackInfoSchema(valueLabel)).safeParse(maybeStackInfo);
|
|
1980
2114
|
if (parsed.error) {
|
|
1981
2115
|
throw new Error(`Cannot deserialize EnsNodeStackInfo:
|
|
1982
|
-
${
|
|
2116
|
+
${prettifyError13(parsed.error)}
|
|
1983
2117
|
`);
|
|
1984
2118
|
}
|
|
1985
2119
|
return parsed.data;
|
|
@@ -2039,7 +2173,7 @@ function deserializeEnsApiIndexingStatusResponse(maybeResponse) {
|
|
|
2039
2173
|
if (parsed.error) {
|
|
2040
2174
|
throw new Error(
|
|
2041
2175
|
`Cannot deserialize EnsApiIndexingStatusResponse:
|
|
2042
|
-
${
|
|
2176
|
+
${prettifyError14(parsed.error)}
|
|
2043
2177
|
`
|
|
2044
2178
|
);
|
|
2045
2179
|
}
|
|
@@ -2047,13 +2181,26 @@ ${prettifyError13(parsed.error)}
|
|
|
2047
2181
|
}
|
|
2048
2182
|
var deserializeIndexingStatusResponse = deserializeEnsApiIndexingStatusResponse;
|
|
2049
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
|
+
|
|
2050
2199
|
// src/stack-info/serialize/ensnode-stack-info.ts
|
|
2051
2200
|
function serializeEnsNodeStackInfo(stackInfo) {
|
|
2052
2201
|
return {
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
ensIndexer: serializeEnsIndexerPublicConfig(stackInfo.ensIndexer),
|
|
2056
|
-
ensRainbow: stackInfo.ensRainbow
|
|
2202
|
+
...serializeEnsIndexerStackInfo(stackInfo),
|
|
2203
|
+
ensApi: serializeEnsApiPublicConfig(stackInfo.ensApi)
|
|
2057
2204
|
};
|
|
2058
2205
|
}
|
|
2059
2206
|
|
|
@@ -2073,7 +2220,7 @@ function serializeEnsApiIndexingStatusResponse(response) {
|
|
|
2073
2220
|
var serializeIndexingStatusResponse = serializeEnsApiIndexingStatusResponse;
|
|
2074
2221
|
|
|
2075
2222
|
// src/ensnode/api/name-tokens/deserialize.ts
|
|
2076
|
-
import { prettifyError as
|
|
2223
|
+
import { prettifyError as prettifyError16 } from "zod/v4";
|
|
2077
2224
|
|
|
2078
2225
|
// src/ensnode/api/name-tokens/zod-schemas.ts
|
|
2079
2226
|
import { namehashInterpretedName } from "enssdk";
|
|
@@ -2123,7 +2270,7 @@ import {
|
|
|
2123
2270
|
stringifyAssetId
|
|
2124
2271
|
} from "enssdk";
|
|
2125
2272
|
import { isAddressEqual as isAddressEqual2, zeroAddress as zeroAddress2 } from "viem";
|
|
2126
|
-
import { prettifyError as
|
|
2273
|
+
import { prettifyError as prettifyError15 } from "zod/v4";
|
|
2127
2274
|
|
|
2128
2275
|
// src/tokenscope/zod-schemas.ts
|
|
2129
2276
|
import { AssetId as CaipAssetId } from "caip";
|
|
@@ -2224,7 +2371,7 @@ function deserializeAssetId(maybeAssetId, valueLabel) {
|
|
|
2224
2371
|
const parsed = schema.safeParse(maybeAssetId);
|
|
2225
2372
|
if (parsed.error) {
|
|
2226
2373
|
throw new RangeError(`Cannot deserialize AssetId:
|
|
2227
|
-
${
|
|
2374
|
+
${prettifyError15(parsed.error)}
|
|
2228
2375
|
`);
|
|
2229
2376
|
}
|
|
2230
2377
|
return parsed.data;
|
|
@@ -2234,7 +2381,7 @@ function parseAssetId(maybeAssetId, valueLabel) {
|
|
|
2234
2381
|
const parsed = schema.safeParse(maybeAssetId);
|
|
2235
2382
|
if (parsed.error) {
|
|
2236
2383
|
throw new RangeError(`Cannot parse AssetId:
|
|
2237
|
-
${
|
|
2384
|
+
${prettifyError15(parsed.error)}
|
|
2238
2385
|
`);
|
|
2239
2386
|
}
|
|
2240
2387
|
return parsed.data;
|
|
@@ -2660,7 +2807,7 @@ function deserializedNameTokensResponse(maybeResponse) {
|
|
|
2660
2807
|
);
|
|
2661
2808
|
if (parsed.error) {
|
|
2662
2809
|
throw new Error(`Cannot deserialize NameTokensResponse:
|
|
2663
|
-
${
|
|
2810
|
+
${prettifyError16(parsed.error)}
|
|
2664
2811
|
`);
|
|
2665
2812
|
}
|
|
2666
2813
|
return parsed.data;
|
|
@@ -2734,7 +2881,7 @@ function serializeNameTokensResponse(response) {
|
|
|
2734
2881
|
}
|
|
2735
2882
|
|
|
2736
2883
|
// src/ensnode/api/registrar-actions/deserialize.ts
|
|
2737
|
-
import { prettifyError as
|
|
2884
|
+
import { prettifyError as prettifyError17 } from "zod/v4";
|
|
2738
2885
|
|
|
2739
2886
|
// src/ensnode/api/registrar-actions/zod-schemas.ts
|
|
2740
2887
|
import { namehashInterpretedName as namehashInterpretedName2 } from "enssdk";
|
|
@@ -3038,7 +3185,7 @@ function deserializeRegistrarActionsResponse(maybeResponse) {
|
|
|
3038
3185
|
if (parsed.error) {
|
|
3039
3186
|
throw new Error(
|
|
3040
3187
|
`Cannot deserialize RegistrarActionsResponse:
|
|
3041
|
-
${
|
|
3188
|
+
${prettifyError17(parsed.error)}
|
|
3042
3189
|
`
|
|
3043
3190
|
);
|
|
3044
3191
|
}
|
|
@@ -3175,12 +3322,12 @@ function serializeRegistrarActionsResponse(response) {
|
|
|
3175
3322
|
}
|
|
3176
3323
|
|
|
3177
3324
|
// src/ensnode/api/shared/errors/deserialize.ts
|
|
3178
|
-
import { prettifyError as
|
|
3325
|
+
import { prettifyError as prettifyError18 } from "zod/v4";
|
|
3179
3326
|
function deserializeErrorResponse2(maybeErrorResponse) {
|
|
3180
3327
|
const parsed = makeErrorResponseSchema().safeParse(maybeErrorResponse);
|
|
3181
3328
|
if (parsed.error) {
|
|
3182
3329
|
throw new Error(`Cannot deserialize ErrorResponse:
|
|
3183
|
-
${
|
|
3330
|
+
${prettifyError18(parsed.error)}
|
|
3184
3331
|
`);
|
|
3185
3332
|
}
|
|
3186
3333
|
return parsed.data;
|
|
@@ -3710,51 +3857,18 @@ var EnsNodeClient = class _EnsNodeClient {
|
|
|
3710
3857
|
}
|
|
3711
3858
|
};
|
|
3712
3859
|
|
|
3713
|
-
// src/
|
|
3714
|
-
import {
|
|
3715
|
-
|
|
3716
|
-
// src/identity/types.ts
|
|
3717
|
-
var ResolutionStatusIds = {
|
|
3718
|
-
/**
|
|
3719
|
-
* Represents that the `Identity` is not resolved yet.
|
|
3720
|
-
*/
|
|
3721
|
-
Unresolved: "unresolved",
|
|
3722
|
-
/**
|
|
3723
|
-
* Represents that resolution of the `Identity` resulted in a named identity.
|
|
3724
|
-
*/
|
|
3725
|
-
Named: "named",
|
|
3726
|
-
/**
|
|
3727
|
-
* Represents that resolution of the `Identity` resulted in an unnamed identity.
|
|
3728
|
-
*/
|
|
3729
|
-
Unnamed: "unnamed",
|
|
3730
|
-
/**
|
|
3731
|
-
* Represents that attempted resolution of the `Identity` resulted in an error
|
|
3732
|
-
* and therefore it is unknown if the `Identity` resolves to a named or unnamed identity.
|
|
3733
|
-
*/
|
|
3734
|
-
Unknown: "unknown"
|
|
3735
|
-
};
|
|
3736
|
-
|
|
3737
|
-
// src/identity/identity.ts
|
|
3738
|
-
function buildUnresolvedIdentity(address, namespaceId, chainId) {
|
|
3739
|
-
return {
|
|
3740
|
-
resolutionStatus: ResolutionStatusIds.Unresolved,
|
|
3741
|
-
chainId: chainId ?? getENSRootChainId2(namespaceId),
|
|
3742
|
-
address
|
|
3743
|
-
};
|
|
3744
|
-
}
|
|
3745
|
-
function isResolvedIdentity(identity) {
|
|
3746
|
-
return identity.resolutionStatus !== ResolutionStatusIds.Unresolved;
|
|
3747
|
-
}
|
|
3860
|
+
// src/ensnode/metadata/deserialize/indexing-metadata-context.ts
|
|
3861
|
+
import { prettifyError as prettifyError25 } from "zod/v4";
|
|
3748
3862
|
|
|
3749
3863
|
// src/indexing-status/deserialize/chain-indexing-status-snapshot.ts
|
|
3750
|
-
import { prettifyError as
|
|
3864
|
+
import { prettifyError as prettifyError19 } from "zod/v4";
|
|
3751
3865
|
function deserializeChainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
3752
3866
|
const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
|
|
3753
3867
|
const parsed = schema.safeParse(maybeSnapshot);
|
|
3754
3868
|
if (parsed.error) {
|
|
3755
3869
|
throw new Error(
|
|
3756
3870
|
`Cannot deserialize into ChainIndexingStatusSnapshot:
|
|
3757
|
-
${
|
|
3871
|
+
${prettifyError19(parsed.error)}
|
|
3758
3872
|
`
|
|
3759
3873
|
);
|
|
3760
3874
|
}
|
|
@@ -3772,133 +3886,256 @@ function createRealtimeIndexingStatusProjection(snapshot, now) {
|
|
|
3772
3886
|
}
|
|
3773
3887
|
|
|
3774
3888
|
// src/indexing-status/validate/chain-indexing-status-snapshot.ts
|
|
3775
|
-
import { prettifyError as
|
|
3889
|
+
import { prettifyError as prettifyError20 } from "zod/v4";
|
|
3776
3890
|
function validateChainIndexingStatusSnapshot(unvalidatedSnapshot, valueLabel) {
|
|
3777
3891
|
const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
|
|
3778
3892
|
const parsed = schema.safeParse(unvalidatedSnapshot);
|
|
3779
3893
|
if (parsed.error) {
|
|
3780
3894
|
throw new Error(`Invalid ChainIndexingStatusSnapshot:
|
|
3781
|
-
${
|
|
3895
|
+
${prettifyError20(parsed.error)}
|
|
3782
3896
|
`);
|
|
3783
3897
|
}
|
|
3784
3898
|
return parsed.data;
|
|
3785
3899
|
}
|
|
3786
3900
|
|
|
3787
3901
|
// src/indexing-status/validate/realtime-indexing-status-projection.ts
|
|
3788
|
-
import { prettifyError as
|
|
3902
|
+
import { prettifyError as prettifyError21 } from "zod/v4";
|
|
3789
3903
|
function validateRealtimeIndexingStatusProjection(unvalidatedProjection, valueLabel) {
|
|
3790
3904
|
const schema = makeRealtimeIndexingStatusProjectionSchema(valueLabel);
|
|
3791
3905
|
const parsed = schema.safeParse(unvalidatedProjection);
|
|
3792
3906
|
if (parsed.error) {
|
|
3793
3907
|
throw new Error(`Invalid RealtimeIndexingStatusProjection:
|
|
3794
|
-
${
|
|
3908
|
+
${prettifyError21(parsed.error)}
|
|
3795
3909
|
`);
|
|
3796
3910
|
}
|
|
3797
3911
|
return parsed.data;
|
|
3798
3912
|
}
|
|
3799
3913
|
|
|
3800
|
-
// src/
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
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;
|
|
3808
3924
|
}
|
|
3809
3925
|
|
|
3810
|
-
// src/
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
}
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
const
|
|
3823
|
-
if (
|
|
3824
|
-
throw new Error(`
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
}
|
|
3828
|
-
function getBasenamesSubregistryManagedName(namespaceId) {
|
|
3829
|
-
switch (namespaceId) {
|
|
3830
|
-
case ENSNamespaceIds4.Mainnet:
|
|
3831
|
-
return asInterpretedName("base.eth");
|
|
3832
|
-
case ENSNamespaceIds4.Sepolia:
|
|
3833
|
-
case ENSNamespaceIds4.SepoliaV2:
|
|
3834
|
-
return asInterpretedName("basetest.eth");
|
|
3835
|
-
case ENSNamespaceIds4.EnsTestEnv:
|
|
3836
|
-
throw new Error(
|
|
3837
|
-
`No registrar managed name is known for the 'basenames' subregistry within the "${namespaceId}" namespace.`
|
|
3838
|
-
);
|
|
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
|
+
`);
|
|
3839
3943
|
}
|
|
3944
|
+
return parsed.data;
|
|
3840
3945
|
}
|
|
3841
3946
|
|
|
3842
|
-
// src/
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
}
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
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
|
+
`);
|
|
3853
4014
|
}
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
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);
|
|
3857
4060
|
}
|
|
3858
|
-
return { chainId: datasource.chain.id, address };
|
|
3859
4061
|
}
|
|
3860
|
-
function
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
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
|
+
);
|
|
3867
4071
|
}
|
|
4072
|
+
return parsed.data;
|
|
3868
4073
|
}
|
|
3869
4074
|
|
|
3870
|
-
// src/
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
}
|
|
3886
|
-
return { chainId: datasource.chain.id, address };
|
|
3887
|
-
}
|
|
3888
|
-
function getLineanamesSubregistryManagedName(namespaceId) {
|
|
3889
|
-
switch (namespaceId) {
|
|
3890
|
-
case ENSNamespaceIds6.Mainnet:
|
|
3891
|
-
return asInterpretedName3("linea.eth");
|
|
3892
|
-
case ENSNamespaceIds6.Sepolia:
|
|
3893
|
-
case ENSNamespaceIds6.SepoliaV2:
|
|
3894
|
-
return asInterpretedName3("linea-sepolia.eth");
|
|
3895
|
-
case ENSNamespaceIds6.EnsTestEnv:
|
|
3896
|
-
throw new Error(
|
|
3897
|
-
`No registrar managed name is known for the 'Lineanames' subregistry within the "${namespaceId}" namespace.`
|
|
3898
|
-
);
|
|
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);
|
|
3899
4090
|
}
|
|
3900
4091
|
}
|
|
3901
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
|
+
|
|
3902
4139
|
// src/registrars/registration-expiration.ts
|
|
3903
4140
|
function isRegistrationExpired(info, now) {
|
|
3904
4141
|
if (info.expiry == null) return false;
|
|
@@ -3986,13 +4223,13 @@ import { getUnixTime as getUnixTime2 } from "date-fns/getUnixTime";
|
|
|
3986
4223
|
import { getUnixTime } from "date-fns/getUnixTime";
|
|
3987
4224
|
|
|
3988
4225
|
// src/shared/deserialize.ts
|
|
3989
|
-
import
|
|
4226
|
+
import z22, { prettifyError as prettifyError26 } from "zod/v4";
|
|
3990
4227
|
function deserializeChainId(maybeChainId, valueLabel) {
|
|
3991
4228
|
const schema = makeChainIdStringSchema(valueLabel);
|
|
3992
4229
|
const parsed = schema.safeParse(maybeChainId);
|
|
3993
4230
|
if (parsed.error) {
|
|
3994
4231
|
throw new Error(`Cannot deserialize ChainId:
|
|
3995
|
-
${
|
|
4232
|
+
${prettifyError26(parsed.error)}
|
|
3996
4233
|
`);
|
|
3997
4234
|
}
|
|
3998
4235
|
return parsed.data;
|
|
@@ -4002,7 +4239,7 @@ function deserializeDatetime(maybeDatetime, valueLabel) {
|
|
|
4002
4239
|
const parsed = schema.safeParse(maybeDatetime);
|
|
4003
4240
|
if (parsed.error) {
|
|
4004
4241
|
throw new Error(`Cannot deserialize Datetime:
|
|
4005
|
-
${
|
|
4242
|
+
${prettifyError26(parsed.error)}
|
|
4006
4243
|
`);
|
|
4007
4244
|
}
|
|
4008
4245
|
return parsed.data;
|
|
@@ -4012,7 +4249,7 @@ function deserializeUnixTimestamp(maybeTimestamp, valueLabel) {
|
|
|
4012
4249
|
const parsed = schema.safeParse(maybeTimestamp);
|
|
4013
4250
|
if (parsed.error) {
|
|
4014
4251
|
throw new Error(`Cannot deserialize Unix Timestamp:
|
|
4015
|
-
${
|
|
4252
|
+
${prettifyError26(parsed.error)}
|
|
4016
4253
|
`);
|
|
4017
4254
|
}
|
|
4018
4255
|
return parsed.data;
|
|
@@ -4022,7 +4259,7 @@ function deserializeUrl(maybeUrl, valueLabel) {
|
|
|
4022
4259
|
const parsed = schema.safeParse(maybeUrl);
|
|
4023
4260
|
if (parsed.error) {
|
|
4024
4261
|
throw new Error(`Cannot deserialize URL:
|
|
4025
|
-
${
|
|
4262
|
+
${prettifyError26(parsed.error)}
|
|
4026
4263
|
`);
|
|
4027
4264
|
}
|
|
4028
4265
|
return parsed.data;
|
|
@@ -4032,7 +4269,7 @@ function deserializeBlockNumber(maybeBlockNumber, valueLabel) {
|
|
|
4032
4269
|
const parsed = schema.safeParse(maybeBlockNumber);
|
|
4033
4270
|
if (parsed.error) {
|
|
4034
4271
|
throw new Error(`Cannot deserialize BlockNumber:
|
|
4035
|
-
${
|
|
4272
|
+
${prettifyError26(parsed.error)}
|
|
4036
4273
|
`);
|
|
4037
4274
|
}
|
|
4038
4275
|
return parsed.data;
|
|
@@ -4042,17 +4279,17 @@ function deserializeBlockRef(maybeBlockRef, valueLabel) {
|
|
|
4042
4279
|
const parsed = schema.safeParse(maybeBlockRef);
|
|
4043
4280
|
if (parsed.error) {
|
|
4044
4281
|
throw new Error(`Cannot deserialize BlockRef:
|
|
4045
|
-
${
|
|
4282
|
+
${prettifyError26(parsed.error)}
|
|
4046
4283
|
`);
|
|
4047
4284
|
}
|
|
4048
4285
|
return parsed.data;
|
|
4049
4286
|
}
|
|
4050
4287
|
function deserializeDuration(maybeDuration, valueLabel) {
|
|
4051
|
-
const schema =
|
|
4288
|
+
const schema = z22.coerce.number().pipe(makeDurationSchema(valueLabel));
|
|
4052
4289
|
const parsed = schema.safeParse(maybeDuration);
|
|
4053
4290
|
if (parsed.error) {
|
|
4054
4291
|
throw new RangeError(`Cannot deserialize Duration:
|
|
4055
|
-
${
|
|
4292
|
+
${prettifyError26(parsed.error)}
|
|
4056
4293
|
`);
|
|
4057
4294
|
}
|
|
4058
4295
|
return parsed.data;
|
|
@@ -4062,7 +4299,7 @@ function parseAccountId(maybeAccountId, valueLabel) {
|
|
|
4062
4299
|
const parsed = schema.safeParse(maybeAccountId);
|
|
4063
4300
|
if (parsed.error) {
|
|
4064
4301
|
throw new RangeError(`Cannot deserialize AccountId:
|
|
4065
|
-
${
|
|
4302
|
+
${prettifyError26(parsed.error)}
|
|
4066
4303
|
`);
|
|
4067
4304
|
}
|
|
4068
4305
|
return parsed.data;
|
|
@@ -4072,7 +4309,7 @@ function deserializePriceEth(maybePrice, valueLabel) {
|
|
|
4072
4309
|
const parsed = schema.safeParse(maybePrice);
|
|
4073
4310
|
if (parsed.error) {
|
|
4074
4311
|
throw new Error(`Cannot deserialize PriceEth:
|
|
4075
|
-
${
|
|
4312
|
+
${prettifyError26(parsed.error)}
|
|
4076
4313
|
`);
|
|
4077
4314
|
}
|
|
4078
4315
|
return parsed.data;
|
|
@@ -4082,7 +4319,7 @@ function deserializePriceUsdc(maybePrice, valueLabel) {
|
|
|
4082
4319
|
const parsed = schema.safeParse(maybePrice);
|
|
4083
4320
|
if (parsed.error) {
|
|
4084
4321
|
throw new Error(`Cannot deserialize PriceUsdc:
|
|
4085
|
-
${
|
|
4322
|
+
${prettifyError26(parsed.error)}
|
|
4086
4323
|
`);
|
|
4087
4324
|
}
|
|
4088
4325
|
return parsed.data;
|
|
@@ -4092,7 +4329,17 @@ function deserializePriceDai(maybePrice, valueLabel) {
|
|
|
4092
4329
|
const parsed = schema.safeParse(maybePrice);
|
|
4093
4330
|
if (parsed.error) {
|
|
4094
4331
|
throw new Error(`Cannot deserialize PriceDai:
|
|
4095
|
-
${
|
|
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)}
|
|
4096
4343
|
`);
|
|
4097
4344
|
}
|
|
4098
4345
|
return parsed.data;
|
|
@@ -4245,13 +4492,13 @@ var TtlCache = class {
|
|
|
4245
4492
|
|
|
4246
4493
|
// src/shared/config/indexed-blockranges.ts
|
|
4247
4494
|
import {
|
|
4248
|
-
maybeGetDatasource as
|
|
4495
|
+
maybeGetDatasource as maybeGetDatasource2
|
|
4249
4496
|
} from "@ensnode/datasources";
|
|
4250
4497
|
function buildIndexedBlockranges(namespace, pluginsDatasourceNames) {
|
|
4251
4498
|
const indexedBlockranges = /* @__PURE__ */ new Map();
|
|
4252
4499
|
for (const [, datasourceNames] of pluginsDatasourceNames) {
|
|
4253
4500
|
for (const datasourceName of datasourceNames) {
|
|
4254
|
-
const datasource =
|
|
4501
|
+
const datasource = maybeGetDatasource2(namespace, datasourceName);
|
|
4255
4502
|
if (!datasource) continue;
|
|
4256
4503
|
const datasourceChainId = datasource.chain.id;
|
|
4257
4504
|
const datasourceContracts = Object.values(datasource.contracts);
|
|
@@ -4326,24 +4573,225 @@ function interpretDnszonehashValue(value) {
|
|
|
4326
4573
|
return value;
|
|
4327
4574
|
}
|
|
4328
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
|
+
|
|
4329
4733
|
// src/shared/namespace-specific-value.ts
|
|
4330
4734
|
function getNamespaceSpecificValue(namespace, value) {
|
|
4331
4735
|
return value[namespace] ?? value.default;
|
|
4332
4736
|
}
|
|
4333
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
|
+
|
|
4334
4750
|
// src/shared/root-registry.ts
|
|
4335
|
-
import {
|
|
4336
|
-
|
|
4337
|
-
|
|
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));
|
|
4338
4759
|
var isENSv1Registry = (namespace, contract) => accountIdEqual(getENSv1Registry(namespace), contract);
|
|
4339
|
-
var getENSv2RootRegistry = (namespace) => getDatasourceContract(namespace,
|
|
4340
|
-
var getENSv2RootRegistryId = (namespace) =>
|
|
4760
|
+
var getENSv2RootRegistry = (namespace) => getDatasourceContract(namespace, DatasourceNames3.ENSv2Root, "RootRegistry");
|
|
4761
|
+
var getENSv2RootRegistryId = (namespace) => makeENSv2RegistryId(getENSv2RootRegistry(namespace));
|
|
4341
4762
|
var isENSv2RootRegistry = (namespace, contract) => accountIdEqual(getENSv2RootRegistry(namespace), contract);
|
|
4342
|
-
var maybeGetENSv2RootRegistry = (namespace) => maybeGetDatasourceContract(namespace,
|
|
4763
|
+
var maybeGetENSv2RootRegistry = (namespace) => maybeGetDatasourceContract(namespace, DatasourceNames3.ENSv2Root, "RootRegistry");
|
|
4343
4764
|
var maybeGetENSv2RootRegistryId = (namespace) => {
|
|
4344
4765
|
const root = maybeGetENSv2RootRegistry(namespace);
|
|
4345
4766
|
if (!root) return void 0;
|
|
4346
|
-
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);
|
|
4347
4795
|
};
|
|
4348
4796
|
|
|
4349
4797
|
// src/shared/url.ts
|
|
@@ -4354,16 +4802,6 @@ function isWebSocketProtocol(url) {
|
|
|
4354
4802
|
return ["ws:", "wss:"].includes(url.protocol);
|
|
4355
4803
|
}
|
|
4356
4804
|
|
|
4357
|
-
// src/stack-info/ensnode-stack-info.ts
|
|
4358
|
-
function buildEnsNodeStackInfo(ensApiPublicConfig, ensDbPublicConfig) {
|
|
4359
|
-
return {
|
|
4360
|
-
ensApi: ensApiPublicConfig,
|
|
4361
|
-
ensDb: ensDbPublicConfig,
|
|
4362
|
-
ensIndexer: ensApiPublicConfig.ensIndexerPublicConfig,
|
|
4363
|
-
ensRainbow: ensApiPublicConfig.ensIndexerPublicConfig.ensRainbowPublicConfig
|
|
4364
|
-
};
|
|
4365
|
-
}
|
|
4366
|
-
|
|
4367
4805
|
// src/subgraph-api/prerequisites.ts
|
|
4368
4806
|
function hasSubgraphApiConfigSupport(config) {
|
|
4369
4807
|
const supported = config.plugins.includes("subgraph" /* Subgraph */);
|
|
@@ -4415,13 +4853,14 @@ export {
|
|
|
4415
4853
|
DEFAULT_ENSNODE_URL_SEPOLIA,
|
|
4416
4854
|
ENCODED_REFERRER_BYTE_LENGTH,
|
|
4417
4855
|
ENCODED_REFERRER_BYTE_OFFSET,
|
|
4418
|
-
|
|
4856
|
+
ENSNamespaceIds4 as ENSNamespaceIds,
|
|
4419
4857
|
EXPECTED_ENCODED_REFERRER_PADDING,
|
|
4420
4858
|
EnsApiIndexingStatusResponseCodes,
|
|
4421
4859
|
EnsIndexerClient,
|
|
4422
4860
|
EnsIndexerIndexingStatusResponseCodes,
|
|
4423
4861
|
EnsNodeClient,
|
|
4424
4862
|
ForwardResolutionProtocolStep,
|
|
4863
|
+
IndexingMetadataContextStatusCodes,
|
|
4425
4864
|
IndexingStatusResponseCodes,
|
|
4426
4865
|
LruCache,
|
|
4427
4866
|
NFTMintStatuses,
|
|
@@ -4456,9 +4895,12 @@ export {
|
|
|
4456
4895
|
buildBlockRefRange,
|
|
4457
4896
|
buildCrossChainIndexingStatusSnapshotOmnichain,
|
|
4458
4897
|
buildEncodedReferrer,
|
|
4898
|
+
buildEnsIndexerStackInfo,
|
|
4459
4899
|
buildEnsNodeStackInfo,
|
|
4460
4900
|
buildEnsRainbowClientLabelSet,
|
|
4461
4901
|
buildIndexedBlockranges,
|
|
4902
|
+
buildIndexingMetadataContextInitialized,
|
|
4903
|
+
buildIndexingMetadataContextUninitialized,
|
|
4462
4904
|
buildLabelSetId,
|
|
4463
4905
|
buildLabelSetVersion,
|
|
4464
4906
|
buildOmnichainIndexingStatusSnapshot,
|
|
@@ -4467,6 +4909,7 @@ export {
|
|
|
4467
4909
|
buildUnvalidatedCrossChainIndexingStatusSnapshot,
|
|
4468
4910
|
buildUnvalidatedEnsApiPublicConfig,
|
|
4469
4911
|
buildUnvalidatedEnsIndexerPublicConfig,
|
|
4912
|
+
buildUnvalidatedEnsIndexerStackInfo,
|
|
4470
4913
|
buildUnvalidatedEnsNodeStackInfo,
|
|
4471
4914
|
buildUnvalidatedOmnichainIndexingStatusSnapshot,
|
|
4472
4915
|
buildUnvalidatedRealtimeIndexingStatusProjection,
|
|
@@ -4491,11 +4934,14 @@ export {
|
|
|
4491
4934
|
deserializeEnsIndexerConfigResponse,
|
|
4492
4935
|
deserializeEnsIndexerIndexingStatusResponse,
|
|
4493
4936
|
deserializeEnsIndexerPublicConfig,
|
|
4937
|
+
deserializeEnsIndexerStackInfo,
|
|
4494
4938
|
deserializeEnsNodeStackInfo,
|
|
4495
4939
|
deserializeErrorResponse2 as deserializeErrorResponse,
|
|
4940
|
+
deserializeIndexingMetadataContext,
|
|
4496
4941
|
deserializeIndexingStatusResponse,
|
|
4497
4942
|
deserializeOmnichainIndexingStatusSnapshot,
|
|
4498
4943
|
deserializePriceDai,
|
|
4944
|
+
deserializePriceEnsTokens,
|
|
4499
4945
|
deserializePriceEth,
|
|
4500
4946
|
deserializePriceUsdc,
|
|
4501
4947
|
deserializeRealtimeIndexingStatusProjection,
|
|
@@ -4505,21 +4951,17 @@ export {
|
|
|
4505
4951
|
deserializedNameTokensResponse,
|
|
4506
4952
|
durationBetween,
|
|
4507
4953
|
formatNFTTransferEventMetadata,
|
|
4508
|
-
getBasenamesSubregistryId,
|
|
4509
|
-
getBasenamesSubregistryManagedName,
|
|
4510
4954
|
getCurrencyInfo,
|
|
4511
4955
|
getDatasourceContract,
|
|
4512
4956
|
getDefaultEnsNodeUrl,
|
|
4513
4957
|
getENSRootChainId,
|
|
4514
4958
|
getENSv1Registry,
|
|
4959
|
+
getENSv1RootRegistryId,
|
|
4515
4960
|
getENSv2RootRegistry,
|
|
4516
4961
|
getENSv2RootRegistryId,
|
|
4517
|
-
getEthnamesSubregistryId,
|
|
4518
|
-
getEthnamesSubregistryManagedName,
|
|
4519
4962
|
getHighestKnownBlockTimestamp,
|
|
4520
4963
|
getLatestIndexedBlockRef,
|
|
4521
|
-
|
|
4522
|
-
getLineanamesSubregistryManagedName,
|
|
4964
|
+
getManagedName,
|
|
4523
4965
|
getNFTTransferType,
|
|
4524
4966
|
getNameTokenOwnership,
|
|
4525
4967
|
getNameWrapperAccounts,
|
|
@@ -4527,6 +4969,8 @@ export {
|
|
|
4527
4969
|
getOmnichainIndexingCursor,
|
|
4528
4970
|
getOmnichainIndexingStatus,
|
|
4529
4971
|
getResolvePrimaryNameChainIdParam,
|
|
4972
|
+
getRootRegistryId,
|
|
4973
|
+
getRootRegistryIds,
|
|
4530
4974
|
getTimestampForHighestOmnichainKnownBlock,
|
|
4531
4975
|
getTimestampForLowestOmnichainStartBlock,
|
|
4532
4976
|
hasNullByte,
|
|
@@ -4545,6 +4989,7 @@ export {
|
|
|
4545
4989
|
isENSv1Registry,
|
|
4546
4990
|
isENSv2RootRegistry,
|
|
4547
4991
|
isHttpProtocol,
|
|
4992
|
+
isNameWrapper,
|
|
4548
4993
|
isPccFuseSet,
|
|
4549
4994
|
isPriceCurrencyEqual,
|
|
4550
4995
|
isPriceEqual,
|
|
@@ -4562,22 +5007,27 @@ export {
|
|
|
4562
5007
|
makeENSApiPublicConfigSchema,
|
|
4563
5008
|
makeEnsApiPublicConfigSchema,
|
|
4564
5009
|
makeSerializedEnsApiPublicConfigSchema,
|
|
5010
|
+
maxPrice,
|
|
4565
5011
|
maybeGetDatasourceContract,
|
|
4566
5012
|
maybeGetENSv2RootRegistry,
|
|
4567
5013
|
maybeGetENSv2RootRegistryId,
|
|
4568
5014
|
mergeBlockNumberRanges,
|
|
5015
|
+
minPrice,
|
|
4569
5016
|
nameTokensPrerequisites,
|
|
4570
5017
|
parseAccountId,
|
|
4571
5018
|
parseAssetId,
|
|
4572
5019
|
parseDai,
|
|
5020
|
+
parseEnsTokens,
|
|
4573
5021
|
parseEth,
|
|
4574
5022
|
parseNonNegativeInteger,
|
|
4575
5023
|
parseTimestamp,
|
|
4576
5024
|
parseUsdc,
|
|
4577
5025
|
priceDai,
|
|
5026
|
+
priceEnsTokens,
|
|
4578
5027
|
priceEth,
|
|
4579
5028
|
priceUsdc,
|
|
4580
5029
|
registrarActionsFilter,
|
|
5030
|
+
replaceBigInts,
|
|
4581
5031
|
scaleBigintByNumber,
|
|
4582
5032
|
scalePrice,
|
|
4583
5033
|
serializeAssetId,
|
|
@@ -4594,8 +5044,11 @@ export {
|
|
|
4594
5044
|
serializeEnsIndexerConfigResponse,
|
|
4595
5045
|
serializeEnsIndexerIndexingStatusResponse,
|
|
4596
5046
|
serializeEnsIndexerPublicConfig,
|
|
5047
|
+
serializeEnsIndexerStackInfo,
|
|
4597
5048
|
serializeEnsNodeStackInfo,
|
|
4598
5049
|
serializeIndexedChainIds,
|
|
5050
|
+
serializeIndexingMetadataContext,
|
|
5051
|
+
serializeIndexingMetadataContextInitialized,
|
|
4599
5052
|
serializeIndexingStatusResponse,
|
|
4600
5053
|
serializeNameToken,
|
|
4601
5054
|
serializeNameTokensResponse,
|
|
@@ -4603,6 +5056,7 @@ export {
|
|
|
4603
5056
|
serializeOmnichainIndexingStatusSnapshot,
|
|
4604
5057
|
serializePrice,
|
|
4605
5058
|
serializePriceDai,
|
|
5059
|
+
serializePriceEnsTokens,
|
|
4606
5060
|
serializePriceEth,
|
|
4607
5061
|
serializePriceUsdc,
|
|
4608
5062
|
serializeRealtimeIndexingStatusProjection,
|
|
@@ -4613,13 +5067,18 @@ export {
|
|
|
4613
5067
|
serializeUrl,
|
|
4614
5068
|
sortChainStatusesByStartBlockAsc,
|
|
4615
5069
|
stripNullBytes,
|
|
5070
|
+
subtractPrice,
|
|
5071
|
+
toJson,
|
|
4616
5072
|
translateDefaultableChainIdToChainId,
|
|
4617
5073
|
uniq,
|
|
4618
5074
|
validateChainIndexingStatusSnapshot,
|
|
4619
5075
|
validateCrossChainIndexingStatusSnapshot,
|
|
4620
5076
|
validateEnsIndexerPublicConfig,
|
|
4621
5077
|
validateEnsIndexerPublicConfigCompatibility,
|
|
5078
|
+
validateEnsIndexerStackInfo,
|
|
4622
5079
|
validateEnsIndexerVersionInfo,
|
|
5080
|
+
validateEnsNodeStackInfo,
|
|
5081
|
+
validateIndexingMetadataContextInitialized,
|
|
4623
5082
|
validateOmnichainIndexingStatusSnapshot,
|
|
4624
5083
|
validateRealtimeIndexingStatusProjection,
|
|
4625
5084
|
validateSupportedLabelSetAndVersion
|