@ensnode/ensnode-sdk 1.1.0 → 1.2.0
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 +1098 -642
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +785 -324
- package/dist/index.d.ts +785 -324
- package/dist/index.js +1125 -669
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -34,6 +34,7 @@ __export(index_exports, {
|
|
|
34
34
|
ATTR_PROTOCOL_NAME: () => ATTR_PROTOCOL_NAME,
|
|
35
35
|
ATTR_PROTOCOL_STEP: () => ATTR_PROTOCOL_STEP,
|
|
36
36
|
ATTR_PROTOCOL_STEP_RESULT: () => ATTR_PROTOCOL_STEP_RESULT,
|
|
37
|
+
AssetNamespaces: () => AssetNamespaces,
|
|
37
38
|
BASENAMES_NODE: () => BASENAMES_NODE,
|
|
38
39
|
ChainIndexingConfigTypeIds: () => ChainIndexingConfigTypeIds,
|
|
39
40
|
ChainIndexingStatusIds: () => ChainIndexingStatusIds,
|
|
@@ -50,10 +51,15 @@ __export(index_exports, {
|
|
|
50
51
|
IndexingStatusResponseCodes: () => IndexingStatusResponseCodes,
|
|
51
52
|
LINEANAMES_NODE: () => LINEANAMES_NODE,
|
|
52
53
|
LruCache: () => LruCache,
|
|
54
|
+
NFTMintStatuses: () => NFTMintStatuses,
|
|
55
|
+
NFTTransferTypes: () => NFTTransferTypes,
|
|
53
56
|
OmnichainIndexingStatusIds: () => OmnichainIndexingStatusIds,
|
|
54
57
|
PROTOCOL_ATTRIBUTE_PREFIX: () => PROTOCOL_ATTRIBUTE_PREFIX,
|
|
55
58
|
PluginName: () => PluginName,
|
|
59
|
+
RECORDS_PER_PAGE_DEFAULT: () => RECORDS_PER_PAGE_DEFAULT,
|
|
60
|
+
RECORDS_PER_PAGE_MAX: () => RECORDS_PER_PAGE_MAX,
|
|
56
61
|
ROOT_NODE: () => ROOT_NODE,
|
|
62
|
+
ReferrerDetailResponseCodes: () => ReferrerDetailResponseCodes,
|
|
57
63
|
ReferrerLeaderboardPageResponseCodes: () => ReferrerLeaderboardPageResponseCodes,
|
|
58
64
|
RegistrarActionTypes: () => RegistrarActionTypes,
|
|
59
65
|
RegistrarActionsFilterTypes: () => RegistrarActionsFilterTypes,
|
|
@@ -75,6 +81,7 @@ __export(index_exports, {
|
|
|
75
81
|
beautifyName: () => beautifyName,
|
|
76
82
|
bigIntToNumber: () => bigIntToNumber,
|
|
77
83
|
bigintToCoinType: () => bigintToCoinType,
|
|
84
|
+
buildAssetId: () => buildAssetId,
|
|
78
85
|
buildEnsRainbowClientLabelSet: () => buildEnsRainbowClientLabelSet,
|
|
79
86
|
buildLabelSetId: () => buildLabelSetId,
|
|
80
87
|
buildLabelSetVersion: () => buildLabelSetVersion,
|
|
@@ -96,6 +103,7 @@ __export(index_exports, {
|
|
|
96
103
|
deserializeBlockrange: () => deserializeBlockrange,
|
|
97
104
|
deserializeChainId: () => deserializeChainId,
|
|
98
105
|
deserializeChainIndexingStatusSnapshot: () => deserializeChainIndexingStatusSnapshot,
|
|
106
|
+
deserializeConfigResponse: () => deserializeConfigResponse,
|
|
99
107
|
deserializeCrossChainIndexingStatusSnapshot: () => deserializeCrossChainIndexingStatusSnapshot,
|
|
100
108
|
deserializeDatetime: () => deserializeDatetime,
|
|
101
109
|
deserializeDuration: () => deserializeDuration,
|
|
@@ -105,6 +113,7 @@ __export(index_exports, {
|
|
|
105
113
|
deserializeIndexingStatusResponse: () => deserializeIndexingStatusResponse,
|
|
106
114
|
deserializeOmnichainIndexingStatusSnapshot: () => deserializeOmnichainIndexingStatusSnapshot,
|
|
107
115
|
deserializeRealtimeIndexingStatusProjection: () => deserializeRealtimeIndexingStatusProjection,
|
|
116
|
+
deserializeReferrerDetailResponse: () => deserializeReferrerDetailResponse,
|
|
108
117
|
deserializeReferrerLeaderboardPageResponse: () => deserializeReferrerLeaderboardPageResponse,
|
|
109
118
|
deserializeRegistrarActionsResponse: () => deserializeRegistrarActionsResponse,
|
|
110
119
|
deserializeUnixTimestamp: () => deserializeUnixTimestamp,
|
|
@@ -112,10 +121,12 @@ __export(index_exports, {
|
|
|
112
121
|
durationBetween: () => durationBetween,
|
|
113
122
|
encodeLabelHash: () => encodeLabelHash,
|
|
114
123
|
evmChainIdToCoinType: () => evmChainIdToCoinType,
|
|
124
|
+
formatNFTTransferEventMetadata: () => formatNFTTransferEventMetadata,
|
|
115
125
|
getCurrencyInfo: () => getCurrencyInfo,
|
|
116
126
|
getENSRootChainId: () => import_datasources2.getENSRootChainId,
|
|
117
127
|
getEthnamesSubregistryId: () => getEthnamesSubregistryId,
|
|
118
128
|
getLatestIndexedBlockRef: () => getLatestIndexedBlockRef,
|
|
129
|
+
getNFTTransferType: () => getNFTTransferType,
|
|
119
130
|
getNameHierarchy: () => getNameHierarchy,
|
|
120
131
|
getOmnichainIndexingCursor: () => getOmnichainIndexingCursor,
|
|
121
132
|
getOmnichainIndexingStatus: () => getOmnichainIndexingStatus,
|
|
@@ -153,8 +164,10 @@ __export(index_exports, {
|
|
|
153
164
|
registrarActionsPrerequisites: () => registrarActionsPrerequisites,
|
|
154
165
|
reverseName: () => reverseName,
|
|
155
166
|
serializeAccountId: () => serializeAccountId,
|
|
167
|
+
serializeAssetId: () => serializeAssetId,
|
|
156
168
|
serializeChainId: () => serializeChainId,
|
|
157
169
|
serializeChainIndexingSnapshots: () => serializeChainIndexingSnapshots,
|
|
170
|
+
serializeConfigResponse: () => serializeConfigResponse,
|
|
158
171
|
serializeCrossChainIndexingStatusSnapshotOmnichain: () => serializeCrossChainIndexingStatusSnapshotOmnichain,
|
|
159
172
|
serializeDatetime: () => serializeDatetime,
|
|
160
173
|
serializeENSApiPublicConfig: () => serializeENSApiPublicConfig,
|
|
@@ -166,6 +179,7 @@ __export(index_exports, {
|
|
|
166
179
|
serializePrice: () => serializePrice,
|
|
167
180
|
serializePriceEth: () => serializePriceEth,
|
|
168
181
|
serializeRealtimeIndexingStatusProjection: () => serializeRealtimeIndexingStatusProjection,
|
|
182
|
+
serializeReferrerDetailResponse: () => serializeReferrerDetailResponse,
|
|
169
183
|
serializeReferrerLeaderboardPageResponse: () => serializeReferrerLeaderboardPageResponse,
|
|
170
184
|
serializeRegistrarAction: () => serializeRegistrarAction,
|
|
171
185
|
serializeRegistrarActionPricing: () => serializeRegistrarActionPricing,
|
|
@@ -182,14 +196,13 @@ __export(index_exports, {
|
|
|
182
196
|
});
|
|
183
197
|
module.exports = __toCommonJS(index_exports);
|
|
184
198
|
|
|
185
|
-
// src/
|
|
186
|
-
var
|
|
199
|
+
// src/ensapi/config/deserialize.ts
|
|
200
|
+
var import_v45 = require("zod/v4");
|
|
187
201
|
|
|
188
|
-
// src/
|
|
189
|
-
var
|
|
190
|
-
var import_v48 = __toESM(require("zod/v4"), 1);
|
|
202
|
+
// src/ensapi/config/zod-schemas.ts
|
|
203
|
+
var import_v44 = require("zod/v4");
|
|
191
204
|
|
|
192
|
-
// src/ensindexer/
|
|
205
|
+
// src/ensindexer/config/zod-schemas.ts
|
|
193
206
|
var import_v43 = __toESM(require("zod/v4"), 1);
|
|
194
207
|
|
|
195
208
|
// src/ens/is-normalized.ts
|
|
@@ -1065,6 +1078,272 @@ function isWebSocketProtocol(url) {
|
|
|
1065
1078
|
return ["ws:", "wss:"].includes(url.protocol);
|
|
1066
1079
|
}
|
|
1067
1080
|
|
|
1081
|
+
// src/ensindexer/config/is-subgraph-compatible.ts
|
|
1082
|
+
var import_datasources3 = require("@ensnode/datasources");
|
|
1083
|
+
|
|
1084
|
+
// src/ensindexer/config/types.ts
|
|
1085
|
+
var PluginName = /* @__PURE__ */ ((PluginName2) => {
|
|
1086
|
+
PluginName2["Subgraph"] = "subgraph";
|
|
1087
|
+
PluginName2["Basenames"] = "basenames";
|
|
1088
|
+
PluginName2["Lineanames"] = "lineanames";
|
|
1089
|
+
PluginName2["ThreeDNS"] = "threedns";
|
|
1090
|
+
PluginName2["ProtocolAcceleration"] = "protocol-acceleration";
|
|
1091
|
+
PluginName2["Registrars"] = "registrars";
|
|
1092
|
+
PluginName2["TokenScope"] = "tokenscope";
|
|
1093
|
+
return PluginName2;
|
|
1094
|
+
})(PluginName || {});
|
|
1095
|
+
|
|
1096
|
+
// src/ensindexer/config/is-subgraph-compatible.ts
|
|
1097
|
+
function isSubgraphCompatible(config) {
|
|
1098
|
+
const onlySubgraphPluginActivated = config.plugins.length === 1 && config.plugins[0] === "subgraph" /* Subgraph */;
|
|
1099
|
+
const isSubgraphLabelSet = config.labelSet.labelSetId === "subgraph" && config.labelSet.labelSetVersion === 0;
|
|
1100
|
+
const isEnsTestEnvLabelSet = config.labelSet.labelSetId === "ens-test-env" && config.labelSet.labelSetVersion === 0;
|
|
1101
|
+
const labelSetIsSubgraphCompatible = isSubgraphLabelSet || config.namespace === import_datasources3.ENSNamespaceIds.EnsTestEnv && isEnsTestEnvLabelSet;
|
|
1102
|
+
return onlySubgraphPluginActivated && labelSetIsSubgraphCompatible;
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
// src/ensindexer/config/validations.ts
|
|
1106
|
+
function invariant_ensDbVersionIsSameAsEnsIndexerVersion(ctx) {
|
|
1107
|
+
const versionInfo = ctx.value;
|
|
1108
|
+
if (versionInfo.ensDb !== versionInfo.ensIndexer) {
|
|
1109
|
+
ctx.issues.push({
|
|
1110
|
+
code: "custom",
|
|
1111
|
+
input: versionInfo,
|
|
1112
|
+
message: "`ensDb` version must be same as `ensIndexer` version"
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
// src/ensindexer/config/zod-schemas.ts
|
|
1118
|
+
var makeIndexedChainIdsSchema = (valueLabel = "Indexed Chain IDs") => import_v43.default.array(makeChainIdSchema(valueLabel), {
|
|
1119
|
+
error: `${valueLabel} must be an array.`
|
|
1120
|
+
}).min(1, { error: `${valueLabel} list must include at least one element.` }).transform((v) => new Set(v));
|
|
1121
|
+
var makePluginsListSchema = (valueLabel = "Plugins") => import_v43.default.array(import_v43.default.string(), {
|
|
1122
|
+
error: `${valueLabel} must be a list of strings.`
|
|
1123
|
+
}).min(1, {
|
|
1124
|
+
error: `${valueLabel} must be a list of strings with at least one string value`
|
|
1125
|
+
}).refine((arr) => arr.length === uniq(arr).length, {
|
|
1126
|
+
error: `${valueLabel} cannot contain duplicate values.`
|
|
1127
|
+
});
|
|
1128
|
+
var makeDatabaseSchemaNameSchema = (valueLabel = "Database schema name") => import_v43.default.string({ error: `${valueLabel} must be a string` }).trim().nonempty({
|
|
1129
|
+
error: `${valueLabel} is required and must be a non-empty string.`
|
|
1130
|
+
});
|
|
1131
|
+
var makeLabelSetIdSchema = (valueLabel) => {
|
|
1132
|
+
return import_v43.default.string({ error: `${valueLabel} must be a string` }).min(1, { error: `${valueLabel} must be 1-50 characters long` }).max(50, { error: `${valueLabel} must be 1-50 characters long` }).regex(/^[a-z-]+$/, {
|
|
1133
|
+
error: `${valueLabel} can only contain lowercase letters (a-z) and hyphens (-)`
|
|
1134
|
+
});
|
|
1135
|
+
};
|
|
1136
|
+
var makeLabelSetVersionSchema = (valueLabel) => {
|
|
1137
|
+
return import_v43.default.coerce.number({ error: `${valueLabel} must be an integer.` }).pipe(makeNonNegativeIntegerSchema(valueLabel));
|
|
1138
|
+
};
|
|
1139
|
+
var makeFullyPinnedLabelSetSchema = (valueLabel = "Label set") => {
|
|
1140
|
+
let valueLabelLabelSetId = valueLabel;
|
|
1141
|
+
let valueLabelLabelSetVersion = valueLabel;
|
|
1142
|
+
if (valueLabel === "LABEL_SET") {
|
|
1143
|
+
valueLabelLabelSetId = "LABEL_SET_ID";
|
|
1144
|
+
valueLabelLabelSetVersion = "LABEL_SET_VERSION";
|
|
1145
|
+
} else {
|
|
1146
|
+
valueLabelLabelSetId = `${valueLabel}.labelSetId`;
|
|
1147
|
+
valueLabelLabelSetVersion = `${valueLabel}.labelSetVersion`;
|
|
1148
|
+
}
|
|
1149
|
+
return import_v43.default.object({
|
|
1150
|
+
labelSetId: makeLabelSetIdSchema(valueLabelLabelSetId),
|
|
1151
|
+
labelSetVersion: makeLabelSetVersionSchema(valueLabelLabelSetVersion)
|
|
1152
|
+
});
|
|
1153
|
+
};
|
|
1154
|
+
var makeNonEmptyStringSchema = (valueLabel = "Value") => import_v43.default.string().nonempty({ error: `${valueLabel} must be a non-empty string.` });
|
|
1155
|
+
var makeENSIndexerVersionInfoSchema = (valueLabel = "Value") => import_v43.default.strictObject(
|
|
1156
|
+
{
|
|
1157
|
+
nodejs: makeNonEmptyStringSchema(),
|
|
1158
|
+
ponder: makeNonEmptyStringSchema(),
|
|
1159
|
+
ensDb: makeNonEmptyStringSchema(),
|
|
1160
|
+
ensIndexer: makeNonEmptyStringSchema(),
|
|
1161
|
+
ensNormalize: makeNonEmptyStringSchema(),
|
|
1162
|
+
ensRainbow: makeNonEmptyStringSchema(),
|
|
1163
|
+
ensRainbowSchema: makePositiveIntegerSchema()
|
|
1164
|
+
},
|
|
1165
|
+
{
|
|
1166
|
+
error: `${valueLabel} must be a valid ENSIndexerVersionInfo object.`
|
|
1167
|
+
}
|
|
1168
|
+
).check(invariant_ensDbVersionIsSameAsEnsIndexerVersion);
|
|
1169
|
+
function invariant_isSubgraphCompatibleRequirements(ctx) {
|
|
1170
|
+
const { value: config } = ctx;
|
|
1171
|
+
if (config.isSubgraphCompatible && !isSubgraphCompatible(config)) {
|
|
1172
|
+
ctx.issues.push({
|
|
1173
|
+
code: "custom",
|
|
1174
|
+
input: config,
|
|
1175
|
+
message: `'isSubgraphCompatible' requires only the '${"subgraph" /* Subgraph */}' plugin to be active and labelSet must be {labelSetId: "subgraph", labelSetVersion: 0}`
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
var makeENSIndexerPublicConfigSchema = (valueLabel = "ENSIndexerPublicConfig") => import_v43.default.object({
|
|
1180
|
+
labelSet: makeFullyPinnedLabelSetSchema(`${valueLabel}.labelSet`),
|
|
1181
|
+
indexedChainIds: makeIndexedChainIdsSchema(`${valueLabel}.indexedChainIds`),
|
|
1182
|
+
isSubgraphCompatible: import_v43.default.boolean({ error: `${valueLabel}.isSubgraphCompatible` }),
|
|
1183
|
+
namespace: makeENSNamespaceIdSchema(`${valueLabel}.namespace`),
|
|
1184
|
+
plugins: makePluginsListSchema(`${valueLabel}.plugins`),
|
|
1185
|
+
databaseSchemaName: makeDatabaseSchemaNameSchema(`${valueLabel}.databaseSchemaName`),
|
|
1186
|
+
versionInfo: makeENSIndexerVersionInfoSchema(`${valueLabel}.versionInfo`)
|
|
1187
|
+
}).check(invariant_isSubgraphCompatibleRequirements);
|
|
1188
|
+
|
|
1189
|
+
// src/ensapi/config/zod-schemas.ts
|
|
1190
|
+
var TheGraphCannotFallbackReasonSchema = import_v44.z.enum({
|
|
1191
|
+
NotSubgraphCompatible: "not-subgraph-compatible",
|
|
1192
|
+
NoApiKey: "no-api-key",
|
|
1193
|
+
NoSubgraphUrl: "no-subgraph-url"
|
|
1194
|
+
});
|
|
1195
|
+
var TheGraphFallbackSchema = import_v44.z.strictObject({
|
|
1196
|
+
canFallback: import_v44.z.boolean(),
|
|
1197
|
+
reason: TheGraphCannotFallbackReasonSchema.nullable()
|
|
1198
|
+
});
|
|
1199
|
+
function makeENSApiPublicConfigSchema(valueLabel) {
|
|
1200
|
+
const label = valueLabel ?? "ENSApiPublicConfig";
|
|
1201
|
+
return import_v44.z.strictObject({
|
|
1202
|
+
version: import_v44.z.string().min(1, `${label}.version must be a non-empty string`),
|
|
1203
|
+
theGraphFallback: TheGraphFallbackSchema,
|
|
1204
|
+
ensIndexerPublicConfig: makeENSIndexerPublicConfigSchema(`${label}.ensIndexerPublicConfig`)
|
|
1205
|
+
});
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
// src/ensapi/config/deserialize.ts
|
|
1209
|
+
function deserializeENSApiPublicConfig(maybeConfig, valueLabel) {
|
|
1210
|
+
const schema = makeENSApiPublicConfigSchema(valueLabel);
|
|
1211
|
+
try {
|
|
1212
|
+
return schema.parse(maybeConfig);
|
|
1213
|
+
} catch (error) {
|
|
1214
|
+
if (error instanceof import_v45.ZodError) {
|
|
1215
|
+
throw new Error(`Cannot deserialize ENSApiPublicConfig:
|
|
1216
|
+
${(0, import_v45.prettifyError)(error)}
|
|
1217
|
+
`);
|
|
1218
|
+
}
|
|
1219
|
+
throw error;
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
// src/ensindexer/config/deserialize.ts
|
|
1224
|
+
var import_v46 = require("zod/v4");
|
|
1225
|
+
function deserializeENSIndexerPublicConfig(maybeConfig, valueLabel) {
|
|
1226
|
+
const schema = makeENSIndexerPublicConfigSchema(valueLabel);
|
|
1227
|
+
const parsed = schema.safeParse(maybeConfig);
|
|
1228
|
+
if (parsed.error) {
|
|
1229
|
+
throw new Error(`Cannot deserialize ENSIndexerPublicConfig:
|
|
1230
|
+
${(0, import_v46.prettifyError)(parsed.error)}
|
|
1231
|
+
`);
|
|
1232
|
+
}
|
|
1233
|
+
return parsed.data;
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
// src/ensindexer/config/label-utils.ts
|
|
1237
|
+
var import_viem10 = require("viem");
|
|
1238
|
+
function labelHashToBytes(labelHash) {
|
|
1239
|
+
try {
|
|
1240
|
+
if (labelHash.length !== 66) {
|
|
1241
|
+
throw new Error(`Invalid labelHash length ${labelHash.length} characters (expected 66)`);
|
|
1242
|
+
}
|
|
1243
|
+
if (labelHash !== labelHash.toLowerCase()) {
|
|
1244
|
+
throw new Error("Labelhash must be in lowercase");
|
|
1245
|
+
}
|
|
1246
|
+
if (!labelHash.startsWith("0x")) {
|
|
1247
|
+
throw new Error("Labelhash must be 0x-prefixed");
|
|
1248
|
+
}
|
|
1249
|
+
const bytes = (0, import_viem10.hexToBytes)(labelHash);
|
|
1250
|
+
if (bytes.length !== 32) {
|
|
1251
|
+
throw new Error(`Invalid labelHash length ${bytes.length} bytes (expected 32)`);
|
|
1252
|
+
}
|
|
1253
|
+
return bytes;
|
|
1254
|
+
} catch (e) {
|
|
1255
|
+
if (e instanceof Error) {
|
|
1256
|
+
throw e;
|
|
1257
|
+
}
|
|
1258
|
+
throw new Error("Invalid hex format");
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
// src/ensindexer/config/labelset-utils.ts
|
|
1263
|
+
function buildLabelSetId(maybeLabelSetId) {
|
|
1264
|
+
return makeLabelSetIdSchema("LabelSetId").parse(maybeLabelSetId);
|
|
1265
|
+
}
|
|
1266
|
+
function buildLabelSetVersion(maybeLabelSetVersion) {
|
|
1267
|
+
return makeLabelSetVersionSchema("LabelSetVersion").parse(maybeLabelSetVersion);
|
|
1268
|
+
}
|
|
1269
|
+
function buildEnsRainbowClientLabelSet(labelSetId, labelSetVersion) {
|
|
1270
|
+
if (labelSetVersion !== void 0 && labelSetId === void 0) {
|
|
1271
|
+
throw new Error("When a labelSetVersion is defined, labelSetId must also be defined.");
|
|
1272
|
+
}
|
|
1273
|
+
return { labelSetId, labelSetVersion };
|
|
1274
|
+
}
|
|
1275
|
+
function validateSupportedLabelSetAndVersion(serverSet, clientSet) {
|
|
1276
|
+
if (clientSet.labelSetId === void 0) {
|
|
1277
|
+
return;
|
|
1278
|
+
}
|
|
1279
|
+
if (serverSet.labelSetId !== clientSet.labelSetId) {
|
|
1280
|
+
throw new Error(
|
|
1281
|
+
`Server label set ID "${serverSet.labelSetId}" does not match client's requested label set ID "${clientSet.labelSetId}".`
|
|
1282
|
+
);
|
|
1283
|
+
}
|
|
1284
|
+
if (clientSet.labelSetVersion !== void 0 && serverSet.highestLabelSetVersion < clientSet.labelSetVersion) {
|
|
1285
|
+
throw new Error(
|
|
1286
|
+
`Server highest label set version ${serverSet.highestLabelSetVersion} is less than client's requested version ${clientSet.labelSetVersion} for label set ID "${clientSet.labelSetId}".`
|
|
1287
|
+
);
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
// src/ensindexer/config/parsing.ts
|
|
1292
|
+
function parseNonNegativeInteger(maybeNumber) {
|
|
1293
|
+
const trimmed = maybeNumber.trim();
|
|
1294
|
+
if (!trimmed) {
|
|
1295
|
+
throw new Error("Input cannot be empty");
|
|
1296
|
+
}
|
|
1297
|
+
if (trimmed === "-0") {
|
|
1298
|
+
throw new Error("Negative zero is not a valid non-negative integer");
|
|
1299
|
+
}
|
|
1300
|
+
const num = Number(maybeNumber);
|
|
1301
|
+
if (Number.isNaN(num)) {
|
|
1302
|
+
throw new Error(`"${maybeNumber}" is not a valid number`);
|
|
1303
|
+
}
|
|
1304
|
+
if (!Number.isFinite(num)) {
|
|
1305
|
+
throw new Error(`"${maybeNumber}" is not a finite number`);
|
|
1306
|
+
}
|
|
1307
|
+
if (!Number.isInteger(num)) {
|
|
1308
|
+
throw new Error(`"${maybeNumber}" is not an integer`);
|
|
1309
|
+
}
|
|
1310
|
+
if (num < 0) {
|
|
1311
|
+
throw new Error(`"${maybeNumber}" is not a non-negative integer`);
|
|
1312
|
+
}
|
|
1313
|
+
return num;
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
// src/ensindexer/config/serialize.ts
|
|
1317
|
+
function serializeIndexedChainIds(indexedChainIds) {
|
|
1318
|
+
return Array.from(indexedChainIds);
|
|
1319
|
+
}
|
|
1320
|
+
function serializeENSIndexerPublicConfig(config) {
|
|
1321
|
+
const {
|
|
1322
|
+
labelSet,
|
|
1323
|
+
indexedChainIds,
|
|
1324
|
+
databaseSchemaName,
|
|
1325
|
+
isSubgraphCompatible: isSubgraphCompatible2,
|
|
1326
|
+
namespace,
|
|
1327
|
+
plugins,
|
|
1328
|
+
versionInfo
|
|
1329
|
+
} = config;
|
|
1330
|
+
return {
|
|
1331
|
+
labelSet,
|
|
1332
|
+
indexedChainIds: serializeIndexedChainIds(indexedChainIds),
|
|
1333
|
+
databaseSchemaName,
|
|
1334
|
+
isSubgraphCompatible: isSubgraphCompatible2,
|
|
1335
|
+
namespace,
|
|
1336
|
+
plugins,
|
|
1337
|
+
versionInfo
|
|
1338
|
+
};
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
// src/ensindexer/indexing-status/deserialize.ts
|
|
1342
|
+
var import_v48 = require("zod/v4");
|
|
1343
|
+
|
|
1344
|
+
// src/ensindexer/indexing-status/zod-schemas.ts
|
|
1345
|
+
var import_v47 = __toESM(require("zod/v4"), 1);
|
|
1346
|
+
|
|
1068
1347
|
// src/ensindexer/indexing-status/types.ts
|
|
1069
1348
|
var ChainIndexingConfigTypeIds = {
|
|
1070
1349
|
/**
|
|
@@ -1519,52 +1798,52 @@ function invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect(ct
|
|
|
1519
1798
|
}
|
|
1520
1799
|
|
|
1521
1800
|
// src/ensindexer/indexing-status/zod-schemas.ts
|
|
1522
|
-
var makeChainIndexingConfigSchema = (valueLabel = "Value") =>
|
|
1523
|
-
|
|
1524
|
-
configType:
|
|
1801
|
+
var makeChainIndexingConfigSchema = (valueLabel = "Value") => import_v47.default.discriminatedUnion("configType", [
|
|
1802
|
+
import_v47.default.strictObject({
|
|
1803
|
+
configType: import_v47.default.literal(ChainIndexingConfigTypeIds.Indefinite),
|
|
1525
1804
|
startBlock: makeBlockRefSchema(valueLabel)
|
|
1526
1805
|
}),
|
|
1527
|
-
|
|
1528
|
-
configType:
|
|
1806
|
+
import_v47.default.strictObject({
|
|
1807
|
+
configType: import_v47.default.literal(ChainIndexingConfigTypeIds.Definite),
|
|
1529
1808
|
startBlock: makeBlockRefSchema(valueLabel),
|
|
1530
1809
|
endBlock: makeBlockRefSchema(valueLabel)
|
|
1531
1810
|
})
|
|
1532
1811
|
]);
|
|
1533
|
-
var makeChainIndexingStatusSnapshotQueuedSchema = (valueLabel = "Value") =>
|
|
1534
|
-
chainStatus:
|
|
1812
|
+
var makeChainIndexingStatusSnapshotQueuedSchema = (valueLabel = "Value") => import_v47.default.strictObject({
|
|
1813
|
+
chainStatus: import_v47.default.literal(ChainIndexingStatusIds.Queued),
|
|
1535
1814
|
config: makeChainIndexingConfigSchema(valueLabel)
|
|
1536
1815
|
}).check(invariant_chainSnapshotQueuedBlocks);
|
|
1537
|
-
var makeChainIndexingStatusSnapshotBackfillSchema = (valueLabel = "Value") =>
|
|
1538
|
-
chainStatus:
|
|
1816
|
+
var makeChainIndexingStatusSnapshotBackfillSchema = (valueLabel = "Value") => import_v47.default.strictObject({
|
|
1817
|
+
chainStatus: import_v47.default.literal(ChainIndexingStatusIds.Backfill),
|
|
1539
1818
|
config: makeChainIndexingConfigSchema(valueLabel),
|
|
1540
1819
|
latestIndexedBlock: makeBlockRefSchema(valueLabel),
|
|
1541
1820
|
backfillEndBlock: makeBlockRefSchema(valueLabel)
|
|
1542
1821
|
}).check(invariant_chainSnapshotBackfillBlocks);
|
|
1543
|
-
var makeChainIndexingStatusSnapshotCompletedSchema = (valueLabel = "Value") =>
|
|
1544
|
-
chainStatus:
|
|
1545
|
-
config:
|
|
1546
|
-
configType:
|
|
1822
|
+
var makeChainIndexingStatusSnapshotCompletedSchema = (valueLabel = "Value") => import_v47.default.strictObject({
|
|
1823
|
+
chainStatus: import_v47.default.literal(ChainIndexingStatusIds.Completed),
|
|
1824
|
+
config: import_v47.default.strictObject({
|
|
1825
|
+
configType: import_v47.default.literal(ChainIndexingConfigTypeIds.Definite),
|
|
1547
1826
|
startBlock: makeBlockRefSchema(valueLabel),
|
|
1548
1827
|
endBlock: makeBlockRefSchema(valueLabel)
|
|
1549
1828
|
}),
|
|
1550
1829
|
latestIndexedBlock: makeBlockRefSchema(valueLabel)
|
|
1551
1830
|
}).check(invariant_chainSnapshotCompletedBlocks);
|
|
1552
|
-
var makeChainIndexingStatusSnapshotFollowingSchema = (valueLabel = "Value") =>
|
|
1553
|
-
chainStatus:
|
|
1554
|
-
config:
|
|
1555
|
-
configType:
|
|
1831
|
+
var makeChainIndexingStatusSnapshotFollowingSchema = (valueLabel = "Value") => import_v47.default.strictObject({
|
|
1832
|
+
chainStatus: import_v47.default.literal(ChainIndexingStatusIds.Following),
|
|
1833
|
+
config: import_v47.default.strictObject({
|
|
1834
|
+
configType: import_v47.default.literal(ChainIndexingConfigTypeIds.Indefinite),
|
|
1556
1835
|
startBlock: makeBlockRefSchema(valueLabel)
|
|
1557
1836
|
}),
|
|
1558
1837
|
latestIndexedBlock: makeBlockRefSchema(valueLabel),
|
|
1559
1838
|
latestKnownBlock: makeBlockRefSchema(valueLabel)
|
|
1560
1839
|
}).check(invariant_chainSnapshotFollowingBlocks);
|
|
1561
|
-
var makeChainIndexingStatusSnapshotSchema = (valueLabel = "Value") =>
|
|
1840
|
+
var makeChainIndexingStatusSnapshotSchema = (valueLabel = "Value") => import_v47.default.discriminatedUnion("chainStatus", [
|
|
1562
1841
|
makeChainIndexingStatusSnapshotQueuedSchema(valueLabel),
|
|
1563
1842
|
makeChainIndexingStatusSnapshotBackfillSchema(valueLabel),
|
|
1564
1843
|
makeChainIndexingStatusSnapshotCompletedSchema(valueLabel),
|
|
1565
1844
|
makeChainIndexingStatusSnapshotFollowingSchema(valueLabel)
|
|
1566
1845
|
]);
|
|
1567
|
-
var makeChainIndexingStatusesSchema = (valueLabel = "Value") =>
|
|
1846
|
+
var makeChainIndexingStatusesSchema = (valueLabel = "Value") => import_v47.default.record(makeChainIdStringSchema(), makeChainIndexingStatusSnapshotSchema(valueLabel), {
|
|
1568
1847
|
error: "Chains indexing statuses must be an object mapping valid chain IDs to their indexing status snapshots."
|
|
1569
1848
|
}).transform((serializedChainsIndexingStatus) => {
|
|
1570
1849
|
const chainsIndexingStatus = /* @__PURE__ */ new Map();
|
|
@@ -1573,29 +1852,29 @@ var makeChainIndexingStatusesSchema = (valueLabel = "Value") => import_v43.defau
|
|
|
1573
1852
|
}
|
|
1574
1853
|
return chainsIndexingStatus;
|
|
1575
1854
|
});
|
|
1576
|
-
var makeOmnichainIndexingStatusSnapshotUnstartedSchema = (valueLabel) =>
|
|
1577
|
-
omnichainStatus:
|
|
1855
|
+
var makeOmnichainIndexingStatusSnapshotUnstartedSchema = (valueLabel) => import_v47.default.strictObject({
|
|
1856
|
+
omnichainStatus: import_v47.default.literal(OmnichainIndexingStatusIds.Unstarted),
|
|
1578
1857
|
chains: makeChainIndexingStatusesSchema(valueLabel).check(invariant_omnichainSnapshotUnstartedHasValidChains).transform((chains) => chains),
|
|
1579
1858
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1580
1859
|
});
|
|
1581
|
-
var makeOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) =>
|
|
1582
|
-
omnichainStatus:
|
|
1860
|
+
var makeOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) => import_v47.default.strictObject({
|
|
1861
|
+
omnichainStatus: import_v47.default.literal(OmnichainIndexingStatusIds.Backfill),
|
|
1583
1862
|
chains: makeChainIndexingStatusesSchema(valueLabel).check(invariant_omnichainStatusSnapshotBackfillHasValidChains).transform(
|
|
1584
1863
|
(chains) => chains
|
|
1585
1864
|
),
|
|
1586
1865
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1587
1866
|
});
|
|
1588
|
-
var makeOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) =>
|
|
1589
|
-
omnichainStatus:
|
|
1867
|
+
var makeOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) => import_v47.default.strictObject({
|
|
1868
|
+
omnichainStatus: import_v47.default.literal(OmnichainIndexingStatusIds.Completed),
|
|
1590
1869
|
chains: makeChainIndexingStatusesSchema(valueLabel).check(invariant_omnichainStatusSnapshotCompletedHasValidChains).transform((chains) => chains),
|
|
1591
1870
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1592
1871
|
});
|
|
1593
|
-
var makeOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) =>
|
|
1594
|
-
omnichainStatus:
|
|
1872
|
+
var makeOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) => import_v47.default.strictObject({
|
|
1873
|
+
omnichainStatus: import_v47.default.literal(OmnichainIndexingStatusIds.Following),
|
|
1595
1874
|
chains: makeChainIndexingStatusesSchema(valueLabel),
|
|
1596
1875
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1597
1876
|
});
|
|
1598
|
-
var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexing Snapshot") =>
|
|
1877
|
+
var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexing Snapshot") => import_v47.default.discriminatedUnion("omnichainStatus", [
|
|
1599
1878
|
makeOmnichainIndexingStatusSnapshotUnstartedSchema(valueLabel),
|
|
1600
1879
|
makeOmnichainIndexingStatusSnapshotBackfillSchema(valueLabel),
|
|
1601
1880
|
makeOmnichainIndexingStatusSnapshotCompletedSchema(valueLabel),
|
|
@@ -1603,209 +1882,224 @@ var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexin
|
|
|
1603
1882
|
]).check(invariant_omnichainSnapshotStatusIsConsistentWithChainSnapshot).check(invariant_omnichainIndexingCursorLowerThanEarliestStartBlockAcrossQueuedChains).check(
|
|
1604
1883
|
invariant_omnichainIndexingCursorLowerThanOrEqualToLatestBackfillEndBlockAcrossBackfillChains
|
|
1605
1884
|
).check(invariant_omnichainIndexingCursorIsEqualToHighestLatestIndexedBlockAcrossIndexedChain);
|
|
1606
|
-
var makeCrossChainIndexingStatusSnapshotOmnichainSchema = (valueLabel = "Cross-chain Indexing Status Snapshot Omnichain") =>
|
|
1607
|
-
strategy:
|
|
1885
|
+
var makeCrossChainIndexingStatusSnapshotOmnichainSchema = (valueLabel = "Cross-chain Indexing Status Snapshot Omnichain") => import_v47.default.strictObject({
|
|
1886
|
+
strategy: import_v47.default.literal(CrossChainIndexingStrategyIds.Omnichain),
|
|
1608
1887
|
slowestChainIndexingCursor: makeUnixTimestampSchema(valueLabel),
|
|
1609
1888
|
snapshotTime: makeUnixTimestampSchema(valueLabel),
|
|
1610
1889
|
omnichainSnapshot: makeOmnichainIndexingStatusSnapshotSchema(valueLabel)
|
|
1611
1890
|
}).check(invariant_slowestChainEqualsToOmnichainSnapshotTime).check(invariant_snapshotTimeIsTheHighestKnownBlockTimestamp);
|
|
1612
|
-
var makeCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Cross-chain Indexing Status Snapshot") =>
|
|
1891
|
+
var makeCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Cross-chain Indexing Status Snapshot") => import_v47.default.discriminatedUnion("strategy", [
|
|
1613
1892
|
makeCrossChainIndexingStatusSnapshotOmnichainSchema(valueLabel)
|
|
1614
1893
|
]);
|
|
1615
|
-
var makeRealtimeIndexingStatusProjectionSchema = (valueLabel = "Realtime Indexing Status Projection") =>
|
|
1894
|
+
var makeRealtimeIndexingStatusProjectionSchema = (valueLabel = "Realtime Indexing Status Projection") => import_v47.default.strictObject({
|
|
1616
1895
|
projectedAt: makeUnixTimestampSchema(valueLabel),
|
|
1617
1896
|
worstCaseDistance: makeDurationSchema(valueLabel),
|
|
1618
1897
|
snapshot: makeCrossChainIndexingStatusSnapshotSchema(valueLabel)
|
|
1619
1898
|
}).check(invariant_realtimeIndexingStatusProjectionProjectedAtIsAfterOrEqualToSnapshotTime).check(invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect);
|
|
1620
1899
|
|
|
1621
|
-
// src/ensindexer/
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
PluginName2["Lineanames"] = "lineanames";
|
|
1632
|
-
PluginName2["ThreeDNS"] = "threedns";
|
|
1633
|
-
PluginName2["ProtocolAcceleration"] = "protocol-acceleration";
|
|
1634
|
-
PluginName2["Registrars"] = "registrars";
|
|
1635
|
-
PluginName2["TokenScope"] = "tokenscope";
|
|
1636
|
-
return PluginName2;
|
|
1637
|
-
})(PluginName || {});
|
|
1638
|
-
|
|
1639
|
-
// src/ensindexer/config/is-subgraph-compatible.ts
|
|
1640
|
-
function isSubgraphCompatible(config) {
|
|
1641
|
-
const onlySubgraphPluginActivated = config.plugins.length === 1 && config.plugins[0] === "subgraph" /* Subgraph */;
|
|
1642
|
-
const isSubgraphLabelSet = config.labelSet.labelSetId === "subgraph" && config.labelSet.labelSetVersion === 0;
|
|
1643
|
-
const isEnsTestEnvLabelSet = config.labelSet.labelSetId === "ens-test-env" && config.labelSet.labelSetVersion === 0;
|
|
1644
|
-
const labelSetIsSubgraphCompatible = isSubgraphLabelSet || config.namespace === import_datasources3.ENSNamespaceIds.EnsTestEnv && isEnsTestEnvLabelSet;
|
|
1645
|
-
return onlySubgraphPluginActivated && labelSetIsSubgraphCompatible;
|
|
1646
|
-
}
|
|
1647
|
-
|
|
1648
|
-
// src/ensindexer/config/validations.ts
|
|
1649
|
-
function invariant_ensDbVersionIsSameAsEnsIndexerVersion(ctx) {
|
|
1650
|
-
const versionInfo = ctx.value;
|
|
1651
|
-
if (versionInfo.ensDb !== versionInfo.ensIndexer) {
|
|
1652
|
-
ctx.issues.push({
|
|
1653
|
-
code: "custom",
|
|
1654
|
-
input: versionInfo,
|
|
1655
|
-
message: "`ensDb` version must be same as `ensIndexer` version"
|
|
1656
|
-
});
|
|
1900
|
+
// src/ensindexer/indexing-status/deserialize.ts
|
|
1901
|
+
function deserializeChainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
1902
|
+
const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
|
|
1903
|
+
const parsed = schema.safeParse(maybeSnapshot);
|
|
1904
|
+
if (parsed.error) {
|
|
1905
|
+
throw new Error(
|
|
1906
|
+
`Cannot deserialize into ChainIndexingStatusSnapshot:
|
|
1907
|
+
${(0, import_v48.prettifyError)(parsed.error)}
|
|
1908
|
+
`
|
|
1909
|
+
);
|
|
1657
1910
|
}
|
|
1911
|
+
return parsed.data;
|
|
1658
1912
|
}
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
error
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
}).refine((arr) => arr.length === uniq(arr).length, {
|
|
1669
|
-
error: `${valueLabel} cannot contain duplicate values.`
|
|
1670
|
-
});
|
|
1671
|
-
var makeDatabaseSchemaNameSchema = (valueLabel = "Database schema name") => import_v44.default.string({ error: `${valueLabel} must be a string` }).trim().nonempty({
|
|
1672
|
-
error: `${valueLabel} is required and must be a non-empty string.`
|
|
1673
|
-
});
|
|
1674
|
-
var makeLabelSetIdSchema = (valueLabel) => {
|
|
1675
|
-
return import_v44.default.string({ error: `${valueLabel} must be a string` }).min(1, { error: `${valueLabel} must be 1-50 characters long` }).max(50, { error: `${valueLabel} must be 1-50 characters long` }).regex(/^[a-z-]+$/, {
|
|
1676
|
-
error: `${valueLabel} can only contain lowercase letters (a-z) and hyphens (-)`
|
|
1677
|
-
});
|
|
1678
|
-
};
|
|
1679
|
-
var makeLabelSetVersionSchema = (valueLabel) => {
|
|
1680
|
-
return import_v44.default.coerce.number({ error: `${valueLabel} must be an integer.` }).pipe(makeNonNegativeIntegerSchema(valueLabel));
|
|
1681
|
-
};
|
|
1682
|
-
var makeFullyPinnedLabelSetSchema = (valueLabel = "Label set") => {
|
|
1683
|
-
let valueLabelLabelSetId = valueLabel;
|
|
1684
|
-
let valueLabelLabelSetVersion = valueLabel;
|
|
1685
|
-
if (valueLabel === "LABEL_SET") {
|
|
1686
|
-
valueLabelLabelSetId = "LABEL_SET_ID";
|
|
1687
|
-
valueLabelLabelSetVersion = "LABEL_SET_VERSION";
|
|
1688
|
-
} else {
|
|
1689
|
-
valueLabelLabelSetId = `${valueLabel}.labelSetId`;
|
|
1690
|
-
valueLabelLabelSetVersion = `${valueLabel}.labelSetVersion`;
|
|
1913
|
+
function deserializeOmnichainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
1914
|
+
const schema = makeOmnichainIndexingStatusSnapshotSchema(valueLabel);
|
|
1915
|
+
const parsed = schema.safeParse(maybeSnapshot);
|
|
1916
|
+
if (parsed.error) {
|
|
1917
|
+
throw new Error(
|
|
1918
|
+
`Cannot deserialize into OmnichainIndexingStatusSnapshot:
|
|
1919
|
+
${(0, import_v48.prettifyError)(parsed.error)}
|
|
1920
|
+
`
|
|
1921
|
+
);
|
|
1691
1922
|
}
|
|
1692
|
-
return
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
ensIndexer: makeNonEmptyStringSchema(),
|
|
1704
|
-
ensNormalize: makeNonEmptyStringSchema(),
|
|
1705
|
-
ensRainbow: makeNonEmptyStringSchema(),
|
|
1706
|
-
ensRainbowSchema: makePositiveIntegerSchema()
|
|
1707
|
-
},
|
|
1708
|
-
{
|
|
1709
|
-
error: `${valueLabel} must be a valid ENSIndexerVersionInfo object.`
|
|
1923
|
+
return parsed.data;
|
|
1924
|
+
}
|
|
1925
|
+
function deserializeCrossChainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
1926
|
+
const schema = makeCrossChainIndexingStatusSnapshotSchema(valueLabel);
|
|
1927
|
+
const parsed = schema.safeParse(maybeSnapshot);
|
|
1928
|
+
if (parsed.error) {
|
|
1929
|
+
throw new Error(
|
|
1930
|
+
`Cannot deserialize into CrossChainIndexingStatusSnapshot:
|
|
1931
|
+
${(0, import_v48.prettifyError)(parsed.error)}
|
|
1932
|
+
`
|
|
1933
|
+
);
|
|
1710
1934
|
}
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1935
|
+
return parsed.data;
|
|
1936
|
+
}
|
|
1937
|
+
function deserializeRealtimeIndexingStatusProjection(maybeProjection, valueLabel) {
|
|
1938
|
+
const schema = makeRealtimeIndexingStatusProjectionSchema(valueLabel);
|
|
1939
|
+
const parsed = schema.safeParse(maybeProjection);
|
|
1940
|
+
if (parsed.error) {
|
|
1941
|
+
throw new Error(
|
|
1942
|
+
`Cannot deserialize into RealtimeIndexingStatusProjection:
|
|
1943
|
+
${(0, import_v48.prettifyError)(parsed.error)}
|
|
1944
|
+
`
|
|
1945
|
+
);
|
|
1720
1946
|
}
|
|
1947
|
+
return parsed.data;
|
|
1721
1948
|
}
|
|
1722
|
-
var makeENSIndexerPublicConfigSchema = (valueLabel = "ENSIndexerPublicConfig") => import_v44.default.object({
|
|
1723
|
-
labelSet: makeFullyPinnedLabelSetSchema(`${valueLabel}.labelSet`),
|
|
1724
|
-
indexedChainIds: makeIndexedChainIdsSchema(`${valueLabel}.indexedChainIds`),
|
|
1725
|
-
isSubgraphCompatible: import_v44.default.boolean({ error: `${valueLabel}.isSubgraphCompatible` }),
|
|
1726
|
-
namespace: makeENSNamespaceIdSchema(`${valueLabel}.namespace`),
|
|
1727
|
-
plugins: makePluginsListSchema(`${valueLabel}.plugins`),
|
|
1728
|
-
databaseSchemaName: makeDatabaseSchemaNameSchema(`${valueLabel}.databaseSchemaName`),
|
|
1729
|
-
versionInfo: makeENSIndexerVersionInfoSchema(`${valueLabel}.versionInfo`)
|
|
1730
|
-
}).check(invariant_isSubgraphCompatibleRequirements);
|
|
1731
|
-
|
|
1732
|
-
// src/shared/config/build-rpc-urls.ts
|
|
1733
|
-
var import_chains = require("viem/chains");
|
|
1734
1949
|
|
|
1735
|
-
// src/
|
|
1736
|
-
|
|
1950
|
+
// src/ensindexer/indexing-status/projection.ts
|
|
1951
|
+
function createRealtimeIndexingStatusProjection(snapshot, now) {
|
|
1952
|
+
const projectedAt = Math.max(now, snapshot.snapshotTime);
|
|
1953
|
+
return {
|
|
1954
|
+
projectedAt,
|
|
1955
|
+
worstCaseDistance: projectedAt - snapshot.slowestChainIndexingCursor,
|
|
1956
|
+
snapshot
|
|
1957
|
+
};
|
|
1958
|
+
}
|
|
1737
1959
|
|
|
1738
|
-
// src/
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1960
|
+
// src/ensindexer/indexing-status/serialize.ts
|
|
1961
|
+
function serializeCrossChainIndexingStatusSnapshotOmnichain({
|
|
1962
|
+
strategy,
|
|
1963
|
+
slowestChainIndexingCursor,
|
|
1964
|
+
snapshotTime,
|
|
1965
|
+
omnichainSnapshot
|
|
1966
|
+
}) {
|
|
1967
|
+
return {
|
|
1968
|
+
strategy,
|
|
1969
|
+
slowestChainIndexingCursor,
|
|
1970
|
+
snapshotTime,
|
|
1971
|
+
omnichainSnapshot: serializeOmnichainIndexingStatusSnapshot(omnichainSnapshot)
|
|
1972
|
+
};
|
|
1973
|
+
}
|
|
1974
|
+
function serializeRealtimeIndexingStatusProjection(indexingProjection) {
|
|
1975
|
+
return {
|
|
1976
|
+
projectedAt: indexingProjection.projectedAt,
|
|
1977
|
+
worstCaseDistance: indexingProjection.worstCaseDistance,
|
|
1978
|
+
snapshot: serializeCrossChainIndexingStatusSnapshotOmnichain(indexingProjection.snapshot)
|
|
1979
|
+
};
|
|
1980
|
+
}
|
|
1981
|
+
function serializeChainIndexingSnapshots(chains) {
|
|
1982
|
+
const serializedSnapshots = {};
|
|
1983
|
+
for (const [chainId, snapshot] of chains.entries()) {
|
|
1984
|
+
serializedSnapshots[serializeChainId(chainId)] = snapshot;
|
|
1749
1985
|
}
|
|
1986
|
+
return serializedSnapshots;
|
|
1750
1987
|
}
|
|
1751
|
-
function
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1988
|
+
function serializeOmnichainIndexingStatusSnapshot(indexingStatus) {
|
|
1989
|
+
switch (indexingStatus.omnichainStatus) {
|
|
1990
|
+
case OmnichainIndexingStatusIds.Unstarted:
|
|
1991
|
+
return {
|
|
1992
|
+
omnichainStatus: OmnichainIndexingStatusIds.Unstarted,
|
|
1993
|
+
chains: serializeChainIndexingSnapshots(indexingStatus.chains),
|
|
1994
|
+
omnichainIndexingCursor: indexingStatus.omnichainIndexingCursor
|
|
1995
|
+
};
|
|
1996
|
+
case OmnichainIndexingStatusIds.Backfill:
|
|
1997
|
+
return {
|
|
1998
|
+
omnichainStatus: OmnichainIndexingStatusIds.Backfill,
|
|
1999
|
+
chains: serializeChainIndexingSnapshots(indexingStatus.chains),
|
|
2000
|
+
omnichainIndexingCursor: indexingStatus.omnichainIndexingCursor
|
|
2001
|
+
};
|
|
2002
|
+
case OmnichainIndexingStatusIds.Completed: {
|
|
2003
|
+
return {
|
|
2004
|
+
omnichainStatus: OmnichainIndexingStatusIds.Completed,
|
|
2005
|
+
chains: serializeChainIndexingSnapshots(indexingStatus.chains),
|
|
2006
|
+
omnichainIndexingCursor: indexingStatus.omnichainIndexingCursor
|
|
2007
|
+
};
|
|
2008
|
+
}
|
|
2009
|
+
case OmnichainIndexingStatusIds.Following:
|
|
2010
|
+
return {
|
|
2011
|
+
omnichainStatus: OmnichainIndexingStatusIds.Following,
|
|
2012
|
+
chains: serializeChainIndexingSnapshots(indexingStatus.chains),
|
|
2013
|
+
omnichainIndexingCursor: indexingStatus.omnichainIndexingCursor
|
|
2014
|
+
};
|
|
1760
2015
|
}
|
|
1761
2016
|
}
|
|
1762
2017
|
|
|
1763
|
-
// src/
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
2018
|
+
// src/ensapi/config/serialize.ts
|
|
2019
|
+
function serializeENSApiPublicConfig(config) {
|
|
2020
|
+
const { version, theGraphFallback, ensIndexerPublicConfig } = config;
|
|
2021
|
+
return {
|
|
2022
|
+
version,
|
|
2023
|
+
theGraphFallback,
|
|
2024
|
+
ensIndexerPublicConfig: serializeENSIndexerPublicConfig(ensIndexerPublicConfig)
|
|
2025
|
+
};
|
|
2026
|
+
}
|
|
2027
|
+
|
|
2028
|
+
// src/api/config/deserialize.ts
|
|
2029
|
+
function deserializeConfigResponse(serializedResponse) {
|
|
2030
|
+
return deserializeENSApiPublicConfig(serializedResponse);
|
|
2031
|
+
}
|
|
2032
|
+
|
|
2033
|
+
// src/api/config/serialize.ts
|
|
2034
|
+
function serializeConfigResponse(response) {
|
|
2035
|
+
return serializeENSApiPublicConfig(response);
|
|
2036
|
+
}
|
|
2037
|
+
|
|
2038
|
+
// src/api/indexing-status/deserialize.ts
|
|
2039
|
+
var import_v416 = require("zod/v4");
|
|
2040
|
+
|
|
2041
|
+
// src/api/indexing-status/zod-schemas.ts
|
|
2042
|
+
var import_v415 = __toESM(require("zod/v4"), 1);
|
|
2043
|
+
|
|
2044
|
+
// src/api/registrar-actions/zod-schemas.ts
|
|
2045
|
+
var import_ens5 = require("viem/ens");
|
|
2046
|
+
var import_v410 = __toESM(require("zod/v4"), 1);
|
|
2047
|
+
|
|
2048
|
+
// src/api/shared/errors/zod-schemas.ts
|
|
2049
|
+
var import_v49 = __toESM(require("zod/v4"), 1);
|
|
2050
|
+
var ErrorResponseSchema = import_v49.default.object({
|
|
2051
|
+
message: import_v49.default.string(),
|
|
2052
|
+
details: import_v49.default.optional(import_v49.default.unknown())
|
|
1770
2053
|
});
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
2054
|
+
|
|
2055
|
+
// src/api/registrar-actions/response.ts
|
|
2056
|
+
var RegistrarActionsResponseCodes = {
|
|
2057
|
+
/**
|
|
2058
|
+
* Represents that Registrar Actions are available.
|
|
2059
|
+
*/
|
|
2060
|
+
Ok: "ok",
|
|
2061
|
+
/**
|
|
2062
|
+
* Represents that Registrar Actions are unavailable.
|
|
2063
|
+
*/
|
|
2064
|
+
Error: "error"
|
|
2065
|
+
};
|
|
2066
|
+
|
|
2067
|
+
// src/api/registrar-actions/zod-schemas.ts
|
|
2068
|
+
function invariant_registrationLifecycleNodeMatchesName(ctx) {
|
|
2069
|
+
const { name, action } = ctx.value;
|
|
2070
|
+
const expectedNode = action.registrationLifecycle.node;
|
|
2071
|
+
const actualNode = (0, import_ens5.namehash)(name);
|
|
2072
|
+
if (actualNode !== expectedNode) {
|
|
2073
|
+
ctx.issues.push({
|
|
2074
|
+
code: "custom",
|
|
2075
|
+
input: ctx.value,
|
|
2076
|
+
message: `The 'action.registrationLifecycle.node' must match namehash of 'name'`
|
|
1782
2077
|
});
|
|
1783
2078
|
}
|
|
1784
|
-
|
|
2079
|
+
}
|
|
2080
|
+
var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") => import_v410.default.object({
|
|
2081
|
+
action: makeRegistrarActionSchema(valueLabel),
|
|
2082
|
+
name: makeReinterpretedNameSchema(valueLabel)
|
|
2083
|
+
}).check(invariant_registrationLifecycleNodeMatchesName);
|
|
2084
|
+
var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") => import_v410.default.strictObject({
|
|
2085
|
+
responseCode: import_v410.default.literal(RegistrarActionsResponseCodes.Ok),
|
|
2086
|
+
registrarActions: import_v410.default.array(makeNamedRegistrarActionSchema(valueLabel))
|
|
1785
2087
|
});
|
|
1786
|
-
var
|
|
1787
|
-
|
|
1788
|
-
error:
|
|
2088
|
+
var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") => import_v410.default.strictObject({
|
|
2089
|
+
responseCode: import_v410.default.literal(RegistrarActionsResponseCodes.Error),
|
|
2090
|
+
error: ErrorResponseSchema
|
|
1789
2091
|
});
|
|
1790
|
-
var
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
var import_datasources7 = require("@ensnode/datasources");
|
|
1795
|
-
var DATASOURCE_NAMES_WITH_RESOLVERS = [
|
|
1796
|
-
import_datasources7.DatasourceNames.ENSRoot,
|
|
1797
|
-
import_datasources7.DatasourceNames.Basenames,
|
|
1798
|
-
import_datasources7.DatasourceNames.Lineanames,
|
|
1799
|
-
import_datasources7.DatasourceNames.ThreeDNSOptimism,
|
|
1800
|
-
import_datasources7.DatasourceNames.ThreeDNSBase
|
|
1801
|
-
];
|
|
2092
|
+
var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") => import_v410.default.discriminatedUnion("responseCode", [
|
|
2093
|
+
makeRegistrarActionsResponseOkSchema(valueLabel),
|
|
2094
|
+
makeRegistrarActionsResponseErrorSchema(valueLabel)
|
|
2095
|
+
]);
|
|
1802
2096
|
|
|
1803
|
-
// src/shared/
|
|
1804
|
-
var
|
|
1805
|
-
var LogLevelSchema = import_v46.z.enum(["fatal", "error", "warn", "info", "debug", "trace", "silent"]);
|
|
2097
|
+
// src/api/shared/pagination/zod-schemas.ts
|
|
2098
|
+
var import_v411 = __toESM(require("zod/v4"), 1);
|
|
1806
2099
|
|
|
1807
|
-
// src/shared/
|
|
1808
|
-
var
|
|
2100
|
+
// src/api/shared/pagination/request.ts
|
|
2101
|
+
var RECORDS_PER_PAGE_DEFAULT = 10;
|
|
2102
|
+
var RECORDS_PER_PAGE_MAX = 100;
|
|
1809
2103
|
|
|
1810
2104
|
// ../ens-referrals/src/address.ts
|
|
1811
2105
|
var import_viem11 = require("viem");
|
|
@@ -1846,8 +2140,20 @@ var REFERRERS_PER_LEADERBOARD_PAGE_MAX = 100;
|
|
|
1846
2140
|
// ../ens-referrals/src/link.ts
|
|
1847
2141
|
var import_viem13 = require("viem");
|
|
1848
2142
|
|
|
2143
|
+
// ../ens-referrals/src/referrer-detail.ts
|
|
2144
|
+
var ReferrerDetailTypeIds = {
|
|
2145
|
+
/**
|
|
2146
|
+
* Represents a referrer who is ranked on the leaderboard.
|
|
2147
|
+
*/
|
|
2148
|
+
Ranked: "ranked",
|
|
2149
|
+
/**
|
|
2150
|
+
* Represents a referrer who is not ranked on the leaderboard.
|
|
2151
|
+
*/
|
|
2152
|
+
Unranked: "unranked"
|
|
2153
|
+
};
|
|
2154
|
+
|
|
1849
2155
|
// src/registrars/zod-schemas.ts
|
|
1850
|
-
var
|
|
2156
|
+
var import_v412 = __toESM(require("zod/v4"), 1);
|
|
1851
2157
|
|
|
1852
2158
|
// src/registrars/subregistry.ts
|
|
1853
2159
|
function serializeSubregistry(subregistry) {
|
|
@@ -1905,11 +2211,11 @@ function serializeRegistrarAction(registrarAction) {
|
|
|
1905
2211
|
}
|
|
1906
2212
|
|
|
1907
2213
|
// src/registrars/zod-schemas.ts
|
|
1908
|
-
var makeSubregistrySchema = (valueLabel = "Subregistry") =>
|
|
2214
|
+
var makeSubregistrySchema = (valueLabel = "Subregistry") => import_v412.default.object({
|
|
1909
2215
|
subregistryId: makeSerializedAccountIdSchema(`${valueLabel} Subregistry ID`),
|
|
1910
2216
|
node: makeNodeSchema(`${valueLabel} Node`)
|
|
1911
2217
|
});
|
|
1912
|
-
var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") =>
|
|
2218
|
+
var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") => import_v412.default.object({
|
|
1913
2219
|
subregistry: makeSubregistrySchema(`${valueLabel} Subregistry`),
|
|
1914
2220
|
node: makeNodeSchema(`${valueLabel} Node`),
|
|
1915
2221
|
expiresAt: makeUnixTimestampSchema(`${valueLabel} Expires at`)
|
|
@@ -1925,18 +2231,18 @@ function invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium(ctx) {
|
|
|
1925
2231
|
});
|
|
1926
2232
|
}
|
|
1927
2233
|
}
|
|
1928
|
-
var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") =>
|
|
2234
|
+
var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") => import_v412.default.union([
|
|
1929
2235
|
// pricing available
|
|
1930
|
-
|
|
2236
|
+
import_v412.default.object({
|
|
1931
2237
|
baseCost: makePriceEthSchema(`${valueLabel} Base Cost`),
|
|
1932
2238
|
premium: makePriceEthSchema(`${valueLabel} Premium`),
|
|
1933
2239
|
total: makePriceEthSchema(`${valueLabel} Total`)
|
|
1934
2240
|
}).check(invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium).transform((v) => v),
|
|
1935
2241
|
// pricing unknown
|
|
1936
|
-
|
|
1937
|
-
baseCost:
|
|
1938
|
-
premium:
|
|
1939
|
-
total:
|
|
2242
|
+
import_v412.default.object({
|
|
2243
|
+
baseCost: import_v412.default.null(),
|
|
2244
|
+
premium: import_v412.default.null(),
|
|
2245
|
+
total: import_v412.default.null()
|
|
1940
2246
|
}).transform((v) => v)
|
|
1941
2247
|
]);
|
|
1942
2248
|
function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
|
|
@@ -1959,9 +2265,9 @@ function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
|
|
|
1959
2265
|
});
|
|
1960
2266
|
}
|
|
1961
2267
|
}
|
|
1962
|
-
var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") =>
|
|
2268
|
+
var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") => import_v412.default.union([
|
|
1963
2269
|
// referral available
|
|
1964
|
-
|
|
2270
|
+
import_v412.default.object({
|
|
1965
2271
|
encodedReferrer: makeHexStringSchema(
|
|
1966
2272
|
{ bytesCount: ENCODED_REFERRER_BYTE_LENGTH },
|
|
1967
2273
|
`${valueLabel} Encoded Referrer`
|
|
@@ -1969,9 +2275,9 @@ var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral
|
|
|
1969
2275
|
decodedReferrer: makeLowercaseAddressSchema(`${valueLabel} Decoded Referrer`)
|
|
1970
2276
|
}).check(invariant_registrarActionDecodedReferrerBasedOnRawReferrer),
|
|
1971
2277
|
// referral not applicable
|
|
1972
|
-
|
|
1973
|
-
encodedReferrer:
|
|
1974
|
-
decodedReferrer:
|
|
2278
|
+
import_v412.default.object({
|
|
2279
|
+
encodedReferrer: import_v412.default.null(),
|
|
2280
|
+
decodedReferrer: import_v412.default.null()
|
|
1975
2281
|
})
|
|
1976
2282
|
]);
|
|
1977
2283
|
function invariant_eventIdsInitialElementIsTheActionId(ctx) {
|
|
@@ -1984,9 +2290,9 @@ function invariant_eventIdsInitialElementIsTheActionId(ctx) {
|
|
|
1984
2290
|
});
|
|
1985
2291
|
}
|
|
1986
2292
|
}
|
|
1987
|
-
var EventIdSchema =
|
|
1988
|
-
var EventIdsSchema =
|
|
1989
|
-
var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") =>
|
|
2293
|
+
var EventIdSchema = import_v412.default.string().nonempty();
|
|
2294
|
+
var EventIdsSchema = import_v412.default.array(EventIdSchema).min(1).transform((v) => v);
|
|
2295
|
+
var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => import_v412.default.object({
|
|
1990
2296
|
id: EventIdSchema,
|
|
1991
2297
|
incrementalDuration: makeDurationSchema(`${valueLabel} Incremental Duration`),
|
|
1992
2298
|
registrant: makeLowercaseAddressSchema(`${valueLabel} Registrant`),
|
|
@@ -2000,380 +2306,188 @@ var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => im
|
|
|
2000
2306
|
eventIds: EventIdsSchema
|
|
2001
2307
|
}).check(invariant_eventIdsInitialElementIsTheActionId);
|
|
2002
2308
|
var makeRegistrarActionRegistrationSchema = (valueLabel = "Registration ") => makeBaseRegistrarActionSchema(valueLabel).extend({
|
|
2003
|
-
type:
|
|
2309
|
+
type: import_v412.default.literal(RegistrarActionTypes.Registration)
|
|
2004
2310
|
});
|
|
2005
2311
|
var makeRegistrarActionRenewalSchema = (valueLabel = "Renewal") => makeBaseRegistrarActionSchema(valueLabel).extend({
|
|
2006
|
-
type:
|
|
2312
|
+
type: import_v412.default.literal(RegistrarActionTypes.Renewal)
|
|
2007
2313
|
});
|
|
2008
|
-
var makeRegistrarActionSchema = (valueLabel = "Registrar Action") =>
|
|
2314
|
+
var makeRegistrarActionSchema = (valueLabel = "Registrar Action") => import_v412.default.discriminatedUnion("type", [
|
|
2009
2315
|
makeRegistrarActionRegistrationSchema(`${valueLabel} Registration`),
|
|
2010
2316
|
makeRegistrarActionRenewalSchema(`${valueLabel} Renewal`)
|
|
2011
2317
|
]);
|
|
2012
2318
|
|
|
2013
|
-
// src/
|
|
2014
|
-
var
|
|
2015
|
-
/**
|
|
2016
|
-
* Represents that the indexing status is available.
|
|
2017
|
-
*/
|
|
2018
|
-
Ok: "ok",
|
|
2019
|
-
/**
|
|
2020
|
-
* Represents that the indexing status is unavailable.
|
|
2021
|
-
*/
|
|
2022
|
-
Error: "error"
|
|
2023
|
-
};
|
|
2024
|
-
var RegistrarActionsFilterTypes = {
|
|
2025
|
-
BySubregistryNode: "bySubregistryNode",
|
|
2026
|
-
WithEncodedReferral: "withEncodedReferral"
|
|
2027
|
-
};
|
|
2028
|
-
var RegistrarActionsOrders = {
|
|
2029
|
-
LatestRegistrarActions: "orderBy[timestamp]=desc"
|
|
2030
|
-
};
|
|
2031
|
-
var RegistrarActionsResponseCodes = {
|
|
2032
|
-
/**
|
|
2033
|
-
* Represents that Registrar Actions are available.
|
|
2034
|
-
*/
|
|
2035
|
-
Ok: "ok",
|
|
2036
|
-
/**
|
|
2037
|
-
* Represents that Registrar Actions are unavailable.
|
|
2038
|
-
*/
|
|
2039
|
-
Error: "error"
|
|
2040
|
-
};
|
|
2319
|
+
// src/shared/config/build-rpc-urls.ts
|
|
2320
|
+
var import_chains = require("viem/chains");
|
|
2041
2321
|
|
|
2042
|
-
// src/
|
|
2043
|
-
var
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
var makeIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => import_v48.default.strictObject({
|
|
2052
|
-
responseCode: import_v48.default.literal(IndexingStatusResponseCodes.Error)
|
|
2053
|
-
});
|
|
2054
|
-
var makeIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => import_v48.default.discriminatedUnion("responseCode", [
|
|
2055
|
-
makeIndexingStatusResponseOkSchema(valueLabel),
|
|
2056
|
-
makeIndexingStatusResponseErrorSchema(valueLabel)
|
|
2057
|
-
]);
|
|
2058
|
-
function invariant_registrationLifecycleNodeMatchesName(ctx) {
|
|
2059
|
-
const { name, action } = ctx.value;
|
|
2060
|
-
const expectedNode = action.registrationLifecycle.node;
|
|
2061
|
-
const actualNode = (0, import_viem14.namehash)(name);
|
|
2062
|
-
if (actualNode !== expectedNode) {
|
|
2322
|
+
// src/shared/config/rpc-configs-from-env.ts
|
|
2323
|
+
var import_datasources4 = require("@ensnode/datasources");
|
|
2324
|
+
|
|
2325
|
+
// src/shared/config/validatons.ts
|
|
2326
|
+
var import_datasources5 = require("@ensnode/datasources");
|
|
2327
|
+
function invariant_rpcEndpointConfigIncludesAtLeastOneHTTPProtocolURL(ctx) {
|
|
2328
|
+
const endpoints = ctx.value;
|
|
2329
|
+
const httpEndpoints = endpoints.filter(isHttpProtocol);
|
|
2330
|
+
if (httpEndpoints.length < 1) {
|
|
2063
2331
|
ctx.issues.push({
|
|
2064
2332
|
code: "custom",
|
|
2065
|
-
input:
|
|
2066
|
-
message: `
|
|
2333
|
+
input: endpoints,
|
|
2334
|
+
message: `RPC endpoint configuration for a chain must include at least one http/https protocol URL.`
|
|
2067
2335
|
});
|
|
2068
2336
|
}
|
|
2069
2337
|
}
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2338
|
+
function invariant_rpcEndpointConfigIncludesAtMostOneWebSocketsProtocolURL(ctx) {
|
|
2339
|
+
const endpoints = ctx.value;
|
|
2340
|
+
const wsEndpoints = endpoints.filter(isWebSocketProtocol);
|
|
2341
|
+
if (wsEndpoints.length > 1) {
|
|
2342
|
+
ctx.issues.push({
|
|
2343
|
+
code: "custom",
|
|
2344
|
+
input: endpoints,
|
|
2345
|
+
message: `RPC endpoint configuration for a chain must include at most one websocket (ws/wss) protocol URL.`
|
|
2346
|
+
});
|
|
2347
|
+
}
|
|
2348
|
+
}
|
|
2349
|
+
|
|
2350
|
+
// src/shared/config/zod-schemas.ts
|
|
2351
|
+
var import_v413 = require("zod/v4");
|
|
2352
|
+
var import_datasources6 = require("@ensnode/datasources");
|
|
2353
|
+
var DatabaseSchemaNameSchema = import_v413.z.string({
|
|
2354
|
+
error: "DATABASE_SCHEMA is required."
|
|
2355
|
+
}).trim().min(1, {
|
|
2356
|
+
error: "DATABASE_SCHEMA is required and cannot be an empty string."
|
|
2357
|
+
});
|
|
2358
|
+
var RpcConfigSchema = import_v413.z.string().transform((val) => val.split(",")).pipe(import_v413.z.array(makeUrlSchema("RPC URL"))).check(invariant_rpcEndpointConfigIncludesAtLeastOneHTTPProtocolURL).check(invariant_rpcEndpointConfigIncludesAtMostOneWebSocketsProtocolURL);
|
|
2359
|
+
var RpcConfigsSchema = import_v413.z.record(makeChainIdStringSchema("RPC URL"), RpcConfigSchema, {
|
|
2360
|
+
error: "Chains configuration must be an object mapping valid chain IDs to their configs."
|
|
2361
|
+
}).transform((records) => {
|
|
2362
|
+
const rpcConfigs = /* @__PURE__ */ new Map();
|
|
2363
|
+
for (const [chainIdString, rpcConfig] of Object.entries(records)) {
|
|
2364
|
+
const httpRPCs = rpcConfig.filter(isHttpProtocol);
|
|
2365
|
+
const websocketRPC = rpcConfig.find(isWebSocketProtocol);
|
|
2366
|
+
rpcConfigs.set(deserializeChainId(chainIdString), {
|
|
2367
|
+
httpRPCs,
|
|
2368
|
+
websocketRPC
|
|
2369
|
+
});
|
|
2370
|
+
}
|
|
2371
|
+
return rpcConfigs;
|
|
2372
|
+
});
|
|
2373
|
+
var EnsIndexerUrlSchema = makeUrlSchema("ENSINDEXER_URL");
|
|
2374
|
+
var ENSNamespaceSchema = import_v413.z.enum(import_datasources6.ENSNamespaceIds, {
|
|
2375
|
+
error: ({ input }) => `Invalid NAMESPACE. Got '${input}', but supported ENS namespaces are: ${Object.keys(import_datasources6.ENSNamespaceIds).join(", ")}`
|
|
2376
|
+
});
|
|
2377
|
+
var PortSchema = import_v413.z.coerce.number({ error: "PORT must be a number." }).min(1, { error: "PORT must be greater than 1." }).max(65535, { error: "PORT must be less than 65535" }).optional();
|
|
2378
|
+
var TheGraphApiKeySchema = import_v413.z.string().optional();
|
|
2379
|
+
|
|
2380
|
+
// src/shared/datasources-with-resolvers.ts
|
|
2381
|
+
var import_datasources7 = require("@ensnode/datasources");
|
|
2382
|
+
var DATASOURCE_NAMES_WITH_RESOLVERS = [
|
|
2383
|
+
import_datasources7.DatasourceNames.ENSRoot,
|
|
2384
|
+
import_datasources7.DatasourceNames.Basenames,
|
|
2385
|
+
import_datasources7.DatasourceNames.Lineanames,
|
|
2386
|
+
import_datasources7.DatasourceNames.ThreeDNSOptimism,
|
|
2387
|
+
import_datasources7.DatasourceNames.ThreeDNSBase
|
|
2388
|
+
];
|
|
2389
|
+
|
|
2390
|
+
// src/shared/log-level.ts
|
|
2391
|
+
var import_v414 = require("zod/v4");
|
|
2392
|
+
var LogLevelSchema = import_v414.z.enum(["fatal", "error", "warn", "info", "debug", "trace", "silent"]);
|
|
2393
|
+
|
|
2394
|
+
// src/shared/protocol-acceleration/interpret-record-values.ts
|
|
2395
|
+
var import_viem14 = require("viem");
|
|
2396
|
+
|
|
2397
|
+
// src/api/indexing-status/response.ts
|
|
2398
|
+
var IndexingStatusResponseCodes = {
|
|
2399
|
+
/**
|
|
2400
|
+
* Represents that the indexing status is available.
|
|
2401
|
+
*/
|
|
2402
|
+
Ok: "ok",
|
|
2403
|
+
/**
|
|
2404
|
+
* Represents that the indexing status is unavailable.
|
|
2405
|
+
*/
|
|
2406
|
+
Error: "error"
|
|
2407
|
+
};
|
|
2408
|
+
|
|
2409
|
+
// src/api/indexing-status/zod-schemas.ts
|
|
2410
|
+
var makeIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => import_v415.default.strictObject({
|
|
2411
|
+
responseCode: import_v415.default.literal(IndexingStatusResponseCodes.Ok),
|
|
2412
|
+
realtimeProjection: makeRealtimeIndexingStatusProjectionSchema(valueLabel)
|
|
2077
2413
|
});
|
|
2078
|
-
var
|
|
2079
|
-
responseCode:
|
|
2080
|
-
error: ErrorResponseSchema
|
|
2414
|
+
var makeIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => import_v415.default.strictObject({
|
|
2415
|
+
responseCode: import_v415.default.literal(IndexingStatusResponseCodes.Error)
|
|
2081
2416
|
});
|
|
2082
|
-
var
|
|
2083
|
-
|
|
2084
|
-
|
|
2417
|
+
var makeIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => import_v415.default.discriminatedUnion("responseCode", [
|
|
2418
|
+
makeIndexingStatusResponseOkSchema(valueLabel),
|
|
2419
|
+
makeIndexingStatusResponseErrorSchema(valueLabel)
|
|
2085
2420
|
]);
|
|
2086
2421
|
|
|
2087
|
-
// src/api/deserialize.ts
|
|
2088
|
-
function deserializeErrorResponse(maybeErrorResponse) {
|
|
2089
|
-
const parsed = ErrorResponseSchema.safeParse(maybeErrorResponse);
|
|
2090
|
-
if (parsed.error) {
|
|
2091
|
-
throw new Error(`Cannot deserialize ErrorResponse:
|
|
2092
|
-
${(0, import_v49.prettifyError)(parsed.error)}
|
|
2093
|
-
`);
|
|
2094
|
-
}
|
|
2095
|
-
return parsed.data;
|
|
2096
|
-
}
|
|
2422
|
+
// src/api/indexing-status/deserialize.ts
|
|
2097
2423
|
function deserializeIndexingStatusResponse(maybeResponse) {
|
|
2098
2424
|
const parsed = makeIndexingStatusResponseSchema().safeParse(maybeResponse);
|
|
2099
2425
|
if (parsed.error) {
|
|
2100
2426
|
throw new Error(`Cannot deserialize IndexingStatusResponse:
|
|
2101
|
-
${(0,
|
|
2102
|
-
`);
|
|
2103
|
-
}
|
|
2104
|
-
return parsed.data;
|
|
2105
|
-
}
|
|
2106
|
-
function deserializeRegistrarActionsResponse(maybeResponse) {
|
|
2107
|
-
const parsed = makeRegistrarActionsResponseSchema().safeParse(maybeResponse);
|
|
2108
|
-
if (parsed.error) {
|
|
2109
|
-
throw new Error(
|
|
2110
|
-
`Cannot deserialize RegistrarActionsResponse:
|
|
2111
|
-
${(0, import_v49.prettifyError)(parsed.error)}
|
|
2112
|
-
`
|
|
2113
|
-
);
|
|
2114
|
-
}
|
|
2115
|
-
return parsed.data;
|
|
2116
|
-
}
|
|
2117
|
-
|
|
2118
|
-
// src/api/registrar-actions/filters.ts
|
|
2119
|
-
function byParentNode(parentNode) {
|
|
2120
|
-
if (typeof parentNode === "undefined") {
|
|
2121
|
-
return void 0;
|
|
2122
|
-
}
|
|
2123
|
-
return {
|
|
2124
|
-
filterType: RegistrarActionsFilterTypes.BySubregistryNode,
|
|
2125
|
-
value: parentNode
|
|
2126
|
-
};
|
|
2127
|
-
}
|
|
2128
|
-
function withReferral(withReferral2) {
|
|
2129
|
-
if (!withReferral2) {
|
|
2130
|
-
return void 0;
|
|
2131
|
-
}
|
|
2132
|
-
return {
|
|
2133
|
-
filterType: RegistrarActionsFilterTypes.WithEncodedReferral
|
|
2134
|
-
};
|
|
2135
|
-
}
|
|
2136
|
-
var registrarActionsFilter = {
|
|
2137
|
-
byParentNode,
|
|
2138
|
-
withReferral
|
|
2139
|
-
};
|
|
2140
|
-
|
|
2141
|
-
// src/ensindexer/config/deserialize.ts
|
|
2142
|
-
var import_v410 = require("zod/v4");
|
|
2143
|
-
function deserializeENSIndexerPublicConfig(maybeConfig, valueLabel) {
|
|
2144
|
-
const schema = makeENSIndexerPublicConfigSchema(valueLabel);
|
|
2145
|
-
const parsed = schema.safeParse(maybeConfig);
|
|
2146
|
-
if (parsed.error) {
|
|
2147
|
-
throw new Error(`Cannot deserialize ENSIndexerPublicConfig:
|
|
2148
|
-
${(0, import_v410.prettifyError)(parsed.error)}
|
|
2427
|
+
${(0, import_v416.prettifyError)(parsed.error)}
|
|
2149
2428
|
`);
|
|
2150
2429
|
}
|
|
2151
2430
|
return parsed.data;
|
|
2152
2431
|
}
|
|
2153
2432
|
|
|
2154
|
-
// src/
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
if (!labelHash.startsWith("0x")) {
|
|
2165
|
-
throw new Error("Labelhash must be 0x-prefixed");
|
|
2166
|
-
}
|
|
2167
|
-
const bytes = (0, import_viem15.hexToBytes)(labelHash);
|
|
2168
|
-
if (bytes.length !== 32) {
|
|
2169
|
-
throw new Error(`Invalid labelHash length ${bytes.length} bytes (expected 32)`);
|
|
2170
|
-
}
|
|
2171
|
-
return bytes;
|
|
2172
|
-
} catch (e) {
|
|
2173
|
-
if (e instanceof Error) {
|
|
2174
|
-
throw e;
|
|
2175
|
-
}
|
|
2176
|
-
throw new Error("Invalid hex format");
|
|
2177
|
-
}
|
|
2178
|
-
}
|
|
2179
|
-
|
|
2180
|
-
// src/ensindexer/config/labelset-utils.ts
|
|
2181
|
-
function buildLabelSetId(maybeLabelSetId) {
|
|
2182
|
-
return makeLabelSetIdSchema("LabelSetId").parse(maybeLabelSetId);
|
|
2183
|
-
}
|
|
2184
|
-
function buildLabelSetVersion(maybeLabelSetVersion) {
|
|
2185
|
-
return makeLabelSetVersionSchema("LabelSetVersion").parse(maybeLabelSetVersion);
|
|
2186
|
-
}
|
|
2187
|
-
function buildEnsRainbowClientLabelSet(labelSetId, labelSetVersion) {
|
|
2188
|
-
if (labelSetVersion !== void 0 && labelSetId === void 0) {
|
|
2189
|
-
throw new Error("When a labelSetVersion is defined, labelSetId must also be defined.");
|
|
2190
|
-
}
|
|
2191
|
-
return { labelSetId, labelSetVersion };
|
|
2192
|
-
}
|
|
2193
|
-
function validateSupportedLabelSetAndVersion(serverSet, clientSet) {
|
|
2194
|
-
if (clientSet.labelSetId === void 0) {
|
|
2195
|
-
return;
|
|
2196
|
-
}
|
|
2197
|
-
if (serverSet.labelSetId !== clientSet.labelSetId) {
|
|
2198
|
-
throw new Error(
|
|
2199
|
-
`Server label set ID "${serverSet.labelSetId}" does not match client's requested label set ID "${clientSet.labelSetId}".`
|
|
2200
|
-
);
|
|
2201
|
-
}
|
|
2202
|
-
if (clientSet.labelSetVersion !== void 0 && serverSet.highestLabelSetVersion < clientSet.labelSetVersion) {
|
|
2203
|
-
throw new Error(
|
|
2204
|
-
`Server highest label set version ${serverSet.highestLabelSetVersion} is less than client's requested version ${clientSet.labelSetVersion} for label set ID "${clientSet.labelSetId}".`
|
|
2205
|
-
);
|
|
2206
|
-
}
|
|
2207
|
-
}
|
|
2208
|
-
|
|
2209
|
-
// src/ensindexer/config/parsing.ts
|
|
2210
|
-
function parseNonNegativeInteger(maybeNumber) {
|
|
2211
|
-
const trimmed = maybeNumber.trim();
|
|
2212
|
-
if (!trimmed) {
|
|
2213
|
-
throw new Error("Input cannot be empty");
|
|
2214
|
-
}
|
|
2215
|
-
if (trimmed === "-0") {
|
|
2216
|
-
throw new Error("Negative zero is not a valid non-negative integer");
|
|
2217
|
-
}
|
|
2218
|
-
const num = Number(maybeNumber);
|
|
2219
|
-
if (Number.isNaN(num)) {
|
|
2220
|
-
throw new Error(`"${maybeNumber}" is not a valid number`);
|
|
2221
|
-
}
|
|
2222
|
-
if (!Number.isFinite(num)) {
|
|
2223
|
-
throw new Error(`"${maybeNumber}" is not a finite number`);
|
|
2224
|
-
}
|
|
2225
|
-
if (!Number.isInteger(num)) {
|
|
2226
|
-
throw new Error(`"${maybeNumber}" is not an integer`);
|
|
2227
|
-
}
|
|
2228
|
-
if (num < 0) {
|
|
2229
|
-
throw new Error(`"${maybeNumber}" is not a non-negative integer`);
|
|
2433
|
+
// src/api/indexing-status/serialize.ts
|
|
2434
|
+
function serializeIndexingStatusResponse(response) {
|
|
2435
|
+
switch (response.responseCode) {
|
|
2436
|
+
case IndexingStatusResponseCodes.Ok:
|
|
2437
|
+
return {
|
|
2438
|
+
responseCode: response.responseCode,
|
|
2439
|
+
realtimeProjection: serializeRealtimeIndexingStatusProjection(response.realtimeProjection)
|
|
2440
|
+
};
|
|
2441
|
+
case IndexingStatusResponseCodes.Error:
|
|
2442
|
+
return response;
|
|
2230
2443
|
}
|
|
2231
|
-
return num;
|
|
2232
|
-
}
|
|
2233
|
-
|
|
2234
|
-
// src/ensindexer/config/serialize.ts
|
|
2235
|
-
function serializeIndexedChainIds(indexedChainIds) {
|
|
2236
|
-
return Array.from(indexedChainIds);
|
|
2237
|
-
}
|
|
2238
|
-
function serializeENSIndexerPublicConfig(config) {
|
|
2239
|
-
const {
|
|
2240
|
-
labelSet,
|
|
2241
|
-
indexedChainIds,
|
|
2242
|
-
databaseSchemaName,
|
|
2243
|
-
isSubgraphCompatible: isSubgraphCompatible2,
|
|
2244
|
-
namespace,
|
|
2245
|
-
plugins,
|
|
2246
|
-
versionInfo
|
|
2247
|
-
} = config;
|
|
2248
|
-
return {
|
|
2249
|
-
labelSet,
|
|
2250
|
-
indexedChainIds: serializeIndexedChainIds(indexedChainIds),
|
|
2251
|
-
databaseSchemaName,
|
|
2252
|
-
isSubgraphCompatible: isSubgraphCompatible2,
|
|
2253
|
-
namespace,
|
|
2254
|
-
plugins,
|
|
2255
|
-
versionInfo
|
|
2256
|
-
};
|
|
2257
2444
|
}
|
|
2258
2445
|
|
|
2259
|
-
// src/
|
|
2260
|
-
var
|
|
2261
|
-
function
|
|
2262
|
-
const
|
|
2263
|
-
const parsed = schema.safeParse(maybeSnapshot);
|
|
2264
|
-
if (parsed.error) {
|
|
2265
|
-
throw new Error(
|
|
2266
|
-
`Cannot deserialize into ChainIndexingStatusSnapshot:
|
|
2267
|
-
${(0, import_v411.prettifyError)(parsed.error)}
|
|
2268
|
-
`
|
|
2269
|
-
);
|
|
2270
|
-
}
|
|
2271
|
-
return parsed.data;
|
|
2272
|
-
}
|
|
2273
|
-
function deserializeOmnichainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
2274
|
-
const schema = makeOmnichainIndexingStatusSnapshotSchema(valueLabel);
|
|
2275
|
-
const parsed = schema.safeParse(maybeSnapshot);
|
|
2276
|
-
if (parsed.error) {
|
|
2277
|
-
throw new Error(
|
|
2278
|
-
`Cannot deserialize into OmnichainIndexingStatusSnapshot:
|
|
2279
|
-
${(0, import_v411.prettifyError)(parsed.error)}
|
|
2280
|
-
`
|
|
2281
|
-
);
|
|
2282
|
-
}
|
|
2283
|
-
return parsed.data;
|
|
2284
|
-
}
|
|
2285
|
-
function deserializeCrossChainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
2286
|
-
const schema = makeCrossChainIndexingStatusSnapshotSchema(valueLabel);
|
|
2287
|
-
const parsed = schema.safeParse(maybeSnapshot);
|
|
2288
|
-
if (parsed.error) {
|
|
2289
|
-
throw new Error(
|
|
2290
|
-
`Cannot deserialize into CrossChainIndexingStatusSnapshot:
|
|
2291
|
-
${(0, import_v411.prettifyError)(parsed.error)}
|
|
2292
|
-
`
|
|
2293
|
-
);
|
|
2294
|
-
}
|
|
2295
|
-
return parsed.data;
|
|
2296
|
-
}
|
|
2297
|
-
function deserializeRealtimeIndexingStatusProjection(maybeProjection, valueLabel) {
|
|
2298
|
-
const schema = makeRealtimeIndexingStatusProjectionSchema(valueLabel);
|
|
2299
|
-
const parsed = schema.safeParse(maybeProjection);
|
|
2446
|
+
// src/api/registrar-actions/deserialize.ts
|
|
2447
|
+
var import_v417 = require("zod/v4");
|
|
2448
|
+
function deserializeRegistrarActionsResponse(maybeResponse) {
|
|
2449
|
+
const parsed = makeRegistrarActionsResponseSchema().safeParse(maybeResponse);
|
|
2300
2450
|
if (parsed.error) {
|
|
2301
2451
|
throw new Error(
|
|
2302
|
-
`Cannot deserialize
|
|
2303
|
-
${(0,
|
|
2452
|
+
`Cannot deserialize RegistrarActionsResponse:
|
|
2453
|
+
${(0, import_v417.prettifyError)(parsed.error)}
|
|
2304
2454
|
`
|
|
2305
2455
|
);
|
|
2306
2456
|
}
|
|
2307
2457
|
return parsed.data;
|
|
2308
2458
|
}
|
|
2309
2459
|
|
|
2310
|
-
// src/
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
}
|
|
2460
|
+
// src/api/registrar-actions/request.ts
|
|
2461
|
+
var RegistrarActionsFilterTypes = {
|
|
2462
|
+
BySubregistryNode: "bySubregistryNode",
|
|
2463
|
+
WithEncodedReferral: "withEncodedReferral"
|
|
2464
|
+
};
|
|
2465
|
+
var RegistrarActionsOrders = {
|
|
2466
|
+
LatestRegistrarActions: "orderBy[timestamp]=desc"
|
|
2467
|
+
};
|
|
2319
2468
|
|
|
2320
|
-
// src/
|
|
2321
|
-
function
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
snapshotTime,
|
|
2325
|
-
omnichainSnapshot
|
|
2326
|
-
}) {
|
|
2327
|
-
return {
|
|
2328
|
-
strategy,
|
|
2329
|
-
slowestChainIndexingCursor,
|
|
2330
|
-
snapshotTime,
|
|
2331
|
-
omnichainSnapshot: serializeOmnichainIndexingStatusSnapshot(omnichainSnapshot)
|
|
2332
|
-
};
|
|
2333
|
-
}
|
|
2334
|
-
function serializeRealtimeIndexingStatusProjection(indexingProjection) {
|
|
2335
|
-
return {
|
|
2336
|
-
projectedAt: indexingProjection.projectedAt,
|
|
2337
|
-
worstCaseDistance: indexingProjection.worstCaseDistance,
|
|
2338
|
-
snapshot: serializeCrossChainIndexingStatusSnapshotOmnichain(indexingProjection.snapshot)
|
|
2339
|
-
};
|
|
2340
|
-
}
|
|
2341
|
-
function serializeChainIndexingSnapshots(chains) {
|
|
2342
|
-
const serializedSnapshots = {};
|
|
2343
|
-
for (const [chainId, snapshot] of chains.entries()) {
|
|
2344
|
-
serializedSnapshots[serializeChainId(chainId)] = snapshot;
|
|
2469
|
+
// src/api/registrar-actions/filters.ts
|
|
2470
|
+
function byParentNode(parentNode) {
|
|
2471
|
+
if (typeof parentNode === "undefined") {
|
|
2472
|
+
return void 0;
|
|
2345
2473
|
}
|
|
2346
|
-
return
|
|
2474
|
+
return {
|
|
2475
|
+
filterType: RegistrarActionsFilterTypes.BySubregistryNode,
|
|
2476
|
+
value: parentNode
|
|
2477
|
+
};
|
|
2347
2478
|
}
|
|
2348
|
-
function
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
return {
|
|
2352
|
-
omnichainStatus: OmnichainIndexingStatusIds.Unstarted,
|
|
2353
|
-
chains: serializeChainIndexingSnapshots(indexingStatus.chains),
|
|
2354
|
-
omnichainIndexingCursor: indexingStatus.omnichainIndexingCursor
|
|
2355
|
-
};
|
|
2356
|
-
case OmnichainIndexingStatusIds.Backfill:
|
|
2357
|
-
return {
|
|
2358
|
-
omnichainStatus: OmnichainIndexingStatusIds.Backfill,
|
|
2359
|
-
chains: serializeChainIndexingSnapshots(indexingStatus.chains),
|
|
2360
|
-
omnichainIndexingCursor: indexingStatus.omnichainIndexingCursor
|
|
2361
|
-
};
|
|
2362
|
-
case OmnichainIndexingStatusIds.Completed: {
|
|
2363
|
-
return {
|
|
2364
|
-
omnichainStatus: OmnichainIndexingStatusIds.Completed,
|
|
2365
|
-
chains: serializeChainIndexingSnapshots(indexingStatus.chains),
|
|
2366
|
-
omnichainIndexingCursor: indexingStatus.omnichainIndexingCursor
|
|
2367
|
-
};
|
|
2368
|
-
}
|
|
2369
|
-
case OmnichainIndexingStatusIds.Following:
|
|
2370
|
-
return {
|
|
2371
|
-
omnichainStatus: OmnichainIndexingStatusIds.Following,
|
|
2372
|
-
chains: serializeChainIndexingSnapshots(indexingStatus.chains),
|
|
2373
|
-
omnichainIndexingCursor: indexingStatus.omnichainIndexingCursor
|
|
2374
|
-
};
|
|
2479
|
+
function withReferral(withReferral2) {
|
|
2480
|
+
if (!withReferral2) {
|
|
2481
|
+
return void 0;
|
|
2375
2482
|
}
|
|
2483
|
+
return {
|
|
2484
|
+
filterType: RegistrarActionsFilterTypes.WithEncodedReferral
|
|
2485
|
+
};
|
|
2376
2486
|
}
|
|
2487
|
+
var registrarActionsFilter = {
|
|
2488
|
+
byParentNode,
|
|
2489
|
+
withReferral
|
|
2490
|
+
};
|
|
2377
2491
|
|
|
2378
2492
|
// src/api/registrar-actions/prerequisites.ts
|
|
2379
2493
|
var registrarActionsPrerequisites = Object.freeze({
|
|
@@ -2442,18 +2556,7 @@ function getEthnamesSubregistryId(namespace) {
|
|
|
2442
2556
|
};
|
|
2443
2557
|
}
|
|
2444
2558
|
|
|
2445
|
-
// src/api/serialize.ts
|
|
2446
|
-
function serializeIndexingStatusResponse(response) {
|
|
2447
|
-
switch (response.responseCode) {
|
|
2448
|
-
case IndexingStatusResponseCodes.Ok:
|
|
2449
|
-
return {
|
|
2450
|
-
responseCode: response.responseCode,
|
|
2451
|
-
realtimeProjection: serializeRealtimeIndexingStatusProjection(response.realtimeProjection)
|
|
2452
|
-
};
|
|
2453
|
-
case IndexingStatusResponseCodes.Error:
|
|
2454
|
-
return response;
|
|
2455
|
-
}
|
|
2456
|
-
}
|
|
2559
|
+
// src/api/registrar-actions/serialize.ts
|
|
2457
2560
|
function serializeNamedRegistrarAction({
|
|
2458
2561
|
action,
|
|
2459
2562
|
name
|
|
@@ -2475,6 +2578,18 @@ function serializeRegistrarActionsResponse(response) {
|
|
|
2475
2578
|
}
|
|
2476
2579
|
}
|
|
2477
2580
|
|
|
2581
|
+
// src/api/shared/errors/deserialize.ts
|
|
2582
|
+
var import_v418 = require("zod/v4");
|
|
2583
|
+
function deserializeErrorResponse(maybeErrorResponse) {
|
|
2584
|
+
const parsed = ErrorResponseSchema.safeParse(maybeErrorResponse);
|
|
2585
|
+
if (parsed.error) {
|
|
2586
|
+
throw new Error(`Cannot deserialize ErrorResponse:
|
|
2587
|
+
${(0, import_v418.prettifyError)(parsed.error)}
|
|
2588
|
+
`);
|
|
2589
|
+
}
|
|
2590
|
+
return parsed.data;
|
|
2591
|
+
}
|
|
2592
|
+
|
|
2478
2593
|
// src/client-error.ts
|
|
2479
2594
|
var ClientError = class _ClientError extends Error {
|
|
2480
2595
|
details;
|
|
@@ -2489,10 +2604,10 @@ var ClientError = class _ClientError extends Error {
|
|
|
2489
2604
|
};
|
|
2490
2605
|
|
|
2491
2606
|
// src/ensanalytics/deserialize.ts
|
|
2492
|
-
var
|
|
2607
|
+
var import_v420 = require("zod/v4");
|
|
2493
2608
|
|
|
2494
2609
|
// src/ensanalytics/zod-schemas.ts
|
|
2495
|
-
var
|
|
2610
|
+
var import_v419 = __toESM(require("zod/v4"), 1);
|
|
2496
2611
|
|
|
2497
2612
|
// src/ensanalytics/types.ts
|
|
2498
2613
|
var ReferrerLeaderboardPageResponseCodes = {
|
|
@@ -2505,22 +2620,50 @@ var ReferrerLeaderboardPageResponseCodes = {
|
|
|
2505
2620
|
*/
|
|
2506
2621
|
Error: "error"
|
|
2507
2622
|
};
|
|
2623
|
+
var ReferrerDetailResponseCodes = {
|
|
2624
|
+
/**
|
|
2625
|
+
* Represents that the referrer detail data is available.
|
|
2626
|
+
*/
|
|
2627
|
+
Ok: "ok",
|
|
2628
|
+
/**
|
|
2629
|
+
* Represents that an error occurred while fetching the data.
|
|
2630
|
+
*/
|
|
2631
|
+
Error: "error"
|
|
2632
|
+
};
|
|
2508
2633
|
|
|
2509
2634
|
// src/ensanalytics/zod-schemas.ts
|
|
2510
|
-
var makeReferralProgramRulesSchema = (valueLabel = "ReferralProgramRules") =>
|
|
2635
|
+
var makeReferralProgramRulesSchema = (valueLabel = "ReferralProgramRules") => import_v419.default.object({
|
|
2511
2636
|
totalAwardPoolValue: makeFiniteNonNegativeNumberSchema(`${valueLabel}.totalAwardPoolValue`),
|
|
2512
2637
|
maxQualifiedReferrers: makeNonNegativeIntegerSchema(`${valueLabel}.maxQualifiedReferrers`),
|
|
2513
2638
|
startTime: makeUnixTimestampSchema(`${valueLabel}.startTime`),
|
|
2514
2639
|
endTime: makeUnixTimestampSchema(`${valueLabel}.endTime`),
|
|
2515
2640
|
subregistryId: makeAccountIdSchema(`${valueLabel}.subregistryId`)
|
|
2516
2641
|
});
|
|
2517
|
-
var makeAwardedReferrerMetricsSchema = (valueLabel = "AwardedReferrerMetrics") =>
|
|
2642
|
+
var makeAwardedReferrerMetricsSchema = (valueLabel = "AwardedReferrerMetrics") => import_v419.default.object({
|
|
2518
2643
|
referrer: makeLowercaseAddressSchema(`${valueLabel}.referrer`),
|
|
2519
2644
|
totalReferrals: makeNonNegativeIntegerSchema(`${valueLabel}.totalReferrals`),
|
|
2520
2645
|
totalIncrementalDuration: makeDurationSchema(`${valueLabel}.totalIncrementalDuration`),
|
|
2521
2646
|
score: makeFiniteNonNegativeNumberSchema(`${valueLabel}.score`),
|
|
2522
2647
|
rank: makePositiveIntegerSchema(`${valueLabel}.rank`),
|
|
2523
|
-
isQualified:
|
|
2648
|
+
isQualified: import_v419.default.boolean(),
|
|
2649
|
+
finalScoreBoost: makeFiniteNonNegativeNumberSchema(`${valueLabel}.finalScoreBoost`).max(
|
|
2650
|
+
1,
|
|
2651
|
+
`${valueLabel}.finalScoreBoost must be <= 1`
|
|
2652
|
+
),
|
|
2653
|
+
finalScore: makeFiniteNonNegativeNumberSchema(`${valueLabel}.finalScore`),
|
|
2654
|
+
awardPoolShare: makeFiniteNonNegativeNumberSchema(`${valueLabel}.awardPoolShare`).max(
|
|
2655
|
+
1,
|
|
2656
|
+
`${valueLabel}.awardPoolShare must be <= 1`
|
|
2657
|
+
),
|
|
2658
|
+
awardPoolApproxValue: makeFiniteNonNegativeNumberSchema(`${valueLabel}.awardPoolApproxValue`)
|
|
2659
|
+
});
|
|
2660
|
+
var makeUnrankedReferrerMetricsSchema = (valueLabel = "UnrankedReferrerMetrics") => import_v419.default.object({
|
|
2661
|
+
referrer: makeLowercaseAddressSchema(`${valueLabel}.referrer`),
|
|
2662
|
+
totalReferrals: makeNonNegativeIntegerSchema(`${valueLabel}.totalReferrals`),
|
|
2663
|
+
totalIncrementalDuration: makeDurationSchema(`${valueLabel}.totalIncrementalDuration`),
|
|
2664
|
+
score: makeFiniteNonNegativeNumberSchema(`${valueLabel}.score`),
|
|
2665
|
+
rank: import_v419.default.null(),
|
|
2666
|
+
isQualified: import_v419.default.literal(false),
|
|
2524
2667
|
finalScoreBoost: makeFiniteNonNegativeNumberSchema(`${valueLabel}.finalScoreBoost`).max(
|
|
2525
2668
|
1,
|
|
2526
2669
|
`${valueLabel}.finalScoreBoost must be <= 1`
|
|
@@ -2532,7 +2675,7 @@ var makeAwardedReferrerMetricsSchema = (valueLabel = "AwardedReferrerMetrics") =
|
|
|
2532
2675
|
),
|
|
2533
2676
|
awardPoolApproxValue: makeFiniteNonNegativeNumberSchema(`${valueLabel}.awardPoolApproxValue`)
|
|
2534
2677
|
});
|
|
2535
|
-
var makeAggregatedReferrerMetricsSchema = (valueLabel = "AggregatedReferrerMetrics") =>
|
|
2678
|
+
var makeAggregatedReferrerMetricsSchema = (valueLabel = "AggregatedReferrerMetrics") => import_v419.default.object({
|
|
2536
2679
|
grandTotalReferrals: makeNonNegativeIntegerSchema(`${valueLabel}.grandTotalReferrals`),
|
|
2537
2680
|
grandTotalIncrementalDuration: makeDurationSchema(
|
|
2538
2681
|
`${valueLabel}.grandTotalIncrementalDuration`
|
|
@@ -2544,7 +2687,7 @@ var makeAggregatedReferrerMetricsSchema = (valueLabel = "AggregatedReferrerMetri
|
|
|
2544
2687
|
`${valueLabel}.minFinalScoreToQualify`
|
|
2545
2688
|
)
|
|
2546
2689
|
});
|
|
2547
|
-
var
|
|
2690
|
+
var makeReferrerLeaderboardPageContextSchema = (valueLabel = "ReferrerLeaderboardPageContext") => import_v419.default.object({
|
|
2548
2691
|
page: makePositiveIntegerSchema(`${valueLabel}.page`),
|
|
2549
2692
|
itemsPerPage: makePositiveIntegerSchema(`${valueLabel}.itemsPerPage`).max(
|
|
2550
2693
|
REFERRERS_PER_LEADERBOARD_PAGE_MAX,
|
|
@@ -2552,33 +2695,61 @@ var makeReferrerLeaderboardPaginationContextSchema = (valueLabel = "ReferrerLead
|
|
|
2552
2695
|
),
|
|
2553
2696
|
totalRecords: makeNonNegativeIntegerSchema(`${valueLabel}.totalRecords`),
|
|
2554
2697
|
totalPages: makePositiveIntegerSchema(`${valueLabel}.totalPages`),
|
|
2555
|
-
hasNext:
|
|
2556
|
-
hasPrev:
|
|
2557
|
-
startIndex:
|
|
2558
|
-
endIndex:
|
|
2698
|
+
hasNext: import_v419.default.boolean(),
|
|
2699
|
+
hasPrev: import_v419.default.boolean(),
|
|
2700
|
+
startIndex: import_v419.default.optional(makeNonNegativeIntegerSchema(`${valueLabel}.startIndex`)),
|
|
2701
|
+
endIndex: import_v419.default.optional(makeNonNegativeIntegerSchema(`${valueLabel}.endIndex`))
|
|
2559
2702
|
});
|
|
2560
|
-
var makeReferrerLeaderboardPageSchema = (valueLabel = "ReferrerLeaderboardPage") =>
|
|
2703
|
+
var makeReferrerLeaderboardPageSchema = (valueLabel = "ReferrerLeaderboardPage") => import_v419.default.object({
|
|
2561
2704
|
rules: makeReferralProgramRulesSchema(`${valueLabel}.rules`),
|
|
2562
|
-
referrers:
|
|
2705
|
+
referrers: import_v419.default.array(makeAwardedReferrerMetricsSchema(`${valueLabel}.referrers[item]`)),
|
|
2563
2706
|
aggregatedMetrics: makeAggregatedReferrerMetricsSchema(`${valueLabel}.aggregatedMetrics`),
|
|
2564
|
-
paginationContext:
|
|
2565
|
-
`${valueLabel}.paginationContext`
|
|
2566
|
-
),
|
|
2707
|
+
paginationContext: makeReferrerLeaderboardPageContextSchema(`${valueLabel}.paginationContext`),
|
|
2567
2708
|
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
|
|
2568
2709
|
});
|
|
2569
|
-
var makeReferrerLeaderboardPageResponseOkSchema = (valueLabel = "ReferrerLeaderboardPageResponseOk") =>
|
|
2570
|
-
responseCode:
|
|
2710
|
+
var makeReferrerLeaderboardPageResponseOkSchema = (valueLabel = "ReferrerLeaderboardPageResponseOk") => import_v419.default.object({
|
|
2711
|
+
responseCode: import_v419.default.literal(ReferrerLeaderboardPageResponseCodes.Ok),
|
|
2571
2712
|
data: makeReferrerLeaderboardPageSchema(`${valueLabel}.data`)
|
|
2572
2713
|
});
|
|
2573
|
-
var makeReferrerLeaderboardPageResponseErrorSchema = (_valueLabel = "ReferrerLeaderboardPageResponseError") =>
|
|
2574
|
-
responseCode:
|
|
2575
|
-
error:
|
|
2576
|
-
errorMessage:
|
|
2714
|
+
var makeReferrerLeaderboardPageResponseErrorSchema = (_valueLabel = "ReferrerLeaderboardPageResponseError") => import_v419.default.object({
|
|
2715
|
+
responseCode: import_v419.default.literal(ReferrerLeaderboardPageResponseCodes.Error),
|
|
2716
|
+
error: import_v419.default.string(),
|
|
2717
|
+
errorMessage: import_v419.default.string()
|
|
2577
2718
|
});
|
|
2578
|
-
var makeReferrerLeaderboardPageResponseSchema = (valueLabel = "ReferrerLeaderboardPageResponse") =>
|
|
2719
|
+
var makeReferrerLeaderboardPageResponseSchema = (valueLabel = "ReferrerLeaderboardPageResponse") => import_v419.default.union([
|
|
2579
2720
|
makeReferrerLeaderboardPageResponseOkSchema(valueLabel),
|
|
2580
2721
|
makeReferrerLeaderboardPageResponseErrorSchema(valueLabel)
|
|
2581
2722
|
]);
|
|
2723
|
+
var makeReferrerDetailRankedSchema = (valueLabel = "ReferrerDetailRanked") => import_v419.default.object({
|
|
2724
|
+
type: import_v419.default.literal(ReferrerDetailTypeIds.Ranked),
|
|
2725
|
+
rules: makeReferralProgramRulesSchema(`${valueLabel}.rules`),
|
|
2726
|
+
referrer: makeAwardedReferrerMetricsSchema(`${valueLabel}.referrer`),
|
|
2727
|
+
aggregatedMetrics: makeAggregatedReferrerMetricsSchema(`${valueLabel}.aggregatedMetrics`),
|
|
2728
|
+
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
|
|
2729
|
+
});
|
|
2730
|
+
var makeReferrerDetailUnrankedSchema = (valueLabel = "ReferrerDetailUnranked") => import_v419.default.object({
|
|
2731
|
+
type: import_v419.default.literal(ReferrerDetailTypeIds.Unranked),
|
|
2732
|
+
rules: makeReferralProgramRulesSchema(`${valueLabel}.rules`),
|
|
2733
|
+
referrer: makeUnrankedReferrerMetricsSchema(`${valueLabel}.referrer`),
|
|
2734
|
+
aggregatedMetrics: makeAggregatedReferrerMetricsSchema(`${valueLabel}.aggregatedMetrics`),
|
|
2735
|
+
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
|
|
2736
|
+
});
|
|
2737
|
+
var makeReferrerDetailResponseOkSchema = (valueLabel = "ReferrerDetailResponse") => import_v419.default.object({
|
|
2738
|
+
responseCode: import_v419.default.literal(ReferrerDetailResponseCodes.Ok),
|
|
2739
|
+
data: import_v419.default.union([
|
|
2740
|
+
makeReferrerDetailRankedSchema(`${valueLabel}.data`),
|
|
2741
|
+
makeReferrerDetailUnrankedSchema(`${valueLabel}.data`)
|
|
2742
|
+
])
|
|
2743
|
+
});
|
|
2744
|
+
var makeReferrerDetailResponseErrorSchema = (_valueLabel = "ReferrerDetailResponse") => import_v419.default.object({
|
|
2745
|
+
responseCode: import_v419.default.literal(ReferrerDetailResponseCodes.Error),
|
|
2746
|
+
error: import_v419.default.string(),
|
|
2747
|
+
errorMessage: import_v419.default.string()
|
|
2748
|
+
});
|
|
2749
|
+
var makeReferrerDetailResponseSchema = (valueLabel = "ReferrerDetailResponse") => import_v419.default.union([
|
|
2750
|
+
makeReferrerDetailResponseOkSchema(valueLabel),
|
|
2751
|
+
makeReferrerDetailResponseErrorSchema(valueLabel)
|
|
2752
|
+
]);
|
|
2582
2753
|
|
|
2583
2754
|
// src/ensanalytics/deserialize.ts
|
|
2584
2755
|
function deserializeReferrerLeaderboardPageResponse(maybeResponse, valueLabel) {
|
|
@@ -2587,12 +2758,22 @@ function deserializeReferrerLeaderboardPageResponse(maybeResponse, valueLabel) {
|
|
|
2587
2758
|
if (parsed.error) {
|
|
2588
2759
|
throw new Error(
|
|
2589
2760
|
`Cannot deserialize SerializedReferrerLeaderboardPageResponse:
|
|
2590
|
-
${(0,
|
|
2761
|
+
${(0, import_v420.prettifyError)(parsed.error)}
|
|
2591
2762
|
`
|
|
2592
2763
|
);
|
|
2593
2764
|
}
|
|
2594
2765
|
return parsed.data;
|
|
2595
2766
|
}
|
|
2767
|
+
function deserializeReferrerDetailResponse(maybeResponse, valueLabel) {
|
|
2768
|
+
const schema = makeReferrerDetailResponseSchema(valueLabel);
|
|
2769
|
+
const parsed = schema.safeParse(maybeResponse);
|
|
2770
|
+
if (parsed.error) {
|
|
2771
|
+
throw new Error(`Cannot deserialize ReferrerDetailResponse:
|
|
2772
|
+
${(0, import_v420.prettifyError)(parsed.error)}
|
|
2773
|
+
`);
|
|
2774
|
+
}
|
|
2775
|
+
return parsed.data;
|
|
2776
|
+
}
|
|
2596
2777
|
|
|
2597
2778
|
// src/ensanalytics/serialize.ts
|
|
2598
2779
|
function serializeReferrerLeaderboardPageResponse(response) {
|
|
@@ -2603,55 +2784,15 @@ function serializeReferrerLeaderboardPageResponse(response) {
|
|
|
2603
2784
|
return response;
|
|
2604
2785
|
}
|
|
2605
2786
|
}
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
var TheGraphCannotFallbackReasonSchema = import_v414.z.enum({
|
|
2613
|
-
NotSubgraphCompatible: "not-subgraph-compatible",
|
|
2614
|
-
NoApiKey: "no-api-key",
|
|
2615
|
-
NoSubgraphUrl: "no-subgraph-url"
|
|
2616
|
-
});
|
|
2617
|
-
var TheGraphFallbackSchema = import_v414.z.strictObject({
|
|
2618
|
-
canFallback: import_v414.z.boolean(),
|
|
2619
|
-
reason: TheGraphCannotFallbackReasonSchema.nullable()
|
|
2620
|
-
});
|
|
2621
|
-
function makeENSApiPublicConfigSchema(valueLabel) {
|
|
2622
|
-
const label = valueLabel ?? "ENSApiPublicConfig";
|
|
2623
|
-
return import_v414.z.strictObject({
|
|
2624
|
-
version: import_v414.z.string().min(1, `${label}.version must be a non-empty string`),
|
|
2625
|
-
theGraphFallback: TheGraphFallbackSchema,
|
|
2626
|
-
ensIndexerPublicConfig: makeENSIndexerPublicConfigSchema(`${label}.ensIndexerPublicConfig`)
|
|
2627
|
-
});
|
|
2628
|
-
}
|
|
2629
|
-
|
|
2630
|
-
// src/ensapi/config/deserialize.ts
|
|
2631
|
-
function deserializeENSApiPublicConfig(maybeConfig, valueLabel) {
|
|
2632
|
-
const schema = makeENSApiPublicConfigSchema(valueLabel);
|
|
2633
|
-
try {
|
|
2634
|
-
return schema.parse(maybeConfig);
|
|
2635
|
-
} catch (error) {
|
|
2636
|
-
if (error instanceof import_v415.ZodError) {
|
|
2637
|
-
throw new Error(`Cannot deserialize ENSApiPublicConfig:
|
|
2638
|
-
${(0, import_v415.prettifyError)(error)}
|
|
2639
|
-
`);
|
|
2640
|
-
}
|
|
2641
|
-
throw error;
|
|
2787
|
+
function serializeReferrerDetailResponse(response) {
|
|
2788
|
+
switch (response.responseCode) {
|
|
2789
|
+
case ReferrerDetailResponseCodes.Ok:
|
|
2790
|
+
return response;
|
|
2791
|
+
case ReferrerDetailResponseCodes.Error:
|
|
2792
|
+
return response;
|
|
2642
2793
|
}
|
|
2643
2794
|
}
|
|
2644
2795
|
|
|
2645
|
-
// src/ensapi/config/serialize.ts
|
|
2646
|
-
function serializeENSApiPublicConfig(config) {
|
|
2647
|
-
const { version, theGraphFallback, ensIndexerPublicConfig } = config;
|
|
2648
|
-
return {
|
|
2649
|
-
version,
|
|
2650
|
-
theGraphFallback,
|
|
2651
|
-
ensIndexerPublicConfig: serializeENSIndexerPublicConfig(ensIndexerPublicConfig)
|
|
2652
|
-
};
|
|
2653
|
-
}
|
|
2654
|
-
|
|
2655
2796
|
// src/client.ts
|
|
2656
2797
|
var DEFAULT_ENSNODE_API_URL = "https://api.alpha.ensnode.io";
|
|
2657
2798
|
var ENSNodeClient = class _ENSNodeClient {
|
|
@@ -2855,7 +2996,7 @@ var ENSNodeClient = class _ENSNodeClient {
|
|
|
2855
2996
|
const errorResponse = deserializeErrorResponse(responseData);
|
|
2856
2997
|
throw new Error(`Fetching ENSNode Config Failed: ${errorResponse.message}`);
|
|
2857
2998
|
}
|
|
2858
|
-
return
|
|
2999
|
+
return deserializeConfigResponse(responseData);
|
|
2859
3000
|
}
|
|
2860
3001
|
/**
|
|
2861
3002
|
* Fetch ENSNode Indexing Status
|
|
@@ -2906,7 +3047,7 @@ var ENSNodeClient = class _ENSNodeClient {
|
|
|
2906
3047
|
* @example
|
|
2907
3048
|
* ```typescript
|
|
2908
3049
|
* // Get first page with default page size (25 items)
|
|
2909
|
-
* const response = await client.
|
|
3050
|
+
* const response = await client.getReferrerLeaderboardPage();
|
|
2910
3051
|
* if (response.responseCode === ReferrerLeaderboardPageResponseCodes.Ok) {
|
|
2911
3052
|
* const {
|
|
2912
3053
|
* aggregatedMetrics,
|
|
@@ -2926,13 +3067,13 @@ var ENSNodeClient = class _ENSNodeClient {
|
|
|
2926
3067
|
* @example
|
|
2927
3068
|
* ```typescript
|
|
2928
3069
|
* // Get second page with 50 items per page
|
|
2929
|
-
* const response = await client.
|
|
3070
|
+
* const response = await client.getReferrerLeaderboardPage({ page: 2, itemsPerPage: 50 });
|
|
2930
3071
|
* ```
|
|
2931
3072
|
*
|
|
2932
3073
|
* @example
|
|
2933
3074
|
* ```typescript
|
|
2934
3075
|
* // Handle error response, ie. when Referrer Leaderboard is not currently available.
|
|
2935
|
-
* const response = await client.
|
|
3076
|
+
* const response = await client.getReferrerLeaderboardPage();
|
|
2936
3077
|
*
|
|
2937
3078
|
* if (response.responseCode === ReferrerLeaderboardPageResponseCodes.Error) {
|
|
2938
3079
|
* console.error(response.error);
|
|
@@ -2940,7 +3081,7 @@ var ENSNodeClient = class _ENSNodeClient {
|
|
|
2940
3081
|
* }
|
|
2941
3082
|
* ```
|
|
2942
3083
|
*/
|
|
2943
|
-
async
|
|
3084
|
+
async getReferrerLeaderboardPage(request) {
|
|
2944
3085
|
const url = new URL(`/ensanalytics/referrers`, this.options.url);
|
|
2945
3086
|
if (request?.page) url.searchParams.set("page", request.page.toString());
|
|
2946
3087
|
if (request?.itemsPerPage)
|
|
@@ -2956,6 +3097,96 @@ var ENSNodeClient = class _ENSNodeClient {
|
|
|
2956
3097
|
responseData
|
|
2957
3098
|
);
|
|
2958
3099
|
}
|
|
3100
|
+
/**
|
|
3101
|
+
* Fetch Referrer Detail
|
|
3102
|
+
*
|
|
3103
|
+
* Retrieves detailed information about a specific referrer, whether they are on the
|
|
3104
|
+
* leaderboard or not.
|
|
3105
|
+
*
|
|
3106
|
+
* The response data is a discriminated union type with a `type` field:
|
|
3107
|
+
*
|
|
3108
|
+
* **For referrers on the leaderboard** (`ReferrerDetailRanked`):
|
|
3109
|
+
* - `type`: {@link ReferrerDetailTypeIds.Ranked}
|
|
3110
|
+
* - `referrer`: The `AwardedReferrerMetrics` from @namehash/ens-referrals
|
|
3111
|
+
* - `rules`: The referral program rules
|
|
3112
|
+
* - `aggregatedMetrics`: Aggregated metrics for all referrers on the leaderboard
|
|
3113
|
+
* - `accurateAsOf`: Unix timestamp indicating when the data was last updated
|
|
3114
|
+
*
|
|
3115
|
+
* **For referrers NOT on the leaderboard** (`ReferrerDetailUnranked`):
|
|
3116
|
+
* - `type`: {@link ReferrerDetailTypeIds.Unranked}
|
|
3117
|
+
* - `referrer`: The `UnrankedReferrerMetrics` from @namehash/ens-referrals
|
|
3118
|
+
* - `rules`: The referral program rules
|
|
3119
|
+
* - `aggregatedMetrics`: Aggregated metrics for all referrers on the leaderboard
|
|
3120
|
+
* - `accurateAsOf`: Unix timestamp indicating when the data was last updated
|
|
3121
|
+
*
|
|
3122
|
+
* @see {@link https://www.npmjs.com/package/@namehash/ens-referrals|@namehash/ens-referrals} for calculation details
|
|
3123
|
+
*
|
|
3124
|
+
* @param request The referrer address to query
|
|
3125
|
+
* @returns {ReferrerDetailResponse} Returns the referrer detail response
|
|
3126
|
+
*
|
|
3127
|
+
* @throws if the ENSNode request fails
|
|
3128
|
+
* @throws if the response data is malformed
|
|
3129
|
+
*
|
|
3130
|
+
* @example
|
|
3131
|
+
* ```typescript
|
|
3132
|
+
* // Get referrer detail for a specific address
|
|
3133
|
+
* const response = await client.getReferrerDetail({
|
|
3134
|
+
* referrer: "0x1234567890123456789012345678901234567890"
|
|
3135
|
+
* });
|
|
3136
|
+
* if (response.responseCode === ReferrerDetailResponseCodes.Ok) {
|
|
3137
|
+
* const { type, referrer, rules, aggregatedMetrics, accurateAsOf } = response.data;
|
|
3138
|
+
* console.log(type); // ReferrerDetailTypeIds.Ranked or ReferrerDetailTypeIds.Unranked
|
|
3139
|
+
* console.log(referrer);
|
|
3140
|
+
* console.log(accurateAsOf);
|
|
3141
|
+
* }
|
|
3142
|
+
* ```
|
|
3143
|
+
*
|
|
3144
|
+
* @example
|
|
3145
|
+
* ```typescript
|
|
3146
|
+
* // Use discriminated union to check if referrer is ranked
|
|
3147
|
+
* const response = await client.getReferrerDetail({
|
|
3148
|
+
* referrer: "0x1234567890123456789012345678901234567890"
|
|
3149
|
+
* });
|
|
3150
|
+
* if (response.responseCode === ReferrerDetailResponseCodes.Ok) {
|
|
3151
|
+
* if (response.data.type === ReferrerDetailTypeIds.Ranked) {
|
|
3152
|
+
* // TypeScript knows this is ReferrerDetailRanked
|
|
3153
|
+
* console.log(`Rank: ${response.data.referrer.rank}`);
|
|
3154
|
+
* console.log(`Qualified: ${response.data.referrer.isQualified}`);
|
|
3155
|
+
* console.log(`Award Pool Share: ${response.data.referrer.awardPoolShare * 100}%`);
|
|
3156
|
+
* } else {
|
|
3157
|
+
* // TypeScript knows this is ReferrerDetailUnranked
|
|
3158
|
+
* console.log("Referrer is not on the leaderboard (no referrals yet)");
|
|
3159
|
+
* }
|
|
3160
|
+
* }
|
|
3161
|
+
* ```
|
|
3162
|
+
*
|
|
3163
|
+
* @example
|
|
3164
|
+
* ```typescript
|
|
3165
|
+
* // Handle error response, ie. when Referrer Detail is not currently available.
|
|
3166
|
+
* const response = await client.getReferrerDetail({
|
|
3167
|
+
* referrer: "0x1234567890123456789012345678901234567890"
|
|
3168
|
+
* });
|
|
3169
|
+
*
|
|
3170
|
+
* if (response.responseCode === ReferrerDetailResponseCodes.Error) {
|
|
3171
|
+
* console.error(response.error);
|
|
3172
|
+
* console.error(response.errorMessage);
|
|
3173
|
+
* }
|
|
3174
|
+
* ```
|
|
3175
|
+
*/
|
|
3176
|
+
async getReferrerDetail(request) {
|
|
3177
|
+
const url = new URL(
|
|
3178
|
+
`/api/ensanalytics/referrers/${encodeURIComponent(request.referrer)}`,
|
|
3179
|
+
this.options.url
|
|
3180
|
+
);
|
|
3181
|
+
const response = await fetch(url);
|
|
3182
|
+
let responseData;
|
|
3183
|
+
try {
|
|
3184
|
+
responseData = await response.json();
|
|
3185
|
+
} catch {
|
|
3186
|
+
throw new Error("Malformed response data: invalid JSON");
|
|
3187
|
+
}
|
|
3188
|
+
return deserializeReferrerDetailResponse(responseData);
|
|
3189
|
+
}
|
|
2959
3190
|
/**
|
|
2960
3191
|
* Fetch ENSNode Registrar Actions
|
|
2961
3192
|
*
|
|
@@ -3119,6 +3350,231 @@ var translateDefaultableChainIdToChainId = (chainId, namespaceId) => {
|
|
|
3119
3350
|
// src/resolution/resolver-records-selection.ts
|
|
3120
3351
|
var isSelectionEmpty = (selection) => !selection.name && !selection.addresses?.length && !selection.texts?.length;
|
|
3121
3352
|
|
|
3353
|
+
// src/tokenscope/assets.ts
|
|
3354
|
+
var import_caip3 = require("caip");
|
|
3355
|
+
var import_viem15 = require("viem");
|
|
3356
|
+
var AssetNamespaces = {
|
|
3357
|
+
ERC721: "erc721",
|
|
3358
|
+
ERC1155: "erc1155"
|
|
3359
|
+
};
|
|
3360
|
+
function serializeAssetId(assetId) {
|
|
3361
|
+
const { assetNamespace, contract, tokenId } = assetId;
|
|
3362
|
+
return import_caip3.AssetId.format({
|
|
3363
|
+
chainId: { namespace: "eip155", reference: contract.chainId.toString() },
|
|
3364
|
+
assetName: { namespace: assetNamespace, reference: contract.address },
|
|
3365
|
+
tokenId: uint256ToHex32(tokenId)
|
|
3366
|
+
}).toLowerCase();
|
|
3367
|
+
}
|
|
3368
|
+
var buildAssetId = (contract, tokenId, assetNamespace) => {
|
|
3369
|
+
return {
|
|
3370
|
+
assetNamespace,
|
|
3371
|
+
contract,
|
|
3372
|
+
tokenId
|
|
3373
|
+
};
|
|
3374
|
+
};
|
|
3375
|
+
var NFTMintStatuses = {
|
|
3376
|
+
Minted: "minted",
|
|
3377
|
+
Burned: "burned"
|
|
3378
|
+
};
|
|
3379
|
+
var formatNFTTransferEventMetadata = (metadata) => {
|
|
3380
|
+
const serializedAssetId = serializeAssetId(metadata.nft);
|
|
3381
|
+
return [
|
|
3382
|
+
`Event: ${metadata.eventHandlerName}`,
|
|
3383
|
+
`Chain ID: ${metadata.chainId}`,
|
|
3384
|
+
`Block Number: ${metadata.blockNumber}`,
|
|
3385
|
+
`Transaction Hash: ${metadata.transactionHash}`,
|
|
3386
|
+
`NFT: ${serializedAssetId}`
|
|
3387
|
+
].map((line) => ` - ${line}`).join("\n");
|
|
3388
|
+
};
|
|
3389
|
+
var NFTTransferTypes = {
|
|
3390
|
+
/**
|
|
3391
|
+
* Initial transfer from zeroAddress to a non-zeroAddress
|
|
3392
|
+
* Can happen at most once to a NFT AssetId
|
|
3393
|
+
*
|
|
3394
|
+
* Invariants:
|
|
3395
|
+
* - NFT is not indexed and therefore has no previous mint status or owner
|
|
3396
|
+
* - new NFT mint status is `minted`
|
|
3397
|
+
* - new NFT owner is a non-zeroAddress
|
|
3398
|
+
*/
|
|
3399
|
+
Mint: "mint",
|
|
3400
|
+
/**
|
|
3401
|
+
* Subsequent transfer from zeroAddress to a non-zeroAddress
|
|
3402
|
+
* Can happen any number of times to a NFT AssetId as it passes in a cycle from
|
|
3403
|
+
* mint -> burn -> remint -> burn -> remint -> ...
|
|
3404
|
+
*
|
|
3405
|
+
* Invariants:
|
|
3406
|
+
* - NFT is indexed
|
|
3407
|
+
* - previous NFT mint status was `burned`
|
|
3408
|
+
* - previous NFT owner is the zeroAddress
|
|
3409
|
+
* - new NFT mint status is `minted`
|
|
3410
|
+
* - new NFT owner is a non-zeroAddress
|
|
3411
|
+
*/
|
|
3412
|
+
Remint: "remint",
|
|
3413
|
+
/**
|
|
3414
|
+
* Special transfer type for improperly implemented NFT contracts that allow a NFT
|
|
3415
|
+
* that is currently minted to be reminted before an intermediate burn.
|
|
3416
|
+
*
|
|
3417
|
+
* Transfer from zeroAddress to non-zeroAddress for an indexed NFT where the
|
|
3418
|
+
* previously indexed nft had status `minted` with a non-zeroAddress owner.
|
|
3419
|
+
*
|
|
3420
|
+
* Invariants:
|
|
3421
|
+
* - NFT is indexed
|
|
3422
|
+
* - previous NFT mint status was `minted`
|
|
3423
|
+
* - previous NFT owner was a non-zeroAddress
|
|
3424
|
+
* - new NFT mint status is `minted`
|
|
3425
|
+
* - new NFT owner is a non-zeroAddress
|
|
3426
|
+
*/
|
|
3427
|
+
MintedRemint: "minted-remint",
|
|
3428
|
+
/**
|
|
3429
|
+
* Transfer from a non-zeroAddress to zeroAddress
|
|
3430
|
+
*
|
|
3431
|
+
* Invariants:
|
|
3432
|
+
* - NFT is indexed
|
|
3433
|
+
* - previous NFT mint status was `minted`
|
|
3434
|
+
* - previous NFT owner is a non-zeroAddress
|
|
3435
|
+
* - new NFT mint status is `burned`
|
|
3436
|
+
* - new NFT owner is the zeroAddress
|
|
3437
|
+
*/
|
|
3438
|
+
Burn: "burn",
|
|
3439
|
+
/**
|
|
3440
|
+
* Transfer from a non-zeroAddress to a distinct non-zeroAddress
|
|
3441
|
+
*
|
|
3442
|
+
* Invariants:
|
|
3443
|
+
* - NFT is indexed
|
|
3444
|
+
* - previous and new NFT mint status is `minted`
|
|
3445
|
+
* - previous and new NFT owner are distinct non-zeroAddress
|
|
3446
|
+
*/
|
|
3447
|
+
Transfer: "transfer",
|
|
3448
|
+
/**
|
|
3449
|
+
* Transfer from a non-zeroAddress to the same non-zeroAddress
|
|
3450
|
+
*
|
|
3451
|
+
* Invariants:
|
|
3452
|
+
* - NFT is indexed
|
|
3453
|
+
* - previous and new NFT mint status is `minted`
|
|
3454
|
+
* - previous and new NFT owner are equivalent non-zeroAddress
|
|
3455
|
+
*/
|
|
3456
|
+
SelfTransfer: "self-transfer",
|
|
3457
|
+
/**
|
|
3458
|
+
* Transfer from zeroAddress to zeroAddress for an indexed NFT
|
|
3459
|
+
*
|
|
3460
|
+
* Invariants:
|
|
3461
|
+
* - NFT is indexed
|
|
3462
|
+
* - previous and new NFT mint status is `burned`
|
|
3463
|
+
* - previous and new NFT owner are zeroAddress
|
|
3464
|
+
*/
|
|
3465
|
+
RemintBurn: "remint-burn",
|
|
3466
|
+
/**
|
|
3467
|
+
* Special transfer type for improperly implemented NFT contracts that allow a NFT
|
|
3468
|
+
* that is currently minted to be reminted again before an intermediate burn.
|
|
3469
|
+
*
|
|
3470
|
+
* Transfer from zeroAddress to zeroAddress for an indexed NFT where the
|
|
3471
|
+
* previously indexed nft had status `minted` with a non-zeroAddress owner.
|
|
3472
|
+
*
|
|
3473
|
+
* Invariants:
|
|
3474
|
+
* - NFT is indexed
|
|
3475
|
+
* - previous NFT mint status was `minted`
|
|
3476
|
+
* - previous NFT owner was a non-zeroAddress
|
|
3477
|
+
* - new NFT mint status is `burned`
|
|
3478
|
+
* - new NFT owner is the zeroAddress
|
|
3479
|
+
*/
|
|
3480
|
+
MintedRemintBurn: "minted-remint-burn",
|
|
3481
|
+
/**
|
|
3482
|
+
* Transfer from zeroAddress to zeroAddress for an unindexed NFT
|
|
3483
|
+
*
|
|
3484
|
+
* Invariants:
|
|
3485
|
+
* - NFT is not indexed and therefore has no previous mint status or owner
|
|
3486
|
+
* - NFT should remain unindexed and without any mint status or owner
|
|
3487
|
+
*/
|
|
3488
|
+
MintBurn: "mint-burn"
|
|
3489
|
+
};
|
|
3490
|
+
var getNFTTransferType = (from, to, allowMintedRemint, metadata, currentlyIndexedOwner) => {
|
|
3491
|
+
const isIndexed = currentlyIndexedOwner !== void 0;
|
|
3492
|
+
const isIndexedAsMinted = isIndexed && !(0, import_viem15.isAddressEqual)(currentlyIndexedOwner, import_viem15.zeroAddress);
|
|
3493
|
+
const isMint = (0, import_viem15.isAddressEqual)(from, import_viem15.zeroAddress);
|
|
3494
|
+
const isBurn = (0, import_viem15.isAddressEqual)(to, import_viem15.zeroAddress);
|
|
3495
|
+
const isSelfTransfer = (0, import_viem15.isAddressEqual)(from, to);
|
|
3496
|
+
if (isIndexed && !(0, import_viem15.isAddressEqual)(currentlyIndexedOwner, from)) {
|
|
3497
|
+
if (isMint && allowMintedRemint) {
|
|
3498
|
+
} else {
|
|
3499
|
+
throw new Error(
|
|
3500
|
+
`Error: Sending from ${from} conflicts with currently indexed owner ${currentlyIndexedOwner}.
|
|
3501
|
+
${formatNFTTransferEventMetadata(metadata)}`
|
|
3502
|
+
);
|
|
3503
|
+
}
|
|
3504
|
+
}
|
|
3505
|
+
if (isSelfTransfer) {
|
|
3506
|
+
if (isMint) {
|
|
3507
|
+
if (!isIndexed) {
|
|
3508
|
+
return NFTTransferTypes.MintBurn;
|
|
3509
|
+
} else if (!isIndexedAsMinted) {
|
|
3510
|
+
return NFTTransferTypes.RemintBurn;
|
|
3511
|
+
} else if (allowMintedRemint) {
|
|
3512
|
+
return NFTTransferTypes.MintedRemintBurn;
|
|
3513
|
+
} else {
|
|
3514
|
+
throw new Error(
|
|
3515
|
+
`Error: Invalid state transition from minted -> remint-burn
|
|
3516
|
+
${formatNFTTransferEventMetadata(metadata)}`
|
|
3517
|
+
);
|
|
3518
|
+
}
|
|
3519
|
+
} else {
|
|
3520
|
+
if (!isIndexed) {
|
|
3521
|
+
throw new Error(
|
|
3522
|
+
`Error: Invalid state transition from unindexed -> self-transfer
|
|
3523
|
+
${formatNFTTransferEventMetadata(metadata)}`
|
|
3524
|
+
);
|
|
3525
|
+
} else if (!isIndexedAsMinted) {
|
|
3526
|
+
throw new Error(
|
|
3527
|
+
`Error: invalid state transition from burned -> self-transfer
|
|
3528
|
+
${formatNFTTransferEventMetadata(metadata)}`
|
|
3529
|
+
);
|
|
3530
|
+
} else {
|
|
3531
|
+
return NFTTransferTypes.SelfTransfer;
|
|
3532
|
+
}
|
|
3533
|
+
}
|
|
3534
|
+
} else if (isMint) {
|
|
3535
|
+
if (!isIndexed) {
|
|
3536
|
+
return NFTTransferTypes.Mint;
|
|
3537
|
+
} else if (!isIndexedAsMinted) {
|
|
3538
|
+
return NFTTransferTypes.Remint;
|
|
3539
|
+
} else if (allowMintedRemint) {
|
|
3540
|
+
return NFTTransferTypes.MintedRemint;
|
|
3541
|
+
} else {
|
|
3542
|
+
throw new Error(
|
|
3543
|
+
`Error: Invalid state transition from minted -> mint
|
|
3544
|
+
${formatNFTTransferEventMetadata(metadata)}`
|
|
3545
|
+
);
|
|
3546
|
+
}
|
|
3547
|
+
} else if (isBurn) {
|
|
3548
|
+
if (!isIndexed) {
|
|
3549
|
+
throw new Error(
|
|
3550
|
+
`Error: Invalid state transition from unindexed -> burn
|
|
3551
|
+
${formatNFTTransferEventMetadata(metadata)}`
|
|
3552
|
+
);
|
|
3553
|
+
} else if (!isIndexedAsMinted) {
|
|
3554
|
+
throw new Error(
|
|
3555
|
+
`Error: Invalid state transition from burned -> burn
|
|
3556
|
+
${formatNFTTransferEventMetadata(metadata)}`
|
|
3557
|
+
);
|
|
3558
|
+
} else {
|
|
3559
|
+
return NFTTransferTypes.Burn;
|
|
3560
|
+
}
|
|
3561
|
+
} else {
|
|
3562
|
+
if (!isIndexed) {
|
|
3563
|
+
throw new Error(
|
|
3564
|
+
`Error: Invalid state transition from unindexed -> transfer
|
|
3565
|
+
${formatNFTTransferEventMetadata(metadata)}`
|
|
3566
|
+
);
|
|
3567
|
+
} else if (!isIndexedAsMinted) {
|
|
3568
|
+
throw new Error(
|
|
3569
|
+
`Error: Invalid state transition from burned -> transfer
|
|
3570
|
+
${formatNFTTransferEventMetadata(metadata)}`
|
|
3571
|
+
);
|
|
3572
|
+
} else {
|
|
3573
|
+
return NFTTransferTypes.Transfer;
|
|
3574
|
+
}
|
|
3575
|
+
}
|
|
3576
|
+
};
|
|
3577
|
+
|
|
3122
3578
|
// src/tracing/index.ts
|
|
3123
3579
|
var TraceableENSProtocol = /* @__PURE__ */ ((TraceableENSProtocol2) => {
|
|
3124
3580
|
TraceableENSProtocol2["ForwardResolution"] = "forward-resolution";
|