@ensnode/ensnode-sdk 0.0.0-next-20260210145458 → 0.0.0-next-20260211153531
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 +377 -365
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +92 -89
- package/dist/index.d.ts +92 -89
- package/dist/index.js +371 -359
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -876,6 +876,90 @@ function sortChainStatusesByStartBlockAsc(chains) {
|
|
|
876
876
|
import { prettifyError as prettifyError4 } from "zod/v4";
|
|
877
877
|
|
|
878
878
|
// src/ensindexer/indexing-status/zod-schemas.ts
|
|
879
|
+
import { z as z7 } from "zod/v4";
|
|
880
|
+
|
|
881
|
+
// src/ensindexer/indexing-status/types.ts
|
|
882
|
+
var CrossChainIndexingStrategyIds = {
|
|
883
|
+
/**
|
|
884
|
+
* Represents that the indexing of events across all indexed chains will
|
|
885
|
+
* proceed in a deterministic "omnichain" ordering by block timestamp, chain ID,
|
|
886
|
+
* and block number.
|
|
887
|
+
*
|
|
888
|
+
* This strategy is "deterministic" in that the order of processing cross-chain indexed
|
|
889
|
+
* events and each resulting indexed data state transition recorded in ENSDb is always
|
|
890
|
+
* the same for each ENSIndexer instance operating with an equivalent
|
|
891
|
+
* `ENSIndexerConfig` and ENSIndexer version. However it also has the drawbacks of:
|
|
892
|
+
* - increased indexing latency that must wait for the slowest indexed chain to
|
|
893
|
+
* add new blocks or to discover new blocks through the configured RPCs.
|
|
894
|
+
* - if any indexed chain gets "stuck" due to chain or RPC failures, all indexed chains
|
|
895
|
+
* will be affected.
|
|
896
|
+
*/
|
|
897
|
+
Omnichain: "omnichain"
|
|
898
|
+
};
|
|
899
|
+
|
|
900
|
+
// src/ensindexer/indexing-status/validations.ts
|
|
901
|
+
function invariant_slowestChainEqualsToOmnichainSnapshotTime(ctx) {
|
|
902
|
+
const { slowestChainIndexingCursor, omnichainSnapshot } = ctx.value;
|
|
903
|
+
const { omnichainIndexingCursor } = omnichainSnapshot;
|
|
904
|
+
if (slowestChainIndexingCursor !== omnichainIndexingCursor) {
|
|
905
|
+
console.log("invariant_slowestChainEqualsToOmnichainSnapshotTime", {
|
|
906
|
+
slowestChainIndexingCursor,
|
|
907
|
+
omnichainIndexingCursor
|
|
908
|
+
});
|
|
909
|
+
ctx.issues.push({
|
|
910
|
+
code: "custom",
|
|
911
|
+
input: ctx.value,
|
|
912
|
+
message: `'slowestChainIndexingCursor' must be equal to 'omnichainSnapshot.omnichainIndexingCursor'`
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
function invariant_snapshotTimeIsTheHighestKnownBlockTimestamp(ctx) {
|
|
917
|
+
const { snapshotTime, omnichainSnapshot } = ctx.value;
|
|
918
|
+
const chains = Array.from(omnichainSnapshot.chains.values());
|
|
919
|
+
const startBlockTimestamps = chains.map((chain) => chain.config.startBlock.timestamp);
|
|
920
|
+
const endBlockTimestamps = chains.map((chain) => chain.config).filter((chainConfig) => chainConfig.configType === ChainIndexingConfigTypeIds.Definite).map((chainConfig) => chainConfig.endBlock.timestamp);
|
|
921
|
+
const backfillEndBlockTimestamps = chains.filter((chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill).map((chain) => chain.backfillEndBlock.timestamp);
|
|
922
|
+
const latestKnownBlockTimestamps = chains.filter((chain) => chain.chainStatus === ChainIndexingStatusIds.Following).map((chain) => chain.latestKnownBlock.timestamp);
|
|
923
|
+
const highestKnownBlockTimestamp = Math.max(
|
|
924
|
+
...startBlockTimestamps,
|
|
925
|
+
...endBlockTimestamps,
|
|
926
|
+
...backfillEndBlockTimestamps,
|
|
927
|
+
...latestKnownBlockTimestamps
|
|
928
|
+
);
|
|
929
|
+
if (snapshotTime < highestKnownBlockTimestamp) {
|
|
930
|
+
ctx.issues.push({
|
|
931
|
+
code: "custom",
|
|
932
|
+
input: ctx.value,
|
|
933
|
+
message: `'snapshotTime' (${snapshotTime}) must be greater than or equal to the "highest known block timestamp" (${highestKnownBlockTimestamp})`
|
|
934
|
+
});
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
function invariant_realtimeIndexingStatusProjectionProjectedAtIsAfterOrEqualToSnapshotTime(ctx) {
|
|
938
|
+
const projection = ctx.value;
|
|
939
|
+
const { snapshot, projectedAt } = projection;
|
|
940
|
+
if (snapshot.snapshotTime > projectedAt) {
|
|
941
|
+
ctx.issues.push({
|
|
942
|
+
code: "custom",
|
|
943
|
+
input: projection,
|
|
944
|
+
message: "`projectedAt` must be after or same as `snapshot.snapshotTime`."
|
|
945
|
+
});
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
function invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect(ctx) {
|
|
949
|
+
const projection = ctx.value;
|
|
950
|
+
const { projectedAt, snapshot, worstCaseDistance } = projection;
|
|
951
|
+
const { omnichainSnapshot } = snapshot;
|
|
952
|
+
const expectedWorstCaseDistance = projectedAt - omnichainSnapshot.omnichainIndexingCursor;
|
|
953
|
+
if (worstCaseDistance !== expectedWorstCaseDistance) {
|
|
954
|
+
ctx.issues.push({
|
|
955
|
+
code: "custom",
|
|
956
|
+
input: projection,
|
|
957
|
+
message: "`worstCaseDistance` must be the exact difference between `projectedAt` and `snapshot.omnichainIndexingCursor`."
|
|
958
|
+
});
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
// src/ensindexer/indexing-status/zod-schema/omnichain-indexing-status-snapshot.ts
|
|
879
963
|
import { z as z6 } from "zod/v4";
|
|
880
964
|
|
|
881
965
|
// src/shared/deserialize.ts
|
|
@@ -1001,7 +1085,7 @@ ${prettifyError3(parsed.error)}
|
|
|
1001
1085
|
return parsed.data;
|
|
1002
1086
|
}
|
|
1003
1087
|
|
|
1004
|
-
// src/ensindexer/indexing-status/
|
|
1088
|
+
// src/ensindexer/indexing-status/omnichain-indexing-status-snapshot.ts
|
|
1005
1089
|
var OmnichainIndexingStatusIds = {
|
|
1006
1090
|
/**
|
|
1007
1091
|
* Represents that omnichain indexing is not ready to begin yet because
|
|
@@ -1028,54 +1112,6 @@ var OmnichainIndexingStatusIds = {
|
|
|
1028
1112
|
*/
|
|
1029
1113
|
Completed: "omnichain-completed"
|
|
1030
1114
|
};
|
|
1031
|
-
var CrossChainIndexingStrategyIds = {
|
|
1032
|
-
/**
|
|
1033
|
-
* Represents that the indexing of events across all indexed chains will
|
|
1034
|
-
* proceed in a deterministic "omnichain" ordering by block timestamp, chain ID,
|
|
1035
|
-
* and block number.
|
|
1036
|
-
*
|
|
1037
|
-
* This strategy is "deterministic" in that the order of processing cross-chain indexed
|
|
1038
|
-
* events and each resulting indexed data state transition recorded in ENSDb is always
|
|
1039
|
-
* the same for each ENSIndexer instance operating with an equivalent
|
|
1040
|
-
* `ENSIndexerConfig` and ENSIndexer version. However it also has the drawbacks of:
|
|
1041
|
-
* - increased indexing latency that must wait for the slowest indexed chain to
|
|
1042
|
-
* add new blocks or to discover new blocks through the configured RPCs.
|
|
1043
|
-
* - if any indexed chain gets "stuck" due to chain or RPC failures, all indexed chains
|
|
1044
|
-
* will be affected.
|
|
1045
|
-
*/
|
|
1046
|
-
Omnichain: "omnichain"
|
|
1047
|
-
};
|
|
1048
|
-
|
|
1049
|
-
// src/ensindexer/indexing-status/helpers.ts
|
|
1050
|
-
function getOmnichainIndexingStatus(chains) {
|
|
1051
|
-
if (checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing(chains)) {
|
|
1052
|
-
return OmnichainIndexingStatusIds.Following;
|
|
1053
|
-
}
|
|
1054
|
-
if (checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill(chains)) {
|
|
1055
|
-
return OmnichainIndexingStatusIds.Backfill;
|
|
1056
|
-
}
|
|
1057
|
-
if (checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted(chains)) {
|
|
1058
|
-
return OmnichainIndexingStatusIds.Unstarted;
|
|
1059
|
-
}
|
|
1060
|
-
if (checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted(chains)) {
|
|
1061
|
-
return OmnichainIndexingStatusIds.Completed;
|
|
1062
|
-
}
|
|
1063
|
-
throw new Error(`Unable to determine omnichain indexing status for provided chains.`);
|
|
1064
|
-
}
|
|
1065
|
-
function getOmnichainIndexingCursor(chains) {
|
|
1066
|
-
if (chains.length === 0) {
|
|
1067
|
-
throw new Error(`Unable to determine omnichain indexing cursor when no chains were provided.`);
|
|
1068
|
-
}
|
|
1069
|
-
if (getOmnichainIndexingStatus(chains) === OmnichainIndexingStatusIds.Unstarted) {
|
|
1070
|
-
const earliestStartBlockTimestamps = chains.map((chain) => chain.config.startBlock.timestamp);
|
|
1071
|
-
return Math.min(...earliestStartBlockTimestamps) - 1;
|
|
1072
|
-
}
|
|
1073
|
-
const latestIndexedBlockTimestamps = chains.filter((chain) => chain.chainStatus !== ChainIndexingStatusIds.Queued).map((chain) => chain.latestIndexedBlock.timestamp);
|
|
1074
|
-
if (latestIndexedBlockTimestamps.length < 1) {
|
|
1075
|
-
throw new Error("latestIndexedBlockTimestamps array must include at least one element");
|
|
1076
|
-
}
|
|
1077
|
-
return Math.max(...latestIndexedBlockTimestamps);
|
|
1078
|
-
}
|
|
1079
1115
|
function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted(chains) {
|
|
1080
1116
|
return chains.every((chain) => chain.chainStatus === ChainIndexingStatusIds.Queued);
|
|
1081
1117
|
}
|
|
@@ -1100,185 +1136,34 @@ function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing(ch
|
|
|
1100
1136
|
);
|
|
1101
1137
|
return allChainsHaveValidStatuses;
|
|
1102
1138
|
}
|
|
1103
|
-
function
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
return null;
|
|
1107
|
-
}
|
|
1108
|
-
if (chainIndexingStatus.chainStatus === ChainIndexingStatusIds.Queued) {
|
|
1109
|
-
return null;
|
|
1110
|
-
}
|
|
1111
|
-
return chainIndexingStatus.latestIndexedBlock;
|
|
1112
|
-
}
|
|
1113
|
-
|
|
1114
|
-
// src/ensindexer/indexing-status/validations.ts
|
|
1115
|
-
function invariant_omnichainSnapshotStatusIsConsistentWithChainSnapshot(ctx) {
|
|
1116
|
-
const snapshot = ctx.value;
|
|
1117
|
-
const chains = Array.from(snapshot.chains.values());
|
|
1118
|
-
const expectedOmnichainStatus = getOmnichainIndexingStatus(chains);
|
|
1119
|
-
const actualOmnichainStatus = snapshot.omnichainStatus;
|
|
1120
|
-
if (expectedOmnichainStatus !== actualOmnichainStatus) {
|
|
1121
|
-
ctx.issues.push({
|
|
1122
|
-
code: "custom",
|
|
1123
|
-
input: snapshot,
|
|
1124
|
-
message: `'${actualOmnichainStatus}' is an invalid omnichainStatus. Expected '${expectedOmnichainStatus}' based on the statuses of individual chains.`
|
|
1125
|
-
});
|
|
1126
|
-
}
|
|
1127
|
-
}
|
|
1128
|
-
function invariant_omnichainIndexingCursorLowerThanEarliestStartBlockAcrossQueuedChains(ctx) {
|
|
1129
|
-
const snapshot = ctx.value;
|
|
1130
|
-
const queuedChains = Array.from(snapshot.chains.values()).filter(
|
|
1131
|
-
(chain) => chain.chainStatus === ChainIndexingStatusIds.Queued
|
|
1132
|
-
);
|
|
1133
|
-
if (queuedChains.length === 0) {
|
|
1134
|
-
return;
|
|
1135
|
-
}
|
|
1136
|
-
const queuedChainStartBlocks = queuedChains.map((chain) => chain.config.startBlock.timestamp);
|
|
1137
|
-
const queuedChainEarliestStartBlock = Math.min(...queuedChainStartBlocks);
|
|
1138
|
-
if (snapshot.omnichainIndexingCursor >= queuedChainEarliestStartBlock) {
|
|
1139
|
-
ctx.issues.push({
|
|
1140
|
-
code: "custom",
|
|
1141
|
-
input: snapshot,
|
|
1142
|
-
message: "`omnichainIndexingCursor` must be lower than the earliest start block across all queued chains."
|
|
1143
|
-
});
|
|
1144
|
-
}
|
|
1145
|
-
}
|
|
1146
|
-
function invariant_omnichainIndexingCursorLowerThanOrEqualToLatestBackfillEndBlockAcrossBackfillChains(ctx) {
|
|
1147
|
-
const snapshot = ctx.value;
|
|
1148
|
-
const backfillChains = Array.from(snapshot.chains.values()).filter(
|
|
1149
|
-
(chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill
|
|
1150
|
-
);
|
|
1151
|
-
if (backfillChains.length === 0) {
|
|
1152
|
-
return;
|
|
1153
|
-
}
|
|
1154
|
-
const backfillEndBlocks = backfillChains.map((chain) => chain.backfillEndBlock.timestamp);
|
|
1155
|
-
const highestBackfillEndBlock = Math.max(...backfillEndBlocks);
|
|
1156
|
-
if (snapshot.omnichainIndexingCursor > highestBackfillEndBlock) {
|
|
1157
|
-
ctx.issues.push({
|
|
1158
|
-
code: "custom",
|
|
1159
|
-
input: snapshot,
|
|
1160
|
-
message: "`omnichainIndexingCursor` must be lower than or equal to the highest `backfillEndBlock` across all backfill chains."
|
|
1161
|
-
});
|
|
1162
|
-
}
|
|
1163
|
-
}
|
|
1164
|
-
function invariant_omnichainIndexingCursorIsEqualToHighestLatestIndexedBlockAcrossIndexedChain(ctx) {
|
|
1165
|
-
const snapshot = ctx.value;
|
|
1166
|
-
const indexedChains = Array.from(snapshot.chains.values()).filter(
|
|
1167
|
-
(chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill || chain.chainStatus === ChainIndexingStatusIds.Completed || chain.chainStatus === ChainIndexingStatusIds.Following
|
|
1168
|
-
);
|
|
1169
|
-
if (indexedChains.length === 0) {
|
|
1170
|
-
return;
|
|
1171
|
-
}
|
|
1172
|
-
const indexedChainLatestIndexedBlocks = indexedChains.map(
|
|
1173
|
-
(chain) => chain.latestIndexedBlock.timestamp
|
|
1174
|
-
);
|
|
1175
|
-
const indexedChainHighestLatestIndexedBlock = Math.max(...indexedChainLatestIndexedBlocks);
|
|
1176
|
-
if (snapshot.omnichainIndexingCursor !== indexedChainHighestLatestIndexedBlock) {
|
|
1177
|
-
ctx.issues.push({
|
|
1178
|
-
code: "custom",
|
|
1179
|
-
input: snapshot,
|
|
1180
|
-
message: "`omnichainIndexingCursor` must be same as the highest `latestIndexedBlock` across all indexed chains."
|
|
1181
|
-
});
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1184
|
-
function invariant_omnichainSnapshotUnstartedHasValidChains(ctx) {
|
|
1185
|
-
const chains = ctx.value;
|
|
1186
|
-
const hasValidChains = checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted(
|
|
1187
|
-
Array.from(chains.values())
|
|
1188
|
-
);
|
|
1189
|
-
if (hasValidChains === false) {
|
|
1190
|
-
ctx.issues.push({
|
|
1191
|
-
code: "custom",
|
|
1192
|
-
input: chains,
|
|
1193
|
-
message: `For omnichain status snapshot 'unstarted', all chains must have "queued" status.`
|
|
1194
|
-
});
|
|
1195
|
-
}
|
|
1196
|
-
}
|
|
1197
|
-
function invariant_omnichainStatusSnapshotBackfillHasValidChains(ctx) {
|
|
1198
|
-
const chains = ctx.value;
|
|
1199
|
-
const hasValidChains = checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill(
|
|
1200
|
-
Array.from(chains.values())
|
|
1201
|
-
);
|
|
1202
|
-
if (hasValidChains === false) {
|
|
1203
|
-
ctx.issues.push({
|
|
1204
|
-
code: "custom",
|
|
1205
|
-
input: chains,
|
|
1206
|
-
message: `For omnichain status snapshot 'backfill', at least one chain must be in "backfill" status and each chain has to have a status of either "queued", "backfill" or "completed".`
|
|
1207
|
-
});
|
|
1208
|
-
}
|
|
1209
|
-
}
|
|
1210
|
-
function invariant_omnichainStatusSnapshotCompletedHasValidChains(ctx) {
|
|
1211
|
-
const chains = ctx.value;
|
|
1212
|
-
const hasValidChains = checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted(
|
|
1213
|
-
Array.from(chains.values())
|
|
1214
|
-
);
|
|
1215
|
-
if (hasValidChains === false) {
|
|
1216
|
-
ctx.issues.push({
|
|
1217
|
-
code: "custom",
|
|
1218
|
-
input: chains,
|
|
1219
|
-
message: `For omnichain status snapshot 'completed', all chains must have "completed" status.`
|
|
1220
|
-
});
|
|
1221
|
-
}
|
|
1222
|
-
}
|
|
1223
|
-
function invariant_slowestChainEqualsToOmnichainSnapshotTime(ctx) {
|
|
1224
|
-
const { slowestChainIndexingCursor, omnichainSnapshot } = ctx.value;
|
|
1225
|
-
const { omnichainIndexingCursor } = omnichainSnapshot;
|
|
1226
|
-
if (slowestChainIndexingCursor !== omnichainIndexingCursor) {
|
|
1227
|
-
console.log("invariant_slowestChainEqualsToOmnichainSnapshotTime", {
|
|
1228
|
-
slowestChainIndexingCursor,
|
|
1229
|
-
omnichainIndexingCursor
|
|
1230
|
-
});
|
|
1231
|
-
ctx.issues.push({
|
|
1232
|
-
code: "custom",
|
|
1233
|
-
input: ctx.value,
|
|
1234
|
-
message: `'slowestChainIndexingCursor' must be equal to 'omnichainSnapshot.omnichainIndexingCursor'`
|
|
1235
|
-
});
|
|
1139
|
+
function getOmnichainIndexingStatus(chains) {
|
|
1140
|
+
if (checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing(chains)) {
|
|
1141
|
+
return OmnichainIndexingStatusIds.Following;
|
|
1236
1142
|
}
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
const { snapshotTime, omnichainSnapshot } = ctx.value;
|
|
1240
|
-
const chains = Array.from(omnichainSnapshot.chains.values());
|
|
1241
|
-
const startBlockTimestamps = chains.map((chain) => chain.config.startBlock.timestamp);
|
|
1242
|
-
const endBlockTimestamps = chains.map((chain) => chain.config).filter((chainConfig) => chainConfig.configType === ChainIndexingConfigTypeIds.Definite).map((chainConfig) => chainConfig.endBlock.timestamp);
|
|
1243
|
-
const backfillEndBlockTimestamps = chains.filter((chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill).map((chain) => chain.backfillEndBlock.timestamp);
|
|
1244
|
-
const latestKnownBlockTimestamps = chains.filter((chain) => chain.chainStatus === ChainIndexingStatusIds.Following).map((chain) => chain.latestKnownBlock.timestamp);
|
|
1245
|
-
const highestKnownBlockTimestamp = Math.max(
|
|
1246
|
-
...startBlockTimestamps,
|
|
1247
|
-
...endBlockTimestamps,
|
|
1248
|
-
...backfillEndBlockTimestamps,
|
|
1249
|
-
...latestKnownBlockTimestamps
|
|
1250
|
-
);
|
|
1251
|
-
if (snapshotTime < highestKnownBlockTimestamp) {
|
|
1252
|
-
ctx.issues.push({
|
|
1253
|
-
code: "custom",
|
|
1254
|
-
input: ctx.value,
|
|
1255
|
-
message: `'snapshotTime' (${snapshotTime}) must be greater than or equal to the "highest known block timestamp" (${highestKnownBlockTimestamp})`
|
|
1256
|
-
});
|
|
1143
|
+
if (checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill(chains)) {
|
|
1144
|
+
return OmnichainIndexingStatusIds.Backfill;
|
|
1257
1145
|
}
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
const projection = ctx.value;
|
|
1261
|
-
const { snapshot, projectedAt } = projection;
|
|
1262
|
-
if (snapshot.snapshotTime > projectedAt) {
|
|
1263
|
-
ctx.issues.push({
|
|
1264
|
-
code: "custom",
|
|
1265
|
-
input: projection,
|
|
1266
|
-
message: "`projectedAt` must be after or same as `snapshot.snapshotTime`."
|
|
1267
|
-
});
|
|
1146
|
+
if (checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted(chains)) {
|
|
1147
|
+
return OmnichainIndexingStatusIds.Unstarted;
|
|
1268
1148
|
}
|
|
1149
|
+
if (checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted(chains)) {
|
|
1150
|
+
return OmnichainIndexingStatusIds.Completed;
|
|
1151
|
+
}
|
|
1152
|
+
throw new Error(`Unable to determine omnichain indexing status for provided chains.`);
|
|
1269
1153
|
}
|
|
1270
|
-
function
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1154
|
+
function getOmnichainIndexingCursor(chains) {
|
|
1155
|
+
if (chains.length === 0) {
|
|
1156
|
+
throw new Error(`Unable to determine omnichain indexing cursor when no chains were provided.`);
|
|
1157
|
+
}
|
|
1158
|
+
if (getOmnichainIndexingStatus(chains) === OmnichainIndexingStatusIds.Unstarted) {
|
|
1159
|
+
const earliestStartBlockTimestamps = chains.map((chain) => chain.config.startBlock.timestamp);
|
|
1160
|
+
return Math.min(...earliestStartBlockTimestamps) - 1;
|
|
1161
|
+
}
|
|
1162
|
+
const latestIndexedBlockTimestamps = chains.filter((chain) => chain.chainStatus !== ChainIndexingStatusIds.Queued).map((chain) => chain.latestIndexedBlock.timestamp);
|
|
1163
|
+
if (latestIndexedBlockTimestamps.length < 1) {
|
|
1164
|
+
throw new Error("latestIndexedBlockTimestamps array must include at least one element");
|
|
1281
1165
|
}
|
|
1166
|
+
return Math.max(...latestIndexedBlockTimestamps);
|
|
1282
1167
|
}
|
|
1283
1168
|
|
|
1284
1169
|
// src/ensindexer/indexing-status/zod-schema/chain-indexing-status-snapshot.ts
|
|
@@ -1417,7 +1302,115 @@ var makeChainIndexingStatusSnapshotSchema = (valueLabel = "Value") => z5.discrim
|
|
|
1417
1302
|
]);
|
|
1418
1303
|
var makeSerializedChainIndexingStatusSnapshotSchema = makeChainIndexingStatusSnapshotSchema;
|
|
1419
1304
|
|
|
1420
|
-
// src/ensindexer/indexing-status/zod-
|
|
1305
|
+
// src/ensindexer/indexing-status/zod-schema/omnichain-indexing-status-snapshot.ts
|
|
1306
|
+
function invariant_omnichainSnapshotStatusIsConsistentWithChainSnapshot(ctx) {
|
|
1307
|
+
const snapshot = ctx.value;
|
|
1308
|
+
const chains = Array.from(snapshot.chains.values());
|
|
1309
|
+
const expectedOmnichainStatus = getOmnichainIndexingStatus(chains);
|
|
1310
|
+
const actualOmnichainStatus = snapshot.omnichainStatus;
|
|
1311
|
+
if (expectedOmnichainStatus !== actualOmnichainStatus) {
|
|
1312
|
+
ctx.issues.push({
|
|
1313
|
+
code: "custom",
|
|
1314
|
+
input: snapshot,
|
|
1315
|
+
message: `'${actualOmnichainStatus}' is an invalid omnichainStatus. Expected '${expectedOmnichainStatus}' based on the statuses of individual chains.`
|
|
1316
|
+
});
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
function invariant_omnichainIndexingCursorLowerThanEarliestStartBlockAcrossQueuedChains(ctx) {
|
|
1320
|
+
const snapshot = ctx.value;
|
|
1321
|
+
const queuedChains = Array.from(snapshot.chains.values()).filter(
|
|
1322
|
+
(chain) => chain.chainStatus === ChainIndexingStatusIds.Queued
|
|
1323
|
+
);
|
|
1324
|
+
if (queuedChains.length === 0) {
|
|
1325
|
+
return;
|
|
1326
|
+
}
|
|
1327
|
+
const queuedChainStartBlocks = queuedChains.map((chain) => chain.config.startBlock.timestamp);
|
|
1328
|
+
const queuedChainEarliestStartBlock = Math.min(...queuedChainStartBlocks);
|
|
1329
|
+
if (snapshot.omnichainIndexingCursor >= queuedChainEarliestStartBlock) {
|
|
1330
|
+
ctx.issues.push({
|
|
1331
|
+
code: "custom",
|
|
1332
|
+
input: snapshot,
|
|
1333
|
+
message: "`omnichainIndexingCursor` must be lower than the earliest start block across all queued chains."
|
|
1334
|
+
});
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
function invariant_omnichainIndexingCursorLowerThanOrEqualToLatestBackfillEndBlockAcrossBackfillChains(ctx) {
|
|
1338
|
+
const snapshot = ctx.value;
|
|
1339
|
+
const backfillChains = Array.from(snapshot.chains.values()).filter(
|
|
1340
|
+
(chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill
|
|
1341
|
+
);
|
|
1342
|
+
if (backfillChains.length === 0) {
|
|
1343
|
+
return;
|
|
1344
|
+
}
|
|
1345
|
+
const backfillEndBlocks = backfillChains.map((chain) => chain.backfillEndBlock.timestamp);
|
|
1346
|
+
const highestBackfillEndBlock = Math.max(...backfillEndBlocks);
|
|
1347
|
+
if (snapshot.omnichainIndexingCursor > highestBackfillEndBlock) {
|
|
1348
|
+
ctx.issues.push({
|
|
1349
|
+
code: "custom",
|
|
1350
|
+
input: snapshot,
|
|
1351
|
+
message: "`omnichainIndexingCursor` must be lower than or equal to the highest `backfillEndBlock` across all backfill chains."
|
|
1352
|
+
});
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
function invariant_omnichainIndexingCursorIsEqualToHighestLatestIndexedBlockAcrossIndexedChain(ctx) {
|
|
1356
|
+
const snapshot = ctx.value;
|
|
1357
|
+
const indexedChains = Array.from(snapshot.chains.values()).filter(
|
|
1358
|
+
(chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill || chain.chainStatus === ChainIndexingStatusIds.Completed || chain.chainStatus === ChainIndexingStatusIds.Following
|
|
1359
|
+
);
|
|
1360
|
+
if (indexedChains.length === 0) {
|
|
1361
|
+
return;
|
|
1362
|
+
}
|
|
1363
|
+
const indexedChainLatestIndexedBlocks = indexedChains.map(
|
|
1364
|
+
(chain) => chain.latestIndexedBlock.timestamp
|
|
1365
|
+
);
|
|
1366
|
+
const indexedChainHighestLatestIndexedBlock = Math.max(...indexedChainLatestIndexedBlocks);
|
|
1367
|
+
if (snapshot.omnichainIndexingCursor !== indexedChainHighestLatestIndexedBlock) {
|
|
1368
|
+
ctx.issues.push({
|
|
1369
|
+
code: "custom",
|
|
1370
|
+
input: snapshot,
|
|
1371
|
+
message: "`omnichainIndexingCursor` must be same as the highest `latestIndexedBlock` across all indexed chains."
|
|
1372
|
+
});
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
function invariant_omnichainSnapshotUnstartedHasValidChains(ctx) {
|
|
1376
|
+
const chains = ctx.value;
|
|
1377
|
+
const hasValidChains = checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted(
|
|
1378
|
+
Array.from(chains.values())
|
|
1379
|
+
);
|
|
1380
|
+
if (hasValidChains === false) {
|
|
1381
|
+
ctx.issues.push({
|
|
1382
|
+
code: "custom",
|
|
1383
|
+
input: chains,
|
|
1384
|
+
message: `For omnichain status snapshot 'unstarted', all chains must have "queued" status.`
|
|
1385
|
+
});
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
function invariant_omnichainStatusSnapshotBackfillHasValidChains(ctx) {
|
|
1389
|
+
const chains = ctx.value;
|
|
1390
|
+
const hasValidChains = checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill(
|
|
1391
|
+
Array.from(chains.values())
|
|
1392
|
+
);
|
|
1393
|
+
if (hasValidChains === false) {
|
|
1394
|
+
ctx.issues.push({
|
|
1395
|
+
code: "custom",
|
|
1396
|
+
input: chains,
|
|
1397
|
+
message: `For omnichain status snapshot 'backfill', at least one chain must be in "backfill" status and each chain has to have a status of either "queued", "backfill" or "completed".`
|
|
1398
|
+
});
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
function invariant_omnichainStatusSnapshotCompletedHasValidChains(ctx) {
|
|
1402
|
+
const chains = ctx.value;
|
|
1403
|
+
const hasValidChains = checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted(
|
|
1404
|
+
Array.from(chains.values())
|
|
1405
|
+
);
|
|
1406
|
+
if (hasValidChains === false) {
|
|
1407
|
+
ctx.issues.push({
|
|
1408
|
+
code: "custom",
|
|
1409
|
+
input: chains,
|
|
1410
|
+
message: `For omnichain status snapshot 'completed', all chains must have "completed" status.`
|
|
1411
|
+
});
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1421
1414
|
var makeChainIndexingStatusesSchema = (valueLabel = "Value") => z6.record(makeChainIdStringSchema(), makeChainIndexingStatusSnapshotSchema(valueLabel), {
|
|
1422
1415
|
error: "Chains indexing statuses must be an object mapping valid chain IDs to their indexing status snapshots."
|
|
1423
1416
|
}).transform((serializedChainsIndexingStatus) => {
|
|
@@ -1457,34 +1450,24 @@ var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexin
|
|
|
1457
1450
|
]).check(invariant_omnichainSnapshotStatusIsConsistentWithChainSnapshot).check(invariant_omnichainIndexingCursorLowerThanEarliestStartBlockAcrossQueuedChains).check(
|
|
1458
1451
|
invariant_omnichainIndexingCursorLowerThanOrEqualToLatestBackfillEndBlockAcrossBackfillChains
|
|
1459
1452
|
).check(invariant_omnichainIndexingCursorIsEqualToHighestLatestIndexedBlockAcrossIndexedChain);
|
|
1460
|
-
|
|
1461
|
-
|
|
1453
|
+
|
|
1454
|
+
// src/ensindexer/indexing-status/zod-schemas.ts
|
|
1455
|
+
var makeCrossChainIndexingStatusSnapshotOmnichainSchema = (valueLabel = "Cross-chain Indexing Status Snapshot Omnichain") => z7.strictObject({
|
|
1456
|
+
strategy: z7.literal(CrossChainIndexingStrategyIds.Omnichain),
|
|
1462
1457
|
slowestChainIndexingCursor: makeUnixTimestampSchema(valueLabel),
|
|
1463
1458
|
snapshotTime: makeUnixTimestampSchema(valueLabel),
|
|
1464
1459
|
omnichainSnapshot: makeOmnichainIndexingStatusSnapshotSchema(valueLabel)
|
|
1465
1460
|
}).check(invariant_slowestChainEqualsToOmnichainSnapshotTime).check(invariant_snapshotTimeIsTheHighestKnownBlockTimestamp);
|
|
1466
|
-
var makeCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Cross-chain Indexing Status Snapshot") =>
|
|
1461
|
+
var makeCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Cross-chain Indexing Status Snapshot") => z7.discriminatedUnion("strategy", [
|
|
1467
1462
|
makeCrossChainIndexingStatusSnapshotOmnichainSchema(valueLabel)
|
|
1468
1463
|
]);
|
|
1469
|
-
var makeRealtimeIndexingStatusProjectionSchema = (valueLabel = "Realtime Indexing Status Projection") =>
|
|
1464
|
+
var makeRealtimeIndexingStatusProjectionSchema = (valueLabel = "Realtime Indexing Status Projection") => z7.strictObject({
|
|
1470
1465
|
projectedAt: makeUnixTimestampSchema(valueLabel),
|
|
1471
1466
|
worstCaseDistance: makeDurationSchema(valueLabel),
|
|
1472
1467
|
snapshot: makeCrossChainIndexingStatusSnapshotSchema(valueLabel)
|
|
1473
1468
|
}).check(invariant_realtimeIndexingStatusProjectionProjectedAtIsAfterOrEqualToSnapshotTime).check(invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect);
|
|
1474
1469
|
|
|
1475
1470
|
// src/ensindexer/indexing-status/deserialize.ts
|
|
1476
|
-
function deserializeOmnichainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
1477
|
-
const schema = makeOmnichainIndexingStatusSnapshotSchema(valueLabel);
|
|
1478
|
-
const parsed = schema.safeParse(maybeSnapshot);
|
|
1479
|
-
if (parsed.error) {
|
|
1480
|
-
throw new Error(
|
|
1481
|
-
`Cannot deserialize into OmnichainIndexingStatusSnapshot:
|
|
1482
|
-
${prettifyError4(parsed.error)}
|
|
1483
|
-
`
|
|
1484
|
-
);
|
|
1485
|
-
}
|
|
1486
|
-
return parsed.data;
|
|
1487
|
-
}
|
|
1488
1471
|
function deserializeCrossChainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
1489
1472
|
const schema = makeCrossChainIndexingStatusSnapshotSchema(valueLabel);
|
|
1490
1473
|
const parsed = schema.safeParse(maybeSnapshot);
|
|
@@ -1525,6 +1508,33 @@ ${prettifyError5(parsed.error)}
|
|
|
1525
1508
|
return parsed.data;
|
|
1526
1509
|
}
|
|
1527
1510
|
|
|
1511
|
+
// src/ensindexer/indexing-status/deserialize/omnichain-indexing-status-snapshot.ts
|
|
1512
|
+
import { prettifyError as prettifyError6 } from "zod/v4";
|
|
1513
|
+
function deserializeOmnichainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
1514
|
+
const schema = makeOmnichainIndexingStatusSnapshotSchema(valueLabel);
|
|
1515
|
+
const parsed = schema.safeParse(maybeSnapshot);
|
|
1516
|
+
if (parsed.error) {
|
|
1517
|
+
throw new Error(
|
|
1518
|
+
`Cannot deserialize into OmnichainIndexingStatusSnapshot:
|
|
1519
|
+
${prettifyError6(parsed.error)}
|
|
1520
|
+
`
|
|
1521
|
+
);
|
|
1522
|
+
}
|
|
1523
|
+
return parsed.data;
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
// src/ensindexer/indexing-status/helpers.ts
|
|
1527
|
+
function getLatestIndexedBlockRef(indexingStatus, chainId) {
|
|
1528
|
+
const chainIndexingStatus = indexingStatus.omnichainSnapshot.chains.get(chainId);
|
|
1529
|
+
if (chainIndexingStatus === void 0) {
|
|
1530
|
+
return null;
|
|
1531
|
+
}
|
|
1532
|
+
if (chainIndexingStatus.chainStatus === ChainIndexingStatusIds.Queued) {
|
|
1533
|
+
return null;
|
|
1534
|
+
}
|
|
1535
|
+
return chainIndexingStatus.latestIndexedBlock;
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1528
1538
|
// src/ensindexer/indexing-status/projection.ts
|
|
1529
1539
|
function createRealtimeIndexingStatusProjection(snapshot, now) {
|
|
1530
1540
|
const projectedAt = Math.max(now, snapshot.snapshotTime);
|
|
@@ -1588,27 +1598,7 @@ function serializeChainIndexingSnapshots(chains) {
|
|
|
1588
1598
|
return serializedSnapshots;
|
|
1589
1599
|
}
|
|
1590
1600
|
|
|
1591
|
-
// src/ensindexer/indexing-status/serialize.ts
|
|
1592
|
-
function serializeCrossChainIndexingStatusSnapshotOmnichain({
|
|
1593
|
-
strategy,
|
|
1594
|
-
slowestChainIndexingCursor,
|
|
1595
|
-
snapshotTime,
|
|
1596
|
-
omnichainSnapshot
|
|
1597
|
-
}) {
|
|
1598
|
-
return {
|
|
1599
|
-
strategy,
|
|
1600
|
-
slowestChainIndexingCursor,
|
|
1601
|
-
snapshotTime,
|
|
1602
|
-
omnichainSnapshot: serializeOmnichainIndexingStatusSnapshot(omnichainSnapshot)
|
|
1603
|
-
};
|
|
1604
|
-
}
|
|
1605
|
-
function serializeRealtimeIndexingStatusProjection(indexingProjection) {
|
|
1606
|
-
return {
|
|
1607
|
-
projectedAt: indexingProjection.projectedAt,
|
|
1608
|
-
worstCaseDistance: indexingProjection.worstCaseDistance,
|
|
1609
|
-
snapshot: serializeCrossChainIndexingStatusSnapshotOmnichain(indexingProjection.snapshot)
|
|
1610
|
-
};
|
|
1611
|
-
}
|
|
1601
|
+
// src/ensindexer/indexing-status/serialize/omnichain-indexing-status-snapshot.ts
|
|
1612
1602
|
function serializeOmnichainIndexingStatusSnapshot(indexingStatus) {
|
|
1613
1603
|
switch (indexingStatus.omnichainStatus) {
|
|
1614
1604
|
case OmnichainIndexingStatusIds.Unstarted:
|
|
@@ -1639,14 +1629,36 @@ function serializeOmnichainIndexingStatusSnapshot(indexingStatus) {
|
|
|
1639
1629
|
}
|
|
1640
1630
|
}
|
|
1641
1631
|
|
|
1632
|
+
// src/ensindexer/indexing-status/serialize.ts
|
|
1633
|
+
function serializeCrossChainIndexingStatusSnapshotOmnichain({
|
|
1634
|
+
strategy,
|
|
1635
|
+
slowestChainIndexingCursor,
|
|
1636
|
+
snapshotTime,
|
|
1637
|
+
omnichainSnapshot
|
|
1638
|
+
}) {
|
|
1639
|
+
return {
|
|
1640
|
+
strategy,
|
|
1641
|
+
slowestChainIndexingCursor,
|
|
1642
|
+
snapshotTime,
|
|
1643
|
+
omnichainSnapshot: serializeOmnichainIndexingStatusSnapshot(omnichainSnapshot)
|
|
1644
|
+
};
|
|
1645
|
+
}
|
|
1646
|
+
function serializeRealtimeIndexingStatusProjection(indexingProjection) {
|
|
1647
|
+
return {
|
|
1648
|
+
projectedAt: indexingProjection.projectedAt,
|
|
1649
|
+
worstCaseDistance: indexingProjection.worstCaseDistance,
|
|
1650
|
+
snapshot: serializeCrossChainIndexingStatusSnapshotOmnichain(indexingProjection.snapshot)
|
|
1651
|
+
};
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1642
1654
|
// src/ensindexer/indexing-status/validate/chain-indexing-status-snapshot.ts
|
|
1643
|
-
import { prettifyError as
|
|
1655
|
+
import { prettifyError as prettifyError7 } from "zod/v4";
|
|
1644
1656
|
function validateChainIndexingStatusSnapshot(unvalidatedSnapshot, valueLabel) {
|
|
1645
1657
|
const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
|
|
1646
1658
|
const parsed = schema.safeParse(unvalidatedSnapshot);
|
|
1647
1659
|
if (parsed.error) {
|
|
1648
1660
|
throw new Error(`Invalid ChainIndexingStatusSnapshot:
|
|
1649
|
-
${
|
|
1661
|
+
${prettifyError7(parsed.error)}
|
|
1650
1662
|
`);
|
|
1651
1663
|
}
|
|
1652
1664
|
return parsed.data;
|
|
@@ -1673,10 +1685,10 @@ function serializeConfigResponse(response) {
|
|
|
1673
1685
|
}
|
|
1674
1686
|
|
|
1675
1687
|
// src/api/indexing-status/deserialize.ts
|
|
1676
|
-
import { prettifyError as
|
|
1688
|
+
import { prettifyError as prettifyError8 } from "zod/v4";
|
|
1677
1689
|
|
|
1678
1690
|
// src/api/indexing-status/zod-schemas.ts
|
|
1679
|
-
import { z as
|
|
1691
|
+
import { z as z8 } from "zod/v4";
|
|
1680
1692
|
|
|
1681
1693
|
// src/api/indexing-status/response.ts
|
|
1682
1694
|
var IndexingStatusResponseCodes = {
|
|
@@ -1691,14 +1703,14 @@ var IndexingStatusResponseCodes = {
|
|
|
1691
1703
|
};
|
|
1692
1704
|
|
|
1693
1705
|
// src/api/indexing-status/zod-schemas.ts
|
|
1694
|
-
var makeIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") =>
|
|
1695
|
-
responseCode:
|
|
1706
|
+
var makeIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => z8.strictObject({
|
|
1707
|
+
responseCode: z8.literal(IndexingStatusResponseCodes.Ok),
|
|
1696
1708
|
realtimeProjection: makeRealtimeIndexingStatusProjectionSchema(valueLabel)
|
|
1697
1709
|
});
|
|
1698
|
-
var makeIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") =>
|
|
1699
|
-
responseCode:
|
|
1710
|
+
var makeIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => z8.strictObject({
|
|
1711
|
+
responseCode: z8.literal(IndexingStatusResponseCodes.Error)
|
|
1700
1712
|
});
|
|
1701
|
-
var makeIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") =>
|
|
1713
|
+
var makeIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => z8.discriminatedUnion("responseCode", [
|
|
1702
1714
|
makeIndexingStatusResponseOkSchema(valueLabel),
|
|
1703
1715
|
makeIndexingStatusResponseErrorSchema(valueLabel)
|
|
1704
1716
|
]);
|
|
@@ -1708,7 +1720,7 @@ function deserializeIndexingStatusResponse(maybeResponse) {
|
|
|
1708
1720
|
const parsed = makeIndexingStatusResponseSchema().safeParse(maybeResponse);
|
|
1709
1721
|
if (parsed.error) {
|
|
1710
1722
|
throw new Error(`Cannot deserialize IndexingStatusResponse:
|
|
1711
|
-
${
|
|
1723
|
+
${prettifyError8(parsed.error)}
|
|
1712
1724
|
`);
|
|
1713
1725
|
}
|
|
1714
1726
|
return parsed.data;
|
|
@@ -1728,20 +1740,20 @@ function serializeIndexingStatusResponse(response) {
|
|
|
1728
1740
|
}
|
|
1729
1741
|
|
|
1730
1742
|
// src/api/name-tokens/deserialize.ts
|
|
1731
|
-
import { prettifyError as
|
|
1743
|
+
import { prettifyError as prettifyError10 } from "zod/v4";
|
|
1732
1744
|
|
|
1733
1745
|
// src/api/name-tokens/zod-schemas.ts
|
|
1734
1746
|
import { namehash as namehash2 } from "viem";
|
|
1735
|
-
import { z as
|
|
1747
|
+
import { z as z11 } from "zod/v4";
|
|
1736
1748
|
|
|
1737
1749
|
// src/tokenscope/assets.ts
|
|
1738
1750
|
import { isAddressEqual as isAddressEqual3, zeroAddress as zeroAddress3 } from "viem";
|
|
1739
|
-
import { prettifyError as
|
|
1751
|
+
import { prettifyError as prettifyError9 } from "zod/v4";
|
|
1740
1752
|
|
|
1741
1753
|
// src/tokenscope/zod-schemas.ts
|
|
1742
1754
|
import { AssetId as CaipAssetId2 } from "caip";
|
|
1743
1755
|
import { zeroAddress as zeroAddress2 } from "viem";
|
|
1744
|
-
import { z as
|
|
1756
|
+
import { z as z9 } from "zod/v4";
|
|
1745
1757
|
|
|
1746
1758
|
// src/shared/types.ts
|
|
1747
1759
|
var AssetNamespaces = {
|
|
@@ -1866,10 +1878,10 @@ function getNameTokenOwnership(namespaceId, name, owner) {
|
|
|
1866
1878
|
}
|
|
1867
1879
|
|
|
1868
1880
|
// src/tokenscope/zod-schemas.ts
|
|
1869
|
-
var tokenIdSchemaSerializable =
|
|
1870
|
-
var tokenIdSchemaNative =
|
|
1881
|
+
var tokenIdSchemaSerializable = z9.string();
|
|
1882
|
+
var tokenIdSchemaNative = z9.preprocess(
|
|
1871
1883
|
(v) => typeof v === "string" ? BigInt(v) : v,
|
|
1872
|
-
|
|
1884
|
+
z9.bigint().positive()
|
|
1873
1885
|
);
|
|
1874
1886
|
function makeTokenIdSchema(_valueLabel = "Token ID Schema", serializable = false) {
|
|
1875
1887
|
if (serializable) {
|
|
@@ -1879,13 +1891,13 @@ function makeTokenIdSchema(_valueLabel = "Token ID Schema", serializable = false
|
|
|
1879
1891
|
}
|
|
1880
1892
|
}
|
|
1881
1893
|
var makeAssetIdSchema = (valueLabel = "Asset ID Schema", serializable) => {
|
|
1882
|
-
return
|
|
1883
|
-
assetNamespace:
|
|
1894
|
+
return z9.object({
|
|
1895
|
+
assetNamespace: z9.enum(AssetNamespaces),
|
|
1884
1896
|
contract: makeAccountIdSchema(valueLabel),
|
|
1885
1897
|
tokenId: makeTokenIdSchema(valueLabel, serializable ?? false)
|
|
1886
1898
|
});
|
|
1887
1899
|
};
|
|
1888
|
-
var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") =>
|
|
1900
|
+
var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") => z9.preprocess((v) => {
|
|
1889
1901
|
if (typeof v === "string") {
|
|
1890
1902
|
const result = new CaipAssetId2(v);
|
|
1891
1903
|
return {
|
|
@@ -1909,20 +1921,20 @@ function invariant_nameTokenOwnershipHasNonZeroAddressOwner(ctx) {
|
|
|
1909
1921
|
});
|
|
1910
1922
|
}
|
|
1911
1923
|
}
|
|
1912
|
-
var makeNameTokenOwnershipNameWrapperSchema = (valueLabel = "Name Token Ownership NameWrapper") =>
|
|
1913
|
-
ownershipType:
|
|
1924
|
+
var makeNameTokenOwnershipNameWrapperSchema = (valueLabel = "Name Token Ownership NameWrapper") => z9.object({
|
|
1925
|
+
ownershipType: z9.literal(NameTokenOwnershipTypes.NameWrapper),
|
|
1914
1926
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
1915
1927
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
1916
|
-
var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") =>
|
|
1917
|
-
ownershipType:
|
|
1928
|
+
var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") => z9.object({
|
|
1929
|
+
ownershipType: z9.literal(NameTokenOwnershipTypes.FullyOnchain),
|
|
1918
1930
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
1919
1931
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
1920
|
-
var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") =>
|
|
1921
|
-
ownershipType:
|
|
1932
|
+
var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") => z9.object({
|
|
1933
|
+
ownershipType: z9.literal(NameTokenOwnershipTypes.Burned),
|
|
1922
1934
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
1923
1935
|
}).check(invariant_nameTokenOwnershipHasZeroAddressOwner);
|
|
1924
|
-
var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") =>
|
|
1925
|
-
ownershipType:
|
|
1936
|
+
var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") => z9.object({
|
|
1937
|
+
ownershipType: z9.literal(NameTokenOwnershipTypes.Unknown),
|
|
1926
1938
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
1927
1939
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
1928
1940
|
function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
|
|
@@ -1935,16 +1947,16 @@ function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
|
|
|
1935
1947
|
});
|
|
1936
1948
|
}
|
|
1937
1949
|
}
|
|
1938
|
-
var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") =>
|
|
1950
|
+
var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") => z9.discriminatedUnion("ownershipType", [
|
|
1939
1951
|
makeNameTokenOwnershipNameWrapperSchema(valueLabel),
|
|
1940
1952
|
makeNameTokenOwnershipFullyOnchainSchema(valueLabel),
|
|
1941
1953
|
makeNameTokenOwnershipBurnedSchema(valueLabel),
|
|
1942
1954
|
makeNameTokenOwnershipUnknownSchema(valueLabel)
|
|
1943
1955
|
]);
|
|
1944
|
-
var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) =>
|
|
1956
|
+
var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) => z9.object({
|
|
1945
1957
|
token: makeAssetIdSchema(`${valueLabel}.token`, serializable),
|
|
1946
1958
|
ownership: makeNameTokenOwnershipSchema(`${valueLabel}.ownership`),
|
|
1947
|
-
mintStatus:
|
|
1959
|
+
mintStatus: z9.enum(NFTMintStatuses)
|
|
1948
1960
|
});
|
|
1949
1961
|
|
|
1950
1962
|
// src/tokenscope/assets.ts
|
|
@@ -1960,7 +1972,7 @@ function deserializeAssetId(maybeAssetId, valueLabel) {
|
|
|
1960
1972
|
const parsed = schema.safeParse(maybeAssetId);
|
|
1961
1973
|
if (parsed.error) {
|
|
1962
1974
|
throw new RangeError(`Cannot deserialize AssetId:
|
|
1963
|
-
${
|
|
1975
|
+
${prettifyError9(parsed.error)}
|
|
1964
1976
|
`);
|
|
1965
1977
|
}
|
|
1966
1978
|
return parsed.data;
|
|
@@ -1970,7 +1982,7 @@ function parseAssetId(maybeAssetId, valueLabel) {
|
|
|
1970
1982
|
const parsed = schema.safeParse(maybeAssetId);
|
|
1971
1983
|
if (parsed.error) {
|
|
1972
1984
|
throw new RangeError(`Cannot parse AssetId:
|
|
1973
|
-
${
|
|
1985
|
+
${prettifyError9(parsed.error)}
|
|
1974
1986
|
`);
|
|
1975
1987
|
}
|
|
1976
1988
|
return parsed.data;
|
|
@@ -2192,10 +2204,10 @@ ${formatNFTTransferEventMetadata(metadata)}`
|
|
|
2192
2204
|
};
|
|
2193
2205
|
|
|
2194
2206
|
// src/api/shared/errors/zod-schemas.ts
|
|
2195
|
-
import { z as
|
|
2196
|
-
var ErrorResponseSchema =
|
|
2197
|
-
message:
|
|
2198
|
-
details:
|
|
2207
|
+
import { z as z10 } from "zod/v4";
|
|
2208
|
+
var ErrorResponseSchema = z10.object({
|
|
2209
|
+
message: z10.string(),
|
|
2210
|
+
details: z10.optional(z10.unknown())
|
|
2199
2211
|
});
|
|
2200
2212
|
|
|
2201
2213
|
// src/api/name-tokens/response.ts
|
|
@@ -2234,10 +2246,10 @@ var NameTokensResponseErrorCodes = {
|
|
|
2234
2246
|
};
|
|
2235
2247
|
|
|
2236
2248
|
// src/api/name-tokens/zod-schemas.ts
|
|
2237
|
-
var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) =>
|
|
2249
|
+
var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) => z11.object({
|
|
2238
2250
|
domainId: makeNodeSchema(`${valueLabel}.domainId`),
|
|
2239
2251
|
name: makeReinterpretedNameSchema(valueLabel),
|
|
2240
|
-
tokens:
|
|
2252
|
+
tokens: z11.array(makeNameTokenSchema(`${valueLabel}.tokens`, serializable)).nonempty(),
|
|
2241
2253
|
expiresAt: makeUnixTimestampSchema(`${valueLabel}.expiresAt`),
|
|
2242
2254
|
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
|
|
2243
2255
|
}).check(function invariant_nameIsAssociatedWithDomainId(ctx) {
|
|
@@ -2279,32 +2291,32 @@ var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", seria
|
|
|
2279
2291
|
});
|
|
2280
2292
|
}
|
|
2281
2293
|
});
|
|
2282
|
-
var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) =>
|
|
2283
|
-
responseCode:
|
|
2294
|
+
var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) => z11.strictObject({
|
|
2295
|
+
responseCode: z11.literal(NameTokensResponseCodes.Ok),
|
|
2284
2296
|
registeredNameTokens: makeRegisteredNameTokenSchema(`${valueLabel}.nameTokens`, serializable)
|
|
2285
2297
|
});
|
|
2286
|
-
var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") =>
|
|
2287
|
-
responseCode:
|
|
2288
|
-
errorCode:
|
|
2298
|
+
var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") => z11.strictObject({
|
|
2299
|
+
responseCode: z11.literal(NameTokensResponseCodes.Error),
|
|
2300
|
+
errorCode: z11.literal(NameTokensResponseErrorCodes.NameTokensNotIndexed),
|
|
2289
2301
|
error: ErrorResponseSchema
|
|
2290
2302
|
});
|
|
2291
|
-
var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") =>
|
|
2292
|
-
responseCode:
|
|
2293
|
-
errorCode:
|
|
2303
|
+
var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") => z11.strictObject({
|
|
2304
|
+
responseCode: z11.literal(NameTokensResponseCodes.Error),
|
|
2305
|
+
errorCode: z11.literal(NameTokensResponseErrorCodes.EnsIndexerConfigUnsupported),
|
|
2294
2306
|
error: ErrorResponseSchema
|
|
2295
2307
|
});
|
|
2296
|
-
var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") =>
|
|
2297
|
-
responseCode:
|
|
2298
|
-
errorCode:
|
|
2308
|
+
var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") => z11.strictObject({
|
|
2309
|
+
responseCode: z11.literal(NameTokensResponseCodes.Error),
|
|
2310
|
+
errorCode: z11.literal(NameTokensResponseErrorCodes.IndexingStatusUnsupported),
|
|
2299
2311
|
error: ErrorResponseSchema
|
|
2300
2312
|
});
|
|
2301
|
-
var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") =>
|
|
2313
|
+
var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") => z11.discriminatedUnion("errorCode", [
|
|
2302
2314
|
makeNameTokensResponseErrorNameTokensNotIndexedSchema(valueLabel),
|
|
2303
2315
|
makeNameTokensResponseErrorEnsIndexerConfigUnsupported(valueLabel),
|
|
2304
2316
|
makeNameTokensResponseErrorNameIndexingStatusUnsupported(valueLabel)
|
|
2305
2317
|
]);
|
|
2306
2318
|
var makeNameTokensResponseSchema = (valueLabel = "Name Tokens Response", serializable) => {
|
|
2307
|
-
return
|
|
2319
|
+
return z11.discriminatedUnion("responseCode", [
|
|
2308
2320
|
makeNameTokensResponseOkSchema(valueLabel, serializable ?? false),
|
|
2309
2321
|
makeNameTokensResponseErrorSchema(valueLabel)
|
|
2310
2322
|
]);
|
|
@@ -2317,7 +2329,7 @@ function deserializedNameTokensResponse(maybeResponse) {
|
|
|
2317
2329
|
);
|
|
2318
2330
|
if (parsed.error) {
|
|
2319
2331
|
throw new Error(`Cannot deserialize NameTokensResponse:
|
|
2320
|
-
${
|
|
2332
|
+
${prettifyError10(parsed.error)}
|
|
2321
2333
|
`);
|
|
2322
2334
|
}
|
|
2323
2335
|
return parsed.data;
|
|
@@ -2391,14 +2403,14 @@ function serializeNameTokensResponse(response) {
|
|
|
2391
2403
|
}
|
|
2392
2404
|
|
|
2393
2405
|
// src/api/registrar-actions/deserialize.ts
|
|
2394
|
-
import { prettifyError as
|
|
2406
|
+
import { prettifyError as prettifyError11 } from "zod/v4";
|
|
2395
2407
|
|
|
2396
2408
|
// src/api/registrar-actions/zod-schemas.ts
|
|
2397
2409
|
import { namehash as namehash3 } from "viem/ens";
|
|
2398
|
-
import { z as
|
|
2410
|
+
import { z as z14 } from "zod/v4";
|
|
2399
2411
|
|
|
2400
2412
|
// src/registrars/zod-schemas.ts
|
|
2401
|
-
import { z as
|
|
2413
|
+
import { z as z12 } from "zod/v4";
|
|
2402
2414
|
|
|
2403
2415
|
// src/registrars/encoded-referrer.ts
|
|
2404
2416
|
import { getAddress, pad, size as size2, slice, zeroAddress as zeroAddress4 } from "viem";
|
|
@@ -2473,11 +2485,11 @@ function serializeRegistrarAction(registrarAction) {
|
|
|
2473
2485
|
}
|
|
2474
2486
|
|
|
2475
2487
|
// src/registrars/zod-schemas.ts
|
|
2476
|
-
var makeSubregistrySchema = (valueLabel = "Subregistry") =>
|
|
2488
|
+
var makeSubregistrySchema = (valueLabel = "Subregistry") => z12.object({
|
|
2477
2489
|
subregistryId: makeAccountIdSchema(`${valueLabel} Subregistry ID`),
|
|
2478
2490
|
node: makeNodeSchema(`${valueLabel} Node`)
|
|
2479
2491
|
});
|
|
2480
|
-
var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") =>
|
|
2492
|
+
var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") => z12.object({
|
|
2481
2493
|
subregistry: makeSubregistrySchema(`${valueLabel} Subregistry`),
|
|
2482
2494
|
node: makeNodeSchema(`${valueLabel} Node`),
|
|
2483
2495
|
expiresAt: makeUnixTimestampSchema(`${valueLabel} Expires at`)
|
|
@@ -2493,18 +2505,18 @@ function invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium(ctx) {
|
|
|
2493
2505
|
});
|
|
2494
2506
|
}
|
|
2495
2507
|
}
|
|
2496
|
-
var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") =>
|
|
2508
|
+
var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") => z12.union([
|
|
2497
2509
|
// pricing available
|
|
2498
|
-
|
|
2510
|
+
z12.object({
|
|
2499
2511
|
baseCost: makePriceEthSchema(`${valueLabel} Base Cost`),
|
|
2500
2512
|
premium: makePriceEthSchema(`${valueLabel} Premium`),
|
|
2501
2513
|
total: makePriceEthSchema(`${valueLabel} Total`)
|
|
2502
2514
|
}).check(invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium).transform((v) => v),
|
|
2503
2515
|
// pricing unknown
|
|
2504
|
-
|
|
2505
|
-
baseCost:
|
|
2506
|
-
premium:
|
|
2507
|
-
total:
|
|
2516
|
+
z12.object({
|
|
2517
|
+
baseCost: z12.null(),
|
|
2518
|
+
premium: z12.null(),
|
|
2519
|
+
total: z12.null()
|
|
2508
2520
|
}).transform((v) => v)
|
|
2509
2521
|
]);
|
|
2510
2522
|
function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
|
|
@@ -2527,9 +2539,9 @@ function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
|
|
|
2527
2539
|
});
|
|
2528
2540
|
}
|
|
2529
2541
|
}
|
|
2530
|
-
var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") =>
|
|
2542
|
+
var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") => z12.union([
|
|
2531
2543
|
// referral available
|
|
2532
|
-
|
|
2544
|
+
z12.object({
|
|
2533
2545
|
encodedReferrer: makeHexStringSchema(
|
|
2534
2546
|
{ bytesCount: ENCODED_REFERRER_BYTE_LENGTH },
|
|
2535
2547
|
`${valueLabel} Encoded Referrer`
|
|
@@ -2537,9 +2549,9 @@ var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral
|
|
|
2537
2549
|
decodedReferrer: makeLowercaseAddressSchema(`${valueLabel} Decoded Referrer`)
|
|
2538
2550
|
}).check(invariant_registrarActionDecodedReferrerBasedOnRawReferrer),
|
|
2539
2551
|
// referral not applicable
|
|
2540
|
-
|
|
2541
|
-
encodedReferrer:
|
|
2542
|
-
decodedReferrer:
|
|
2552
|
+
z12.object({
|
|
2553
|
+
encodedReferrer: z12.null(),
|
|
2554
|
+
decodedReferrer: z12.null()
|
|
2543
2555
|
})
|
|
2544
2556
|
]);
|
|
2545
2557
|
function invariant_eventIdsInitialElementIsTheActionId(ctx) {
|
|
@@ -2552,9 +2564,9 @@ function invariant_eventIdsInitialElementIsTheActionId(ctx) {
|
|
|
2552
2564
|
});
|
|
2553
2565
|
}
|
|
2554
2566
|
}
|
|
2555
|
-
var EventIdSchema =
|
|
2556
|
-
var EventIdsSchema =
|
|
2557
|
-
var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") =>
|
|
2567
|
+
var EventIdSchema = z12.string().nonempty();
|
|
2568
|
+
var EventIdsSchema = z12.array(EventIdSchema).min(1).transform((v) => v);
|
|
2569
|
+
var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => z12.object({
|
|
2558
2570
|
id: EventIdSchema,
|
|
2559
2571
|
incrementalDuration: makeDurationSchema(`${valueLabel} Incremental Duration`),
|
|
2560
2572
|
registrant: makeLowercaseAddressSchema(`${valueLabel} Registrant`),
|
|
@@ -2568,38 +2580,38 @@ var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => z1
|
|
|
2568
2580
|
eventIds: EventIdsSchema
|
|
2569
2581
|
}).check(invariant_eventIdsInitialElementIsTheActionId);
|
|
2570
2582
|
var makeRegistrarActionRegistrationSchema = (valueLabel = "Registration ") => makeBaseRegistrarActionSchema(valueLabel).extend({
|
|
2571
|
-
type:
|
|
2583
|
+
type: z12.literal(RegistrarActionTypes.Registration)
|
|
2572
2584
|
});
|
|
2573
2585
|
var makeRegistrarActionRenewalSchema = (valueLabel = "Renewal") => makeBaseRegistrarActionSchema(valueLabel).extend({
|
|
2574
|
-
type:
|
|
2586
|
+
type: z12.literal(RegistrarActionTypes.Renewal)
|
|
2575
2587
|
});
|
|
2576
|
-
var makeRegistrarActionSchema = (valueLabel = "Registrar Action") =>
|
|
2588
|
+
var makeRegistrarActionSchema = (valueLabel = "Registrar Action") => z12.discriminatedUnion("type", [
|
|
2577
2589
|
makeRegistrarActionRegistrationSchema(`${valueLabel} Registration`),
|
|
2578
2590
|
makeRegistrarActionRenewalSchema(`${valueLabel} Renewal`)
|
|
2579
2591
|
]);
|
|
2580
2592
|
|
|
2581
2593
|
// src/api/shared/pagination/zod-schemas.ts
|
|
2582
|
-
import { z as
|
|
2594
|
+
import { z as z13 } from "zod/v4";
|
|
2583
2595
|
|
|
2584
2596
|
// src/api/shared/pagination/request.ts
|
|
2585
2597
|
var RECORDS_PER_PAGE_DEFAULT = 10;
|
|
2586
2598
|
var RECORDS_PER_PAGE_MAX = 100;
|
|
2587
2599
|
|
|
2588
2600
|
// src/api/shared/pagination/zod-schemas.ts
|
|
2589
|
-
var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") =>
|
|
2601
|
+
var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") => z13.object({
|
|
2590
2602
|
page: makePositiveIntegerSchema(`${valueLabel}.page`),
|
|
2591
2603
|
recordsPerPage: makePositiveIntegerSchema(`${valueLabel}.recordsPerPage`).max(
|
|
2592
2604
|
RECORDS_PER_PAGE_MAX,
|
|
2593
2605
|
`${valueLabel}.recordsPerPage must not exceed ${RECORDS_PER_PAGE_MAX}`
|
|
2594
2606
|
)
|
|
2595
2607
|
});
|
|
2596
|
-
var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") =>
|
|
2597
|
-
totalRecords:
|
|
2598
|
-
totalPages:
|
|
2599
|
-
hasNext:
|
|
2600
|
-
hasPrev:
|
|
2601
|
-
startIndex:
|
|
2602
|
-
endIndex:
|
|
2608
|
+
var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") => z13.object({
|
|
2609
|
+
totalRecords: z13.literal(0),
|
|
2610
|
+
totalPages: z13.literal(1),
|
|
2611
|
+
hasNext: z13.literal(false),
|
|
2612
|
+
hasPrev: z13.literal(false),
|
|
2613
|
+
startIndex: z13.undefined(),
|
|
2614
|
+
endIndex: z13.undefined()
|
|
2603
2615
|
}).extend(makeRequestPageParamsSchema(valueLabel).shape);
|
|
2604
2616
|
function invariant_responsePageWithRecordsIsCorrect(ctx) {
|
|
2605
2617
|
const { hasNext, hasPrev, recordsPerPage, page, totalRecords, startIndex, endIndex } = ctx.value;
|
|
@@ -2634,15 +2646,15 @@ function invariant_responsePageWithRecordsIsCorrect(ctx) {
|
|
|
2634
2646
|
});
|
|
2635
2647
|
}
|
|
2636
2648
|
}
|
|
2637
|
-
var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") =>
|
|
2649
|
+
var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") => z13.object({
|
|
2638
2650
|
totalRecords: makePositiveIntegerSchema(`${valueLabel}.totalRecords`),
|
|
2639
2651
|
totalPages: makePositiveIntegerSchema(`${valueLabel}.totalPages`),
|
|
2640
|
-
hasNext:
|
|
2641
|
-
hasPrev:
|
|
2652
|
+
hasNext: z13.boolean(),
|
|
2653
|
+
hasPrev: z13.boolean(),
|
|
2642
2654
|
startIndex: makeNonNegativeIntegerSchema(`${valueLabel}.startIndex`),
|
|
2643
2655
|
endIndex: makeNonNegativeIntegerSchema(`${valueLabel}.endIndex`)
|
|
2644
2656
|
}).extend(makeRequestPageParamsSchema(valueLabel).shape).check(invariant_responsePageWithRecordsIsCorrect);
|
|
2645
|
-
var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") =>
|
|
2657
|
+
var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") => z13.union([
|
|
2646
2658
|
makeResponsePageContextSchemaWithNoRecords(valueLabel),
|
|
2647
2659
|
makeResponsePageContextSchemaWithRecords(valueLabel)
|
|
2648
2660
|
]);
|
|
@@ -2672,21 +2684,21 @@ function invariant_registrationLifecycleNodeMatchesName(ctx) {
|
|
|
2672
2684
|
});
|
|
2673
2685
|
}
|
|
2674
2686
|
}
|
|
2675
|
-
var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") =>
|
|
2687
|
+
var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") => z14.object({
|
|
2676
2688
|
action: makeRegistrarActionSchema(valueLabel),
|
|
2677
2689
|
name: makeReinterpretedNameSchema(valueLabel)
|
|
2678
2690
|
}).check(invariant_registrationLifecycleNodeMatchesName);
|
|
2679
|
-
var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") =>
|
|
2680
|
-
responseCode:
|
|
2681
|
-
registrarActions:
|
|
2691
|
+
var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") => z14.object({
|
|
2692
|
+
responseCode: z14.literal(RegistrarActionsResponseCodes.Ok),
|
|
2693
|
+
registrarActions: z14.array(makeNamedRegistrarActionSchema(valueLabel)),
|
|
2682
2694
|
pageContext: makeResponsePageContextSchema(`${valueLabel}.pageContext`),
|
|
2683
2695
|
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`).optional()
|
|
2684
2696
|
});
|
|
2685
|
-
var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") =>
|
|
2686
|
-
responseCode:
|
|
2697
|
+
var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") => z14.strictObject({
|
|
2698
|
+
responseCode: z14.literal(RegistrarActionsResponseCodes.Error),
|
|
2687
2699
|
error: ErrorResponseSchema
|
|
2688
2700
|
});
|
|
2689
|
-
var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") =>
|
|
2701
|
+
var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") => z14.discriminatedUnion("responseCode", [
|
|
2690
2702
|
makeRegistrarActionsResponseOkSchema(valueLabel),
|
|
2691
2703
|
makeRegistrarActionsResponseErrorSchema(valueLabel)
|
|
2692
2704
|
]);
|
|
@@ -2697,7 +2709,7 @@ function deserializeRegistrarActionsResponse(maybeResponse) {
|
|
|
2697
2709
|
if (parsed.error) {
|
|
2698
2710
|
throw new Error(
|
|
2699
2711
|
`Cannot deserialize RegistrarActionsResponse:
|
|
2700
|
-
${
|
|
2712
|
+
${prettifyError11(parsed.error)}
|
|
2701
2713
|
`
|
|
2702
2714
|
);
|
|
2703
2715
|
}
|
|
@@ -2957,12 +2969,12 @@ function serializeRegistrarActionsResponse(response) {
|
|
|
2957
2969
|
}
|
|
2958
2970
|
|
|
2959
2971
|
// src/api/shared/errors/deserialize.ts
|
|
2960
|
-
import { prettifyError as
|
|
2972
|
+
import { prettifyError as prettifyError12 } from "zod/v4";
|
|
2961
2973
|
function deserializeErrorResponse(maybeErrorResponse) {
|
|
2962
2974
|
const parsed = ErrorResponseSchema.safeParse(maybeErrorResponse);
|
|
2963
2975
|
if (parsed.error) {
|
|
2964
2976
|
throw new Error(`Cannot deserialize ErrorResponse:
|
|
2965
|
-
${
|
|
2977
|
+
${prettifyError12(parsed.error)}
|
|
2966
2978
|
`);
|
|
2967
2979
|
}
|
|
2968
2980
|
return parsed.data;
|