@ensnode/ensnode-sdk 0.0.0-next-20260216171758 → 0.0.0-next-20260217102457
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 +363 -338
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +327 -153
- package/dist/index.d.ts +327 -153
- package/dist/index.js +196 -171
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -47,13 +47,14 @@ __export(index_exports, {
|
|
|
47
47
|
DEFAULT_EVM_COIN_TYPE: () => DEFAULT_EVM_COIN_TYPE,
|
|
48
48
|
ENCODED_REFERRER_BYTE_LENGTH: () => ENCODED_REFERRER_BYTE_LENGTH,
|
|
49
49
|
ENCODED_REFERRER_BYTE_OFFSET: () => ENCODED_REFERRER_BYTE_OFFSET,
|
|
50
|
-
ENSApiClient: () => ENSApiClient,
|
|
51
50
|
ENSNamespaceIds: () => import_datasources.ENSNamespaceIds,
|
|
52
51
|
ENSNodeClient: () => ENSNodeClient,
|
|
53
52
|
ENS_ROOT: () => ENS_ROOT,
|
|
54
53
|
ETH_COIN_TYPE: () => ETH_COIN_TYPE,
|
|
55
54
|
ETH_NODE: () => ETH_NODE,
|
|
56
55
|
EXPECTED_ENCODED_REFERRER_PADDING: () => EXPECTED_ENCODED_REFERRER_PADDING,
|
|
56
|
+
EnsApiClient: () => EnsApiClient,
|
|
57
|
+
EnsApiIndexingStatusResponseCodes: () => EnsApiIndexingStatusResponseCodes,
|
|
57
58
|
ForwardResolutionProtocolStep: () => ForwardResolutionProtocolStep,
|
|
58
59
|
IndexingStatusResponseCodes: () => IndexingStatusResponseCodes,
|
|
59
60
|
LINEANAMES_NODE: () => LINEANAMES_NODE,
|
|
@@ -125,6 +126,10 @@ __export(index_exports, {
|
|
|
125
126
|
deserializeDuration: () => deserializeDuration,
|
|
126
127
|
deserializeENSApiPublicConfig: () => deserializeENSApiPublicConfig,
|
|
127
128
|
deserializeENSIndexerPublicConfig: () => deserializeENSIndexerPublicConfig,
|
|
129
|
+
deserializeEnsApiConfigResponse: () => deserializeEnsApiConfigResponse,
|
|
130
|
+
deserializeEnsApiIndexingStatusResponse: () => deserializeEnsApiIndexingStatusResponse,
|
|
131
|
+
deserializeEnsApiPublicConfig: () => deserializeEnsApiPublicConfig,
|
|
132
|
+
deserializeEnsIndexerPublicConfig: () => deserializeEnsIndexerPublicConfig,
|
|
128
133
|
deserializeErrorResponse: () => deserializeErrorResponse,
|
|
129
134
|
deserializeIndexingStatusResponse: () => deserializeIndexingStatusResponse,
|
|
130
135
|
deserializeOmnichainIndexingStatusSnapshot: () => deserializeOmnichainIndexingStatusSnapshot,
|
|
@@ -210,6 +215,7 @@ __export(index_exports, {
|
|
|
210
215
|
makeENSApiPublicConfigSchema: () => makeENSApiPublicConfigSchema,
|
|
211
216
|
makeENSv1DomainId: () => makeENSv1DomainId,
|
|
212
217
|
makeENSv2DomainId: () => makeENSv2DomainId,
|
|
218
|
+
makeEnsApiPublicConfigSchema: () => makeEnsApiPublicConfigSchema,
|
|
213
219
|
makeLatestRegistrationId: () => makeLatestRegistrationId,
|
|
214
220
|
makeLatestRenewalId: () => makeLatestRenewalId,
|
|
215
221
|
makePermissionsId: () => makePermissionsId,
|
|
@@ -248,6 +254,10 @@ __export(index_exports, {
|
|
|
248
254
|
serializeDomainAssetId: () => serializeDomainAssetId,
|
|
249
255
|
serializeENSApiPublicConfig: () => serializeENSApiPublicConfig,
|
|
250
256
|
serializeENSIndexerPublicConfig: () => serializeENSIndexerPublicConfig,
|
|
257
|
+
serializeEnsApiConfigResponse: () => serializeEnsApiConfigResponse,
|
|
258
|
+
serializeEnsApiIndexingStatusResponse: () => serializeEnsApiIndexingStatusResponse,
|
|
259
|
+
serializeEnsApiPublicConfig: () => serializeEnsApiPublicConfig,
|
|
260
|
+
serializeEnsIndexerPublicConfig: () => serializeEnsIndexerPublicConfig,
|
|
251
261
|
serializeIndexedChainIds: () => serializeIndexedChainIds,
|
|
252
262
|
serializeIndexingStatusResponse: () => serializeIndexingStatusResponse,
|
|
253
263
|
serializeNameToken: () => serializeNameToken,
|
|
@@ -854,7 +864,7 @@ var makeFullyPinnedLabelSetSchema = (valueLabel = "Label set") => {
|
|
|
854
864
|
});
|
|
855
865
|
};
|
|
856
866
|
var makeNonEmptyStringSchema = (valueLabel = "Value") => import_v42.z.string().nonempty({ error: `${valueLabel} must be a non-empty string.` });
|
|
857
|
-
var
|
|
867
|
+
var makeEnsIndexerVersionInfoSchema = (valueLabel = "Value") => import_v42.z.strictObject(
|
|
858
868
|
{
|
|
859
869
|
nodejs: makeNonEmptyStringSchema(),
|
|
860
870
|
ponder: makeNonEmptyStringSchema(),
|
|
@@ -868,6 +878,7 @@ var makeENSIndexerVersionInfoSchema = (valueLabel = "Value") => import_v42.z.str
|
|
|
868
878
|
error: `${valueLabel} must be a valid ENSIndexerVersionInfo object.`
|
|
869
879
|
}
|
|
870
880
|
).check(invariant_ensDbVersionIsSameAsEnsIndexerVersion);
|
|
881
|
+
var makeENSIndexerVersionInfoSchema = makeEnsIndexerVersionInfoSchema;
|
|
871
882
|
function invariant_isSubgraphCompatibleRequirements(ctx) {
|
|
872
883
|
const { value: config } = ctx;
|
|
873
884
|
if (config.isSubgraphCompatible && !isSubgraphCompatible(config)) {
|
|
@@ -878,7 +889,7 @@ function invariant_isSubgraphCompatibleRequirements(ctx) {
|
|
|
878
889
|
});
|
|
879
890
|
}
|
|
880
891
|
}
|
|
881
|
-
var
|
|
892
|
+
var makeEnsIndexerPublicConfigSchema = (valueLabel = "ENSIndexerPublicConfig") => import_v42.z.object({
|
|
882
893
|
labelSet: makeFullyPinnedLabelSetSchema(`${valueLabel}.labelSet`),
|
|
883
894
|
indexedChainIds: makeIndexedChainIdsSchema(`${valueLabel}.indexedChainIds`),
|
|
884
895
|
isSubgraphCompatible: import_v42.z.boolean({ error: `${valueLabel}.isSubgraphCompatible` }),
|
|
@@ -907,133 +918,43 @@ var TheGraphFallbackSchema = import_v43.z.discriminatedUnion("canFallback", [
|
|
|
907
918
|
]);
|
|
908
919
|
|
|
909
920
|
// src/ensapi/config/zod-schemas.ts
|
|
910
|
-
function
|
|
921
|
+
function makeEnsApiPublicConfigSchema(valueLabel) {
|
|
911
922
|
const label = valueLabel ?? "ENSApiPublicConfig";
|
|
912
923
|
return import_v44.z.strictObject({
|
|
913
924
|
version: import_v44.z.string().min(1, `${label}.version must be a non-empty string`),
|
|
914
925
|
theGraphFallback: TheGraphFallbackSchema,
|
|
915
|
-
ensIndexerPublicConfig:
|
|
926
|
+
ensIndexerPublicConfig: makeEnsIndexerPublicConfigSchema(`${label}.ensIndexerPublicConfig`)
|
|
916
927
|
});
|
|
917
928
|
}
|
|
929
|
+
var makeENSApiPublicConfigSchema = makeEnsApiPublicConfigSchema;
|
|
918
930
|
|
|
919
931
|
// src/ensapi/config/deserialize.ts
|
|
920
|
-
function
|
|
921
|
-
const schema =
|
|
932
|
+
function deserializeEnsApiPublicConfig(maybeConfig, valueLabel) {
|
|
933
|
+
const schema = makeEnsApiPublicConfigSchema(valueLabel);
|
|
922
934
|
try {
|
|
923
935
|
return schema.parse(maybeConfig);
|
|
924
936
|
} catch (error) {
|
|
925
937
|
if (error instanceof import_v45.ZodError) {
|
|
926
|
-
throw new Error(`Cannot deserialize
|
|
938
|
+
throw new Error(`Cannot deserialize EnsApiPublicConfig:
|
|
927
939
|
${(0, import_v45.prettifyError)(error)}
|
|
928
940
|
`);
|
|
929
941
|
}
|
|
930
942
|
throw error;
|
|
931
943
|
}
|
|
932
944
|
}
|
|
945
|
+
var deserializeENSApiPublicConfig = deserializeEnsApiPublicConfig;
|
|
933
946
|
|
|
934
947
|
// src/ensapi/api/config/deserialize.ts
|
|
935
|
-
function
|
|
936
|
-
return
|
|
937
|
-
}
|
|
938
|
-
|
|
939
|
-
// src/ensindexer/config/deserialize.ts
|
|
940
|
-
var import_v46 = require("zod/v4");
|
|
941
|
-
function deserializeENSIndexerPublicConfig(maybeConfig, valueLabel) {
|
|
942
|
-
const schema = makeENSIndexerPublicConfigSchema(valueLabel);
|
|
943
|
-
const parsed = schema.safeParse(maybeConfig);
|
|
944
|
-
if (parsed.error) {
|
|
945
|
-
throw new Error(`Cannot deserialize ENSIndexerPublicConfig:
|
|
946
|
-
${(0, import_v46.prettifyError)(parsed.error)}
|
|
947
|
-
`);
|
|
948
|
-
}
|
|
949
|
-
return parsed.data;
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
// src/ensindexer/config/label-utils.ts
|
|
953
|
-
var import_viem9 = require("viem");
|
|
954
|
-
function labelHashToBytes(labelHash) {
|
|
955
|
-
try {
|
|
956
|
-
if (labelHash.length !== 66) {
|
|
957
|
-
throw new Error(`Invalid labelHash length ${labelHash.length} characters (expected 66)`);
|
|
958
|
-
}
|
|
959
|
-
if (labelHash !== labelHash.toLowerCase()) {
|
|
960
|
-
throw new Error("Labelhash must be in lowercase");
|
|
961
|
-
}
|
|
962
|
-
if (!labelHash.startsWith("0x")) {
|
|
963
|
-
throw new Error("Labelhash must be 0x-prefixed");
|
|
964
|
-
}
|
|
965
|
-
const bytes = (0, import_viem9.hexToBytes)(labelHash);
|
|
966
|
-
if (bytes.length !== 32) {
|
|
967
|
-
throw new Error(`Invalid labelHash length ${bytes.length} bytes (expected 32)`);
|
|
968
|
-
}
|
|
969
|
-
return bytes;
|
|
970
|
-
} catch (e) {
|
|
971
|
-
if (e instanceof Error) {
|
|
972
|
-
throw e;
|
|
973
|
-
}
|
|
974
|
-
throw new Error("Invalid hex format");
|
|
975
|
-
}
|
|
976
|
-
}
|
|
977
|
-
|
|
978
|
-
// src/ensindexer/config/labelset-utils.ts
|
|
979
|
-
function buildLabelSetId(maybeLabelSetId) {
|
|
980
|
-
return makeLabelSetIdSchema("LabelSetId").parse(maybeLabelSetId);
|
|
981
|
-
}
|
|
982
|
-
function buildLabelSetVersion(maybeLabelSetVersion) {
|
|
983
|
-
return makeLabelSetVersionSchema("LabelSetVersion").parse(maybeLabelSetVersion);
|
|
984
|
-
}
|
|
985
|
-
function buildEnsRainbowClientLabelSet(labelSetId, labelSetVersion) {
|
|
986
|
-
if (labelSetVersion !== void 0 && labelSetId === void 0) {
|
|
987
|
-
throw new Error("When a labelSetVersion is defined, labelSetId must also be defined.");
|
|
988
|
-
}
|
|
989
|
-
return { labelSetId, labelSetVersion };
|
|
990
|
-
}
|
|
991
|
-
function validateSupportedLabelSetAndVersion(serverSet, clientSet) {
|
|
992
|
-
if (clientSet.labelSetId === void 0) {
|
|
993
|
-
return;
|
|
994
|
-
}
|
|
995
|
-
if (serverSet.labelSetId !== clientSet.labelSetId) {
|
|
996
|
-
throw new Error(
|
|
997
|
-
`Server label set ID "${serverSet.labelSetId}" does not match client's requested label set ID "${clientSet.labelSetId}".`
|
|
998
|
-
);
|
|
999
|
-
}
|
|
1000
|
-
if (clientSet.labelSetVersion !== void 0 && serverSet.highestLabelSetVersion < clientSet.labelSetVersion) {
|
|
1001
|
-
throw new Error(
|
|
1002
|
-
`Server highest label set version ${serverSet.highestLabelSetVersion} is less than client's requested version ${clientSet.labelSetVersion} for label set ID "${clientSet.labelSetId}".`
|
|
1003
|
-
);
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
|
-
// src/ensindexer/config/parsing.ts
|
|
1008
|
-
function parseNonNegativeInteger(maybeNumber) {
|
|
1009
|
-
const trimmed = maybeNumber.trim();
|
|
1010
|
-
if (!trimmed) {
|
|
1011
|
-
throw new Error("Input cannot be empty");
|
|
1012
|
-
}
|
|
1013
|
-
if (trimmed === "-0") {
|
|
1014
|
-
throw new Error("Negative zero is not a valid non-negative integer");
|
|
1015
|
-
}
|
|
1016
|
-
const num = Number(maybeNumber);
|
|
1017
|
-
if (Number.isNaN(num)) {
|
|
1018
|
-
throw new Error(`"${maybeNumber}" is not a valid number`);
|
|
1019
|
-
}
|
|
1020
|
-
if (!Number.isFinite(num)) {
|
|
1021
|
-
throw new Error(`"${maybeNumber}" is not a finite number`);
|
|
1022
|
-
}
|
|
1023
|
-
if (!Number.isInteger(num)) {
|
|
1024
|
-
throw new Error(`"${maybeNumber}" is not an integer`);
|
|
1025
|
-
}
|
|
1026
|
-
if (num < 0) {
|
|
1027
|
-
throw new Error(`"${maybeNumber}" is not a non-negative integer`);
|
|
1028
|
-
}
|
|
1029
|
-
return num;
|
|
948
|
+
function deserializeEnsApiConfigResponse(serializedResponse) {
|
|
949
|
+
return deserializeEnsApiPublicConfig(serializedResponse);
|
|
1030
950
|
}
|
|
951
|
+
var deserializeConfigResponse = deserializeEnsApiConfigResponse;
|
|
1031
952
|
|
|
1032
953
|
// src/ensindexer/config/serialize.ts
|
|
1033
954
|
function serializeIndexedChainIds(indexedChainIds) {
|
|
1034
955
|
return Array.from(indexedChainIds);
|
|
1035
956
|
}
|
|
1036
|
-
function
|
|
957
|
+
function serializeEnsIndexerPublicConfig(config) {
|
|
1037
958
|
const {
|
|
1038
959
|
labelSet,
|
|
1039
960
|
indexedChainIds,
|
|
@@ -1053,33 +974,36 @@ function serializeENSIndexerPublicConfig(config) {
|
|
|
1053
974
|
versionInfo
|
|
1054
975
|
};
|
|
1055
976
|
}
|
|
977
|
+
var serializeENSIndexerPublicConfig = serializeEnsIndexerPublicConfig;
|
|
1056
978
|
|
|
1057
979
|
// src/ensapi/config/serialize.ts
|
|
1058
|
-
function
|
|
980
|
+
function serializeEnsApiPublicConfig(config) {
|
|
1059
981
|
const { version, theGraphFallback, ensIndexerPublicConfig } = config;
|
|
1060
982
|
return {
|
|
1061
983
|
version,
|
|
1062
984
|
theGraphFallback,
|
|
1063
|
-
ensIndexerPublicConfig:
|
|
985
|
+
ensIndexerPublicConfig: serializeEnsIndexerPublicConfig(ensIndexerPublicConfig)
|
|
1064
986
|
};
|
|
1065
987
|
}
|
|
988
|
+
var serializeENSApiPublicConfig = serializeEnsApiPublicConfig;
|
|
1066
989
|
|
|
1067
990
|
// src/ensapi/api/config/serialize.ts
|
|
1068
|
-
function
|
|
1069
|
-
return
|
|
991
|
+
function serializeEnsApiConfigResponse(response) {
|
|
992
|
+
return serializeEnsApiPublicConfig(response);
|
|
1070
993
|
}
|
|
994
|
+
var serializeConfigResponse = serializeEnsApiConfigResponse;
|
|
1071
995
|
|
|
1072
996
|
// src/ensapi/api/indexing-status/deserialize.ts
|
|
1073
|
-
var
|
|
997
|
+
var import_v414 = require("zod/v4");
|
|
1074
998
|
|
|
1075
999
|
// src/indexing-status/deserialize/realtime-indexing-status-projection.ts
|
|
1076
|
-
var
|
|
1000
|
+
var import_v412 = require("zod/v4");
|
|
1077
1001
|
|
|
1078
1002
|
// src/indexing-status/zod-schema/realtime-indexing-status-projection.ts
|
|
1079
|
-
var
|
|
1003
|
+
var import_v49 = require("zod/v4");
|
|
1080
1004
|
|
|
1081
1005
|
// src/indexing-status/zod-schema/cross-chain-indexing-status-snapshot.ts
|
|
1082
|
-
var
|
|
1006
|
+
var import_v48 = require("zod/v4");
|
|
1083
1007
|
|
|
1084
1008
|
// src/indexing-status/chain-indexing-status-snapshot.ts
|
|
1085
1009
|
var ChainIndexingConfigTypeIds = {
|
|
@@ -1210,7 +1134,7 @@ function getLatestIndexedBlockRef(indexingStatus, chainId) {
|
|
|
1210
1134
|
}
|
|
1211
1135
|
|
|
1212
1136
|
// src/indexing-status/zod-schema/omnichain-indexing-status-snapshot.ts
|
|
1213
|
-
var
|
|
1137
|
+
var import_v47 = require("zod/v4");
|
|
1214
1138
|
|
|
1215
1139
|
// src/indexing-status/omnichain-indexing-status-snapshot.ts
|
|
1216
1140
|
var OmnichainIndexingStatusIds = {
|
|
@@ -1294,7 +1218,7 @@ function getOmnichainIndexingCursor(chains) {
|
|
|
1294
1218
|
}
|
|
1295
1219
|
|
|
1296
1220
|
// src/indexing-status/zod-schema/chain-indexing-status-snapshot.ts
|
|
1297
|
-
var
|
|
1221
|
+
var import_v46 = require("zod/v4");
|
|
1298
1222
|
|
|
1299
1223
|
// src/shared/block-ref.ts
|
|
1300
1224
|
function isBefore(blockA, blockB) {
|
|
@@ -1382,46 +1306,46 @@ function invariant_chainSnapshotFollowingBlocks(ctx) {
|
|
|
1382
1306
|
});
|
|
1383
1307
|
}
|
|
1384
1308
|
}
|
|
1385
|
-
var makeChainIndexingConfigSchema = (valueLabel = "Value") =>
|
|
1386
|
-
|
|
1387
|
-
configType:
|
|
1309
|
+
var makeChainIndexingConfigSchema = (valueLabel = "Value") => import_v46.z.discriminatedUnion("configType", [
|
|
1310
|
+
import_v46.z.object({
|
|
1311
|
+
configType: import_v46.z.literal(ChainIndexingConfigTypeIds.Indefinite),
|
|
1388
1312
|
startBlock: makeBlockRefSchema(valueLabel)
|
|
1389
1313
|
}),
|
|
1390
|
-
|
|
1391
|
-
configType:
|
|
1314
|
+
import_v46.z.object({
|
|
1315
|
+
configType: import_v46.z.literal(ChainIndexingConfigTypeIds.Definite),
|
|
1392
1316
|
startBlock: makeBlockRefSchema(valueLabel),
|
|
1393
1317
|
endBlock: makeBlockRefSchema(valueLabel)
|
|
1394
1318
|
})
|
|
1395
1319
|
]);
|
|
1396
|
-
var makeChainIndexingStatusSnapshotQueuedSchema = (valueLabel = "Value") =>
|
|
1397
|
-
chainStatus:
|
|
1320
|
+
var makeChainIndexingStatusSnapshotQueuedSchema = (valueLabel = "Value") => import_v46.z.object({
|
|
1321
|
+
chainStatus: import_v46.z.literal(ChainIndexingStatusIds.Queued),
|
|
1398
1322
|
config: makeChainIndexingConfigSchema(valueLabel)
|
|
1399
1323
|
}).check(invariant_chainSnapshotQueuedBlocks);
|
|
1400
|
-
var makeChainIndexingStatusSnapshotBackfillSchema = (valueLabel = "Value") =>
|
|
1401
|
-
chainStatus:
|
|
1324
|
+
var makeChainIndexingStatusSnapshotBackfillSchema = (valueLabel = "Value") => import_v46.z.object({
|
|
1325
|
+
chainStatus: import_v46.z.literal(ChainIndexingStatusIds.Backfill),
|
|
1402
1326
|
config: makeChainIndexingConfigSchema(valueLabel),
|
|
1403
1327
|
latestIndexedBlock: makeBlockRefSchema(valueLabel),
|
|
1404
1328
|
backfillEndBlock: makeBlockRefSchema(valueLabel)
|
|
1405
1329
|
}).check(invariant_chainSnapshotBackfillBlocks);
|
|
1406
|
-
var makeChainIndexingStatusSnapshotCompletedSchema = (valueLabel = "Value") =>
|
|
1407
|
-
chainStatus:
|
|
1408
|
-
config:
|
|
1409
|
-
configType:
|
|
1330
|
+
var makeChainIndexingStatusSnapshotCompletedSchema = (valueLabel = "Value") => import_v46.z.object({
|
|
1331
|
+
chainStatus: import_v46.z.literal(ChainIndexingStatusIds.Completed),
|
|
1332
|
+
config: import_v46.z.object({
|
|
1333
|
+
configType: import_v46.z.literal(ChainIndexingConfigTypeIds.Definite),
|
|
1410
1334
|
startBlock: makeBlockRefSchema(valueLabel),
|
|
1411
1335
|
endBlock: makeBlockRefSchema(valueLabel)
|
|
1412
1336
|
}),
|
|
1413
1337
|
latestIndexedBlock: makeBlockRefSchema(valueLabel)
|
|
1414
1338
|
}).check(invariant_chainSnapshotCompletedBlocks);
|
|
1415
|
-
var makeChainIndexingStatusSnapshotFollowingSchema = (valueLabel = "Value") =>
|
|
1416
|
-
chainStatus:
|
|
1417
|
-
config:
|
|
1418
|
-
configType:
|
|
1339
|
+
var makeChainIndexingStatusSnapshotFollowingSchema = (valueLabel = "Value") => import_v46.z.object({
|
|
1340
|
+
chainStatus: import_v46.z.literal(ChainIndexingStatusIds.Following),
|
|
1341
|
+
config: import_v46.z.object({
|
|
1342
|
+
configType: import_v46.z.literal(ChainIndexingConfigTypeIds.Indefinite),
|
|
1419
1343
|
startBlock: makeBlockRefSchema(valueLabel)
|
|
1420
1344
|
}),
|
|
1421
1345
|
latestIndexedBlock: makeBlockRefSchema(valueLabel),
|
|
1422
1346
|
latestKnownBlock: makeBlockRefSchema(valueLabel)
|
|
1423
1347
|
}).check(invariant_chainSnapshotFollowingBlocks);
|
|
1424
|
-
var makeChainIndexingStatusSnapshotSchema = (valueLabel = "Value") =>
|
|
1348
|
+
var makeChainIndexingStatusSnapshotSchema = (valueLabel = "Value") => import_v46.z.discriminatedUnion("chainStatus", [
|
|
1425
1349
|
makeChainIndexingStatusSnapshotQueuedSchema(valueLabel),
|
|
1426
1350
|
makeChainIndexingStatusSnapshotBackfillSchema(valueLabel),
|
|
1427
1351
|
makeChainIndexingStatusSnapshotCompletedSchema(valueLabel),
|
|
@@ -1550,11 +1474,11 @@ function invariant_omnichainStatusSnapshotFollowingHasValidChains(ctx) {
|
|
|
1550
1474
|
});
|
|
1551
1475
|
}
|
|
1552
1476
|
}
|
|
1553
|
-
var makeOmnichainIndexingStatusSnapshotUnstartedSchema = (valueLabel) =>
|
|
1554
|
-
omnichainStatus:
|
|
1555
|
-
chains:
|
|
1477
|
+
var makeOmnichainIndexingStatusSnapshotUnstartedSchema = (valueLabel) => import_v47.z.object({
|
|
1478
|
+
omnichainStatus: import_v47.z.literal(OmnichainIndexingStatusIds.Unstarted),
|
|
1479
|
+
chains: import_v47.z.map(
|
|
1556
1480
|
makeChainIdSchema(),
|
|
1557
|
-
|
|
1481
|
+
import_v47.z.discriminatedUnion("chainStatus", [
|
|
1558
1482
|
makeChainIndexingStatusSnapshotQueuedSchema(valueLabel)
|
|
1559
1483
|
]),
|
|
1560
1484
|
{
|
|
@@ -1563,11 +1487,11 @@ var makeOmnichainIndexingStatusSnapshotUnstartedSchema = (valueLabel) => import_
|
|
|
1563
1487
|
),
|
|
1564
1488
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1565
1489
|
}).check(invariant_omnichainSnapshotUnstartedHasValidChains);
|
|
1566
|
-
var makeOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) =>
|
|
1567
|
-
omnichainStatus:
|
|
1568
|
-
chains:
|
|
1490
|
+
var makeOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) => import_v47.z.object({
|
|
1491
|
+
omnichainStatus: import_v47.z.literal(OmnichainIndexingStatusIds.Backfill),
|
|
1492
|
+
chains: import_v47.z.map(
|
|
1569
1493
|
makeChainIdSchema(),
|
|
1570
|
-
|
|
1494
|
+
import_v47.z.discriminatedUnion("chainStatus", [
|
|
1571
1495
|
makeChainIndexingStatusSnapshotQueuedSchema(valueLabel),
|
|
1572
1496
|
makeChainIndexingStatusSnapshotBackfillSchema(valueLabel),
|
|
1573
1497
|
makeChainIndexingStatusSnapshotCompletedSchema(valueLabel)
|
|
@@ -1578,11 +1502,11 @@ var makeOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) => import_v
|
|
|
1578
1502
|
),
|
|
1579
1503
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1580
1504
|
}).check(invariant_omnichainStatusSnapshotBackfillHasValidChains);
|
|
1581
|
-
var makeOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) =>
|
|
1582
|
-
omnichainStatus:
|
|
1583
|
-
chains:
|
|
1505
|
+
var makeOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) => import_v47.z.object({
|
|
1506
|
+
omnichainStatus: import_v47.z.literal(OmnichainIndexingStatusIds.Completed),
|
|
1507
|
+
chains: import_v47.z.map(
|
|
1584
1508
|
makeChainIdSchema(),
|
|
1585
|
-
|
|
1509
|
+
import_v47.z.discriminatedUnion("chainStatus", [
|
|
1586
1510
|
makeChainIndexingStatusSnapshotCompletedSchema(valueLabel)
|
|
1587
1511
|
]),
|
|
1588
1512
|
{
|
|
@@ -1591,11 +1515,11 @@ var makeOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) => import_
|
|
|
1591
1515
|
),
|
|
1592
1516
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1593
1517
|
}).check(invariant_omnichainStatusSnapshotCompletedHasValidChains);
|
|
1594
|
-
var makeOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) =>
|
|
1595
|
-
omnichainStatus:
|
|
1596
|
-
chains:
|
|
1518
|
+
var makeOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) => import_v47.z.object({
|
|
1519
|
+
omnichainStatus: import_v47.z.literal(OmnichainIndexingStatusIds.Following),
|
|
1520
|
+
chains: import_v47.z.map(
|
|
1597
1521
|
makeChainIdSchema(),
|
|
1598
|
-
|
|
1522
|
+
import_v47.z.discriminatedUnion("chainStatus", [
|
|
1599
1523
|
makeChainIndexingStatusSnapshotQueuedSchema(valueLabel),
|
|
1600
1524
|
makeChainIndexingStatusSnapshotBackfillSchema(valueLabel),
|
|
1601
1525
|
makeChainIndexingStatusSnapshotFollowingSchema(valueLabel),
|
|
@@ -1607,7 +1531,7 @@ var makeOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) => import_
|
|
|
1607
1531
|
),
|
|
1608
1532
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1609
1533
|
}).check(invariant_omnichainStatusSnapshotFollowingHasValidChains);
|
|
1610
|
-
var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexing Snapshot") =>
|
|
1534
|
+
var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexing Snapshot") => import_v47.z.discriminatedUnion("omnichainStatus", [
|
|
1611
1535
|
makeOmnichainIndexingStatusSnapshotUnstartedSchema(valueLabel),
|
|
1612
1536
|
makeOmnichainIndexingStatusSnapshotBackfillSchema(valueLabel),
|
|
1613
1537
|
makeOmnichainIndexingStatusSnapshotCompletedSchema(valueLabel),
|
|
@@ -1615,21 +1539,21 @@ var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexin
|
|
|
1615
1539
|
]).check(invariant_omnichainSnapshotStatusIsConsistentWithChainSnapshot).check(invariant_omnichainIndexingCursorLowerThanEarliestStartBlockAcrossQueuedChains).check(
|
|
1616
1540
|
invariant_omnichainIndexingCursorLowerThanOrEqualToLatestBackfillEndBlockAcrossBackfillChains
|
|
1617
1541
|
).check(invariant_omnichainIndexingCursorIsEqualToHighestLatestIndexedBlockAcrossIndexedChain);
|
|
1618
|
-
var makeSerializedOmnichainIndexingStatusSnapshotUnstartedSchema = (valueLabel) =>
|
|
1619
|
-
omnichainStatus:
|
|
1620
|
-
chains:
|
|
1542
|
+
var makeSerializedOmnichainIndexingStatusSnapshotUnstartedSchema = (valueLabel) => import_v47.z.object({
|
|
1543
|
+
omnichainStatus: import_v47.z.literal(OmnichainIndexingStatusIds.Unstarted),
|
|
1544
|
+
chains: import_v47.z.record(
|
|
1621
1545
|
makeChainIdStringSchema(),
|
|
1622
|
-
|
|
1546
|
+
import_v47.z.discriminatedUnion("chainStatus", [
|
|
1623
1547
|
makeChainIndexingStatusSnapshotQueuedSchema(valueLabel)
|
|
1624
1548
|
])
|
|
1625
1549
|
),
|
|
1626
1550
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1627
1551
|
});
|
|
1628
|
-
var makeSerializedOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) =>
|
|
1629
|
-
omnichainStatus:
|
|
1630
|
-
chains:
|
|
1552
|
+
var makeSerializedOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) => import_v47.z.object({
|
|
1553
|
+
omnichainStatus: import_v47.z.literal(OmnichainIndexingStatusIds.Backfill),
|
|
1554
|
+
chains: import_v47.z.record(
|
|
1631
1555
|
makeChainIdStringSchema(),
|
|
1632
|
-
|
|
1556
|
+
import_v47.z.discriminatedUnion("chainStatus", [
|
|
1633
1557
|
makeChainIndexingStatusSnapshotQueuedSchema(valueLabel),
|
|
1634
1558
|
makeChainIndexingStatusSnapshotBackfillSchema(valueLabel),
|
|
1635
1559
|
makeChainIndexingStatusSnapshotCompletedSchema(valueLabel)
|
|
@@ -1637,21 +1561,21 @@ var makeSerializedOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) =
|
|
|
1637
1561
|
),
|
|
1638
1562
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1639
1563
|
});
|
|
1640
|
-
var makeSerializedOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) =>
|
|
1641
|
-
omnichainStatus:
|
|
1642
|
-
chains:
|
|
1564
|
+
var makeSerializedOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) => import_v47.z.object({
|
|
1565
|
+
omnichainStatus: import_v47.z.literal(OmnichainIndexingStatusIds.Completed),
|
|
1566
|
+
chains: import_v47.z.record(
|
|
1643
1567
|
makeChainIdStringSchema(),
|
|
1644
|
-
|
|
1568
|
+
import_v47.z.discriminatedUnion("chainStatus", [
|
|
1645
1569
|
makeChainIndexingStatusSnapshotCompletedSchema(valueLabel)
|
|
1646
1570
|
])
|
|
1647
1571
|
),
|
|
1648
1572
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1649
1573
|
});
|
|
1650
|
-
var makeSerializedOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) =>
|
|
1651
|
-
omnichainStatus:
|
|
1652
|
-
chains:
|
|
1574
|
+
var makeSerializedOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) => import_v47.z.object({
|
|
1575
|
+
omnichainStatus: import_v47.z.literal(OmnichainIndexingStatusIds.Following),
|
|
1576
|
+
chains: import_v47.z.record(
|
|
1653
1577
|
makeChainIdStringSchema(),
|
|
1654
|
-
|
|
1578
|
+
import_v47.z.discriminatedUnion("chainStatus", [
|
|
1655
1579
|
makeChainIndexingStatusSnapshotQueuedSchema(valueLabel),
|
|
1656
1580
|
makeChainIndexingStatusSnapshotBackfillSchema(valueLabel),
|
|
1657
1581
|
makeChainIndexingStatusSnapshotFollowingSchema(valueLabel),
|
|
@@ -1660,7 +1584,7 @@ var makeSerializedOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel)
|
|
|
1660
1584
|
),
|
|
1661
1585
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1662
1586
|
});
|
|
1663
|
-
var makeSerializedOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Value") =>
|
|
1587
|
+
var makeSerializedOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Value") => import_v47.z.discriminatedUnion("omnichainStatus", [
|
|
1664
1588
|
makeSerializedOmnichainIndexingStatusSnapshotUnstartedSchema(valueLabel),
|
|
1665
1589
|
makeSerializedOmnichainIndexingStatusSnapshotBackfillSchema(valueLabel),
|
|
1666
1590
|
makeSerializedOmnichainIndexingStatusSnapshotCompletedSchema(valueLabel),
|
|
@@ -1700,17 +1624,17 @@ function invariant_snapshotTimeIsTheHighestKnownBlockTimestamp(ctx) {
|
|
|
1700
1624
|
});
|
|
1701
1625
|
}
|
|
1702
1626
|
}
|
|
1703
|
-
var makeCrossChainIndexingStatusSnapshotOmnichainSchema = (valueLabel = "Cross-chain Indexing Status Snapshot Omnichain") =>
|
|
1704
|
-
strategy:
|
|
1627
|
+
var makeCrossChainIndexingStatusSnapshotOmnichainSchema = (valueLabel = "Cross-chain Indexing Status Snapshot Omnichain") => import_v48.z.object({
|
|
1628
|
+
strategy: import_v48.z.literal(CrossChainIndexingStrategyIds.Omnichain),
|
|
1705
1629
|
slowestChainIndexingCursor: makeUnixTimestampSchema(valueLabel),
|
|
1706
1630
|
snapshotTime: makeUnixTimestampSchema(valueLabel),
|
|
1707
1631
|
omnichainSnapshot: makeOmnichainIndexingStatusSnapshotSchema(valueLabel)
|
|
1708
1632
|
}).check(invariant_slowestChainEqualsToOmnichainSnapshotTime).check(invariant_snapshotTimeIsTheHighestKnownBlockTimestamp);
|
|
1709
|
-
var makeCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Cross-chain Indexing Status Snapshot") =>
|
|
1633
|
+
var makeCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Cross-chain Indexing Status Snapshot") => import_v48.z.discriminatedUnion("strategy", [
|
|
1710
1634
|
makeCrossChainIndexingStatusSnapshotOmnichainSchema(valueLabel)
|
|
1711
1635
|
]);
|
|
1712
|
-
var makeSerializedCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Serialized Cross-chain Indexing Status Snapshot") =>
|
|
1713
|
-
strategy:
|
|
1636
|
+
var makeSerializedCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Serialized Cross-chain Indexing Status Snapshot") => import_v48.z.object({
|
|
1637
|
+
strategy: import_v48.z.enum(CrossChainIndexingStrategyIds),
|
|
1714
1638
|
slowestChainIndexingCursor: makeUnixTimestampSchema(valueLabel),
|
|
1715
1639
|
snapshotTime: makeUnixTimestampSchema(valueLabel),
|
|
1716
1640
|
omnichainSnapshot: makeSerializedOmnichainIndexingStatusSnapshotSchema(valueLabel)
|
|
@@ -1740,22 +1664,22 @@ function invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect(ct
|
|
|
1740
1664
|
});
|
|
1741
1665
|
}
|
|
1742
1666
|
}
|
|
1743
|
-
var makeRealtimeIndexingStatusProjectionSchema = (valueLabel = "Realtime Indexing Status Projection") =>
|
|
1667
|
+
var makeRealtimeIndexingStatusProjectionSchema = (valueLabel = "Realtime Indexing Status Projection") => import_v49.z.object({
|
|
1744
1668
|
projectedAt: makeUnixTimestampSchema(valueLabel),
|
|
1745
1669
|
worstCaseDistance: makeDurationSchema(valueLabel),
|
|
1746
1670
|
snapshot: makeCrossChainIndexingStatusSnapshotSchema(valueLabel)
|
|
1747
1671
|
}).check(invariant_realtimeIndexingStatusProjectionProjectedAtIsAfterOrEqualToSnapshotTime).check(invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect);
|
|
1748
|
-
var makeSerializedRealtimeIndexingStatusProjectionSchema = (valueLabel = "Value") =>
|
|
1672
|
+
var makeSerializedRealtimeIndexingStatusProjectionSchema = (valueLabel = "Value") => import_v49.z.object({
|
|
1749
1673
|
snapshot: makeSerializedCrossChainIndexingStatusSnapshotSchema(valueLabel),
|
|
1750
1674
|
projectedAt: makeUnixTimestampSchema(valueLabel),
|
|
1751
1675
|
worstCaseDistance: makeDurationSchema(valueLabel)
|
|
1752
1676
|
});
|
|
1753
1677
|
|
|
1754
1678
|
// src/indexing-status/deserialize/cross-chain-indexing-status-snapshot.ts
|
|
1755
|
-
var
|
|
1679
|
+
var import_v411 = require("zod/v4");
|
|
1756
1680
|
|
|
1757
1681
|
// src/indexing-status/deserialize/omnichain-indexing-status-snapshot.ts
|
|
1758
|
-
var
|
|
1682
|
+
var import_v410 = require("zod/v4");
|
|
1759
1683
|
function buildUnvalidatedOmnichainIndexingStatusSnapshot(serializedSnapshot) {
|
|
1760
1684
|
const chains = /* @__PURE__ */ new Map();
|
|
1761
1685
|
for (const [chainIdString, chainIndexingStatusSnapshot] of Object.entries(
|
|
@@ -1776,7 +1700,7 @@ function deserializeOmnichainIndexingStatusSnapshot(data, valueLabel) {
|
|
|
1776
1700
|
if (parsed.error) {
|
|
1777
1701
|
throw new Error(
|
|
1778
1702
|
`Cannot deserialize into OmnichainIndexingStatusSnapshot:
|
|
1779
|
-
${(0,
|
|
1703
|
+
${(0, import_v410.prettifyError)(parsed.error)}
|
|
1780
1704
|
`
|
|
1781
1705
|
);
|
|
1782
1706
|
}
|
|
@@ -1798,7 +1722,7 @@ function deserializeCrossChainIndexingStatusSnapshot(maybeSnapshot, valueLabel)
|
|
|
1798
1722
|
if (parsed.error) {
|
|
1799
1723
|
throw new Error(
|
|
1800
1724
|
`Cannot deserialize into CrossChainIndexingStatusSnapshot:
|
|
1801
|
-
${(0,
|
|
1725
|
+
${(0, import_v411.prettifyError)(parsed.error)}
|
|
1802
1726
|
`
|
|
1803
1727
|
);
|
|
1804
1728
|
}
|
|
@@ -1818,7 +1742,7 @@ function deserializeRealtimeIndexingStatusProjection(maybeProjection, valueLabel
|
|
|
1818
1742
|
if (parsed.error) {
|
|
1819
1743
|
throw new Error(
|
|
1820
1744
|
`Cannot deserialize into RealtimeIndexingStatusProjection:
|
|
1821
|
-
${(0,
|
|
1745
|
+
${(0, import_v412.prettifyError)(parsed.error)}
|
|
1822
1746
|
`
|
|
1823
1747
|
);
|
|
1824
1748
|
}
|
|
@@ -1826,7 +1750,7 @@ ${(0, import_v413.prettifyError)(parsed.error)}
|
|
|
1826
1750
|
}
|
|
1827
1751
|
|
|
1828
1752
|
// src/ensapi/api/indexing-status/response.ts
|
|
1829
|
-
var
|
|
1753
|
+
var EnsApiIndexingStatusResponseCodes = {
|
|
1830
1754
|
/**
|
|
1831
1755
|
* Represents that the indexing status is available.
|
|
1832
1756
|
*/
|
|
@@ -1836,32 +1760,33 @@ var IndexingStatusResponseCodes = {
|
|
|
1836
1760
|
*/
|
|
1837
1761
|
Error: "error"
|
|
1838
1762
|
};
|
|
1763
|
+
var IndexingStatusResponseCodes = EnsApiIndexingStatusResponseCodes;
|
|
1839
1764
|
|
|
1840
1765
|
// src/ensapi/api/indexing-status/zod-schemas.ts
|
|
1841
|
-
var
|
|
1842
|
-
var
|
|
1843
|
-
responseCode:
|
|
1766
|
+
var import_v413 = require("zod/v4");
|
|
1767
|
+
var makeEnsApiIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => import_v413.z.strictObject({
|
|
1768
|
+
responseCode: import_v413.z.literal(EnsApiIndexingStatusResponseCodes.Ok),
|
|
1844
1769
|
realtimeProjection: makeRealtimeIndexingStatusProjectionSchema(valueLabel)
|
|
1845
1770
|
});
|
|
1846
|
-
var
|
|
1847
|
-
responseCode:
|
|
1771
|
+
var makeEnsApiIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => import_v413.z.strictObject({
|
|
1772
|
+
responseCode: import_v413.z.literal(EnsApiIndexingStatusResponseCodes.Error)
|
|
1848
1773
|
});
|
|
1849
|
-
var
|
|
1850
|
-
|
|
1851
|
-
|
|
1774
|
+
var makeEnsApiIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => import_v413.z.discriminatedUnion("responseCode", [
|
|
1775
|
+
makeEnsApiIndexingStatusResponseOkSchema(valueLabel),
|
|
1776
|
+
makeEnsApiIndexingStatusResponseErrorSchema(valueLabel)
|
|
1852
1777
|
]);
|
|
1853
|
-
var
|
|
1854
|
-
responseCode:
|
|
1778
|
+
var makeSerializedEnsApiIndexingStatusResponseOkSchema = (valueLabel = "Serialized Indexing Status Response OK") => import_v413.z.strictObject({
|
|
1779
|
+
responseCode: import_v413.z.literal(EnsApiIndexingStatusResponseCodes.Ok),
|
|
1855
1780
|
realtimeProjection: makeSerializedRealtimeIndexingStatusProjectionSchema(valueLabel)
|
|
1856
1781
|
});
|
|
1857
|
-
var
|
|
1858
|
-
|
|
1859
|
-
|
|
1782
|
+
var makeSerializedEnsApiIndexingStatusResponseSchema = (valueLabel = "Serialized Indexing Status Response") => import_v413.z.discriminatedUnion("responseCode", [
|
|
1783
|
+
makeSerializedEnsApiIndexingStatusResponseOkSchema(valueLabel),
|
|
1784
|
+
makeEnsApiIndexingStatusResponseErrorSchema(valueLabel)
|
|
1860
1785
|
]);
|
|
1861
1786
|
|
|
1862
1787
|
// src/ensapi/api/indexing-status/deserialize.ts
|
|
1863
|
-
function
|
|
1864
|
-
if (serializedResponse.responseCode !==
|
|
1788
|
+
function buildUnvalidatedEnsApiIndexingStatusResponse(serializedResponse) {
|
|
1789
|
+
if (serializedResponse.responseCode !== EnsApiIndexingStatusResponseCodes.Ok) {
|
|
1865
1790
|
return serializedResponse;
|
|
1866
1791
|
}
|
|
1867
1792
|
return {
|
|
@@ -1871,15 +1796,18 @@ function buildUnvalidatedIndexingStatusResponse(serializedResponse) {
|
|
|
1871
1796
|
)
|
|
1872
1797
|
};
|
|
1873
1798
|
}
|
|
1874
|
-
function
|
|
1875
|
-
const parsed =
|
|
1799
|
+
function deserializeEnsApiIndexingStatusResponse(maybeResponse) {
|
|
1800
|
+
const parsed = makeSerializedEnsApiIndexingStatusResponseSchema().transform(buildUnvalidatedEnsApiIndexingStatusResponse).pipe(makeEnsApiIndexingStatusResponseSchema()).safeParse(maybeResponse);
|
|
1876
1801
|
if (parsed.error) {
|
|
1877
|
-
throw new Error(
|
|
1878
|
-
|
|
1879
|
-
|
|
1802
|
+
throw new Error(
|
|
1803
|
+
`Cannot deserialize EnsApiIndexingStatusResponse:
|
|
1804
|
+
${(0, import_v414.prettifyError)(parsed.error)}
|
|
1805
|
+
`
|
|
1806
|
+
);
|
|
1880
1807
|
}
|
|
1881
1808
|
return parsed.data;
|
|
1882
1809
|
}
|
|
1810
|
+
var deserializeIndexingStatusResponse = deserializeEnsApiIndexingStatusResponse;
|
|
1883
1811
|
|
|
1884
1812
|
// src/shared/serialize.ts
|
|
1885
1813
|
var import_caip2 = require("caip");
|
|
@@ -1990,33 +1918,34 @@ function serializeRealtimeIndexingStatusProjection(indexingProjection) {
|
|
|
1990
1918
|
}
|
|
1991
1919
|
|
|
1992
1920
|
// src/ensapi/api/indexing-status/serialize.ts
|
|
1993
|
-
function
|
|
1921
|
+
function serializeEnsApiIndexingStatusResponse(response) {
|
|
1994
1922
|
switch (response.responseCode) {
|
|
1995
|
-
case
|
|
1923
|
+
case EnsApiIndexingStatusResponseCodes.Ok:
|
|
1996
1924
|
return {
|
|
1997
1925
|
responseCode: response.responseCode,
|
|
1998
1926
|
realtimeProjection: serializeRealtimeIndexingStatusProjection(response.realtimeProjection)
|
|
1999
1927
|
};
|
|
2000
|
-
case
|
|
1928
|
+
case EnsApiIndexingStatusResponseCodes.Error:
|
|
2001
1929
|
return response;
|
|
2002
1930
|
}
|
|
2003
1931
|
}
|
|
1932
|
+
var serializeIndexingStatusResponse = serializeEnsApiIndexingStatusResponse;
|
|
2004
1933
|
|
|
2005
1934
|
// src/ensapi/api/name-tokens/deserialize.ts
|
|
2006
|
-
var
|
|
1935
|
+
var import_v419 = require("zod/v4");
|
|
2007
1936
|
|
|
2008
1937
|
// src/ensapi/api/name-tokens/zod-schemas.ts
|
|
2009
|
-
var
|
|
2010
|
-
var
|
|
1938
|
+
var import_viem13 = require("viem");
|
|
1939
|
+
var import_v418 = require("zod/v4");
|
|
2011
1940
|
|
|
2012
1941
|
// src/tokenscope/name-token.ts
|
|
2013
|
-
var
|
|
1942
|
+
var import_viem12 = require("viem");
|
|
2014
1943
|
var import_datasources5 = require("@ensnode/datasources");
|
|
2015
1944
|
|
|
2016
1945
|
// src/shared/account-id.ts
|
|
2017
|
-
var
|
|
1946
|
+
var import_viem9 = require("viem");
|
|
2018
1947
|
var accountIdEqual = (a, b) => {
|
|
2019
|
-
return a.chainId === b.chainId && (0,
|
|
1948
|
+
return a.chainId === b.chainId && (0, import_viem9.isAddressEqual)(a.address, b.address);
|
|
2020
1949
|
};
|
|
2021
1950
|
|
|
2022
1951
|
// src/shared/datasource-contract.ts
|
|
@@ -2046,13 +1975,13 @@ var makeContractMatcher = (namespace, b) => (datasourceName, contractName) => {
|
|
|
2046
1975
|
};
|
|
2047
1976
|
|
|
2048
1977
|
// src/tokenscope/assets.ts
|
|
2049
|
-
var
|
|
2050
|
-
var
|
|
1978
|
+
var import_viem11 = require("viem");
|
|
1979
|
+
var import_v416 = require("zod/v4");
|
|
2051
1980
|
|
|
2052
1981
|
// src/tokenscope/zod-schemas.ts
|
|
2053
1982
|
var import_caip3 = require("caip");
|
|
2054
|
-
var
|
|
2055
|
-
var
|
|
1983
|
+
var import_viem10 = require("viem");
|
|
1984
|
+
var import_v415 = require("zod/v4");
|
|
2056
1985
|
|
|
2057
1986
|
// src/shared/types.ts
|
|
2058
1987
|
var AssetNamespaces = {
|
|
@@ -2061,10 +1990,10 @@ var AssetNamespaces = {
|
|
|
2061
1990
|
};
|
|
2062
1991
|
|
|
2063
1992
|
// src/tokenscope/zod-schemas.ts
|
|
2064
|
-
var tokenIdSchemaSerializable =
|
|
2065
|
-
var tokenIdSchemaNative =
|
|
1993
|
+
var tokenIdSchemaSerializable = import_v415.z.string();
|
|
1994
|
+
var tokenIdSchemaNative = import_v415.z.preprocess(
|
|
2066
1995
|
(v) => typeof v === "string" ? BigInt(v) : v,
|
|
2067
|
-
|
|
1996
|
+
import_v415.z.bigint().positive()
|
|
2068
1997
|
);
|
|
2069
1998
|
function makeTokenIdSchema(_valueLabel = "Token ID Schema", serializable = false) {
|
|
2070
1999
|
if (serializable) {
|
|
@@ -2074,13 +2003,13 @@ function makeTokenIdSchema(_valueLabel = "Token ID Schema", serializable = false
|
|
|
2074
2003
|
}
|
|
2075
2004
|
}
|
|
2076
2005
|
var makeAssetIdSchema = (valueLabel = "Asset ID Schema", serializable) => {
|
|
2077
|
-
return
|
|
2078
|
-
assetNamespace:
|
|
2006
|
+
return import_v415.z.object({
|
|
2007
|
+
assetNamespace: import_v415.z.enum(AssetNamespaces),
|
|
2079
2008
|
contract: makeAccountIdSchema(valueLabel),
|
|
2080
2009
|
tokenId: makeTokenIdSchema(valueLabel, serializable ?? false)
|
|
2081
2010
|
});
|
|
2082
2011
|
};
|
|
2083
|
-
var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") =>
|
|
2012
|
+
var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") => import_v415.z.preprocess((v) => {
|
|
2084
2013
|
if (typeof v === "string") {
|
|
2085
2014
|
const result = new import_caip3.AssetId(v);
|
|
2086
2015
|
return {
|
|
@@ -2096,7 +2025,7 @@ var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") => import_
|
|
|
2096
2025
|
}, makeAssetIdSchema(valueLabel));
|
|
2097
2026
|
function invariant_nameTokenOwnershipHasNonZeroAddressOwner(ctx) {
|
|
2098
2027
|
const ownership = ctx.value;
|
|
2099
|
-
if (ctx.value.owner.address ===
|
|
2028
|
+
if (ctx.value.owner.address === import_viem10.zeroAddress) {
|
|
2100
2029
|
ctx.issues.push({
|
|
2101
2030
|
code: "custom",
|
|
2102
2031
|
input: ctx.value,
|
|
@@ -2104,25 +2033,25 @@ function invariant_nameTokenOwnershipHasNonZeroAddressOwner(ctx) {
|
|
|
2104
2033
|
});
|
|
2105
2034
|
}
|
|
2106
2035
|
}
|
|
2107
|
-
var makeNameTokenOwnershipNameWrapperSchema = (valueLabel = "Name Token Ownership NameWrapper") =>
|
|
2108
|
-
ownershipType:
|
|
2036
|
+
var makeNameTokenOwnershipNameWrapperSchema = (valueLabel = "Name Token Ownership NameWrapper") => import_v415.z.object({
|
|
2037
|
+
ownershipType: import_v415.z.literal(NameTokenOwnershipTypes.NameWrapper),
|
|
2109
2038
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2110
2039
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2111
|
-
var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") =>
|
|
2112
|
-
ownershipType:
|
|
2040
|
+
var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") => import_v415.z.object({
|
|
2041
|
+
ownershipType: import_v415.z.literal(NameTokenOwnershipTypes.FullyOnchain),
|
|
2113
2042
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2114
2043
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2115
|
-
var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") =>
|
|
2116
|
-
ownershipType:
|
|
2044
|
+
var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") => import_v415.z.object({
|
|
2045
|
+
ownershipType: import_v415.z.literal(NameTokenOwnershipTypes.Burned),
|
|
2117
2046
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2118
2047
|
}).check(invariant_nameTokenOwnershipHasZeroAddressOwner);
|
|
2119
|
-
var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") =>
|
|
2120
|
-
ownershipType:
|
|
2048
|
+
var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") => import_v415.z.object({
|
|
2049
|
+
ownershipType: import_v415.z.literal(NameTokenOwnershipTypes.Unknown),
|
|
2121
2050
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2122
2051
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2123
2052
|
function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
|
|
2124
2053
|
const ownership = ctx.value;
|
|
2125
|
-
if (ctx.value.owner.address !==
|
|
2054
|
+
if (ctx.value.owner.address !== import_viem10.zeroAddress) {
|
|
2126
2055
|
ctx.issues.push({
|
|
2127
2056
|
code: "custom",
|
|
2128
2057
|
input: ctx.value,
|
|
@@ -2130,16 +2059,16 @@ function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
|
|
|
2130
2059
|
});
|
|
2131
2060
|
}
|
|
2132
2061
|
}
|
|
2133
|
-
var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") =>
|
|
2062
|
+
var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") => import_v415.z.discriminatedUnion("ownershipType", [
|
|
2134
2063
|
makeNameTokenOwnershipNameWrapperSchema(valueLabel),
|
|
2135
2064
|
makeNameTokenOwnershipFullyOnchainSchema(valueLabel),
|
|
2136
2065
|
makeNameTokenOwnershipBurnedSchema(valueLabel),
|
|
2137
2066
|
makeNameTokenOwnershipUnknownSchema(valueLabel)
|
|
2138
2067
|
]);
|
|
2139
|
-
var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) =>
|
|
2068
|
+
var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) => import_v415.z.object({
|
|
2140
2069
|
token: makeAssetIdSchema(`${valueLabel}.token`, serializable),
|
|
2141
2070
|
ownership: makeNameTokenOwnershipSchema(`${valueLabel}.ownership`),
|
|
2142
|
-
mintStatus:
|
|
2071
|
+
mintStatus: import_v415.z.enum(NFTMintStatuses)
|
|
2143
2072
|
});
|
|
2144
2073
|
|
|
2145
2074
|
// src/tokenscope/assets.ts
|
|
@@ -2155,7 +2084,7 @@ function deserializeAssetId(maybeAssetId, valueLabel) {
|
|
|
2155
2084
|
const parsed = schema.safeParse(maybeAssetId);
|
|
2156
2085
|
if (parsed.error) {
|
|
2157
2086
|
throw new RangeError(`Cannot deserialize AssetId:
|
|
2158
|
-
${(0,
|
|
2087
|
+
${(0, import_v416.prettifyError)(parsed.error)}
|
|
2159
2088
|
`);
|
|
2160
2089
|
}
|
|
2161
2090
|
return parsed.data;
|
|
@@ -2165,7 +2094,7 @@ function parseAssetId(maybeAssetId, valueLabel) {
|
|
|
2165
2094
|
const parsed = schema.safeParse(maybeAssetId);
|
|
2166
2095
|
if (parsed.error) {
|
|
2167
2096
|
throw new RangeError(`Cannot parse AssetId:
|
|
2168
|
-
${(0,
|
|
2097
|
+
${(0, import_v416.prettifyError)(parsed.error)}
|
|
2169
2098
|
`);
|
|
2170
2099
|
}
|
|
2171
2100
|
return parsed.data;
|
|
@@ -2300,11 +2229,11 @@ var NFTTransferTypes = {
|
|
|
2300
2229
|
};
|
|
2301
2230
|
var getNFTTransferType = (from, to, allowMintedRemint, metadata, currentlyIndexedOwner) => {
|
|
2302
2231
|
const isIndexed = currentlyIndexedOwner !== void 0;
|
|
2303
|
-
const isIndexedAsMinted = isIndexed && !(0,
|
|
2304
|
-
const isMint = (0,
|
|
2305
|
-
const isBurn = (0,
|
|
2306
|
-
const isSelfTransfer = (0,
|
|
2307
|
-
if (isIndexed && !(0,
|
|
2232
|
+
const isIndexedAsMinted = isIndexed && !(0, import_viem11.isAddressEqual)(currentlyIndexedOwner, import_viem11.zeroAddress);
|
|
2233
|
+
const isMint = (0, import_viem11.isAddressEqual)(from, import_viem11.zeroAddress);
|
|
2234
|
+
const isBurn = (0, import_viem11.isAddressEqual)(to, import_viem11.zeroAddress);
|
|
2235
|
+
const isSelfTransfer = (0, import_viem11.isAddressEqual)(from, to);
|
|
2236
|
+
if (isIndexed && !(0, import_viem11.isAddressEqual)(currentlyIndexedOwner, from)) {
|
|
2308
2237
|
if (isMint && allowMintedRemint) {
|
|
2309
2238
|
} else {
|
|
2310
2239
|
throw new Error(
|
|
@@ -2445,7 +2374,7 @@ function getNameTokenOwnership(namespaceId, name, owner) {
|
|
|
2445
2374
|
owner
|
|
2446
2375
|
};
|
|
2447
2376
|
}
|
|
2448
|
-
if ((0,
|
|
2377
|
+
if ((0, import_viem12.isAddressEqual)(owner.address, import_viem12.zeroAddress)) {
|
|
2449
2378
|
return {
|
|
2450
2379
|
ownershipType: NameTokenOwnershipTypes.Burned,
|
|
2451
2380
|
owner
|
|
@@ -2465,10 +2394,10 @@ function getNameTokenOwnership(namespaceId, name, owner) {
|
|
|
2465
2394
|
}
|
|
2466
2395
|
|
|
2467
2396
|
// src/ensapi/api/shared/errors/zod-schemas.ts
|
|
2468
|
-
var
|
|
2469
|
-
var ErrorResponseSchema =
|
|
2470
|
-
message:
|
|
2471
|
-
details:
|
|
2397
|
+
var import_v417 = require("zod/v4");
|
|
2398
|
+
var ErrorResponseSchema = import_v417.z.object({
|
|
2399
|
+
message: import_v417.z.string(),
|
|
2400
|
+
details: import_v417.z.optional(import_v417.z.unknown())
|
|
2472
2401
|
});
|
|
2473
2402
|
|
|
2474
2403
|
// src/ensapi/api/name-tokens/response.ts
|
|
@@ -2507,15 +2436,15 @@ var NameTokensResponseErrorCodes = {
|
|
|
2507
2436
|
};
|
|
2508
2437
|
|
|
2509
2438
|
// src/ensapi/api/name-tokens/zod-schemas.ts
|
|
2510
|
-
var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) =>
|
|
2439
|
+
var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) => import_v418.z.object({
|
|
2511
2440
|
domainId: makeNodeSchema(`${valueLabel}.domainId`),
|
|
2512
2441
|
name: makeReinterpretedNameSchema(valueLabel),
|
|
2513
|
-
tokens:
|
|
2442
|
+
tokens: import_v418.z.array(makeNameTokenSchema(`${valueLabel}.tokens`, serializable)).nonempty(),
|
|
2514
2443
|
expiresAt: makeUnixTimestampSchema(`${valueLabel}.expiresAt`),
|
|
2515
2444
|
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
|
|
2516
2445
|
}).check(function invariant_nameIsAssociatedWithDomainId(ctx) {
|
|
2517
2446
|
const { name, domainId } = ctx.value;
|
|
2518
|
-
if ((0,
|
|
2447
|
+
if ((0, import_viem13.namehash)(name) !== domainId) {
|
|
2519
2448
|
ctx.issues.push({
|
|
2520
2449
|
code: "custom",
|
|
2521
2450
|
input: ctx.value,
|
|
@@ -2552,32 +2481,32 @@ var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", seria
|
|
|
2552
2481
|
});
|
|
2553
2482
|
}
|
|
2554
2483
|
});
|
|
2555
|
-
var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) =>
|
|
2556
|
-
responseCode:
|
|
2484
|
+
var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) => import_v418.z.strictObject({
|
|
2485
|
+
responseCode: import_v418.z.literal(NameTokensResponseCodes.Ok),
|
|
2557
2486
|
registeredNameTokens: makeRegisteredNameTokenSchema(`${valueLabel}.nameTokens`, serializable)
|
|
2558
2487
|
});
|
|
2559
|
-
var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") =>
|
|
2560
|
-
responseCode:
|
|
2561
|
-
errorCode:
|
|
2488
|
+
var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") => import_v418.z.strictObject({
|
|
2489
|
+
responseCode: import_v418.z.literal(NameTokensResponseCodes.Error),
|
|
2490
|
+
errorCode: import_v418.z.literal(NameTokensResponseErrorCodes.NameTokensNotIndexed),
|
|
2562
2491
|
error: ErrorResponseSchema
|
|
2563
2492
|
});
|
|
2564
|
-
var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") =>
|
|
2565
|
-
responseCode:
|
|
2566
|
-
errorCode:
|
|
2493
|
+
var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") => import_v418.z.strictObject({
|
|
2494
|
+
responseCode: import_v418.z.literal(NameTokensResponseCodes.Error),
|
|
2495
|
+
errorCode: import_v418.z.literal(NameTokensResponseErrorCodes.EnsIndexerConfigUnsupported),
|
|
2567
2496
|
error: ErrorResponseSchema
|
|
2568
2497
|
});
|
|
2569
|
-
var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") =>
|
|
2570
|
-
responseCode:
|
|
2571
|
-
errorCode:
|
|
2498
|
+
var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") => import_v418.z.strictObject({
|
|
2499
|
+
responseCode: import_v418.z.literal(NameTokensResponseCodes.Error),
|
|
2500
|
+
errorCode: import_v418.z.literal(NameTokensResponseErrorCodes.IndexingStatusUnsupported),
|
|
2572
2501
|
error: ErrorResponseSchema
|
|
2573
2502
|
});
|
|
2574
|
-
var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") =>
|
|
2503
|
+
var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") => import_v418.z.discriminatedUnion("errorCode", [
|
|
2575
2504
|
makeNameTokensResponseErrorNameTokensNotIndexedSchema(valueLabel),
|
|
2576
2505
|
makeNameTokensResponseErrorEnsIndexerConfigUnsupported(valueLabel),
|
|
2577
2506
|
makeNameTokensResponseErrorNameIndexingStatusUnsupported(valueLabel)
|
|
2578
2507
|
]);
|
|
2579
2508
|
var makeNameTokensResponseSchema = (valueLabel = "Name Tokens Response", serializable) => {
|
|
2580
|
-
return
|
|
2509
|
+
return import_v418.z.discriminatedUnion("responseCode", [
|
|
2581
2510
|
makeNameTokensResponseOkSchema(valueLabel, serializable ?? false),
|
|
2582
2511
|
makeNameTokensResponseErrorSchema(valueLabel)
|
|
2583
2512
|
]);
|
|
@@ -2590,7 +2519,7 @@ function deserializedNameTokensResponse(maybeResponse) {
|
|
|
2590
2519
|
);
|
|
2591
2520
|
if (parsed.error) {
|
|
2592
2521
|
throw new Error(`Cannot deserialize NameTokensResponse:
|
|
2593
|
-
${(0,
|
|
2522
|
+
${(0, import_v419.prettifyError)(parsed.error)}
|
|
2594
2523
|
`);
|
|
2595
2524
|
}
|
|
2596
2525
|
return parsed.data;
|
|
@@ -2608,7 +2537,7 @@ var nameTokensPrerequisites = Object.freeze({
|
|
|
2608
2537
|
*/
|
|
2609
2538
|
requiredPlugins: ["registrars" /* Registrars */, "tokenscope" /* TokenScope */],
|
|
2610
2539
|
/**
|
|
2611
|
-
* Check if provided
|
|
2540
|
+
* Check if provided EnsIndexerPublicConfig supports the Name Tokens API.
|
|
2612
2541
|
*/
|
|
2613
2542
|
hasEnsIndexerConfigSupport(config) {
|
|
2614
2543
|
return nameTokensPrerequisites.requiredPlugins.every(
|
|
@@ -2664,44 +2593,44 @@ function serializeNameTokensResponse(response) {
|
|
|
2664
2593
|
}
|
|
2665
2594
|
|
|
2666
2595
|
// src/ensapi/api/registrar-actions/deserialize.ts
|
|
2667
|
-
var
|
|
2596
|
+
var import_v423 = require("zod/v4");
|
|
2668
2597
|
|
|
2669
2598
|
// src/ensapi/api/registrar-actions/zod-schemas.ts
|
|
2670
2599
|
var import_ens7 = require("viem/ens");
|
|
2671
|
-
var
|
|
2600
|
+
var import_v422 = require("zod/v4");
|
|
2672
2601
|
|
|
2673
2602
|
// src/registrars/zod-schemas.ts
|
|
2674
|
-
var
|
|
2603
|
+
var import_v420 = require("zod/v4");
|
|
2675
2604
|
|
|
2676
2605
|
// src/registrars/encoded-referrer.ts
|
|
2677
|
-
var
|
|
2606
|
+
var import_viem14 = require("viem");
|
|
2678
2607
|
var ENCODED_REFERRER_BYTE_OFFSET = 12;
|
|
2679
2608
|
var ENCODED_REFERRER_BYTE_LENGTH = 32;
|
|
2680
|
-
var EXPECTED_ENCODED_REFERRER_PADDING = (0,
|
|
2609
|
+
var EXPECTED_ENCODED_REFERRER_PADDING = (0, import_viem14.pad)("0x", {
|
|
2681
2610
|
size: ENCODED_REFERRER_BYTE_OFFSET,
|
|
2682
2611
|
dir: "left"
|
|
2683
2612
|
});
|
|
2684
|
-
var ZERO_ENCODED_REFERRER = (0,
|
|
2613
|
+
var ZERO_ENCODED_REFERRER = (0, import_viem14.pad)("0x", {
|
|
2685
2614
|
size: ENCODED_REFERRER_BYTE_LENGTH,
|
|
2686
2615
|
dir: "left"
|
|
2687
2616
|
});
|
|
2688
2617
|
function buildEncodedReferrer(address) {
|
|
2689
2618
|
const lowercaseAddress = address.toLowerCase();
|
|
2690
|
-
return (0,
|
|
2619
|
+
return (0, import_viem14.pad)(lowercaseAddress, { size: ENCODED_REFERRER_BYTE_LENGTH, dir: "left" });
|
|
2691
2620
|
}
|
|
2692
2621
|
function decodeEncodedReferrer(encodedReferrer) {
|
|
2693
|
-
if ((0,
|
|
2622
|
+
if ((0, import_viem14.size)(encodedReferrer) !== ENCODED_REFERRER_BYTE_LENGTH) {
|
|
2694
2623
|
throw new Error(
|
|
2695
2624
|
`Encoded referrer value must be represented by ${ENCODED_REFERRER_BYTE_LENGTH} bytes.`
|
|
2696
2625
|
);
|
|
2697
2626
|
}
|
|
2698
|
-
const padding = (0,
|
|
2627
|
+
const padding = (0, import_viem14.slice)(encodedReferrer, 0, ENCODED_REFERRER_BYTE_OFFSET);
|
|
2699
2628
|
if (padding !== EXPECTED_ENCODED_REFERRER_PADDING) {
|
|
2700
|
-
return
|
|
2629
|
+
return import_viem14.zeroAddress;
|
|
2701
2630
|
}
|
|
2702
|
-
const decodedReferrer = (0,
|
|
2631
|
+
const decodedReferrer = (0, import_viem14.slice)(encodedReferrer, ENCODED_REFERRER_BYTE_OFFSET);
|
|
2703
2632
|
try {
|
|
2704
|
-
return (0,
|
|
2633
|
+
return (0, import_viem14.getAddress)(decodedReferrer);
|
|
2705
2634
|
} catch {
|
|
2706
2635
|
throw new Error(`Decoded referrer value must be a valid EVM address.`);
|
|
2707
2636
|
}
|
|
@@ -2746,11 +2675,11 @@ function serializeRegistrarAction(registrarAction) {
|
|
|
2746
2675
|
}
|
|
2747
2676
|
|
|
2748
2677
|
// src/registrars/zod-schemas.ts
|
|
2749
|
-
var makeSubregistrySchema = (valueLabel = "Subregistry") =>
|
|
2678
|
+
var makeSubregistrySchema = (valueLabel = "Subregistry") => import_v420.z.object({
|
|
2750
2679
|
subregistryId: makeAccountIdSchema(`${valueLabel} Subregistry ID`),
|
|
2751
2680
|
node: makeNodeSchema(`${valueLabel} Node`)
|
|
2752
2681
|
});
|
|
2753
|
-
var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") =>
|
|
2682
|
+
var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") => import_v420.z.object({
|
|
2754
2683
|
subregistry: makeSubregistrySchema(`${valueLabel} Subregistry`),
|
|
2755
2684
|
node: makeNodeSchema(`${valueLabel} Node`),
|
|
2756
2685
|
expiresAt: makeUnixTimestampSchema(`${valueLabel} Expires at`)
|
|
@@ -2766,18 +2695,18 @@ function invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium(ctx) {
|
|
|
2766
2695
|
});
|
|
2767
2696
|
}
|
|
2768
2697
|
}
|
|
2769
|
-
var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") =>
|
|
2698
|
+
var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") => import_v420.z.union([
|
|
2770
2699
|
// pricing available
|
|
2771
|
-
|
|
2700
|
+
import_v420.z.object({
|
|
2772
2701
|
baseCost: makePriceEthSchema(`${valueLabel} Base Cost`),
|
|
2773
2702
|
premium: makePriceEthSchema(`${valueLabel} Premium`),
|
|
2774
2703
|
total: makePriceEthSchema(`${valueLabel} Total`)
|
|
2775
2704
|
}).check(invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium).transform((v) => v),
|
|
2776
2705
|
// pricing unknown
|
|
2777
|
-
|
|
2778
|
-
baseCost:
|
|
2779
|
-
premium:
|
|
2780
|
-
total:
|
|
2706
|
+
import_v420.z.object({
|
|
2707
|
+
baseCost: import_v420.z.null(),
|
|
2708
|
+
premium: import_v420.z.null(),
|
|
2709
|
+
total: import_v420.z.null()
|
|
2781
2710
|
}).transform((v) => v)
|
|
2782
2711
|
]);
|
|
2783
2712
|
function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
|
|
@@ -2800,9 +2729,9 @@ function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
|
|
|
2800
2729
|
});
|
|
2801
2730
|
}
|
|
2802
2731
|
}
|
|
2803
|
-
var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") =>
|
|
2732
|
+
var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") => import_v420.z.union([
|
|
2804
2733
|
// referral available
|
|
2805
|
-
|
|
2734
|
+
import_v420.z.object({
|
|
2806
2735
|
encodedReferrer: makeHexStringSchema(
|
|
2807
2736
|
{ bytesCount: ENCODED_REFERRER_BYTE_LENGTH },
|
|
2808
2737
|
`${valueLabel} Encoded Referrer`
|
|
@@ -2810,9 +2739,9 @@ var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral
|
|
|
2810
2739
|
decodedReferrer: makeLowercaseAddressSchema(`${valueLabel} Decoded Referrer`)
|
|
2811
2740
|
}).check(invariant_registrarActionDecodedReferrerBasedOnRawReferrer),
|
|
2812
2741
|
// referral not applicable
|
|
2813
|
-
|
|
2814
|
-
encodedReferrer:
|
|
2815
|
-
decodedReferrer:
|
|
2742
|
+
import_v420.z.object({
|
|
2743
|
+
encodedReferrer: import_v420.z.null(),
|
|
2744
|
+
decodedReferrer: import_v420.z.null()
|
|
2816
2745
|
})
|
|
2817
2746
|
]);
|
|
2818
2747
|
function invariant_eventIdsInitialElementIsTheActionId(ctx) {
|
|
@@ -2825,9 +2754,9 @@ function invariant_eventIdsInitialElementIsTheActionId(ctx) {
|
|
|
2825
2754
|
});
|
|
2826
2755
|
}
|
|
2827
2756
|
}
|
|
2828
|
-
var EventIdSchema =
|
|
2829
|
-
var EventIdsSchema =
|
|
2830
|
-
var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") =>
|
|
2757
|
+
var EventIdSchema = import_v420.z.string().nonempty();
|
|
2758
|
+
var EventIdsSchema = import_v420.z.array(EventIdSchema).min(1).transform((v) => v);
|
|
2759
|
+
var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => import_v420.z.object({
|
|
2831
2760
|
id: EventIdSchema,
|
|
2832
2761
|
incrementalDuration: makeDurationSchema(`${valueLabel} Incremental Duration`),
|
|
2833
2762
|
registrant: makeLowercaseAddressSchema(`${valueLabel} Registrant`),
|
|
@@ -2841,38 +2770,38 @@ var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => im
|
|
|
2841
2770
|
eventIds: EventIdsSchema
|
|
2842
2771
|
}).check(invariant_eventIdsInitialElementIsTheActionId);
|
|
2843
2772
|
var makeRegistrarActionRegistrationSchema = (valueLabel = "Registration ") => makeBaseRegistrarActionSchema(valueLabel).extend({
|
|
2844
|
-
type:
|
|
2773
|
+
type: import_v420.z.literal(RegistrarActionTypes.Registration)
|
|
2845
2774
|
});
|
|
2846
2775
|
var makeRegistrarActionRenewalSchema = (valueLabel = "Renewal") => makeBaseRegistrarActionSchema(valueLabel).extend({
|
|
2847
|
-
type:
|
|
2776
|
+
type: import_v420.z.literal(RegistrarActionTypes.Renewal)
|
|
2848
2777
|
});
|
|
2849
|
-
var makeRegistrarActionSchema = (valueLabel = "Registrar Action") =>
|
|
2778
|
+
var makeRegistrarActionSchema = (valueLabel = "Registrar Action") => import_v420.z.discriminatedUnion("type", [
|
|
2850
2779
|
makeRegistrarActionRegistrationSchema(`${valueLabel} Registration`),
|
|
2851
2780
|
makeRegistrarActionRenewalSchema(`${valueLabel} Renewal`)
|
|
2852
2781
|
]);
|
|
2853
2782
|
|
|
2854
2783
|
// src/ensapi/api/shared/pagination/zod-schemas.ts
|
|
2855
|
-
var
|
|
2784
|
+
var import_v421 = require("zod/v4");
|
|
2856
2785
|
|
|
2857
2786
|
// src/ensapi/api/shared/pagination/request.ts
|
|
2858
2787
|
var RECORDS_PER_PAGE_DEFAULT = 10;
|
|
2859
2788
|
var RECORDS_PER_PAGE_MAX = 100;
|
|
2860
2789
|
|
|
2861
2790
|
// src/ensapi/api/shared/pagination/zod-schemas.ts
|
|
2862
|
-
var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") =>
|
|
2791
|
+
var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") => import_v421.z.object({
|
|
2863
2792
|
page: makePositiveIntegerSchema(`${valueLabel}.page`),
|
|
2864
2793
|
recordsPerPage: makePositiveIntegerSchema(`${valueLabel}.recordsPerPage`).max(
|
|
2865
2794
|
RECORDS_PER_PAGE_MAX,
|
|
2866
2795
|
`${valueLabel}.recordsPerPage must not exceed ${RECORDS_PER_PAGE_MAX}`
|
|
2867
2796
|
)
|
|
2868
2797
|
});
|
|
2869
|
-
var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") =>
|
|
2870
|
-
totalRecords:
|
|
2871
|
-
totalPages:
|
|
2872
|
-
hasNext:
|
|
2873
|
-
hasPrev:
|
|
2874
|
-
startIndex:
|
|
2875
|
-
endIndex:
|
|
2798
|
+
var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") => import_v421.z.object({
|
|
2799
|
+
totalRecords: import_v421.z.literal(0),
|
|
2800
|
+
totalPages: import_v421.z.literal(1),
|
|
2801
|
+
hasNext: import_v421.z.literal(false),
|
|
2802
|
+
hasPrev: import_v421.z.literal(false),
|
|
2803
|
+
startIndex: import_v421.z.undefined(),
|
|
2804
|
+
endIndex: import_v421.z.undefined()
|
|
2876
2805
|
}).extend(makeRequestPageParamsSchema(valueLabel).shape);
|
|
2877
2806
|
function invariant_responsePageWithRecordsIsCorrect(ctx) {
|
|
2878
2807
|
const { hasNext, hasPrev, recordsPerPage, page, totalRecords, startIndex, endIndex } = ctx.value;
|
|
@@ -2907,15 +2836,15 @@ function invariant_responsePageWithRecordsIsCorrect(ctx) {
|
|
|
2907
2836
|
});
|
|
2908
2837
|
}
|
|
2909
2838
|
}
|
|
2910
|
-
var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") =>
|
|
2839
|
+
var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") => import_v421.z.object({
|
|
2911
2840
|
totalRecords: makePositiveIntegerSchema(`${valueLabel}.totalRecords`),
|
|
2912
2841
|
totalPages: makePositiveIntegerSchema(`${valueLabel}.totalPages`),
|
|
2913
|
-
hasNext:
|
|
2914
|
-
hasPrev:
|
|
2842
|
+
hasNext: import_v421.z.boolean(),
|
|
2843
|
+
hasPrev: import_v421.z.boolean(),
|
|
2915
2844
|
startIndex: makeNonNegativeIntegerSchema(`${valueLabel}.startIndex`),
|
|
2916
2845
|
endIndex: makeNonNegativeIntegerSchema(`${valueLabel}.endIndex`)
|
|
2917
2846
|
}).extend(makeRequestPageParamsSchema(valueLabel).shape).check(invariant_responsePageWithRecordsIsCorrect);
|
|
2918
|
-
var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") =>
|
|
2847
|
+
var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") => import_v421.z.union([
|
|
2919
2848
|
makeResponsePageContextSchemaWithNoRecords(valueLabel),
|
|
2920
2849
|
makeResponsePageContextSchemaWithRecords(valueLabel)
|
|
2921
2850
|
]);
|
|
@@ -2945,21 +2874,21 @@ function invariant_registrationLifecycleNodeMatchesName(ctx) {
|
|
|
2945
2874
|
});
|
|
2946
2875
|
}
|
|
2947
2876
|
}
|
|
2948
|
-
var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") =>
|
|
2877
|
+
var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") => import_v422.z.object({
|
|
2949
2878
|
action: makeRegistrarActionSchema(valueLabel),
|
|
2950
2879
|
name: makeReinterpretedNameSchema(valueLabel)
|
|
2951
2880
|
}).check(invariant_registrationLifecycleNodeMatchesName);
|
|
2952
|
-
var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") =>
|
|
2953
|
-
responseCode:
|
|
2954
|
-
registrarActions:
|
|
2881
|
+
var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") => import_v422.z.object({
|
|
2882
|
+
responseCode: import_v422.z.literal(RegistrarActionsResponseCodes.Ok),
|
|
2883
|
+
registrarActions: import_v422.z.array(makeNamedRegistrarActionSchema(valueLabel)),
|
|
2955
2884
|
pageContext: makeResponsePageContextSchema(`${valueLabel}.pageContext`),
|
|
2956
2885
|
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`).optional()
|
|
2957
2886
|
});
|
|
2958
|
-
var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") =>
|
|
2959
|
-
responseCode:
|
|
2887
|
+
var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") => import_v422.z.strictObject({
|
|
2888
|
+
responseCode: import_v422.z.literal(RegistrarActionsResponseCodes.Error),
|
|
2960
2889
|
error: ErrorResponseSchema
|
|
2961
2890
|
});
|
|
2962
|
-
var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") =>
|
|
2891
|
+
var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") => import_v422.z.discriminatedUnion("responseCode", [
|
|
2963
2892
|
makeRegistrarActionsResponseOkSchema(valueLabel),
|
|
2964
2893
|
makeRegistrarActionsResponseErrorSchema(valueLabel)
|
|
2965
2894
|
]);
|
|
@@ -2970,7 +2899,7 @@ function deserializeRegistrarActionsResponse(maybeResponse) {
|
|
|
2970
2899
|
if (parsed.error) {
|
|
2971
2900
|
throw new Error(
|
|
2972
2901
|
`Cannot deserialize RegistrarActionsResponse:
|
|
2973
|
-
${(0,
|
|
2902
|
+
${(0, import_v423.prettifyError)(parsed.error)}
|
|
2974
2903
|
`
|
|
2975
2904
|
);
|
|
2976
2905
|
}
|
|
@@ -3065,7 +2994,7 @@ var registrarActionsPrerequisites = Object.freeze({
|
|
|
3065
2994
|
"registrars" /* Registrars */
|
|
3066
2995
|
],
|
|
3067
2996
|
/**
|
|
3068
|
-
* Check if provided
|
|
2997
|
+
* Check if provided EnsIndexerPublicConfig supports the Registrar Actions API.
|
|
3069
2998
|
*/
|
|
3070
2999
|
hasEnsIndexerConfigSupport(config) {
|
|
3071
3000
|
return registrarActionsPrerequisites.requiredPlugins.every(
|
|
@@ -3117,12 +3046,12 @@ function serializeRegistrarActionsResponse(response) {
|
|
|
3117
3046
|
}
|
|
3118
3047
|
|
|
3119
3048
|
// src/ensapi/api/shared/errors/deserialize.ts
|
|
3120
|
-
var
|
|
3049
|
+
var import_v424 = require("zod/v4");
|
|
3121
3050
|
function deserializeErrorResponse(maybeErrorResponse) {
|
|
3122
3051
|
const parsed = ErrorResponseSchema.safeParse(maybeErrorResponse);
|
|
3123
3052
|
if (parsed.error) {
|
|
3124
3053
|
throw new Error(`Cannot deserialize ErrorResponse:
|
|
3125
|
-
${(0,
|
|
3054
|
+
${(0, import_v424.prettifyError)(parsed.error)}
|
|
3126
3055
|
`);
|
|
3127
3056
|
}
|
|
3128
3057
|
return parsed.data;
|
|
@@ -3195,7 +3124,7 @@ var getDefaultEnsNodeUrl = (namespace) => {
|
|
|
3195
3124
|
};
|
|
3196
3125
|
|
|
3197
3126
|
// src/ensapi/client.ts
|
|
3198
|
-
var
|
|
3127
|
+
var EnsApiClient = class _EnsApiClient {
|
|
3199
3128
|
options;
|
|
3200
3129
|
static defaultOptions() {
|
|
3201
3130
|
return {
|
|
@@ -3204,7 +3133,7 @@ var ENSApiClient = class _ENSApiClient {
|
|
|
3204
3133
|
}
|
|
3205
3134
|
constructor(options = {}) {
|
|
3206
3135
|
this.options = {
|
|
3207
|
-
...
|
|
3136
|
+
..._EnsApiClient.defaultOptions(),
|
|
3208
3137
|
...options
|
|
3209
3138
|
};
|
|
3210
3139
|
}
|
|
@@ -3373,15 +3302,15 @@ var ENSApiClient = class _ENSApiClient {
|
|
|
3373
3302
|
return data;
|
|
3374
3303
|
}
|
|
3375
3304
|
/**
|
|
3376
|
-
* Fetch
|
|
3305
|
+
* Fetch ENSApi Config
|
|
3377
3306
|
*
|
|
3378
|
-
* Fetch the
|
|
3307
|
+
* Fetch the ENSApi's configuration.
|
|
3379
3308
|
*
|
|
3380
|
-
* @returns {
|
|
3309
|
+
* @returns {EnsApiConfigResponse}
|
|
3381
3310
|
*
|
|
3382
|
-
* @throws if the
|
|
3383
|
-
* @throws if the
|
|
3384
|
-
* @throws if the
|
|
3311
|
+
* @throws if the ENSApi request fails
|
|
3312
|
+
* @throws if the ENSApi returns an error response
|
|
3313
|
+
* @throws if the ENSApi response breaks required invariants
|
|
3385
3314
|
*/
|
|
3386
3315
|
async config() {
|
|
3387
3316
|
const url = new URL(`/api/config`, this.options.url);
|
|
@@ -3394,18 +3323,18 @@ var ENSApiClient = class _ENSApiClient {
|
|
|
3394
3323
|
}
|
|
3395
3324
|
if (!response.ok) {
|
|
3396
3325
|
const errorResponse = deserializeErrorResponse(responseData);
|
|
3397
|
-
throw new Error(`Fetching
|
|
3326
|
+
throw new Error(`Fetching ENSApi Config Failed: ${errorResponse.message}`);
|
|
3398
3327
|
}
|
|
3399
|
-
return
|
|
3328
|
+
return deserializeEnsApiConfigResponse(responseData);
|
|
3400
3329
|
}
|
|
3401
3330
|
/**
|
|
3402
|
-
* Fetch
|
|
3331
|
+
* Fetch ENSApi Indexing Status
|
|
3403
3332
|
*
|
|
3404
|
-
* @returns {
|
|
3333
|
+
* @returns {EnsApiIndexingStatusResponse}
|
|
3405
3334
|
*
|
|
3406
|
-
* @throws if the
|
|
3407
|
-
* @throws if the
|
|
3408
|
-
* @throws if the
|
|
3335
|
+
* @throws if the ENSApi request fails
|
|
3336
|
+
* @throws if the ENSApi returns an error response
|
|
3337
|
+
* @throws if the ENSApi response breaks required invariants
|
|
3409
3338
|
*/
|
|
3410
3339
|
async indexingStatus() {
|
|
3411
3340
|
const url = new URL(`/api/indexing-status`, this.options.url);
|
|
@@ -3424,10 +3353,12 @@ var ENSApiClient = class _ENSApiClient {
|
|
|
3424
3353
|
console.log("Indexing Status API: handling a known indexing status server error.");
|
|
3425
3354
|
}
|
|
3426
3355
|
if (typeof errorResponse !== "undefined") {
|
|
3427
|
-
throw new Error(`Fetching
|
|
3356
|
+
throw new Error(`Fetching ENSApi Indexing Status Failed: ${errorResponse.message}`);
|
|
3428
3357
|
}
|
|
3429
3358
|
}
|
|
3430
|
-
return
|
|
3359
|
+
return deserializeEnsApiIndexingStatusResponse(
|
|
3360
|
+
responseData
|
|
3361
|
+
);
|
|
3431
3362
|
}
|
|
3432
3363
|
/**
|
|
3433
3364
|
* Fetch ENSNode Registrar Actions
|
|
@@ -3449,11 +3380,11 @@ var ENSApiClient = class _ENSApiClient {
|
|
|
3449
3380
|
* ```ts
|
|
3450
3381
|
* import {
|
|
3451
3382
|
* registrarActionsFilter,
|
|
3452
|
-
*
|
|
3383
|
+
* EnsApiClient,
|
|
3453
3384
|
* } from "@ensnode/ensnode-sdk";
|
|
3454
3385
|
* import { namehash } from "viem/ens";
|
|
3455
3386
|
*
|
|
3456
|
-
* const client:
|
|
3387
|
+
* const client: EnsApiClient;
|
|
3457
3388
|
*
|
|
3458
3389
|
* // Get first page with default page size (10 records)
|
|
3459
3390
|
* const response = await client.registrarActions();
|
|
@@ -3616,11 +3547,11 @@ var ENSApiClient = class _ENSApiClient {
|
|
|
3616
3547
|
* @example
|
|
3617
3548
|
* ```ts
|
|
3618
3549
|
* import {
|
|
3619
|
-
*
|
|
3550
|
+
* EnsApiClient,
|
|
3620
3551
|
* } from "@ensnode/ensnode-sdk";
|
|
3621
3552
|
* import { namehash } from "viem/ens";
|
|
3622
3553
|
*
|
|
3623
|
-
* const client:
|
|
3554
|
+
* const client: EnsApiClient;
|
|
3624
3555
|
*
|
|
3625
3556
|
* // get latest name token records from the indexed subregistry based on the requested name
|
|
3626
3557
|
* const response = await client.nameTokens({
|
|
@@ -3660,9 +3591,103 @@ var ENSApiClient = class _ENSApiClient {
|
|
|
3660
3591
|
return deserializedNameTokensResponse(responseData);
|
|
3661
3592
|
}
|
|
3662
3593
|
};
|
|
3663
|
-
var ENSNodeClient = class extends
|
|
3594
|
+
var ENSNodeClient = class extends EnsApiClient {
|
|
3664
3595
|
};
|
|
3665
3596
|
|
|
3597
|
+
// src/ensindexer/config/deserialize.ts
|
|
3598
|
+
var import_v425 = require("zod/v4");
|
|
3599
|
+
function deserializeEnsIndexerPublicConfig(maybeConfig, valueLabel) {
|
|
3600
|
+
const schema = makeEnsIndexerPublicConfigSchema(valueLabel);
|
|
3601
|
+
const parsed = schema.safeParse(maybeConfig);
|
|
3602
|
+
if (parsed.error) {
|
|
3603
|
+
throw new Error(`Cannot deserialize EnsIndexerPublicConfig:
|
|
3604
|
+
${(0, import_v425.prettifyError)(parsed.error)}
|
|
3605
|
+
`);
|
|
3606
|
+
}
|
|
3607
|
+
return parsed.data;
|
|
3608
|
+
}
|
|
3609
|
+
var deserializeENSIndexerPublicConfig = deserializeEnsIndexerPublicConfig;
|
|
3610
|
+
|
|
3611
|
+
// src/ensindexer/config/label-utils.ts
|
|
3612
|
+
var import_viem15 = require("viem");
|
|
3613
|
+
function labelHashToBytes(labelHash) {
|
|
3614
|
+
try {
|
|
3615
|
+
if (labelHash.length !== 66) {
|
|
3616
|
+
throw new Error(`Invalid labelHash length ${labelHash.length} characters (expected 66)`);
|
|
3617
|
+
}
|
|
3618
|
+
if (labelHash !== labelHash.toLowerCase()) {
|
|
3619
|
+
throw new Error("Labelhash must be in lowercase");
|
|
3620
|
+
}
|
|
3621
|
+
if (!labelHash.startsWith("0x")) {
|
|
3622
|
+
throw new Error("Labelhash must be 0x-prefixed");
|
|
3623
|
+
}
|
|
3624
|
+
const bytes = (0, import_viem15.hexToBytes)(labelHash);
|
|
3625
|
+
if (bytes.length !== 32) {
|
|
3626
|
+
throw new Error(`Invalid labelHash length ${bytes.length} bytes (expected 32)`);
|
|
3627
|
+
}
|
|
3628
|
+
return bytes;
|
|
3629
|
+
} catch (e) {
|
|
3630
|
+
if (e instanceof Error) {
|
|
3631
|
+
throw e;
|
|
3632
|
+
}
|
|
3633
|
+
throw new Error("Invalid hex format");
|
|
3634
|
+
}
|
|
3635
|
+
}
|
|
3636
|
+
|
|
3637
|
+
// src/ensindexer/config/labelset-utils.ts
|
|
3638
|
+
function buildLabelSetId(maybeLabelSetId) {
|
|
3639
|
+
return makeLabelSetIdSchema("LabelSetId").parse(maybeLabelSetId);
|
|
3640
|
+
}
|
|
3641
|
+
function buildLabelSetVersion(maybeLabelSetVersion) {
|
|
3642
|
+
return makeLabelSetVersionSchema("LabelSetVersion").parse(maybeLabelSetVersion);
|
|
3643
|
+
}
|
|
3644
|
+
function buildEnsRainbowClientLabelSet(labelSetId, labelSetVersion) {
|
|
3645
|
+
if (labelSetVersion !== void 0 && labelSetId === void 0) {
|
|
3646
|
+
throw new Error("When a labelSetVersion is defined, labelSetId must also be defined.");
|
|
3647
|
+
}
|
|
3648
|
+
return { labelSetId, labelSetVersion };
|
|
3649
|
+
}
|
|
3650
|
+
function validateSupportedLabelSetAndVersion(serverSet, clientSet) {
|
|
3651
|
+
if (clientSet.labelSetId === void 0) {
|
|
3652
|
+
return;
|
|
3653
|
+
}
|
|
3654
|
+
if (serverSet.labelSetId !== clientSet.labelSetId) {
|
|
3655
|
+
throw new Error(
|
|
3656
|
+
`Server label set ID "${serverSet.labelSetId}" does not match client's requested label set ID "${clientSet.labelSetId}".`
|
|
3657
|
+
);
|
|
3658
|
+
}
|
|
3659
|
+
if (clientSet.labelSetVersion !== void 0 && serverSet.highestLabelSetVersion < clientSet.labelSetVersion) {
|
|
3660
|
+
throw new Error(
|
|
3661
|
+
`Server highest label set version ${serverSet.highestLabelSetVersion} is less than client's requested version ${clientSet.labelSetVersion} for label set ID "${clientSet.labelSetId}".`
|
|
3662
|
+
);
|
|
3663
|
+
}
|
|
3664
|
+
}
|
|
3665
|
+
|
|
3666
|
+
// src/ensindexer/config/parsing.ts
|
|
3667
|
+
function parseNonNegativeInteger(maybeNumber) {
|
|
3668
|
+
const trimmed = maybeNumber.trim();
|
|
3669
|
+
if (!trimmed) {
|
|
3670
|
+
throw new Error("Input cannot be empty");
|
|
3671
|
+
}
|
|
3672
|
+
if (trimmed === "-0") {
|
|
3673
|
+
throw new Error("Negative zero is not a valid non-negative integer");
|
|
3674
|
+
}
|
|
3675
|
+
const num = Number(maybeNumber);
|
|
3676
|
+
if (Number.isNaN(num)) {
|
|
3677
|
+
throw new Error(`"${maybeNumber}" is not a valid number`);
|
|
3678
|
+
}
|
|
3679
|
+
if (!Number.isFinite(num)) {
|
|
3680
|
+
throw new Error(`"${maybeNumber}" is not a finite number`);
|
|
3681
|
+
}
|
|
3682
|
+
if (!Number.isInteger(num)) {
|
|
3683
|
+
throw new Error(`"${maybeNumber}" is not an integer`);
|
|
3684
|
+
}
|
|
3685
|
+
if (num < 0) {
|
|
3686
|
+
throw new Error(`"${maybeNumber}" is not a non-negative integer`);
|
|
3687
|
+
}
|
|
3688
|
+
return num;
|
|
3689
|
+
}
|
|
3690
|
+
|
|
3666
3691
|
// src/ensv2/ids-lib.ts
|
|
3667
3692
|
var import_viem16 = require("viem");
|
|
3668
3693
|
var makeRegistryId = (accountId) => formatAccountId(accountId);
|