@ensnode/ensnode-sdk 0.0.0-next-20260216100641 → 0.0.0-next-20260216122402
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 +764 -576
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +183 -138
- package/dist/index.d.ts +183 -138
- package/dist/index.js +760 -572
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -47,7 +47,7 @@ __export(index_exports, {
|
|
|
47
47
|
DEFAULT_EVM_COIN_TYPE: () => DEFAULT_EVM_COIN_TYPE,
|
|
48
48
|
ENCODED_REFERRER_BYTE_LENGTH: () => ENCODED_REFERRER_BYTE_LENGTH,
|
|
49
49
|
ENCODED_REFERRER_BYTE_OFFSET: () => ENCODED_REFERRER_BYTE_OFFSET,
|
|
50
|
-
ENSNamespaceIds: () =>
|
|
50
|
+
ENSNamespaceIds: () => import_datasources2.ENSNamespaceIds,
|
|
51
51
|
ENSNodeClient: () => ENSNodeClient,
|
|
52
52
|
ENS_ROOT: () => ENS_ROOT,
|
|
53
53
|
ETH_COIN_TYPE: () => ETH_COIN_TYPE,
|
|
@@ -97,6 +97,9 @@ __export(index_exports, {
|
|
|
97
97
|
buildLabelSetVersion: () => buildLabelSetVersion,
|
|
98
98
|
buildPageContext: () => buildPageContext,
|
|
99
99
|
buildUnresolvedIdentity: () => buildUnresolvedIdentity,
|
|
100
|
+
buildUnvalidatedCrossChainIndexingStatusSnapshot: () => buildUnvalidatedCrossChainIndexingStatusSnapshot,
|
|
101
|
+
buildUnvalidatedOmnichainIndexingStatusSnapshot: () => buildUnvalidatedOmnichainIndexingStatusSnapshot,
|
|
102
|
+
buildUnvalidatedRealtimeIndexingStatusProjection: () => buildUnvalidatedRealtimeIndexingStatusProjection,
|
|
100
103
|
checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill: () => checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill,
|
|
101
104
|
checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted: () => checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted,
|
|
102
105
|
checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing: () => checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing,
|
|
@@ -146,7 +149,7 @@ __export(index_exports, {
|
|
|
146
149
|
getCurrencyInfo: () => getCurrencyInfo,
|
|
147
150
|
getDatasourceContract: () => getDatasourceContract,
|
|
148
151
|
getDefaultEnsNodeUrl: () => getDefaultEnsNodeUrl,
|
|
149
|
-
getENSRootChainId: () =>
|
|
152
|
+
getENSRootChainId: () => import_datasources3.getENSRootChainId,
|
|
150
153
|
getENSv1Registry: () => getENSv1Registry,
|
|
151
154
|
getENSv2RootRegistry: () => getENSv2RootRegistry,
|
|
152
155
|
getENSv2RootRegistryId: () => getENSv2RootRegistryId,
|
|
@@ -266,10 +269,44 @@ __export(index_exports, {
|
|
|
266
269
|
uint256ToHex32: () => uint256ToHex32,
|
|
267
270
|
uniq: () => uniq,
|
|
268
271
|
validateChainIndexingStatusSnapshot: () => validateChainIndexingStatusSnapshot,
|
|
272
|
+
validateCrossChainIndexingStatusSnapshot: () => validateCrossChainIndexingStatusSnapshot,
|
|
273
|
+
validateOmnichainIndexingStatusSnapshot: () => validateOmnichainIndexingStatusSnapshot,
|
|
274
|
+
validateRealtimeIndexingStatusProjection: () => validateRealtimeIndexingStatusProjection,
|
|
269
275
|
validateSupportedLabelSetAndVersion: () => validateSupportedLabelSetAndVersion
|
|
270
276
|
});
|
|
271
277
|
module.exports = __toCommonJS(index_exports);
|
|
272
278
|
|
|
279
|
+
// src/client-error.ts
|
|
280
|
+
var ClientError = class _ClientError extends Error {
|
|
281
|
+
details;
|
|
282
|
+
constructor(message, details) {
|
|
283
|
+
super(message);
|
|
284
|
+
this.name = "ClientError";
|
|
285
|
+
this.details = details;
|
|
286
|
+
}
|
|
287
|
+
static fromErrorResponse({ message, details }) {
|
|
288
|
+
return new _ClientError(message, details);
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
// src/deployments.ts
|
|
293
|
+
var import_datasources = require("@ensnode/datasources");
|
|
294
|
+
var DEFAULT_ENSNODE_API_URL_MAINNET = "https://api.alpha.ensnode.io";
|
|
295
|
+
var DEFAULT_ENSNODE_API_URL_SEPOLIA = "https://api.alpha-sepolia.ensnode.io";
|
|
296
|
+
var getDefaultEnsNodeUrl = (namespace) => {
|
|
297
|
+
const effectiveNamespace = namespace ?? import_datasources.ENSNamespaceIds.Mainnet;
|
|
298
|
+
switch (effectiveNamespace) {
|
|
299
|
+
case import_datasources.ENSNamespaceIds.Mainnet:
|
|
300
|
+
return new URL(DEFAULT_ENSNODE_API_URL_MAINNET);
|
|
301
|
+
case import_datasources.ENSNamespaceIds.Sepolia:
|
|
302
|
+
return new URL(DEFAULT_ENSNODE_API_URL_SEPOLIA);
|
|
303
|
+
default:
|
|
304
|
+
throw new Error(
|
|
305
|
+
`ENSNamespaceId ${effectiveNamespace} does not have a default ENSNode URL defined`
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
|
|
273
310
|
// src/ensapi/config/deserialize.ts
|
|
274
311
|
var import_v45 = require("zod/v4");
|
|
275
312
|
|
|
@@ -288,7 +325,7 @@ var import_viem8 = require("viem");
|
|
|
288
325
|
var import_v4 = require("zod/v4");
|
|
289
326
|
|
|
290
327
|
// src/ens/index.ts
|
|
291
|
-
var
|
|
328
|
+
var import_datasources3 = require("@ensnode/datasources");
|
|
292
329
|
|
|
293
330
|
// src/ens/coin-type.ts
|
|
294
331
|
var import_utils = require("@ensdomains/address-encoder/utils");
|
|
@@ -477,7 +514,7 @@ var makeSubdomainNode = (labelHash, node) => (0, import_viem5.keccak256)((0, imp
|
|
|
477
514
|
var uint256ToHex32 = (num) => (0, import_viem5.toHex)(num, { size: 32 });
|
|
478
515
|
|
|
479
516
|
// src/ens/types.ts
|
|
480
|
-
var
|
|
517
|
+
var import_datasources2 = require("@ensnode/datasources");
|
|
481
518
|
|
|
482
519
|
// src/shared/currencies.ts
|
|
483
520
|
var import_viem6 = require("viem");
|
|
@@ -708,9 +745,9 @@ var makeBlockRefSchema = (valueLabel = "Value") => import_v4.z.strictObject(
|
|
|
708
745
|
error: `${valueLabel} must be a valid BlockRef object.`
|
|
709
746
|
}
|
|
710
747
|
);
|
|
711
|
-
var makeENSNamespaceIdSchema = (valueLabel = "ENSNamespaceId") => import_v4.z.enum(
|
|
748
|
+
var makeENSNamespaceIdSchema = (valueLabel = "ENSNamespaceId") => import_v4.z.enum(import_datasources2.ENSNamespaceIds, {
|
|
712
749
|
error() {
|
|
713
|
-
return `Invalid ${valueLabel}. Supported ENS namespace IDs are: ${Object.keys(
|
|
750
|
+
return `Invalid ${valueLabel}. Supported ENS namespace IDs are: ${Object.keys(import_datasources2.ENSNamespaceIds).join(", ")}`;
|
|
714
751
|
}
|
|
715
752
|
});
|
|
716
753
|
var makePriceAmountSchema = (valueLabel = "Amount") => import_v4.z.coerce.bigint({
|
|
@@ -773,7 +810,7 @@ var makeReinterpretedNameSchema = (valueLabel = "Reinterpreted Name") => import_
|
|
|
773
810
|
}).transform(reinterpretName);
|
|
774
811
|
|
|
775
812
|
// src/ensindexer/config/is-subgraph-compatible.ts
|
|
776
|
-
var
|
|
813
|
+
var import_datasources4 = require("@ensnode/datasources");
|
|
777
814
|
|
|
778
815
|
// src/ensindexer/config/types.ts
|
|
779
816
|
var PluginName = /* @__PURE__ */ ((PluginName2) => {
|
|
@@ -793,7 +830,7 @@ function isSubgraphCompatible(config) {
|
|
|
793
830
|
const onlySubgraphPluginActivated = config.plugins.length === 1 && config.plugins[0] === "subgraph" /* Subgraph */;
|
|
794
831
|
const isSubgraphLabelSet = config.labelSet.labelSetId === "subgraph" && config.labelSet.labelSetVersion === 0;
|
|
795
832
|
const isEnsTestEnvLabelSet = config.labelSet.labelSetId === "ens-test-env" && config.labelSet.labelSetVersion === 0;
|
|
796
|
-
const labelSetIsSubgraphCompatible = isSubgraphLabelSet || config.namespace ===
|
|
833
|
+
const labelSetIsSubgraphCompatible = isSubgraphLabelSet || config.namespace === import_datasources4.ENSNamespaceIds.EnsTestEnv && isEnsTestEnvLabelSet;
|
|
797
834
|
return onlySubgraphPluginActivated && labelSetIsSubgraphCompatible;
|
|
798
835
|
}
|
|
799
836
|
|
|
@@ -924,6 +961,11 @@ ${(0, import_v45.prettifyError)(error)}
|
|
|
924
961
|
}
|
|
925
962
|
}
|
|
926
963
|
|
|
964
|
+
// src/ensapi/api/config/deserialize.ts
|
|
965
|
+
function deserializeConfigResponse(serializedResponse) {
|
|
966
|
+
return deserializeENSApiPublicConfig(serializedResponse);
|
|
967
|
+
}
|
|
968
|
+
|
|
927
969
|
// src/ensindexer/config/deserialize.ts
|
|
928
970
|
var import_v46 = require("zod/v4");
|
|
929
971
|
function deserializeENSIndexerPublicConfig(maybeConfig, valueLabel) {
|
|
@@ -1307,11 +1349,10 @@ var makeChainIndexingStatusSnapshotSchema = (valueLabel = "Value") => import_v47
|
|
|
1307
1349
|
makeChainIndexingStatusSnapshotCompletedSchema(valueLabel),
|
|
1308
1350
|
makeChainIndexingStatusSnapshotFollowingSchema(valueLabel)
|
|
1309
1351
|
]);
|
|
1310
|
-
var makeSerializedChainIndexingStatusSnapshotSchema = makeChainIndexingStatusSnapshotSchema;
|
|
1311
1352
|
|
|
1312
1353
|
// src/ensindexer/indexing-status/deserialize/chain-indexing-status-snapshot.ts
|
|
1313
1354
|
function deserializeChainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
1314
|
-
const schema =
|
|
1355
|
+
const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
|
|
1315
1356
|
const parsed = schema.safeParse(maybeSnapshot);
|
|
1316
1357
|
if (parsed.error) {
|
|
1317
1358
|
throw new Error(
|
|
@@ -1327,133 +1368,10 @@ ${(0, import_v48.prettifyError)(parsed.error)}
|
|
|
1327
1368
|
var import_v412 = require("zod/v4");
|
|
1328
1369
|
|
|
1329
1370
|
// src/ensindexer/indexing-status/zod-schema/cross-chain-indexing-status-snapshot.ts
|
|
1330
|
-
var import_v411 = require("zod/v4");
|
|
1331
|
-
|
|
1332
|
-
// src/ensindexer/indexing-status/zod-schema/omnichain-indexing-status-snapshot.ts
|
|
1333
1371
|
var import_v410 = require("zod/v4");
|
|
1334
1372
|
|
|
1335
|
-
// src/
|
|
1336
|
-
var import_v49 =
|
|
1337
|
-
function deserializeChainId(maybeChainId, valueLabel) {
|
|
1338
|
-
const schema = makeChainIdStringSchema(valueLabel);
|
|
1339
|
-
const parsed = schema.safeParse(maybeChainId);
|
|
1340
|
-
if (parsed.error) {
|
|
1341
|
-
throw new Error(`Cannot deserialize ChainId:
|
|
1342
|
-
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1343
|
-
`);
|
|
1344
|
-
}
|
|
1345
|
-
return parsed.data;
|
|
1346
|
-
}
|
|
1347
|
-
function deserializeDatetime(maybeDatetime, valueLabel) {
|
|
1348
|
-
const schema = makeDatetimeSchema(valueLabel);
|
|
1349
|
-
const parsed = schema.safeParse(maybeDatetime);
|
|
1350
|
-
if (parsed.error) {
|
|
1351
|
-
throw new Error(`Cannot deserialize Datetime:
|
|
1352
|
-
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1353
|
-
`);
|
|
1354
|
-
}
|
|
1355
|
-
return parsed.data;
|
|
1356
|
-
}
|
|
1357
|
-
function deserializeUnixTimestamp(maybeTimestamp, valueLabel) {
|
|
1358
|
-
const schema = makeUnixTimestampSchema(valueLabel);
|
|
1359
|
-
const parsed = schema.safeParse(maybeTimestamp);
|
|
1360
|
-
if (parsed.error) {
|
|
1361
|
-
throw new Error(`Cannot deserialize Unix Timestamp:
|
|
1362
|
-
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1363
|
-
`);
|
|
1364
|
-
}
|
|
1365
|
-
return parsed.data;
|
|
1366
|
-
}
|
|
1367
|
-
function deserializeUrl(maybeUrl, valueLabel) {
|
|
1368
|
-
const schema = makeUrlSchema(valueLabel);
|
|
1369
|
-
const parsed = schema.safeParse(maybeUrl);
|
|
1370
|
-
if (parsed.error) {
|
|
1371
|
-
throw new Error(`Cannot deserialize URL:
|
|
1372
|
-
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1373
|
-
`);
|
|
1374
|
-
}
|
|
1375
|
-
return parsed.data;
|
|
1376
|
-
}
|
|
1377
|
-
function deserializeBlockNumber(maybeBlockNumber, valueLabel) {
|
|
1378
|
-
const schema = makeBlockNumberSchema(valueLabel);
|
|
1379
|
-
const parsed = schema.safeParse(maybeBlockNumber);
|
|
1380
|
-
if (parsed.error) {
|
|
1381
|
-
throw new Error(`Cannot deserialize BlockNumber:
|
|
1382
|
-
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1383
|
-
`);
|
|
1384
|
-
}
|
|
1385
|
-
return parsed.data;
|
|
1386
|
-
}
|
|
1387
|
-
function deserializeBlockrange(maybeBlockrange, valueLabel) {
|
|
1388
|
-
const schema = makeBlockrangeSchema(valueLabel);
|
|
1389
|
-
const parsed = schema.safeParse(maybeBlockrange);
|
|
1390
|
-
if (parsed.error) {
|
|
1391
|
-
throw new Error(`Cannot deserialize Blockrange:
|
|
1392
|
-
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1393
|
-
`);
|
|
1394
|
-
}
|
|
1395
|
-
return parsed.data;
|
|
1396
|
-
}
|
|
1397
|
-
function deserializeBlockRef(maybeBlockRef, valueLabel) {
|
|
1398
|
-
const schema = makeBlockRefSchema(valueLabel);
|
|
1399
|
-
const parsed = schema.safeParse(maybeBlockRef);
|
|
1400
|
-
if (parsed.error) {
|
|
1401
|
-
throw new Error(`Cannot deserialize BlockRef:
|
|
1402
|
-
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1403
|
-
`);
|
|
1404
|
-
}
|
|
1405
|
-
return parsed.data;
|
|
1406
|
-
}
|
|
1407
|
-
function deserializeDuration(maybeDuration, valueLabel) {
|
|
1408
|
-
const schema = import_v49.default.coerce.number().pipe(makeDurationSchema(valueLabel));
|
|
1409
|
-
const parsed = schema.safeParse(maybeDuration);
|
|
1410
|
-
if (parsed.error) {
|
|
1411
|
-
throw new RangeError(`Cannot deserialize Duration:
|
|
1412
|
-
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1413
|
-
`);
|
|
1414
|
-
}
|
|
1415
|
-
return parsed.data;
|
|
1416
|
-
}
|
|
1417
|
-
function parseAccountId(maybeAccountId, valueLabel) {
|
|
1418
|
-
const schema = makeAccountIdStringSchema(valueLabel);
|
|
1419
|
-
const parsed = schema.safeParse(maybeAccountId);
|
|
1420
|
-
if (parsed.error) {
|
|
1421
|
-
throw new RangeError(`Cannot deserialize AccountId:
|
|
1422
|
-
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1423
|
-
`);
|
|
1424
|
-
}
|
|
1425
|
-
return parsed.data;
|
|
1426
|
-
}
|
|
1427
|
-
function deserializePriceEth(maybePrice, valueLabel) {
|
|
1428
|
-
const schema = makePriceEthSchema(valueLabel);
|
|
1429
|
-
const parsed = schema.safeParse(maybePrice);
|
|
1430
|
-
if (parsed.error) {
|
|
1431
|
-
throw new Error(`Cannot deserialize PriceEth:
|
|
1432
|
-
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1433
|
-
`);
|
|
1434
|
-
}
|
|
1435
|
-
return parsed.data;
|
|
1436
|
-
}
|
|
1437
|
-
function deserializePriceUsdc(maybePrice, valueLabel) {
|
|
1438
|
-
const schema = makePriceUsdcSchema(valueLabel);
|
|
1439
|
-
const parsed = schema.safeParse(maybePrice);
|
|
1440
|
-
if (parsed.error) {
|
|
1441
|
-
throw new Error(`Cannot deserialize PriceUsdc:
|
|
1442
|
-
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1443
|
-
`);
|
|
1444
|
-
}
|
|
1445
|
-
return parsed.data;
|
|
1446
|
-
}
|
|
1447
|
-
function deserializePriceDai(maybePrice, valueLabel) {
|
|
1448
|
-
const schema = makePriceDaiSchema(valueLabel);
|
|
1449
|
-
const parsed = schema.safeParse(maybePrice);
|
|
1450
|
-
if (parsed.error) {
|
|
1451
|
-
throw new Error(`Cannot deserialize PriceDai:
|
|
1452
|
-
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1453
|
-
`);
|
|
1454
|
-
}
|
|
1455
|
-
return parsed.data;
|
|
1456
|
-
}
|
|
1373
|
+
// src/ensindexer/indexing-status/zod-schema/omnichain-indexing-status-snapshot.ts
|
|
1374
|
+
var import_v49 = require("zod/v4");
|
|
1457
1375
|
|
|
1458
1376
|
// src/ensindexer/indexing-status/omnichain-indexing-status-snapshot.ts
|
|
1459
1377
|
var OmnichainIndexingStatusIds = {
|
|
@@ -1607,76 +1525,115 @@ function invariant_omnichainIndexingCursorIsEqualToHighestLatestIndexedBlockAcro
|
|
|
1607
1525
|
}
|
|
1608
1526
|
}
|
|
1609
1527
|
function invariant_omnichainSnapshotUnstartedHasValidChains(ctx) {
|
|
1610
|
-
const
|
|
1528
|
+
const snapshot = ctx.value;
|
|
1611
1529
|
const hasValidChains = checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted(
|
|
1612
|
-
Array.from(chains.values())
|
|
1530
|
+
Array.from(snapshot.chains.values())
|
|
1613
1531
|
);
|
|
1614
1532
|
if (hasValidChains === false) {
|
|
1615
1533
|
ctx.issues.push({
|
|
1616
1534
|
code: "custom",
|
|
1617
|
-
input:
|
|
1535
|
+
input: snapshot,
|
|
1618
1536
|
message: `For omnichain status snapshot 'unstarted', all chains must have "queued" status.`
|
|
1619
1537
|
});
|
|
1620
1538
|
}
|
|
1621
1539
|
}
|
|
1622
1540
|
function invariant_omnichainStatusSnapshotBackfillHasValidChains(ctx) {
|
|
1623
|
-
const
|
|
1541
|
+
const snapshot = ctx.value;
|
|
1624
1542
|
const hasValidChains = checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill(
|
|
1625
|
-
Array.from(chains.values())
|
|
1543
|
+
Array.from(snapshot.chains.values())
|
|
1626
1544
|
);
|
|
1627
1545
|
if (hasValidChains === false) {
|
|
1628
1546
|
ctx.issues.push({
|
|
1629
1547
|
code: "custom",
|
|
1630
|
-
input:
|
|
1548
|
+
input: snapshot,
|
|
1631
1549
|
message: `For omnichain status snapshot 'backfill', at least one chain must be in "backfill" status and each chain has to have a status of either "queued", "backfill" or "completed".`
|
|
1632
1550
|
});
|
|
1633
1551
|
}
|
|
1634
1552
|
}
|
|
1635
1553
|
function invariant_omnichainStatusSnapshotCompletedHasValidChains(ctx) {
|
|
1636
|
-
const
|
|
1554
|
+
const snapshot = ctx.value;
|
|
1637
1555
|
const hasValidChains = checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted(
|
|
1638
|
-
Array.from(chains.values())
|
|
1556
|
+
Array.from(snapshot.chains.values())
|
|
1639
1557
|
);
|
|
1640
1558
|
if (hasValidChains === false) {
|
|
1641
1559
|
ctx.issues.push({
|
|
1642
1560
|
code: "custom",
|
|
1643
|
-
input:
|
|
1561
|
+
input: snapshot,
|
|
1644
1562
|
message: `For omnichain status snapshot 'completed', all chains must have "completed" status.`
|
|
1645
1563
|
});
|
|
1646
1564
|
}
|
|
1647
1565
|
}
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1566
|
+
function invariant_omnichainStatusSnapshotFollowingHasValidChains(ctx) {
|
|
1567
|
+
const snapshot = ctx.value;
|
|
1568
|
+
const hasValidChains = checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing(
|
|
1569
|
+
Array.from(snapshot.chains.values())
|
|
1570
|
+
);
|
|
1571
|
+
if (hasValidChains === false) {
|
|
1572
|
+
ctx.issues.push({
|
|
1573
|
+
code: "custom",
|
|
1574
|
+
input: snapshot,
|
|
1575
|
+
message: "For omnichainStatus 'following', at least one chain must be in 'following' status."
|
|
1576
|
+
});
|
|
1654
1577
|
}
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1578
|
+
}
|
|
1579
|
+
var makeOmnichainIndexingStatusSnapshotUnstartedSchema = (valueLabel) => import_v49.z.object({
|
|
1580
|
+
omnichainStatus: import_v49.z.literal(OmnichainIndexingStatusIds.Unstarted),
|
|
1581
|
+
chains: import_v49.z.map(
|
|
1582
|
+
makeChainIdSchema(),
|
|
1583
|
+
import_v49.z.discriminatedUnion("chainStatus", [
|
|
1584
|
+
makeChainIndexingStatusSnapshotQueuedSchema(valueLabel)
|
|
1585
|
+
]),
|
|
1586
|
+
{
|
|
1587
|
+
error: "Chains indexing statuses must be a Map with ChainId as keys and ChainIndexingStatusSnapshot as values."
|
|
1588
|
+
}
|
|
1589
|
+
),
|
|
1660
1590
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1661
|
-
});
|
|
1662
|
-
var makeOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) =>
|
|
1663
|
-
omnichainStatus:
|
|
1664
|
-
chains:
|
|
1665
|
-
(
|
|
1591
|
+
}).check(invariant_omnichainSnapshotUnstartedHasValidChains);
|
|
1592
|
+
var makeOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) => import_v49.z.object({
|
|
1593
|
+
omnichainStatus: import_v49.z.literal(OmnichainIndexingStatusIds.Backfill),
|
|
1594
|
+
chains: import_v49.z.map(
|
|
1595
|
+
makeChainIdSchema(),
|
|
1596
|
+
import_v49.z.discriminatedUnion("chainStatus", [
|
|
1597
|
+
makeChainIndexingStatusSnapshotQueuedSchema(valueLabel),
|
|
1598
|
+
makeChainIndexingStatusSnapshotBackfillSchema(valueLabel),
|
|
1599
|
+
makeChainIndexingStatusSnapshotCompletedSchema(valueLabel)
|
|
1600
|
+
]),
|
|
1601
|
+
{
|
|
1602
|
+
error: "Chains indexing statuses must be a Map with ChainId as keys and ChainIndexingStatusSnapshot as values."
|
|
1603
|
+
}
|
|
1666
1604
|
),
|
|
1667
1605
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1668
|
-
});
|
|
1669
|
-
var makeOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) =>
|
|
1670
|
-
omnichainStatus:
|
|
1671
|
-
chains:
|
|
1606
|
+
}).check(invariant_omnichainStatusSnapshotBackfillHasValidChains);
|
|
1607
|
+
var makeOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) => import_v49.z.object({
|
|
1608
|
+
omnichainStatus: import_v49.z.literal(OmnichainIndexingStatusIds.Completed),
|
|
1609
|
+
chains: import_v49.z.map(
|
|
1610
|
+
makeChainIdSchema(),
|
|
1611
|
+
import_v49.z.discriminatedUnion("chainStatus", [
|
|
1612
|
+
makeChainIndexingStatusSnapshotCompletedSchema(valueLabel)
|
|
1613
|
+
]),
|
|
1614
|
+
{
|
|
1615
|
+
error: "Chains indexing statuses must be a Map with ChainId as keys and ChainIndexingStatusSnapshot as values."
|
|
1616
|
+
}
|
|
1617
|
+
),
|
|
1672
1618
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1673
|
-
});
|
|
1674
|
-
var makeOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) =>
|
|
1675
|
-
omnichainStatus:
|
|
1676
|
-
chains:
|
|
1619
|
+
}).check(invariant_omnichainStatusSnapshotCompletedHasValidChains);
|
|
1620
|
+
var makeOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) => import_v49.z.object({
|
|
1621
|
+
omnichainStatus: import_v49.z.literal(OmnichainIndexingStatusIds.Following),
|
|
1622
|
+
chains: import_v49.z.map(
|
|
1623
|
+
makeChainIdSchema(),
|
|
1624
|
+
import_v49.z.discriminatedUnion("chainStatus", [
|
|
1625
|
+
makeChainIndexingStatusSnapshotQueuedSchema(valueLabel),
|
|
1626
|
+
makeChainIndexingStatusSnapshotBackfillSchema(valueLabel),
|
|
1627
|
+
makeChainIndexingStatusSnapshotFollowingSchema(valueLabel),
|
|
1628
|
+
makeChainIndexingStatusSnapshotCompletedSchema(valueLabel)
|
|
1629
|
+
]),
|
|
1630
|
+
{
|
|
1631
|
+
error: "Chains indexing statuses must be a Map with ChainId as keys and ChainIndexingStatusSnapshot as values."
|
|
1632
|
+
}
|
|
1633
|
+
),
|
|
1677
1634
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1678
|
-
});
|
|
1679
|
-
var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexing Snapshot") =>
|
|
1635
|
+
}).check(invariant_omnichainStatusSnapshotFollowingHasValidChains);
|
|
1636
|
+
var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexing Snapshot") => import_v49.z.discriminatedUnion("omnichainStatus", [
|
|
1680
1637
|
makeOmnichainIndexingStatusSnapshotUnstartedSchema(valueLabel),
|
|
1681
1638
|
makeOmnichainIndexingStatusSnapshotBackfillSchema(valueLabel),
|
|
1682
1639
|
makeOmnichainIndexingStatusSnapshotCompletedSchema(valueLabel),
|
|
@@ -1684,16 +1641,63 @@ var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexin
|
|
|
1684
1641
|
]).check(invariant_omnichainSnapshotStatusIsConsistentWithChainSnapshot).check(invariant_omnichainIndexingCursorLowerThanEarliestStartBlockAcrossQueuedChains).check(
|
|
1685
1642
|
invariant_omnichainIndexingCursorLowerThanOrEqualToLatestBackfillEndBlockAcrossBackfillChains
|
|
1686
1643
|
).check(invariant_omnichainIndexingCursorIsEqualToHighestLatestIndexedBlockAcrossIndexedChain);
|
|
1644
|
+
var makeSerializedOmnichainIndexingStatusSnapshotUnstartedSchema = (valueLabel) => import_v49.z.object({
|
|
1645
|
+
omnichainStatus: import_v49.z.literal(OmnichainIndexingStatusIds.Unstarted),
|
|
1646
|
+
chains: import_v49.z.record(
|
|
1647
|
+
makeChainIdStringSchema(),
|
|
1648
|
+
import_v49.z.discriminatedUnion("chainStatus", [
|
|
1649
|
+
makeChainIndexingStatusSnapshotQueuedSchema(valueLabel)
|
|
1650
|
+
])
|
|
1651
|
+
),
|
|
1652
|
+
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1653
|
+
});
|
|
1654
|
+
var makeSerializedOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) => import_v49.z.object({
|
|
1655
|
+
omnichainStatus: import_v49.z.literal(OmnichainIndexingStatusIds.Backfill),
|
|
1656
|
+
chains: import_v49.z.record(
|
|
1657
|
+
makeChainIdStringSchema(),
|
|
1658
|
+
import_v49.z.discriminatedUnion("chainStatus", [
|
|
1659
|
+
makeChainIndexingStatusSnapshotQueuedSchema(valueLabel),
|
|
1660
|
+
makeChainIndexingStatusSnapshotBackfillSchema(valueLabel),
|
|
1661
|
+
makeChainIndexingStatusSnapshotCompletedSchema(valueLabel)
|
|
1662
|
+
])
|
|
1663
|
+
),
|
|
1664
|
+
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1665
|
+
});
|
|
1666
|
+
var makeSerializedOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) => import_v49.z.object({
|
|
1667
|
+
omnichainStatus: import_v49.z.literal(OmnichainIndexingStatusIds.Completed),
|
|
1668
|
+
chains: import_v49.z.record(
|
|
1669
|
+
makeChainIdStringSchema(),
|
|
1670
|
+
import_v49.z.discriminatedUnion("chainStatus", [
|
|
1671
|
+
makeChainIndexingStatusSnapshotCompletedSchema(valueLabel)
|
|
1672
|
+
])
|
|
1673
|
+
),
|
|
1674
|
+
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1675
|
+
});
|
|
1676
|
+
var makeSerializedOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) => import_v49.z.object({
|
|
1677
|
+
omnichainStatus: import_v49.z.literal(OmnichainIndexingStatusIds.Following),
|
|
1678
|
+
chains: import_v49.z.record(
|
|
1679
|
+
makeChainIdStringSchema(),
|
|
1680
|
+
import_v49.z.discriminatedUnion("chainStatus", [
|
|
1681
|
+
makeChainIndexingStatusSnapshotQueuedSchema(valueLabel),
|
|
1682
|
+
makeChainIndexingStatusSnapshotBackfillSchema(valueLabel),
|
|
1683
|
+
makeChainIndexingStatusSnapshotFollowingSchema(valueLabel),
|
|
1684
|
+
makeChainIndexingStatusSnapshotCompletedSchema(valueLabel)
|
|
1685
|
+
])
|
|
1686
|
+
),
|
|
1687
|
+
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1688
|
+
});
|
|
1689
|
+
var makeSerializedOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Value") => import_v49.z.discriminatedUnion("omnichainStatus", [
|
|
1690
|
+
makeSerializedOmnichainIndexingStatusSnapshotUnstartedSchema(valueLabel),
|
|
1691
|
+
makeSerializedOmnichainIndexingStatusSnapshotBackfillSchema(valueLabel),
|
|
1692
|
+
makeSerializedOmnichainIndexingStatusSnapshotCompletedSchema(valueLabel),
|
|
1693
|
+
makeSerializedOmnichainIndexingStatusSnapshotFollowingSchema(valueLabel)
|
|
1694
|
+
]);
|
|
1687
1695
|
|
|
1688
1696
|
// src/ensindexer/indexing-status/zod-schema/cross-chain-indexing-status-snapshot.ts
|
|
1689
1697
|
function invariant_slowestChainEqualsToOmnichainSnapshotTime(ctx) {
|
|
1690
1698
|
const { slowestChainIndexingCursor, omnichainSnapshot } = ctx.value;
|
|
1691
1699
|
const { omnichainIndexingCursor } = omnichainSnapshot;
|
|
1692
1700
|
if (slowestChainIndexingCursor !== omnichainIndexingCursor) {
|
|
1693
|
-
console.log("invariant_slowestChainEqualsToOmnichainSnapshotTime", {
|
|
1694
|
-
slowestChainIndexingCursor,
|
|
1695
|
-
omnichainIndexingCursor
|
|
1696
|
-
});
|
|
1697
1701
|
ctx.issues.push({
|
|
1698
1702
|
code: "custom",
|
|
1699
1703
|
input: ctx.value,
|
|
@@ -1722,39 +1726,67 @@ function invariant_snapshotTimeIsTheHighestKnownBlockTimestamp(ctx) {
|
|
|
1722
1726
|
});
|
|
1723
1727
|
}
|
|
1724
1728
|
}
|
|
1725
|
-
var makeCrossChainIndexingStatusSnapshotOmnichainSchema = (valueLabel = "Cross-chain Indexing Status Snapshot Omnichain") =>
|
|
1726
|
-
strategy:
|
|
1729
|
+
var makeCrossChainIndexingStatusSnapshotOmnichainSchema = (valueLabel = "Cross-chain Indexing Status Snapshot Omnichain") => import_v410.z.object({
|
|
1730
|
+
strategy: import_v410.z.literal(CrossChainIndexingStrategyIds.Omnichain),
|
|
1727
1731
|
slowestChainIndexingCursor: makeUnixTimestampSchema(valueLabel),
|
|
1728
1732
|
snapshotTime: makeUnixTimestampSchema(valueLabel),
|
|
1729
1733
|
omnichainSnapshot: makeOmnichainIndexingStatusSnapshotSchema(valueLabel)
|
|
1730
1734
|
}).check(invariant_slowestChainEqualsToOmnichainSnapshotTime).check(invariant_snapshotTimeIsTheHighestKnownBlockTimestamp);
|
|
1731
|
-
var makeCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Cross-chain Indexing Status Snapshot") =>
|
|
1735
|
+
var makeCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Cross-chain Indexing Status Snapshot") => import_v410.z.discriminatedUnion("strategy", [
|
|
1732
1736
|
makeCrossChainIndexingStatusSnapshotOmnichainSchema(valueLabel)
|
|
1733
1737
|
]);
|
|
1738
|
+
var makeSerializedCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Serialized Cross-chain Indexing Status Snapshot") => import_v410.z.object({
|
|
1739
|
+
strategy: import_v410.z.enum(CrossChainIndexingStrategyIds),
|
|
1740
|
+
slowestChainIndexingCursor: makeUnixTimestampSchema(valueLabel),
|
|
1741
|
+
snapshotTime: makeUnixTimestampSchema(valueLabel),
|
|
1742
|
+
omnichainSnapshot: makeSerializedOmnichainIndexingStatusSnapshotSchema(valueLabel)
|
|
1743
|
+
});
|
|
1734
1744
|
|
|
1735
|
-
// src/ensindexer/indexing-status/deserialize/
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
const
|
|
1745
|
+
// src/ensindexer/indexing-status/deserialize/omnichain-indexing-status-snapshot.ts
|
|
1746
|
+
var import_v411 = require("zod/v4");
|
|
1747
|
+
function buildUnvalidatedOmnichainIndexingStatusSnapshot(serializedSnapshot) {
|
|
1748
|
+
const chains = /* @__PURE__ */ new Map();
|
|
1749
|
+
for (const [chainIdString, chainIndexingStatusSnapshot] of Object.entries(
|
|
1750
|
+
serializedSnapshot.chains
|
|
1751
|
+
)) {
|
|
1752
|
+
const chainId = Number(chainIdString);
|
|
1753
|
+
chains.set(chainId, chainIndexingStatusSnapshot);
|
|
1754
|
+
}
|
|
1755
|
+
const unvalidatedSnapshot = {
|
|
1756
|
+
...serializedSnapshot,
|
|
1757
|
+
chains
|
|
1758
|
+
};
|
|
1759
|
+
return unvalidatedSnapshot;
|
|
1760
|
+
}
|
|
1761
|
+
function deserializeOmnichainIndexingStatusSnapshot(data, valueLabel) {
|
|
1762
|
+
const schema = makeSerializedOmnichainIndexingStatusSnapshotSchema(valueLabel).transform(buildUnvalidatedOmnichainIndexingStatusSnapshot).pipe(makeOmnichainIndexingStatusSnapshotSchema(valueLabel));
|
|
1763
|
+
const parsed = schema.safeParse(data);
|
|
1739
1764
|
if (parsed.error) {
|
|
1740
1765
|
throw new Error(
|
|
1741
|
-
`Cannot deserialize into
|
|
1742
|
-
${(0,
|
|
1766
|
+
`Cannot deserialize into OmnichainIndexingStatusSnapshot:
|
|
1767
|
+
${(0, import_v411.prettifyError)(parsed.error)}
|
|
1743
1768
|
`
|
|
1744
1769
|
);
|
|
1745
1770
|
}
|
|
1746
1771
|
return parsed.data;
|
|
1747
1772
|
}
|
|
1748
1773
|
|
|
1749
|
-
// src/ensindexer/indexing-status/deserialize/
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1774
|
+
// src/ensindexer/indexing-status/deserialize/cross-chain-indexing-status-snapshot.ts
|
|
1775
|
+
function buildUnvalidatedCrossChainIndexingStatusSnapshot(serializedSnapshot) {
|
|
1776
|
+
return {
|
|
1777
|
+
...serializedSnapshot,
|
|
1778
|
+
omnichainSnapshot: buildUnvalidatedOmnichainIndexingStatusSnapshot(
|
|
1779
|
+
serializedSnapshot.omnichainSnapshot
|
|
1780
|
+
)
|
|
1781
|
+
};
|
|
1782
|
+
}
|
|
1783
|
+
function deserializeCrossChainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
1784
|
+
const schema = makeSerializedCrossChainIndexingStatusSnapshotSchema(valueLabel).transform(buildUnvalidatedCrossChainIndexingStatusSnapshot).pipe(makeCrossChainIndexingStatusSnapshotSchema(valueLabel));
|
|
1753
1785
|
const parsed = schema.safeParse(maybeSnapshot);
|
|
1754
1786
|
if (parsed.error) {
|
|
1755
1787
|
throw new Error(
|
|
1756
|
-
`Cannot deserialize into
|
|
1757
|
-
${(0,
|
|
1788
|
+
`Cannot deserialize into CrossChainIndexingStatusSnapshot:
|
|
1789
|
+
${(0, import_v412.prettifyError)(parsed.error)}
|
|
1758
1790
|
`
|
|
1759
1791
|
);
|
|
1760
1792
|
}
|
|
@@ -1762,10 +1794,10 @@ ${(0, import_v413.prettifyError)(parsed.error)}
|
|
|
1762
1794
|
}
|
|
1763
1795
|
|
|
1764
1796
|
// src/ensindexer/indexing-status/deserialize/realtime-indexing-status-projection.ts
|
|
1765
|
-
var
|
|
1797
|
+
var import_v414 = require("zod/v4");
|
|
1766
1798
|
|
|
1767
1799
|
// src/ensindexer/indexing-status/zod-schema/realtime-indexing-status-projection.ts
|
|
1768
|
-
var
|
|
1800
|
+
var import_v413 = require("zod/v4");
|
|
1769
1801
|
function invariant_realtimeIndexingStatusProjectionProjectedAtIsAfterOrEqualToSnapshotTime(ctx) {
|
|
1770
1802
|
const projection = ctx.value;
|
|
1771
1803
|
const { snapshot, projectedAt } = projection;
|
|
@@ -1789,20 +1821,31 @@ function invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect(ct
|
|
|
1789
1821
|
});
|
|
1790
1822
|
}
|
|
1791
1823
|
}
|
|
1792
|
-
var makeRealtimeIndexingStatusProjectionSchema = (valueLabel = "Realtime Indexing Status Projection") =>
|
|
1824
|
+
var makeRealtimeIndexingStatusProjectionSchema = (valueLabel = "Realtime Indexing Status Projection") => import_v413.z.object({
|
|
1793
1825
|
projectedAt: makeUnixTimestampSchema(valueLabel),
|
|
1794
1826
|
worstCaseDistance: makeDurationSchema(valueLabel),
|
|
1795
1827
|
snapshot: makeCrossChainIndexingStatusSnapshotSchema(valueLabel)
|
|
1796
1828
|
}).check(invariant_realtimeIndexingStatusProjectionProjectedAtIsAfterOrEqualToSnapshotTime).check(invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect);
|
|
1829
|
+
var makeSerializedRealtimeIndexingStatusProjectionSchema = (valueLabel = "Value") => import_v413.z.object({
|
|
1830
|
+
snapshot: makeSerializedCrossChainIndexingStatusSnapshotSchema(valueLabel),
|
|
1831
|
+
projectedAt: makeUnixTimestampSchema(valueLabel),
|
|
1832
|
+
worstCaseDistance: makeDurationSchema(valueLabel)
|
|
1833
|
+
});
|
|
1797
1834
|
|
|
1798
1835
|
// src/ensindexer/indexing-status/deserialize/realtime-indexing-status-projection.ts
|
|
1836
|
+
function buildUnvalidatedRealtimeIndexingStatusProjection(serializedProjection) {
|
|
1837
|
+
return {
|
|
1838
|
+
...serializedProjection,
|
|
1839
|
+
snapshot: buildUnvalidatedCrossChainIndexingStatusSnapshot(serializedProjection.snapshot)
|
|
1840
|
+
};
|
|
1841
|
+
}
|
|
1799
1842
|
function deserializeRealtimeIndexingStatusProjection(maybeProjection, valueLabel) {
|
|
1800
|
-
const schema = makeRealtimeIndexingStatusProjectionSchema(valueLabel);
|
|
1843
|
+
const schema = makeSerializedRealtimeIndexingStatusProjectionSchema(valueLabel).transform(buildUnvalidatedRealtimeIndexingStatusProjection).pipe(makeRealtimeIndexingStatusProjectionSchema(valueLabel));
|
|
1801
1844
|
const parsed = schema.safeParse(maybeProjection);
|
|
1802
1845
|
if (parsed.error) {
|
|
1803
1846
|
throw new Error(
|
|
1804
1847
|
`Cannot deserialize into RealtimeIndexingStatusProjection:
|
|
1805
|
-
${(0,
|
|
1848
|
+
${(0, import_v414.prettifyError)(parsed.error)}
|
|
1806
1849
|
`
|
|
1807
1850
|
);
|
|
1808
1851
|
}
|
|
@@ -1928,45 +1971,76 @@ function serializeRealtimeIndexingStatusProjection(indexingProjection) {
|
|
|
1928
1971
|
}
|
|
1929
1972
|
|
|
1930
1973
|
// src/ensindexer/indexing-status/validate/chain-indexing-status-snapshot.ts
|
|
1931
|
-
var
|
|
1974
|
+
var import_v415 = require("zod/v4");
|
|
1932
1975
|
function validateChainIndexingStatusSnapshot(unvalidatedSnapshot, valueLabel) {
|
|
1933
1976
|
const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
|
|
1934
1977
|
const parsed = schema.safeParse(unvalidatedSnapshot);
|
|
1935
1978
|
if (parsed.error) {
|
|
1936
1979
|
throw new Error(`Invalid ChainIndexingStatusSnapshot:
|
|
1937
|
-
${(0,
|
|
1980
|
+
${(0, import_v415.prettifyError)(parsed.error)}
|
|
1938
1981
|
`);
|
|
1939
1982
|
}
|
|
1940
1983
|
return parsed.data;
|
|
1941
1984
|
}
|
|
1942
1985
|
|
|
1943
|
-
// src/
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
function deserializeConfigResponse(serializedResponse) {
|
|
1955
|
-
return deserializeENSApiPublicConfig(serializedResponse);
|
|
1986
|
+
// src/ensindexer/indexing-status/validate/cross-chain-indexing-status-snapshot.ts
|
|
1987
|
+
var import_v416 = require("zod/v4");
|
|
1988
|
+
function validateCrossChainIndexingStatusSnapshot(unvalidatedSnapshot, valueLabel) {
|
|
1989
|
+
const schema = makeCrossChainIndexingStatusSnapshotSchema(valueLabel);
|
|
1990
|
+
const parsed = schema.safeParse(unvalidatedSnapshot);
|
|
1991
|
+
if (parsed.error) {
|
|
1992
|
+
throw new Error(`Invalid CrossChainIndexingStatusSnapshot:
|
|
1993
|
+
${(0, import_v416.prettifyError)(parsed.error)}
|
|
1994
|
+
`);
|
|
1995
|
+
}
|
|
1996
|
+
return parsed.data;
|
|
1956
1997
|
}
|
|
1957
1998
|
|
|
1958
|
-
// src/
|
|
1959
|
-
|
|
1960
|
-
|
|
1999
|
+
// src/ensindexer/indexing-status/validate/omnichain-indexing-status-snapshot.ts
|
|
2000
|
+
var import_v417 = require("zod/v4");
|
|
2001
|
+
function validateOmnichainIndexingStatusSnapshot(unvalidatedSnapshot, valueLabel) {
|
|
2002
|
+
const schema = makeOmnichainIndexingStatusSnapshotSchema(valueLabel);
|
|
2003
|
+
const parsed = schema.safeParse(unvalidatedSnapshot);
|
|
2004
|
+
if (parsed.error) {
|
|
2005
|
+
throw new Error(`Invalid OmnichainIndexingStatusSnapshot:
|
|
2006
|
+
${(0, import_v417.prettifyError)(parsed.error)}
|
|
2007
|
+
`);
|
|
2008
|
+
}
|
|
2009
|
+
return parsed.data;
|
|
1961
2010
|
}
|
|
1962
2011
|
|
|
1963
|
-
// src/
|
|
2012
|
+
// src/ensindexer/indexing-status/validate/realtime-indexing-status-projection.ts
|
|
1964
2013
|
var import_v418 = require("zod/v4");
|
|
2014
|
+
function validateRealtimeIndexingStatusProjection(unvalidatedProjection, valueLabel) {
|
|
2015
|
+
const schema = makeRealtimeIndexingStatusProjectionSchema(valueLabel);
|
|
2016
|
+
const parsed = schema.safeParse(unvalidatedProjection);
|
|
2017
|
+
if (parsed.error) {
|
|
2018
|
+
throw new Error(`Invalid RealtimeIndexingStatusProjection:
|
|
2019
|
+
${(0, import_v418.prettifyError)(parsed.error)}
|
|
2020
|
+
`);
|
|
2021
|
+
}
|
|
2022
|
+
return parsed.data;
|
|
2023
|
+
}
|
|
1965
2024
|
|
|
1966
|
-
// src/
|
|
1967
|
-
|
|
2025
|
+
// src/ensapi/config/serialize.ts
|
|
2026
|
+
function serializeENSApiPublicConfig(config) {
|
|
2027
|
+
const { version, theGraphFallback, ensIndexerPublicConfig } = config;
|
|
2028
|
+
return {
|
|
2029
|
+
version,
|
|
2030
|
+
theGraphFallback,
|
|
2031
|
+
ensIndexerPublicConfig: serializeENSIndexerPublicConfig(ensIndexerPublicConfig)
|
|
2032
|
+
};
|
|
2033
|
+
}
|
|
2034
|
+
|
|
2035
|
+
// src/ensapi/api/config/serialize.ts
|
|
2036
|
+
function serializeConfigResponse(response) {
|
|
2037
|
+
return serializeENSApiPublicConfig(response);
|
|
2038
|
+
}
|
|
2039
|
+
|
|
2040
|
+
// src/ensapi/api/indexing-status/deserialize.ts
|
|
2041
|
+
var import_v420 = require("zod/v4");
|
|
1968
2042
|
|
|
1969
|
-
// src/api/indexing-status/response.ts
|
|
2043
|
+
// src/ensapi/api/indexing-status/response.ts
|
|
1970
2044
|
var IndexingStatusResponseCodes = {
|
|
1971
2045
|
/**
|
|
1972
2046
|
* Represents that the indexing status is available.
|
|
@@ -1978,31 +2052,51 @@ var IndexingStatusResponseCodes = {
|
|
|
1978
2052
|
Error: "error"
|
|
1979
2053
|
};
|
|
1980
2054
|
|
|
1981
|
-
// src/api/indexing-status/zod-schemas.ts
|
|
1982
|
-
var
|
|
1983
|
-
|
|
2055
|
+
// src/ensapi/api/indexing-status/zod-schemas.ts
|
|
2056
|
+
var import_v419 = require("zod/v4");
|
|
2057
|
+
var makeIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => import_v419.z.strictObject({
|
|
2058
|
+
responseCode: import_v419.z.literal(IndexingStatusResponseCodes.Ok),
|
|
1984
2059
|
realtimeProjection: makeRealtimeIndexingStatusProjectionSchema(valueLabel)
|
|
1985
2060
|
});
|
|
1986
|
-
var makeIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") =>
|
|
1987
|
-
responseCode:
|
|
2061
|
+
var makeIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => import_v419.z.strictObject({
|
|
2062
|
+
responseCode: import_v419.z.literal(IndexingStatusResponseCodes.Error)
|
|
1988
2063
|
});
|
|
1989
|
-
var makeIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") =>
|
|
2064
|
+
var makeIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => import_v419.z.discriminatedUnion("responseCode", [
|
|
1990
2065
|
makeIndexingStatusResponseOkSchema(valueLabel),
|
|
1991
2066
|
makeIndexingStatusResponseErrorSchema(valueLabel)
|
|
1992
2067
|
]);
|
|
2068
|
+
var makeSerializedIndexingStatusResponseOkSchema = (valueLabel = "Serialized Indexing Status Response OK") => import_v419.z.strictObject({
|
|
2069
|
+
responseCode: import_v419.z.literal(IndexingStatusResponseCodes.Ok),
|
|
2070
|
+
realtimeProjection: makeSerializedRealtimeIndexingStatusProjectionSchema(valueLabel)
|
|
2071
|
+
});
|
|
2072
|
+
var makeSerializedIndexingStatusResponseSchema = (valueLabel = "Serialized Indexing Status Response") => import_v419.z.discriminatedUnion("responseCode", [
|
|
2073
|
+
makeSerializedIndexingStatusResponseOkSchema(valueLabel),
|
|
2074
|
+
makeIndexingStatusResponseErrorSchema(valueLabel)
|
|
2075
|
+
]);
|
|
1993
2076
|
|
|
1994
|
-
// src/api/indexing-status/deserialize.ts
|
|
2077
|
+
// src/ensapi/api/indexing-status/deserialize.ts
|
|
2078
|
+
function buildUnvalidatedIndexingStatusResponse(serializedResponse) {
|
|
2079
|
+
if (serializedResponse.responseCode !== IndexingStatusResponseCodes.Ok) {
|
|
2080
|
+
return serializedResponse;
|
|
2081
|
+
}
|
|
2082
|
+
return {
|
|
2083
|
+
...serializedResponse,
|
|
2084
|
+
realtimeProjection: buildUnvalidatedRealtimeIndexingStatusProjection(
|
|
2085
|
+
serializedResponse.realtimeProjection
|
|
2086
|
+
)
|
|
2087
|
+
};
|
|
2088
|
+
}
|
|
1995
2089
|
function deserializeIndexingStatusResponse(maybeResponse) {
|
|
1996
|
-
const parsed = makeIndexingStatusResponseSchema().safeParse(maybeResponse);
|
|
2090
|
+
const parsed = makeSerializedIndexingStatusResponseSchema().transform(buildUnvalidatedIndexingStatusResponse).pipe(makeIndexingStatusResponseSchema()).safeParse(maybeResponse);
|
|
1997
2091
|
if (parsed.error) {
|
|
1998
2092
|
throw new Error(`Cannot deserialize IndexingStatusResponse:
|
|
1999
|
-
${(0,
|
|
2093
|
+
${(0, import_v420.prettifyError)(parsed.error)}
|
|
2000
2094
|
`);
|
|
2001
2095
|
}
|
|
2002
2096
|
return parsed.data;
|
|
2003
2097
|
}
|
|
2004
2098
|
|
|
2005
|
-
// src/api/indexing-status/serialize.ts
|
|
2099
|
+
// src/ensapi/api/indexing-status/serialize.ts
|
|
2006
2100
|
function serializeIndexingStatusResponse(response) {
|
|
2007
2101
|
switch (response.responseCode) {
|
|
2008
2102
|
case IndexingStatusResponseCodes.Ok:
|
|
@@ -2015,31 +2109,16 @@ function serializeIndexingStatusResponse(response) {
|
|
|
2015
2109
|
}
|
|
2016
2110
|
}
|
|
2017
2111
|
|
|
2018
|
-
// src/api/name-tokens/deserialize.ts
|
|
2019
|
-
var
|
|
2112
|
+
// src/ensapi/api/name-tokens/deserialize.ts
|
|
2113
|
+
var import_v425 = require("zod/v4");
|
|
2020
2114
|
|
|
2021
|
-
// src/api/name-tokens/zod-schemas.ts
|
|
2115
|
+
// src/ensapi/api/name-tokens/zod-schemas.ts
|
|
2022
2116
|
var import_viem14 = require("viem");
|
|
2023
|
-
var
|
|
2024
|
-
|
|
2025
|
-
// src/tokenscope/assets.ts
|
|
2026
|
-
var import_viem13 = require("viem");
|
|
2027
|
-
var import_v420 = require("zod/v4");
|
|
2028
|
-
|
|
2029
|
-
// src/tokenscope/zod-schemas.ts
|
|
2030
|
-
var import_caip3 = require("caip");
|
|
2031
|
-
var import_viem12 = require("viem");
|
|
2032
|
-
var import_v419 = require("zod/v4");
|
|
2033
|
-
|
|
2034
|
-
// src/shared/types.ts
|
|
2035
|
-
var AssetNamespaces = {
|
|
2036
|
-
ERC721: "erc721",
|
|
2037
|
-
ERC1155: "erc1155"
|
|
2038
|
-
};
|
|
2117
|
+
var import_v424 = require("zod/v4");
|
|
2039
2118
|
|
|
2040
2119
|
// src/tokenscope/name-token.ts
|
|
2041
|
-
var
|
|
2042
|
-
var
|
|
2120
|
+
var import_viem13 = require("viem");
|
|
2121
|
+
var import_datasources6 = require("@ensnode/datasources");
|
|
2043
2122
|
|
|
2044
2123
|
// src/shared/account-id.ts
|
|
2045
2124
|
var import_viem10 = require("viem");
|
|
@@ -2048,9 +2127,9 @@ var accountIdEqual = (a, b) => {
|
|
|
2048
2127
|
};
|
|
2049
2128
|
|
|
2050
2129
|
// src/shared/datasource-contract.ts
|
|
2051
|
-
var
|
|
2130
|
+
var import_datasources5 = require("@ensnode/datasources");
|
|
2052
2131
|
var maybeGetDatasourceContract = (namespaceId, datasourceName, contractName) => {
|
|
2053
|
-
const datasource = (0,
|
|
2132
|
+
const datasource = (0, import_datasources5.maybeGetDatasource)(namespaceId, datasourceName);
|
|
2054
2133
|
if (!datasource) return void 0;
|
|
2055
2134
|
const address = datasource.contracts[contractName]?.address;
|
|
2056
2135
|
if (address === void 0 || Array.isArray(address)) return void 0;
|
|
@@ -2073,89 +2152,26 @@ var makeContractMatcher = (namespace, b) => (datasourceName, contractName) => {
|
|
|
2073
2152
|
return a && accountIdEqual(a, b);
|
|
2074
2153
|
};
|
|
2075
2154
|
|
|
2076
|
-
// src/tokenscope/
|
|
2077
|
-
var
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
* Name Token ownership has been transferred to the null address.
|
|
2090
|
-
*/
|
|
2091
|
-
Burned: "burned",
|
|
2092
|
-
/**
|
|
2093
|
-
* Name Token ownership is unknown.
|
|
2094
|
-
*/
|
|
2095
|
-
Unknown: "unknown"
|
|
2155
|
+
// src/tokenscope/assets.ts
|
|
2156
|
+
var import_viem12 = require("viem");
|
|
2157
|
+
var import_v422 = require("zod/v4");
|
|
2158
|
+
|
|
2159
|
+
// src/tokenscope/zod-schemas.ts
|
|
2160
|
+
var import_caip3 = require("caip");
|
|
2161
|
+
var import_viem11 = require("viem");
|
|
2162
|
+
var import_v421 = require("zod/v4");
|
|
2163
|
+
|
|
2164
|
+
// src/shared/types.ts
|
|
2165
|
+
var AssetNamespaces = {
|
|
2166
|
+
ERC721: "erc721",
|
|
2167
|
+
ERC1155: "erc1155"
|
|
2096
2168
|
};
|
|
2097
|
-
function serializeNameToken(nameToken) {
|
|
2098
|
-
return {
|
|
2099
|
-
token: serializeAssetId(nameToken.token),
|
|
2100
|
-
ownership: nameToken.ownership,
|
|
2101
|
-
mintStatus: nameToken.mintStatus
|
|
2102
|
-
};
|
|
2103
|
-
}
|
|
2104
|
-
function getNameWrapperAccounts(namespaceId) {
|
|
2105
|
-
const ethnamesNameWrapperAccount = getDatasourceContract(
|
|
2106
|
-
namespaceId,
|
|
2107
|
-
import_datasources5.DatasourceNames.ENSRoot,
|
|
2108
|
-
"NameWrapper"
|
|
2109
|
-
);
|
|
2110
|
-
const lineanamesNameWrapperAccount = maybeGetDatasourceContract(
|
|
2111
|
-
namespaceId,
|
|
2112
|
-
import_datasources5.DatasourceNames.Lineanames,
|
|
2113
|
-
"NameWrapper"
|
|
2114
|
-
);
|
|
2115
|
-
const nameWrapperAccounts = [
|
|
2116
|
-
// NameWrapper for direct subnames of .eth is defined for all ENS namespaces
|
|
2117
|
-
ethnamesNameWrapperAccount
|
|
2118
|
-
];
|
|
2119
|
-
if (lineanamesNameWrapperAccount) {
|
|
2120
|
-
nameWrapperAccounts.push(lineanamesNameWrapperAccount);
|
|
2121
|
-
}
|
|
2122
|
-
return nameWrapperAccounts;
|
|
2123
|
-
}
|
|
2124
|
-
function getNameTokenOwnership(namespaceId, name, owner) {
|
|
2125
|
-
const nameWrapperAccounts = getNameWrapperAccounts(namespaceId);
|
|
2126
|
-
const hasNameWrapperOwnership = nameWrapperAccounts.some(
|
|
2127
|
-
(nameWrapperAccount) => accountIdEqual(owner, nameWrapperAccount)
|
|
2128
|
-
);
|
|
2129
|
-
if (hasNameWrapperOwnership) {
|
|
2130
|
-
return {
|
|
2131
|
-
ownershipType: NameTokenOwnershipTypes.NameWrapper,
|
|
2132
|
-
owner
|
|
2133
|
-
};
|
|
2134
|
-
}
|
|
2135
|
-
if ((0, import_viem11.isAddressEqual)(owner.address, import_viem11.zeroAddress)) {
|
|
2136
|
-
return {
|
|
2137
|
-
ownershipType: NameTokenOwnershipTypes.Burned,
|
|
2138
|
-
owner
|
|
2139
|
-
};
|
|
2140
|
-
}
|
|
2141
|
-
const parentName = getParentNameFQDN(name);
|
|
2142
|
-
if (parentName === "eth") {
|
|
2143
|
-
return {
|
|
2144
|
-
ownershipType: NameTokenOwnershipTypes.FullyOnchain,
|
|
2145
|
-
owner
|
|
2146
|
-
};
|
|
2147
|
-
}
|
|
2148
|
-
return {
|
|
2149
|
-
ownershipType: NameTokenOwnershipTypes.Unknown,
|
|
2150
|
-
owner
|
|
2151
|
-
};
|
|
2152
|
-
}
|
|
2153
2169
|
|
|
2154
2170
|
// src/tokenscope/zod-schemas.ts
|
|
2155
|
-
var tokenIdSchemaSerializable =
|
|
2156
|
-
var tokenIdSchemaNative =
|
|
2171
|
+
var tokenIdSchemaSerializable = import_v421.z.string();
|
|
2172
|
+
var tokenIdSchemaNative = import_v421.z.preprocess(
|
|
2157
2173
|
(v) => typeof v === "string" ? BigInt(v) : v,
|
|
2158
|
-
|
|
2174
|
+
import_v421.z.bigint().positive()
|
|
2159
2175
|
);
|
|
2160
2176
|
function makeTokenIdSchema(_valueLabel = "Token ID Schema", serializable = false) {
|
|
2161
2177
|
if (serializable) {
|
|
@@ -2165,13 +2181,13 @@ function makeTokenIdSchema(_valueLabel = "Token ID Schema", serializable = false
|
|
|
2165
2181
|
}
|
|
2166
2182
|
}
|
|
2167
2183
|
var makeAssetIdSchema = (valueLabel = "Asset ID Schema", serializable) => {
|
|
2168
|
-
return
|
|
2169
|
-
assetNamespace:
|
|
2184
|
+
return import_v421.z.object({
|
|
2185
|
+
assetNamespace: import_v421.z.enum(AssetNamespaces),
|
|
2170
2186
|
contract: makeAccountIdSchema(valueLabel),
|
|
2171
2187
|
tokenId: makeTokenIdSchema(valueLabel, serializable ?? false)
|
|
2172
2188
|
});
|
|
2173
2189
|
};
|
|
2174
|
-
var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") =>
|
|
2190
|
+
var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") => import_v421.z.preprocess((v) => {
|
|
2175
2191
|
if (typeof v === "string") {
|
|
2176
2192
|
const result = new import_caip3.AssetId(v);
|
|
2177
2193
|
return {
|
|
@@ -2187,7 +2203,7 @@ var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") => import_
|
|
|
2187
2203
|
}, makeAssetIdSchema(valueLabel));
|
|
2188
2204
|
function invariant_nameTokenOwnershipHasNonZeroAddressOwner(ctx) {
|
|
2189
2205
|
const ownership = ctx.value;
|
|
2190
|
-
if (ctx.value.owner.address ===
|
|
2206
|
+
if (ctx.value.owner.address === import_viem11.zeroAddress) {
|
|
2191
2207
|
ctx.issues.push({
|
|
2192
2208
|
code: "custom",
|
|
2193
2209
|
input: ctx.value,
|
|
@@ -2195,25 +2211,25 @@ function invariant_nameTokenOwnershipHasNonZeroAddressOwner(ctx) {
|
|
|
2195
2211
|
});
|
|
2196
2212
|
}
|
|
2197
2213
|
}
|
|
2198
|
-
var makeNameTokenOwnershipNameWrapperSchema = (valueLabel = "Name Token Ownership NameWrapper") =>
|
|
2199
|
-
ownershipType:
|
|
2214
|
+
var makeNameTokenOwnershipNameWrapperSchema = (valueLabel = "Name Token Ownership NameWrapper") => import_v421.z.object({
|
|
2215
|
+
ownershipType: import_v421.z.literal(NameTokenOwnershipTypes.NameWrapper),
|
|
2200
2216
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2201
2217
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2202
|
-
var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") =>
|
|
2203
|
-
ownershipType:
|
|
2218
|
+
var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") => import_v421.z.object({
|
|
2219
|
+
ownershipType: import_v421.z.literal(NameTokenOwnershipTypes.FullyOnchain),
|
|
2204
2220
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2205
2221
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2206
|
-
var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") =>
|
|
2207
|
-
ownershipType:
|
|
2222
|
+
var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") => import_v421.z.object({
|
|
2223
|
+
ownershipType: import_v421.z.literal(NameTokenOwnershipTypes.Burned),
|
|
2208
2224
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2209
2225
|
}).check(invariant_nameTokenOwnershipHasZeroAddressOwner);
|
|
2210
|
-
var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") =>
|
|
2211
|
-
ownershipType:
|
|
2226
|
+
var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") => import_v421.z.object({
|
|
2227
|
+
ownershipType: import_v421.z.literal(NameTokenOwnershipTypes.Unknown),
|
|
2212
2228
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2213
2229
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2214
2230
|
function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
|
|
2215
2231
|
const ownership = ctx.value;
|
|
2216
|
-
if (ctx.value.owner.address !==
|
|
2232
|
+
if (ctx.value.owner.address !== import_viem11.zeroAddress) {
|
|
2217
2233
|
ctx.issues.push({
|
|
2218
2234
|
code: "custom",
|
|
2219
2235
|
input: ctx.value,
|
|
@@ -2221,16 +2237,16 @@ function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
|
|
|
2221
2237
|
});
|
|
2222
2238
|
}
|
|
2223
2239
|
}
|
|
2224
|
-
var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") =>
|
|
2240
|
+
var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") => import_v421.z.discriminatedUnion("ownershipType", [
|
|
2225
2241
|
makeNameTokenOwnershipNameWrapperSchema(valueLabel),
|
|
2226
2242
|
makeNameTokenOwnershipFullyOnchainSchema(valueLabel),
|
|
2227
2243
|
makeNameTokenOwnershipBurnedSchema(valueLabel),
|
|
2228
2244
|
makeNameTokenOwnershipUnknownSchema(valueLabel)
|
|
2229
2245
|
]);
|
|
2230
|
-
var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) =>
|
|
2246
|
+
var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) => import_v421.z.object({
|
|
2231
2247
|
token: makeAssetIdSchema(`${valueLabel}.token`, serializable),
|
|
2232
2248
|
ownership: makeNameTokenOwnershipSchema(`${valueLabel}.ownership`),
|
|
2233
|
-
mintStatus:
|
|
2249
|
+
mintStatus: import_v421.z.enum(NFTMintStatuses)
|
|
2234
2250
|
});
|
|
2235
2251
|
|
|
2236
2252
|
// src/tokenscope/assets.ts
|
|
@@ -2246,7 +2262,7 @@ function deserializeAssetId(maybeAssetId, valueLabel) {
|
|
|
2246
2262
|
const parsed = schema.safeParse(maybeAssetId);
|
|
2247
2263
|
if (parsed.error) {
|
|
2248
2264
|
throw new RangeError(`Cannot deserialize AssetId:
|
|
2249
|
-
${(0,
|
|
2265
|
+
${(0, import_v422.prettifyError)(parsed.error)}
|
|
2250
2266
|
`);
|
|
2251
2267
|
}
|
|
2252
2268
|
return parsed.data;
|
|
@@ -2256,7 +2272,7 @@ function parseAssetId(maybeAssetId, valueLabel) {
|
|
|
2256
2272
|
const parsed = schema.safeParse(maybeAssetId);
|
|
2257
2273
|
if (parsed.error) {
|
|
2258
2274
|
throw new RangeError(`Cannot parse AssetId:
|
|
2259
|
-
${(0,
|
|
2275
|
+
${(0, import_v422.prettifyError)(parsed.error)}
|
|
2260
2276
|
`);
|
|
2261
2277
|
}
|
|
2262
2278
|
return parsed.data;
|
|
@@ -2391,11 +2407,11 @@ var NFTTransferTypes = {
|
|
|
2391
2407
|
};
|
|
2392
2408
|
var getNFTTransferType = (from, to, allowMintedRemint, metadata, currentlyIndexedOwner) => {
|
|
2393
2409
|
const isIndexed = currentlyIndexedOwner !== void 0;
|
|
2394
|
-
const isIndexedAsMinted = isIndexed && !(0,
|
|
2395
|
-
const isMint = (0,
|
|
2396
|
-
const isBurn = (0,
|
|
2397
|
-
const isSelfTransfer = (0,
|
|
2398
|
-
if (isIndexed && !(0,
|
|
2410
|
+
const isIndexedAsMinted = isIndexed && !(0, import_viem12.isAddressEqual)(currentlyIndexedOwner, import_viem12.zeroAddress);
|
|
2411
|
+
const isMint = (0, import_viem12.isAddressEqual)(from, import_viem12.zeroAddress);
|
|
2412
|
+
const isBurn = (0, import_viem12.isAddressEqual)(to, import_viem12.zeroAddress);
|
|
2413
|
+
const isSelfTransfer = (0, import_viem12.isAddressEqual)(from, to);
|
|
2414
|
+
if (isIndexed && !(0, import_viem12.isAddressEqual)(currentlyIndexedOwner, from)) {
|
|
2399
2415
|
if (isMint && allowMintedRemint) {
|
|
2400
2416
|
} else {
|
|
2401
2417
|
throw new Error(
|
|
@@ -2477,14 +2493,92 @@ ${formatNFTTransferEventMetadata(metadata)}`
|
|
|
2477
2493
|
}
|
|
2478
2494
|
};
|
|
2479
2495
|
|
|
2480
|
-
// src/
|
|
2481
|
-
var
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2496
|
+
// src/tokenscope/name-token.ts
|
|
2497
|
+
var NameTokenOwnershipTypes = {
|
|
2498
|
+
/**
|
|
2499
|
+
* Name Token is owned by NameWrapper account.
|
|
2500
|
+
*/
|
|
2501
|
+
NameWrapper: "namewrapper",
|
|
2502
|
+
/**
|
|
2503
|
+
* Name Token is owned fully onchain.
|
|
2504
|
+
*
|
|
2505
|
+
* This ownership type can only apply to direct subnames of `.eth`
|
|
2506
|
+
*/
|
|
2507
|
+
FullyOnchain: "fully-onchain",
|
|
2508
|
+
/**
|
|
2509
|
+
* Name Token ownership has been transferred to the null address.
|
|
2510
|
+
*/
|
|
2511
|
+
Burned: "burned",
|
|
2512
|
+
/**
|
|
2513
|
+
* Name Token ownership is unknown.
|
|
2514
|
+
*/
|
|
2515
|
+
Unknown: "unknown"
|
|
2516
|
+
};
|
|
2517
|
+
function serializeNameToken(nameToken) {
|
|
2518
|
+
return {
|
|
2519
|
+
token: serializeAssetId(nameToken.token),
|
|
2520
|
+
ownership: nameToken.ownership,
|
|
2521
|
+
mintStatus: nameToken.mintStatus
|
|
2522
|
+
};
|
|
2523
|
+
}
|
|
2524
|
+
function getNameWrapperAccounts(namespaceId) {
|
|
2525
|
+
const ethnamesNameWrapperAccount = getDatasourceContract(
|
|
2526
|
+
namespaceId,
|
|
2527
|
+
import_datasources6.DatasourceNames.ENSRoot,
|
|
2528
|
+
"NameWrapper"
|
|
2529
|
+
);
|
|
2530
|
+
const lineanamesNameWrapperAccount = maybeGetDatasourceContract(
|
|
2531
|
+
namespaceId,
|
|
2532
|
+
import_datasources6.DatasourceNames.Lineanames,
|
|
2533
|
+
"NameWrapper"
|
|
2534
|
+
);
|
|
2535
|
+
const nameWrapperAccounts = [
|
|
2536
|
+
// NameWrapper for direct subnames of .eth is defined for all ENS namespaces
|
|
2537
|
+
ethnamesNameWrapperAccount
|
|
2538
|
+
];
|
|
2539
|
+
if (lineanamesNameWrapperAccount) {
|
|
2540
|
+
nameWrapperAccounts.push(lineanamesNameWrapperAccount);
|
|
2541
|
+
}
|
|
2542
|
+
return nameWrapperAccounts;
|
|
2543
|
+
}
|
|
2544
|
+
function getNameTokenOwnership(namespaceId, name, owner) {
|
|
2545
|
+
const nameWrapperAccounts = getNameWrapperAccounts(namespaceId);
|
|
2546
|
+
const hasNameWrapperOwnership = nameWrapperAccounts.some(
|
|
2547
|
+
(nameWrapperAccount) => accountIdEqual(owner, nameWrapperAccount)
|
|
2548
|
+
);
|
|
2549
|
+
if (hasNameWrapperOwnership) {
|
|
2550
|
+
return {
|
|
2551
|
+
ownershipType: NameTokenOwnershipTypes.NameWrapper,
|
|
2552
|
+
owner
|
|
2553
|
+
};
|
|
2554
|
+
}
|
|
2555
|
+
if ((0, import_viem13.isAddressEqual)(owner.address, import_viem13.zeroAddress)) {
|
|
2556
|
+
return {
|
|
2557
|
+
ownershipType: NameTokenOwnershipTypes.Burned,
|
|
2558
|
+
owner
|
|
2559
|
+
};
|
|
2560
|
+
}
|
|
2561
|
+
const parentName = getParentNameFQDN(name);
|
|
2562
|
+
if (parentName === "eth") {
|
|
2563
|
+
return {
|
|
2564
|
+
ownershipType: NameTokenOwnershipTypes.FullyOnchain,
|
|
2565
|
+
owner
|
|
2566
|
+
};
|
|
2567
|
+
}
|
|
2568
|
+
return {
|
|
2569
|
+
ownershipType: NameTokenOwnershipTypes.Unknown,
|
|
2570
|
+
owner
|
|
2571
|
+
};
|
|
2572
|
+
}
|
|
2573
|
+
|
|
2574
|
+
// src/ensapi/api/shared/errors/zod-schemas.ts
|
|
2575
|
+
var import_v423 = require("zod/v4");
|
|
2576
|
+
var ErrorResponseSchema = import_v423.z.object({
|
|
2577
|
+
message: import_v423.z.string(),
|
|
2578
|
+
details: import_v423.z.optional(import_v423.z.unknown())
|
|
2485
2579
|
});
|
|
2486
2580
|
|
|
2487
|
-
// src/api/name-tokens/response.ts
|
|
2581
|
+
// src/ensapi/api/name-tokens/response.ts
|
|
2488
2582
|
var NameTokensResponseCodes = {
|
|
2489
2583
|
/**
|
|
2490
2584
|
* Represents a response when Name Tokens API can respond with requested data.
|
|
@@ -2519,11 +2613,11 @@ var NameTokensResponseErrorCodes = {
|
|
|
2519
2613
|
IndexingStatusUnsupported: "unsupported-indexing-status"
|
|
2520
2614
|
};
|
|
2521
2615
|
|
|
2522
|
-
// src/api/name-tokens/zod-schemas.ts
|
|
2523
|
-
var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) =>
|
|
2616
|
+
// src/ensapi/api/name-tokens/zod-schemas.ts
|
|
2617
|
+
var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) => import_v424.z.object({
|
|
2524
2618
|
domainId: makeNodeSchema(`${valueLabel}.domainId`),
|
|
2525
2619
|
name: makeReinterpretedNameSchema(valueLabel),
|
|
2526
|
-
tokens:
|
|
2620
|
+
tokens: import_v424.z.array(makeNameTokenSchema(`${valueLabel}.tokens`, serializable)).nonempty(),
|
|
2527
2621
|
expiresAt: makeUnixTimestampSchema(`${valueLabel}.expiresAt`),
|
|
2528
2622
|
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
|
|
2529
2623
|
}).check(function invariant_nameIsAssociatedWithDomainId(ctx) {
|
|
@@ -2565,51 +2659,51 @@ var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", seria
|
|
|
2565
2659
|
});
|
|
2566
2660
|
}
|
|
2567
2661
|
});
|
|
2568
|
-
var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) =>
|
|
2569
|
-
responseCode:
|
|
2662
|
+
var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) => import_v424.z.strictObject({
|
|
2663
|
+
responseCode: import_v424.z.literal(NameTokensResponseCodes.Ok),
|
|
2570
2664
|
registeredNameTokens: makeRegisteredNameTokenSchema(`${valueLabel}.nameTokens`, serializable)
|
|
2571
2665
|
});
|
|
2572
|
-
var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") =>
|
|
2573
|
-
responseCode:
|
|
2574
|
-
errorCode:
|
|
2666
|
+
var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") => import_v424.z.strictObject({
|
|
2667
|
+
responseCode: import_v424.z.literal(NameTokensResponseCodes.Error),
|
|
2668
|
+
errorCode: import_v424.z.literal(NameTokensResponseErrorCodes.NameTokensNotIndexed),
|
|
2575
2669
|
error: ErrorResponseSchema
|
|
2576
2670
|
});
|
|
2577
|
-
var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") =>
|
|
2578
|
-
responseCode:
|
|
2579
|
-
errorCode:
|
|
2671
|
+
var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") => import_v424.z.strictObject({
|
|
2672
|
+
responseCode: import_v424.z.literal(NameTokensResponseCodes.Error),
|
|
2673
|
+
errorCode: import_v424.z.literal(NameTokensResponseErrorCodes.EnsIndexerConfigUnsupported),
|
|
2580
2674
|
error: ErrorResponseSchema
|
|
2581
2675
|
});
|
|
2582
|
-
var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") =>
|
|
2583
|
-
responseCode:
|
|
2584
|
-
errorCode:
|
|
2676
|
+
var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") => import_v424.z.strictObject({
|
|
2677
|
+
responseCode: import_v424.z.literal(NameTokensResponseCodes.Error),
|
|
2678
|
+
errorCode: import_v424.z.literal(NameTokensResponseErrorCodes.IndexingStatusUnsupported),
|
|
2585
2679
|
error: ErrorResponseSchema
|
|
2586
2680
|
});
|
|
2587
|
-
var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") =>
|
|
2681
|
+
var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") => import_v424.z.discriminatedUnion("errorCode", [
|
|
2588
2682
|
makeNameTokensResponseErrorNameTokensNotIndexedSchema(valueLabel),
|
|
2589
2683
|
makeNameTokensResponseErrorEnsIndexerConfigUnsupported(valueLabel),
|
|
2590
2684
|
makeNameTokensResponseErrorNameIndexingStatusUnsupported(valueLabel)
|
|
2591
2685
|
]);
|
|
2592
2686
|
var makeNameTokensResponseSchema = (valueLabel = "Name Tokens Response", serializable) => {
|
|
2593
|
-
return
|
|
2687
|
+
return import_v424.z.discriminatedUnion("responseCode", [
|
|
2594
2688
|
makeNameTokensResponseOkSchema(valueLabel, serializable ?? false),
|
|
2595
2689
|
makeNameTokensResponseErrorSchema(valueLabel)
|
|
2596
2690
|
]);
|
|
2597
2691
|
};
|
|
2598
2692
|
|
|
2599
|
-
// src/api/name-tokens/deserialize.ts
|
|
2693
|
+
// src/ensapi/api/name-tokens/deserialize.ts
|
|
2600
2694
|
function deserializedNameTokensResponse(maybeResponse) {
|
|
2601
2695
|
const parsed = makeNameTokensResponseSchema("Name Tokens Response", false).safeParse(
|
|
2602
2696
|
maybeResponse
|
|
2603
2697
|
);
|
|
2604
2698
|
if (parsed.error) {
|
|
2605
2699
|
throw new Error(`Cannot deserialize NameTokensResponse:
|
|
2606
|
-
${(0,
|
|
2700
|
+
${(0, import_v425.prettifyError)(parsed.error)}
|
|
2607
2701
|
`);
|
|
2608
2702
|
}
|
|
2609
2703
|
return parsed.data;
|
|
2610
2704
|
}
|
|
2611
2705
|
|
|
2612
|
-
// src/api/name-tokens/prerequisites.ts
|
|
2706
|
+
// src/ensapi/api/name-tokens/prerequisites.ts
|
|
2613
2707
|
var nameTokensPrerequisites = Object.freeze({
|
|
2614
2708
|
/**
|
|
2615
2709
|
* Required plugins to enable Name Tokens API routes.
|
|
@@ -2648,7 +2742,7 @@ var nameTokensPrerequisites = Object.freeze({
|
|
|
2648
2742
|
}
|
|
2649
2743
|
});
|
|
2650
2744
|
|
|
2651
|
-
// src/api/name-tokens/serialize.ts
|
|
2745
|
+
// src/ensapi/api/name-tokens/serialize.ts
|
|
2652
2746
|
function serializeRegisteredNameTokens({
|
|
2653
2747
|
domainId,
|
|
2654
2748
|
name,
|
|
@@ -2676,15 +2770,15 @@ function serializeNameTokensResponse(response) {
|
|
|
2676
2770
|
}
|
|
2677
2771
|
}
|
|
2678
2772
|
|
|
2679
|
-
// src/api/registrar-actions/deserialize.ts
|
|
2680
|
-
var
|
|
2773
|
+
// src/ensapi/api/registrar-actions/deserialize.ts
|
|
2774
|
+
var import_v429 = require("zod/v4");
|
|
2681
2775
|
|
|
2682
|
-
// src/api/registrar-actions/zod-schemas.ts
|
|
2776
|
+
// src/ensapi/api/registrar-actions/zod-schemas.ts
|
|
2683
2777
|
var import_ens7 = require("viem/ens");
|
|
2684
|
-
var
|
|
2778
|
+
var import_v428 = require("zod/v4");
|
|
2685
2779
|
|
|
2686
2780
|
// src/registrars/zod-schemas.ts
|
|
2687
|
-
var
|
|
2781
|
+
var import_v426 = require("zod/v4");
|
|
2688
2782
|
|
|
2689
2783
|
// src/registrars/encoded-referrer.ts
|
|
2690
2784
|
var import_viem15 = require("viem");
|
|
@@ -2759,11 +2853,11 @@ function serializeRegistrarAction(registrarAction) {
|
|
|
2759
2853
|
}
|
|
2760
2854
|
|
|
2761
2855
|
// src/registrars/zod-schemas.ts
|
|
2762
|
-
var makeSubregistrySchema = (valueLabel = "Subregistry") =>
|
|
2856
|
+
var makeSubregistrySchema = (valueLabel = "Subregistry") => import_v426.z.object({
|
|
2763
2857
|
subregistryId: makeAccountIdSchema(`${valueLabel} Subregistry ID`),
|
|
2764
2858
|
node: makeNodeSchema(`${valueLabel} Node`)
|
|
2765
2859
|
});
|
|
2766
|
-
var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") =>
|
|
2860
|
+
var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") => import_v426.z.object({
|
|
2767
2861
|
subregistry: makeSubregistrySchema(`${valueLabel} Subregistry`),
|
|
2768
2862
|
node: makeNodeSchema(`${valueLabel} Node`),
|
|
2769
2863
|
expiresAt: makeUnixTimestampSchema(`${valueLabel} Expires at`)
|
|
@@ -2779,18 +2873,18 @@ function invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium(ctx) {
|
|
|
2779
2873
|
});
|
|
2780
2874
|
}
|
|
2781
2875
|
}
|
|
2782
|
-
var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") =>
|
|
2876
|
+
var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") => import_v426.z.union([
|
|
2783
2877
|
// pricing available
|
|
2784
|
-
|
|
2878
|
+
import_v426.z.object({
|
|
2785
2879
|
baseCost: makePriceEthSchema(`${valueLabel} Base Cost`),
|
|
2786
2880
|
premium: makePriceEthSchema(`${valueLabel} Premium`),
|
|
2787
2881
|
total: makePriceEthSchema(`${valueLabel} Total`)
|
|
2788
2882
|
}).check(invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium).transform((v) => v),
|
|
2789
2883
|
// pricing unknown
|
|
2790
|
-
|
|
2791
|
-
baseCost:
|
|
2792
|
-
premium:
|
|
2793
|
-
total:
|
|
2884
|
+
import_v426.z.object({
|
|
2885
|
+
baseCost: import_v426.z.null(),
|
|
2886
|
+
premium: import_v426.z.null(),
|
|
2887
|
+
total: import_v426.z.null()
|
|
2794
2888
|
}).transform((v) => v)
|
|
2795
2889
|
]);
|
|
2796
2890
|
function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
|
|
@@ -2813,9 +2907,9 @@ function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
|
|
|
2813
2907
|
});
|
|
2814
2908
|
}
|
|
2815
2909
|
}
|
|
2816
|
-
var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") =>
|
|
2910
|
+
var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") => import_v426.z.union([
|
|
2817
2911
|
// referral available
|
|
2818
|
-
|
|
2912
|
+
import_v426.z.object({
|
|
2819
2913
|
encodedReferrer: makeHexStringSchema(
|
|
2820
2914
|
{ bytesCount: ENCODED_REFERRER_BYTE_LENGTH },
|
|
2821
2915
|
`${valueLabel} Encoded Referrer`
|
|
@@ -2823,9 +2917,9 @@ var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral
|
|
|
2823
2917
|
decodedReferrer: makeLowercaseAddressSchema(`${valueLabel} Decoded Referrer`)
|
|
2824
2918
|
}).check(invariant_registrarActionDecodedReferrerBasedOnRawReferrer),
|
|
2825
2919
|
// referral not applicable
|
|
2826
|
-
|
|
2827
|
-
encodedReferrer:
|
|
2828
|
-
decodedReferrer:
|
|
2920
|
+
import_v426.z.object({
|
|
2921
|
+
encodedReferrer: import_v426.z.null(),
|
|
2922
|
+
decodedReferrer: import_v426.z.null()
|
|
2829
2923
|
})
|
|
2830
2924
|
]);
|
|
2831
2925
|
function invariant_eventIdsInitialElementIsTheActionId(ctx) {
|
|
@@ -2838,9 +2932,9 @@ function invariant_eventIdsInitialElementIsTheActionId(ctx) {
|
|
|
2838
2932
|
});
|
|
2839
2933
|
}
|
|
2840
2934
|
}
|
|
2841
|
-
var EventIdSchema =
|
|
2842
|
-
var EventIdsSchema =
|
|
2843
|
-
var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") =>
|
|
2935
|
+
var EventIdSchema = import_v426.z.string().nonempty();
|
|
2936
|
+
var EventIdsSchema = import_v426.z.array(EventIdSchema).min(1).transform((v) => v);
|
|
2937
|
+
var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => import_v426.z.object({
|
|
2844
2938
|
id: EventIdSchema,
|
|
2845
2939
|
incrementalDuration: makeDurationSchema(`${valueLabel} Incremental Duration`),
|
|
2846
2940
|
registrant: makeLowercaseAddressSchema(`${valueLabel} Registrant`),
|
|
@@ -2854,38 +2948,38 @@ var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => im
|
|
|
2854
2948
|
eventIds: EventIdsSchema
|
|
2855
2949
|
}).check(invariant_eventIdsInitialElementIsTheActionId);
|
|
2856
2950
|
var makeRegistrarActionRegistrationSchema = (valueLabel = "Registration ") => makeBaseRegistrarActionSchema(valueLabel).extend({
|
|
2857
|
-
type:
|
|
2951
|
+
type: import_v426.z.literal(RegistrarActionTypes.Registration)
|
|
2858
2952
|
});
|
|
2859
2953
|
var makeRegistrarActionRenewalSchema = (valueLabel = "Renewal") => makeBaseRegistrarActionSchema(valueLabel).extend({
|
|
2860
|
-
type:
|
|
2954
|
+
type: import_v426.z.literal(RegistrarActionTypes.Renewal)
|
|
2861
2955
|
});
|
|
2862
|
-
var makeRegistrarActionSchema = (valueLabel = "Registrar Action") =>
|
|
2956
|
+
var makeRegistrarActionSchema = (valueLabel = "Registrar Action") => import_v426.z.discriminatedUnion("type", [
|
|
2863
2957
|
makeRegistrarActionRegistrationSchema(`${valueLabel} Registration`),
|
|
2864
2958
|
makeRegistrarActionRenewalSchema(`${valueLabel} Renewal`)
|
|
2865
2959
|
]);
|
|
2866
2960
|
|
|
2867
|
-
// src/api/shared/pagination/zod-schemas.ts
|
|
2868
|
-
var
|
|
2961
|
+
// src/ensapi/api/shared/pagination/zod-schemas.ts
|
|
2962
|
+
var import_v427 = require("zod/v4");
|
|
2869
2963
|
|
|
2870
|
-
// src/api/shared/pagination/request.ts
|
|
2964
|
+
// src/ensapi/api/shared/pagination/request.ts
|
|
2871
2965
|
var RECORDS_PER_PAGE_DEFAULT = 10;
|
|
2872
2966
|
var RECORDS_PER_PAGE_MAX = 100;
|
|
2873
2967
|
|
|
2874
|
-
// src/api/shared/pagination/zod-schemas.ts
|
|
2875
|
-
var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") =>
|
|
2968
|
+
// src/ensapi/api/shared/pagination/zod-schemas.ts
|
|
2969
|
+
var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") => import_v427.z.object({
|
|
2876
2970
|
page: makePositiveIntegerSchema(`${valueLabel}.page`),
|
|
2877
2971
|
recordsPerPage: makePositiveIntegerSchema(`${valueLabel}.recordsPerPage`).max(
|
|
2878
2972
|
RECORDS_PER_PAGE_MAX,
|
|
2879
2973
|
`${valueLabel}.recordsPerPage must not exceed ${RECORDS_PER_PAGE_MAX}`
|
|
2880
2974
|
)
|
|
2881
2975
|
});
|
|
2882
|
-
var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") =>
|
|
2883
|
-
totalRecords:
|
|
2884
|
-
totalPages:
|
|
2885
|
-
hasNext:
|
|
2886
|
-
hasPrev:
|
|
2887
|
-
startIndex:
|
|
2888
|
-
endIndex:
|
|
2976
|
+
var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") => import_v427.z.object({
|
|
2977
|
+
totalRecords: import_v427.z.literal(0),
|
|
2978
|
+
totalPages: import_v427.z.literal(1),
|
|
2979
|
+
hasNext: import_v427.z.literal(false),
|
|
2980
|
+
hasPrev: import_v427.z.literal(false),
|
|
2981
|
+
startIndex: import_v427.z.undefined(),
|
|
2982
|
+
endIndex: import_v427.z.undefined()
|
|
2889
2983
|
}).extend(makeRequestPageParamsSchema(valueLabel).shape);
|
|
2890
2984
|
function invariant_responsePageWithRecordsIsCorrect(ctx) {
|
|
2891
2985
|
const { hasNext, hasPrev, recordsPerPage, page, totalRecords, startIndex, endIndex } = ctx.value;
|
|
@@ -2920,20 +3014,20 @@ function invariant_responsePageWithRecordsIsCorrect(ctx) {
|
|
|
2920
3014
|
});
|
|
2921
3015
|
}
|
|
2922
3016
|
}
|
|
2923
|
-
var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") =>
|
|
3017
|
+
var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") => import_v427.z.object({
|
|
2924
3018
|
totalRecords: makePositiveIntegerSchema(`${valueLabel}.totalRecords`),
|
|
2925
3019
|
totalPages: makePositiveIntegerSchema(`${valueLabel}.totalPages`),
|
|
2926
|
-
hasNext:
|
|
2927
|
-
hasPrev:
|
|
3020
|
+
hasNext: import_v427.z.boolean(),
|
|
3021
|
+
hasPrev: import_v427.z.boolean(),
|
|
2928
3022
|
startIndex: makeNonNegativeIntegerSchema(`${valueLabel}.startIndex`),
|
|
2929
3023
|
endIndex: makeNonNegativeIntegerSchema(`${valueLabel}.endIndex`)
|
|
2930
3024
|
}).extend(makeRequestPageParamsSchema(valueLabel).shape).check(invariant_responsePageWithRecordsIsCorrect);
|
|
2931
|
-
var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") =>
|
|
3025
|
+
var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") => import_v427.z.union([
|
|
2932
3026
|
makeResponsePageContextSchemaWithNoRecords(valueLabel),
|
|
2933
3027
|
makeResponsePageContextSchemaWithRecords(valueLabel)
|
|
2934
3028
|
]);
|
|
2935
3029
|
|
|
2936
|
-
// src/api/registrar-actions/response.ts
|
|
3030
|
+
// src/ensapi/api/registrar-actions/response.ts
|
|
2937
3031
|
var RegistrarActionsResponseCodes = {
|
|
2938
3032
|
/**
|
|
2939
3033
|
* Represents that Registrar Actions are available.
|
|
@@ -2945,7 +3039,7 @@ var RegistrarActionsResponseCodes = {
|
|
|
2945
3039
|
Error: "error"
|
|
2946
3040
|
};
|
|
2947
3041
|
|
|
2948
|
-
// src/api/registrar-actions/zod-schemas.ts
|
|
3042
|
+
// src/ensapi/api/registrar-actions/zod-schemas.ts
|
|
2949
3043
|
function invariant_registrationLifecycleNodeMatchesName(ctx) {
|
|
2950
3044
|
const { name, action } = ctx.value;
|
|
2951
3045
|
const expectedNode = action.registrationLifecycle.node;
|
|
@@ -2958,39 +3052,39 @@ function invariant_registrationLifecycleNodeMatchesName(ctx) {
|
|
|
2958
3052
|
});
|
|
2959
3053
|
}
|
|
2960
3054
|
}
|
|
2961
|
-
var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") =>
|
|
3055
|
+
var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") => import_v428.z.object({
|
|
2962
3056
|
action: makeRegistrarActionSchema(valueLabel),
|
|
2963
3057
|
name: makeReinterpretedNameSchema(valueLabel)
|
|
2964
3058
|
}).check(invariant_registrationLifecycleNodeMatchesName);
|
|
2965
|
-
var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") =>
|
|
2966
|
-
responseCode:
|
|
2967
|
-
registrarActions:
|
|
3059
|
+
var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") => import_v428.z.object({
|
|
3060
|
+
responseCode: import_v428.z.literal(RegistrarActionsResponseCodes.Ok),
|
|
3061
|
+
registrarActions: import_v428.z.array(makeNamedRegistrarActionSchema(valueLabel)),
|
|
2968
3062
|
pageContext: makeResponsePageContextSchema(`${valueLabel}.pageContext`),
|
|
2969
3063
|
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`).optional()
|
|
2970
3064
|
});
|
|
2971
|
-
var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") =>
|
|
2972
|
-
responseCode:
|
|
3065
|
+
var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") => import_v428.z.strictObject({
|
|
3066
|
+
responseCode: import_v428.z.literal(RegistrarActionsResponseCodes.Error),
|
|
2973
3067
|
error: ErrorResponseSchema
|
|
2974
3068
|
});
|
|
2975
|
-
var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") =>
|
|
3069
|
+
var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") => import_v428.z.discriminatedUnion("responseCode", [
|
|
2976
3070
|
makeRegistrarActionsResponseOkSchema(valueLabel),
|
|
2977
3071
|
makeRegistrarActionsResponseErrorSchema(valueLabel)
|
|
2978
3072
|
]);
|
|
2979
3073
|
|
|
2980
|
-
// src/api/registrar-actions/deserialize.ts
|
|
3074
|
+
// src/ensapi/api/registrar-actions/deserialize.ts
|
|
2981
3075
|
function deserializeRegistrarActionsResponse(maybeResponse) {
|
|
2982
3076
|
const parsed = makeRegistrarActionsResponseSchema().safeParse(maybeResponse);
|
|
2983
3077
|
if (parsed.error) {
|
|
2984
3078
|
throw new Error(
|
|
2985
3079
|
`Cannot deserialize RegistrarActionsResponse:
|
|
2986
|
-
${(0,
|
|
3080
|
+
${(0, import_v429.prettifyError)(parsed.error)}
|
|
2987
3081
|
`
|
|
2988
3082
|
);
|
|
2989
3083
|
}
|
|
2990
3084
|
return parsed.data;
|
|
2991
3085
|
}
|
|
2992
3086
|
|
|
2993
|
-
// src/api/registrar-actions/request.ts
|
|
3087
|
+
// src/ensapi/api/registrar-actions/request.ts
|
|
2994
3088
|
var RegistrarActionsFilterTypes = {
|
|
2995
3089
|
BySubregistryNode: "bySubregistryNode",
|
|
2996
3090
|
WithEncodedReferral: "withEncodedReferral",
|
|
@@ -3002,7 +3096,7 @@ var RegistrarActionsOrders = {
|
|
|
3002
3096
|
LatestRegistrarActions: "orderBy[timestamp]=desc"
|
|
3003
3097
|
};
|
|
3004
3098
|
|
|
3005
|
-
// src/api/registrar-actions/filters.ts
|
|
3099
|
+
// src/ensapi/api/registrar-actions/filters.ts
|
|
3006
3100
|
function byParentNode(parentNode) {
|
|
3007
3101
|
if (typeof parentNode === "undefined") {
|
|
3008
3102
|
return void 0;
|
|
@@ -3055,7 +3149,7 @@ var registrarActionsFilter = {
|
|
|
3055
3149
|
endTimestamp
|
|
3056
3150
|
};
|
|
3057
3151
|
|
|
3058
|
-
// src/api/registrar-actions/prerequisites.ts
|
|
3152
|
+
// src/ensapi/api/registrar-actions/prerequisites.ts
|
|
3059
3153
|
var registrarActionsPrerequisites = Object.freeze({
|
|
3060
3154
|
/**
|
|
3061
3155
|
* Required plugins to enable Registrar Actions API routes.
|
|
@@ -3105,115 +3199,14 @@ var registrarActionsPrerequisites = Object.freeze({
|
|
|
3105
3199
|
}
|
|
3106
3200
|
});
|
|
3107
3201
|
|
|
3108
|
-
// src/
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
throw new Error(`Datasource not found for ${namespace} ${import_datasources6.DatasourceNames.Basenames}`);
|
|
3114
|
-
}
|
|
3115
|
-
const address = datasource.contracts.BaseRegistrar?.address;
|
|
3116
|
-
if (address === void 0 || Array.isArray(address)) {
|
|
3117
|
-
throw new Error(`BaseRegistrar contract not found or has multiple addresses for ${namespace}`);
|
|
3118
|
-
}
|
|
3202
|
+
// src/ensapi/api/registrar-actions/serialize.ts
|
|
3203
|
+
function serializeNamedRegistrarAction({
|
|
3204
|
+
action,
|
|
3205
|
+
name
|
|
3206
|
+
}) {
|
|
3119
3207
|
return {
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
};
|
|
3123
|
-
}
|
|
3124
|
-
function getBasenamesSubregistryManagedName(namespaceId) {
|
|
3125
|
-
switch (namespaceId) {
|
|
3126
|
-
case import_datasources6.ENSNamespaceIds.Mainnet:
|
|
3127
|
-
return "base.eth";
|
|
3128
|
-
case import_datasources6.ENSNamespaceIds.Sepolia:
|
|
3129
|
-
case import_datasources6.ENSNamespaceIds.SepoliaV2:
|
|
3130
|
-
return "basetest.eth";
|
|
3131
|
-
case import_datasources6.ENSNamespaceIds.EnsTestEnv:
|
|
3132
|
-
throw new Error(
|
|
3133
|
-
`No registrar managed name is known for the 'basenames' subregistry within the "${namespaceId}" namespace.`
|
|
3134
|
-
);
|
|
3135
|
-
}
|
|
3136
|
-
}
|
|
3137
|
-
|
|
3138
|
-
// src/registrars/ethnames-subregistry.ts
|
|
3139
|
-
var import_datasources7 = require("@ensnode/datasources");
|
|
3140
|
-
function getEthnamesSubregistryId(namespace) {
|
|
3141
|
-
const datasource = (0, import_datasources7.maybeGetDatasource)(namespace, import_datasources7.DatasourceNames.ENSRoot);
|
|
3142
|
-
if (!datasource) {
|
|
3143
|
-
throw new Error(`Datasource not found for ${namespace} ${import_datasources7.DatasourceNames.ENSRoot}`);
|
|
3144
|
-
}
|
|
3145
|
-
const address = datasource.contracts.BaseRegistrar?.address;
|
|
3146
|
-
if (address === void 0 || Array.isArray(address)) {
|
|
3147
|
-
throw new Error(`BaseRegistrar contract not found or has multiple addresses for ${namespace}`);
|
|
3148
|
-
}
|
|
3149
|
-
return {
|
|
3150
|
-
chainId: datasource.chain.id,
|
|
3151
|
-
address
|
|
3152
|
-
};
|
|
3153
|
-
}
|
|
3154
|
-
function getEthnamesSubregistryManagedName(namespaceId) {
|
|
3155
|
-
switch (namespaceId) {
|
|
3156
|
-
case import_datasources7.ENSNamespaceIds.Mainnet:
|
|
3157
|
-
case import_datasources7.ENSNamespaceIds.Sepolia:
|
|
3158
|
-
case import_datasources7.ENSNamespaceIds.SepoliaV2:
|
|
3159
|
-
case import_datasources7.ENSNamespaceIds.EnsTestEnv:
|
|
3160
|
-
return "eth";
|
|
3161
|
-
}
|
|
3162
|
-
}
|
|
3163
|
-
|
|
3164
|
-
// src/registrars/lineanames-subregistry.ts
|
|
3165
|
-
var import_datasources8 = require("@ensnode/datasources");
|
|
3166
|
-
function getLineanamesSubregistryId(namespace) {
|
|
3167
|
-
const datasource = (0, import_datasources8.maybeGetDatasource)(namespace, import_datasources8.DatasourceNames.Lineanames);
|
|
3168
|
-
if (!datasource) {
|
|
3169
|
-
throw new Error(`Datasource not found for ${namespace} ${import_datasources8.DatasourceNames.Lineanames}`);
|
|
3170
|
-
}
|
|
3171
|
-
const address = datasource.contracts.BaseRegistrar?.address;
|
|
3172
|
-
if (address === void 0 || Array.isArray(address)) {
|
|
3173
|
-
throw new Error(`BaseRegistrar contract not found or has multiple addresses for ${namespace}`);
|
|
3174
|
-
}
|
|
3175
|
-
return {
|
|
3176
|
-
chainId: datasource.chain.id,
|
|
3177
|
-
address
|
|
3178
|
-
};
|
|
3179
|
-
}
|
|
3180
|
-
function getLineanamesSubregistryManagedName(namespaceId) {
|
|
3181
|
-
switch (namespaceId) {
|
|
3182
|
-
case import_datasources8.ENSNamespaceIds.Mainnet:
|
|
3183
|
-
return "linea.eth";
|
|
3184
|
-
case import_datasources8.ENSNamespaceIds.Sepolia:
|
|
3185
|
-
case import_datasources8.ENSNamespaceIds.SepoliaV2:
|
|
3186
|
-
return "linea-sepolia.eth";
|
|
3187
|
-
case import_datasources8.ENSNamespaceIds.EnsTestEnv:
|
|
3188
|
-
throw new Error(
|
|
3189
|
-
`No registrar managed name is known for the 'Lineanames' subregistry within the "${namespaceId}" namespace.`
|
|
3190
|
-
);
|
|
3191
|
-
}
|
|
3192
|
-
}
|
|
3193
|
-
|
|
3194
|
-
// src/registrars/registration-expiration.ts
|
|
3195
|
-
function isRegistrationExpired(info, now) {
|
|
3196
|
-
if (info.expiry == null) return false;
|
|
3197
|
-
return info.expiry <= now;
|
|
3198
|
-
}
|
|
3199
|
-
function isRegistrationFullyExpired(info, now) {
|
|
3200
|
-
if (info.expiry == null) return false;
|
|
3201
|
-
return now >= info.expiry + (info.gracePeriod ?? 0n);
|
|
3202
|
-
}
|
|
3203
|
-
function isRegistrationInGracePeriod(info, now) {
|
|
3204
|
-
if (info.expiry == null) return false;
|
|
3205
|
-
if (info.gracePeriod == null) return false;
|
|
3206
|
-
return info.expiry <= now && info.expiry + info.gracePeriod > now;
|
|
3207
|
-
}
|
|
3208
|
-
|
|
3209
|
-
// src/api/registrar-actions/serialize.ts
|
|
3210
|
-
function serializeNamedRegistrarAction({
|
|
3211
|
-
action,
|
|
3212
|
-
name
|
|
3213
|
-
}) {
|
|
3214
|
-
return {
|
|
3215
|
-
action: serializeRegistrarAction(action),
|
|
3216
|
-
name
|
|
3208
|
+
action: serializeRegistrarAction(action),
|
|
3209
|
+
name
|
|
3217
3210
|
};
|
|
3218
3211
|
}
|
|
3219
3212
|
function serializeRegistrarActionsResponse(response) {
|
|
@@ -3230,19 +3223,19 @@ function serializeRegistrarActionsResponse(response) {
|
|
|
3230
3223
|
}
|
|
3231
3224
|
}
|
|
3232
3225
|
|
|
3233
|
-
// src/api/shared/errors/deserialize.ts
|
|
3234
|
-
var
|
|
3226
|
+
// src/ensapi/api/shared/errors/deserialize.ts
|
|
3227
|
+
var import_v430 = require("zod/v4");
|
|
3235
3228
|
function deserializeErrorResponse(maybeErrorResponse) {
|
|
3236
3229
|
const parsed = ErrorResponseSchema.safeParse(maybeErrorResponse);
|
|
3237
3230
|
if (parsed.error) {
|
|
3238
3231
|
throw new Error(`Cannot deserialize ErrorResponse:
|
|
3239
|
-
${(0,
|
|
3232
|
+
${(0, import_v430.prettifyError)(parsed.error)}
|
|
3240
3233
|
`);
|
|
3241
3234
|
}
|
|
3242
3235
|
return parsed.data;
|
|
3243
3236
|
}
|
|
3244
3237
|
|
|
3245
|
-
// src/api/shared/pagination/build-page-context.ts
|
|
3238
|
+
// src/ensapi/api/shared/pagination/build-page-context.ts
|
|
3246
3239
|
function buildPageContext(page, recordsPerPage, totalRecords) {
|
|
3247
3240
|
const totalPages = Math.max(1, Math.ceil(totalRecords / recordsPerPage));
|
|
3248
3241
|
if (page > totalPages) {
|
|
@@ -3277,37 +3270,6 @@ function buildPageContext(page, recordsPerPage, totalRecords) {
|
|
|
3277
3270
|
};
|
|
3278
3271
|
}
|
|
3279
3272
|
|
|
3280
|
-
// src/client-error.ts
|
|
3281
|
-
var ClientError = class _ClientError extends Error {
|
|
3282
|
-
details;
|
|
3283
|
-
constructor(message, details) {
|
|
3284
|
-
super(message);
|
|
3285
|
-
this.name = "ClientError";
|
|
3286
|
-
this.details = details;
|
|
3287
|
-
}
|
|
3288
|
-
static fromErrorResponse({ message, details }) {
|
|
3289
|
-
return new _ClientError(message, details);
|
|
3290
|
-
}
|
|
3291
|
-
};
|
|
3292
|
-
|
|
3293
|
-
// src/deployments.ts
|
|
3294
|
-
var import_datasources9 = require("@ensnode/datasources");
|
|
3295
|
-
var DEFAULT_ENSNODE_API_URL_MAINNET = "https://api.alpha.ensnode.io";
|
|
3296
|
-
var DEFAULT_ENSNODE_API_URL_SEPOLIA = "https://api.alpha-sepolia.ensnode.io";
|
|
3297
|
-
var getDefaultEnsNodeUrl = (namespace) => {
|
|
3298
|
-
const effectiveNamespace = namespace ?? import_datasources9.ENSNamespaceIds.Mainnet;
|
|
3299
|
-
switch (effectiveNamespace) {
|
|
3300
|
-
case import_datasources9.ENSNamespaceIds.Mainnet:
|
|
3301
|
-
return new URL(DEFAULT_ENSNODE_API_URL_MAINNET);
|
|
3302
|
-
case import_datasources9.ENSNamespaceIds.Sepolia:
|
|
3303
|
-
return new URL(DEFAULT_ENSNODE_API_URL_SEPOLIA);
|
|
3304
|
-
default:
|
|
3305
|
-
throw new Error(
|
|
3306
|
-
`ENSNamespaceId ${effectiveNamespace} does not have a default ENSNode URL defined`
|
|
3307
|
-
);
|
|
3308
|
-
}
|
|
3309
|
-
};
|
|
3310
|
-
|
|
3311
3273
|
// src/client.ts
|
|
3312
3274
|
var ENSNodeClient = class _ENSNodeClient {
|
|
3313
3275
|
options;
|
|
@@ -3800,7 +3762,7 @@ var makeLatestRenewalId = (domainId, registrationIndex) => `${makeRegistrationId
|
|
|
3800
3762
|
var makeRenewalId = (domainId, registrationIndex, index = 0) => `${makeRegistrationId(domainId, registrationIndex)}/${index}`;
|
|
3801
3763
|
|
|
3802
3764
|
// src/identity/identity.ts
|
|
3803
|
-
var
|
|
3765
|
+
var import_datasources7 = require("@ensnode/datasources");
|
|
3804
3766
|
|
|
3805
3767
|
// src/identity/types.ts
|
|
3806
3768
|
var ResolutionStatusIds = {
|
|
@@ -3827,7 +3789,7 @@ var ResolutionStatusIds = {
|
|
|
3827
3789
|
function buildUnresolvedIdentity(address, namespaceId, chainId) {
|
|
3828
3790
|
return {
|
|
3829
3791
|
resolutionStatus: ResolutionStatusIds.Unresolved,
|
|
3830
|
-
chainId: chainId ?? (0,
|
|
3792
|
+
chainId: chainId ?? (0, import_datasources7.getENSRootChainId)(namespaceId),
|
|
3831
3793
|
address
|
|
3832
3794
|
};
|
|
3833
3795
|
}
|
|
@@ -3835,6 +3797,107 @@ function isResolvedIdentity(identity) {
|
|
|
3835
3797
|
return identity.resolutionStatus !== ResolutionStatusIds.Unresolved;
|
|
3836
3798
|
}
|
|
3837
3799
|
|
|
3800
|
+
// src/registrars/basenames-subregistry.ts
|
|
3801
|
+
var import_datasources8 = require("@ensnode/datasources");
|
|
3802
|
+
function getBasenamesSubregistryId(namespace) {
|
|
3803
|
+
const datasource = (0, import_datasources8.maybeGetDatasource)(namespace, import_datasources8.DatasourceNames.Basenames);
|
|
3804
|
+
if (!datasource) {
|
|
3805
|
+
throw new Error(`Datasource not found for ${namespace} ${import_datasources8.DatasourceNames.Basenames}`);
|
|
3806
|
+
}
|
|
3807
|
+
const address = datasource.contracts.BaseRegistrar?.address;
|
|
3808
|
+
if (address === void 0 || Array.isArray(address)) {
|
|
3809
|
+
throw new Error(`BaseRegistrar contract not found or has multiple addresses for ${namespace}`);
|
|
3810
|
+
}
|
|
3811
|
+
return {
|
|
3812
|
+
chainId: datasource.chain.id,
|
|
3813
|
+
address
|
|
3814
|
+
};
|
|
3815
|
+
}
|
|
3816
|
+
function getBasenamesSubregistryManagedName(namespaceId) {
|
|
3817
|
+
switch (namespaceId) {
|
|
3818
|
+
case import_datasources8.ENSNamespaceIds.Mainnet:
|
|
3819
|
+
return "base.eth";
|
|
3820
|
+
case import_datasources8.ENSNamespaceIds.Sepolia:
|
|
3821
|
+
case import_datasources8.ENSNamespaceIds.SepoliaV2:
|
|
3822
|
+
return "basetest.eth";
|
|
3823
|
+
case import_datasources8.ENSNamespaceIds.EnsTestEnv:
|
|
3824
|
+
throw new Error(
|
|
3825
|
+
`No registrar managed name is known for the 'basenames' subregistry within the "${namespaceId}" namespace.`
|
|
3826
|
+
);
|
|
3827
|
+
}
|
|
3828
|
+
}
|
|
3829
|
+
|
|
3830
|
+
// src/registrars/ethnames-subregistry.ts
|
|
3831
|
+
var import_datasources9 = require("@ensnode/datasources");
|
|
3832
|
+
function getEthnamesSubregistryId(namespace) {
|
|
3833
|
+
const datasource = (0, import_datasources9.maybeGetDatasource)(namespace, import_datasources9.DatasourceNames.ENSRoot);
|
|
3834
|
+
if (!datasource) {
|
|
3835
|
+
throw new Error(`Datasource not found for ${namespace} ${import_datasources9.DatasourceNames.ENSRoot}`);
|
|
3836
|
+
}
|
|
3837
|
+
const address = datasource.contracts.BaseRegistrar?.address;
|
|
3838
|
+
if (address === void 0 || Array.isArray(address)) {
|
|
3839
|
+
throw new Error(`BaseRegistrar contract not found or has multiple addresses for ${namespace}`);
|
|
3840
|
+
}
|
|
3841
|
+
return {
|
|
3842
|
+
chainId: datasource.chain.id,
|
|
3843
|
+
address
|
|
3844
|
+
};
|
|
3845
|
+
}
|
|
3846
|
+
function getEthnamesSubregistryManagedName(namespaceId) {
|
|
3847
|
+
switch (namespaceId) {
|
|
3848
|
+
case import_datasources9.ENSNamespaceIds.Mainnet:
|
|
3849
|
+
case import_datasources9.ENSNamespaceIds.Sepolia:
|
|
3850
|
+
case import_datasources9.ENSNamespaceIds.SepoliaV2:
|
|
3851
|
+
case import_datasources9.ENSNamespaceIds.EnsTestEnv:
|
|
3852
|
+
return "eth";
|
|
3853
|
+
}
|
|
3854
|
+
}
|
|
3855
|
+
|
|
3856
|
+
// src/registrars/lineanames-subregistry.ts
|
|
3857
|
+
var import_datasources10 = require("@ensnode/datasources");
|
|
3858
|
+
function getLineanamesSubregistryId(namespace) {
|
|
3859
|
+
const datasource = (0, import_datasources10.maybeGetDatasource)(namespace, import_datasources10.DatasourceNames.Lineanames);
|
|
3860
|
+
if (!datasource) {
|
|
3861
|
+
throw new Error(`Datasource not found for ${namespace} ${import_datasources10.DatasourceNames.Lineanames}`);
|
|
3862
|
+
}
|
|
3863
|
+
const address = datasource.contracts.BaseRegistrar?.address;
|
|
3864
|
+
if (address === void 0 || Array.isArray(address)) {
|
|
3865
|
+
throw new Error(`BaseRegistrar contract not found or has multiple addresses for ${namespace}`);
|
|
3866
|
+
}
|
|
3867
|
+
return {
|
|
3868
|
+
chainId: datasource.chain.id,
|
|
3869
|
+
address
|
|
3870
|
+
};
|
|
3871
|
+
}
|
|
3872
|
+
function getLineanamesSubregistryManagedName(namespaceId) {
|
|
3873
|
+
switch (namespaceId) {
|
|
3874
|
+
case import_datasources10.ENSNamespaceIds.Mainnet:
|
|
3875
|
+
return "linea.eth";
|
|
3876
|
+
case import_datasources10.ENSNamespaceIds.Sepolia:
|
|
3877
|
+
case import_datasources10.ENSNamespaceIds.SepoliaV2:
|
|
3878
|
+
return "linea-sepolia.eth";
|
|
3879
|
+
case import_datasources10.ENSNamespaceIds.EnsTestEnv:
|
|
3880
|
+
throw new Error(
|
|
3881
|
+
`No registrar managed name is known for the 'Lineanames' subregistry within the "${namespaceId}" namespace.`
|
|
3882
|
+
);
|
|
3883
|
+
}
|
|
3884
|
+
}
|
|
3885
|
+
|
|
3886
|
+
// src/registrars/registration-expiration.ts
|
|
3887
|
+
function isRegistrationExpired(info, now) {
|
|
3888
|
+
if (info.expiry == null) return false;
|
|
3889
|
+
return info.expiry <= now;
|
|
3890
|
+
}
|
|
3891
|
+
function isRegistrationFullyExpired(info, now) {
|
|
3892
|
+
if (info.expiry == null) return false;
|
|
3893
|
+
return now >= info.expiry + (info.gracePeriod ?? 0n);
|
|
3894
|
+
}
|
|
3895
|
+
function isRegistrationInGracePeriod(info, now) {
|
|
3896
|
+
if (info.expiry == null) return false;
|
|
3897
|
+
if (info.gracePeriod == null) return false;
|
|
3898
|
+
return info.expiry <= now && info.expiry + info.gracePeriod > now;
|
|
3899
|
+
}
|
|
3900
|
+
|
|
3838
3901
|
// src/resolution/ensip19-chainid.ts
|
|
3839
3902
|
var import_chains = require("viem/chains");
|
|
3840
3903
|
var import_datasources11 = require("@ensnode/datasources");
|
|
@@ -3904,6 +3967,131 @@ var import_getUnixTime2 = require("date-fns/getUnixTime");
|
|
|
3904
3967
|
|
|
3905
3968
|
// src/shared/datetime.ts
|
|
3906
3969
|
var import_getUnixTime = require("date-fns/getUnixTime");
|
|
3970
|
+
|
|
3971
|
+
// src/shared/deserialize.ts
|
|
3972
|
+
var import_v431 = __toESM(require("zod/v4"), 1);
|
|
3973
|
+
function deserializeChainId(maybeChainId, valueLabel) {
|
|
3974
|
+
const schema = makeChainIdStringSchema(valueLabel);
|
|
3975
|
+
const parsed = schema.safeParse(maybeChainId);
|
|
3976
|
+
if (parsed.error) {
|
|
3977
|
+
throw new Error(`Cannot deserialize ChainId:
|
|
3978
|
+
${(0, import_v431.prettifyError)(parsed.error)}
|
|
3979
|
+
`);
|
|
3980
|
+
}
|
|
3981
|
+
return parsed.data;
|
|
3982
|
+
}
|
|
3983
|
+
function deserializeDatetime(maybeDatetime, valueLabel) {
|
|
3984
|
+
const schema = makeDatetimeSchema(valueLabel);
|
|
3985
|
+
const parsed = schema.safeParse(maybeDatetime);
|
|
3986
|
+
if (parsed.error) {
|
|
3987
|
+
throw new Error(`Cannot deserialize Datetime:
|
|
3988
|
+
${(0, import_v431.prettifyError)(parsed.error)}
|
|
3989
|
+
`);
|
|
3990
|
+
}
|
|
3991
|
+
return parsed.data;
|
|
3992
|
+
}
|
|
3993
|
+
function deserializeUnixTimestamp(maybeTimestamp, valueLabel) {
|
|
3994
|
+
const schema = makeUnixTimestampSchema(valueLabel);
|
|
3995
|
+
const parsed = schema.safeParse(maybeTimestamp);
|
|
3996
|
+
if (parsed.error) {
|
|
3997
|
+
throw new Error(`Cannot deserialize Unix Timestamp:
|
|
3998
|
+
${(0, import_v431.prettifyError)(parsed.error)}
|
|
3999
|
+
`);
|
|
4000
|
+
}
|
|
4001
|
+
return parsed.data;
|
|
4002
|
+
}
|
|
4003
|
+
function deserializeUrl(maybeUrl, valueLabel) {
|
|
4004
|
+
const schema = makeUrlSchema(valueLabel);
|
|
4005
|
+
const parsed = schema.safeParse(maybeUrl);
|
|
4006
|
+
if (parsed.error) {
|
|
4007
|
+
throw new Error(`Cannot deserialize URL:
|
|
4008
|
+
${(0, import_v431.prettifyError)(parsed.error)}
|
|
4009
|
+
`);
|
|
4010
|
+
}
|
|
4011
|
+
return parsed.data;
|
|
4012
|
+
}
|
|
4013
|
+
function deserializeBlockNumber(maybeBlockNumber, valueLabel) {
|
|
4014
|
+
const schema = makeBlockNumberSchema(valueLabel);
|
|
4015
|
+
const parsed = schema.safeParse(maybeBlockNumber);
|
|
4016
|
+
if (parsed.error) {
|
|
4017
|
+
throw new Error(`Cannot deserialize BlockNumber:
|
|
4018
|
+
${(0, import_v431.prettifyError)(parsed.error)}
|
|
4019
|
+
`);
|
|
4020
|
+
}
|
|
4021
|
+
return parsed.data;
|
|
4022
|
+
}
|
|
4023
|
+
function deserializeBlockrange(maybeBlockrange, valueLabel) {
|
|
4024
|
+
const schema = makeBlockrangeSchema(valueLabel);
|
|
4025
|
+
const parsed = schema.safeParse(maybeBlockrange);
|
|
4026
|
+
if (parsed.error) {
|
|
4027
|
+
throw new Error(`Cannot deserialize Blockrange:
|
|
4028
|
+
${(0, import_v431.prettifyError)(parsed.error)}
|
|
4029
|
+
`);
|
|
4030
|
+
}
|
|
4031
|
+
return parsed.data;
|
|
4032
|
+
}
|
|
4033
|
+
function deserializeBlockRef(maybeBlockRef, valueLabel) {
|
|
4034
|
+
const schema = makeBlockRefSchema(valueLabel);
|
|
4035
|
+
const parsed = schema.safeParse(maybeBlockRef);
|
|
4036
|
+
if (parsed.error) {
|
|
4037
|
+
throw new Error(`Cannot deserialize BlockRef:
|
|
4038
|
+
${(0, import_v431.prettifyError)(parsed.error)}
|
|
4039
|
+
`);
|
|
4040
|
+
}
|
|
4041
|
+
return parsed.data;
|
|
4042
|
+
}
|
|
4043
|
+
function deserializeDuration(maybeDuration, valueLabel) {
|
|
4044
|
+
const schema = import_v431.default.coerce.number().pipe(makeDurationSchema(valueLabel));
|
|
4045
|
+
const parsed = schema.safeParse(maybeDuration);
|
|
4046
|
+
if (parsed.error) {
|
|
4047
|
+
throw new RangeError(`Cannot deserialize Duration:
|
|
4048
|
+
${(0, import_v431.prettifyError)(parsed.error)}
|
|
4049
|
+
`);
|
|
4050
|
+
}
|
|
4051
|
+
return parsed.data;
|
|
4052
|
+
}
|
|
4053
|
+
function parseAccountId(maybeAccountId, valueLabel) {
|
|
4054
|
+
const schema = makeAccountIdStringSchema(valueLabel);
|
|
4055
|
+
const parsed = schema.safeParse(maybeAccountId);
|
|
4056
|
+
if (parsed.error) {
|
|
4057
|
+
throw new RangeError(`Cannot deserialize AccountId:
|
|
4058
|
+
${(0, import_v431.prettifyError)(parsed.error)}
|
|
4059
|
+
`);
|
|
4060
|
+
}
|
|
4061
|
+
return parsed.data;
|
|
4062
|
+
}
|
|
4063
|
+
function deserializePriceEth(maybePrice, valueLabel) {
|
|
4064
|
+
const schema = makePriceEthSchema(valueLabel);
|
|
4065
|
+
const parsed = schema.safeParse(maybePrice);
|
|
4066
|
+
if (parsed.error) {
|
|
4067
|
+
throw new Error(`Cannot deserialize PriceEth:
|
|
4068
|
+
${(0, import_v431.prettifyError)(parsed.error)}
|
|
4069
|
+
`);
|
|
4070
|
+
}
|
|
4071
|
+
return parsed.data;
|
|
4072
|
+
}
|
|
4073
|
+
function deserializePriceUsdc(maybePrice, valueLabel) {
|
|
4074
|
+
const schema = makePriceUsdcSchema(valueLabel);
|
|
4075
|
+
const parsed = schema.safeParse(maybePrice);
|
|
4076
|
+
if (parsed.error) {
|
|
4077
|
+
throw new Error(`Cannot deserialize PriceUsdc:
|
|
4078
|
+
${(0, import_v431.prettifyError)(parsed.error)}
|
|
4079
|
+
`);
|
|
4080
|
+
}
|
|
4081
|
+
return parsed.data;
|
|
4082
|
+
}
|
|
4083
|
+
function deserializePriceDai(maybePrice, valueLabel) {
|
|
4084
|
+
const schema = makePriceDaiSchema(valueLabel);
|
|
4085
|
+
const parsed = schema.safeParse(maybePrice);
|
|
4086
|
+
if (parsed.error) {
|
|
4087
|
+
throw new Error(`Cannot deserialize PriceDai:
|
|
4088
|
+
${(0, import_v431.prettifyError)(parsed.error)}
|
|
4089
|
+
`);
|
|
4090
|
+
}
|
|
4091
|
+
return parsed.data;
|
|
4092
|
+
}
|
|
4093
|
+
|
|
4094
|
+
// src/shared/datetime.ts
|
|
3907
4095
|
function durationBetween(start, end) {
|
|
3908
4096
|
return deserializeDuration(end - start, "Duration");
|
|
3909
4097
|
}
|