@ensnode/ensnode-sdk 0.0.0-next-20260211153531 → 0.0.0-next-20260213092129
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 +358 -352
- 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 +344 -338
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -230,7 +230,6 @@ __export(index_exports, {
|
|
|
230
230
|
serializeChainId: () => serializeChainId,
|
|
231
231
|
serializeChainIndexingSnapshots: () => serializeChainIndexingSnapshots,
|
|
232
232
|
serializeConfigResponse: () => serializeConfigResponse,
|
|
233
|
-
serializeCrossChainIndexingStatusSnapshotOmnichain: () => serializeCrossChainIndexingStatusSnapshotOmnichain,
|
|
234
233
|
serializeDatetime: () => serializeDatetime,
|
|
235
234
|
serializeDomainAssetId: () => serializeDomainAssetId,
|
|
236
235
|
serializeENSApiPublicConfig: () => serializeENSApiPublicConfig,
|
|
@@ -1132,13 +1131,7 @@ function sortChainStatusesByStartBlockAsc(chains) {
|
|
|
1132
1131
|
);
|
|
1133
1132
|
}
|
|
1134
1133
|
|
|
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
|
|
1134
|
+
// src/ensindexer/indexing-status/cross-chain-indexing-status-snapshot.ts
|
|
1142
1135
|
var CrossChainIndexingStrategyIds = {
|
|
1143
1136
|
/**
|
|
1144
1137
|
* Represents that the indexing of events across all indexed chains will
|
|
@@ -1156,80 +1149,187 @@ var CrossChainIndexingStrategyIds = {
|
|
|
1156
1149
|
*/
|
|
1157
1150
|
Omnichain: "omnichain"
|
|
1158
1151
|
};
|
|
1152
|
+
function getLatestIndexedBlockRef(indexingStatus, chainId) {
|
|
1153
|
+
const chainIndexingStatus = indexingStatus.omnichainSnapshot.chains.get(chainId);
|
|
1154
|
+
if (chainIndexingStatus === void 0) {
|
|
1155
|
+
return null;
|
|
1156
|
+
}
|
|
1157
|
+
if (chainIndexingStatus.chainStatus === ChainIndexingStatusIds.Queued) {
|
|
1158
|
+
return null;
|
|
1159
|
+
}
|
|
1160
|
+
return chainIndexingStatus.latestIndexedBlock;
|
|
1161
|
+
}
|
|
1159
1162
|
|
|
1160
|
-
// src/ensindexer/indexing-status/
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1163
|
+
// src/ensindexer/indexing-status/deserialize/chain-indexing-status-snapshot.ts
|
|
1164
|
+
var import_v48 = require("zod/v4");
|
|
1165
|
+
|
|
1166
|
+
// src/ensindexer/indexing-status/zod-schema/chain-indexing-status-snapshot.ts
|
|
1167
|
+
var import_v47 = require("zod/v4");
|
|
1168
|
+
|
|
1169
|
+
// src/shared/block-ref.ts
|
|
1170
|
+
function isBefore(blockA, blockB) {
|
|
1171
|
+
return blockA.number < blockB.number && blockA.timestamp < blockB.timestamp;
|
|
1172
|
+
}
|
|
1173
|
+
function isEqualTo(blockA, blockB) {
|
|
1174
|
+
return blockA.number === blockB.number && blockA.timestamp === blockB.timestamp;
|
|
1175
|
+
}
|
|
1176
|
+
function isBeforeOrEqualTo(blockA, blockB) {
|
|
1177
|
+
return isBefore(blockA, blockB) || isEqualTo(blockA, blockB);
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
// src/ensindexer/indexing-status/zod-schema/chain-indexing-status-snapshot.ts
|
|
1181
|
+
function invariant_chainSnapshotQueuedBlocks(ctx) {
|
|
1182
|
+
const { config } = ctx.value;
|
|
1183
|
+
if (config.configType === ChainIndexingConfigTypeIds.Indefinite) {
|
|
1184
|
+
return;
|
|
1185
|
+
}
|
|
1186
|
+
if (isBeforeOrEqualTo(config.startBlock, config.endBlock) === false) {
|
|
1169
1187
|
ctx.issues.push({
|
|
1170
1188
|
code: "custom",
|
|
1171
1189
|
input: ctx.value,
|
|
1172
|
-
message: `
|
|
1190
|
+
message: "`config.startBlock` must be before or same as `config.endBlock`."
|
|
1173
1191
|
});
|
|
1174
1192
|
}
|
|
1175
1193
|
}
|
|
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) {
|
|
1194
|
+
function invariant_chainSnapshotBackfillBlocks(ctx) {
|
|
1195
|
+
const { config, latestIndexedBlock, backfillEndBlock } = ctx.value;
|
|
1196
|
+
if (isBeforeOrEqualTo(config.startBlock, latestIndexedBlock) === false) {
|
|
1190
1197
|
ctx.issues.push({
|
|
1191
1198
|
code: "custom",
|
|
1192
1199
|
input: ctx.value,
|
|
1193
|
-
message: `
|
|
1200
|
+
message: "`config.startBlock` must be before or same as `latestIndexedBlock`."
|
|
1201
|
+
});
|
|
1202
|
+
}
|
|
1203
|
+
if (isBeforeOrEqualTo(latestIndexedBlock, backfillEndBlock) === false) {
|
|
1204
|
+
ctx.issues.push({
|
|
1205
|
+
code: "custom",
|
|
1206
|
+
input: ctx.value,
|
|
1207
|
+
message: "`latestIndexedBlock` must be before or same as `backfillEndBlock`."
|
|
1208
|
+
});
|
|
1209
|
+
}
|
|
1210
|
+
if (config.configType === ChainIndexingConfigTypeIds.Indefinite) {
|
|
1211
|
+
return;
|
|
1212
|
+
}
|
|
1213
|
+
if (isEqualTo(backfillEndBlock, config.endBlock) === false) {
|
|
1214
|
+
ctx.issues.push({
|
|
1215
|
+
code: "custom",
|
|
1216
|
+
input: ctx.value,
|
|
1217
|
+
message: "`backfillEndBlock` must be the same as `config.endBlock`."
|
|
1194
1218
|
});
|
|
1195
1219
|
}
|
|
1196
1220
|
}
|
|
1197
|
-
function
|
|
1198
|
-
const
|
|
1199
|
-
|
|
1200
|
-
if (snapshot.snapshotTime > projectedAt) {
|
|
1221
|
+
function invariant_chainSnapshotCompletedBlocks(ctx) {
|
|
1222
|
+
const { config, latestIndexedBlock } = ctx.value;
|
|
1223
|
+
if (isBeforeOrEqualTo(config.startBlock, latestIndexedBlock) === false) {
|
|
1201
1224
|
ctx.issues.push({
|
|
1202
1225
|
code: "custom",
|
|
1203
|
-
input:
|
|
1204
|
-
message: "`
|
|
1226
|
+
input: ctx.value,
|
|
1227
|
+
message: "`config.startBlock` must be before or same as `latestIndexedBlock`."
|
|
1228
|
+
});
|
|
1229
|
+
}
|
|
1230
|
+
if (isBeforeOrEqualTo(latestIndexedBlock, config.endBlock) === false) {
|
|
1231
|
+
ctx.issues.push({
|
|
1232
|
+
code: "custom",
|
|
1233
|
+
input: ctx.value,
|
|
1234
|
+
message: "`latestIndexedBlock` must be before or same as `config.endBlock`."
|
|
1205
1235
|
});
|
|
1206
1236
|
}
|
|
1207
1237
|
}
|
|
1208
|
-
function
|
|
1209
|
-
const
|
|
1210
|
-
|
|
1211
|
-
const { omnichainSnapshot } = snapshot;
|
|
1212
|
-
const expectedWorstCaseDistance = projectedAt - omnichainSnapshot.omnichainIndexingCursor;
|
|
1213
|
-
if (worstCaseDistance !== expectedWorstCaseDistance) {
|
|
1238
|
+
function invariant_chainSnapshotFollowingBlocks(ctx) {
|
|
1239
|
+
const { config, latestIndexedBlock, latestKnownBlock } = ctx.value;
|
|
1240
|
+
if (isBeforeOrEqualTo(config.startBlock, latestIndexedBlock) === false) {
|
|
1214
1241
|
ctx.issues.push({
|
|
1215
1242
|
code: "custom",
|
|
1216
|
-
input:
|
|
1217
|
-
message: "`
|
|
1243
|
+
input: ctx.value,
|
|
1244
|
+
message: "`config.startBlock` must be before or same as `latestIndexedBlock`."
|
|
1245
|
+
});
|
|
1246
|
+
}
|
|
1247
|
+
if (isBeforeOrEqualTo(latestIndexedBlock, latestKnownBlock) === false) {
|
|
1248
|
+
ctx.issues.push({
|
|
1249
|
+
code: "custom",
|
|
1250
|
+
input: ctx.value,
|
|
1251
|
+
message: "`latestIndexedBlock` must be before or same as `latestKnownBlock`."
|
|
1218
1252
|
});
|
|
1219
1253
|
}
|
|
1220
1254
|
}
|
|
1255
|
+
var makeChainIndexingConfigSchema = (valueLabel = "Value") => import_v47.z.discriminatedUnion("configType", [
|
|
1256
|
+
import_v47.z.object({
|
|
1257
|
+
configType: import_v47.z.literal(ChainIndexingConfigTypeIds.Indefinite),
|
|
1258
|
+
startBlock: makeBlockRefSchema(valueLabel)
|
|
1259
|
+
}),
|
|
1260
|
+
import_v47.z.object({
|
|
1261
|
+
configType: import_v47.z.literal(ChainIndexingConfigTypeIds.Definite),
|
|
1262
|
+
startBlock: makeBlockRefSchema(valueLabel),
|
|
1263
|
+
endBlock: makeBlockRefSchema(valueLabel)
|
|
1264
|
+
})
|
|
1265
|
+
]);
|
|
1266
|
+
var makeChainIndexingStatusSnapshotQueuedSchema = (valueLabel = "Value") => import_v47.z.object({
|
|
1267
|
+
chainStatus: import_v47.z.literal(ChainIndexingStatusIds.Queued),
|
|
1268
|
+
config: makeChainIndexingConfigSchema(valueLabel)
|
|
1269
|
+
}).check(invariant_chainSnapshotQueuedBlocks);
|
|
1270
|
+
var makeChainIndexingStatusSnapshotBackfillSchema = (valueLabel = "Value") => import_v47.z.object({
|
|
1271
|
+
chainStatus: import_v47.z.literal(ChainIndexingStatusIds.Backfill),
|
|
1272
|
+
config: makeChainIndexingConfigSchema(valueLabel),
|
|
1273
|
+
latestIndexedBlock: makeBlockRefSchema(valueLabel),
|
|
1274
|
+
backfillEndBlock: makeBlockRefSchema(valueLabel)
|
|
1275
|
+
}).check(invariant_chainSnapshotBackfillBlocks);
|
|
1276
|
+
var makeChainIndexingStatusSnapshotCompletedSchema = (valueLabel = "Value") => import_v47.z.object({
|
|
1277
|
+
chainStatus: import_v47.z.literal(ChainIndexingStatusIds.Completed),
|
|
1278
|
+
config: import_v47.z.object({
|
|
1279
|
+
configType: import_v47.z.literal(ChainIndexingConfigTypeIds.Definite),
|
|
1280
|
+
startBlock: makeBlockRefSchema(valueLabel),
|
|
1281
|
+
endBlock: makeBlockRefSchema(valueLabel)
|
|
1282
|
+
}),
|
|
1283
|
+
latestIndexedBlock: makeBlockRefSchema(valueLabel)
|
|
1284
|
+
}).check(invariant_chainSnapshotCompletedBlocks);
|
|
1285
|
+
var makeChainIndexingStatusSnapshotFollowingSchema = (valueLabel = "Value") => import_v47.z.object({
|
|
1286
|
+
chainStatus: import_v47.z.literal(ChainIndexingStatusIds.Following),
|
|
1287
|
+
config: import_v47.z.object({
|
|
1288
|
+
configType: import_v47.z.literal(ChainIndexingConfigTypeIds.Indefinite),
|
|
1289
|
+
startBlock: makeBlockRefSchema(valueLabel)
|
|
1290
|
+
}),
|
|
1291
|
+
latestIndexedBlock: makeBlockRefSchema(valueLabel),
|
|
1292
|
+
latestKnownBlock: makeBlockRefSchema(valueLabel)
|
|
1293
|
+
}).check(invariant_chainSnapshotFollowingBlocks);
|
|
1294
|
+
var makeChainIndexingStatusSnapshotSchema = (valueLabel = "Value") => import_v47.z.discriminatedUnion("chainStatus", [
|
|
1295
|
+
makeChainIndexingStatusSnapshotQueuedSchema(valueLabel),
|
|
1296
|
+
makeChainIndexingStatusSnapshotBackfillSchema(valueLabel),
|
|
1297
|
+
makeChainIndexingStatusSnapshotCompletedSchema(valueLabel),
|
|
1298
|
+
makeChainIndexingStatusSnapshotFollowingSchema(valueLabel)
|
|
1299
|
+
]);
|
|
1300
|
+
var makeSerializedChainIndexingStatusSnapshotSchema = makeChainIndexingStatusSnapshotSchema;
|
|
1301
|
+
|
|
1302
|
+
// src/ensindexer/indexing-status/deserialize/chain-indexing-status-snapshot.ts
|
|
1303
|
+
function deserializeChainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
1304
|
+
const schema = makeSerializedChainIndexingStatusSnapshotSchema(valueLabel);
|
|
1305
|
+
const parsed = schema.safeParse(maybeSnapshot);
|
|
1306
|
+
if (parsed.error) {
|
|
1307
|
+
throw new Error(
|
|
1308
|
+
`Cannot deserialize into ChainIndexingStatusSnapshot:
|
|
1309
|
+
${(0, import_v48.prettifyError)(parsed.error)}
|
|
1310
|
+
`
|
|
1311
|
+
);
|
|
1312
|
+
}
|
|
1313
|
+
return parsed.data;
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
// src/ensindexer/indexing-status/deserialize/cross-chain-indexing-status-snapshot.ts
|
|
1317
|
+
var import_v412 = require("zod/v4");
|
|
1318
|
+
|
|
1319
|
+
// src/ensindexer/indexing-status/zod-schema/cross-chain-indexing-status-snapshot.ts
|
|
1320
|
+
var import_v411 = require("zod/v4");
|
|
1221
1321
|
|
|
1222
1322
|
// src/ensindexer/indexing-status/zod-schema/omnichain-indexing-status-snapshot.ts
|
|
1223
|
-
var
|
|
1323
|
+
var import_v410 = require("zod/v4");
|
|
1224
1324
|
|
|
1225
1325
|
// src/shared/deserialize.ts
|
|
1226
|
-
var
|
|
1326
|
+
var import_v49 = require("zod/v4");
|
|
1227
1327
|
function deserializeChainId(maybeChainId, valueLabel) {
|
|
1228
1328
|
const schema = makeChainIdStringSchema(valueLabel);
|
|
1229
1329
|
const parsed = schema.safeParse(maybeChainId);
|
|
1230
1330
|
if (parsed.error) {
|
|
1231
1331
|
throw new Error(`Cannot deserialize ChainId:
|
|
1232
|
-
${(0,
|
|
1332
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1233
1333
|
`);
|
|
1234
1334
|
}
|
|
1235
1335
|
return parsed.data;
|
|
@@ -1239,7 +1339,7 @@ function deserializeDatetime(maybeDatetime, valueLabel) {
|
|
|
1239
1339
|
const parsed = schema.safeParse(maybeDatetime);
|
|
1240
1340
|
if (parsed.error) {
|
|
1241
1341
|
throw new Error(`Cannot deserialize Datetime:
|
|
1242
|
-
${(0,
|
|
1342
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1243
1343
|
`);
|
|
1244
1344
|
}
|
|
1245
1345
|
return parsed.data;
|
|
@@ -1249,7 +1349,7 @@ function deserializeUnixTimestamp(maybeTimestamp, valueLabel) {
|
|
|
1249
1349
|
const parsed = schema.safeParse(maybeTimestamp);
|
|
1250
1350
|
if (parsed.error) {
|
|
1251
1351
|
throw new Error(`Cannot deserialize Unix Timestamp:
|
|
1252
|
-
${(0,
|
|
1352
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1253
1353
|
`);
|
|
1254
1354
|
}
|
|
1255
1355
|
return parsed.data;
|
|
@@ -1259,7 +1359,7 @@ function deserializeUrl(maybeUrl, valueLabel) {
|
|
|
1259
1359
|
const parsed = schema.safeParse(maybeUrl);
|
|
1260
1360
|
if (parsed.error) {
|
|
1261
1361
|
throw new Error(`Cannot deserialize URL:
|
|
1262
|
-
${(0,
|
|
1362
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1263
1363
|
`);
|
|
1264
1364
|
}
|
|
1265
1365
|
return parsed.data;
|
|
@@ -1269,7 +1369,7 @@ function deserializeBlockNumber(maybeBlockNumber, valueLabel) {
|
|
|
1269
1369
|
const parsed = schema.safeParse(maybeBlockNumber);
|
|
1270
1370
|
if (parsed.error) {
|
|
1271
1371
|
throw new Error(`Cannot deserialize BlockNumber:
|
|
1272
|
-
${(0,
|
|
1372
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1273
1373
|
`);
|
|
1274
1374
|
}
|
|
1275
1375
|
return parsed.data;
|
|
@@ -1279,7 +1379,7 @@ function deserializeBlockrange(maybeBlockrange, valueLabel) {
|
|
|
1279
1379
|
const parsed = schema.safeParse(maybeBlockrange);
|
|
1280
1380
|
if (parsed.error) {
|
|
1281
1381
|
throw new Error(`Cannot deserialize Blockrange:
|
|
1282
|
-
${(0,
|
|
1382
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1283
1383
|
`);
|
|
1284
1384
|
}
|
|
1285
1385
|
return parsed.data;
|
|
@@ -1289,7 +1389,7 @@ function deserializeBlockRef(maybeBlockRef, valueLabel) {
|
|
|
1289
1389
|
const parsed = schema.safeParse(maybeBlockRef);
|
|
1290
1390
|
if (parsed.error) {
|
|
1291
1391
|
throw new Error(`Cannot deserialize BlockRef:
|
|
1292
|
-
${(0,
|
|
1392
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1293
1393
|
`);
|
|
1294
1394
|
}
|
|
1295
1395
|
return parsed.data;
|
|
@@ -1299,7 +1399,7 @@ function deserializeDuration(maybeDuration, valueLabel) {
|
|
|
1299
1399
|
const parsed = schema.safeParse(maybeDuration);
|
|
1300
1400
|
if (parsed.error) {
|
|
1301
1401
|
throw new RangeError(`Cannot deserialize Duration:
|
|
1302
|
-
${(0,
|
|
1402
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1303
1403
|
`);
|
|
1304
1404
|
}
|
|
1305
1405
|
return parsed.data;
|
|
@@ -1309,7 +1409,7 @@ function parseAccountId(maybeAccountId, valueLabel) {
|
|
|
1309
1409
|
const parsed = schema.safeParse(maybeAccountId);
|
|
1310
1410
|
if (parsed.error) {
|
|
1311
1411
|
throw new RangeError(`Cannot deserialize AccountId:
|
|
1312
|
-
${(0,
|
|
1412
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1313
1413
|
`);
|
|
1314
1414
|
}
|
|
1315
1415
|
return parsed.data;
|
|
@@ -1319,7 +1419,7 @@ function deserializePriceEth(maybePrice, valueLabel) {
|
|
|
1319
1419
|
const parsed = schema.safeParse(maybePrice);
|
|
1320
1420
|
if (parsed.error) {
|
|
1321
1421
|
throw new Error(`Cannot deserialize PriceEth:
|
|
1322
|
-
${(0,
|
|
1422
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1323
1423
|
`);
|
|
1324
1424
|
}
|
|
1325
1425
|
return parsed.data;
|
|
@@ -1329,7 +1429,7 @@ function deserializePriceUsdc(maybePrice, valueLabel) {
|
|
|
1329
1429
|
const parsed = schema.safeParse(maybePrice);
|
|
1330
1430
|
if (parsed.error) {
|
|
1331
1431
|
throw new Error(`Cannot deserialize PriceUsdc:
|
|
1332
|
-
${(0,
|
|
1432
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1333
1433
|
`);
|
|
1334
1434
|
}
|
|
1335
1435
|
return parsed.data;
|
|
@@ -1339,7 +1439,7 @@ function deserializePriceDai(maybePrice, valueLabel) {
|
|
|
1339
1439
|
const parsed = schema.safeParse(maybePrice);
|
|
1340
1440
|
if (parsed.error) {
|
|
1341
1441
|
throw new Error(`Cannot deserialize PriceDai:
|
|
1342
|
-
${(0,
|
|
1442
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1343
1443
|
`);
|
|
1344
1444
|
}
|
|
1345
1445
|
return parsed.data;
|
|
@@ -1426,142 +1526,6 @@ function getOmnichainIndexingCursor(chains) {
|
|
|
1426
1526
|
return Math.max(...latestIndexedBlockTimestamps);
|
|
1427
1527
|
}
|
|
1428
1528
|
|
|
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
1529
|
// src/ensindexer/indexing-status/zod-schema/omnichain-indexing-status-snapshot.ts
|
|
1566
1530
|
function invariant_omnichainSnapshotStatusIsConsistentWithChainSnapshot(ctx) {
|
|
1567
1531
|
const snapshot = ctx.value;
|
|
@@ -1671,7 +1635,7 @@ function invariant_omnichainStatusSnapshotCompletedHasValidChains(ctx) {
|
|
|
1671
1635
|
});
|
|
1672
1636
|
}
|
|
1673
1637
|
}
|
|
1674
|
-
var makeChainIndexingStatusesSchema = (valueLabel = "Value") =>
|
|
1638
|
+
var makeChainIndexingStatusesSchema = (valueLabel = "Value") => import_v410.z.record(makeChainIdStringSchema(), makeChainIndexingStatusSnapshotSchema(valueLabel), {
|
|
1675
1639
|
error: "Chains indexing statuses must be an object mapping valid chain IDs to their indexing status snapshots."
|
|
1676
1640
|
}).transform((serializedChainsIndexingStatus) => {
|
|
1677
1641
|
const chainsIndexingStatus = /* @__PURE__ */ new Map();
|
|
@@ -1680,29 +1644,29 @@ var makeChainIndexingStatusesSchema = (valueLabel = "Value") => import_v49.z.rec
|
|
|
1680
1644
|
}
|
|
1681
1645
|
return chainsIndexingStatus;
|
|
1682
1646
|
});
|
|
1683
|
-
var makeOmnichainIndexingStatusSnapshotUnstartedSchema = (valueLabel) =>
|
|
1684
|
-
omnichainStatus:
|
|
1647
|
+
var makeOmnichainIndexingStatusSnapshotUnstartedSchema = (valueLabel) => import_v410.z.strictObject({
|
|
1648
|
+
omnichainStatus: import_v410.z.literal(OmnichainIndexingStatusIds.Unstarted),
|
|
1685
1649
|
chains: makeChainIndexingStatusesSchema(valueLabel).check(invariant_omnichainSnapshotUnstartedHasValidChains).transform((chains) => chains),
|
|
1686
1650
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1687
1651
|
});
|
|
1688
|
-
var makeOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) =>
|
|
1689
|
-
omnichainStatus:
|
|
1652
|
+
var makeOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) => import_v410.z.strictObject({
|
|
1653
|
+
omnichainStatus: import_v410.z.literal(OmnichainIndexingStatusIds.Backfill),
|
|
1690
1654
|
chains: makeChainIndexingStatusesSchema(valueLabel).check(invariant_omnichainStatusSnapshotBackfillHasValidChains).transform(
|
|
1691
1655
|
(chains) => chains
|
|
1692
1656
|
),
|
|
1693
1657
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1694
1658
|
});
|
|
1695
|
-
var makeOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) =>
|
|
1696
|
-
omnichainStatus:
|
|
1659
|
+
var makeOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) => import_v410.z.strictObject({
|
|
1660
|
+
omnichainStatus: import_v410.z.literal(OmnichainIndexingStatusIds.Completed),
|
|
1697
1661
|
chains: makeChainIndexingStatusesSchema(valueLabel).check(invariant_omnichainStatusSnapshotCompletedHasValidChains).transform((chains) => chains),
|
|
1698
1662
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1699
1663
|
});
|
|
1700
|
-
var makeOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) =>
|
|
1701
|
-
omnichainStatus:
|
|
1664
|
+
var makeOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) => import_v410.z.strictObject({
|
|
1665
|
+
omnichainStatus: import_v410.z.literal(OmnichainIndexingStatusIds.Following),
|
|
1702
1666
|
chains: makeChainIndexingStatusesSchema(valueLabel),
|
|
1703
1667
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1704
1668
|
});
|
|
1705
|
-
var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexing Snapshot") =>
|
|
1669
|
+
var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexing Snapshot") => import_v410.z.discriminatedUnion("omnichainStatus", [
|
|
1706
1670
|
makeOmnichainIndexingStatusSnapshotUnstartedSchema(valueLabel),
|
|
1707
1671
|
makeOmnichainIndexingStatusSnapshotBackfillSchema(valueLabel),
|
|
1708
1672
|
makeOmnichainIndexingStatusSnapshotCompletedSchema(valueLabel),
|
|
@@ -1711,56 +1675,60 @@ var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexin
|
|
|
1711
1675
|
invariant_omnichainIndexingCursorLowerThanOrEqualToLatestBackfillEndBlockAcrossBackfillChains
|
|
1712
1676
|
).check(invariant_omnichainIndexingCursorIsEqualToHighestLatestIndexedBlockAcrossIndexedChain);
|
|
1713
1677
|
|
|
1714
|
-
// src/ensindexer/indexing-status/zod-
|
|
1715
|
-
|
|
1716
|
-
|
|
1678
|
+
// src/ensindexer/indexing-status/zod-schema/cross-chain-indexing-status-snapshot.ts
|
|
1679
|
+
function invariant_slowestChainEqualsToOmnichainSnapshotTime(ctx) {
|
|
1680
|
+
const { slowestChainIndexingCursor, omnichainSnapshot } = ctx.value;
|
|
1681
|
+
const { omnichainIndexingCursor } = omnichainSnapshot;
|
|
1682
|
+
if (slowestChainIndexingCursor !== omnichainIndexingCursor) {
|
|
1683
|
+
console.log("invariant_slowestChainEqualsToOmnichainSnapshotTime", {
|
|
1684
|
+
slowestChainIndexingCursor,
|
|
1685
|
+
omnichainIndexingCursor
|
|
1686
|
+
});
|
|
1687
|
+
ctx.issues.push({
|
|
1688
|
+
code: "custom",
|
|
1689
|
+
input: ctx.value,
|
|
1690
|
+
message: `'slowestChainIndexingCursor' must be equal to 'omnichainSnapshot.omnichainIndexingCursor'`
|
|
1691
|
+
});
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1694
|
+
function invariant_snapshotTimeIsTheHighestKnownBlockTimestamp(ctx) {
|
|
1695
|
+
const { snapshotTime, omnichainSnapshot } = ctx.value;
|
|
1696
|
+
const chains = Array.from(omnichainSnapshot.chains.values());
|
|
1697
|
+
const startBlockTimestamps = chains.map((chain) => chain.config.startBlock.timestamp);
|
|
1698
|
+
const endBlockTimestamps = chains.map((chain) => chain.config).filter((chainConfig) => chainConfig.configType === ChainIndexingConfigTypeIds.Definite).map((chainConfig) => chainConfig.endBlock.timestamp);
|
|
1699
|
+
const backfillEndBlockTimestamps = chains.filter((chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill).map((chain) => chain.backfillEndBlock.timestamp);
|
|
1700
|
+
const latestKnownBlockTimestamps = chains.filter((chain) => chain.chainStatus === ChainIndexingStatusIds.Following).map((chain) => chain.latestKnownBlock.timestamp);
|
|
1701
|
+
const highestKnownBlockTimestamp = Math.max(
|
|
1702
|
+
...startBlockTimestamps,
|
|
1703
|
+
...endBlockTimestamps,
|
|
1704
|
+
...backfillEndBlockTimestamps,
|
|
1705
|
+
...latestKnownBlockTimestamps
|
|
1706
|
+
);
|
|
1707
|
+
if (snapshotTime < highestKnownBlockTimestamp) {
|
|
1708
|
+
ctx.issues.push({
|
|
1709
|
+
code: "custom",
|
|
1710
|
+
input: ctx.value,
|
|
1711
|
+
message: `'snapshotTime' (${snapshotTime}) must be greater than or equal to the "highest known block timestamp" (${highestKnownBlockTimestamp})`
|
|
1712
|
+
});
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
var makeCrossChainIndexingStatusSnapshotOmnichainSchema = (valueLabel = "Cross-chain Indexing Status Snapshot Omnichain") => import_v411.z.strictObject({
|
|
1716
|
+
strategy: import_v411.z.literal(CrossChainIndexingStrategyIds.Omnichain),
|
|
1717
1717
|
slowestChainIndexingCursor: makeUnixTimestampSchema(valueLabel),
|
|
1718
1718
|
snapshotTime: makeUnixTimestampSchema(valueLabel),
|
|
1719
1719
|
omnichainSnapshot: makeOmnichainIndexingStatusSnapshotSchema(valueLabel)
|
|
1720
1720
|
}).check(invariant_slowestChainEqualsToOmnichainSnapshotTime).check(invariant_snapshotTimeIsTheHighestKnownBlockTimestamp);
|
|
1721
|
-
var makeCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Cross-chain Indexing Status Snapshot") =>
|
|
1721
|
+
var makeCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Cross-chain Indexing Status Snapshot") => import_v411.z.discriminatedUnion("strategy", [
|
|
1722
1722
|
makeCrossChainIndexingStatusSnapshotOmnichainSchema(valueLabel)
|
|
1723
1723
|
]);
|
|
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
1724
|
|
|
1730
|
-
// src/ensindexer/indexing-status/deserialize.ts
|
|
1725
|
+
// src/ensindexer/indexing-status/deserialize/cross-chain-indexing-status-snapshot.ts
|
|
1731
1726
|
function deserializeCrossChainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
1732
1727
|
const schema = makeCrossChainIndexingStatusSnapshotSchema(valueLabel);
|
|
1733
1728
|
const parsed = schema.safeParse(maybeSnapshot);
|
|
1734
1729
|
if (parsed.error) {
|
|
1735
1730
|
throw new Error(
|
|
1736
1731
|
`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
1732
|
${(0, import_v412.prettifyError)(parsed.error)}
|
|
1765
1733
|
`
|
|
1766
1734
|
);
|
|
@@ -1783,19 +1751,55 @@ ${(0, import_v413.prettifyError)(parsed.error)}
|
|
|
1783
1751
|
return parsed.data;
|
|
1784
1752
|
}
|
|
1785
1753
|
|
|
1786
|
-
// src/ensindexer/indexing-status/
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1754
|
+
// src/ensindexer/indexing-status/deserialize/realtime-indexing-status-projection.ts
|
|
1755
|
+
var import_v415 = require("zod/v4");
|
|
1756
|
+
|
|
1757
|
+
// src/ensindexer/indexing-status/zod-schema/realtime-indexing-status-projection.ts
|
|
1758
|
+
var import_v414 = require("zod/v4");
|
|
1759
|
+
function invariant_realtimeIndexingStatusProjectionProjectedAtIsAfterOrEqualToSnapshotTime(ctx) {
|
|
1760
|
+
const projection = ctx.value;
|
|
1761
|
+
const { snapshot, projectedAt } = projection;
|
|
1762
|
+
if (snapshot.snapshotTime > projectedAt) {
|
|
1763
|
+
ctx.issues.push({
|
|
1764
|
+
code: "custom",
|
|
1765
|
+
input: projection,
|
|
1766
|
+
message: "`projectedAt` must be after or same as `snapshot.snapshotTime`."
|
|
1767
|
+
});
|
|
1791
1768
|
}
|
|
1792
|
-
|
|
1793
|
-
|
|
1769
|
+
}
|
|
1770
|
+
function invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect(ctx) {
|
|
1771
|
+
const projection = ctx.value;
|
|
1772
|
+
const { projectedAt, snapshot, worstCaseDistance } = projection;
|
|
1773
|
+
const expectedWorstCaseDistance = projectedAt - snapshot.slowestChainIndexingCursor;
|
|
1774
|
+
if (worstCaseDistance !== expectedWorstCaseDistance) {
|
|
1775
|
+
ctx.issues.push({
|
|
1776
|
+
code: "custom",
|
|
1777
|
+
input: projection,
|
|
1778
|
+
message: "`worstCaseDistance` must be the exact difference between `projectedAt` and `snapshot.slowestChainIndexingCursor`."
|
|
1779
|
+
});
|
|
1794
1780
|
}
|
|
1795
|
-
return chainIndexingStatus.latestIndexedBlock;
|
|
1796
1781
|
}
|
|
1782
|
+
var makeRealtimeIndexingStatusProjectionSchema = (valueLabel = "Realtime Indexing Status Projection") => import_v414.z.strictObject({
|
|
1783
|
+
projectedAt: makeUnixTimestampSchema(valueLabel),
|
|
1784
|
+
worstCaseDistance: makeDurationSchema(valueLabel),
|
|
1785
|
+
snapshot: makeCrossChainIndexingStatusSnapshotSchema(valueLabel)
|
|
1786
|
+
}).check(invariant_realtimeIndexingStatusProjectionProjectedAtIsAfterOrEqualToSnapshotTime).check(invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect);
|
|
1797
1787
|
|
|
1798
|
-
// src/ensindexer/indexing-status/projection.ts
|
|
1788
|
+
// src/ensindexer/indexing-status/deserialize/realtime-indexing-status-projection.ts
|
|
1789
|
+
function deserializeRealtimeIndexingStatusProjection(maybeProjection, valueLabel) {
|
|
1790
|
+
const schema = makeRealtimeIndexingStatusProjectionSchema(valueLabel);
|
|
1791
|
+
const parsed = schema.safeParse(maybeProjection);
|
|
1792
|
+
if (parsed.error) {
|
|
1793
|
+
throw new Error(
|
|
1794
|
+
`Cannot deserialize into RealtimeIndexingStatusProjection:
|
|
1795
|
+
${(0, import_v415.prettifyError)(parsed.error)}
|
|
1796
|
+
`
|
|
1797
|
+
);
|
|
1798
|
+
}
|
|
1799
|
+
return parsed.data;
|
|
1800
|
+
}
|
|
1801
|
+
|
|
1802
|
+
// src/ensindexer/indexing-status/realtime-indexing-status-projection.ts
|
|
1799
1803
|
function createRealtimeIndexingStatusProjection(snapshot, now) {
|
|
1800
1804
|
const projectedAt = Math.max(now, snapshot.snapshotTime);
|
|
1801
1805
|
return {
|
|
@@ -1889,7 +1893,7 @@ function serializeOmnichainIndexingStatusSnapshot(indexingStatus) {
|
|
|
1889
1893
|
}
|
|
1890
1894
|
}
|
|
1891
1895
|
|
|
1892
|
-
// src/ensindexer/indexing-status/serialize.ts
|
|
1896
|
+
// src/ensindexer/indexing-status/serialize/cross-chain-indexing-status-snapshot.ts
|
|
1893
1897
|
function serializeCrossChainIndexingStatusSnapshotOmnichain({
|
|
1894
1898
|
strategy,
|
|
1895
1899
|
slowestChainIndexingCursor,
|
|
@@ -1903,6 +1907,8 @@ function serializeCrossChainIndexingStatusSnapshotOmnichain({
|
|
|
1903
1907
|
omnichainSnapshot: serializeOmnichainIndexingStatusSnapshot(omnichainSnapshot)
|
|
1904
1908
|
};
|
|
1905
1909
|
}
|
|
1910
|
+
|
|
1911
|
+
// src/ensindexer/indexing-status/serialize/realtime-indexing-status-projection.ts
|
|
1906
1912
|
function serializeRealtimeIndexingStatusProjection(indexingProjection) {
|
|
1907
1913
|
return {
|
|
1908
1914
|
projectedAt: indexingProjection.projectedAt,
|
|
@@ -1912,13 +1918,13 @@ function serializeRealtimeIndexingStatusProjection(indexingProjection) {
|
|
|
1912
1918
|
}
|
|
1913
1919
|
|
|
1914
1920
|
// src/ensindexer/indexing-status/validate/chain-indexing-status-snapshot.ts
|
|
1915
|
-
var
|
|
1921
|
+
var import_v416 = require("zod/v4");
|
|
1916
1922
|
function validateChainIndexingStatusSnapshot(unvalidatedSnapshot, valueLabel) {
|
|
1917
1923
|
const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
|
|
1918
1924
|
const parsed = schema.safeParse(unvalidatedSnapshot);
|
|
1919
1925
|
if (parsed.error) {
|
|
1920
1926
|
throw new Error(`Invalid ChainIndexingStatusSnapshot:
|
|
1921
|
-
${(0,
|
|
1927
|
+
${(0, import_v416.prettifyError)(parsed.error)}
|
|
1922
1928
|
`);
|
|
1923
1929
|
}
|
|
1924
1930
|
return parsed.data;
|
|
@@ -1945,10 +1951,10 @@ function serializeConfigResponse(response) {
|
|
|
1945
1951
|
}
|
|
1946
1952
|
|
|
1947
1953
|
// src/api/indexing-status/deserialize.ts
|
|
1948
|
-
var
|
|
1954
|
+
var import_v418 = require("zod/v4");
|
|
1949
1955
|
|
|
1950
1956
|
// src/api/indexing-status/zod-schemas.ts
|
|
1951
|
-
var
|
|
1957
|
+
var import_v417 = require("zod/v4");
|
|
1952
1958
|
|
|
1953
1959
|
// src/api/indexing-status/response.ts
|
|
1954
1960
|
var IndexingStatusResponseCodes = {
|
|
@@ -1963,14 +1969,14 @@ var IndexingStatusResponseCodes = {
|
|
|
1963
1969
|
};
|
|
1964
1970
|
|
|
1965
1971
|
// src/api/indexing-status/zod-schemas.ts
|
|
1966
|
-
var makeIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") =>
|
|
1967
|
-
responseCode:
|
|
1972
|
+
var makeIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => import_v417.z.strictObject({
|
|
1973
|
+
responseCode: import_v417.z.literal(IndexingStatusResponseCodes.Ok),
|
|
1968
1974
|
realtimeProjection: makeRealtimeIndexingStatusProjectionSchema(valueLabel)
|
|
1969
1975
|
});
|
|
1970
|
-
var makeIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") =>
|
|
1971
|
-
responseCode:
|
|
1976
|
+
var makeIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => import_v417.z.strictObject({
|
|
1977
|
+
responseCode: import_v417.z.literal(IndexingStatusResponseCodes.Error)
|
|
1972
1978
|
});
|
|
1973
|
-
var makeIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") =>
|
|
1979
|
+
var makeIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => import_v417.z.discriminatedUnion("responseCode", [
|
|
1974
1980
|
makeIndexingStatusResponseOkSchema(valueLabel),
|
|
1975
1981
|
makeIndexingStatusResponseErrorSchema(valueLabel)
|
|
1976
1982
|
]);
|
|
@@ -1980,7 +1986,7 @@ function deserializeIndexingStatusResponse(maybeResponse) {
|
|
|
1980
1986
|
const parsed = makeIndexingStatusResponseSchema().safeParse(maybeResponse);
|
|
1981
1987
|
if (parsed.error) {
|
|
1982
1988
|
throw new Error(`Cannot deserialize IndexingStatusResponse:
|
|
1983
|
-
${(0,
|
|
1989
|
+
${(0, import_v418.prettifyError)(parsed.error)}
|
|
1984
1990
|
`);
|
|
1985
1991
|
}
|
|
1986
1992
|
return parsed.data;
|
|
@@ -2000,20 +2006,20 @@ function serializeIndexingStatusResponse(response) {
|
|
|
2000
2006
|
}
|
|
2001
2007
|
|
|
2002
2008
|
// src/api/name-tokens/deserialize.ts
|
|
2003
|
-
var
|
|
2009
|
+
var import_v423 = require("zod/v4");
|
|
2004
2010
|
|
|
2005
2011
|
// src/api/name-tokens/zod-schemas.ts
|
|
2006
2012
|
var import_viem14 = require("viem");
|
|
2007
|
-
var
|
|
2013
|
+
var import_v422 = require("zod/v4");
|
|
2008
2014
|
|
|
2009
2015
|
// src/tokenscope/assets.ts
|
|
2010
2016
|
var import_viem13 = require("viem");
|
|
2011
|
-
var
|
|
2017
|
+
var import_v420 = require("zod/v4");
|
|
2012
2018
|
|
|
2013
2019
|
// src/tokenscope/zod-schemas.ts
|
|
2014
2020
|
var import_caip3 = require("caip");
|
|
2015
2021
|
var import_viem12 = require("viem");
|
|
2016
|
-
var
|
|
2022
|
+
var import_v419 = require("zod/v4");
|
|
2017
2023
|
|
|
2018
2024
|
// src/shared/types.ts
|
|
2019
2025
|
var AssetNamespaces = {
|
|
@@ -2136,10 +2142,10 @@ function getNameTokenOwnership(namespaceId, name, owner) {
|
|
|
2136
2142
|
}
|
|
2137
2143
|
|
|
2138
2144
|
// src/tokenscope/zod-schemas.ts
|
|
2139
|
-
var tokenIdSchemaSerializable =
|
|
2140
|
-
var tokenIdSchemaNative =
|
|
2145
|
+
var tokenIdSchemaSerializable = import_v419.z.string();
|
|
2146
|
+
var tokenIdSchemaNative = import_v419.z.preprocess(
|
|
2141
2147
|
(v) => typeof v === "string" ? BigInt(v) : v,
|
|
2142
|
-
|
|
2148
|
+
import_v419.z.bigint().positive()
|
|
2143
2149
|
);
|
|
2144
2150
|
function makeTokenIdSchema(_valueLabel = "Token ID Schema", serializable = false) {
|
|
2145
2151
|
if (serializable) {
|
|
@@ -2149,13 +2155,13 @@ function makeTokenIdSchema(_valueLabel = "Token ID Schema", serializable = false
|
|
|
2149
2155
|
}
|
|
2150
2156
|
}
|
|
2151
2157
|
var makeAssetIdSchema = (valueLabel = "Asset ID Schema", serializable) => {
|
|
2152
|
-
return
|
|
2153
|
-
assetNamespace:
|
|
2158
|
+
return import_v419.z.object({
|
|
2159
|
+
assetNamespace: import_v419.z.enum(AssetNamespaces),
|
|
2154
2160
|
contract: makeAccountIdSchema(valueLabel),
|
|
2155
2161
|
tokenId: makeTokenIdSchema(valueLabel, serializable ?? false)
|
|
2156
2162
|
});
|
|
2157
2163
|
};
|
|
2158
|
-
var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") =>
|
|
2164
|
+
var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") => import_v419.z.preprocess((v) => {
|
|
2159
2165
|
if (typeof v === "string") {
|
|
2160
2166
|
const result = new import_caip3.AssetId(v);
|
|
2161
2167
|
return {
|
|
@@ -2179,20 +2185,20 @@ function invariant_nameTokenOwnershipHasNonZeroAddressOwner(ctx) {
|
|
|
2179
2185
|
});
|
|
2180
2186
|
}
|
|
2181
2187
|
}
|
|
2182
|
-
var makeNameTokenOwnershipNameWrapperSchema = (valueLabel = "Name Token Ownership NameWrapper") =>
|
|
2183
|
-
ownershipType:
|
|
2188
|
+
var makeNameTokenOwnershipNameWrapperSchema = (valueLabel = "Name Token Ownership NameWrapper") => import_v419.z.object({
|
|
2189
|
+
ownershipType: import_v419.z.literal(NameTokenOwnershipTypes.NameWrapper),
|
|
2184
2190
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2185
2191
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2186
|
-
var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") =>
|
|
2187
|
-
ownershipType:
|
|
2192
|
+
var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") => import_v419.z.object({
|
|
2193
|
+
ownershipType: import_v419.z.literal(NameTokenOwnershipTypes.FullyOnchain),
|
|
2188
2194
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2189
2195
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2190
|
-
var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") =>
|
|
2191
|
-
ownershipType:
|
|
2196
|
+
var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") => import_v419.z.object({
|
|
2197
|
+
ownershipType: import_v419.z.literal(NameTokenOwnershipTypes.Burned),
|
|
2192
2198
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2193
2199
|
}).check(invariant_nameTokenOwnershipHasZeroAddressOwner);
|
|
2194
|
-
var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") =>
|
|
2195
|
-
ownershipType:
|
|
2200
|
+
var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") => import_v419.z.object({
|
|
2201
|
+
ownershipType: import_v419.z.literal(NameTokenOwnershipTypes.Unknown),
|
|
2196
2202
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2197
2203
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2198
2204
|
function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
|
|
@@ -2205,16 +2211,16 @@ function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
|
|
|
2205
2211
|
});
|
|
2206
2212
|
}
|
|
2207
2213
|
}
|
|
2208
|
-
var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") =>
|
|
2214
|
+
var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") => import_v419.z.discriminatedUnion("ownershipType", [
|
|
2209
2215
|
makeNameTokenOwnershipNameWrapperSchema(valueLabel),
|
|
2210
2216
|
makeNameTokenOwnershipFullyOnchainSchema(valueLabel),
|
|
2211
2217
|
makeNameTokenOwnershipBurnedSchema(valueLabel),
|
|
2212
2218
|
makeNameTokenOwnershipUnknownSchema(valueLabel)
|
|
2213
2219
|
]);
|
|
2214
|
-
var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) =>
|
|
2220
|
+
var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) => import_v419.z.object({
|
|
2215
2221
|
token: makeAssetIdSchema(`${valueLabel}.token`, serializable),
|
|
2216
2222
|
ownership: makeNameTokenOwnershipSchema(`${valueLabel}.ownership`),
|
|
2217
|
-
mintStatus:
|
|
2223
|
+
mintStatus: import_v419.z.enum(NFTMintStatuses)
|
|
2218
2224
|
});
|
|
2219
2225
|
|
|
2220
2226
|
// src/tokenscope/assets.ts
|
|
@@ -2230,7 +2236,7 @@ function deserializeAssetId(maybeAssetId, valueLabel) {
|
|
|
2230
2236
|
const parsed = schema.safeParse(maybeAssetId);
|
|
2231
2237
|
if (parsed.error) {
|
|
2232
2238
|
throw new RangeError(`Cannot deserialize AssetId:
|
|
2233
|
-
${(0,
|
|
2239
|
+
${(0, import_v420.prettifyError)(parsed.error)}
|
|
2234
2240
|
`);
|
|
2235
2241
|
}
|
|
2236
2242
|
return parsed.data;
|
|
@@ -2240,7 +2246,7 @@ function parseAssetId(maybeAssetId, valueLabel) {
|
|
|
2240
2246
|
const parsed = schema.safeParse(maybeAssetId);
|
|
2241
2247
|
if (parsed.error) {
|
|
2242
2248
|
throw new RangeError(`Cannot parse AssetId:
|
|
2243
|
-
${(0,
|
|
2249
|
+
${(0, import_v420.prettifyError)(parsed.error)}
|
|
2244
2250
|
`);
|
|
2245
2251
|
}
|
|
2246
2252
|
return parsed.data;
|
|
@@ -2462,10 +2468,10 @@ ${formatNFTTransferEventMetadata(metadata)}`
|
|
|
2462
2468
|
};
|
|
2463
2469
|
|
|
2464
2470
|
// src/api/shared/errors/zod-schemas.ts
|
|
2465
|
-
var
|
|
2466
|
-
var ErrorResponseSchema =
|
|
2467
|
-
message:
|
|
2468
|
-
details:
|
|
2471
|
+
var import_v421 = require("zod/v4");
|
|
2472
|
+
var ErrorResponseSchema = import_v421.z.object({
|
|
2473
|
+
message: import_v421.z.string(),
|
|
2474
|
+
details: import_v421.z.optional(import_v421.z.unknown())
|
|
2469
2475
|
});
|
|
2470
2476
|
|
|
2471
2477
|
// src/api/name-tokens/response.ts
|
|
@@ -2504,10 +2510,10 @@ var NameTokensResponseErrorCodes = {
|
|
|
2504
2510
|
};
|
|
2505
2511
|
|
|
2506
2512
|
// src/api/name-tokens/zod-schemas.ts
|
|
2507
|
-
var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) =>
|
|
2513
|
+
var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) => import_v422.z.object({
|
|
2508
2514
|
domainId: makeNodeSchema(`${valueLabel}.domainId`),
|
|
2509
2515
|
name: makeReinterpretedNameSchema(valueLabel),
|
|
2510
|
-
tokens:
|
|
2516
|
+
tokens: import_v422.z.array(makeNameTokenSchema(`${valueLabel}.tokens`, serializable)).nonempty(),
|
|
2511
2517
|
expiresAt: makeUnixTimestampSchema(`${valueLabel}.expiresAt`),
|
|
2512
2518
|
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
|
|
2513
2519
|
}).check(function invariant_nameIsAssociatedWithDomainId(ctx) {
|
|
@@ -2549,32 +2555,32 @@ var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", seria
|
|
|
2549
2555
|
});
|
|
2550
2556
|
}
|
|
2551
2557
|
});
|
|
2552
|
-
var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) =>
|
|
2553
|
-
responseCode:
|
|
2558
|
+
var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) => import_v422.z.strictObject({
|
|
2559
|
+
responseCode: import_v422.z.literal(NameTokensResponseCodes.Ok),
|
|
2554
2560
|
registeredNameTokens: makeRegisteredNameTokenSchema(`${valueLabel}.nameTokens`, serializable)
|
|
2555
2561
|
});
|
|
2556
|
-
var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") =>
|
|
2557
|
-
responseCode:
|
|
2558
|
-
errorCode:
|
|
2562
|
+
var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") => import_v422.z.strictObject({
|
|
2563
|
+
responseCode: import_v422.z.literal(NameTokensResponseCodes.Error),
|
|
2564
|
+
errorCode: import_v422.z.literal(NameTokensResponseErrorCodes.NameTokensNotIndexed),
|
|
2559
2565
|
error: ErrorResponseSchema
|
|
2560
2566
|
});
|
|
2561
|
-
var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") =>
|
|
2562
|
-
responseCode:
|
|
2563
|
-
errorCode:
|
|
2567
|
+
var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") => import_v422.z.strictObject({
|
|
2568
|
+
responseCode: import_v422.z.literal(NameTokensResponseCodes.Error),
|
|
2569
|
+
errorCode: import_v422.z.literal(NameTokensResponseErrorCodes.EnsIndexerConfigUnsupported),
|
|
2564
2570
|
error: ErrorResponseSchema
|
|
2565
2571
|
});
|
|
2566
|
-
var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") =>
|
|
2567
|
-
responseCode:
|
|
2568
|
-
errorCode:
|
|
2572
|
+
var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") => import_v422.z.strictObject({
|
|
2573
|
+
responseCode: import_v422.z.literal(NameTokensResponseCodes.Error),
|
|
2574
|
+
errorCode: import_v422.z.literal(NameTokensResponseErrorCodes.IndexingStatusUnsupported),
|
|
2569
2575
|
error: ErrorResponseSchema
|
|
2570
2576
|
});
|
|
2571
|
-
var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") =>
|
|
2577
|
+
var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") => import_v422.z.discriminatedUnion("errorCode", [
|
|
2572
2578
|
makeNameTokensResponseErrorNameTokensNotIndexedSchema(valueLabel),
|
|
2573
2579
|
makeNameTokensResponseErrorEnsIndexerConfigUnsupported(valueLabel),
|
|
2574
2580
|
makeNameTokensResponseErrorNameIndexingStatusUnsupported(valueLabel)
|
|
2575
2581
|
]);
|
|
2576
2582
|
var makeNameTokensResponseSchema = (valueLabel = "Name Tokens Response", serializable) => {
|
|
2577
|
-
return
|
|
2583
|
+
return import_v422.z.discriminatedUnion("responseCode", [
|
|
2578
2584
|
makeNameTokensResponseOkSchema(valueLabel, serializable ?? false),
|
|
2579
2585
|
makeNameTokensResponseErrorSchema(valueLabel)
|
|
2580
2586
|
]);
|
|
@@ -2587,7 +2593,7 @@ function deserializedNameTokensResponse(maybeResponse) {
|
|
|
2587
2593
|
);
|
|
2588
2594
|
if (parsed.error) {
|
|
2589
2595
|
throw new Error(`Cannot deserialize NameTokensResponse:
|
|
2590
|
-
${(0,
|
|
2596
|
+
${(0, import_v423.prettifyError)(parsed.error)}
|
|
2591
2597
|
`);
|
|
2592
2598
|
}
|
|
2593
2599
|
return parsed.data;
|
|
@@ -2661,14 +2667,14 @@ function serializeNameTokensResponse(response) {
|
|
|
2661
2667
|
}
|
|
2662
2668
|
|
|
2663
2669
|
// src/api/registrar-actions/deserialize.ts
|
|
2664
|
-
var
|
|
2670
|
+
var import_v427 = require("zod/v4");
|
|
2665
2671
|
|
|
2666
2672
|
// src/api/registrar-actions/zod-schemas.ts
|
|
2667
2673
|
var import_ens7 = require("viem/ens");
|
|
2668
|
-
var
|
|
2674
|
+
var import_v426 = require("zod/v4");
|
|
2669
2675
|
|
|
2670
2676
|
// src/registrars/zod-schemas.ts
|
|
2671
|
-
var
|
|
2677
|
+
var import_v424 = require("zod/v4");
|
|
2672
2678
|
|
|
2673
2679
|
// src/registrars/encoded-referrer.ts
|
|
2674
2680
|
var import_viem15 = require("viem");
|
|
@@ -2743,11 +2749,11 @@ function serializeRegistrarAction(registrarAction) {
|
|
|
2743
2749
|
}
|
|
2744
2750
|
|
|
2745
2751
|
// src/registrars/zod-schemas.ts
|
|
2746
|
-
var makeSubregistrySchema = (valueLabel = "Subregistry") =>
|
|
2752
|
+
var makeSubregistrySchema = (valueLabel = "Subregistry") => import_v424.z.object({
|
|
2747
2753
|
subregistryId: makeAccountIdSchema(`${valueLabel} Subregistry ID`),
|
|
2748
2754
|
node: makeNodeSchema(`${valueLabel} Node`)
|
|
2749
2755
|
});
|
|
2750
|
-
var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") =>
|
|
2756
|
+
var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") => import_v424.z.object({
|
|
2751
2757
|
subregistry: makeSubregistrySchema(`${valueLabel} Subregistry`),
|
|
2752
2758
|
node: makeNodeSchema(`${valueLabel} Node`),
|
|
2753
2759
|
expiresAt: makeUnixTimestampSchema(`${valueLabel} Expires at`)
|
|
@@ -2763,18 +2769,18 @@ function invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium(ctx) {
|
|
|
2763
2769
|
});
|
|
2764
2770
|
}
|
|
2765
2771
|
}
|
|
2766
|
-
var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") =>
|
|
2772
|
+
var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") => import_v424.z.union([
|
|
2767
2773
|
// pricing available
|
|
2768
|
-
|
|
2774
|
+
import_v424.z.object({
|
|
2769
2775
|
baseCost: makePriceEthSchema(`${valueLabel} Base Cost`),
|
|
2770
2776
|
premium: makePriceEthSchema(`${valueLabel} Premium`),
|
|
2771
2777
|
total: makePriceEthSchema(`${valueLabel} Total`)
|
|
2772
2778
|
}).check(invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium).transform((v) => v),
|
|
2773
2779
|
// pricing unknown
|
|
2774
|
-
|
|
2775
|
-
baseCost:
|
|
2776
|
-
premium:
|
|
2777
|
-
total:
|
|
2780
|
+
import_v424.z.object({
|
|
2781
|
+
baseCost: import_v424.z.null(),
|
|
2782
|
+
premium: import_v424.z.null(),
|
|
2783
|
+
total: import_v424.z.null()
|
|
2778
2784
|
}).transform((v) => v)
|
|
2779
2785
|
]);
|
|
2780
2786
|
function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
|
|
@@ -2797,9 +2803,9 @@ function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
|
|
|
2797
2803
|
});
|
|
2798
2804
|
}
|
|
2799
2805
|
}
|
|
2800
|
-
var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") =>
|
|
2806
|
+
var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") => import_v424.z.union([
|
|
2801
2807
|
// referral available
|
|
2802
|
-
|
|
2808
|
+
import_v424.z.object({
|
|
2803
2809
|
encodedReferrer: makeHexStringSchema(
|
|
2804
2810
|
{ bytesCount: ENCODED_REFERRER_BYTE_LENGTH },
|
|
2805
2811
|
`${valueLabel} Encoded Referrer`
|
|
@@ -2807,9 +2813,9 @@ var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral
|
|
|
2807
2813
|
decodedReferrer: makeLowercaseAddressSchema(`${valueLabel} Decoded Referrer`)
|
|
2808
2814
|
}).check(invariant_registrarActionDecodedReferrerBasedOnRawReferrer),
|
|
2809
2815
|
// referral not applicable
|
|
2810
|
-
|
|
2811
|
-
encodedReferrer:
|
|
2812
|
-
decodedReferrer:
|
|
2816
|
+
import_v424.z.object({
|
|
2817
|
+
encodedReferrer: import_v424.z.null(),
|
|
2818
|
+
decodedReferrer: import_v424.z.null()
|
|
2813
2819
|
})
|
|
2814
2820
|
]);
|
|
2815
2821
|
function invariant_eventIdsInitialElementIsTheActionId(ctx) {
|
|
@@ -2822,9 +2828,9 @@ function invariant_eventIdsInitialElementIsTheActionId(ctx) {
|
|
|
2822
2828
|
});
|
|
2823
2829
|
}
|
|
2824
2830
|
}
|
|
2825
|
-
var EventIdSchema =
|
|
2826
|
-
var EventIdsSchema =
|
|
2827
|
-
var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") =>
|
|
2831
|
+
var EventIdSchema = import_v424.z.string().nonempty();
|
|
2832
|
+
var EventIdsSchema = import_v424.z.array(EventIdSchema).min(1).transform((v) => v);
|
|
2833
|
+
var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => import_v424.z.object({
|
|
2828
2834
|
id: EventIdSchema,
|
|
2829
2835
|
incrementalDuration: makeDurationSchema(`${valueLabel} Incremental Duration`),
|
|
2830
2836
|
registrant: makeLowercaseAddressSchema(`${valueLabel} Registrant`),
|
|
@@ -2838,38 +2844,38 @@ var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => im
|
|
|
2838
2844
|
eventIds: EventIdsSchema
|
|
2839
2845
|
}).check(invariant_eventIdsInitialElementIsTheActionId);
|
|
2840
2846
|
var makeRegistrarActionRegistrationSchema = (valueLabel = "Registration ") => makeBaseRegistrarActionSchema(valueLabel).extend({
|
|
2841
|
-
type:
|
|
2847
|
+
type: import_v424.z.literal(RegistrarActionTypes.Registration)
|
|
2842
2848
|
});
|
|
2843
2849
|
var makeRegistrarActionRenewalSchema = (valueLabel = "Renewal") => makeBaseRegistrarActionSchema(valueLabel).extend({
|
|
2844
|
-
type:
|
|
2850
|
+
type: import_v424.z.literal(RegistrarActionTypes.Renewal)
|
|
2845
2851
|
});
|
|
2846
|
-
var makeRegistrarActionSchema = (valueLabel = "Registrar Action") =>
|
|
2852
|
+
var makeRegistrarActionSchema = (valueLabel = "Registrar Action") => import_v424.z.discriminatedUnion("type", [
|
|
2847
2853
|
makeRegistrarActionRegistrationSchema(`${valueLabel} Registration`),
|
|
2848
2854
|
makeRegistrarActionRenewalSchema(`${valueLabel} Renewal`)
|
|
2849
2855
|
]);
|
|
2850
2856
|
|
|
2851
2857
|
// src/api/shared/pagination/zod-schemas.ts
|
|
2852
|
-
var
|
|
2858
|
+
var import_v425 = require("zod/v4");
|
|
2853
2859
|
|
|
2854
2860
|
// src/api/shared/pagination/request.ts
|
|
2855
2861
|
var RECORDS_PER_PAGE_DEFAULT = 10;
|
|
2856
2862
|
var RECORDS_PER_PAGE_MAX = 100;
|
|
2857
2863
|
|
|
2858
2864
|
// src/api/shared/pagination/zod-schemas.ts
|
|
2859
|
-
var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") =>
|
|
2865
|
+
var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") => import_v425.z.object({
|
|
2860
2866
|
page: makePositiveIntegerSchema(`${valueLabel}.page`),
|
|
2861
2867
|
recordsPerPage: makePositiveIntegerSchema(`${valueLabel}.recordsPerPage`).max(
|
|
2862
2868
|
RECORDS_PER_PAGE_MAX,
|
|
2863
2869
|
`${valueLabel}.recordsPerPage must not exceed ${RECORDS_PER_PAGE_MAX}`
|
|
2864
2870
|
)
|
|
2865
2871
|
});
|
|
2866
|
-
var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") =>
|
|
2867
|
-
totalRecords:
|
|
2868
|
-
totalPages:
|
|
2869
|
-
hasNext:
|
|
2870
|
-
hasPrev:
|
|
2871
|
-
startIndex:
|
|
2872
|
-
endIndex:
|
|
2872
|
+
var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") => import_v425.z.object({
|
|
2873
|
+
totalRecords: import_v425.z.literal(0),
|
|
2874
|
+
totalPages: import_v425.z.literal(1),
|
|
2875
|
+
hasNext: import_v425.z.literal(false),
|
|
2876
|
+
hasPrev: import_v425.z.literal(false),
|
|
2877
|
+
startIndex: import_v425.z.undefined(),
|
|
2878
|
+
endIndex: import_v425.z.undefined()
|
|
2873
2879
|
}).extend(makeRequestPageParamsSchema(valueLabel).shape);
|
|
2874
2880
|
function invariant_responsePageWithRecordsIsCorrect(ctx) {
|
|
2875
2881
|
const { hasNext, hasPrev, recordsPerPage, page, totalRecords, startIndex, endIndex } = ctx.value;
|
|
@@ -2904,15 +2910,15 @@ function invariant_responsePageWithRecordsIsCorrect(ctx) {
|
|
|
2904
2910
|
});
|
|
2905
2911
|
}
|
|
2906
2912
|
}
|
|
2907
|
-
var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") =>
|
|
2913
|
+
var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") => import_v425.z.object({
|
|
2908
2914
|
totalRecords: makePositiveIntegerSchema(`${valueLabel}.totalRecords`),
|
|
2909
2915
|
totalPages: makePositiveIntegerSchema(`${valueLabel}.totalPages`),
|
|
2910
|
-
hasNext:
|
|
2911
|
-
hasPrev:
|
|
2916
|
+
hasNext: import_v425.z.boolean(),
|
|
2917
|
+
hasPrev: import_v425.z.boolean(),
|
|
2912
2918
|
startIndex: makeNonNegativeIntegerSchema(`${valueLabel}.startIndex`),
|
|
2913
2919
|
endIndex: makeNonNegativeIntegerSchema(`${valueLabel}.endIndex`)
|
|
2914
2920
|
}).extend(makeRequestPageParamsSchema(valueLabel).shape).check(invariant_responsePageWithRecordsIsCorrect);
|
|
2915
|
-
var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") =>
|
|
2921
|
+
var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") => import_v425.z.union([
|
|
2916
2922
|
makeResponsePageContextSchemaWithNoRecords(valueLabel),
|
|
2917
2923
|
makeResponsePageContextSchemaWithRecords(valueLabel)
|
|
2918
2924
|
]);
|
|
@@ -2942,21 +2948,21 @@ function invariant_registrationLifecycleNodeMatchesName(ctx) {
|
|
|
2942
2948
|
});
|
|
2943
2949
|
}
|
|
2944
2950
|
}
|
|
2945
|
-
var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") =>
|
|
2951
|
+
var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") => import_v426.z.object({
|
|
2946
2952
|
action: makeRegistrarActionSchema(valueLabel),
|
|
2947
2953
|
name: makeReinterpretedNameSchema(valueLabel)
|
|
2948
2954
|
}).check(invariant_registrationLifecycleNodeMatchesName);
|
|
2949
|
-
var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") =>
|
|
2950
|
-
responseCode:
|
|
2951
|
-
registrarActions:
|
|
2955
|
+
var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") => import_v426.z.object({
|
|
2956
|
+
responseCode: import_v426.z.literal(RegistrarActionsResponseCodes.Ok),
|
|
2957
|
+
registrarActions: import_v426.z.array(makeNamedRegistrarActionSchema(valueLabel)),
|
|
2952
2958
|
pageContext: makeResponsePageContextSchema(`${valueLabel}.pageContext`),
|
|
2953
2959
|
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`).optional()
|
|
2954
2960
|
});
|
|
2955
|
-
var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") =>
|
|
2956
|
-
responseCode:
|
|
2961
|
+
var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") => import_v426.z.strictObject({
|
|
2962
|
+
responseCode: import_v426.z.literal(RegistrarActionsResponseCodes.Error),
|
|
2957
2963
|
error: ErrorResponseSchema
|
|
2958
2964
|
});
|
|
2959
|
-
var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") =>
|
|
2965
|
+
var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") => import_v426.z.discriminatedUnion("responseCode", [
|
|
2960
2966
|
makeRegistrarActionsResponseOkSchema(valueLabel),
|
|
2961
2967
|
makeRegistrarActionsResponseErrorSchema(valueLabel)
|
|
2962
2968
|
]);
|
|
@@ -2967,7 +2973,7 @@ function deserializeRegistrarActionsResponse(maybeResponse) {
|
|
|
2967
2973
|
if (parsed.error) {
|
|
2968
2974
|
throw new Error(
|
|
2969
2975
|
`Cannot deserialize RegistrarActionsResponse:
|
|
2970
|
-
${(0,
|
|
2976
|
+
${(0, import_v427.prettifyError)(parsed.error)}
|
|
2971
2977
|
`
|
|
2972
2978
|
);
|
|
2973
2979
|
}
|
|
@@ -3215,12 +3221,12 @@ function serializeRegistrarActionsResponse(response) {
|
|
|
3215
3221
|
}
|
|
3216
3222
|
|
|
3217
3223
|
// src/api/shared/errors/deserialize.ts
|
|
3218
|
-
var
|
|
3224
|
+
var import_v428 = require("zod/v4");
|
|
3219
3225
|
function deserializeErrorResponse(maybeErrorResponse) {
|
|
3220
3226
|
const parsed = ErrorResponseSchema.safeParse(maybeErrorResponse);
|
|
3221
3227
|
if (parsed.error) {
|
|
3222
3228
|
throw new Error(`Cannot deserialize ErrorResponse:
|
|
3223
|
-
${(0,
|
|
3229
|
+
${(0, import_v428.prettifyError)(parsed.error)}
|
|
3224
3230
|
`);
|
|
3225
3231
|
}
|
|
3226
3232
|
return parsed.data;
|