@ensnode/ensnode-sdk 0.0.0-next-20260211153531 → 0.0.0-next-20260216074158
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 +370 -354
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +119 -120
- package/dist/index.d.ts +119 -120
- package/dist/index.js +360 -354
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
@@ -230,7 +240,6 @@ __export(index_exports, {
|
|
|
230
240
|
serializeChainId: () => serializeChainId,
|
|
231
241
|
serializeChainIndexingSnapshots: () => serializeChainIndexingSnapshots,
|
|
232
242
|
serializeConfigResponse: () => serializeConfigResponse,
|
|
233
|
-
serializeCrossChainIndexingStatusSnapshotOmnichain: () => serializeCrossChainIndexingStatusSnapshotOmnichain,
|
|
234
243
|
serializeDatetime: () => serializeDatetime,
|
|
235
244
|
serializeDomainAssetId: () => serializeDomainAssetId,
|
|
236
245
|
serializeENSApiPublicConfig: () => serializeENSApiPublicConfig,
|
|
@@ -652,7 +661,7 @@ var makePositiveIntegerSchema = (valueLabel = "Value") => makeIntegerSchema(valu
|
|
|
652
661
|
var makeNonNegativeIntegerSchema = (valueLabel = "Value") => makeIntegerSchema(valueLabel).nonnegative({
|
|
653
662
|
error: `${valueLabel} must be a non-negative integer (>=0).`
|
|
654
663
|
});
|
|
655
|
-
var makeDurationSchema = (valueLabel = "Value") => import_v4.z.
|
|
664
|
+
var makeDurationSchema = (valueLabel = "Value") => import_v4.z.number({
|
|
656
665
|
error: `${valueLabel} must be a number.`
|
|
657
666
|
}).pipe(makeNonNegativeIntegerSchema(valueLabel));
|
|
658
667
|
var makeChainIdSchema = (valueLabel = "Chain ID") => makePositiveIntegerSchema(valueLabel).transform((val) => val);
|
|
@@ -1132,13 +1141,7 @@ function sortChainStatusesByStartBlockAsc(chains) {
|
|
|
1132
1141
|
);
|
|
1133
1142
|
}
|
|
1134
1143
|
|
|
1135
|
-
// src/ensindexer/indexing-status/
|
|
1136
|
-
var import_v411 = require("zod/v4");
|
|
1137
|
-
|
|
1138
|
-
// src/ensindexer/indexing-status/zod-schemas.ts
|
|
1139
|
-
var import_v410 = require("zod/v4");
|
|
1140
|
-
|
|
1141
|
-
// src/ensindexer/indexing-status/types.ts
|
|
1144
|
+
// src/ensindexer/indexing-status/cross-chain-indexing-status-snapshot.ts
|
|
1142
1145
|
var CrossChainIndexingStrategyIds = {
|
|
1143
1146
|
/**
|
|
1144
1147
|
* Represents that the indexing of events across all indexed chains will
|
|
@@ -1156,80 +1159,187 @@ var CrossChainIndexingStrategyIds = {
|
|
|
1156
1159
|
*/
|
|
1157
1160
|
Omnichain: "omnichain"
|
|
1158
1161
|
};
|
|
1162
|
+
function getLatestIndexedBlockRef(indexingStatus, chainId) {
|
|
1163
|
+
const chainIndexingStatus = indexingStatus.omnichainSnapshot.chains.get(chainId);
|
|
1164
|
+
if (chainIndexingStatus === void 0) {
|
|
1165
|
+
return null;
|
|
1166
|
+
}
|
|
1167
|
+
if (chainIndexingStatus.chainStatus === ChainIndexingStatusIds.Queued) {
|
|
1168
|
+
return null;
|
|
1169
|
+
}
|
|
1170
|
+
return chainIndexingStatus.latestIndexedBlock;
|
|
1171
|
+
}
|
|
1159
1172
|
|
|
1160
|
-
// src/ensindexer/indexing-status/
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1173
|
+
// src/ensindexer/indexing-status/deserialize/chain-indexing-status-snapshot.ts
|
|
1174
|
+
var import_v48 = require("zod/v4");
|
|
1175
|
+
|
|
1176
|
+
// src/ensindexer/indexing-status/zod-schema/chain-indexing-status-snapshot.ts
|
|
1177
|
+
var import_v47 = require("zod/v4");
|
|
1178
|
+
|
|
1179
|
+
// src/shared/block-ref.ts
|
|
1180
|
+
function isBefore(blockA, blockB) {
|
|
1181
|
+
return blockA.number < blockB.number && blockA.timestamp < blockB.timestamp;
|
|
1182
|
+
}
|
|
1183
|
+
function isEqualTo(blockA, blockB) {
|
|
1184
|
+
return blockA.number === blockB.number && blockA.timestamp === blockB.timestamp;
|
|
1185
|
+
}
|
|
1186
|
+
function isBeforeOrEqualTo(blockA, blockB) {
|
|
1187
|
+
return isBefore(blockA, blockB) || isEqualTo(blockA, blockB);
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
// src/ensindexer/indexing-status/zod-schema/chain-indexing-status-snapshot.ts
|
|
1191
|
+
function invariant_chainSnapshotQueuedBlocks(ctx) {
|
|
1192
|
+
const { config } = ctx.value;
|
|
1193
|
+
if (config.configType === ChainIndexingConfigTypeIds.Indefinite) {
|
|
1194
|
+
return;
|
|
1195
|
+
}
|
|
1196
|
+
if (isBeforeOrEqualTo(config.startBlock, config.endBlock) === false) {
|
|
1169
1197
|
ctx.issues.push({
|
|
1170
1198
|
code: "custom",
|
|
1171
1199
|
input: ctx.value,
|
|
1172
|
-
message: `
|
|
1200
|
+
message: "`config.startBlock` must be before or same as `config.endBlock`."
|
|
1173
1201
|
});
|
|
1174
1202
|
}
|
|
1175
1203
|
}
|
|
1176
|
-
function
|
|
1177
|
-
const {
|
|
1178
|
-
|
|
1179
|
-
const startBlockTimestamps = chains.map((chain) => chain.config.startBlock.timestamp);
|
|
1180
|
-
const endBlockTimestamps = chains.map((chain) => chain.config).filter((chainConfig) => chainConfig.configType === ChainIndexingConfigTypeIds.Definite).map((chainConfig) => chainConfig.endBlock.timestamp);
|
|
1181
|
-
const backfillEndBlockTimestamps = chains.filter((chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill).map((chain) => chain.backfillEndBlock.timestamp);
|
|
1182
|
-
const latestKnownBlockTimestamps = chains.filter((chain) => chain.chainStatus === ChainIndexingStatusIds.Following).map((chain) => chain.latestKnownBlock.timestamp);
|
|
1183
|
-
const highestKnownBlockTimestamp = Math.max(
|
|
1184
|
-
...startBlockTimestamps,
|
|
1185
|
-
...endBlockTimestamps,
|
|
1186
|
-
...backfillEndBlockTimestamps,
|
|
1187
|
-
...latestKnownBlockTimestamps
|
|
1188
|
-
);
|
|
1189
|
-
if (snapshotTime < highestKnownBlockTimestamp) {
|
|
1204
|
+
function invariant_chainSnapshotBackfillBlocks(ctx) {
|
|
1205
|
+
const { config, latestIndexedBlock, backfillEndBlock } = ctx.value;
|
|
1206
|
+
if (isBeforeOrEqualTo(config.startBlock, latestIndexedBlock) === false) {
|
|
1190
1207
|
ctx.issues.push({
|
|
1191
1208
|
code: "custom",
|
|
1192
1209
|
input: ctx.value,
|
|
1193
|
-
message: `
|
|
1210
|
+
message: "`config.startBlock` must be before or same as `latestIndexedBlock`."
|
|
1211
|
+
});
|
|
1212
|
+
}
|
|
1213
|
+
if (isBeforeOrEqualTo(latestIndexedBlock, backfillEndBlock) === false) {
|
|
1214
|
+
ctx.issues.push({
|
|
1215
|
+
code: "custom",
|
|
1216
|
+
input: ctx.value,
|
|
1217
|
+
message: "`latestIndexedBlock` must be before or same as `backfillEndBlock`."
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1220
|
+
if (config.configType === ChainIndexingConfigTypeIds.Indefinite) {
|
|
1221
|
+
return;
|
|
1222
|
+
}
|
|
1223
|
+
if (isEqualTo(backfillEndBlock, config.endBlock) === false) {
|
|
1224
|
+
ctx.issues.push({
|
|
1225
|
+
code: "custom",
|
|
1226
|
+
input: ctx.value,
|
|
1227
|
+
message: "`backfillEndBlock` must be the same as `config.endBlock`."
|
|
1194
1228
|
});
|
|
1195
1229
|
}
|
|
1196
1230
|
}
|
|
1197
|
-
function
|
|
1198
|
-
const
|
|
1199
|
-
|
|
1200
|
-
if (snapshot.snapshotTime > projectedAt) {
|
|
1231
|
+
function invariant_chainSnapshotCompletedBlocks(ctx) {
|
|
1232
|
+
const { config, latestIndexedBlock } = ctx.value;
|
|
1233
|
+
if (isBeforeOrEqualTo(config.startBlock, latestIndexedBlock) === false) {
|
|
1201
1234
|
ctx.issues.push({
|
|
1202
1235
|
code: "custom",
|
|
1203
|
-
input:
|
|
1204
|
-
message: "`
|
|
1236
|
+
input: ctx.value,
|
|
1237
|
+
message: "`config.startBlock` must be before or same as `latestIndexedBlock`."
|
|
1238
|
+
});
|
|
1239
|
+
}
|
|
1240
|
+
if (isBeforeOrEqualTo(latestIndexedBlock, config.endBlock) === false) {
|
|
1241
|
+
ctx.issues.push({
|
|
1242
|
+
code: "custom",
|
|
1243
|
+
input: ctx.value,
|
|
1244
|
+
message: "`latestIndexedBlock` must be before or same as `config.endBlock`."
|
|
1205
1245
|
});
|
|
1206
1246
|
}
|
|
1207
1247
|
}
|
|
1208
|
-
function
|
|
1209
|
-
const
|
|
1210
|
-
|
|
1211
|
-
const { omnichainSnapshot } = snapshot;
|
|
1212
|
-
const expectedWorstCaseDistance = projectedAt - omnichainSnapshot.omnichainIndexingCursor;
|
|
1213
|
-
if (worstCaseDistance !== expectedWorstCaseDistance) {
|
|
1248
|
+
function invariant_chainSnapshotFollowingBlocks(ctx) {
|
|
1249
|
+
const { config, latestIndexedBlock, latestKnownBlock } = ctx.value;
|
|
1250
|
+
if (isBeforeOrEqualTo(config.startBlock, latestIndexedBlock) === false) {
|
|
1214
1251
|
ctx.issues.push({
|
|
1215
1252
|
code: "custom",
|
|
1216
|
-
input:
|
|
1217
|
-
message: "`
|
|
1253
|
+
input: ctx.value,
|
|
1254
|
+
message: "`config.startBlock` must be before or same as `latestIndexedBlock`."
|
|
1255
|
+
});
|
|
1256
|
+
}
|
|
1257
|
+
if (isBeforeOrEqualTo(latestIndexedBlock, latestKnownBlock) === false) {
|
|
1258
|
+
ctx.issues.push({
|
|
1259
|
+
code: "custom",
|
|
1260
|
+
input: ctx.value,
|
|
1261
|
+
message: "`latestIndexedBlock` must be before or same as `latestKnownBlock`."
|
|
1218
1262
|
});
|
|
1219
1263
|
}
|
|
1220
1264
|
}
|
|
1265
|
+
var makeChainIndexingConfigSchema = (valueLabel = "Value") => import_v47.z.discriminatedUnion("configType", [
|
|
1266
|
+
import_v47.z.object({
|
|
1267
|
+
configType: import_v47.z.literal(ChainIndexingConfigTypeIds.Indefinite),
|
|
1268
|
+
startBlock: makeBlockRefSchema(valueLabel)
|
|
1269
|
+
}),
|
|
1270
|
+
import_v47.z.object({
|
|
1271
|
+
configType: import_v47.z.literal(ChainIndexingConfigTypeIds.Definite),
|
|
1272
|
+
startBlock: makeBlockRefSchema(valueLabel),
|
|
1273
|
+
endBlock: makeBlockRefSchema(valueLabel)
|
|
1274
|
+
})
|
|
1275
|
+
]);
|
|
1276
|
+
var makeChainIndexingStatusSnapshotQueuedSchema = (valueLabel = "Value") => import_v47.z.object({
|
|
1277
|
+
chainStatus: import_v47.z.literal(ChainIndexingStatusIds.Queued),
|
|
1278
|
+
config: makeChainIndexingConfigSchema(valueLabel)
|
|
1279
|
+
}).check(invariant_chainSnapshotQueuedBlocks);
|
|
1280
|
+
var makeChainIndexingStatusSnapshotBackfillSchema = (valueLabel = "Value") => import_v47.z.object({
|
|
1281
|
+
chainStatus: import_v47.z.literal(ChainIndexingStatusIds.Backfill),
|
|
1282
|
+
config: makeChainIndexingConfigSchema(valueLabel),
|
|
1283
|
+
latestIndexedBlock: makeBlockRefSchema(valueLabel),
|
|
1284
|
+
backfillEndBlock: makeBlockRefSchema(valueLabel)
|
|
1285
|
+
}).check(invariant_chainSnapshotBackfillBlocks);
|
|
1286
|
+
var makeChainIndexingStatusSnapshotCompletedSchema = (valueLabel = "Value") => import_v47.z.object({
|
|
1287
|
+
chainStatus: import_v47.z.literal(ChainIndexingStatusIds.Completed),
|
|
1288
|
+
config: import_v47.z.object({
|
|
1289
|
+
configType: import_v47.z.literal(ChainIndexingConfigTypeIds.Definite),
|
|
1290
|
+
startBlock: makeBlockRefSchema(valueLabel),
|
|
1291
|
+
endBlock: makeBlockRefSchema(valueLabel)
|
|
1292
|
+
}),
|
|
1293
|
+
latestIndexedBlock: makeBlockRefSchema(valueLabel)
|
|
1294
|
+
}).check(invariant_chainSnapshotCompletedBlocks);
|
|
1295
|
+
var makeChainIndexingStatusSnapshotFollowingSchema = (valueLabel = "Value") => import_v47.z.object({
|
|
1296
|
+
chainStatus: import_v47.z.literal(ChainIndexingStatusIds.Following),
|
|
1297
|
+
config: import_v47.z.object({
|
|
1298
|
+
configType: import_v47.z.literal(ChainIndexingConfigTypeIds.Indefinite),
|
|
1299
|
+
startBlock: makeBlockRefSchema(valueLabel)
|
|
1300
|
+
}),
|
|
1301
|
+
latestIndexedBlock: makeBlockRefSchema(valueLabel),
|
|
1302
|
+
latestKnownBlock: makeBlockRefSchema(valueLabel)
|
|
1303
|
+
}).check(invariant_chainSnapshotFollowingBlocks);
|
|
1304
|
+
var makeChainIndexingStatusSnapshotSchema = (valueLabel = "Value") => import_v47.z.discriminatedUnion("chainStatus", [
|
|
1305
|
+
makeChainIndexingStatusSnapshotQueuedSchema(valueLabel),
|
|
1306
|
+
makeChainIndexingStatusSnapshotBackfillSchema(valueLabel),
|
|
1307
|
+
makeChainIndexingStatusSnapshotCompletedSchema(valueLabel),
|
|
1308
|
+
makeChainIndexingStatusSnapshotFollowingSchema(valueLabel)
|
|
1309
|
+
]);
|
|
1310
|
+
var makeSerializedChainIndexingStatusSnapshotSchema = makeChainIndexingStatusSnapshotSchema;
|
|
1311
|
+
|
|
1312
|
+
// src/ensindexer/indexing-status/deserialize/chain-indexing-status-snapshot.ts
|
|
1313
|
+
function deserializeChainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
1314
|
+
const schema = makeSerializedChainIndexingStatusSnapshotSchema(valueLabel);
|
|
1315
|
+
const parsed = schema.safeParse(maybeSnapshot);
|
|
1316
|
+
if (parsed.error) {
|
|
1317
|
+
throw new Error(
|
|
1318
|
+
`Cannot deserialize into ChainIndexingStatusSnapshot:
|
|
1319
|
+
${(0, import_v48.prettifyError)(parsed.error)}
|
|
1320
|
+
`
|
|
1321
|
+
);
|
|
1322
|
+
}
|
|
1323
|
+
return parsed.data;
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
// src/ensindexer/indexing-status/deserialize/cross-chain-indexing-status-snapshot.ts
|
|
1327
|
+
var import_v412 = require("zod/v4");
|
|
1328
|
+
|
|
1329
|
+
// src/ensindexer/indexing-status/zod-schema/cross-chain-indexing-status-snapshot.ts
|
|
1330
|
+
var import_v411 = require("zod/v4");
|
|
1221
1331
|
|
|
1222
1332
|
// src/ensindexer/indexing-status/zod-schema/omnichain-indexing-status-snapshot.ts
|
|
1223
|
-
var
|
|
1333
|
+
var import_v410 = require("zod/v4");
|
|
1224
1334
|
|
|
1225
1335
|
// src/shared/deserialize.ts
|
|
1226
|
-
var
|
|
1336
|
+
var import_v49 = __toESM(require("zod/v4"), 1);
|
|
1227
1337
|
function deserializeChainId(maybeChainId, valueLabel) {
|
|
1228
1338
|
const schema = makeChainIdStringSchema(valueLabel);
|
|
1229
1339
|
const parsed = schema.safeParse(maybeChainId);
|
|
1230
1340
|
if (parsed.error) {
|
|
1231
1341
|
throw new Error(`Cannot deserialize ChainId:
|
|
1232
|
-
${(0,
|
|
1342
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1233
1343
|
`);
|
|
1234
1344
|
}
|
|
1235
1345
|
return parsed.data;
|
|
@@ -1239,7 +1349,7 @@ function deserializeDatetime(maybeDatetime, valueLabel) {
|
|
|
1239
1349
|
const parsed = schema.safeParse(maybeDatetime);
|
|
1240
1350
|
if (parsed.error) {
|
|
1241
1351
|
throw new Error(`Cannot deserialize Datetime:
|
|
1242
|
-
${(0,
|
|
1352
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1243
1353
|
`);
|
|
1244
1354
|
}
|
|
1245
1355
|
return parsed.data;
|
|
@@ -1249,7 +1359,7 @@ function deserializeUnixTimestamp(maybeTimestamp, valueLabel) {
|
|
|
1249
1359
|
const parsed = schema.safeParse(maybeTimestamp);
|
|
1250
1360
|
if (parsed.error) {
|
|
1251
1361
|
throw new Error(`Cannot deserialize Unix Timestamp:
|
|
1252
|
-
${(0,
|
|
1362
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1253
1363
|
`);
|
|
1254
1364
|
}
|
|
1255
1365
|
return parsed.data;
|
|
@@ -1259,7 +1369,7 @@ function deserializeUrl(maybeUrl, valueLabel) {
|
|
|
1259
1369
|
const parsed = schema.safeParse(maybeUrl);
|
|
1260
1370
|
if (parsed.error) {
|
|
1261
1371
|
throw new Error(`Cannot deserialize URL:
|
|
1262
|
-
${(0,
|
|
1372
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1263
1373
|
`);
|
|
1264
1374
|
}
|
|
1265
1375
|
return parsed.data;
|
|
@@ -1269,7 +1379,7 @@ function deserializeBlockNumber(maybeBlockNumber, valueLabel) {
|
|
|
1269
1379
|
const parsed = schema.safeParse(maybeBlockNumber);
|
|
1270
1380
|
if (parsed.error) {
|
|
1271
1381
|
throw new Error(`Cannot deserialize BlockNumber:
|
|
1272
|
-
${(0,
|
|
1382
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1273
1383
|
`);
|
|
1274
1384
|
}
|
|
1275
1385
|
return parsed.data;
|
|
@@ -1279,7 +1389,7 @@ function deserializeBlockrange(maybeBlockrange, valueLabel) {
|
|
|
1279
1389
|
const parsed = schema.safeParse(maybeBlockrange);
|
|
1280
1390
|
if (parsed.error) {
|
|
1281
1391
|
throw new Error(`Cannot deserialize Blockrange:
|
|
1282
|
-
${(0,
|
|
1392
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1283
1393
|
`);
|
|
1284
1394
|
}
|
|
1285
1395
|
return parsed.data;
|
|
@@ -1289,17 +1399,17 @@ function deserializeBlockRef(maybeBlockRef, valueLabel) {
|
|
|
1289
1399
|
const parsed = schema.safeParse(maybeBlockRef);
|
|
1290
1400
|
if (parsed.error) {
|
|
1291
1401
|
throw new Error(`Cannot deserialize BlockRef:
|
|
1292
|
-
${(0,
|
|
1402
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1293
1403
|
`);
|
|
1294
1404
|
}
|
|
1295
1405
|
return parsed.data;
|
|
1296
1406
|
}
|
|
1297
1407
|
function deserializeDuration(maybeDuration, valueLabel) {
|
|
1298
|
-
const schema = makeDurationSchema(valueLabel);
|
|
1408
|
+
const schema = import_v49.default.coerce.number().pipe(makeDurationSchema(valueLabel));
|
|
1299
1409
|
const parsed = schema.safeParse(maybeDuration);
|
|
1300
1410
|
if (parsed.error) {
|
|
1301
1411
|
throw new RangeError(`Cannot deserialize Duration:
|
|
1302
|
-
${(0,
|
|
1412
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1303
1413
|
`);
|
|
1304
1414
|
}
|
|
1305
1415
|
return parsed.data;
|
|
@@ -1309,7 +1419,7 @@ function parseAccountId(maybeAccountId, valueLabel) {
|
|
|
1309
1419
|
const parsed = schema.safeParse(maybeAccountId);
|
|
1310
1420
|
if (parsed.error) {
|
|
1311
1421
|
throw new RangeError(`Cannot deserialize AccountId:
|
|
1312
|
-
${(0,
|
|
1422
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1313
1423
|
`);
|
|
1314
1424
|
}
|
|
1315
1425
|
return parsed.data;
|
|
@@ -1319,7 +1429,7 @@ function deserializePriceEth(maybePrice, valueLabel) {
|
|
|
1319
1429
|
const parsed = schema.safeParse(maybePrice);
|
|
1320
1430
|
if (parsed.error) {
|
|
1321
1431
|
throw new Error(`Cannot deserialize PriceEth:
|
|
1322
|
-
${(0,
|
|
1432
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1323
1433
|
`);
|
|
1324
1434
|
}
|
|
1325
1435
|
return parsed.data;
|
|
@@ -1329,7 +1439,7 @@ function deserializePriceUsdc(maybePrice, valueLabel) {
|
|
|
1329
1439
|
const parsed = schema.safeParse(maybePrice);
|
|
1330
1440
|
if (parsed.error) {
|
|
1331
1441
|
throw new Error(`Cannot deserialize PriceUsdc:
|
|
1332
|
-
${(0,
|
|
1442
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1333
1443
|
`);
|
|
1334
1444
|
}
|
|
1335
1445
|
return parsed.data;
|
|
@@ -1339,7 +1449,7 @@ function deserializePriceDai(maybePrice, valueLabel) {
|
|
|
1339
1449
|
const parsed = schema.safeParse(maybePrice);
|
|
1340
1450
|
if (parsed.error) {
|
|
1341
1451
|
throw new Error(`Cannot deserialize PriceDai:
|
|
1342
|
-
${(0,
|
|
1452
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1343
1453
|
`);
|
|
1344
1454
|
}
|
|
1345
1455
|
return parsed.data;
|
|
@@ -1426,142 +1536,6 @@ function getOmnichainIndexingCursor(chains) {
|
|
|
1426
1536
|
return Math.max(...latestIndexedBlockTimestamps);
|
|
1427
1537
|
}
|
|
1428
1538
|
|
|
1429
|
-
// src/ensindexer/indexing-status/zod-schema/chain-indexing-status-snapshot.ts
|
|
1430
|
-
var import_v48 = require("zod/v4");
|
|
1431
|
-
|
|
1432
|
-
// src/shared/block-ref.ts
|
|
1433
|
-
function isBefore(blockA, blockB) {
|
|
1434
|
-
return blockA.number < blockB.number && blockA.timestamp < blockB.timestamp;
|
|
1435
|
-
}
|
|
1436
|
-
function isEqualTo(blockA, blockB) {
|
|
1437
|
-
return blockA.number === blockB.number && blockA.timestamp === blockB.timestamp;
|
|
1438
|
-
}
|
|
1439
|
-
function isBeforeOrEqualTo(blockA, blockB) {
|
|
1440
|
-
return isBefore(blockA, blockB) || isEqualTo(blockA, blockB);
|
|
1441
|
-
}
|
|
1442
|
-
|
|
1443
|
-
// src/ensindexer/indexing-status/zod-schema/chain-indexing-status-snapshot.ts
|
|
1444
|
-
function invariant_chainSnapshotQueuedBlocks(ctx) {
|
|
1445
|
-
const { config } = ctx.value;
|
|
1446
|
-
if (config.configType === ChainIndexingConfigTypeIds.Indefinite) {
|
|
1447
|
-
return;
|
|
1448
|
-
}
|
|
1449
|
-
if (isBeforeOrEqualTo(config.startBlock, config.endBlock) === false) {
|
|
1450
|
-
ctx.issues.push({
|
|
1451
|
-
code: "custom",
|
|
1452
|
-
input: ctx.value,
|
|
1453
|
-
message: "`config.startBlock` must be before or same as `config.endBlock`."
|
|
1454
|
-
});
|
|
1455
|
-
}
|
|
1456
|
-
}
|
|
1457
|
-
function invariant_chainSnapshotBackfillBlocks(ctx) {
|
|
1458
|
-
const { config, latestIndexedBlock, backfillEndBlock } = ctx.value;
|
|
1459
|
-
if (isBeforeOrEqualTo(config.startBlock, latestIndexedBlock) === false) {
|
|
1460
|
-
ctx.issues.push({
|
|
1461
|
-
code: "custom",
|
|
1462
|
-
input: ctx.value,
|
|
1463
|
-
message: "`config.startBlock` must be before or same as `latestIndexedBlock`."
|
|
1464
|
-
});
|
|
1465
|
-
}
|
|
1466
|
-
if (isBeforeOrEqualTo(latestIndexedBlock, backfillEndBlock) === false) {
|
|
1467
|
-
ctx.issues.push({
|
|
1468
|
-
code: "custom",
|
|
1469
|
-
input: ctx.value,
|
|
1470
|
-
message: "`latestIndexedBlock` must be before or same as `backfillEndBlock`."
|
|
1471
|
-
});
|
|
1472
|
-
}
|
|
1473
|
-
if (config.configType === ChainIndexingConfigTypeIds.Indefinite) {
|
|
1474
|
-
return;
|
|
1475
|
-
}
|
|
1476
|
-
if (isEqualTo(backfillEndBlock, config.endBlock) === false) {
|
|
1477
|
-
ctx.issues.push({
|
|
1478
|
-
code: "custom",
|
|
1479
|
-
input: ctx.value,
|
|
1480
|
-
message: "`backfillEndBlock` must be the same as `config.endBlock`."
|
|
1481
|
-
});
|
|
1482
|
-
}
|
|
1483
|
-
}
|
|
1484
|
-
function invariant_chainSnapshotCompletedBlocks(ctx) {
|
|
1485
|
-
const { config, latestIndexedBlock } = ctx.value;
|
|
1486
|
-
if (isBeforeOrEqualTo(config.startBlock, latestIndexedBlock) === false) {
|
|
1487
|
-
ctx.issues.push({
|
|
1488
|
-
code: "custom",
|
|
1489
|
-
input: ctx.value,
|
|
1490
|
-
message: "`config.startBlock` must be before or same as `latestIndexedBlock`."
|
|
1491
|
-
});
|
|
1492
|
-
}
|
|
1493
|
-
if (isBeforeOrEqualTo(latestIndexedBlock, config.endBlock) === false) {
|
|
1494
|
-
ctx.issues.push({
|
|
1495
|
-
code: "custom",
|
|
1496
|
-
input: ctx.value,
|
|
1497
|
-
message: "`latestIndexedBlock` must be before or same as `config.endBlock`."
|
|
1498
|
-
});
|
|
1499
|
-
}
|
|
1500
|
-
}
|
|
1501
|
-
function invariant_chainSnapshotFollowingBlocks(ctx) {
|
|
1502
|
-
const { config, latestIndexedBlock, latestKnownBlock } = ctx.value;
|
|
1503
|
-
if (isBeforeOrEqualTo(config.startBlock, latestIndexedBlock) === false) {
|
|
1504
|
-
ctx.issues.push({
|
|
1505
|
-
code: "custom",
|
|
1506
|
-
input: ctx.value,
|
|
1507
|
-
message: "`config.startBlock` must be before or same as `latestIndexedBlock`."
|
|
1508
|
-
});
|
|
1509
|
-
}
|
|
1510
|
-
if (isBeforeOrEqualTo(latestIndexedBlock, latestKnownBlock) === false) {
|
|
1511
|
-
ctx.issues.push({
|
|
1512
|
-
code: "custom",
|
|
1513
|
-
input: ctx.value,
|
|
1514
|
-
message: "`latestIndexedBlock` must be before or same as `latestKnownBlock`."
|
|
1515
|
-
});
|
|
1516
|
-
}
|
|
1517
|
-
}
|
|
1518
|
-
var makeChainIndexingConfigSchema = (valueLabel = "Value") => import_v48.z.discriminatedUnion("configType", [
|
|
1519
|
-
import_v48.z.object({
|
|
1520
|
-
configType: import_v48.z.literal(ChainIndexingConfigTypeIds.Indefinite),
|
|
1521
|
-
startBlock: makeBlockRefSchema(valueLabel)
|
|
1522
|
-
}),
|
|
1523
|
-
import_v48.z.object({
|
|
1524
|
-
configType: import_v48.z.literal(ChainIndexingConfigTypeIds.Definite),
|
|
1525
|
-
startBlock: makeBlockRefSchema(valueLabel),
|
|
1526
|
-
endBlock: makeBlockRefSchema(valueLabel)
|
|
1527
|
-
})
|
|
1528
|
-
]);
|
|
1529
|
-
var makeChainIndexingStatusSnapshotQueuedSchema = (valueLabel = "Value") => import_v48.z.object({
|
|
1530
|
-
chainStatus: import_v48.z.literal(ChainIndexingStatusIds.Queued),
|
|
1531
|
-
config: makeChainIndexingConfigSchema(valueLabel)
|
|
1532
|
-
}).check(invariant_chainSnapshotQueuedBlocks);
|
|
1533
|
-
var makeChainIndexingStatusSnapshotBackfillSchema = (valueLabel = "Value") => import_v48.z.object({
|
|
1534
|
-
chainStatus: import_v48.z.literal(ChainIndexingStatusIds.Backfill),
|
|
1535
|
-
config: makeChainIndexingConfigSchema(valueLabel),
|
|
1536
|
-
latestIndexedBlock: makeBlockRefSchema(valueLabel),
|
|
1537
|
-
backfillEndBlock: makeBlockRefSchema(valueLabel)
|
|
1538
|
-
}).check(invariant_chainSnapshotBackfillBlocks);
|
|
1539
|
-
var makeChainIndexingStatusSnapshotCompletedSchema = (valueLabel = "Value") => import_v48.z.object({
|
|
1540
|
-
chainStatus: import_v48.z.literal(ChainIndexingStatusIds.Completed),
|
|
1541
|
-
config: import_v48.z.object({
|
|
1542
|
-
configType: import_v48.z.literal(ChainIndexingConfigTypeIds.Definite),
|
|
1543
|
-
startBlock: makeBlockRefSchema(valueLabel),
|
|
1544
|
-
endBlock: makeBlockRefSchema(valueLabel)
|
|
1545
|
-
}),
|
|
1546
|
-
latestIndexedBlock: makeBlockRefSchema(valueLabel)
|
|
1547
|
-
}).check(invariant_chainSnapshotCompletedBlocks);
|
|
1548
|
-
var makeChainIndexingStatusSnapshotFollowingSchema = (valueLabel = "Value") => import_v48.z.object({
|
|
1549
|
-
chainStatus: import_v48.z.literal(ChainIndexingStatusIds.Following),
|
|
1550
|
-
config: import_v48.z.object({
|
|
1551
|
-
configType: import_v48.z.literal(ChainIndexingConfigTypeIds.Indefinite),
|
|
1552
|
-
startBlock: makeBlockRefSchema(valueLabel)
|
|
1553
|
-
}),
|
|
1554
|
-
latestIndexedBlock: makeBlockRefSchema(valueLabel),
|
|
1555
|
-
latestKnownBlock: makeBlockRefSchema(valueLabel)
|
|
1556
|
-
}).check(invariant_chainSnapshotFollowingBlocks);
|
|
1557
|
-
var makeChainIndexingStatusSnapshotSchema = (valueLabel = "Value") => import_v48.z.discriminatedUnion("chainStatus", [
|
|
1558
|
-
makeChainIndexingStatusSnapshotQueuedSchema(valueLabel),
|
|
1559
|
-
makeChainIndexingStatusSnapshotBackfillSchema(valueLabel),
|
|
1560
|
-
makeChainIndexingStatusSnapshotCompletedSchema(valueLabel),
|
|
1561
|
-
makeChainIndexingStatusSnapshotFollowingSchema(valueLabel)
|
|
1562
|
-
]);
|
|
1563
|
-
var makeSerializedChainIndexingStatusSnapshotSchema = makeChainIndexingStatusSnapshotSchema;
|
|
1564
|
-
|
|
1565
1539
|
// src/ensindexer/indexing-status/zod-schema/omnichain-indexing-status-snapshot.ts
|
|
1566
1540
|
function invariant_omnichainSnapshotStatusIsConsistentWithChainSnapshot(ctx) {
|
|
1567
1541
|
const snapshot = ctx.value;
|
|
@@ -1671,7 +1645,7 @@ function invariant_omnichainStatusSnapshotCompletedHasValidChains(ctx) {
|
|
|
1671
1645
|
});
|
|
1672
1646
|
}
|
|
1673
1647
|
}
|
|
1674
|
-
var makeChainIndexingStatusesSchema = (valueLabel = "Value") =>
|
|
1648
|
+
var makeChainIndexingStatusesSchema = (valueLabel = "Value") => import_v410.z.record(makeChainIdStringSchema(), makeChainIndexingStatusSnapshotSchema(valueLabel), {
|
|
1675
1649
|
error: "Chains indexing statuses must be an object mapping valid chain IDs to their indexing status snapshots."
|
|
1676
1650
|
}).transform((serializedChainsIndexingStatus) => {
|
|
1677
1651
|
const chainsIndexingStatus = /* @__PURE__ */ new Map();
|
|
@@ -1680,29 +1654,29 @@ var makeChainIndexingStatusesSchema = (valueLabel = "Value") => import_v49.z.rec
|
|
|
1680
1654
|
}
|
|
1681
1655
|
return chainsIndexingStatus;
|
|
1682
1656
|
});
|
|
1683
|
-
var makeOmnichainIndexingStatusSnapshotUnstartedSchema = (valueLabel) =>
|
|
1684
|
-
omnichainStatus:
|
|
1657
|
+
var makeOmnichainIndexingStatusSnapshotUnstartedSchema = (valueLabel) => import_v410.z.strictObject({
|
|
1658
|
+
omnichainStatus: import_v410.z.literal(OmnichainIndexingStatusIds.Unstarted),
|
|
1685
1659
|
chains: makeChainIndexingStatusesSchema(valueLabel).check(invariant_omnichainSnapshotUnstartedHasValidChains).transform((chains) => chains),
|
|
1686
1660
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1687
1661
|
});
|
|
1688
|
-
var makeOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) =>
|
|
1689
|
-
omnichainStatus:
|
|
1662
|
+
var makeOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) => import_v410.z.strictObject({
|
|
1663
|
+
omnichainStatus: import_v410.z.literal(OmnichainIndexingStatusIds.Backfill),
|
|
1690
1664
|
chains: makeChainIndexingStatusesSchema(valueLabel).check(invariant_omnichainStatusSnapshotBackfillHasValidChains).transform(
|
|
1691
1665
|
(chains) => chains
|
|
1692
1666
|
),
|
|
1693
1667
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1694
1668
|
});
|
|
1695
|
-
var makeOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) =>
|
|
1696
|
-
omnichainStatus:
|
|
1669
|
+
var makeOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) => import_v410.z.strictObject({
|
|
1670
|
+
omnichainStatus: import_v410.z.literal(OmnichainIndexingStatusIds.Completed),
|
|
1697
1671
|
chains: makeChainIndexingStatusesSchema(valueLabel).check(invariant_omnichainStatusSnapshotCompletedHasValidChains).transform((chains) => chains),
|
|
1698
1672
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1699
1673
|
});
|
|
1700
|
-
var makeOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) =>
|
|
1701
|
-
omnichainStatus:
|
|
1674
|
+
var makeOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) => import_v410.z.strictObject({
|
|
1675
|
+
omnichainStatus: import_v410.z.literal(OmnichainIndexingStatusIds.Following),
|
|
1702
1676
|
chains: makeChainIndexingStatusesSchema(valueLabel),
|
|
1703
1677
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1704
1678
|
});
|
|
1705
|
-
var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexing Snapshot") =>
|
|
1679
|
+
var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexing Snapshot") => import_v410.z.discriminatedUnion("omnichainStatus", [
|
|
1706
1680
|
makeOmnichainIndexingStatusSnapshotUnstartedSchema(valueLabel),
|
|
1707
1681
|
makeOmnichainIndexingStatusSnapshotBackfillSchema(valueLabel),
|
|
1708
1682
|
makeOmnichainIndexingStatusSnapshotCompletedSchema(valueLabel),
|
|
@@ -1711,56 +1685,60 @@ var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexin
|
|
|
1711
1685
|
invariant_omnichainIndexingCursorLowerThanOrEqualToLatestBackfillEndBlockAcrossBackfillChains
|
|
1712
1686
|
).check(invariant_omnichainIndexingCursorIsEqualToHighestLatestIndexedBlockAcrossIndexedChain);
|
|
1713
1687
|
|
|
1714
|
-
// src/ensindexer/indexing-status/zod-
|
|
1715
|
-
|
|
1716
|
-
|
|
1688
|
+
// src/ensindexer/indexing-status/zod-schema/cross-chain-indexing-status-snapshot.ts
|
|
1689
|
+
function invariant_slowestChainEqualsToOmnichainSnapshotTime(ctx) {
|
|
1690
|
+
const { slowestChainIndexingCursor, omnichainSnapshot } = ctx.value;
|
|
1691
|
+
const { omnichainIndexingCursor } = omnichainSnapshot;
|
|
1692
|
+
if (slowestChainIndexingCursor !== omnichainIndexingCursor) {
|
|
1693
|
+
console.log("invariant_slowestChainEqualsToOmnichainSnapshotTime", {
|
|
1694
|
+
slowestChainIndexingCursor,
|
|
1695
|
+
omnichainIndexingCursor
|
|
1696
|
+
});
|
|
1697
|
+
ctx.issues.push({
|
|
1698
|
+
code: "custom",
|
|
1699
|
+
input: ctx.value,
|
|
1700
|
+
message: `'slowestChainIndexingCursor' must be equal to 'omnichainSnapshot.omnichainIndexingCursor'`
|
|
1701
|
+
});
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
function invariant_snapshotTimeIsTheHighestKnownBlockTimestamp(ctx) {
|
|
1705
|
+
const { snapshotTime, omnichainSnapshot } = ctx.value;
|
|
1706
|
+
const chains = Array.from(omnichainSnapshot.chains.values());
|
|
1707
|
+
const startBlockTimestamps = chains.map((chain) => chain.config.startBlock.timestamp);
|
|
1708
|
+
const endBlockTimestamps = chains.map((chain) => chain.config).filter((chainConfig) => chainConfig.configType === ChainIndexingConfigTypeIds.Definite).map((chainConfig) => chainConfig.endBlock.timestamp);
|
|
1709
|
+
const backfillEndBlockTimestamps = chains.filter((chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill).map((chain) => chain.backfillEndBlock.timestamp);
|
|
1710
|
+
const latestKnownBlockTimestamps = chains.filter((chain) => chain.chainStatus === ChainIndexingStatusIds.Following).map((chain) => chain.latestKnownBlock.timestamp);
|
|
1711
|
+
const highestKnownBlockTimestamp = Math.max(
|
|
1712
|
+
...startBlockTimestamps,
|
|
1713
|
+
...endBlockTimestamps,
|
|
1714
|
+
...backfillEndBlockTimestamps,
|
|
1715
|
+
...latestKnownBlockTimestamps
|
|
1716
|
+
);
|
|
1717
|
+
if (snapshotTime < highestKnownBlockTimestamp) {
|
|
1718
|
+
ctx.issues.push({
|
|
1719
|
+
code: "custom",
|
|
1720
|
+
input: ctx.value,
|
|
1721
|
+
message: `'snapshotTime' (${snapshotTime}) must be greater than or equal to the "highest known block timestamp" (${highestKnownBlockTimestamp})`
|
|
1722
|
+
});
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
var makeCrossChainIndexingStatusSnapshotOmnichainSchema = (valueLabel = "Cross-chain Indexing Status Snapshot Omnichain") => import_v411.z.strictObject({
|
|
1726
|
+
strategy: import_v411.z.literal(CrossChainIndexingStrategyIds.Omnichain),
|
|
1717
1727
|
slowestChainIndexingCursor: makeUnixTimestampSchema(valueLabel),
|
|
1718
1728
|
snapshotTime: makeUnixTimestampSchema(valueLabel),
|
|
1719
1729
|
omnichainSnapshot: makeOmnichainIndexingStatusSnapshotSchema(valueLabel)
|
|
1720
1730
|
}).check(invariant_slowestChainEqualsToOmnichainSnapshotTime).check(invariant_snapshotTimeIsTheHighestKnownBlockTimestamp);
|
|
1721
|
-
var makeCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Cross-chain Indexing Status Snapshot") =>
|
|
1731
|
+
var makeCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Cross-chain Indexing Status Snapshot") => import_v411.z.discriminatedUnion("strategy", [
|
|
1722
1732
|
makeCrossChainIndexingStatusSnapshotOmnichainSchema(valueLabel)
|
|
1723
1733
|
]);
|
|
1724
|
-
var makeRealtimeIndexingStatusProjectionSchema = (valueLabel = "Realtime Indexing Status Projection") => import_v410.z.strictObject({
|
|
1725
|
-
projectedAt: makeUnixTimestampSchema(valueLabel),
|
|
1726
|
-
worstCaseDistance: makeDurationSchema(valueLabel),
|
|
1727
|
-
snapshot: makeCrossChainIndexingStatusSnapshotSchema(valueLabel)
|
|
1728
|
-
}).check(invariant_realtimeIndexingStatusProjectionProjectedAtIsAfterOrEqualToSnapshotTime).check(invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect);
|
|
1729
1734
|
|
|
1730
|
-
// src/ensindexer/indexing-status/deserialize.ts
|
|
1735
|
+
// src/ensindexer/indexing-status/deserialize/cross-chain-indexing-status-snapshot.ts
|
|
1731
1736
|
function deserializeCrossChainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
1732
1737
|
const schema = makeCrossChainIndexingStatusSnapshotSchema(valueLabel);
|
|
1733
1738
|
const parsed = schema.safeParse(maybeSnapshot);
|
|
1734
1739
|
if (parsed.error) {
|
|
1735
1740
|
throw new Error(
|
|
1736
1741
|
`Cannot deserialize into CrossChainIndexingStatusSnapshot:
|
|
1737
|
-
${(0, import_v411.prettifyError)(parsed.error)}
|
|
1738
|
-
`
|
|
1739
|
-
);
|
|
1740
|
-
}
|
|
1741
|
-
return parsed.data;
|
|
1742
|
-
}
|
|
1743
|
-
function deserializeRealtimeIndexingStatusProjection(maybeProjection, valueLabel) {
|
|
1744
|
-
const schema = makeRealtimeIndexingStatusProjectionSchema(valueLabel);
|
|
1745
|
-
const parsed = schema.safeParse(maybeProjection);
|
|
1746
|
-
if (parsed.error) {
|
|
1747
|
-
throw new Error(
|
|
1748
|
-
`Cannot deserialize into RealtimeIndexingStatusProjection:
|
|
1749
|
-
${(0, import_v411.prettifyError)(parsed.error)}
|
|
1750
|
-
`
|
|
1751
|
-
);
|
|
1752
|
-
}
|
|
1753
|
-
return parsed.data;
|
|
1754
|
-
}
|
|
1755
|
-
|
|
1756
|
-
// src/ensindexer/indexing-status/deserialize/chain-indexing-status-snapshot.ts
|
|
1757
|
-
var import_v412 = require("zod/v4");
|
|
1758
|
-
function deserializeChainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
1759
|
-
const schema = makeSerializedChainIndexingStatusSnapshotSchema(valueLabel);
|
|
1760
|
-
const parsed = schema.safeParse(maybeSnapshot);
|
|
1761
|
-
if (parsed.error) {
|
|
1762
|
-
throw new Error(
|
|
1763
|
-
`Cannot deserialize into ChainIndexingStatusSnapshot:
|
|
1764
1742
|
${(0, import_v412.prettifyError)(parsed.error)}
|
|
1765
1743
|
`
|
|
1766
1744
|
);
|
|
@@ -1783,19 +1761,55 @@ ${(0, import_v413.prettifyError)(parsed.error)}
|
|
|
1783
1761
|
return parsed.data;
|
|
1784
1762
|
}
|
|
1785
1763
|
|
|
1786
|
-
// src/ensindexer/indexing-status/
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1764
|
+
// src/ensindexer/indexing-status/deserialize/realtime-indexing-status-projection.ts
|
|
1765
|
+
var import_v415 = require("zod/v4");
|
|
1766
|
+
|
|
1767
|
+
// src/ensindexer/indexing-status/zod-schema/realtime-indexing-status-projection.ts
|
|
1768
|
+
var import_v414 = require("zod/v4");
|
|
1769
|
+
function invariant_realtimeIndexingStatusProjectionProjectedAtIsAfterOrEqualToSnapshotTime(ctx) {
|
|
1770
|
+
const projection = ctx.value;
|
|
1771
|
+
const { snapshot, projectedAt } = projection;
|
|
1772
|
+
if (snapshot.snapshotTime > projectedAt) {
|
|
1773
|
+
ctx.issues.push({
|
|
1774
|
+
code: "custom",
|
|
1775
|
+
input: projection,
|
|
1776
|
+
message: "`projectedAt` must be after or same as `snapshot.snapshotTime`."
|
|
1777
|
+
});
|
|
1791
1778
|
}
|
|
1792
|
-
|
|
1793
|
-
|
|
1779
|
+
}
|
|
1780
|
+
function invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect(ctx) {
|
|
1781
|
+
const projection = ctx.value;
|
|
1782
|
+
const { projectedAt, snapshot, worstCaseDistance } = projection;
|
|
1783
|
+
const expectedWorstCaseDistance = projectedAt - snapshot.slowestChainIndexingCursor;
|
|
1784
|
+
if (worstCaseDistance !== expectedWorstCaseDistance) {
|
|
1785
|
+
ctx.issues.push({
|
|
1786
|
+
code: "custom",
|
|
1787
|
+
input: projection,
|
|
1788
|
+
message: "`worstCaseDistance` must be the exact difference between `projectedAt` and `snapshot.slowestChainIndexingCursor`."
|
|
1789
|
+
});
|
|
1794
1790
|
}
|
|
1795
|
-
|
|
1791
|
+
}
|
|
1792
|
+
var makeRealtimeIndexingStatusProjectionSchema = (valueLabel = "Realtime Indexing Status Projection") => import_v414.z.strictObject({
|
|
1793
|
+
projectedAt: makeUnixTimestampSchema(valueLabel),
|
|
1794
|
+
worstCaseDistance: makeDurationSchema(valueLabel),
|
|
1795
|
+
snapshot: makeCrossChainIndexingStatusSnapshotSchema(valueLabel)
|
|
1796
|
+
}).check(invariant_realtimeIndexingStatusProjectionProjectedAtIsAfterOrEqualToSnapshotTime).check(invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect);
|
|
1797
|
+
|
|
1798
|
+
// src/ensindexer/indexing-status/deserialize/realtime-indexing-status-projection.ts
|
|
1799
|
+
function deserializeRealtimeIndexingStatusProjection(maybeProjection, valueLabel) {
|
|
1800
|
+
const schema = makeRealtimeIndexingStatusProjectionSchema(valueLabel);
|
|
1801
|
+
const parsed = schema.safeParse(maybeProjection);
|
|
1802
|
+
if (parsed.error) {
|
|
1803
|
+
throw new Error(
|
|
1804
|
+
`Cannot deserialize into RealtimeIndexingStatusProjection:
|
|
1805
|
+
${(0, import_v415.prettifyError)(parsed.error)}
|
|
1806
|
+
`
|
|
1807
|
+
);
|
|
1808
|
+
}
|
|
1809
|
+
return parsed.data;
|
|
1796
1810
|
}
|
|
1797
1811
|
|
|
1798
|
-
// src/ensindexer/indexing-status/projection.ts
|
|
1812
|
+
// src/ensindexer/indexing-status/realtime-indexing-status-projection.ts
|
|
1799
1813
|
function createRealtimeIndexingStatusProjection(snapshot, now) {
|
|
1800
1814
|
const projectedAt = Math.max(now, snapshot.snapshotTime);
|
|
1801
1815
|
return {
|
|
@@ -1889,7 +1903,7 @@ function serializeOmnichainIndexingStatusSnapshot(indexingStatus) {
|
|
|
1889
1903
|
}
|
|
1890
1904
|
}
|
|
1891
1905
|
|
|
1892
|
-
// src/ensindexer/indexing-status/serialize.ts
|
|
1906
|
+
// src/ensindexer/indexing-status/serialize/cross-chain-indexing-status-snapshot.ts
|
|
1893
1907
|
function serializeCrossChainIndexingStatusSnapshotOmnichain({
|
|
1894
1908
|
strategy,
|
|
1895
1909
|
slowestChainIndexingCursor,
|
|
@@ -1903,6 +1917,8 @@ function serializeCrossChainIndexingStatusSnapshotOmnichain({
|
|
|
1903
1917
|
omnichainSnapshot: serializeOmnichainIndexingStatusSnapshot(omnichainSnapshot)
|
|
1904
1918
|
};
|
|
1905
1919
|
}
|
|
1920
|
+
|
|
1921
|
+
// src/ensindexer/indexing-status/serialize/realtime-indexing-status-projection.ts
|
|
1906
1922
|
function serializeRealtimeIndexingStatusProjection(indexingProjection) {
|
|
1907
1923
|
return {
|
|
1908
1924
|
projectedAt: indexingProjection.projectedAt,
|
|
@@ -1912,13 +1928,13 @@ function serializeRealtimeIndexingStatusProjection(indexingProjection) {
|
|
|
1912
1928
|
}
|
|
1913
1929
|
|
|
1914
1930
|
// src/ensindexer/indexing-status/validate/chain-indexing-status-snapshot.ts
|
|
1915
|
-
var
|
|
1931
|
+
var import_v416 = require("zod/v4");
|
|
1916
1932
|
function validateChainIndexingStatusSnapshot(unvalidatedSnapshot, valueLabel) {
|
|
1917
1933
|
const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
|
|
1918
1934
|
const parsed = schema.safeParse(unvalidatedSnapshot);
|
|
1919
1935
|
if (parsed.error) {
|
|
1920
1936
|
throw new Error(`Invalid ChainIndexingStatusSnapshot:
|
|
1921
|
-
${(0,
|
|
1937
|
+
${(0, import_v416.prettifyError)(parsed.error)}
|
|
1922
1938
|
`);
|
|
1923
1939
|
}
|
|
1924
1940
|
return parsed.data;
|
|
@@ -1945,10 +1961,10 @@ function serializeConfigResponse(response) {
|
|
|
1945
1961
|
}
|
|
1946
1962
|
|
|
1947
1963
|
// src/api/indexing-status/deserialize.ts
|
|
1948
|
-
var
|
|
1964
|
+
var import_v418 = require("zod/v4");
|
|
1949
1965
|
|
|
1950
1966
|
// src/api/indexing-status/zod-schemas.ts
|
|
1951
|
-
var
|
|
1967
|
+
var import_v417 = require("zod/v4");
|
|
1952
1968
|
|
|
1953
1969
|
// src/api/indexing-status/response.ts
|
|
1954
1970
|
var IndexingStatusResponseCodes = {
|
|
@@ -1963,14 +1979,14 @@ var IndexingStatusResponseCodes = {
|
|
|
1963
1979
|
};
|
|
1964
1980
|
|
|
1965
1981
|
// src/api/indexing-status/zod-schemas.ts
|
|
1966
|
-
var makeIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") =>
|
|
1967
|
-
responseCode:
|
|
1982
|
+
var makeIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => import_v417.z.strictObject({
|
|
1983
|
+
responseCode: import_v417.z.literal(IndexingStatusResponseCodes.Ok),
|
|
1968
1984
|
realtimeProjection: makeRealtimeIndexingStatusProjectionSchema(valueLabel)
|
|
1969
1985
|
});
|
|
1970
|
-
var makeIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") =>
|
|
1971
|
-
responseCode:
|
|
1986
|
+
var makeIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => import_v417.z.strictObject({
|
|
1987
|
+
responseCode: import_v417.z.literal(IndexingStatusResponseCodes.Error)
|
|
1972
1988
|
});
|
|
1973
|
-
var makeIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") =>
|
|
1989
|
+
var makeIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => import_v417.z.discriminatedUnion("responseCode", [
|
|
1974
1990
|
makeIndexingStatusResponseOkSchema(valueLabel),
|
|
1975
1991
|
makeIndexingStatusResponseErrorSchema(valueLabel)
|
|
1976
1992
|
]);
|
|
@@ -1980,7 +1996,7 @@ function deserializeIndexingStatusResponse(maybeResponse) {
|
|
|
1980
1996
|
const parsed = makeIndexingStatusResponseSchema().safeParse(maybeResponse);
|
|
1981
1997
|
if (parsed.error) {
|
|
1982
1998
|
throw new Error(`Cannot deserialize IndexingStatusResponse:
|
|
1983
|
-
${(0,
|
|
1999
|
+
${(0, import_v418.prettifyError)(parsed.error)}
|
|
1984
2000
|
`);
|
|
1985
2001
|
}
|
|
1986
2002
|
return parsed.data;
|
|
@@ -2000,20 +2016,20 @@ function serializeIndexingStatusResponse(response) {
|
|
|
2000
2016
|
}
|
|
2001
2017
|
|
|
2002
2018
|
// src/api/name-tokens/deserialize.ts
|
|
2003
|
-
var
|
|
2019
|
+
var import_v423 = require("zod/v4");
|
|
2004
2020
|
|
|
2005
2021
|
// src/api/name-tokens/zod-schemas.ts
|
|
2006
2022
|
var import_viem14 = require("viem");
|
|
2007
|
-
var
|
|
2023
|
+
var import_v422 = require("zod/v4");
|
|
2008
2024
|
|
|
2009
2025
|
// src/tokenscope/assets.ts
|
|
2010
2026
|
var import_viem13 = require("viem");
|
|
2011
|
-
var
|
|
2027
|
+
var import_v420 = require("zod/v4");
|
|
2012
2028
|
|
|
2013
2029
|
// src/tokenscope/zod-schemas.ts
|
|
2014
2030
|
var import_caip3 = require("caip");
|
|
2015
2031
|
var import_viem12 = require("viem");
|
|
2016
|
-
var
|
|
2032
|
+
var import_v419 = require("zod/v4");
|
|
2017
2033
|
|
|
2018
2034
|
// src/shared/types.ts
|
|
2019
2035
|
var AssetNamespaces = {
|
|
@@ -2136,10 +2152,10 @@ function getNameTokenOwnership(namespaceId, name, owner) {
|
|
|
2136
2152
|
}
|
|
2137
2153
|
|
|
2138
2154
|
// src/tokenscope/zod-schemas.ts
|
|
2139
|
-
var tokenIdSchemaSerializable =
|
|
2140
|
-
var tokenIdSchemaNative =
|
|
2155
|
+
var tokenIdSchemaSerializable = import_v419.z.string();
|
|
2156
|
+
var tokenIdSchemaNative = import_v419.z.preprocess(
|
|
2141
2157
|
(v) => typeof v === "string" ? BigInt(v) : v,
|
|
2142
|
-
|
|
2158
|
+
import_v419.z.bigint().positive()
|
|
2143
2159
|
);
|
|
2144
2160
|
function makeTokenIdSchema(_valueLabel = "Token ID Schema", serializable = false) {
|
|
2145
2161
|
if (serializable) {
|
|
@@ -2149,13 +2165,13 @@ function makeTokenIdSchema(_valueLabel = "Token ID Schema", serializable = false
|
|
|
2149
2165
|
}
|
|
2150
2166
|
}
|
|
2151
2167
|
var makeAssetIdSchema = (valueLabel = "Asset ID Schema", serializable) => {
|
|
2152
|
-
return
|
|
2153
|
-
assetNamespace:
|
|
2168
|
+
return import_v419.z.object({
|
|
2169
|
+
assetNamespace: import_v419.z.enum(AssetNamespaces),
|
|
2154
2170
|
contract: makeAccountIdSchema(valueLabel),
|
|
2155
2171
|
tokenId: makeTokenIdSchema(valueLabel, serializable ?? false)
|
|
2156
2172
|
});
|
|
2157
2173
|
};
|
|
2158
|
-
var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") =>
|
|
2174
|
+
var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") => import_v419.z.preprocess((v) => {
|
|
2159
2175
|
if (typeof v === "string") {
|
|
2160
2176
|
const result = new import_caip3.AssetId(v);
|
|
2161
2177
|
return {
|
|
@@ -2179,20 +2195,20 @@ function invariant_nameTokenOwnershipHasNonZeroAddressOwner(ctx) {
|
|
|
2179
2195
|
});
|
|
2180
2196
|
}
|
|
2181
2197
|
}
|
|
2182
|
-
var makeNameTokenOwnershipNameWrapperSchema = (valueLabel = "Name Token Ownership NameWrapper") =>
|
|
2183
|
-
ownershipType:
|
|
2198
|
+
var makeNameTokenOwnershipNameWrapperSchema = (valueLabel = "Name Token Ownership NameWrapper") => import_v419.z.object({
|
|
2199
|
+
ownershipType: import_v419.z.literal(NameTokenOwnershipTypes.NameWrapper),
|
|
2184
2200
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2185
2201
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2186
|
-
var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") =>
|
|
2187
|
-
ownershipType:
|
|
2202
|
+
var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") => import_v419.z.object({
|
|
2203
|
+
ownershipType: import_v419.z.literal(NameTokenOwnershipTypes.FullyOnchain),
|
|
2188
2204
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2189
2205
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2190
|
-
var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") =>
|
|
2191
|
-
ownershipType:
|
|
2206
|
+
var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") => import_v419.z.object({
|
|
2207
|
+
ownershipType: import_v419.z.literal(NameTokenOwnershipTypes.Burned),
|
|
2192
2208
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2193
2209
|
}).check(invariant_nameTokenOwnershipHasZeroAddressOwner);
|
|
2194
|
-
var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") =>
|
|
2195
|
-
ownershipType:
|
|
2210
|
+
var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") => import_v419.z.object({
|
|
2211
|
+
ownershipType: import_v419.z.literal(NameTokenOwnershipTypes.Unknown),
|
|
2196
2212
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2197
2213
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2198
2214
|
function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
|
|
@@ -2205,16 +2221,16 @@ function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
|
|
|
2205
2221
|
});
|
|
2206
2222
|
}
|
|
2207
2223
|
}
|
|
2208
|
-
var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") =>
|
|
2224
|
+
var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") => import_v419.z.discriminatedUnion("ownershipType", [
|
|
2209
2225
|
makeNameTokenOwnershipNameWrapperSchema(valueLabel),
|
|
2210
2226
|
makeNameTokenOwnershipFullyOnchainSchema(valueLabel),
|
|
2211
2227
|
makeNameTokenOwnershipBurnedSchema(valueLabel),
|
|
2212
2228
|
makeNameTokenOwnershipUnknownSchema(valueLabel)
|
|
2213
2229
|
]);
|
|
2214
|
-
var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) =>
|
|
2230
|
+
var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) => import_v419.z.object({
|
|
2215
2231
|
token: makeAssetIdSchema(`${valueLabel}.token`, serializable),
|
|
2216
2232
|
ownership: makeNameTokenOwnershipSchema(`${valueLabel}.ownership`),
|
|
2217
|
-
mintStatus:
|
|
2233
|
+
mintStatus: import_v419.z.enum(NFTMintStatuses)
|
|
2218
2234
|
});
|
|
2219
2235
|
|
|
2220
2236
|
// src/tokenscope/assets.ts
|
|
@@ -2230,7 +2246,7 @@ function deserializeAssetId(maybeAssetId, valueLabel) {
|
|
|
2230
2246
|
const parsed = schema.safeParse(maybeAssetId);
|
|
2231
2247
|
if (parsed.error) {
|
|
2232
2248
|
throw new RangeError(`Cannot deserialize AssetId:
|
|
2233
|
-
${(0,
|
|
2249
|
+
${(0, import_v420.prettifyError)(parsed.error)}
|
|
2234
2250
|
`);
|
|
2235
2251
|
}
|
|
2236
2252
|
return parsed.data;
|
|
@@ -2240,7 +2256,7 @@ function parseAssetId(maybeAssetId, valueLabel) {
|
|
|
2240
2256
|
const parsed = schema.safeParse(maybeAssetId);
|
|
2241
2257
|
if (parsed.error) {
|
|
2242
2258
|
throw new RangeError(`Cannot parse AssetId:
|
|
2243
|
-
${(0,
|
|
2259
|
+
${(0, import_v420.prettifyError)(parsed.error)}
|
|
2244
2260
|
`);
|
|
2245
2261
|
}
|
|
2246
2262
|
return parsed.data;
|
|
@@ -2462,10 +2478,10 @@ ${formatNFTTransferEventMetadata(metadata)}`
|
|
|
2462
2478
|
};
|
|
2463
2479
|
|
|
2464
2480
|
// src/api/shared/errors/zod-schemas.ts
|
|
2465
|
-
var
|
|
2466
|
-
var ErrorResponseSchema =
|
|
2467
|
-
message:
|
|
2468
|
-
details:
|
|
2481
|
+
var import_v421 = require("zod/v4");
|
|
2482
|
+
var ErrorResponseSchema = import_v421.z.object({
|
|
2483
|
+
message: import_v421.z.string(),
|
|
2484
|
+
details: import_v421.z.optional(import_v421.z.unknown())
|
|
2469
2485
|
});
|
|
2470
2486
|
|
|
2471
2487
|
// src/api/name-tokens/response.ts
|
|
@@ -2504,10 +2520,10 @@ var NameTokensResponseErrorCodes = {
|
|
|
2504
2520
|
};
|
|
2505
2521
|
|
|
2506
2522
|
// src/api/name-tokens/zod-schemas.ts
|
|
2507
|
-
var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) =>
|
|
2523
|
+
var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) => import_v422.z.object({
|
|
2508
2524
|
domainId: makeNodeSchema(`${valueLabel}.domainId`),
|
|
2509
2525
|
name: makeReinterpretedNameSchema(valueLabel),
|
|
2510
|
-
tokens:
|
|
2526
|
+
tokens: import_v422.z.array(makeNameTokenSchema(`${valueLabel}.tokens`, serializable)).nonempty(),
|
|
2511
2527
|
expiresAt: makeUnixTimestampSchema(`${valueLabel}.expiresAt`),
|
|
2512
2528
|
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
|
|
2513
2529
|
}).check(function invariant_nameIsAssociatedWithDomainId(ctx) {
|
|
@@ -2549,32 +2565,32 @@ var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", seria
|
|
|
2549
2565
|
});
|
|
2550
2566
|
}
|
|
2551
2567
|
});
|
|
2552
|
-
var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) =>
|
|
2553
|
-
responseCode:
|
|
2568
|
+
var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) => import_v422.z.strictObject({
|
|
2569
|
+
responseCode: import_v422.z.literal(NameTokensResponseCodes.Ok),
|
|
2554
2570
|
registeredNameTokens: makeRegisteredNameTokenSchema(`${valueLabel}.nameTokens`, serializable)
|
|
2555
2571
|
});
|
|
2556
|
-
var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") =>
|
|
2557
|
-
responseCode:
|
|
2558
|
-
errorCode:
|
|
2572
|
+
var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") => import_v422.z.strictObject({
|
|
2573
|
+
responseCode: import_v422.z.literal(NameTokensResponseCodes.Error),
|
|
2574
|
+
errorCode: import_v422.z.literal(NameTokensResponseErrorCodes.NameTokensNotIndexed),
|
|
2559
2575
|
error: ErrorResponseSchema
|
|
2560
2576
|
});
|
|
2561
|
-
var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") =>
|
|
2562
|
-
responseCode:
|
|
2563
|
-
errorCode:
|
|
2577
|
+
var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") => import_v422.z.strictObject({
|
|
2578
|
+
responseCode: import_v422.z.literal(NameTokensResponseCodes.Error),
|
|
2579
|
+
errorCode: import_v422.z.literal(NameTokensResponseErrorCodes.EnsIndexerConfigUnsupported),
|
|
2564
2580
|
error: ErrorResponseSchema
|
|
2565
2581
|
});
|
|
2566
|
-
var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") =>
|
|
2567
|
-
responseCode:
|
|
2568
|
-
errorCode:
|
|
2582
|
+
var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") => import_v422.z.strictObject({
|
|
2583
|
+
responseCode: import_v422.z.literal(NameTokensResponseCodes.Error),
|
|
2584
|
+
errorCode: import_v422.z.literal(NameTokensResponseErrorCodes.IndexingStatusUnsupported),
|
|
2569
2585
|
error: ErrorResponseSchema
|
|
2570
2586
|
});
|
|
2571
|
-
var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") =>
|
|
2587
|
+
var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") => import_v422.z.discriminatedUnion("errorCode", [
|
|
2572
2588
|
makeNameTokensResponseErrorNameTokensNotIndexedSchema(valueLabel),
|
|
2573
2589
|
makeNameTokensResponseErrorEnsIndexerConfigUnsupported(valueLabel),
|
|
2574
2590
|
makeNameTokensResponseErrorNameIndexingStatusUnsupported(valueLabel)
|
|
2575
2591
|
]);
|
|
2576
2592
|
var makeNameTokensResponseSchema = (valueLabel = "Name Tokens Response", serializable) => {
|
|
2577
|
-
return
|
|
2593
|
+
return import_v422.z.discriminatedUnion("responseCode", [
|
|
2578
2594
|
makeNameTokensResponseOkSchema(valueLabel, serializable ?? false),
|
|
2579
2595
|
makeNameTokensResponseErrorSchema(valueLabel)
|
|
2580
2596
|
]);
|
|
@@ -2587,7 +2603,7 @@ function deserializedNameTokensResponse(maybeResponse) {
|
|
|
2587
2603
|
);
|
|
2588
2604
|
if (parsed.error) {
|
|
2589
2605
|
throw new Error(`Cannot deserialize NameTokensResponse:
|
|
2590
|
-
${(0,
|
|
2606
|
+
${(0, import_v423.prettifyError)(parsed.error)}
|
|
2591
2607
|
`);
|
|
2592
2608
|
}
|
|
2593
2609
|
return parsed.data;
|
|
@@ -2661,14 +2677,14 @@ function serializeNameTokensResponse(response) {
|
|
|
2661
2677
|
}
|
|
2662
2678
|
|
|
2663
2679
|
// src/api/registrar-actions/deserialize.ts
|
|
2664
|
-
var
|
|
2680
|
+
var import_v427 = require("zod/v4");
|
|
2665
2681
|
|
|
2666
2682
|
// src/api/registrar-actions/zod-schemas.ts
|
|
2667
2683
|
var import_ens7 = require("viem/ens");
|
|
2668
|
-
var
|
|
2684
|
+
var import_v426 = require("zod/v4");
|
|
2669
2685
|
|
|
2670
2686
|
// src/registrars/zod-schemas.ts
|
|
2671
|
-
var
|
|
2687
|
+
var import_v424 = require("zod/v4");
|
|
2672
2688
|
|
|
2673
2689
|
// src/registrars/encoded-referrer.ts
|
|
2674
2690
|
var import_viem15 = require("viem");
|
|
@@ -2743,11 +2759,11 @@ function serializeRegistrarAction(registrarAction) {
|
|
|
2743
2759
|
}
|
|
2744
2760
|
|
|
2745
2761
|
// src/registrars/zod-schemas.ts
|
|
2746
|
-
var makeSubregistrySchema = (valueLabel = "Subregistry") =>
|
|
2762
|
+
var makeSubregistrySchema = (valueLabel = "Subregistry") => import_v424.z.object({
|
|
2747
2763
|
subregistryId: makeAccountIdSchema(`${valueLabel} Subregistry ID`),
|
|
2748
2764
|
node: makeNodeSchema(`${valueLabel} Node`)
|
|
2749
2765
|
});
|
|
2750
|
-
var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") =>
|
|
2766
|
+
var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") => import_v424.z.object({
|
|
2751
2767
|
subregistry: makeSubregistrySchema(`${valueLabel} Subregistry`),
|
|
2752
2768
|
node: makeNodeSchema(`${valueLabel} Node`),
|
|
2753
2769
|
expiresAt: makeUnixTimestampSchema(`${valueLabel} Expires at`)
|
|
@@ -2763,18 +2779,18 @@ function invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium(ctx) {
|
|
|
2763
2779
|
});
|
|
2764
2780
|
}
|
|
2765
2781
|
}
|
|
2766
|
-
var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") =>
|
|
2782
|
+
var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") => import_v424.z.union([
|
|
2767
2783
|
// pricing available
|
|
2768
|
-
|
|
2784
|
+
import_v424.z.object({
|
|
2769
2785
|
baseCost: makePriceEthSchema(`${valueLabel} Base Cost`),
|
|
2770
2786
|
premium: makePriceEthSchema(`${valueLabel} Premium`),
|
|
2771
2787
|
total: makePriceEthSchema(`${valueLabel} Total`)
|
|
2772
2788
|
}).check(invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium).transform((v) => v),
|
|
2773
2789
|
// pricing unknown
|
|
2774
|
-
|
|
2775
|
-
baseCost:
|
|
2776
|
-
premium:
|
|
2777
|
-
total:
|
|
2790
|
+
import_v424.z.object({
|
|
2791
|
+
baseCost: import_v424.z.null(),
|
|
2792
|
+
premium: import_v424.z.null(),
|
|
2793
|
+
total: import_v424.z.null()
|
|
2778
2794
|
}).transform((v) => v)
|
|
2779
2795
|
]);
|
|
2780
2796
|
function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
|
|
@@ -2797,9 +2813,9 @@ function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
|
|
|
2797
2813
|
});
|
|
2798
2814
|
}
|
|
2799
2815
|
}
|
|
2800
|
-
var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") =>
|
|
2816
|
+
var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") => import_v424.z.union([
|
|
2801
2817
|
// referral available
|
|
2802
|
-
|
|
2818
|
+
import_v424.z.object({
|
|
2803
2819
|
encodedReferrer: makeHexStringSchema(
|
|
2804
2820
|
{ bytesCount: ENCODED_REFERRER_BYTE_LENGTH },
|
|
2805
2821
|
`${valueLabel} Encoded Referrer`
|
|
@@ -2807,9 +2823,9 @@ var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral
|
|
|
2807
2823
|
decodedReferrer: makeLowercaseAddressSchema(`${valueLabel} Decoded Referrer`)
|
|
2808
2824
|
}).check(invariant_registrarActionDecodedReferrerBasedOnRawReferrer),
|
|
2809
2825
|
// referral not applicable
|
|
2810
|
-
|
|
2811
|
-
encodedReferrer:
|
|
2812
|
-
decodedReferrer:
|
|
2826
|
+
import_v424.z.object({
|
|
2827
|
+
encodedReferrer: import_v424.z.null(),
|
|
2828
|
+
decodedReferrer: import_v424.z.null()
|
|
2813
2829
|
})
|
|
2814
2830
|
]);
|
|
2815
2831
|
function invariant_eventIdsInitialElementIsTheActionId(ctx) {
|
|
@@ -2822,9 +2838,9 @@ function invariant_eventIdsInitialElementIsTheActionId(ctx) {
|
|
|
2822
2838
|
});
|
|
2823
2839
|
}
|
|
2824
2840
|
}
|
|
2825
|
-
var EventIdSchema =
|
|
2826
|
-
var EventIdsSchema =
|
|
2827
|
-
var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") =>
|
|
2841
|
+
var EventIdSchema = import_v424.z.string().nonempty();
|
|
2842
|
+
var EventIdsSchema = import_v424.z.array(EventIdSchema).min(1).transform((v) => v);
|
|
2843
|
+
var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => import_v424.z.object({
|
|
2828
2844
|
id: EventIdSchema,
|
|
2829
2845
|
incrementalDuration: makeDurationSchema(`${valueLabel} Incremental Duration`),
|
|
2830
2846
|
registrant: makeLowercaseAddressSchema(`${valueLabel} Registrant`),
|
|
@@ -2838,38 +2854,38 @@ var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => im
|
|
|
2838
2854
|
eventIds: EventIdsSchema
|
|
2839
2855
|
}).check(invariant_eventIdsInitialElementIsTheActionId);
|
|
2840
2856
|
var makeRegistrarActionRegistrationSchema = (valueLabel = "Registration ") => makeBaseRegistrarActionSchema(valueLabel).extend({
|
|
2841
|
-
type:
|
|
2857
|
+
type: import_v424.z.literal(RegistrarActionTypes.Registration)
|
|
2842
2858
|
});
|
|
2843
2859
|
var makeRegistrarActionRenewalSchema = (valueLabel = "Renewal") => makeBaseRegistrarActionSchema(valueLabel).extend({
|
|
2844
|
-
type:
|
|
2860
|
+
type: import_v424.z.literal(RegistrarActionTypes.Renewal)
|
|
2845
2861
|
});
|
|
2846
|
-
var makeRegistrarActionSchema = (valueLabel = "Registrar Action") =>
|
|
2862
|
+
var makeRegistrarActionSchema = (valueLabel = "Registrar Action") => import_v424.z.discriminatedUnion("type", [
|
|
2847
2863
|
makeRegistrarActionRegistrationSchema(`${valueLabel} Registration`),
|
|
2848
2864
|
makeRegistrarActionRenewalSchema(`${valueLabel} Renewal`)
|
|
2849
2865
|
]);
|
|
2850
2866
|
|
|
2851
2867
|
// src/api/shared/pagination/zod-schemas.ts
|
|
2852
|
-
var
|
|
2868
|
+
var import_v425 = require("zod/v4");
|
|
2853
2869
|
|
|
2854
2870
|
// src/api/shared/pagination/request.ts
|
|
2855
2871
|
var RECORDS_PER_PAGE_DEFAULT = 10;
|
|
2856
2872
|
var RECORDS_PER_PAGE_MAX = 100;
|
|
2857
2873
|
|
|
2858
2874
|
// src/api/shared/pagination/zod-schemas.ts
|
|
2859
|
-
var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") =>
|
|
2875
|
+
var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") => import_v425.z.object({
|
|
2860
2876
|
page: makePositiveIntegerSchema(`${valueLabel}.page`),
|
|
2861
2877
|
recordsPerPage: makePositiveIntegerSchema(`${valueLabel}.recordsPerPage`).max(
|
|
2862
2878
|
RECORDS_PER_PAGE_MAX,
|
|
2863
2879
|
`${valueLabel}.recordsPerPage must not exceed ${RECORDS_PER_PAGE_MAX}`
|
|
2864
2880
|
)
|
|
2865
2881
|
});
|
|
2866
|
-
var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") =>
|
|
2867
|
-
totalRecords:
|
|
2868
|
-
totalPages:
|
|
2869
|
-
hasNext:
|
|
2870
|
-
hasPrev:
|
|
2871
|
-
startIndex:
|
|
2872
|
-
endIndex:
|
|
2882
|
+
var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") => import_v425.z.object({
|
|
2883
|
+
totalRecords: import_v425.z.literal(0),
|
|
2884
|
+
totalPages: import_v425.z.literal(1),
|
|
2885
|
+
hasNext: import_v425.z.literal(false),
|
|
2886
|
+
hasPrev: import_v425.z.literal(false),
|
|
2887
|
+
startIndex: import_v425.z.undefined(),
|
|
2888
|
+
endIndex: import_v425.z.undefined()
|
|
2873
2889
|
}).extend(makeRequestPageParamsSchema(valueLabel).shape);
|
|
2874
2890
|
function invariant_responsePageWithRecordsIsCorrect(ctx) {
|
|
2875
2891
|
const { hasNext, hasPrev, recordsPerPage, page, totalRecords, startIndex, endIndex } = ctx.value;
|
|
@@ -2904,15 +2920,15 @@ function invariant_responsePageWithRecordsIsCorrect(ctx) {
|
|
|
2904
2920
|
});
|
|
2905
2921
|
}
|
|
2906
2922
|
}
|
|
2907
|
-
var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") =>
|
|
2923
|
+
var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") => import_v425.z.object({
|
|
2908
2924
|
totalRecords: makePositiveIntegerSchema(`${valueLabel}.totalRecords`),
|
|
2909
2925
|
totalPages: makePositiveIntegerSchema(`${valueLabel}.totalPages`),
|
|
2910
|
-
hasNext:
|
|
2911
|
-
hasPrev:
|
|
2926
|
+
hasNext: import_v425.z.boolean(),
|
|
2927
|
+
hasPrev: import_v425.z.boolean(),
|
|
2912
2928
|
startIndex: makeNonNegativeIntegerSchema(`${valueLabel}.startIndex`),
|
|
2913
2929
|
endIndex: makeNonNegativeIntegerSchema(`${valueLabel}.endIndex`)
|
|
2914
2930
|
}).extend(makeRequestPageParamsSchema(valueLabel).shape).check(invariant_responsePageWithRecordsIsCorrect);
|
|
2915
|
-
var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") =>
|
|
2931
|
+
var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") => import_v425.z.union([
|
|
2916
2932
|
makeResponsePageContextSchemaWithNoRecords(valueLabel),
|
|
2917
2933
|
makeResponsePageContextSchemaWithRecords(valueLabel)
|
|
2918
2934
|
]);
|
|
@@ -2942,21 +2958,21 @@ function invariant_registrationLifecycleNodeMatchesName(ctx) {
|
|
|
2942
2958
|
});
|
|
2943
2959
|
}
|
|
2944
2960
|
}
|
|
2945
|
-
var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") =>
|
|
2961
|
+
var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") => import_v426.z.object({
|
|
2946
2962
|
action: makeRegistrarActionSchema(valueLabel),
|
|
2947
2963
|
name: makeReinterpretedNameSchema(valueLabel)
|
|
2948
2964
|
}).check(invariant_registrationLifecycleNodeMatchesName);
|
|
2949
|
-
var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") =>
|
|
2950
|
-
responseCode:
|
|
2951
|
-
registrarActions:
|
|
2965
|
+
var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") => import_v426.z.object({
|
|
2966
|
+
responseCode: import_v426.z.literal(RegistrarActionsResponseCodes.Ok),
|
|
2967
|
+
registrarActions: import_v426.z.array(makeNamedRegistrarActionSchema(valueLabel)),
|
|
2952
2968
|
pageContext: makeResponsePageContextSchema(`${valueLabel}.pageContext`),
|
|
2953
2969
|
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`).optional()
|
|
2954
2970
|
});
|
|
2955
|
-
var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") =>
|
|
2956
|
-
responseCode:
|
|
2971
|
+
var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") => import_v426.z.strictObject({
|
|
2972
|
+
responseCode: import_v426.z.literal(RegistrarActionsResponseCodes.Error),
|
|
2957
2973
|
error: ErrorResponseSchema
|
|
2958
2974
|
});
|
|
2959
|
-
var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") =>
|
|
2975
|
+
var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") => import_v426.z.discriminatedUnion("responseCode", [
|
|
2960
2976
|
makeRegistrarActionsResponseOkSchema(valueLabel),
|
|
2961
2977
|
makeRegistrarActionsResponseErrorSchema(valueLabel)
|
|
2962
2978
|
]);
|
|
@@ -2967,7 +2983,7 @@ function deserializeRegistrarActionsResponse(maybeResponse) {
|
|
|
2967
2983
|
if (parsed.error) {
|
|
2968
2984
|
throw new Error(
|
|
2969
2985
|
`Cannot deserialize RegistrarActionsResponse:
|
|
2970
|
-
${(0,
|
|
2986
|
+
${(0, import_v427.prettifyError)(parsed.error)}
|
|
2971
2987
|
`
|
|
2972
2988
|
);
|
|
2973
2989
|
}
|
|
@@ -3215,12 +3231,12 @@ function serializeRegistrarActionsResponse(response) {
|
|
|
3215
3231
|
}
|
|
3216
3232
|
|
|
3217
3233
|
// src/api/shared/errors/deserialize.ts
|
|
3218
|
-
var
|
|
3234
|
+
var import_v428 = require("zod/v4");
|
|
3219
3235
|
function deserializeErrorResponse(maybeErrorResponse) {
|
|
3220
3236
|
const parsed = ErrorResponseSchema.safeParse(maybeErrorResponse);
|
|
3221
3237
|
if (parsed.error) {
|
|
3222
3238
|
throw new Error(`Cannot deserialize ErrorResponse:
|
|
3223
|
-
${(0,
|
|
3239
|
+
${(0, import_v428.prettifyError)(parsed.error)}
|
|
3224
3240
|
`);
|
|
3225
3241
|
}
|
|
3226
3242
|
return parsed.data;
|