@ensnode/ensnode-sdk 0.0.0-next-20260216102612 → 0.0.0-next-20260216125415

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 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: () => import_datasources.ENSNamespaceIds,
50
+ ENSNamespaceIds: () => import_datasources2.ENSNamespaceIds,
51
51
  ENSNodeClient: () => ENSNodeClient,
52
52
  ENS_ROOT: () => ENS_ROOT,
53
53
  ETH_COIN_TYPE: () => ETH_COIN_TYPE,
@@ -149,7 +149,7 @@ __export(index_exports, {
149
149
  getCurrencyInfo: () => getCurrencyInfo,
150
150
  getDatasourceContract: () => getDatasourceContract,
151
151
  getDefaultEnsNodeUrl: () => getDefaultEnsNodeUrl,
152
- getENSRootChainId: () => import_datasources2.getENSRootChainId,
152
+ getENSRootChainId: () => import_datasources3.getENSRootChainId,
153
153
  getENSv1Registry: () => getENSv1Registry,
154
154
  getENSv2RootRegistry: () => getENSv2RootRegistry,
155
155
  getENSv2RootRegistryId: () => getENSv2RootRegistryId,
@@ -276,6 +276,37 @@ __export(index_exports, {
276
276
  });
277
277
  module.exports = __toCommonJS(index_exports);
278
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
+
279
310
  // src/ensapi/config/deserialize.ts
280
311
  var import_v45 = require("zod/v4");
281
312
 
@@ -294,7 +325,7 @@ var import_viem8 = require("viem");
294
325
  var import_v4 = require("zod/v4");
295
326
 
296
327
  // src/ens/index.ts
297
- var import_datasources2 = require("@ensnode/datasources");
328
+ var import_datasources3 = require("@ensnode/datasources");
298
329
 
299
330
  // src/ens/coin-type.ts
300
331
  var import_utils = require("@ensdomains/address-encoder/utils");
@@ -483,7 +514,7 @@ var makeSubdomainNode = (labelHash, node) => (0, import_viem5.keccak256)((0, imp
483
514
  var uint256ToHex32 = (num) => (0, import_viem5.toHex)(num, { size: 32 });
484
515
 
485
516
  // src/ens/types.ts
486
- var import_datasources = require("@ensnode/datasources");
517
+ var import_datasources2 = require("@ensnode/datasources");
487
518
 
488
519
  // src/shared/currencies.ts
489
520
  var import_viem6 = require("viem");
@@ -714,9 +745,9 @@ var makeBlockRefSchema = (valueLabel = "Value") => import_v4.z.strictObject(
714
745
  error: `${valueLabel} must be a valid BlockRef object.`
715
746
  }
716
747
  );
717
- var makeENSNamespaceIdSchema = (valueLabel = "ENSNamespaceId") => import_v4.z.enum(import_datasources.ENSNamespaceIds, {
748
+ var makeENSNamespaceIdSchema = (valueLabel = "ENSNamespaceId") => import_v4.z.enum(import_datasources2.ENSNamespaceIds, {
718
749
  error() {
719
- return `Invalid ${valueLabel}. Supported ENS namespace IDs are: ${Object.keys(import_datasources.ENSNamespaceIds).join(", ")}`;
750
+ return `Invalid ${valueLabel}. Supported ENS namespace IDs are: ${Object.keys(import_datasources2.ENSNamespaceIds).join(", ")}`;
720
751
  }
721
752
  });
722
753
  var makePriceAmountSchema = (valueLabel = "Amount") => import_v4.z.coerce.bigint({
@@ -779,7 +810,7 @@ var makeReinterpretedNameSchema = (valueLabel = "Reinterpreted Name") => import_
779
810
  }).transform(reinterpretName);
780
811
 
781
812
  // src/ensindexer/config/is-subgraph-compatible.ts
782
- var import_datasources3 = require("@ensnode/datasources");
813
+ var import_datasources4 = require("@ensnode/datasources");
783
814
 
784
815
  // src/ensindexer/config/types.ts
785
816
  var PluginName = /* @__PURE__ */ ((PluginName2) => {
@@ -799,7 +830,7 @@ function isSubgraphCompatible(config) {
799
830
  const onlySubgraphPluginActivated = config.plugins.length === 1 && config.plugins[0] === "subgraph" /* Subgraph */;
800
831
  const isSubgraphLabelSet = config.labelSet.labelSetId === "subgraph" && config.labelSet.labelSetVersion === 0;
801
832
  const isEnsTestEnvLabelSet = config.labelSet.labelSetId === "ens-test-env" && config.labelSet.labelSetVersion === 0;
802
- const labelSetIsSubgraphCompatible = isSubgraphLabelSet || config.namespace === import_datasources3.ENSNamespaceIds.EnsTestEnv && isEnsTestEnvLabelSet;
833
+ const labelSetIsSubgraphCompatible = isSubgraphLabelSet || config.namespace === import_datasources4.ENSNamespaceIds.EnsTestEnv && isEnsTestEnvLabelSet;
803
834
  return onlySubgraphPluginActivated && labelSetIsSubgraphCompatible;
804
835
  }
805
836
 
@@ -930,6 +961,11 @@ ${(0, import_v45.prettifyError)(error)}
930
961
  }
931
962
  }
932
963
 
964
+ // src/ensapi/api/config/deserialize.ts
965
+ function deserializeConfigResponse(serializedResponse) {
966
+ return deserializeENSApiPublicConfig(serializedResponse);
967
+ }
968
+
933
969
  // src/ensindexer/config/deserialize.ts
934
970
  var import_v46 = require("zod/v4");
935
971
  function deserializeENSIndexerPublicConfig(maybeConfig, valueLabel) {
@@ -1048,7 +1084,34 @@ function serializeENSIndexerPublicConfig(config) {
1048
1084
  };
1049
1085
  }
1050
1086
 
1051
- // src/ensindexer/indexing-status/chain-indexing-status-snapshot.ts
1087
+ // src/ensapi/config/serialize.ts
1088
+ function serializeENSApiPublicConfig(config) {
1089
+ const { version, theGraphFallback, ensIndexerPublicConfig } = config;
1090
+ return {
1091
+ version,
1092
+ theGraphFallback,
1093
+ ensIndexerPublicConfig: serializeENSIndexerPublicConfig(ensIndexerPublicConfig)
1094
+ };
1095
+ }
1096
+
1097
+ // src/ensapi/api/config/serialize.ts
1098
+ function serializeConfigResponse(response) {
1099
+ return serializeENSApiPublicConfig(response);
1100
+ }
1101
+
1102
+ // src/ensapi/api/indexing-status/deserialize.ts
1103
+ var import_v415 = require("zod/v4");
1104
+
1105
+ // src/indexing-status/deserialize/realtime-indexing-status-projection.ts
1106
+ var import_v413 = require("zod/v4");
1107
+
1108
+ // src/indexing-status/zod-schema/realtime-indexing-status-projection.ts
1109
+ var import_v410 = require("zod/v4");
1110
+
1111
+ // src/indexing-status/zod-schema/cross-chain-indexing-status-snapshot.ts
1112
+ var import_v49 = require("zod/v4");
1113
+
1114
+ // src/indexing-status/chain-indexing-status-snapshot.ts
1052
1115
  var ChainIndexingConfigTypeIds = {
1053
1116
  /**
1054
1117
  * Represents that indexing of the chain should be performed for an indefinite range.
@@ -1147,7 +1210,7 @@ function sortChainStatusesByStartBlockAsc(chains) {
1147
1210
  );
1148
1211
  }
1149
1212
 
1150
- // src/ensindexer/indexing-status/cross-chain-indexing-status-snapshot.ts
1213
+ // src/indexing-status/cross-chain-indexing-status-snapshot.ts
1151
1214
  var CrossChainIndexingStrategyIds = {
1152
1215
  /**
1153
1216
  * Represents that the indexing of events across all indexed chains will
@@ -1176,10 +1239,91 @@ function getLatestIndexedBlockRef(indexingStatus, chainId) {
1176
1239
  return chainIndexingStatus.latestIndexedBlock;
1177
1240
  }
1178
1241
 
1179
- // src/ensindexer/indexing-status/deserialize/chain-indexing-status-snapshot.ts
1242
+ // src/indexing-status/zod-schema/omnichain-indexing-status-snapshot.ts
1180
1243
  var import_v48 = require("zod/v4");
1181
1244
 
1182
- // src/ensindexer/indexing-status/zod-schema/chain-indexing-status-snapshot.ts
1245
+ // src/indexing-status/omnichain-indexing-status-snapshot.ts
1246
+ var OmnichainIndexingStatusIds = {
1247
+ /**
1248
+ * Represents that omnichain indexing is not ready to begin yet because
1249
+ * ENSIndexer is in its initialization phase and the data to build a "true"
1250
+ * {@link OmnichainIndexingStatusSnapshot} is still being loaded.
1251
+ */
1252
+ Unstarted: "omnichain-unstarted",
1253
+ /**
1254
+ * Represents that omnichain indexing is in an overall "backfill" status because
1255
+ * - At least one indexed chain has a `chainStatus` of
1256
+ * {@link ChainIndexingStatusIds.Backfill}; and
1257
+ * - No indexed chain has a `chainStatus` of {@link ChainIndexingStatusIds.Following}.
1258
+ */
1259
+ Backfill: "omnichain-backfill",
1260
+ /**
1261
+ * Represents that omnichain indexing is in an overall "following" status because
1262
+ * at least one indexed chain has a `chainStatus` of
1263
+ * {@link ChainIndexingStatusIds.Following}.
1264
+ */
1265
+ Following: "omnichain-following",
1266
+ /**
1267
+ * Represents that omnichain indexing has completed because all indexed chains have
1268
+ * a `chainStatus` of {@link ChainIndexingStatusIds.Completed}.
1269
+ */
1270
+ Completed: "omnichain-completed"
1271
+ };
1272
+ function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted(chains) {
1273
+ return chains.every((chain) => chain.chainStatus === ChainIndexingStatusIds.Queued);
1274
+ }
1275
+ function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill(chains) {
1276
+ const atLeastOneChainInTargetStatus = chains.some(
1277
+ (chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill
1278
+ );
1279
+ const otherChainsHaveValidStatuses = chains.every(
1280
+ (chain) => chain.chainStatus === ChainIndexingStatusIds.Queued || chain.chainStatus === ChainIndexingStatusIds.Backfill || chain.chainStatus === ChainIndexingStatusIds.Completed
1281
+ );
1282
+ return atLeastOneChainInTargetStatus && otherChainsHaveValidStatuses;
1283
+ }
1284
+ function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted(chains) {
1285
+ const allChainsHaveValidStatuses = chains.every(
1286
+ (chain) => chain.chainStatus === ChainIndexingStatusIds.Completed
1287
+ );
1288
+ return allChainsHaveValidStatuses;
1289
+ }
1290
+ function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing(chains) {
1291
+ const allChainsHaveValidStatuses = chains.some(
1292
+ (chain) => chain.chainStatus === ChainIndexingStatusIds.Following
1293
+ );
1294
+ return allChainsHaveValidStatuses;
1295
+ }
1296
+ function getOmnichainIndexingStatus(chains) {
1297
+ if (checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing(chains)) {
1298
+ return OmnichainIndexingStatusIds.Following;
1299
+ }
1300
+ if (checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill(chains)) {
1301
+ return OmnichainIndexingStatusIds.Backfill;
1302
+ }
1303
+ if (checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted(chains)) {
1304
+ return OmnichainIndexingStatusIds.Unstarted;
1305
+ }
1306
+ if (checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted(chains)) {
1307
+ return OmnichainIndexingStatusIds.Completed;
1308
+ }
1309
+ throw new Error(`Unable to determine omnichain indexing status for provided chains.`);
1310
+ }
1311
+ function getOmnichainIndexingCursor(chains) {
1312
+ if (chains.length === 0) {
1313
+ throw new Error(`Unable to determine omnichain indexing cursor when no chains were provided.`);
1314
+ }
1315
+ if (getOmnichainIndexingStatus(chains) === OmnichainIndexingStatusIds.Unstarted) {
1316
+ const earliestStartBlockTimestamps = chains.map((chain) => chain.config.startBlock.timestamp);
1317
+ return Math.min(...earliestStartBlockTimestamps) - 1;
1318
+ }
1319
+ const latestIndexedBlockTimestamps = chains.filter((chain) => chain.chainStatus !== ChainIndexingStatusIds.Queued).map((chain) => chain.latestIndexedBlock.timestamp);
1320
+ if (latestIndexedBlockTimestamps.length < 1) {
1321
+ throw new Error("latestIndexedBlockTimestamps array must include at least one element");
1322
+ }
1323
+ return Math.max(...latestIndexedBlockTimestamps);
1324
+ }
1325
+
1326
+ // src/indexing-status/zod-schema/chain-indexing-status-snapshot.ts
1183
1327
  var import_v47 = require("zod/v4");
1184
1328
 
1185
1329
  // src/shared/block-ref.ts
@@ -1193,7 +1337,7 @@ function isBeforeOrEqualTo(blockA, blockB) {
1193
1337
  return isBefore(blockA, blockB) || isEqualTo(blockA, blockB);
1194
1338
  }
1195
1339
 
1196
- // src/ensindexer/indexing-status/zod-schema/chain-indexing-status-snapshot.ts
1340
+ // src/indexing-status/zod-schema/chain-indexing-status-snapshot.ts
1197
1341
  function invariant_chainSnapshotQueuedBlocks(ctx) {
1198
1342
  const { config } = ctx.value;
1199
1343
  if (config.configType === ChainIndexingConfigTypeIds.Indefinite) {
@@ -1314,111 +1458,7 @@ var makeChainIndexingStatusSnapshotSchema = (valueLabel = "Value") => import_v47
1314
1458
  makeChainIndexingStatusSnapshotFollowingSchema(valueLabel)
1315
1459
  ]);
1316
1460
 
1317
- // src/ensindexer/indexing-status/deserialize/chain-indexing-status-snapshot.ts
1318
- function deserializeChainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
1319
- const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
1320
- const parsed = schema.safeParse(maybeSnapshot);
1321
- if (parsed.error) {
1322
- throw new Error(
1323
- `Cannot deserialize into ChainIndexingStatusSnapshot:
1324
- ${(0, import_v48.prettifyError)(parsed.error)}
1325
- `
1326
- );
1327
- }
1328
- return parsed.data;
1329
- }
1330
-
1331
- // src/ensindexer/indexing-status/deserialize/cross-chain-indexing-status-snapshot.ts
1332
- var import_v412 = require("zod/v4");
1333
-
1334
- // src/ensindexer/indexing-status/zod-schema/cross-chain-indexing-status-snapshot.ts
1335
- var import_v410 = require("zod/v4");
1336
-
1337
- // src/ensindexer/indexing-status/zod-schema/omnichain-indexing-status-snapshot.ts
1338
- var import_v49 = require("zod/v4");
1339
-
1340
- // src/ensindexer/indexing-status/omnichain-indexing-status-snapshot.ts
1341
- var OmnichainIndexingStatusIds = {
1342
- /**
1343
- * Represents that omnichain indexing is not ready to begin yet because
1344
- * ENSIndexer is in its initialization phase and the data to build a "true"
1345
- * {@link OmnichainIndexingStatusSnapshot} is still being loaded.
1346
- */
1347
- Unstarted: "omnichain-unstarted",
1348
- /**
1349
- * Represents that omnichain indexing is in an overall "backfill" status because
1350
- * - At least one indexed chain has a `chainStatus` of
1351
- * {@link ChainIndexingStatusIds.Backfill}; and
1352
- * - No indexed chain has a `chainStatus` of {@link ChainIndexingStatusIds.Following}.
1353
- */
1354
- Backfill: "omnichain-backfill",
1355
- /**
1356
- * Represents that omnichain indexing is in an overall "following" status because
1357
- * at least one indexed chain has a `chainStatus` of
1358
- * {@link ChainIndexingStatusIds.Following}.
1359
- */
1360
- Following: "omnichain-following",
1361
- /**
1362
- * Represents that omnichain indexing has completed because all indexed chains have
1363
- * a `chainStatus` of {@link ChainIndexingStatusIds.Completed}.
1364
- */
1365
- Completed: "omnichain-completed"
1366
- };
1367
- function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted(chains) {
1368
- return chains.every((chain) => chain.chainStatus === ChainIndexingStatusIds.Queued);
1369
- }
1370
- function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill(chains) {
1371
- const atLeastOneChainInTargetStatus = chains.some(
1372
- (chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill
1373
- );
1374
- const otherChainsHaveValidStatuses = chains.every(
1375
- (chain) => chain.chainStatus === ChainIndexingStatusIds.Queued || chain.chainStatus === ChainIndexingStatusIds.Backfill || chain.chainStatus === ChainIndexingStatusIds.Completed
1376
- );
1377
- return atLeastOneChainInTargetStatus && otherChainsHaveValidStatuses;
1378
- }
1379
- function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted(chains) {
1380
- const allChainsHaveValidStatuses = chains.every(
1381
- (chain) => chain.chainStatus === ChainIndexingStatusIds.Completed
1382
- );
1383
- return allChainsHaveValidStatuses;
1384
- }
1385
- function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing(chains) {
1386
- const allChainsHaveValidStatuses = chains.some(
1387
- (chain) => chain.chainStatus === ChainIndexingStatusIds.Following
1388
- );
1389
- return allChainsHaveValidStatuses;
1390
- }
1391
- function getOmnichainIndexingStatus(chains) {
1392
- if (checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing(chains)) {
1393
- return OmnichainIndexingStatusIds.Following;
1394
- }
1395
- if (checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill(chains)) {
1396
- return OmnichainIndexingStatusIds.Backfill;
1397
- }
1398
- if (checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted(chains)) {
1399
- return OmnichainIndexingStatusIds.Unstarted;
1400
- }
1401
- if (checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted(chains)) {
1402
- return OmnichainIndexingStatusIds.Completed;
1403
- }
1404
- throw new Error(`Unable to determine omnichain indexing status for provided chains.`);
1405
- }
1406
- function getOmnichainIndexingCursor(chains) {
1407
- if (chains.length === 0) {
1408
- throw new Error(`Unable to determine omnichain indexing cursor when no chains were provided.`);
1409
- }
1410
- if (getOmnichainIndexingStatus(chains) === OmnichainIndexingStatusIds.Unstarted) {
1411
- const earliestStartBlockTimestamps = chains.map((chain) => chain.config.startBlock.timestamp);
1412
- return Math.min(...earliestStartBlockTimestamps) - 1;
1413
- }
1414
- const latestIndexedBlockTimestamps = chains.filter((chain) => chain.chainStatus !== ChainIndexingStatusIds.Queued).map((chain) => chain.latestIndexedBlock.timestamp);
1415
- if (latestIndexedBlockTimestamps.length < 1) {
1416
- throw new Error("latestIndexedBlockTimestamps array must include at least one element");
1417
- }
1418
- return Math.max(...latestIndexedBlockTimestamps);
1419
- }
1420
-
1421
- // src/ensindexer/indexing-status/zod-schema/omnichain-indexing-status-snapshot.ts
1461
+ // src/indexing-status/zod-schema/omnichain-indexing-status-snapshot.ts
1422
1462
  function invariant_omnichainSnapshotStatusIsConsistentWithChainSnapshot(ctx) {
1423
1463
  const snapshot = ctx.value;
1424
1464
  const chains = Array.from(snapshot.chains.values());
@@ -1540,11 +1580,11 @@ function invariant_omnichainStatusSnapshotFollowingHasValidChains(ctx) {
1540
1580
  });
1541
1581
  }
1542
1582
  }
1543
- var makeOmnichainIndexingStatusSnapshotUnstartedSchema = (valueLabel) => import_v49.z.object({
1544
- omnichainStatus: import_v49.z.literal(OmnichainIndexingStatusIds.Unstarted),
1545
- chains: import_v49.z.map(
1583
+ var makeOmnichainIndexingStatusSnapshotUnstartedSchema = (valueLabel) => import_v48.z.object({
1584
+ omnichainStatus: import_v48.z.literal(OmnichainIndexingStatusIds.Unstarted),
1585
+ chains: import_v48.z.map(
1546
1586
  makeChainIdSchema(),
1547
- import_v49.z.discriminatedUnion("chainStatus", [
1587
+ import_v48.z.discriminatedUnion("chainStatus", [
1548
1588
  makeChainIndexingStatusSnapshotQueuedSchema(valueLabel)
1549
1589
  ]),
1550
1590
  {
@@ -1553,11 +1593,11 @@ var makeOmnichainIndexingStatusSnapshotUnstartedSchema = (valueLabel) => import_
1553
1593
  ),
1554
1594
  omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
1555
1595
  }).check(invariant_omnichainSnapshotUnstartedHasValidChains);
1556
- var makeOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) => import_v49.z.object({
1557
- omnichainStatus: import_v49.z.literal(OmnichainIndexingStatusIds.Backfill),
1558
- chains: import_v49.z.map(
1596
+ var makeOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) => import_v48.z.object({
1597
+ omnichainStatus: import_v48.z.literal(OmnichainIndexingStatusIds.Backfill),
1598
+ chains: import_v48.z.map(
1559
1599
  makeChainIdSchema(),
1560
- import_v49.z.discriminatedUnion("chainStatus", [
1600
+ import_v48.z.discriminatedUnion("chainStatus", [
1561
1601
  makeChainIndexingStatusSnapshotQueuedSchema(valueLabel),
1562
1602
  makeChainIndexingStatusSnapshotBackfillSchema(valueLabel),
1563
1603
  makeChainIndexingStatusSnapshotCompletedSchema(valueLabel)
@@ -1568,11 +1608,11 @@ var makeOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) => import_v
1568
1608
  ),
1569
1609
  omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
1570
1610
  }).check(invariant_omnichainStatusSnapshotBackfillHasValidChains);
1571
- var makeOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) => import_v49.z.object({
1572
- omnichainStatus: import_v49.z.literal(OmnichainIndexingStatusIds.Completed),
1573
- chains: import_v49.z.map(
1611
+ var makeOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) => import_v48.z.object({
1612
+ omnichainStatus: import_v48.z.literal(OmnichainIndexingStatusIds.Completed),
1613
+ chains: import_v48.z.map(
1574
1614
  makeChainIdSchema(),
1575
- import_v49.z.discriminatedUnion("chainStatus", [
1615
+ import_v48.z.discriminatedUnion("chainStatus", [
1576
1616
  makeChainIndexingStatusSnapshotCompletedSchema(valueLabel)
1577
1617
  ]),
1578
1618
  {
@@ -1581,11 +1621,11 @@ var makeOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) => import_
1581
1621
  ),
1582
1622
  omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
1583
1623
  }).check(invariant_omnichainStatusSnapshotCompletedHasValidChains);
1584
- var makeOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) => import_v49.z.object({
1585
- omnichainStatus: import_v49.z.literal(OmnichainIndexingStatusIds.Following),
1586
- chains: import_v49.z.map(
1624
+ var makeOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) => import_v48.z.object({
1625
+ omnichainStatus: import_v48.z.literal(OmnichainIndexingStatusIds.Following),
1626
+ chains: import_v48.z.map(
1587
1627
  makeChainIdSchema(),
1588
- import_v49.z.discriminatedUnion("chainStatus", [
1628
+ import_v48.z.discriminatedUnion("chainStatus", [
1589
1629
  makeChainIndexingStatusSnapshotQueuedSchema(valueLabel),
1590
1630
  makeChainIndexingStatusSnapshotBackfillSchema(valueLabel),
1591
1631
  makeChainIndexingStatusSnapshotFollowingSchema(valueLabel),
@@ -1597,7 +1637,7 @@ var makeOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) => import_
1597
1637
  ),
1598
1638
  omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
1599
1639
  }).check(invariant_omnichainStatusSnapshotFollowingHasValidChains);
1600
- var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexing Snapshot") => import_v49.z.discriminatedUnion("omnichainStatus", [
1640
+ var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexing Snapshot") => import_v48.z.discriminatedUnion("omnichainStatus", [
1601
1641
  makeOmnichainIndexingStatusSnapshotUnstartedSchema(valueLabel),
1602
1642
  makeOmnichainIndexingStatusSnapshotBackfillSchema(valueLabel),
1603
1643
  makeOmnichainIndexingStatusSnapshotCompletedSchema(valueLabel),
@@ -1605,21 +1645,21 @@ var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexin
1605
1645
  ]).check(invariant_omnichainSnapshotStatusIsConsistentWithChainSnapshot).check(invariant_omnichainIndexingCursorLowerThanEarliestStartBlockAcrossQueuedChains).check(
1606
1646
  invariant_omnichainIndexingCursorLowerThanOrEqualToLatestBackfillEndBlockAcrossBackfillChains
1607
1647
  ).check(invariant_omnichainIndexingCursorIsEqualToHighestLatestIndexedBlockAcrossIndexedChain);
1608
- var makeSerializedOmnichainIndexingStatusSnapshotUnstartedSchema = (valueLabel) => import_v49.z.object({
1609
- omnichainStatus: import_v49.z.literal(OmnichainIndexingStatusIds.Unstarted),
1610
- chains: import_v49.z.record(
1648
+ var makeSerializedOmnichainIndexingStatusSnapshotUnstartedSchema = (valueLabel) => import_v48.z.object({
1649
+ omnichainStatus: import_v48.z.literal(OmnichainIndexingStatusIds.Unstarted),
1650
+ chains: import_v48.z.record(
1611
1651
  makeChainIdStringSchema(),
1612
- import_v49.z.discriminatedUnion("chainStatus", [
1652
+ import_v48.z.discriminatedUnion("chainStatus", [
1613
1653
  makeChainIndexingStatusSnapshotQueuedSchema(valueLabel)
1614
1654
  ])
1615
1655
  ),
1616
1656
  omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
1617
1657
  });
1618
- var makeSerializedOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) => import_v49.z.object({
1619
- omnichainStatus: import_v49.z.literal(OmnichainIndexingStatusIds.Backfill),
1620
- chains: import_v49.z.record(
1658
+ var makeSerializedOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) => import_v48.z.object({
1659
+ omnichainStatus: import_v48.z.literal(OmnichainIndexingStatusIds.Backfill),
1660
+ chains: import_v48.z.record(
1621
1661
  makeChainIdStringSchema(),
1622
- import_v49.z.discriminatedUnion("chainStatus", [
1662
+ import_v48.z.discriminatedUnion("chainStatus", [
1623
1663
  makeChainIndexingStatusSnapshotQueuedSchema(valueLabel),
1624
1664
  makeChainIndexingStatusSnapshotBackfillSchema(valueLabel),
1625
1665
  makeChainIndexingStatusSnapshotCompletedSchema(valueLabel)
@@ -1627,21 +1667,21 @@ var makeSerializedOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) =
1627
1667
  ),
1628
1668
  omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
1629
1669
  });
1630
- var makeSerializedOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) => import_v49.z.object({
1631
- omnichainStatus: import_v49.z.literal(OmnichainIndexingStatusIds.Completed),
1632
- chains: import_v49.z.record(
1670
+ var makeSerializedOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) => import_v48.z.object({
1671
+ omnichainStatus: import_v48.z.literal(OmnichainIndexingStatusIds.Completed),
1672
+ chains: import_v48.z.record(
1633
1673
  makeChainIdStringSchema(),
1634
- import_v49.z.discriminatedUnion("chainStatus", [
1674
+ import_v48.z.discriminatedUnion("chainStatus", [
1635
1675
  makeChainIndexingStatusSnapshotCompletedSchema(valueLabel)
1636
1676
  ])
1637
1677
  ),
1638
1678
  omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
1639
1679
  });
1640
- var makeSerializedOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) => import_v49.z.object({
1641
- omnichainStatus: import_v49.z.literal(OmnichainIndexingStatusIds.Following),
1642
- chains: import_v49.z.record(
1680
+ var makeSerializedOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) => import_v48.z.object({
1681
+ omnichainStatus: import_v48.z.literal(OmnichainIndexingStatusIds.Following),
1682
+ chains: import_v48.z.record(
1643
1683
  makeChainIdStringSchema(),
1644
- import_v49.z.discriminatedUnion("chainStatus", [
1684
+ import_v48.z.discriminatedUnion("chainStatus", [
1645
1685
  makeChainIndexingStatusSnapshotQueuedSchema(valueLabel),
1646
1686
  makeChainIndexingStatusSnapshotBackfillSchema(valueLabel),
1647
1687
  makeChainIndexingStatusSnapshotFollowingSchema(valueLabel),
@@ -1650,14 +1690,14 @@ var makeSerializedOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel)
1650
1690
  ),
1651
1691
  omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
1652
1692
  });
1653
- var makeSerializedOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Value") => import_v49.z.discriminatedUnion("omnichainStatus", [
1693
+ var makeSerializedOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Value") => import_v48.z.discriminatedUnion("omnichainStatus", [
1654
1694
  makeSerializedOmnichainIndexingStatusSnapshotUnstartedSchema(valueLabel),
1655
1695
  makeSerializedOmnichainIndexingStatusSnapshotBackfillSchema(valueLabel),
1656
1696
  makeSerializedOmnichainIndexingStatusSnapshotCompletedSchema(valueLabel),
1657
1697
  makeSerializedOmnichainIndexingStatusSnapshotFollowingSchema(valueLabel)
1658
1698
  ]);
1659
1699
 
1660
- // src/ensindexer/indexing-status/zod-schema/cross-chain-indexing-status-snapshot.ts
1700
+ // src/indexing-status/zod-schema/cross-chain-indexing-status-snapshot.ts
1661
1701
  function invariant_slowestChainEqualsToOmnichainSnapshotTime(ctx) {
1662
1702
  const { slowestChainIndexingCursor, omnichainSnapshot } = ctx.value;
1663
1703
  const { omnichainIndexingCursor } = omnichainSnapshot;
@@ -1690,33 +1730,71 @@ function invariant_snapshotTimeIsTheHighestKnownBlockTimestamp(ctx) {
1690
1730
  });
1691
1731
  }
1692
1732
  }
1693
- var makeCrossChainIndexingStatusSnapshotOmnichainSchema = (valueLabel = "Cross-chain Indexing Status Snapshot Omnichain") => import_v410.z.object({
1694
- strategy: import_v410.z.literal(CrossChainIndexingStrategyIds.Omnichain),
1733
+ var makeCrossChainIndexingStatusSnapshotOmnichainSchema = (valueLabel = "Cross-chain Indexing Status Snapshot Omnichain") => import_v49.z.object({
1734
+ strategy: import_v49.z.literal(CrossChainIndexingStrategyIds.Omnichain),
1695
1735
  slowestChainIndexingCursor: makeUnixTimestampSchema(valueLabel),
1696
1736
  snapshotTime: makeUnixTimestampSchema(valueLabel),
1697
1737
  omnichainSnapshot: makeOmnichainIndexingStatusSnapshotSchema(valueLabel)
1698
1738
  }).check(invariant_slowestChainEqualsToOmnichainSnapshotTime).check(invariant_snapshotTimeIsTheHighestKnownBlockTimestamp);
1699
- var makeCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Cross-chain Indexing Status Snapshot") => import_v410.z.discriminatedUnion("strategy", [
1739
+ var makeCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Cross-chain Indexing Status Snapshot") => import_v49.z.discriminatedUnion("strategy", [
1700
1740
  makeCrossChainIndexingStatusSnapshotOmnichainSchema(valueLabel)
1701
1741
  ]);
1702
- var makeSerializedCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Serialized Cross-chain Indexing Status Snapshot") => import_v410.z.object({
1703
- strategy: import_v410.z.enum(CrossChainIndexingStrategyIds),
1742
+ var makeSerializedCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Serialized Cross-chain Indexing Status Snapshot") => import_v49.z.object({
1743
+ strategy: import_v49.z.enum(CrossChainIndexingStrategyIds),
1704
1744
  slowestChainIndexingCursor: makeUnixTimestampSchema(valueLabel),
1705
1745
  snapshotTime: makeUnixTimestampSchema(valueLabel),
1706
1746
  omnichainSnapshot: makeSerializedOmnichainIndexingStatusSnapshotSchema(valueLabel)
1707
1747
  });
1708
1748
 
1709
- // src/ensindexer/indexing-status/deserialize/omnichain-indexing-status-snapshot.ts
1710
- var import_v411 = require("zod/v4");
1711
- function buildUnvalidatedOmnichainIndexingStatusSnapshot(serializedSnapshot) {
1712
- const chains = /* @__PURE__ */ new Map();
1713
- for (const [chainIdString, chainIndexingStatusSnapshot] of Object.entries(
1714
- serializedSnapshot.chains
1715
- )) {
1716
- const chainId = Number(chainIdString);
1717
- chains.set(chainId, chainIndexingStatusSnapshot);
1749
+ // src/indexing-status/zod-schema/realtime-indexing-status-projection.ts
1750
+ function invariant_realtimeIndexingStatusProjectionProjectedAtIsAfterOrEqualToSnapshotTime(ctx) {
1751
+ const projection = ctx.value;
1752
+ const { snapshot, projectedAt } = projection;
1753
+ if (snapshot.snapshotTime > projectedAt) {
1754
+ ctx.issues.push({
1755
+ code: "custom",
1756
+ input: projection,
1757
+ message: "`projectedAt` must be after or same as `snapshot.snapshotTime`."
1758
+ });
1718
1759
  }
1719
- const unvalidatedSnapshot = {
1760
+ }
1761
+ function invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect(ctx) {
1762
+ const projection = ctx.value;
1763
+ const { projectedAt, snapshot, worstCaseDistance } = projection;
1764
+ const expectedWorstCaseDistance = projectedAt - snapshot.slowestChainIndexingCursor;
1765
+ if (worstCaseDistance !== expectedWorstCaseDistance) {
1766
+ ctx.issues.push({
1767
+ code: "custom",
1768
+ input: projection,
1769
+ message: "`worstCaseDistance` must be the exact difference between `projectedAt` and `snapshot.slowestChainIndexingCursor`."
1770
+ });
1771
+ }
1772
+ }
1773
+ var makeRealtimeIndexingStatusProjectionSchema = (valueLabel = "Realtime Indexing Status Projection") => import_v410.z.object({
1774
+ projectedAt: makeUnixTimestampSchema(valueLabel),
1775
+ worstCaseDistance: makeDurationSchema(valueLabel),
1776
+ snapshot: makeCrossChainIndexingStatusSnapshotSchema(valueLabel)
1777
+ }).check(invariant_realtimeIndexingStatusProjectionProjectedAtIsAfterOrEqualToSnapshotTime).check(invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect);
1778
+ var makeSerializedRealtimeIndexingStatusProjectionSchema = (valueLabel = "Value") => import_v410.z.object({
1779
+ snapshot: makeSerializedCrossChainIndexingStatusSnapshotSchema(valueLabel),
1780
+ projectedAt: makeUnixTimestampSchema(valueLabel),
1781
+ worstCaseDistance: makeDurationSchema(valueLabel)
1782
+ });
1783
+
1784
+ // src/indexing-status/deserialize/cross-chain-indexing-status-snapshot.ts
1785
+ var import_v412 = require("zod/v4");
1786
+
1787
+ // src/indexing-status/deserialize/omnichain-indexing-status-snapshot.ts
1788
+ var import_v411 = require("zod/v4");
1789
+ function buildUnvalidatedOmnichainIndexingStatusSnapshot(serializedSnapshot) {
1790
+ const chains = /* @__PURE__ */ new Map();
1791
+ for (const [chainIdString, chainIndexingStatusSnapshot] of Object.entries(
1792
+ serializedSnapshot.chains
1793
+ )) {
1794
+ const chainId = Number(chainIdString);
1795
+ chains.set(chainId, chainIndexingStatusSnapshot);
1796
+ }
1797
+ const unvalidatedSnapshot = {
1720
1798
  ...serializedSnapshot,
1721
1799
  chains
1722
1800
  };
@@ -1735,7 +1813,7 @@ ${(0, import_v411.prettifyError)(parsed.error)}
1735
1813
  return parsed.data;
1736
1814
  }
1737
1815
 
1738
- // src/ensindexer/indexing-status/deserialize/cross-chain-indexing-status-snapshot.ts
1816
+ // src/indexing-status/deserialize/cross-chain-indexing-status-snapshot.ts
1739
1817
  function buildUnvalidatedCrossChainIndexingStatusSnapshot(serializedSnapshot) {
1740
1818
  return {
1741
1819
  ...serializedSnapshot,
@@ -1757,46 +1835,7 @@ ${(0, import_v412.prettifyError)(parsed.error)}
1757
1835
  return parsed.data;
1758
1836
  }
1759
1837
 
1760
- // src/ensindexer/indexing-status/deserialize/realtime-indexing-status-projection.ts
1761
- var import_v414 = require("zod/v4");
1762
-
1763
- // src/ensindexer/indexing-status/zod-schema/realtime-indexing-status-projection.ts
1764
- var import_v413 = require("zod/v4");
1765
- function invariant_realtimeIndexingStatusProjectionProjectedAtIsAfterOrEqualToSnapshotTime(ctx) {
1766
- const projection = ctx.value;
1767
- const { snapshot, projectedAt } = projection;
1768
- if (snapshot.snapshotTime > projectedAt) {
1769
- ctx.issues.push({
1770
- code: "custom",
1771
- input: projection,
1772
- message: "`projectedAt` must be after or same as `snapshot.snapshotTime`."
1773
- });
1774
- }
1775
- }
1776
- function invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect(ctx) {
1777
- const projection = ctx.value;
1778
- const { projectedAt, snapshot, worstCaseDistance } = projection;
1779
- const expectedWorstCaseDistance = projectedAt - snapshot.slowestChainIndexingCursor;
1780
- if (worstCaseDistance !== expectedWorstCaseDistance) {
1781
- ctx.issues.push({
1782
- code: "custom",
1783
- input: projection,
1784
- message: "`worstCaseDistance` must be the exact difference between `projectedAt` and `snapshot.slowestChainIndexingCursor`."
1785
- });
1786
- }
1787
- }
1788
- var makeRealtimeIndexingStatusProjectionSchema = (valueLabel = "Realtime Indexing Status Projection") => import_v413.z.object({
1789
- projectedAt: makeUnixTimestampSchema(valueLabel),
1790
- worstCaseDistance: makeDurationSchema(valueLabel),
1791
- snapshot: makeCrossChainIndexingStatusSnapshotSchema(valueLabel)
1792
- }).check(invariant_realtimeIndexingStatusProjectionProjectedAtIsAfterOrEqualToSnapshotTime).check(invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect);
1793
- var makeSerializedRealtimeIndexingStatusProjectionSchema = (valueLabel = "Value") => import_v413.z.object({
1794
- snapshot: makeSerializedCrossChainIndexingStatusSnapshotSchema(valueLabel),
1795
- projectedAt: makeUnixTimestampSchema(valueLabel),
1796
- worstCaseDistance: makeDurationSchema(valueLabel)
1797
- });
1798
-
1799
- // src/ensindexer/indexing-status/deserialize/realtime-indexing-status-projection.ts
1838
+ // src/indexing-status/deserialize/realtime-indexing-status-projection.ts
1800
1839
  function buildUnvalidatedRealtimeIndexingStatusProjection(serializedProjection) {
1801
1840
  return {
1802
1841
  ...serializedProjection,
@@ -1809,22 +1848,68 @@ function deserializeRealtimeIndexingStatusProjection(maybeProjection, valueLabel
1809
1848
  if (parsed.error) {
1810
1849
  throw new Error(
1811
1850
  `Cannot deserialize into RealtimeIndexingStatusProjection:
1812
- ${(0, import_v414.prettifyError)(parsed.error)}
1851
+ ${(0, import_v413.prettifyError)(parsed.error)}
1813
1852
  `
1814
1853
  );
1815
1854
  }
1816
1855
  return parsed.data;
1817
1856
  }
1818
1857
 
1819
- // src/ensindexer/indexing-status/realtime-indexing-status-projection.ts
1820
- function createRealtimeIndexingStatusProjection(snapshot, now) {
1821
- const projectedAt = Math.max(now, snapshot.snapshotTime);
1858
+ // src/ensapi/api/indexing-status/response.ts
1859
+ var IndexingStatusResponseCodes = {
1860
+ /**
1861
+ * Represents that the indexing status is available.
1862
+ */
1863
+ Ok: "ok",
1864
+ /**
1865
+ * Represents that the indexing status is unavailable.
1866
+ */
1867
+ Error: "error"
1868
+ };
1869
+
1870
+ // src/ensapi/api/indexing-status/zod-schemas.ts
1871
+ var import_v414 = require("zod/v4");
1872
+ var makeIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => import_v414.z.strictObject({
1873
+ responseCode: import_v414.z.literal(IndexingStatusResponseCodes.Ok),
1874
+ realtimeProjection: makeRealtimeIndexingStatusProjectionSchema(valueLabel)
1875
+ });
1876
+ var makeIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => import_v414.z.strictObject({
1877
+ responseCode: import_v414.z.literal(IndexingStatusResponseCodes.Error)
1878
+ });
1879
+ var makeIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => import_v414.z.discriminatedUnion("responseCode", [
1880
+ makeIndexingStatusResponseOkSchema(valueLabel),
1881
+ makeIndexingStatusResponseErrorSchema(valueLabel)
1882
+ ]);
1883
+ var makeSerializedIndexingStatusResponseOkSchema = (valueLabel = "Serialized Indexing Status Response OK") => import_v414.z.strictObject({
1884
+ responseCode: import_v414.z.literal(IndexingStatusResponseCodes.Ok),
1885
+ realtimeProjection: makeSerializedRealtimeIndexingStatusProjectionSchema(valueLabel)
1886
+ });
1887
+ var makeSerializedIndexingStatusResponseSchema = (valueLabel = "Serialized Indexing Status Response") => import_v414.z.discriminatedUnion("responseCode", [
1888
+ makeSerializedIndexingStatusResponseOkSchema(valueLabel),
1889
+ makeIndexingStatusResponseErrorSchema(valueLabel)
1890
+ ]);
1891
+
1892
+ // src/ensapi/api/indexing-status/deserialize.ts
1893
+ function buildUnvalidatedIndexingStatusResponse(serializedResponse) {
1894
+ if (serializedResponse.responseCode !== IndexingStatusResponseCodes.Ok) {
1895
+ return serializedResponse;
1896
+ }
1822
1897
  return {
1823
- projectedAt,
1824
- worstCaseDistance: projectedAt - snapshot.slowestChainIndexingCursor,
1825
- snapshot
1898
+ ...serializedResponse,
1899
+ realtimeProjection: buildUnvalidatedRealtimeIndexingStatusProjection(
1900
+ serializedResponse.realtimeProjection
1901
+ )
1826
1902
  };
1827
1903
  }
1904
+ function deserializeIndexingStatusResponse(maybeResponse) {
1905
+ const parsed = makeSerializedIndexingStatusResponseSchema().transform(buildUnvalidatedIndexingStatusResponse).pipe(makeIndexingStatusResponseSchema()).safeParse(maybeResponse);
1906
+ if (parsed.error) {
1907
+ throw new Error(`Cannot deserialize IndexingStatusResponse:
1908
+ ${(0, import_v415.prettifyError)(parsed.error)}
1909
+ `);
1910
+ }
1911
+ return parsed.data;
1912
+ }
1828
1913
 
1829
1914
  // src/shared/serialize.ts
1830
1915
  var import_caip2 = require("caip");
@@ -1870,7 +1955,7 @@ function formatAssetId({
1870
1955
  }).toLowerCase();
1871
1956
  }
1872
1957
 
1873
- // src/ensindexer/indexing-status/serialize/chain-indexing-status-snapshot.ts
1958
+ // src/indexing-status/serialize/chain-indexing-status-snapshot.ts
1874
1959
  function serializeChainIndexingSnapshots(chains) {
1875
1960
  const serializedSnapshots = {};
1876
1961
  for (const [chainId, snapshot] of chains.entries()) {
@@ -1879,7 +1964,7 @@ function serializeChainIndexingSnapshots(chains) {
1879
1964
  return serializedSnapshots;
1880
1965
  }
1881
1966
 
1882
- // src/ensindexer/indexing-status/serialize/omnichain-indexing-status-snapshot.ts
1967
+ // src/indexing-status/serialize/omnichain-indexing-status-snapshot.ts
1883
1968
  function serializeOmnichainIndexingStatusSnapshot(indexingStatus) {
1884
1969
  switch (indexingStatus.omnichainStatus) {
1885
1970
  case OmnichainIndexingStatusIds.Unstarted:
@@ -1910,7 +1995,7 @@ function serializeOmnichainIndexingStatusSnapshot(indexingStatus) {
1910
1995
  }
1911
1996
  }
1912
1997
 
1913
- // src/ensindexer/indexing-status/serialize/cross-chain-indexing-status-snapshot.ts
1998
+ // src/indexing-status/serialize/cross-chain-indexing-status-snapshot.ts
1914
1999
  function serializeCrossChainIndexingStatusSnapshotOmnichain({
1915
2000
  strategy,
1916
2001
  slowestChainIndexingCursor,
@@ -1925,7 +2010,7 @@ function serializeCrossChainIndexingStatusSnapshotOmnichain({
1925
2010
  };
1926
2011
  }
1927
2012
 
1928
- // src/ensindexer/indexing-status/serialize/realtime-indexing-status-projection.ts
2013
+ // src/indexing-status/serialize/realtime-indexing-status-projection.ts
1929
2014
  function serializeRealtimeIndexingStatusProjection(indexingProjection) {
1930
2015
  return {
1931
2016
  projectedAt: indexingProjection.projectedAt,
@@ -1934,138 +2019,7 @@ function serializeRealtimeIndexingStatusProjection(indexingProjection) {
1934
2019
  };
1935
2020
  }
1936
2021
 
1937
- // src/ensindexer/indexing-status/validate/chain-indexing-status-snapshot.ts
1938
- var import_v415 = require("zod/v4");
1939
- function validateChainIndexingStatusSnapshot(unvalidatedSnapshot, valueLabel) {
1940
- const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
1941
- const parsed = schema.safeParse(unvalidatedSnapshot);
1942
- if (parsed.error) {
1943
- throw new Error(`Invalid ChainIndexingStatusSnapshot:
1944
- ${(0, import_v415.prettifyError)(parsed.error)}
1945
- `);
1946
- }
1947
- return parsed.data;
1948
- }
1949
-
1950
- // src/ensindexer/indexing-status/validate/cross-chain-indexing-status-snapshot.ts
1951
- var import_v416 = require("zod/v4");
1952
- function validateCrossChainIndexingStatusSnapshot(unvalidatedSnapshot, valueLabel) {
1953
- const schema = makeCrossChainIndexingStatusSnapshotSchema(valueLabel);
1954
- const parsed = schema.safeParse(unvalidatedSnapshot);
1955
- if (parsed.error) {
1956
- throw new Error(`Invalid CrossChainIndexingStatusSnapshot:
1957
- ${(0, import_v416.prettifyError)(parsed.error)}
1958
- `);
1959
- }
1960
- return parsed.data;
1961
- }
1962
-
1963
- // src/ensindexer/indexing-status/validate/omnichain-indexing-status-snapshot.ts
1964
- var import_v417 = require("zod/v4");
1965
- function validateOmnichainIndexingStatusSnapshot(unvalidatedSnapshot, valueLabel) {
1966
- const schema = makeOmnichainIndexingStatusSnapshotSchema(valueLabel);
1967
- const parsed = schema.safeParse(unvalidatedSnapshot);
1968
- if (parsed.error) {
1969
- throw new Error(`Invalid OmnichainIndexingStatusSnapshot:
1970
- ${(0, import_v417.prettifyError)(parsed.error)}
1971
- `);
1972
- }
1973
- return parsed.data;
1974
- }
1975
-
1976
- // src/ensindexer/indexing-status/validate/realtime-indexing-status-projection.ts
1977
- var import_v418 = require("zod/v4");
1978
- function validateRealtimeIndexingStatusProjection(unvalidatedProjection, valueLabel) {
1979
- const schema = makeRealtimeIndexingStatusProjectionSchema(valueLabel);
1980
- const parsed = schema.safeParse(unvalidatedProjection);
1981
- if (parsed.error) {
1982
- throw new Error(`Invalid RealtimeIndexingStatusProjection:
1983
- ${(0, import_v418.prettifyError)(parsed.error)}
1984
- `);
1985
- }
1986
- return parsed.data;
1987
- }
1988
-
1989
- // src/ensapi/config/serialize.ts
1990
- function serializeENSApiPublicConfig(config) {
1991
- const { version, theGraphFallback, ensIndexerPublicConfig } = config;
1992
- return {
1993
- version,
1994
- theGraphFallback,
1995
- ensIndexerPublicConfig: serializeENSIndexerPublicConfig(ensIndexerPublicConfig)
1996
- };
1997
- }
1998
-
1999
- // src/api/config/deserialize.ts
2000
- function deserializeConfigResponse(serializedResponse) {
2001
- return deserializeENSApiPublicConfig(serializedResponse);
2002
- }
2003
-
2004
- // src/api/config/serialize.ts
2005
- function serializeConfigResponse(response) {
2006
- return serializeENSApiPublicConfig(response);
2007
- }
2008
-
2009
- // src/api/indexing-status/deserialize.ts
2010
- var import_v420 = require("zod/v4");
2011
-
2012
- // src/api/indexing-status/response.ts
2013
- var IndexingStatusResponseCodes = {
2014
- /**
2015
- * Represents that the indexing status is available.
2016
- */
2017
- Ok: "ok",
2018
- /**
2019
- * Represents that the indexing status is unavailable.
2020
- */
2021
- Error: "error"
2022
- };
2023
-
2024
- // src/api/indexing-status/zod-schemas.ts
2025
- var import_v419 = require("zod/v4");
2026
- var makeIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => import_v419.z.strictObject({
2027
- responseCode: import_v419.z.literal(IndexingStatusResponseCodes.Ok),
2028
- realtimeProjection: makeRealtimeIndexingStatusProjectionSchema(valueLabel)
2029
- });
2030
- var makeIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => import_v419.z.strictObject({
2031
- responseCode: import_v419.z.literal(IndexingStatusResponseCodes.Error)
2032
- });
2033
- var makeIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => import_v419.z.discriminatedUnion("responseCode", [
2034
- makeIndexingStatusResponseOkSchema(valueLabel),
2035
- makeIndexingStatusResponseErrorSchema(valueLabel)
2036
- ]);
2037
- var makeSerializedIndexingStatusResponseOkSchema = (valueLabel = "Serialized Indexing Status Response OK") => import_v419.z.strictObject({
2038
- responseCode: import_v419.z.literal(IndexingStatusResponseCodes.Ok),
2039
- realtimeProjection: makeSerializedRealtimeIndexingStatusProjectionSchema(valueLabel)
2040
- });
2041
- var makeSerializedIndexingStatusResponseSchema = (valueLabel = "Serialized Indexing Status Response") => import_v419.z.discriminatedUnion("responseCode", [
2042
- makeSerializedIndexingStatusResponseOkSchema(valueLabel),
2043
- makeIndexingStatusResponseErrorSchema(valueLabel)
2044
- ]);
2045
-
2046
- // src/api/indexing-status/deserialize.ts
2047
- function buildUnvalidatedIndexingStatusResponse(serializedResponse) {
2048
- if (serializedResponse.responseCode !== IndexingStatusResponseCodes.Ok) {
2049
- return serializedResponse;
2050
- }
2051
- return {
2052
- ...serializedResponse,
2053
- realtimeProjection: buildUnvalidatedRealtimeIndexingStatusProjection(
2054
- serializedResponse.realtimeProjection
2055
- )
2056
- };
2057
- }
2058
- function deserializeIndexingStatusResponse(maybeResponse) {
2059
- const parsed = makeSerializedIndexingStatusResponseSchema().transform(buildUnvalidatedIndexingStatusResponse).pipe(makeIndexingStatusResponseSchema()).safeParse(maybeResponse);
2060
- if (parsed.error) {
2061
- throw new Error(`Cannot deserialize IndexingStatusResponse:
2062
- ${(0, import_v420.prettifyError)(parsed.error)}
2063
- `);
2064
- }
2065
- return parsed.data;
2066
- }
2067
-
2068
- // src/api/indexing-status/serialize.ts
2022
+ // src/ensapi/api/indexing-status/serialize.ts
2069
2023
  function serializeIndexingStatusResponse(response) {
2070
2024
  switch (response.responseCode) {
2071
2025
  case IndexingStatusResponseCodes.Ok:
@@ -2078,31 +2032,16 @@ function serializeIndexingStatusResponse(response) {
2078
2032
  }
2079
2033
  }
2080
2034
 
2081
- // src/api/name-tokens/deserialize.ts
2082
- var import_v425 = require("zod/v4");
2035
+ // src/ensapi/api/name-tokens/deserialize.ts
2036
+ var import_v420 = require("zod/v4");
2083
2037
 
2084
- // src/api/name-tokens/zod-schemas.ts
2038
+ // src/ensapi/api/name-tokens/zod-schemas.ts
2085
2039
  var import_viem14 = require("viem");
2086
- var import_v424 = require("zod/v4");
2087
-
2088
- // src/tokenscope/assets.ts
2089
- var import_viem13 = require("viem");
2090
- var import_v422 = require("zod/v4");
2091
-
2092
- // src/tokenscope/zod-schemas.ts
2093
- var import_caip3 = require("caip");
2094
- var import_viem12 = require("viem");
2095
- var import_v421 = require("zod/v4");
2096
-
2097
- // src/shared/types.ts
2098
- var AssetNamespaces = {
2099
- ERC721: "erc721",
2100
- ERC1155: "erc1155"
2101
- };
2040
+ var import_v419 = require("zod/v4");
2102
2041
 
2103
2042
  // src/tokenscope/name-token.ts
2104
- var import_viem11 = require("viem");
2105
- var import_datasources5 = require("@ensnode/datasources");
2043
+ var import_viem13 = require("viem");
2044
+ var import_datasources6 = require("@ensnode/datasources");
2106
2045
 
2107
2046
  // src/shared/account-id.ts
2108
2047
  var import_viem10 = require("viem");
@@ -2111,9 +2050,9 @@ var accountIdEqual = (a, b) => {
2111
2050
  };
2112
2051
 
2113
2052
  // src/shared/datasource-contract.ts
2114
- var import_datasources4 = require("@ensnode/datasources");
2053
+ var import_datasources5 = require("@ensnode/datasources");
2115
2054
  var maybeGetDatasourceContract = (namespaceId, datasourceName, contractName) => {
2116
- const datasource = (0, import_datasources4.maybeGetDatasource)(namespaceId, datasourceName);
2055
+ const datasource = (0, import_datasources5.maybeGetDatasource)(namespaceId, datasourceName);
2117
2056
  if (!datasource) return void 0;
2118
2057
  const address = datasource.contracts[contractName]?.address;
2119
2058
  if (address === void 0 || Array.isArray(address)) return void 0;
@@ -2134,91 +2073,28 @@ var getDatasourceContract = (namespaceId, datasourceName, contractName) => {
2134
2073
  var makeContractMatcher = (namespace, b) => (datasourceName, contractName) => {
2135
2074
  const a = maybeGetDatasourceContract(namespace, datasourceName, contractName);
2136
2075
  return a && accountIdEqual(a, b);
2137
- };
2138
-
2139
- // src/tokenscope/name-token.ts
2140
- var NameTokenOwnershipTypes = {
2141
- /**
2142
- * Name Token is owned by NameWrapper account.
2143
- */
2144
- NameWrapper: "namewrapper",
2145
- /**
2146
- * Name Token is owned fully onchain.
2147
- *
2148
- * This ownership type can only apply to direct subnames of `.eth`
2149
- */
2150
- FullyOnchain: "fully-onchain",
2151
- /**
2152
- * Name Token ownership has been transferred to the null address.
2153
- */
2154
- Burned: "burned",
2155
- /**
2156
- * Name Token ownership is unknown.
2157
- */
2158
- Unknown: "unknown"
2159
- };
2160
- function serializeNameToken(nameToken) {
2161
- return {
2162
- token: serializeAssetId(nameToken.token),
2163
- ownership: nameToken.ownership,
2164
- mintStatus: nameToken.mintStatus
2165
- };
2166
- }
2167
- function getNameWrapperAccounts(namespaceId) {
2168
- const ethnamesNameWrapperAccount = getDatasourceContract(
2169
- namespaceId,
2170
- import_datasources5.DatasourceNames.ENSRoot,
2171
- "NameWrapper"
2172
- );
2173
- const lineanamesNameWrapperAccount = maybeGetDatasourceContract(
2174
- namespaceId,
2175
- import_datasources5.DatasourceNames.Lineanames,
2176
- "NameWrapper"
2177
- );
2178
- const nameWrapperAccounts = [
2179
- // NameWrapper for direct subnames of .eth is defined for all ENS namespaces
2180
- ethnamesNameWrapperAccount
2181
- ];
2182
- if (lineanamesNameWrapperAccount) {
2183
- nameWrapperAccounts.push(lineanamesNameWrapperAccount);
2184
- }
2185
- return nameWrapperAccounts;
2186
- }
2187
- function getNameTokenOwnership(namespaceId, name, owner) {
2188
- const nameWrapperAccounts = getNameWrapperAccounts(namespaceId);
2189
- const hasNameWrapperOwnership = nameWrapperAccounts.some(
2190
- (nameWrapperAccount) => accountIdEqual(owner, nameWrapperAccount)
2191
- );
2192
- if (hasNameWrapperOwnership) {
2193
- return {
2194
- ownershipType: NameTokenOwnershipTypes.NameWrapper,
2195
- owner
2196
- };
2197
- }
2198
- if ((0, import_viem11.isAddressEqual)(owner.address, import_viem11.zeroAddress)) {
2199
- return {
2200
- ownershipType: NameTokenOwnershipTypes.Burned,
2201
- owner
2202
- };
2203
- }
2204
- const parentName = getParentNameFQDN(name);
2205
- if (parentName === "eth") {
2206
- return {
2207
- ownershipType: NameTokenOwnershipTypes.FullyOnchain,
2208
- owner
2209
- };
2210
- }
2211
- return {
2212
- ownershipType: NameTokenOwnershipTypes.Unknown,
2213
- owner
2214
- };
2215
- }
2076
+ };
2077
+
2078
+ // src/tokenscope/assets.ts
2079
+ var import_viem12 = require("viem");
2080
+ var import_v417 = require("zod/v4");
2081
+
2082
+ // src/tokenscope/zod-schemas.ts
2083
+ var import_caip3 = require("caip");
2084
+ var import_viem11 = require("viem");
2085
+ var import_v416 = require("zod/v4");
2086
+
2087
+ // src/shared/types.ts
2088
+ var AssetNamespaces = {
2089
+ ERC721: "erc721",
2090
+ ERC1155: "erc1155"
2091
+ };
2216
2092
 
2217
2093
  // src/tokenscope/zod-schemas.ts
2218
- var tokenIdSchemaSerializable = import_v421.z.string();
2219
- var tokenIdSchemaNative = import_v421.z.preprocess(
2094
+ var tokenIdSchemaSerializable = import_v416.z.string();
2095
+ var tokenIdSchemaNative = import_v416.z.preprocess(
2220
2096
  (v) => typeof v === "string" ? BigInt(v) : v,
2221
- import_v421.z.bigint().positive()
2097
+ import_v416.z.bigint().positive()
2222
2098
  );
2223
2099
  function makeTokenIdSchema(_valueLabel = "Token ID Schema", serializable = false) {
2224
2100
  if (serializable) {
@@ -2228,13 +2104,13 @@ function makeTokenIdSchema(_valueLabel = "Token ID Schema", serializable = false
2228
2104
  }
2229
2105
  }
2230
2106
  var makeAssetIdSchema = (valueLabel = "Asset ID Schema", serializable) => {
2231
- return import_v421.z.object({
2232
- assetNamespace: import_v421.z.enum(AssetNamespaces),
2107
+ return import_v416.z.object({
2108
+ assetNamespace: import_v416.z.enum(AssetNamespaces),
2233
2109
  contract: makeAccountIdSchema(valueLabel),
2234
2110
  tokenId: makeTokenIdSchema(valueLabel, serializable ?? false)
2235
2111
  });
2236
2112
  };
2237
- var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") => import_v421.z.preprocess((v) => {
2113
+ var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") => import_v416.z.preprocess((v) => {
2238
2114
  if (typeof v === "string") {
2239
2115
  const result = new import_caip3.AssetId(v);
2240
2116
  return {
@@ -2250,7 +2126,7 @@ var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") => import_
2250
2126
  }, makeAssetIdSchema(valueLabel));
2251
2127
  function invariant_nameTokenOwnershipHasNonZeroAddressOwner(ctx) {
2252
2128
  const ownership = ctx.value;
2253
- if (ctx.value.owner.address === import_viem12.zeroAddress) {
2129
+ if (ctx.value.owner.address === import_viem11.zeroAddress) {
2254
2130
  ctx.issues.push({
2255
2131
  code: "custom",
2256
2132
  input: ctx.value,
@@ -2258,25 +2134,25 @@ function invariant_nameTokenOwnershipHasNonZeroAddressOwner(ctx) {
2258
2134
  });
2259
2135
  }
2260
2136
  }
2261
- var makeNameTokenOwnershipNameWrapperSchema = (valueLabel = "Name Token Ownership NameWrapper") => import_v421.z.object({
2262
- ownershipType: import_v421.z.literal(NameTokenOwnershipTypes.NameWrapper),
2137
+ var makeNameTokenOwnershipNameWrapperSchema = (valueLabel = "Name Token Ownership NameWrapper") => import_v416.z.object({
2138
+ ownershipType: import_v416.z.literal(NameTokenOwnershipTypes.NameWrapper),
2263
2139
  owner: makeAccountIdSchema(`${valueLabel}.owner`)
2264
2140
  }).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
2265
- var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") => import_v421.z.object({
2266
- ownershipType: import_v421.z.literal(NameTokenOwnershipTypes.FullyOnchain),
2141
+ var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") => import_v416.z.object({
2142
+ ownershipType: import_v416.z.literal(NameTokenOwnershipTypes.FullyOnchain),
2267
2143
  owner: makeAccountIdSchema(`${valueLabel}.owner`)
2268
2144
  }).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
2269
- var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") => import_v421.z.object({
2270
- ownershipType: import_v421.z.literal(NameTokenOwnershipTypes.Burned),
2145
+ var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") => import_v416.z.object({
2146
+ ownershipType: import_v416.z.literal(NameTokenOwnershipTypes.Burned),
2271
2147
  owner: makeAccountIdSchema(`${valueLabel}.owner`)
2272
2148
  }).check(invariant_nameTokenOwnershipHasZeroAddressOwner);
2273
- var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") => import_v421.z.object({
2274
- ownershipType: import_v421.z.literal(NameTokenOwnershipTypes.Unknown),
2149
+ var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") => import_v416.z.object({
2150
+ ownershipType: import_v416.z.literal(NameTokenOwnershipTypes.Unknown),
2275
2151
  owner: makeAccountIdSchema(`${valueLabel}.owner`)
2276
2152
  }).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
2277
2153
  function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
2278
2154
  const ownership = ctx.value;
2279
- if (ctx.value.owner.address !== import_viem12.zeroAddress) {
2155
+ if (ctx.value.owner.address !== import_viem11.zeroAddress) {
2280
2156
  ctx.issues.push({
2281
2157
  code: "custom",
2282
2158
  input: ctx.value,
@@ -2284,16 +2160,16 @@ function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
2284
2160
  });
2285
2161
  }
2286
2162
  }
2287
- var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") => import_v421.z.discriminatedUnion("ownershipType", [
2163
+ var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") => import_v416.z.discriminatedUnion("ownershipType", [
2288
2164
  makeNameTokenOwnershipNameWrapperSchema(valueLabel),
2289
2165
  makeNameTokenOwnershipFullyOnchainSchema(valueLabel),
2290
2166
  makeNameTokenOwnershipBurnedSchema(valueLabel),
2291
2167
  makeNameTokenOwnershipUnknownSchema(valueLabel)
2292
2168
  ]);
2293
- var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) => import_v421.z.object({
2169
+ var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) => import_v416.z.object({
2294
2170
  token: makeAssetIdSchema(`${valueLabel}.token`, serializable),
2295
2171
  ownership: makeNameTokenOwnershipSchema(`${valueLabel}.ownership`),
2296
- mintStatus: import_v421.z.enum(NFTMintStatuses)
2172
+ mintStatus: import_v416.z.enum(NFTMintStatuses)
2297
2173
  });
2298
2174
 
2299
2175
  // src/tokenscope/assets.ts
@@ -2309,7 +2185,7 @@ function deserializeAssetId(maybeAssetId, valueLabel) {
2309
2185
  const parsed = schema.safeParse(maybeAssetId);
2310
2186
  if (parsed.error) {
2311
2187
  throw new RangeError(`Cannot deserialize AssetId:
2312
- ${(0, import_v422.prettifyError)(parsed.error)}
2188
+ ${(0, import_v417.prettifyError)(parsed.error)}
2313
2189
  `);
2314
2190
  }
2315
2191
  return parsed.data;
@@ -2319,7 +2195,7 @@ function parseAssetId(maybeAssetId, valueLabel) {
2319
2195
  const parsed = schema.safeParse(maybeAssetId);
2320
2196
  if (parsed.error) {
2321
2197
  throw new RangeError(`Cannot parse AssetId:
2322
- ${(0, import_v422.prettifyError)(parsed.error)}
2198
+ ${(0, import_v417.prettifyError)(parsed.error)}
2323
2199
  `);
2324
2200
  }
2325
2201
  return parsed.data;
@@ -2454,11 +2330,11 @@ var NFTTransferTypes = {
2454
2330
  };
2455
2331
  var getNFTTransferType = (from, to, allowMintedRemint, metadata, currentlyIndexedOwner) => {
2456
2332
  const isIndexed = currentlyIndexedOwner !== void 0;
2457
- const isIndexedAsMinted = isIndexed && !(0, import_viem13.isAddressEqual)(currentlyIndexedOwner, import_viem13.zeroAddress);
2458
- const isMint = (0, import_viem13.isAddressEqual)(from, import_viem13.zeroAddress);
2459
- const isBurn = (0, import_viem13.isAddressEqual)(to, import_viem13.zeroAddress);
2460
- const isSelfTransfer = (0, import_viem13.isAddressEqual)(from, to);
2461
- if (isIndexed && !(0, import_viem13.isAddressEqual)(currentlyIndexedOwner, from)) {
2333
+ const isIndexedAsMinted = isIndexed && !(0, import_viem12.isAddressEqual)(currentlyIndexedOwner, import_viem12.zeroAddress);
2334
+ const isMint = (0, import_viem12.isAddressEqual)(from, import_viem12.zeroAddress);
2335
+ const isBurn = (0, import_viem12.isAddressEqual)(to, import_viem12.zeroAddress);
2336
+ const isSelfTransfer = (0, import_viem12.isAddressEqual)(from, to);
2337
+ if (isIndexed && !(0, import_viem12.isAddressEqual)(currentlyIndexedOwner, from)) {
2462
2338
  if (isMint && allowMintedRemint) {
2463
2339
  } else {
2464
2340
  throw new Error(
@@ -2540,14 +2416,92 @@ ${formatNFTTransferEventMetadata(metadata)}`
2540
2416
  }
2541
2417
  };
2542
2418
 
2543
- // src/api/shared/errors/zod-schemas.ts
2544
- var import_v423 = require("zod/v4");
2545
- var ErrorResponseSchema = import_v423.z.object({
2546
- message: import_v423.z.string(),
2547
- details: import_v423.z.optional(import_v423.z.unknown())
2419
+ // src/tokenscope/name-token.ts
2420
+ var NameTokenOwnershipTypes = {
2421
+ /**
2422
+ * Name Token is owned by NameWrapper account.
2423
+ */
2424
+ NameWrapper: "namewrapper",
2425
+ /**
2426
+ * Name Token is owned fully onchain.
2427
+ *
2428
+ * This ownership type can only apply to direct subnames of `.eth`
2429
+ */
2430
+ FullyOnchain: "fully-onchain",
2431
+ /**
2432
+ * Name Token ownership has been transferred to the null address.
2433
+ */
2434
+ Burned: "burned",
2435
+ /**
2436
+ * Name Token ownership is unknown.
2437
+ */
2438
+ Unknown: "unknown"
2439
+ };
2440
+ function serializeNameToken(nameToken) {
2441
+ return {
2442
+ token: serializeAssetId(nameToken.token),
2443
+ ownership: nameToken.ownership,
2444
+ mintStatus: nameToken.mintStatus
2445
+ };
2446
+ }
2447
+ function getNameWrapperAccounts(namespaceId) {
2448
+ const ethnamesNameWrapperAccount = getDatasourceContract(
2449
+ namespaceId,
2450
+ import_datasources6.DatasourceNames.ENSRoot,
2451
+ "NameWrapper"
2452
+ );
2453
+ const lineanamesNameWrapperAccount = maybeGetDatasourceContract(
2454
+ namespaceId,
2455
+ import_datasources6.DatasourceNames.Lineanames,
2456
+ "NameWrapper"
2457
+ );
2458
+ const nameWrapperAccounts = [
2459
+ // NameWrapper for direct subnames of .eth is defined for all ENS namespaces
2460
+ ethnamesNameWrapperAccount
2461
+ ];
2462
+ if (lineanamesNameWrapperAccount) {
2463
+ nameWrapperAccounts.push(lineanamesNameWrapperAccount);
2464
+ }
2465
+ return nameWrapperAccounts;
2466
+ }
2467
+ function getNameTokenOwnership(namespaceId, name, owner) {
2468
+ const nameWrapperAccounts = getNameWrapperAccounts(namespaceId);
2469
+ const hasNameWrapperOwnership = nameWrapperAccounts.some(
2470
+ (nameWrapperAccount) => accountIdEqual(owner, nameWrapperAccount)
2471
+ );
2472
+ if (hasNameWrapperOwnership) {
2473
+ return {
2474
+ ownershipType: NameTokenOwnershipTypes.NameWrapper,
2475
+ owner
2476
+ };
2477
+ }
2478
+ if ((0, import_viem13.isAddressEqual)(owner.address, import_viem13.zeroAddress)) {
2479
+ return {
2480
+ ownershipType: NameTokenOwnershipTypes.Burned,
2481
+ owner
2482
+ };
2483
+ }
2484
+ const parentName = getParentNameFQDN(name);
2485
+ if (parentName === "eth") {
2486
+ return {
2487
+ ownershipType: NameTokenOwnershipTypes.FullyOnchain,
2488
+ owner
2489
+ };
2490
+ }
2491
+ return {
2492
+ ownershipType: NameTokenOwnershipTypes.Unknown,
2493
+ owner
2494
+ };
2495
+ }
2496
+
2497
+ // src/ensapi/api/shared/errors/zod-schemas.ts
2498
+ var import_v418 = require("zod/v4");
2499
+ var ErrorResponseSchema = import_v418.z.object({
2500
+ message: import_v418.z.string(),
2501
+ details: import_v418.z.optional(import_v418.z.unknown())
2548
2502
  });
2549
2503
 
2550
- // src/api/name-tokens/response.ts
2504
+ // src/ensapi/api/name-tokens/response.ts
2551
2505
  var NameTokensResponseCodes = {
2552
2506
  /**
2553
2507
  * Represents a response when Name Tokens API can respond with requested data.
@@ -2582,11 +2536,11 @@ var NameTokensResponseErrorCodes = {
2582
2536
  IndexingStatusUnsupported: "unsupported-indexing-status"
2583
2537
  };
2584
2538
 
2585
- // src/api/name-tokens/zod-schemas.ts
2586
- var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) => import_v424.z.object({
2539
+ // src/ensapi/api/name-tokens/zod-schemas.ts
2540
+ var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) => import_v419.z.object({
2587
2541
  domainId: makeNodeSchema(`${valueLabel}.domainId`),
2588
2542
  name: makeReinterpretedNameSchema(valueLabel),
2589
- tokens: import_v424.z.array(makeNameTokenSchema(`${valueLabel}.tokens`, serializable)).nonempty(),
2543
+ tokens: import_v419.z.array(makeNameTokenSchema(`${valueLabel}.tokens`, serializable)).nonempty(),
2590
2544
  expiresAt: makeUnixTimestampSchema(`${valueLabel}.expiresAt`),
2591
2545
  accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
2592
2546
  }).check(function invariant_nameIsAssociatedWithDomainId(ctx) {
@@ -2628,51 +2582,51 @@ var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", seria
2628
2582
  });
2629
2583
  }
2630
2584
  });
2631
- var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) => import_v424.z.strictObject({
2632
- responseCode: import_v424.z.literal(NameTokensResponseCodes.Ok),
2585
+ var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) => import_v419.z.strictObject({
2586
+ responseCode: import_v419.z.literal(NameTokensResponseCodes.Ok),
2633
2587
  registeredNameTokens: makeRegisteredNameTokenSchema(`${valueLabel}.nameTokens`, serializable)
2634
2588
  });
2635
- var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") => import_v424.z.strictObject({
2636
- responseCode: import_v424.z.literal(NameTokensResponseCodes.Error),
2637
- errorCode: import_v424.z.literal(NameTokensResponseErrorCodes.NameTokensNotIndexed),
2589
+ var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") => import_v419.z.strictObject({
2590
+ responseCode: import_v419.z.literal(NameTokensResponseCodes.Error),
2591
+ errorCode: import_v419.z.literal(NameTokensResponseErrorCodes.NameTokensNotIndexed),
2638
2592
  error: ErrorResponseSchema
2639
2593
  });
2640
- var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") => import_v424.z.strictObject({
2641
- responseCode: import_v424.z.literal(NameTokensResponseCodes.Error),
2642
- errorCode: import_v424.z.literal(NameTokensResponseErrorCodes.EnsIndexerConfigUnsupported),
2594
+ var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") => import_v419.z.strictObject({
2595
+ responseCode: import_v419.z.literal(NameTokensResponseCodes.Error),
2596
+ errorCode: import_v419.z.literal(NameTokensResponseErrorCodes.EnsIndexerConfigUnsupported),
2643
2597
  error: ErrorResponseSchema
2644
2598
  });
2645
- var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") => import_v424.z.strictObject({
2646
- responseCode: import_v424.z.literal(NameTokensResponseCodes.Error),
2647
- errorCode: import_v424.z.literal(NameTokensResponseErrorCodes.IndexingStatusUnsupported),
2599
+ var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") => import_v419.z.strictObject({
2600
+ responseCode: import_v419.z.literal(NameTokensResponseCodes.Error),
2601
+ errorCode: import_v419.z.literal(NameTokensResponseErrorCodes.IndexingStatusUnsupported),
2648
2602
  error: ErrorResponseSchema
2649
2603
  });
2650
- var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") => import_v424.z.discriminatedUnion("errorCode", [
2604
+ var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") => import_v419.z.discriminatedUnion("errorCode", [
2651
2605
  makeNameTokensResponseErrorNameTokensNotIndexedSchema(valueLabel),
2652
2606
  makeNameTokensResponseErrorEnsIndexerConfigUnsupported(valueLabel),
2653
2607
  makeNameTokensResponseErrorNameIndexingStatusUnsupported(valueLabel)
2654
2608
  ]);
2655
2609
  var makeNameTokensResponseSchema = (valueLabel = "Name Tokens Response", serializable) => {
2656
- return import_v424.z.discriminatedUnion("responseCode", [
2610
+ return import_v419.z.discriminatedUnion("responseCode", [
2657
2611
  makeNameTokensResponseOkSchema(valueLabel, serializable ?? false),
2658
2612
  makeNameTokensResponseErrorSchema(valueLabel)
2659
2613
  ]);
2660
2614
  };
2661
2615
 
2662
- // src/api/name-tokens/deserialize.ts
2616
+ // src/ensapi/api/name-tokens/deserialize.ts
2663
2617
  function deserializedNameTokensResponse(maybeResponse) {
2664
2618
  const parsed = makeNameTokensResponseSchema("Name Tokens Response", false).safeParse(
2665
2619
  maybeResponse
2666
2620
  );
2667
2621
  if (parsed.error) {
2668
2622
  throw new Error(`Cannot deserialize NameTokensResponse:
2669
- ${(0, import_v425.prettifyError)(parsed.error)}
2623
+ ${(0, import_v420.prettifyError)(parsed.error)}
2670
2624
  `);
2671
2625
  }
2672
2626
  return parsed.data;
2673
2627
  }
2674
2628
 
2675
- // src/api/name-tokens/prerequisites.ts
2629
+ // src/ensapi/api/name-tokens/prerequisites.ts
2676
2630
  var nameTokensPrerequisites = Object.freeze({
2677
2631
  /**
2678
2632
  * Required plugins to enable Name Tokens API routes.
@@ -2711,7 +2665,7 @@ var nameTokensPrerequisites = Object.freeze({
2711
2665
  }
2712
2666
  });
2713
2667
 
2714
- // src/api/name-tokens/serialize.ts
2668
+ // src/ensapi/api/name-tokens/serialize.ts
2715
2669
  function serializeRegisteredNameTokens({
2716
2670
  domainId,
2717
2671
  name,
@@ -2739,15 +2693,15 @@ function serializeNameTokensResponse(response) {
2739
2693
  }
2740
2694
  }
2741
2695
 
2742
- // src/api/registrar-actions/deserialize.ts
2743
- var import_v429 = require("zod/v4");
2696
+ // src/ensapi/api/registrar-actions/deserialize.ts
2697
+ var import_v424 = require("zod/v4");
2744
2698
 
2745
- // src/api/registrar-actions/zod-schemas.ts
2699
+ // src/ensapi/api/registrar-actions/zod-schemas.ts
2746
2700
  var import_ens7 = require("viem/ens");
2747
- var import_v428 = require("zod/v4");
2701
+ var import_v423 = require("zod/v4");
2748
2702
 
2749
2703
  // src/registrars/zod-schemas.ts
2750
- var import_v426 = require("zod/v4");
2704
+ var import_v421 = require("zod/v4");
2751
2705
 
2752
2706
  // src/registrars/encoded-referrer.ts
2753
2707
  var import_viem15 = require("viem");
@@ -2822,11 +2776,11 @@ function serializeRegistrarAction(registrarAction) {
2822
2776
  }
2823
2777
 
2824
2778
  // src/registrars/zod-schemas.ts
2825
- var makeSubregistrySchema = (valueLabel = "Subregistry") => import_v426.z.object({
2779
+ var makeSubregistrySchema = (valueLabel = "Subregistry") => import_v421.z.object({
2826
2780
  subregistryId: makeAccountIdSchema(`${valueLabel} Subregistry ID`),
2827
2781
  node: makeNodeSchema(`${valueLabel} Node`)
2828
2782
  });
2829
- var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") => import_v426.z.object({
2783
+ var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") => import_v421.z.object({
2830
2784
  subregistry: makeSubregistrySchema(`${valueLabel} Subregistry`),
2831
2785
  node: makeNodeSchema(`${valueLabel} Node`),
2832
2786
  expiresAt: makeUnixTimestampSchema(`${valueLabel} Expires at`)
@@ -2842,18 +2796,18 @@ function invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium(ctx) {
2842
2796
  });
2843
2797
  }
2844
2798
  }
2845
- var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") => import_v426.z.union([
2799
+ var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") => import_v421.z.union([
2846
2800
  // pricing available
2847
- import_v426.z.object({
2801
+ import_v421.z.object({
2848
2802
  baseCost: makePriceEthSchema(`${valueLabel} Base Cost`),
2849
2803
  premium: makePriceEthSchema(`${valueLabel} Premium`),
2850
2804
  total: makePriceEthSchema(`${valueLabel} Total`)
2851
2805
  }).check(invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium).transform((v) => v),
2852
2806
  // pricing unknown
2853
- import_v426.z.object({
2854
- baseCost: import_v426.z.null(),
2855
- premium: import_v426.z.null(),
2856
- total: import_v426.z.null()
2807
+ import_v421.z.object({
2808
+ baseCost: import_v421.z.null(),
2809
+ premium: import_v421.z.null(),
2810
+ total: import_v421.z.null()
2857
2811
  }).transform((v) => v)
2858
2812
  ]);
2859
2813
  function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
@@ -2876,9 +2830,9 @@ function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
2876
2830
  });
2877
2831
  }
2878
2832
  }
2879
- var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") => import_v426.z.union([
2833
+ var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") => import_v421.z.union([
2880
2834
  // referral available
2881
- import_v426.z.object({
2835
+ import_v421.z.object({
2882
2836
  encodedReferrer: makeHexStringSchema(
2883
2837
  { bytesCount: ENCODED_REFERRER_BYTE_LENGTH },
2884
2838
  `${valueLabel} Encoded Referrer`
@@ -2886,9 +2840,9 @@ var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral
2886
2840
  decodedReferrer: makeLowercaseAddressSchema(`${valueLabel} Decoded Referrer`)
2887
2841
  }).check(invariant_registrarActionDecodedReferrerBasedOnRawReferrer),
2888
2842
  // referral not applicable
2889
- import_v426.z.object({
2890
- encodedReferrer: import_v426.z.null(),
2891
- decodedReferrer: import_v426.z.null()
2843
+ import_v421.z.object({
2844
+ encodedReferrer: import_v421.z.null(),
2845
+ decodedReferrer: import_v421.z.null()
2892
2846
  })
2893
2847
  ]);
2894
2848
  function invariant_eventIdsInitialElementIsTheActionId(ctx) {
@@ -2901,9 +2855,9 @@ function invariant_eventIdsInitialElementIsTheActionId(ctx) {
2901
2855
  });
2902
2856
  }
2903
2857
  }
2904
- var EventIdSchema = import_v426.z.string().nonempty();
2905
- var EventIdsSchema = import_v426.z.array(EventIdSchema).min(1).transform((v) => v);
2906
- var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => import_v426.z.object({
2858
+ var EventIdSchema = import_v421.z.string().nonempty();
2859
+ var EventIdsSchema = import_v421.z.array(EventIdSchema).min(1).transform((v) => v);
2860
+ var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => import_v421.z.object({
2907
2861
  id: EventIdSchema,
2908
2862
  incrementalDuration: makeDurationSchema(`${valueLabel} Incremental Duration`),
2909
2863
  registrant: makeLowercaseAddressSchema(`${valueLabel} Registrant`),
@@ -2917,38 +2871,38 @@ var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => im
2917
2871
  eventIds: EventIdsSchema
2918
2872
  }).check(invariant_eventIdsInitialElementIsTheActionId);
2919
2873
  var makeRegistrarActionRegistrationSchema = (valueLabel = "Registration ") => makeBaseRegistrarActionSchema(valueLabel).extend({
2920
- type: import_v426.z.literal(RegistrarActionTypes.Registration)
2874
+ type: import_v421.z.literal(RegistrarActionTypes.Registration)
2921
2875
  });
2922
2876
  var makeRegistrarActionRenewalSchema = (valueLabel = "Renewal") => makeBaseRegistrarActionSchema(valueLabel).extend({
2923
- type: import_v426.z.literal(RegistrarActionTypes.Renewal)
2877
+ type: import_v421.z.literal(RegistrarActionTypes.Renewal)
2924
2878
  });
2925
- var makeRegistrarActionSchema = (valueLabel = "Registrar Action") => import_v426.z.discriminatedUnion("type", [
2879
+ var makeRegistrarActionSchema = (valueLabel = "Registrar Action") => import_v421.z.discriminatedUnion("type", [
2926
2880
  makeRegistrarActionRegistrationSchema(`${valueLabel} Registration`),
2927
2881
  makeRegistrarActionRenewalSchema(`${valueLabel} Renewal`)
2928
2882
  ]);
2929
2883
 
2930
- // src/api/shared/pagination/zod-schemas.ts
2931
- var import_v427 = require("zod/v4");
2884
+ // src/ensapi/api/shared/pagination/zod-schemas.ts
2885
+ var import_v422 = require("zod/v4");
2932
2886
 
2933
- // src/api/shared/pagination/request.ts
2887
+ // src/ensapi/api/shared/pagination/request.ts
2934
2888
  var RECORDS_PER_PAGE_DEFAULT = 10;
2935
2889
  var RECORDS_PER_PAGE_MAX = 100;
2936
2890
 
2937
- // src/api/shared/pagination/zod-schemas.ts
2938
- var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") => import_v427.z.object({
2891
+ // src/ensapi/api/shared/pagination/zod-schemas.ts
2892
+ var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") => import_v422.z.object({
2939
2893
  page: makePositiveIntegerSchema(`${valueLabel}.page`),
2940
2894
  recordsPerPage: makePositiveIntegerSchema(`${valueLabel}.recordsPerPage`).max(
2941
2895
  RECORDS_PER_PAGE_MAX,
2942
2896
  `${valueLabel}.recordsPerPage must not exceed ${RECORDS_PER_PAGE_MAX}`
2943
2897
  )
2944
2898
  });
2945
- var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") => import_v427.z.object({
2946
- totalRecords: import_v427.z.literal(0),
2947
- totalPages: import_v427.z.literal(1),
2948
- hasNext: import_v427.z.literal(false),
2949
- hasPrev: import_v427.z.literal(false),
2950
- startIndex: import_v427.z.undefined(),
2951
- endIndex: import_v427.z.undefined()
2899
+ var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") => import_v422.z.object({
2900
+ totalRecords: import_v422.z.literal(0),
2901
+ totalPages: import_v422.z.literal(1),
2902
+ hasNext: import_v422.z.literal(false),
2903
+ hasPrev: import_v422.z.literal(false),
2904
+ startIndex: import_v422.z.undefined(),
2905
+ endIndex: import_v422.z.undefined()
2952
2906
  }).extend(makeRequestPageParamsSchema(valueLabel).shape);
2953
2907
  function invariant_responsePageWithRecordsIsCorrect(ctx) {
2954
2908
  const { hasNext, hasPrev, recordsPerPage, page, totalRecords, startIndex, endIndex } = ctx.value;
@@ -2983,20 +2937,20 @@ function invariant_responsePageWithRecordsIsCorrect(ctx) {
2983
2937
  });
2984
2938
  }
2985
2939
  }
2986
- var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") => import_v427.z.object({
2940
+ var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") => import_v422.z.object({
2987
2941
  totalRecords: makePositiveIntegerSchema(`${valueLabel}.totalRecords`),
2988
2942
  totalPages: makePositiveIntegerSchema(`${valueLabel}.totalPages`),
2989
- hasNext: import_v427.z.boolean(),
2990
- hasPrev: import_v427.z.boolean(),
2943
+ hasNext: import_v422.z.boolean(),
2944
+ hasPrev: import_v422.z.boolean(),
2991
2945
  startIndex: makeNonNegativeIntegerSchema(`${valueLabel}.startIndex`),
2992
2946
  endIndex: makeNonNegativeIntegerSchema(`${valueLabel}.endIndex`)
2993
2947
  }).extend(makeRequestPageParamsSchema(valueLabel).shape).check(invariant_responsePageWithRecordsIsCorrect);
2994
- var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") => import_v427.z.union([
2948
+ var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") => import_v422.z.union([
2995
2949
  makeResponsePageContextSchemaWithNoRecords(valueLabel),
2996
2950
  makeResponsePageContextSchemaWithRecords(valueLabel)
2997
2951
  ]);
2998
2952
 
2999
- // src/api/registrar-actions/response.ts
2953
+ // src/ensapi/api/registrar-actions/response.ts
3000
2954
  var RegistrarActionsResponseCodes = {
3001
2955
  /**
3002
2956
  * Represents that Registrar Actions are available.
@@ -3008,7 +2962,7 @@ var RegistrarActionsResponseCodes = {
3008
2962
  Error: "error"
3009
2963
  };
3010
2964
 
3011
- // src/api/registrar-actions/zod-schemas.ts
2965
+ // src/ensapi/api/registrar-actions/zod-schemas.ts
3012
2966
  function invariant_registrationLifecycleNodeMatchesName(ctx) {
3013
2967
  const { name, action } = ctx.value;
3014
2968
  const expectedNode = action.registrationLifecycle.node;
@@ -3021,39 +2975,39 @@ function invariant_registrationLifecycleNodeMatchesName(ctx) {
3021
2975
  });
3022
2976
  }
3023
2977
  }
3024
- var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") => import_v428.z.object({
2978
+ var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") => import_v423.z.object({
3025
2979
  action: makeRegistrarActionSchema(valueLabel),
3026
2980
  name: makeReinterpretedNameSchema(valueLabel)
3027
2981
  }).check(invariant_registrationLifecycleNodeMatchesName);
3028
- var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") => import_v428.z.object({
3029
- responseCode: import_v428.z.literal(RegistrarActionsResponseCodes.Ok),
3030
- registrarActions: import_v428.z.array(makeNamedRegistrarActionSchema(valueLabel)),
2982
+ var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") => import_v423.z.object({
2983
+ responseCode: import_v423.z.literal(RegistrarActionsResponseCodes.Ok),
2984
+ registrarActions: import_v423.z.array(makeNamedRegistrarActionSchema(valueLabel)),
3031
2985
  pageContext: makeResponsePageContextSchema(`${valueLabel}.pageContext`),
3032
2986
  accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`).optional()
3033
2987
  });
3034
- var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") => import_v428.z.strictObject({
3035
- responseCode: import_v428.z.literal(RegistrarActionsResponseCodes.Error),
2988
+ var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") => import_v423.z.strictObject({
2989
+ responseCode: import_v423.z.literal(RegistrarActionsResponseCodes.Error),
3036
2990
  error: ErrorResponseSchema
3037
2991
  });
3038
- var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") => import_v428.z.discriminatedUnion("responseCode", [
2992
+ var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") => import_v423.z.discriminatedUnion("responseCode", [
3039
2993
  makeRegistrarActionsResponseOkSchema(valueLabel),
3040
2994
  makeRegistrarActionsResponseErrorSchema(valueLabel)
3041
2995
  ]);
3042
2996
 
3043
- // src/api/registrar-actions/deserialize.ts
2997
+ // src/ensapi/api/registrar-actions/deserialize.ts
3044
2998
  function deserializeRegistrarActionsResponse(maybeResponse) {
3045
2999
  const parsed = makeRegistrarActionsResponseSchema().safeParse(maybeResponse);
3046
3000
  if (parsed.error) {
3047
3001
  throw new Error(
3048
3002
  `Cannot deserialize RegistrarActionsResponse:
3049
- ${(0, import_v429.prettifyError)(parsed.error)}
3003
+ ${(0, import_v424.prettifyError)(parsed.error)}
3050
3004
  `
3051
3005
  );
3052
3006
  }
3053
3007
  return parsed.data;
3054
3008
  }
3055
3009
 
3056
- // src/api/registrar-actions/request.ts
3010
+ // src/ensapi/api/registrar-actions/request.ts
3057
3011
  var RegistrarActionsFilterTypes = {
3058
3012
  BySubregistryNode: "bySubregistryNode",
3059
3013
  WithEncodedReferral: "withEncodedReferral",
@@ -3065,7 +3019,7 @@ var RegistrarActionsOrders = {
3065
3019
  LatestRegistrarActions: "orderBy[timestamp]=desc"
3066
3020
  };
3067
3021
 
3068
- // src/api/registrar-actions/filters.ts
3022
+ // src/ensapi/api/registrar-actions/filters.ts
3069
3023
  function byParentNode(parentNode) {
3070
3024
  if (typeof parentNode === "undefined") {
3071
3025
  return void 0;
@@ -3102,174 +3056,73 @@ function beginTimestamp(timestamp) {
3102
3056
  };
3103
3057
  }
3104
3058
  function endTimestamp(timestamp) {
3105
- if (typeof timestamp === "undefined") {
3106
- return void 0;
3107
- }
3108
- return {
3109
- filterType: RegistrarActionsFilterTypes.EndTimestamp,
3110
- value: timestamp
3111
- };
3112
- }
3113
- var registrarActionsFilter = {
3114
- byParentNode,
3115
- withReferral,
3116
- byDecodedReferrer,
3117
- beginTimestamp,
3118
- endTimestamp
3119
- };
3120
-
3121
- // src/api/registrar-actions/prerequisites.ts
3122
- var registrarActionsPrerequisites = Object.freeze({
3123
- /**
3124
- * Required plugins to enable Registrar Actions API routes.
3125
- *
3126
- * 1. `registrars` plugin is required so that data in the `registrarActions`
3127
- * table is populated.
3128
- * 2. `subgraph`, `basenames`, and `lineanames` are required to get the data
3129
- * for the name associated with each registrar action.
3130
- * 3. In theory not all of `subgraph`, `basenames`, and `lineanames` plugins
3131
- * might be required. Ex: At least one, but the current logic in
3132
- * the `registrars` plugin always indexes registrar actions across
3133
- * Ethnames (subgraph), Basenames, and Lineanames and therefore we need to
3134
- * ensure each value in the registrar actions table has
3135
- * an associated record in the domains table.
3136
- */
3137
- requiredPlugins: [
3138
- "subgraph" /* Subgraph */,
3139
- "basenames" /* Basenames */,
3140
- "lineanames" /* Lineanames */,
3141
- "registrars" /* Registrars */
3142
- ],
3143
- /**
3144
- * Check if provided ENSApiPublicConfig supports the Registrar Actions API.
3145
- */
3146
- hasEnsIndexerConfigSupport(config) {
3147
- return registrarActionsPrerequisites.requiredPlugins.every(
3148
- (plugin) => config.plugins.includes(plugin)
3149
- );
3150
- },
3151
- /**
3152
- * Required Indexing Status IDs
3153
- *
3154
- * Database indexes are created by the time the omnichain indexing status
3155
- * is either `completed` or `following`.
3156
- */
3157
- supportedIndexingStatusIds: [
3158
- OmnichainIndexingStatusIds.Completed,
3159
- OmnichainIndexingStatusIds.Following
3160
- ],
3161
- /**
3162
- * Check if provided indexing status supports the Registrar Actions API.
3163
- */
3164
- hasIndexingStatusSupport(omnichainIndexingStatusId) {
3165
- return registrarActionsPrerequisites.supportedIndexingStatusIds.some(
3166
- (supportedIndexingStatusId) => supportedIndexingStatusId === omnichainIndexingStatusId
3167
- );
3168
- }
3169
- });
3170
-
3171
- // src/registrars/basenames-subregistry.ts
3172
- var import_datasources6 = require("@ensnode/datasources");
3173
- function getBasenamesSubregistryId(namespace) {
3174
- const datasource = (0, import_datasources6.maybeGetDatasource)(namespace, import_datasources6.DatasourceNames.Basenames);
3175
- if (!datasource) {
3176
- throw new Error(`Datasource not found for ${namespace} ${import_datasources6.DatasourceNames.Basenames}`);
3177
- }
3178
- const address = datasource.contracts.BaseRegistrar?.address;
3179
- if (address === void 0 || Array.isArray(address)) {
3180
- throw new Error(`BaseRegistrar contract not found or has multiple addresses for ${namespace}`);
3181
- }
3182
- return {
3183
- chainId: datasource.chain.id,
3184
- address
3185
- };
3186
- }
3187
- function getBasenamesSubregistryManagedName(namespaceId) {
3188
- switch (namespaceId) {
3189
- case import_datasources6.ENSNamespaceIds.Mainnet:
3190
- return "base.eth";
3191
- case import_datasources6.ENSNamespaceIds.Sepolia:
3192
- case import_datasources6.ENSNamespaceIds.SepoliaV2:
3193
- return "basetest.eth";
3194
- case import_datasources6.ENSNamespaceIds.EnsTestEnv:
3195
- throw new Error(
3196
- `No registrar managed name is known for the 'basenames' subregistry within the "${namespaceId}" namespace.`
3197
- );
3198
- }
3199
- }
3200
-
3201
- // src/registrars/ethnames-subregistry.ts
3202
- var import_datasources7 = require("@ensnode/datasources");
3203
- function getEthnamesSubregistryId(namespace) {
3204
- const datasource = (0, import_datasources7.maybeGetDatasource)(namespace, import_datasources7.DatasourceNames.ENSRoot);
3205
- if (!datasource) {
3206
- throw new Error(`Datasource not found for ${namespace} ${import_datasources7.DatasourceNames.ENSRoot}`);
3207
- }
3208
- const address = datasource.contracts.BaseRegistrar?.address;
3209
- if (address === void 0 || Array.isArray(address)) {
3210
- throw new Error(`BaseRegistrar contract not found or has multiple addresses for ${namespace}`);
3211
- }
3212
- return {
3213
- chainId: datasource.chain.id,
3214
- address
3215
- };
3216
- }
3217
- function getEthnamesSubregistryManagedName(namespaceId) {
3218
- switch (namespaceId) {
3219
- case import_datasources7.ENSNamespaceIds.Mainnet:
3220
- case import_datasources7.ENSNamespaceIds.Sepolia:
3221
- case import_datasources7.ENSNamespaceIds.SepoliaV2:
3222
- case import_datasources7.ENSNamespaceIds.EnsTestEnv:
3223
- return "eth";
3224
- }
3225
- }
3226
-
3227
- // src/registrars/lineanames-subregistry.ts
3228
- var import_datasources8 = require("@ensnode/datasources");
3229
- function getLineanamesSubregistryId(namespace) {
3230
- const datasource = (0, import_datasources8.maybeGetDatasource)(namespace, import_datasources8.DatasourceNames.Lineanames);
3231
- if (!datasource) {
3232
- throw new Error(`Datasource not found for ${namespace} ${import_datasources8.DatasourceNames.Lineanames}`);
3233
- }
3234
- const address = datasource.contracts.BaseRegistrar?.address;
3235
- if (address === void 0 || Array.isArray(address)) {
3236
- throw new Error(`BaseRegistrar contract not found or has multiple addresses for ${namespace}`);
3237
- }
3238
- return {
3239
- chainId: datasource.chain.id,
3240
- address
3241
- };
3242
- }
3243
- function getLineanamesSubregistryManagedName(namespaceId) {
3244
- switch (namespaceId) {
3245
- case import_datasources8.ENSNamespaceIds.Mainnet:
3246
- return "linea.eth";
3247
- case import_datasources8.ENSNamespaceIds.Sepolia:
3248
- case import_datasources8.ENSNamespaceIds.SepoliaV2:
3249
- return "linea-sepolia.eth";
3250
- case import_datasources8.ENSNamespaceIds.EnsTestEnv:
3251
- throw new Error(
3252
- `No registrar managed name is known for the 'Lineanames' subregistry within the "${namespaceId}" namespace.`
3253
- );
3254
- }
3255
- }
3256
-
3257
- // src/registrars/registration-expiration.ts
3258
- function isRegistrationExpired(info, now) {
3259
- if (info.expiry == null) return false;
3260
- return info.expiry <= now;
3261
- }
3262
- function isRegistrationFullyExpired(info, now) {
3263
- if (info.expiry == null) return false;
3264
- return now >= info.expiry + (info.gracePeriod ?? 0n);
3265
- }
3266
- function isRegistrationInGracePeriod(info, now) {
3267
- if (info.expiry == null) return false;
3268
- if (info.gracePeriod == null) return false;
3269
- return info.expiry <= now && info.expiry + info.gracePeriod > now;
3059
+ if (typeof timestamp === "undefined") {
3060
+ return void 0;
3061
+ }
3062
+ return {
3063
+ filterType: RegistrarActionsFilterTypes.EndTimestamp,
3064
+ value: timestamp
3065
+ };
3270
3066
  }
3067
+ var registrarActionsFilter = {
3068
+ byParentNode,
3069
+ withReferral,
3070
+ byDecodedReferrer,
3071
+ beginTimestamp,
3072
+ endTimestamp
3073
+ };
3074
+
3075
+ // src/ensapi/api/registrar-actions/prerequisites.ts
3076
+ var registrarActionsPrerequisites = Object.freeze({
3077
+ /**
3078
+ * Required plugins to enable Registrar Actions API routes.
3079
+ *
3080
+ * 1. `registrars` plugin is required so that data in the `registrarActions`
3081
+ * table is populated.
3082
+ * 2. `subgraph`, `basenames`, and `lineanames` are required to get the data
3083
+ * for the name associated with each registrar action.
3084
+ * 3. In theory not all of `subgraph`, `basenames`, and `lineanames` plugins
3085
+ * might be required. Ex: At least one, but the current logic in
3086
+ * the `registrars` plugin always indexes registrar actions across
3087
+ * Ethnames (subgraph), Basenames, and Lineanames and therefore we need to
3088
+ * ensure each value in the registrar actions table has
3089
+ * an associated record in the domains table.
3090
+ */
3091
+ requiredPlugins: [
3092
+ "subgraph" /* Subgraph */,
3093
+ "basenames" /* Basenames */,
3094
+ "lineanames" /* Lineanames */,
3095
+ "registrars" /* Registrars */
3096
+ ],
3097
+ /**
3098
+ * Check if provided ENSApiPublicConfig supports the Registrar Actions API.
3099
+ */
3100
+ hasEnsIndexerConfigSupport(config) {
3101
+ return registrarActionsPrerequisites.requiredPlugins.every(
3102
+ (plugin) => config.plugins.includes(plugin)
3103
+ );
3104
+ },
3105
+ /**
3106
+ * Required Indexing Status IDs
3107
+ *
3108
+ * Database indexes are created by the time the omnichain indexing status
3109
+ * is either `completed` or `following`.
3110
+ */
3111
+ supportedIndexingStatusIds: [
3112
+ OmnichainIndexingStatusIds.Completed,
3113
+ OmnichainIndexingStatusIds.Following
3114
+ ],
3115
+ /**
3116
+ * Check if provided indexing status supports the Registrar Actions API.
3117
+ */
3118
+ hasIndexingStatusSupport(omnichainIndexingStatusId) {
3119
+ return registrarActionsPrerequisites.supportedIndexingStatusIds.some(
3120
+ (supportedIndexingStatusId) => supportedIndexingStatusId === omnichainIndexingStatusId
3121
+ );
3122
+ }
3123
+ });
3271
3124
 
3272
- // src/api/registrar-actions/serialize.ts
3125
+ // src/ensapi/api/registrar-actions/serialize.ts
3273
3126
  function serializeNamedRegistrarAction({
3274
3127
  action,
3275
3128
  name
@@ -3293,19 +3146,19 @@ function serializeRegistrarActionsResponse(response) {
3293
3146
  }
3294
3147
  }
3295
3148
 
3296
- // src/api/shared/errors/deserialize.ts
3297
- var import_v430 = require("zod/v4");
3149
+ // src/ensapi/api/shared/errors/deserialize.ts
3150
+ var import_v425 = require("zod/v4");
3298
3151
  function deserializeErrorResponse(maybeErrorResponse) {
3299
3152
  const parsed = ErrorResponseSchema.safeParse(maybeErrorResponse);
3300
3153
  if (parsed.error) {
3301
3154
  throw new Error(`Cannot deserialize ErrorResponse:
3302
- ${(0, import_v430.prettifyError)(parsed.error)}
3155
+ ${(0, import_v425.prettifyError)(parsed.error)}
3303
3156
  `);
3304
3157
  }
3305
3158
  return parsed.data;
3306
3159
  }
3307
3160
 
3308
- // src/api/shared/pagination/build-page-context.ts
3161
+ // src/ensapi/api/shared/pagination/build-page-context.ts
3309
3162
  function buildPageContext(page, recordsPerPage, totalRecords) {
3310
3163
  const totalPages = Math.max(1, Math.ceil(totalRecords / recordsPerPage));
3311
3164
  if (page > totalPages) {
@@ -3340,37 +3193,6 @@ function buildPageContext(page, recordsPerPage, totalRecords) {
3340
3193
  };
3341
3194
  }
3342
3195
 
3343
- // src/client-error.ts
3344
- var ClientError = class _ClientError extends Error {
3345
- details;
3346
- constructor(message, details) {
3347
- super(message);
3348
- this.name = "ClientError";
3349
- this.details = details;
3350
- }
3351
- static fromErrorResponse({ message, details }) {
3352
- return new _ClientError(message, details);
3353
- }
3354
- };
3355
-
3356
- // src/deployments.ts
3357
- var import_datasources9 = require("@ensnode/datasources");
3358
- var DEFAULT_ENSNODE_API_URL_MAINNET = "https://api.alpha.ensnode.io";
3359
- var DEFAULT_ENSNODE_API_URL_SEPOLIA = "https://api.alpha-sepolia.ensnode.io";
3360
- var getDefaultEnsNodeUrl = (namespace) => {
3361
- const effectiveNamespace = namespace ?? import_datasources9.ENSNamespaceIds.Mainnet;
3362
- switch (effectiveNamespace) {
3363
- case import_datasources9.ENSNamespaceIds.Mainnet:
3364
- return new URL(DEFAULT_ENSNODE_API_URL_MAINNET);
3365
- case import_datasources9.ENSNamespaceIds.Sepolia:
3366
- return new URL(DEFAULT_ENSNODE_API_URL_SEPOLIA);
3367
- default:
3368
- throw new Error(
3369
- `ENSNamespaceId ${effectiveNamespace} does not have a default ENSNode URL defined`
3370
- );
3371
- }
3372
- };
3373
-
3374
3196
  // src/client.ts
3375
3197
  var ENSNodeClient = class _ENSNodeClient {
3376
3198
  options;
@@ -3863,7 +3685,7 @@ var makeLatestRenewalId = (domainId, registrationIndex) => `${makeRegistrationId
3863
3685
  var makeRenewalId = (domainId, registrationIndex, index = 0) => `${makeRegistrationId(domainId, registrationIndex)}/${index}`;
3864
3686
 
3865
3687
  // src/identity/identity.ts
3866
- var import_datasources10 = require("@ensnode/datasources");
3688
+ var import_datasources7 = require("@ensnode/datasources");
3867
3689
 
3868
3690
  // src/identity/types.ts
3869
3691
  var ResolutionStatusIds = {
@@ -3890,7 +3712,7 @@ var ResolutionStatusIds = {
3890
3712
  function buildUnresolvedIdentity(address, namespaceId, chainId) {
3891
3713
  return {
3892
3714
  resolutionStatus: ResolutionStatusIds.Unresolved,
3893
- chainId: chainId ?? (0, import_datasources10.getENSRootChainId)(namespaceId),
3715
+ chainId: chainId ?? (0, import_datasources7.getENSRootChainId)(namespaceId),
3894
3716
  address
3895
3717
  };
3896
3718
  }
@@ -3898,6 +3720,184 @@ function isResolvedIdentity(identity) {
3898
3720
  return identity.resolutionStatus !== ResolutionStatusIds.Unresolved;
3899
3721
  }
3900
3722
 
3723
+ // src/indexing-status/deserialize/chain-indexing-status-snapshot.ts
3724
+ var import_v426 = require("zod/v4");
3725
+ function deserializeChainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
3726
+ const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
3727
+ const parsed = schema.safeParse(maybeSnapshot);
3728
+ if (parsed.error) {
3729
+ throw new Error(
3730
+ `Cannot deserialize into ChainIndexingStatusSnapshot:
3731
+ ${(0, import_v426.prettifyError)(parsed.error)}
3732
+ `
3733
+ );
3734
+ }
3735
+ return parsed.data;
3736
+ }
3737
+
3738
+ // src/indexing-status/realtime-indexing-status-projection.ts
3739
+ function createRealtimeIndexingStatusProjection(snapshot, now) {
3740
+ const projectedAt = Math.max(now, snapshot.snapshotTime);
3741
+ return {
3742
+ projectedAt,
3743
+ worstCaseDistance: projectedAt - snapshot.slowestChainIndexingCursor,
3744
+ snapshot
3745
+ };
3746
+ }
3747
+
3748
+ // src/indexing-status/validate/chain-indexing-status-snapshot.ts
3749
+ var import_v427 = require("zod/v4");
3750
+ function validateChainIndexingStatusSnapshot(unvalidatedSnapshot, valueLabel) {
3751
+ const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
3752
+ const parsed = schema.safeParse(unvalidatedSnapshot);
3753
+ if (parsed.error) {
3754
+ throw new Error(`Invalid ChainIndexingStatusSnapshot:
3755
+ ${(0, import_v427.prettifyError)(parsed.error)}
3756
+ `);
3757
+ }
3758
+ return parsed.data;
3759
+ }
3760
+
3761
+ // src/indexing-status/validate/cross-chain-indexing-status-snapshot.ts
3762
+ var import_v428 = require("zod/v4");
3763
+ function validateCrossChainIndexingStatusSnapshot(unvalidatedSnapshot, valueLabel) {
3764
+ const schema = makeCrossChainIndexingStatusSnapshotSchema(valueLabel);
3765
+ const parsed = schema.safeParse(unvalidatedSnapshot);
3766
+ if (parsed.error) {
3767
+ throw new Error(`Invalid CrossChainIndexingStatusSnapshot:
3768
+ ${(0, import_v428.prettifyError)(parsed.error)}
3769
+ `);
3770
+ }
3771
+ return parsed.data;
3772
+ }
3773
+
3774
+ // src/indexing-status/validate/omnichain-indexing-status-snapshot.ts
3775
+ var import_v429 = require("zod/v4");
3776
+ function validateOmnichainIndexingStatusSnapshot(unvalidatedSnapshot, valueLabel) {
3777
+ const schema = makeOmnichainIndexingStatusSnapshotSchema(valueLabel);
3778
+ const parsed = schema.safeParse(unvalidatedSnapshot);
3779
+ if (parsed.error) {
3780
+ throw new Error(`Invalid OmnichainIndexingStatusSnapshot:
3781
+ ${(0, import_v429.prettifyError)(parsed.error)}
3782
+ `);
3783
+ }
3784
+ return parsed.data;
3785
+ }
3786
+
3787
+ // src/indexing-status/validate/realtime-indexing-status-projection.ts
3788
+ var import_v430 = require("zod/v4");
3789
+ function validateRealtimeIndexingStatusProjection(unvalidatedProjection, valueLabel) {
3790
+ const schema = makeRealtimeIndexingStatusProjectionSchema(valueLabel);
3791
+ const parsed = schema.safeParse(unvalidatedProjection);
3792
+ if (parsed.error) {
3793
+ throw new Error(`Invalid RealtimeIndexingStatusProjection:
3794
+ ${(0, import_v430.prettifyError)(parsed.error)}
3795
+ `);
3796
+ }
3797
+ return parsed.data;
3798
+ }
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
+
3901
3901
  // src/resolution/ensip19-chainid.ts
3902
3902
  var import_chains = require("viem/chains");
3903
3903
  var import_datasources11 = require("@ensnode/datasources");