@ensnode/ensnode-sdk 1.9.0 → 1.10.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/README.md +16 -26
- package/dist/index.cjs +877 -1222
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1477 -2240
- package/dist/index.d.ts +1477 -2240
- package/dist/index.js +861 -1205
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -30,39 +30,28 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
-
ADDR_REVERSE_NODE: () => ADDR_REVERSE_NODE,
|
|
34
33
|
ATTR_PROTOCOL_NAME: () => ATTR_PROTOCOL_NAME,
|
|
35
34
|
ATTR_PROTOCOL_STEP: () => ATTR_PROTOCOL_STEP,
|
|
36
35
|
ATTR_PROTOCOL_STEP_RESULT: () => ATTR_PROTOCOL_STEP_RESULT,
|
|
37
|
-
AssetNamespaces: () => AssetNamespaces,
|
|
38
|
-
BASENAMES_NODE: () => BASENAMES_NODE,
|
|
39
36
|
ChainIndexingStatusIds: () => ChainIndexingStatusIds,
|
|
40
37
|
ClientError: () => ClientError,
|
|
41
38
|
CrossChainIndexingStrategyIds: () => CrossChainIndexingStrategyIds,
|
|
42
39
|
CurrencyIds: () => CurrencyIds,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
DEFAULT_EVM_CHAIN_ID: () => DEFAULT_EVM_CHAIN_ID,
|
|
46
|
-
DEFAULT_EVM_COIN_TYPE: () => DEFAULT_EVM_COIN_TYPE,
|
|
40
|
+
DEFAULT_ENSNODE_URL_MAINNET: () => DEFAULT_ENSNODE_URL_MAINNET,
|
|
41
|
+
DEFAULT_ENSNODE_URL_SEPOLIA: () => DEFAULT_ENSNODE_URL_SEPOLIA,
|
|
47
42
|
ENCODED_REFERRER_BYTE_LENGTH: () => ENCODED_REFERRER_BYTE_LENGTH,
|
|
48
43
|
ENCODED_REFERRER_BYTE_OFFSET: () => ENCODED_REFERRER_BYTE_OFFSET,
|
|
49
|
-
ENSNamespaceIds: () =>
|
|
50
|
-
ENSNodeClient: () => ENSNodeClient,
|
|
51
|
-
ENS_ROOT: () => ENS_ROOT,
|
|
52
|
-
ETH_COIN_TYPE: () => ETH_COIN_TYPE,
|
|
53
|
-
ETH_NODE: () => ETH_NODE,
|
|
44
|
+
ENSNamespaceIds: () => import_datasources13.ENSNamespaceIds,
|
|
54
45
|
EXPECTED_ENCODED_REFERRER_PADDING: () => EXPECTED_ENCODED_REFERRER_PADDING,
|
|
55
|
-
EnsApiClient: () => EnsApiClient,
|
|
56
46
|
EnsApiIndexingStatusResponseCodes: () => EnsApiIndexingStatusResponseCodes,
|
|
57
47
|
EnsIndexerClient: () => EnsIndexerClient,
|
|
58
48
|
EnsIndexerIndexingStatusResponseCodes: () => EnsIndexerIndexingStatusResponseCodes,
|
|
49
|
+
EnsNodeClient: () => EnsNodeClient,
|
|
59
50
|
ForwardResolutionProtocolStep: () => ForwardResolutionProtocolStep,
|
|
60
51
|
IndexingStatusResponseCodes: () => IndexingStatusResponseCodes,
|
|
61
|
-
LINEANAMES_NODE: () => LINEANAMES_NODE,
|
|
62
52
|
LruCache: () => LruCache,
|
|
63
53
|
NFTMintStatuses: () => NFTMintStatuses,
|
|
64
54
|
NFTTransferTypes: () => NFTTransferTypes,
|
|
65
|
-
NODE_ANY: () => NODE_ANY,
|
|
66
55
|
NameTokenOwnershipTypes: () => NameTokenOwnershipTypes,
|
|
67
56
|
NameTokensResponseCodes: () => NameTokensResponseCodes,
|
|
68
57
|
NameTokensResponseErrorCodes: () => NameTokensResponseErrorCodes,
|
|
@@ -71,8 +60,6 @@ __export(index_exports, {
|
|
|
71
60
|
PluginName: () => PluginName,
|
|
72
61
|
RECORDS_PER_PAGE_DEFAULT: () => RECORDS_PER_PAGE_DEFAULT,
|
|
73
62
|
RECORDS_PER_PAGE_MAX: () => RECORDS_PER_PAGE_MAX,
|
|
74
|
-
ROOT_NODE: () => ROOT_NODE,
|
|
75
|
-
ROOT_RESOURCE: () => ROOT_RESOURCE,
|
|
76
63
|
RangeTypeIds: () => RangeTypeIds,
|
|
77
64
|
RegistrarActionTypes: () => RegistrarActionTypes,
|
|
78
65
|
RegistrarActionsFilterTypes: () => RegistrarActionsFilterTypes,
|
|
@@ -89,16 +76,13 @@ __export(index_exports, {
|
|
|
89
76
|
accountIdEqual: () => accountIdEqual,
|
|
90
77
|
addDuration: () => addDuration,
|
|
91
78
|
addPrices: () => addPrices,
|
|
92
|
-
addrReverseLabel: () => addrReverseLabel,
|
|
93
|
-
asLowerCaseAddress: () => asLowerCaseAddress,
|
|
94
|
-
beautifyName: () => beautifyName,
|
|
95
79
|
bigIntToNumber: () => bigIntToNumber,
|
|
96
|
-
bigintToCoinType: () => bigintToCoinType,
|
|
97
80
|
buildAssetId: () => buildAssetId,
|
|
98
81
|
buildBlockNumberRange: () => buildBlockNumberRange,
|
|
99
82
|
buildBlockRefRange: () => buildBlockRefRange,
|
|
100
83
|
buildCrossChainIndexingStatusSnapshotOmnichain: () => buildCrossChainIndexingStatusSnapshotOmnichain,
|
|
101
84
|
buildEncodedReferrer: () => buildEncodedReferrer,
|
|
85
|
+
buildEnsNodeStackInfo: () => buildEnsNodeStackInfo,
|
|
102
86
|
buildEnsRainbowClientLabelSet: () => buildEnsRainbowClientLabelSet,
|
|
103
87
|
buildIndexedBlockranges: () => buildIndexedBlockranges,
|
|
104
88
|
buildLabelSetId: () => buildLabelSetId,
|
|
@@ -107,38 +91,34 @@ __export(index_exports, {
|
|
|
107
91
|
buildPageContext: () => buildPageContext,
|
|
108
92
|
buildUnresolvedIdentity: () => buildUnresolvedIdentity,
|
|
109
93
|
buildUnvalidatedCrossChainIndexingStatusSnapshot: () => buildUnvalidatedCrossChainIndexingStatusSnapshot,
|
|
94
|
+
buildUnvalidatedEnsApiPublicConfig: () => buildUnvalidatedEnsApiPublicConfig,
|
|
110
95
|
buildUnvalidatedEnsIndexerPublicConfig: () => buildUnvalidatedEnsIndexerPublicConfig,
|
|
96
|
+
buildUnvalidatedEnsNodeStackInfo: () => buildUnvalidatedEnsNodeStackInfo,
|
|
111
97
|
buildUnvalidatedOmnichainIndexingStatusSnapshot: () => buildUnvalidatedOmnichainIndexingStatusSnapshot,
|
|
112
98
|
buildUnvalidatedRealtimeIndexingStatusProjection: () => buildUnvalidatedRealtimeIndexingStatusProjection,
|
|
113
99
|
checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill: () => checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill,
|
|
114
100
|
checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted: () => checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted,
|
|
115
101
|
checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing: () => checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing,
|
|
116
102
|
checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted: () => checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted,
|
|
117
|
-
coinTypeReverseLabel: () => coinTypeReverseLabel,
|
|
118
|
-
coinTypeToEvmChainId: () => coinTypeToEvmChainId,
|
|
119
|
-
constructSubInterpretedName: () => constructSubInterpretedName,
|
|
120
103
|
createRealtimeIndexingStatusProjection: () => createRealtimeIndexingStatusProjection,
|
|
121
|
-
decodeDNSEncodedLiteralName: () => decodeDNSEncodedLiteralName,
|
|
122
|
-
decodeDNSEncodedName: () => decodeDNSEncodedName,
|
|
123
104
|
decodeEncodedReferrer: () => decodeEncodedReferrer,
|
|
124
105
|
deserializeAssetId: () => deserializeAssetId,
|
|
125
106
|
deserializeBlockNumber: () => deserializeBlockNumber,
|
|
126
107
|
deserializeBlockRef: () => deserializeBlockRef,
|
|
127
108
|
deserializeChainId: () => deserializeChainId,
|
|
128
109
|
deserializeChainIndexingStatusSnapshot: () => deserializeChainIndexingStatusSnapshot,
|
|
129
|
-
deserializeConfigResponse: () => deserializeConfigResponse,
|
|
130
110
|
deserializeCrossChainIndexingStatusSnapshot: () => deserializeCrossChainIndexingStatusSnapshot,
|
|
131
111
|
deserializeDatetime: () => deserializeDatetime,
|
|
132
112
|
deserializeDuration: () => deserializeDuration,
|
|
133
113
|
deserializeENSApiPublicConfig: () => deserializeENSApiPublicConfig,
|
|
134
114
|
deserializeENSIndexerPublicConfig: () => deserializeENSIndexerPublicConfig,
|
|
135
|
-
deserializeEnsApiConfigResponse: () => deserializeEnsApiConfigResponse,
|
|
136
115
|
deserializeEnsApiIndexingStatusResponse: () => deserializeEnsApiIndexingStatusResponse,
|
|
137
116
|
deserializeEnsApiPublicConfig: () => deserializeEnsApiPublicConfig,
|
|
138
117
|
deserializeEnsIndexerConfigResponse: () => deserializeEnsIndexerConfigResponse,
|
|
139
118
|
deserializeEnsIndexerIndexingStatusResponse: () => deserializeEnsIndexerIndexingStatusResponse,
|
|
140
119
|
deserializeEnsIndexerPublicConfig: () => deserializeEnsIndexerPublicConfig,
|
|
141
|
-
|
|
120
|
+
deserializeEnsNodeStackInfo: () => deserializeEnsNodeStackInfo,
|
|
121
|
+
deserializeErrorResponse: () => deserializeErrorResponse2,
|
|
142
122
|
deserializeIndexingStatusResponse: () => deserializeIndexingStatusResponse,
|
|
143
123
|
deserializeOmnichainIndexingStatusSnapshot: () => deserializeOmnichainIndexingStatusSnapshot,
|
|
144
124
|
deserializePriceDai: () => deserializePriceDai,
|
|
@@ -150,20 +130,13 @@ __export(index_exports, {
|
|
|
150
130
|
deserializeUrl: () => deserializeUrl,
|
|
151
131
|
deserializedNameTokensResponse: () => deserializedNameTokensResponse,
|
|
152
132
|
durationBetween: () => durationBetween,
|
|
153
|
-
encodeLabelHash: () => encodeLabelHash,
|
|
154
|
-
encodedLabelToLabelhash: () => encodedLabelToLabelhash,
|
|
155
|
-
ensureInterpretedLabel: () => ensureInterpretedLabel,
|
|
156
|
-
evmChainIdToCoinType: () => evmChainIdToCoinType,
|
|
157
|
-
formatAccountId: () => formatAccountId,
|
|
158
|
-
formatAssetId: () => formatAssetId,
|
|
159
133
|
formatNFTTransferEventMetadata: () => formatNFTTransferEventMetadata,
|
|
160
134
|
getBasenamesSubregistryId: () => getBasenamesSubregistryId,
|
|
161
135
|
getBasenamesSubregistryManagedName: () => getBasenamesSubregistryManagedName,
|
|
162
|
-
getCanonicalId: () => getCanonicalId,
|
|
163
136
|
getCurrencyInfo: () => getCurrencyInfo,
|
|
164
137
|
getDatasourceContract: () => getDatasourceContract,
|
|
165
138
|
getDefaultEnsNodeUrl: () => getDefaultEnsNodeUrl,
|
|
166
|
-
getENSRootChainId: () =>
|
|
139
|
+
getENSRootChainId: () => import_datasources.getENSRootChainId,
|
|
167
140
|
getENSv1Registry: () => getENSv1Registry,
|
|
168
141
|
getENSv2RootRegistry: () => getENSv2RootRegistry,
|
|
169
142
|
getENSv2RootRegistryId: () => getENSv2RootRegistryId,
|
|
@@ -174,40 +147,30 @@ __export(index_exports, {
|
|
|
174
147
|
getLineanamesSubregistryId: () => getLineanamesSubregistryId,
|
|
175
148
|
getLineanamesSubregistryManagedName: () => getLineanamesSubregistryManagedName,
|
|
176
149
|
getNFTTransferType: () => getNFTTransferType,
|
|
177
|
-
getNameHierarchy: () => getNameHierarchy,
|
|
178
150
|
getNameTokenOwnership: () => getNameTokenOwnership,
|
|
179
151
|
getNameWrapperAccounts: () => getNameWrapperAccounts,
|
|
180
152
|
getNamespaceSpecificValue: () => getNamespaceSpecificValue,
|
|
181
153
|
getOmnichainIndexingCursor: () => getOmnichainIndexingCursor,
|
|
182
154
|
getOmnichainIndexingStatus: () => getOmnichainIndexingStatus,
|
|
183
|
-
getParentNameFQDN: () => getParentNameFQDN,
|
|
184
155
|
getResolvePrimaryNameChainIdParam: () => getResolvePrimaryNameChainIdParam,
|
|
185
156
|
getTimestampForHighestOmnichainKnownBlock: () => getTimestampForHighestOmnichainKnownBlock,
|
|
186
157
|
getTimestampForLowestOmnichainStartBlock: () => getTimestampForLowestOmnichainStartBlock,
|
|
187
|
-
hasGraphqlApiConfigSupport: () => hasGraphqlApiConfigSupport,
|
|
188
158
|
hasNullByte: () => hasNullByte,
|
|
159
|
+
hasOmnigraphApiConfigSupport: () => hasOmnigraphApiConfigSupport,
|
|
189
160
|
hasRegistrarActionsConfigSupport: () => hasRegistrarActionsConfigSupport,
|
|
190
161
|
hasRegistrarActionsIndexingStatusSupport: () => hasRegistrarActionsIndexingStatusSupport,
|
|
191
162
|
hasSubgraphApiConfigSupport: () => hasSubgraphApiConfigSupport,
|
|
192
163
|
interpretAddress: () => interpretAddress,
|
|
193
164
|
interpretAddressRecordValue: () => interpretAddressRecordValue,
|
|
165
|
+
interpretContenthashValue: () => interpretContenthashValue,
|
|
166
|
+
interpretDnszonehashValue: () => interpretDnszonehashValue,
|
|
194
167
|
interpretNameRecordValue: () => interpretNameRecordValue,
|
|
168
|
+
interpretPubkeyValue: () => interpretPubkeyValue,
|
|
195
169
|
interpretTextRecordKey: () => interpretTextRecordKey,
|
|
196
170
|
interpretTextRecordValue: () => interpretTextRecordValue,
|
|
197
|
-
interpretTokenIdAsLabelHash: () => interpretTokenIdAsLabelHash,
|
|
198
|
-
interpretTokenIdAsNode: () => interpretTokenIdAsNode,
|
|
199
|
-
interpretedLabelsToInterpretedName: () => interpretedLabelsToInterpretedName,
|
|
200
|
-
interpretedLabelsToLabelHashPath: () => interpretedLabelsToLabelHashPath,
|
|
201
|
-
interpretedNameToInterpretedLabels: () => interpretedNameToInterpretedLabels,
|
|
202
171
|
isENSv1Registry: () => isENSv1Registry,
|
|
203
172
|
isENSv2RootRegistry: () => isENSv2RootRegistry,
|
|
204
|
-
isEncodedLabelHash: () => isEncodedLabelHash,
|
|
205
173
|
isHttpProtocol: () => isHttpProtocol,
|
|
206
|
-
isInterpetedLabel: () => isInterpetedLabel,
|
|
207
|
-
isInterpretedName: () => isInterpretedName,
|
|
208
|
-
isLabelHash: () => isLabelHash,
|
|
209
|
-
isNormalizedLabel: () => isNormalizedLabel,
|
|
210
|
-
isNormalizedName: () => isNormalizedName,
|
|
211
174
|
isPccFuseSet: () => isPccFuseSet,
|
|
212
175
|
isPriceCurrencyEqual: () => isPriceCurrencyEqual,
|
|
213
176
|
isPriceEqual: () => isPriceEqual,
|
|
@@ -221,25 +184,10 @@ __export(index_exports, {
|
|
|
221
184
|
isSubgraphCompatible: () => isSubgraphCompatible,
|
|
222
185
|
isWebSocketProtocol: () => isWebSocketProtocol,
|
|
223
186
|
labelHashToBytes: () => labelHashToBytes,
|
|
224
|
-
labelhashLiteralLabel: () => labelhashLiteralLabel,
|
|
225
|
-
literalLabelToInterpretedLabel: () => literalLabelToInterpretedLabel,
|
|
226
|
-
literalLabelsToInterpretedName: () => literalLabelsToInterpretedName,
|
|
227
|
-
literalLabelsToLiteralName: () => literalLabelsToLiteralName,
|
|
228
187
|
makeContractMatcher: () => makeContractMatcher,
|
|
229
188
|
makeENSApiPublicConfigSchema: () => makeENSApiPublicConfigSchema,
|
|
230
|
-
makeENSv1DomainId: () => makeENSv1DomainId,
|
|
231
|
-
makeENSv2DomainId: () => makeENSv2DomainId,
|
|
232
189
|
makeEnsApiPublicConfigSchema: () => makeEnsApiPublicConfigSchema,
|
|
233
|
-
makePermissionsId: () => makePermissionsId,
|
|
234
|
-
makePermissionsResourceId: () => makePermissionsResourceId,
|
|
235
|
-
makePermissionsUserId: () => makePermissionsUserId,
|
|
236
|
-
makeRegistrationId: () => makeRegistrationId,
|
|
237
|
-
makeRegistryId: () => makeRegistryId,
|
|
238
|
-
makeRenewalId: () => makeRenewalId,
|
|
239
|
-
makeResolverId: () => makeResolverId,
|
|
240
|
-
makeResolverRecordsId: () => makeResolverRecordsId,
|
|
241
190
|
makeSerializedEnsApiPublicConfigSchema: () => makeSerializedEnsApiPublicConfigSchema,
|
|
242
|
-
makeSubdomainNode: () => makeSubdomainNode,
|
|
243
191
|
maybeGetDatasourceContract: () => maybeGetDatasourceContract,
|
|
244
192
|
maybeGetENSv2RootRegistry: () => maybeGetENSv2RootRegistry,
|
|
245
193
|
maybeGetENSv2RootRegistryId: () => maybeGetENSv2RootRegistryId,
|
|
@@ -248,38 +196,31 @@ __export(index_exports, {
|
|
|
248
196
|
parseAccountId: () => parseAccountId,
|
|
249
197
|
parseAssetId: () => parseAssetId,
|
|
250
198
|
parseDai: () => parseDai,
|
|
251
|
-
parseEncodedLabelHash: () => parseEncodedLabelHash,
|
|
252
199
|
parseEth: () => parseEth,
|
|
253
|
-
parseLabelHash: () => parseLabelHash,
|
|
254
|
-
parseLabelHashOrEncodedLabelHash: () => parseLabelHashOrEncodedLabelHash,
|
|
255
200
|
parseNonNegativeInteger: () => parseNonNegativeInteger,
|
|
256
|
-
parsePartialInterpretedName: () => parsePartialInterpretedName,
|
|
257
|
-
parseReverseName: () => parseReverseName,
|
|
258
201
|
parseTimestamp: () => parseTimestamp,
|
|
259
202
|
parseUsdc: () => parseUsdc,
|
|
260
203
|
priceDai: () => priceDai,
|
|
261
204
|
priceEth: () => priceEth,
|
|
262
205
|
priceUsdc: () => priceUsdc,
|
|
263
206
|
registrarActionsFilter: () => registrarActionsFilter,
|
|
264
|
-
reverseName: () => reverseName,
|
|
265
207
|
scaleBigintByNumber: () => scaleBigintByNumber,
|
|
266
208
|
scalePrice: () => scalePrice,
|
|
267
209
|
serializeAssetId: () => serializeAssetId,
|
|
268
210
|
serializeChainId: () => serializeChainId,
|
|
269
211
|
serializeChainIndexingSnapshots: () => serializeChainIndexingSnapshots,
|
|
270
|
-
serializeConfigResponse: () => serializeConfigResponse,
|
|
271
212
|
serializeCrossChainIndexingStatusSnapshot: () => serializeCrossChainIndexingStatusSnapshot,
|
|
272
213
|
serializeCrossChainIndexingStatusSnapshotOmnichain: () => serializeCrossChainIndexingStatusSnapshotOmnichain,
|
|
273
214
|
serializeDatetime: () => serializeDatetime,
|
|
274
215
|
serializeDomainAssetId: () => serializeDomainAssetId,
|
|
275
216
|
serializeENSApiPublicConfig: () => serializeENSApiPublicConfig,
|
|
276
217
|
serializeENSIndexerPublicConfig: () => serializeENSIndexerPublicConfig,
|
|
277
|
-
serializeEnsApiConfigResponse: () => serializeEnsApiConfigResponse,
|
|
278
218
|
serializeEnsApiIndexingStatusResponse: () => serializeEnsApiIndexingStatusResponse,
|
|
279
219
|
serializeEnsApiPublicConfig: () => serializeEnsApiPublicConfig,
|
|
280
220
|
serializeEnsIndexerConfigResponse: () => serializeEnsIndexerConfigResponse,
|
|
281
221
|
serializeEnsIndexerIndexingStatusResponse: () => serializeEnsIndexerIndexingStatusResponse,
|
|
282
222
|
serializeEnsIndexerPublicConfig: () => serializeEnsIndexerPublicConfig,
|
|
223
|
+
serializeEnsNodeStackInfo: () => serializeEnsNodeStackInfo,
|
|
283
224
|
serializeIndexedChainIds: () => serializeIndexedChainIds,
|
|
284
225
|
serializeIndexingStatusResponse: () => serializeIndexingStatusResponse,
|
|
285
226
|
serializeNameToken: () => serializeNameToken,
|
|
@@ -299,7 +240,6 @@ __export(index_exports, {
|
|
|
299
240
|
sortChainStatusesByStartBlockAsc: () => sortChainStatusesByStartBlockAsc,
|
|
300
241
|
stripNullBytes: () => stripNullBytes,
|
|
301
242
|
translateDefaultableChainIdToChainId: () => translateDefaultableChainIdToChainId,
|
|
302
|
-
uint256ToHex32: () => uint256ToHex32,
|
|
303
243
|
uniq: () => uniq,
|
|
304
244
|
validateChainIndexingStatusSnapshot: () => validateChainIndexingStatusSnapshot,
|
|
305
245
|
validateCrossChainIndexingStatusSnapshot: () => validateCrossChainIndexingStatusSnapshot,
|
|
@@ -311,229 +251,15 @@ __export(index_exports, {
|
|
|
311
251
|
validateSupportedLabelSetAndVersion: () => validateSupportedLabelSetAndVersion
|
|
312
252
|
});
|
|
313
253
|
module.exports = __toCommonJS(index_exports);
|
|
254
|
+
var import_datasources13 = require("@ensnode/datasources");
|
|
314
255
|
|
|
315
256
|
// src/ens/index.ts
|
|
316
|
-
var
|
|
317
|
-
|
|
318
|
-
// src/ens/coin-type.ts
|
|
319
|
-
var import_utils = require("@ensdomains/address-encoder/utils");
|
|
320
|
-
var ETH_COIN_TYPE = 60;
|
|
321
|
-
var DEFAULT_EVM_CHAIN_ID = 0;
|
|
322
|
-
var DEFAULT_EVM_COIN_TYPE = 2147483648;
|
|
323
|
-
var coinTypeToEvmChainId = (coinType) => {
|
|
324
|
-
if (coinType === ETH_COIN_TYPE) return 1;
|
|
325
|
-
return (0, import_utils.coinTypeToEvmChainId)(coinType);
|
|
326
|
-
};
|
|
327
|
-
var evmChainIdToCoinType = (chainId) => {
|
|
328
|
-
if (chainId === 1) return ETH_COIN_TYPE;
|
|
329
|
-
return (0, import_utils.evmChainIdToCoinType)(chainId);
|
|
330
|
-
};
|
|
331
|
-
var bigintToCoinType = (value) => {
|
|
332
|
-
if (value > BigInt(Number.MAX_SAFE_INTEGER)) {
|
|
333
|
-
throw new Error(`'${value}' cannot represent as CoinType, it is too large.`);
|
|
334
|
-
}
|
|
335
|
-
return Number(value);
|
|
336
|
-
};
|
|
337
|
-
|
|
338
|
-
// src/ens/constants.ts
|
|
339
|
-
var import_viem = require("viem");
|
|
340
|
-
var ROOT_NODE = (0, import_viem.namehash)("");
|
|
341
|
-
var ETH_NODE = (0, import_viem.namehash)("eth");
|
|
342
|
-
var BASENAMES_NODE = (0, import_viem.namehash)("base.eth");
|
|
343
|
-
var LINEANAMES_NODE = (0, import_viem.namehash)("linea.eth");
|
|
344
|
-
var ADDR_REVERSE_NODE = (0, import_viem.namehash)("addr.reverse");
|
|
345
|
-
var NODE_ANY = import_viem.zeroHash;
|
|
346
|
-
var ROOT_RESOURCE = 0n;
|
|
347
|
-
|
|
348
|
-
// src/ens/dns-encoded-name.ts
|
|
349
|
-
var import_viem2 = require("viem");
|
|
350
|
-
function decodeDNSEncodedLiteralName(packet) {
|
|
351
|
-
return decodeDNSEncodedName(packet);
|
|
352
|
-
}
|
|
353
|
-
function decodeDNSEncodedName(packet) {
|
|
354
|
-
const segments = [];
|
|
355
|
-
const bytes = (0, import_viem2.hexToBytes)(packet);
|
|
356
|
-
if (bytes.length === 0) throw new Error(`Packet is empty.`);
|
|
357
|
-
let offset = 0;
|
|
358
|
-
while (offset < bytes.length) {
|
|
359
|
-
const len = bytes[offset];
|
|
360
|
-
if (len === void 0) {
|
|
361
|
-
throw new Error(`Invariant: bytes[offset] is undefined after offset < bytes.length check.`);
|
|
362
|
-
}
|
|
363
|
-
if (len < 0 || len > 255) {
|
|
364
|
-
throw new Error(
|
|
365
|
-
`Invariant: this should be literally impossible, but an unsigned byte was less than zero or greater than 255. The value in question is ${len}`
|
|
366
|
-
);
|
|
367
|
-
}
|
|
368
|
-
if (len === 0) break;
|
|
369
|
-
const segment = (0, import_viem2.bytesToString)(bytes.subarray(offset + 1, offset + len + 1));
|
|
370
|
-
segments.push(segment);
|
|
371
|
-
offset += len + 1;
|
|
372
|
-
}
|
|
373
|
-
if (offset >= bytes.length) throw new Error(`Overflow, offset >= bytes.length`);
|
|
374
|
-
if (offset !== bytes.length - 1) throw new Error(`Junk at end of name`);
|
|
375
|
-
return segments;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
// src/ens/labelhash.ts
|
|
379
|
-
var import_viem3 = require("viem");
|
|
380
|
-
function isLabelHash(maybeLabelHash) {
|
|
381
|
-
const expectedLength = maybeLabelHash.length === 66;
|
|
382
|
-
const expectedEncoding = (0, import_viem3.isHex)(maybeLabelHash);
|
|
383
|
-
const expectedCasing = maybeLabelHash === maybeLabelHash.toLowerCase();
|
|
384
|
-
return expectedLength && expectedEncoding && expectedCasing;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
// src/ens/encode-labelhash.ts
|
|
388
|
-
var encodeLabelHash = (labelHash) => `[${labelHash.slice(2)}]`;
|
|
389
|
-
function isEncodedLabelHash(maybeEncodedLabelHash) {
|
|
390
|
-
const expectedFormatting = maybeEncodedLabelHash.startsWith("[") && maybeEncodedLabelHash.endsWith("]");
|
|
391
|
-
const includesLabelHash = isLabelHash(`0x${maybeEncodedLabelHash.slice(1, -1)}`);
|
|
392
|
-
return expectedFormatting && includesLabelHash;
|
|
393
|
-
}
|
|
257
|
+
var import_datasources = require("@ensnode/datasources");
|
|
394
258
|
|
|
395
259
|
// src/ens/fuses.ts
|
|
396
260
|
var PARENT_CANNOT_CONTROL = 65536;
|
|
397
261
|
var isPccFuseSet = (fuses) => (fuses & PARENT_CANNOT_CONTROL) === PARENT_CANNOT_CONTROL;
|
|
398
262
|
|
|
399
|
-
// src/ens/is-normalized.ts
|
|
400
|
-
var import_ens = require("viem/ens");
|
|
401
|
-
function isNormalizedName(name) {
|
|
402
|
-
try {
|
|
403
|
-
return name === (0, import_ens.normalize)(name);
|
|
404
|
-
} catch {
|
|
405
|
-
return false;
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
function isNormalizedLabel(label) {
|
|
409
|
-
if (label === "") return false;
|
|
410
|
-
if (label.includes(".")) return false;
|
|
411
|
-
try {
|
|
412
|
-
return label === (0, import_ens.normalize)(label);
|
|
413
|
-
} catch {
|
|
414
|
-
return false;
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
// src/ens/names.ts
|
|
419
|
-
var import_ens_normalize = require("@adraffy/ens-normalize");
|
|
420
|
-
var ENS_ROOT = "";
|
|
421
|
-
var getNameHierarchy = (name) => name.split(".").map((_, i, labels) => labels.slice(i).join("."));
|
|
422
|
-
var getParentNameFQDN = (name) => {
|
|
423
|
-
if (name === ENS_ROOT) {
|
|
424
|
-
throw new Error("There is no parent name for ENS Root.");
|
|
425
|
-
}
|
|
426
|
-
const labels = name.split(".");
|
|
427
|
-
if (labels.length === 1) {
|
|
428
|
-
return ENS_ROOT;
|
|
429
|
-
}
|
|
430
|
-
return labels.slice(1).join(".");
|
|
431
|
-
};
|
|
432
|
-
var beautifyName = (name) => {
|
|
433
|
-
const beautifiedLabels = name.split(".").map((label) => {
|
|
434
|
-
if (isNormalizedLabel(label)) {
|
|
435
|
-
return (0, import_ens_normalize.ens_beautify)(label);
|
|
436
|
-
} else {
|
|
437
|
-
return label;
|
|
438
|
-
}
|
|
439
|
-
});
|
|
440
|
-
return beautifiedLabels.join(".");
|
|
441
|
-
};
|
|
442
|
-
|
|
443
|
-
// src/ens/parse-labelhash.ts
|
|
444
|
-
var import_viem4 = require("viem");
|
|
445
|
-
function parseLabelHash(maybeLabelHash) {
|
|
446
|
-
const hexPart = maybeLabelHash.startsWith("0x") ? maybeLabelHash.slice(2) : maybeLabelHash;
|
|
447
|
-
if (!(0, import_viem4.isHex)(`0x${hexPart}`, { strict: true })) {
|
|
448
|
-
throw new Error(`Invalid labelHash: contains non-hex characters: ${maybeLabelHash}`);
|
|
449
|
-
}
|
|
450
|
-
const normalizedHexPart = hexPart.length % 2 === 1 ? `0${hexPart}` : hexPart;
|
|
451
|
-
if (normalizedHexPart.length !== 64) {
|
|
452
|
-
throw new Error(
|
|
453
|
-
`Invalid labelHash length: expected 32 bytes (64 hex chars), got ${normalizedHexPart.length / 2} bytes: ${maybeLabelHash}`
|
|
454
|
-
);
|
|
455
|
-
}
|
|
456
|
-
return `0x${normalizedHexPart.toLowerCase()}`;
|
|
457
|
-
}
|
|
458
|
-
function parseEncodedLabelHash(maybeEncodedLabelHash) {
|
|
459
|
-
if (!maybeEncodedLabelHash.startsWith("[") || !maybeEncodedLabelHash.endsWith("]")) {
|
|
460
|
-
throw new Error(
|
|
461
|
-
`Invalid encoded labelHash: must be enclosed in square brackets: ${maybeEncodedLabelHash}`
|
|
462
|
-
);
|
|
463
|
-
}
|
|
464
|
-
return parseLabelHash(maybeEncodedLabelHash.slice(1, -1));
|
|
465
|
-
}
|
|
466
|
-
function parseLabelHashOrEncodedLabelHash(maybeLabelHash) {
|
|
467
|
-
if (maybeLabelHash.startsWith("[") && maybeLabelHash.endsWith("]")) {
|
|
468
|
-
return parseEncodedLabelHash(maybeLabelHash);
|
|
469
|
-
}
|
|
470
|
-
return parseLabelHash(maybeLabelHash);
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
// src/ens/parse-reverse-name.ts
|
|
474
|
-
var import_viem5 = require("viem");
|
|
475
|
-
|
|
476
|
-
// src/shared/address.ts
|
|
477
|
-
function asLowerCaseAddress(address) {
|
|
478
|
-
return address.toLowerCase();
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
// src/ens/parse-reverse-name.ts
|
|
482
|
-
var REVERSE_NAME_REGEX = /^([0-9a-fA-F]+)\.([0-9a-f]{1,64}|addr|default)\.reverse$/;
|
|
483
|
-
var parseAddressLabel = (addressLabel) => {
|
|
484
|
-
const maybeAddress = `0x${addressLabel}`;
|
|
485
|
-
if (!(0, import_viem5.isAddress)(maybeAddress)) {
|
|
486
|
-
throw new Error(`Invalid EVM address "${maybeAddress}"`);
|
|
487
|
-
}
|
|
488
|
-
return asLowerCaseAddress(maybeAddress);
|
|
489
|
-
};
|
|
490
|
-
var parseCoinTypeLabel = (coinTypeLabel) => {
|
|
491
|
-
if (coinTypeLabel === "default") return DEFAULT_EVM_COIN_TYPE;
|
|
492
|
-
if (coinTypeLabel === "addr") return ETH_COIN_TYPE;
|
|
493
|
-
return bigintToCoinType((0, import_viem5.hexToBigInt)(`0x${coinTypeLabel}`));
|
|
494
|
-
};
|
|
495
|
-
function parseReverseName(name) {
|
|
496
|
-
const match = name.match(REVERSE_NAME_REGEX);
|
|
497
|
-
if (!match) return null;
|
|
498
|
-
try {
|
|
499
|
-
const [, addressLabel, coinTypeLabel] = match;
|
|
500
|
-
if (!addressLabel) return null;
|
|
501
|
-
if (!coinTypeLabel) return null;
|
|
502
|
-
return {
|
|
503
|
-
address: parseAddressLabel(addressLabel),
|
|
504
|
-
coinType: parseCoinTypeLabel(coinTypeLabel)
|
|
505
|
-
};
|
|
506
|
-
} catch {
|
|
507
|
-
return null;
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
// src/ens/reverse-name.ts
|
|
512
|
-
var addrReverseLabel = (address) => address.slice(2);
|
|
513
|
-
var coinTypeReverseLabel = (coinType) => coinType.toString(16);
|
|
514
|
-
function reverseName(address, coinType) {
|
|
515
|
-
const label = addrReverseLabel(address);
|
|
516
|
-
const middle = (() => {
|
|
517
|
-
switch (coinType) {
|
|
518
|
-
case ETH_COIN_TYPE:
|
|
519
|
-
return "addr";
|
|
520
|
-
case DEFAULT_EVM_COIN_TYPE:
|
|
521
|
-
return "default";
|
|
522
|
-
default:
|
|
523
|
-
return coinTypeReverseLabel(coinType);
|
|
524
|
-
}
|
|
525
|
-
})();
|
|
526
|
-
return `${label}.${middle}.reverse`;
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
// src/ens/subname-helpers.ts
|
|
530
|
-
var import_viem6 = require("viem");
|
|
531
|
-
var makeSubdomainNode = (labelHash, node) => (0, import_viem6.keccak256)((0, import_viem6.concat)([node, labelHash]));
|
|
532
|
-
var uint256ToHex32 = (num) => (0, import_viem6.toHex)(num, { size: 32 });
|
|
533
|
-
|
|
534
|
-
// src/ens/types.ts
|
|
535
|
-
var import_datasources = require("@ensnode/datasources");
|
|
536
|
-
|
|
537
263
|
// src/ensapi/config/deserialize.ts
|
|
538
264
|
var import_v47 = require("zod/v4");
|
|
539
265
|
|
|
@@ -548,11 +274,12 @@ var import_v42 = require("zod/v4");
|
|
|
548
274
|
|
|
549
275
|
// src/shared/zod-schemas.ts
|
|
550
276
|
var import_caip = require("caip");
|
|
551
|
-
var
|
|
277
|
+
var import_enssdk = require("enssdk");
|
|
278
|
+
var import_viem2 = require("viem");
|
|
552
279
|
var import_v4 = require("zod/v4");
|
|
553
280
|
|
|
554
281
|
// src/shared/currencies.ts
|
|
555
|
-
var
|
|
282
|
+
var import_viem = require("viem");
|
|
556
283
|
|
|
557
284
|
// src/shared/numbers.ts
|
|
558
285
|
function bigIntToNumber(n) {
|
|
@@ -687,42 +414,22 @@ function validateAmountToParse(value) {
|
|
|
687
414
|
function parseEth(value) {
|
|
688
415
|
validateAmountToParse(value);
|
|
689
416
|
const currencyInfo2 = getCurrencyInfo(CurrencyIds.ETH);
|
|
690
|
-
const amount = (0,
|
|
417
|
+
const amount = (0, import_viem.parseUnits)(value, currencyInfo2.decimals);
|
|
691
418
|
return priceEth(amount);
|
|
692
419
|
}
|
|
693
420
|
function parseUsdc(value) {
|
|
694
421
|
validateAmountToParse(value);
|
|
695
422
|
const currencyInfo2 = getCurrencyInfo(CurrencyIds.USDC);
|
|
696
|
-
const amount = (0,
|
|
423
|
+
const amount = (0, import_viem.parseUnits)(value, currencyInfo2.decimals);
|
|
697
424
|
return priceUsdc(amount);
|
|
698
425
|
}
|
|
699
426
|
function parseDai(value) {
|
|
700
427
|
validateAmountToParse(value);
|
|
701
428
|
const currencyInfo2 = getCurrencyInfo(CurrencyIds.DAI);
|
|
702
|
-
const amount = (0,
|
|
429
|
+
const amount = (0, import_viem.parseUnits)(value, currencyInfo2.decimals);
|
|
703
430
|
return priceDai(amount);
|
|
704
431
|
}
|
|
705
432
|
|
|
706
|
-
// src/shared/interpretation/reinterpretation.ts
|
|
707
|
-
var import_viem8 = require("viem");
|
|
708
|
-
function reinterpretLabel(label) {
|
|
709
|
-
if (label === "") {
|
|
710
|
-
throw new Error(
|
|
711
|
-
`Cannot reinterpret an empty label that violates the invariants of an InterpretedLabel.`
|
|
712
|
-
);
|
|
713
|
-
}
|
|
714
|
-
if (isEncodedLabelHash(label)) return label;
|
|
715
|
-
if (isNormalizedLabel(label)) return label;
|
|
716
|
-
return encodeLabelHash((0, import_viem8.labelhash)(label));
|
|
717
|
-
}
|
|
718
|
-
function reinterpretName(name) {
|
|
719
|
-
if (name === "") return name;
|
|
720
|
-
const interpretedLabels = name.split(".");
|
|
721
|
-
const reinterpretedLabels = interpretedLabels.map(reinterpretLabel);
|
|
722
|
-
const reinterpretedName = reinterpretedLabels.join(".");
|
|
723
|
-
return reinterpretedName;
|
|
724
|
-
}
|
|
725
|
-
|
|
726
433
|
// src/shared/zod-schemas.ts
|
|
727
434
|
var makeIntegerSchema = (valueLabel = "Value") => import_v4.z.int({
|
|
728
435
|
error: `${valueLabel} must be an integer.`
|
|
@@ -738,15 +445,15 @@ var makeDurationSchema = (valueLabel = "Value") => import_v4.z.number({
|
|
|
738
445
|
}).pipe(makeNonNegativeIntegerSchema(valueLabel));
|
|
739
446
|
var makeChainIdSchema = (valueLabel = "Chain ID") => makePositiveIntegerSchema(valueLabel).transform((val) => val);
|
|
740
447
|
var makeChainIdStringSchema = (valueLabel = "Chain ID String") => import_v4.z.string({ error: `${valueLabel} must be a string representing a chain ID.` }).pipe(import_v4.z.coerce.number({ error: `${valueLabel} must represent a positive integer (>0).` })).pipe(makeChainIdSchema(`The numeric value represented by ${valueLabel}`));
|
|
741
|
-
var
|
|
742
|
-
if (!(0,
|
|
448
|
+
var makeNormalizedAddressSchema = (valueLabel = "EVM address") => import_v4.z.string().check((ctx) => {
|
|
449
|
+
if (!(0, import_viem2.isAddress)(ctx.value, { strict: false })) {
|
|
743
450
|
ctx.issues.push({
|
|
744
451
|
code: "custom",
|
|
745
452
|
message: `${valueLabel} must be a valid EVM address`,
|
|
746
453
|
input: ctx.value
|
|
747
454
|
});
|
|
748
455
|
}
|
|
749
|
-
}).transform((val) =>
|
|
456
|
+
}).transform((val) => (0, import_enssdk.toNormalizedAddress)(val));
|
|
750
457
|
var makeDatetimeSchema = (valueLabel = "Datetime string") => import_v4.z.iso.datetime({ error: `${valueLabel} must be a string in ISO 8601 format.` }).transform((v) => new Date(v));
|
|
751
458
|
var makeUnixTimestampSchema = (valueLabel = "Timestamp") => makeIntegerSchema(valueLabel);
|
|
752
459
|
var makeUrlSchema = (valueLabel = "Value") => import_v4.z.url({
|
|
@@ -784,7 +491,7 @@ var makePriceUsdcSchema = (valueLabel = "Price USDC") => makePriceCurrencySchema
|
|
|
784
491
|
var makePriceDaiSchema = (valueLabel = "Price DAI") => makePriceCurrencySchema(CurrencyIds.DAI, valueLabel).transform((v) => v);
|
|
785
492
|
var makeAccountIdSchema = (valueLabel = "AccountId") => import_v4.z.strictObject({
|
|
786
493
|
chainId: makeChainIdSchema(`${valueLabel} chain ID`),
|
|
787
|
-
address:
|
|
494
|
+
address: makeNormalizedAddressSchema(`${valueLabel} address`)
|
|
788
495
|
});
|
|
789
496
|
var makeAccountIdStringSchema = (valueLabel = "Account ID String") => import_v4.z.coerce.string().transform((v) => {
|
|
790
497
|
const result = new import_caip.AccountId(v);
|
|
@@ -794,7 +501,7 @@ var makeAccountIdStringSchema = (valueLabel = "Account ID String") => import_v4.
|
|
|
794
501
|
};
|
|
795
502
|
}).pipe(makeAccountIdSchema(valueLabel));
|
|
796
503
|
var makeHexStringSchema = (options, valueLabel = "String representation of bytes array") => import_v4.z.string().check(function invariant_isHexEncoded(ctx) {
|
|
797
|
-
if (!(0,
|
|
504
|
+
if (!(0, import_viem2.isHex)(ctx.value)) {
|
|
798
505
|
ctx.issues.push({
|
|
799
506
|
code: "custom",
|
|
800
507
|
input: ctx.value,
|
|
@@ -803,7 +510,7 @@ var makeHexStringSchema = (options, valueLabel = "String representation of bytes
|
|
|
803
510
|
}
|
|
804
511
|
}).transform((v) => v).check(function invariant_encodesRequiredBytesCount(ctx) {
|
|
805
512
|
const expectedBytesCount = options.bytesCount;
|
|
806
|
-
const actualBytesCount = (0,
|
|
513
|
+
const actualBytesCount = (0, import_viem2.size)(ctx.value);
|
|
807
514
|
if (actualBytesCount !== expectedBytesCount) {
|
|
808
515
|
ctx.issues.push({
|
|
809
516
|
code: "custom",
|
|
@@ -816,7 +523,7 @@ var makeNodeSchema = (valueLabel = "Node") => makeHexStringSchema({ bytesCount:
|
|
|
816
523
|
var makeTransactionHashSchema = (valueLabel = "Transaction hash") => makeHexStringSchema({ bytesCount: 32 }, valueLabel);
|
|
817
524
|
var makeReinterpretedNameSchema = (valueLabel = "Reinterpreted Name") => import_v4.z.string().transform((v) => v).check((ctx) => {
|
|
818
525
|
try {
|
|
819
|
-
reinterpretName(ctx.value);
|
|
526
|
+
(0, import_enssdk.reinterpretName)(ctx.value);
|
|
820
527
|
} catch (error) {
|
|
821
528
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
822
529
|
ctx.issues.push({
|
|
@@ -825,7 +532,7 @@ var makeReinterpretedNameSchema = (valueLabel = "Reinterpreted Name") => import_
|
|
|
825
532
|
message: `${valueLabel} cannot be reinterpreted: ${errorMessage}`
|
|
826
533
|
});
|
|
827
534
|
}
|
|
828
|
-
}).transform(reinterpretName);
|
|
535
|
+
}).transform(import_enssdk.reinterpretName);
|
|
829
536
|
|
|
830
537
|
// src/ensrainbow/zod-schemas/config.ts
|
|
831
538
|
var makeLabelSetIdSchema = (valueLabel = "Label set ID") => {
|
|
@@ -833,9 +540,8 @@ var makeLabelSetIdSchema = (valueLabel = "Label set ID") => {
|
|
|
833
540
|
error: `${valueLabel} can only contain lowercase letters (a-z) and hyphens (-)`
|
|
834
541
|
});
|
|
835
542
|
};
|
|
836
|
-
var makeLabelSetVersionSchema = (valueLabel = "Label set version") =>
|
|
837
|
-
|
|
838
|
-
};
|
|
543
|
+
var makeLabelSetVersionSchema = (valueLabel = "Label set version") => makeNonNegativeIntegerSchema(valueLabel);
|
|
544
|
+
var makeLabelSetVersionStringSchema = (valueLabel = "Label set version") => import_v42.z.coerce.number({ error: `${valueLabel} must be a non-negative integer` }).pipe(makeLabelSetVersionSchema(valueLabel));
|
|
839
545
|
var makeEnsRainbowPublicConfigSchema = (valueLabel = "EnsRainbowPublicConfig") => import_v42.z.object({
|
|
840
546
|
version: import_v42.z.string().nonempty({ error: `${valueLabel}.version must be a non-empty string.` }),
|
|
841
547
|
labelSet: import_v42.z.object({
|
|
@@ -851,7 +557,7 @@ var makeEnsRainbowPublicConfigSchema = (valueLabel = "EnsRainbowPublicConfig") =
|
|
|
851
557
|
var uniq = (arr) => [...new Set(arr)];
|
|
852
558
|
|
|
853
559
|
// src/ensindexer/config/is-subgraph-compatible.ts
|
|
854
|
-
var
|
|
560
|
+
var import_datasources2 = require("@ensnode/datasources");
|
|
855
561
|
|
|
856
562
|
// src/ensindexer/config/types.ts
|
|
857
563
|
var PluginName = /* @__PURE__ */ ((PluginName2) => {
|
|
@@ -871,7 +577,7 @@ function isSubgraphCompatible(config) {
|
|
|
871
577
|
const onlySubgraphPluginActivated = config.plugins.length === 1 && config.plugins[0] === "subgraph" /* Subgraph */;
|
|
872
578
|
const isSubgraphLabelSet = config.labelSet.labelSetId === "subgraph" && config.labelSet.labelSetVersion === 0;
|
|
873
579
|
const isEnsTestEnvLabelSet = config.labelSet.labelSetId === "ens-test-env" && config.labelSet.labelSetVersion === 0;
|
|
874
|
-
const labelSetIsSubgraphCompatible = isSubgraphLabelSet || config.namespace ===
|
|
580
|
+
const labelSetIsSubgraphCompatible = isSubgraphLabelSet || config.namespace === import_datasources2.ENSNamespaceIds.EnsTestEnv && isEnsTestEnvLabelSet;
|
|
875
581
|
return onlySubgraphPluginActivated && labelSetIsSubgraphCompatible;
|
|
876
582
|
}
|
|
877
583
|
|
|
@@ -880,7 +586,7 @@ function buildLabelSetId(maybeLabelSetId) {
|
|
|
880
586
|
return makeLabelSetIdSchema("LabelSetId").parse(maybeLabelSetId);
|
|
881
587
|
}
|
|
882
588
|
function buildLabelSetVersion(maybeLabelSetVersion) {
|
|
883
|
-
return
|
|
589
|
+
return makeLabelSetVersionStringSchema("LabelSetVersion").parse(maybeLabelSetVersion);
|
|
884
590
|
}
|
|
885
591
|
function buildEnsRainbowClientLabelSet(labelSetId, labelSetVersion) {
|
|
886
592
|
if (labelSetVersion !== void 0 && labelSetId === void 0) {
|
|
@@ -932,7 +638,7 @@ var makePluginsListSchema = (valueLabel = "Plugins") => import_v43.z.array(impor
|
|
|
932
638
|
}).refine((arr) => arr.length === uniq(arr).length, {
|
|
933
639
|
error: `${valueLabel} cannot contain duplicate values.`
|
|
934
640
|
});
|
|
935
|
-
var
|
|
641
|
+
var makeEnsIndexerSchemaNameSchema = (valueLabel = "ENS Indexer Schema Name") => import_v43.z.string({ error: `${valueLabel} must be a string` }).trim().nonempty({
|
|
936
642
|
error: `${valueLabel} is required and must be a non-empty string.`
|
|
937
643
|
});
|
|
938
644
|
var makeFullyPinnedLabelSetSchema = (valueLabel = "Label set") => {
|
|
@@ -947,13 +653,12 @@ var makeFullyPinnedLabelSetSchema = (valueLabel = "Label set") => {
|
|
|
947
653
|
}
|
|
948
654
|
return import_v43.z.object({
|
|
949
655
|
labelSetId: makeLabelSetIdSchema(valueLabelLabelSetId),
|
|
950
|
-
labelSetVersion:
|
|
656
|
+
labelSetVersion: makeLabelSetVersionStringSchema(valueLabelLabelSetVersion)
|
|
951
657
|
});
|
|
952
658
|
};
|
|
953
659
|
var makeNonEmptyStringSchema = (valueLabel = "Value") => import_v43.z.string().nonempty({ error: `${valueLabel} must be a non-empty string.` });
|
|
954
660
|
var makeEnsIndexerVersionInfoSchema = (valueLabel = "Value") => import_v43.z.object(
|
|
955
661
|
{
|
|
956
|
-
nodejs: makeNonEmptyStringSchema(),
|
|
957
662
|
ponder: makeNonEmptyStringSchema(),
|
|
958
663
|
ensDb: makeNonEmptyStringSchema(),
|
|
959
664
|
ensIndexer: makeNonEmptyStringSchema(),
|
|
@@ -988,7 +693,7 @@ function invariant_ensRainbowSupportedLabelSetAndVersion(ctx) {
|
|
|
988
693
|
}
|
|
989
694
|
}
|
|
990
695
|
var makeEnsIndexerPublicConfigSchema = (valueLabel = "ENSIndexerPublicConfig") => import_v43.z.object({
|
|
991
|
-
|
|
696
|
+
ensIndexerSchemaName: makeEnsIndexerSchemaNameSchema(`${valueLabel}.ensIndexerSchemaName`),
|
|
992
697
|
ensRainbowPublicConfig: makeEnsRainbowPublicConfigSchema(
|
|
993
698
|
`${valueLabel}.ensRainbowPublicConfig`
|
|
994
699
|
),
|
|
@@ -1002,7 +707,7 @@ var makeEnsIndexerPublicConfigSchema = (valueLabel = "ENSIndexerPublicConfig") =
|
|
|
1002
707
|
versionInfo: makeEnsIndexerVersionInfoSchema(`${valueLabel}.versionInfo`)
|
|
1003
708
|
}).check(invariant_isSubgraphCompatibleRequirements).check(invariant_ensRainbowSupportedLabelSetAndVersion);
|
|
1004
709
|
var makeSerializedEnsIndexerPublicConfigSchema = (valueLabel = "Serialized ENSIndexerPublicConfig") => import_v43.z.object({
|
|
1005
|
-
|
|
710
|
+
ensIndexerSchemaName: makeEnsIndexerSchemaNameSchema(`${valueLabel}.ensIndexerSchemaName`),
|
|
1006
711
|
ensRainbowPublicConfig: makeEnsRainbowPublicConfigSchema(
|
|
1007
712
|
`${valueLabel}.ensRainbowPublicConfig`
|
|
1008
713
|
),
|
|
@@ -1056,23 +761,27 @@ var TheGraphFallbackSchema = import_v45.z.discriminatedUnion("canFallback", [
|
|
|
1056
761
|
]);
|
|
1057
762
|
|
|
1058
763
|
// src/ensapi/config/zod-schemas.ts
|
|
764
|
+
var makeEnsApiVersionInfoSchema = (valueLabel = "ENS API version info") => import_v46.z.object({
|
|
765
|
+
ensApi: import_v46.z.string().nonempty(`${valueLabel}.ensApi must be a non-empty string`),
|
|
766
|
+
ensNormalize: import_v46.z.string().nonempty(`${valueLabel}.ensNormalize must be a non-empty string`)
|
|
767
|
+
});
|
|
1059
768
|
function makeEnsApiPublicConfigSchema(valueLabel) {
|
|
1060
769
|
const label = valueLabel ?? "ENSApiPublicConfig";
|
|
1061
770
|
return import_v46.z.object({
|
|
1062
|
-
version: import_v46.z.string().min(1, `${label}.version must be a non-empty string`),
|
|
1063
771
|
theGraphFallback: TheGraphFallbackSchema,
|
|
1064
|
-
ensIndexerPublicConfig: makeEnsIndexerPublicConfigSchema(`${label}.ensIndexerPublicConfig`)
|
|
772
|
+
ensIndexerPublicConfig: makeEnsIndexerPublicConfigSchema(`${label}.ensIndexerPublicConfig`),
|
|
773
|
+
versionInfo: makeEnsApiVersionInfoSchema(`${label}.versionInfo`)
|
|
1065
774
|
});
|
|
1066
775
|
}
|
|
1067
776
|
var makeENSApiPublicConfigSchema = makeEnsApiPublicConfigSchema;
|
|
1068
777
|
function makeSerializedEnsApiPublicConfigSchema(valueLabel) {
|
|
1069
778
|
const label = valueLabel ?? "ENSApiPublicConfig";
|
|
1070
779
|
return import_v46.z.object({
|
|
1071
|
-
version: import_v46.z.string().min(1, `${label}.version must be a non-empty string`),
|
|
1072
|
-
theGraphFallback: TheGraphFallbackSchema,
|
|
1073
780
|
ensIndexerPublicConfig: makeSerializedEnsIndexerPublicConfigSchema(
|
|
1074
781
|
`${label}.ensIndexerPublicConfig`
|
|
1075
|
-
)
|
|
782
|
+
),
|
|
783
|
+
theGraphFallback: TheGraphFallbackSchema,
|
|
784
|
+
versionInfo: makeEnsApiVersionInfoSchema(`${label}.versionInfo`)
|
|
1076
785
|
});
|
|
1077
786
|
}
|
|
1078
787
|
|
|
@@ -1096,19 +805,13 @@ ${(0, import_v47.prettifyError)(parsed.error)}
|
|
|
1096
805
|
}
|
|
1097
806
|
var deserializeENSApiPublicConfig = deserializeEnsApiPublicConfig;
|
|
1098
807
|
|
|
1099
|
-
// src/ensapi/api/config/deserialize.ts
|
|
1100
|
-
function deserializeEnsApiConfigResponse(maybeResponse) {
|
|
1101
|
-
return deserializeEnsApiPublicConfig(maybeResponse);
|
|
1102
|
-
}
|
|
1103
|
-
var deserializeConfigResponse = deserializeEnsApiConfigResponse;
|
|
1104
|
-
|
|
1105
808
|
// src/ensindexer/config/serialize.ts
|
|
1106
809
|
function serializeIndexedChainIds(indexedChainIds) {
|
|
1107
810
|
return Array.from(indexedChainIds);
|
|
1108
811
|
}
|
|
1109
812
|
function serializeEnsIndexerPublicConfig(config) {
|
|
1110
813
|
const {
|
|
1111
|
-
|
|
814
|
+
ensIndexerSchemaName,
|
|
1112
815
|
ensRainbowPublicConfig,
|
|
1113
816
|
indexedChainIds,
|
|
1114
817
|
isSubgraphCompatible: isSubgraphCompatible2,
|
|
@@ -1118,7 +821,7 @@ function serializeEnsIndexerPublicConfig(config) {
|
|
|
1118
821
|
versionInfo
|
|
1119
822
|
} = config;
|
|
1120
823
|
return {
|
|
1121
|
-
|
|
824
|
+
ensIndexerSchemaName,
|
|
1122
825
|
ensRainbowPublicConfig,
|
|
1123
826
|
indexedChainIds: serializeIndexedChainIds(indexedChainIds),
|
|
1124
827
|
isSubgraphCompatible: isSubgraphCompatible2,
|
|
@@ -1132,22 +835,26 @@ var serializeENSIndexerPublicConfig = serializeEnsIndexerPublicConfig;
|
|
|
1132
835
|
|
|
1133
836
|
// src/ensapi/config/serialize.ts
|
|
1134
837
|
function serializeEnsApiPublicConfig(config) {
|
|
1135
|
-
const {
|
|
838
|
+
const { ensIndexerPublicConfig, theGraphFallback, versionInfo } = config;
|
|
1136
839
|
return {
|
|
1137
|
-
|
|
840
|
+
ensIndexerPublicConfig: serializeEnsIndexerPublicConfig(ensIndexerPublicConfig),
|
|
1138
841
|
theGraphFallback,
|
|
1139
|
-
|
|
842
|
+
versionInfo
|
|
1140
843
|
};
|
|
1141
844
|
}
|
|
1142
845
|
var serializeENSApiPublicConfig = serializeEnsApiPublicConfig;
|
|
1143
846
|
|
|
1144
|
-
// src/
|
|
1145
|
-
function
|
|
1146
|
-
return
|
|
847
|
+
// src/ensindexer/api/config/deserialize.ts
|
|
848
|
+
function deserializeEnsIndexerConfigResponse(maybeResponse) {
|
|
849
|
+
return deserializeEnsIndexerPublicConfig(maybeResponse, "EnsIndexerConfigResponse");
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
// src/ensindexer/api/config/serialize.ts
|
|
853
|
+
function serializeEnsIndexerConfigResponse(response) {
|
|
854
|
+
return serializeEnsIndexerPublicConfig(response);
|
|
1147
855
|
}
|
|
1148
|
-
var serializeConfigResponse = serializeEnsApiConfigResponse;
|
|
1149
856
|
|
|
1150
|
-
// src/
|
|
857
|
+
// src/ensindexer/api/indexing-status/deserialize.ts
|
|
1151
858
|
var import_v418 = require("zod/v4");
|
|
1152
859
|
|
|
1153
860
|
// src/indexing-status/deserialize/realtime-indexing-status-projection.ts
|
|
@@ -2074,8 +1781,8 @@ ${(0, import_v416.prettifyError)(parsed.error)}
|
|
|
2074
1781
|
return parsed.data;
|
|
2075
1782
|
}
|
|
2076
1783
|
|
|
2077
|
-
// src/
|
|
2078
|
-
var
|
|
1784
|
+
// src/ensindexer/api/indexing-status/response.ts
|
|
1785
|
+
var EnsIndexerIndexingStatusResponseCodes = {
|
|
2079
1786
|
/**
|
|
2080
1787
|
* Represents that the indexing status is available.
|
|
2081
1788
|
*/
|
|
@@ -2085,33 +1792,32 @@ var EnsApiIndexingStatusResponseCodes = {
|
|
|
2085
1792
|
*/
|
|
2086
1793
|
Error: "error"
|
|
2087
1794
|
};
|
|
2088
|
-
var IndexingStatusResponseCodes = EnsApiIndexingStatusResponseCodes;
|
|
2089
1795
|
|
|
2090
|
-
// src/
|
|
1796
|
+
// src/ensindexer/api/indexing-status/zod-schemas.ts
|
|
2091
1797
|
var import_v417 = require("zod/v4");
|
|
2092
|
-
var
|
|
2093
|
-
responseCode: import_v417.z.literal(
|
|
1798
|
+
var makeEnsIndexerIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => import_v417.z.strictObject({
|
|
1799
|
+
responseCode: import_v417.z.literal(EnsIndexerIndexingStatusResponseCodes.Ok),
|
|
2094
1800
|
realtimeProjection: makeRealtimeIndexingStatusProjectionSchema(valueLabel)
|
|
2095
1801
|
});
|
|
2096
|
-
var
|
|
2097
|
-
responseCode: import_v417.z.literal(
|
|
1802
|
+
var makeEnsIndexerIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => import_v417.z.strictObject({
|
|
1803
|
+
responseCode: import_v417.z.literal(EnsIndexerIndexingStatusResponseCodes.Error)
|
|
2098
1804
|
});
|
|
2099
|
-
var
|
|
2100
|
-
|
|
2101
|
-
|
|
1805
|
+
var makeEnsIndexerIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => import_v417.z.discriminatedUnion("responseCode", [
|
|
1806
|
+
makeEnsIndexerIndexingStatusResponseOkSchema(valueLabel),
|
|
1807
|
+
makeEnsIndexerIndexingStatusResponseErrorSchema(valueLabel)
|
|
2102
1808
|
]);
|
|
2103
|
-
var
|
|
2104
|
-
responseCode: import_v417.z.literal(
|
|
1809
|
+
var makeSerializedEnsIndexerIndexingStatusResponseOkSchema = (valueLabel = "Serialized Indexing Status Response OK") => import_v417.z.strictObject({
|
|
1810
|
+
responseCode: import_v417.z.literal(EnsIndexerIndexingStatusResponseCodes.Ok),
|
|
2105
1811
|
realtimeProjection: makeSerializedRealtimeIndexingStatusProjectionSchema(valueLabel)
|
|
2106
1812
|
});
|
|
2107
|
-
var
|
|
2108
|
-
|
|
2109
|
-
|
|
1813
|
+
var makeSerializedEnsIndexerIndexingStatusResponseSchema = (valueLabel = "Serialized Indexing Status Response") => import_v417.z.discriminatedUnion("responseCode", [
|
|
1814
|
+
makeSerializedEnsIndexerIndexingStatusResponseOkSchema(valueLabel),
|
|
1815
|
+
makeEnsIndexerIndexingStatusResponseErrorSchema(valueLabel)
|
|
2110
1816
|
]);
|
|
2111
1817
|
|
|
2112
|
-
// src/
|
|
2113
|
-
function
|
|
2114
|
-
if (serializedResponse.responseCode !==
|
|
1818
|
+
// src/ensindexer/api/indexing-status/deserialize.ts
|
|
1819
|
+
function buildUnvalidatedEnsIndexerIndexingStatusResponse(serializedResponse) {
|
|
1820
|
+
if (serializedResponse.responseCode !== EnsIndexerIndexingStatusResponseCodes.Ok) {
|
|
2115
1821
|
return serializedResponse;
|
|
2116
1822
|
}
|
|
2117
1823
|
return {
|
|
@@ -2121,21 +1827,19 @@ function buildUnvalidatedEnsApiIndexingStatusResponse(serializedResponse) {
|
|
|
2121
1827
|
)
|
|
2122
1828
|
};
|
|
2123
1829
|
}
|
|
2124
|
-
function
|
|
2125
|
-
const parsed =
|
|
1830
|
+
function deserializeEnsIndexerIndexingStatusResponse(maybeResponse) {
|
|
1831
|
+
const parsed = makeSerializedEnsIndexerIndexingStatusResponseSchema().transform(buildUnvalidatedEnsIndexerIndexingStatusResponse).pipe(makeEnsIndexerIndexingStatusResponseSchema()).safeParse(maybeResponse);
|
|
2126
1832
|
if (parsed.error) {
|
|
2127
1833
|
throw new Error(
|
|
2128
|
-
`Cannot deserialize
|
|
1834
|
+
`Cannot deserialize EnsIndexerIndexingStatusResponse:
|
|
2129
1835
|
${(0, import_v418.prettifyError)(parsed.error)}
|
|
2130
1836
|
`
|
|
2131
1837
|
);
|
|
2132
1838
|
}
|
|
2133
1839
|
return parsed.data;
|
|
2134
1840
|
}
|
|
2135
|
-
var deserializeIndexingStatusResponse = deserializeEnsApiIndexingStatusResponse;
|
|
2136
1841
|
|
|
2137
1842
|
// src/shared/serialize.ts
|
|
2138
|
-
var import_caip2 = require("caip");
|
|
2139
1843
|
function serializeChainId(chainId) {
|
|
2140
1844
|
return chainId.toString();
|
|
2141
1845
|
}
|
|
@@ -2160,23 +1864,6 @@ function serializePriceUsdc(price) {
|
|
|
2160
1864
|
function serializePriceDai(price) {
|
|
2161
1865
|
return serializePrice(price);
|
|
2162
1866
|
}
|
|
2163
|
-
function formatAccountId(accountId) {
|
|
2164
|
-
return import_caip2.AccountId.format({
|
|
2165
|
-
chainId: { namespace: "eip155", reference: accountId.chainId.toString() },
|
|
2166
|
-
address: accountId.address
|
|
2167
|
-
}).toLowerCase();
|
|
2168
|
-
}
|
|
2169
|
-
function formatAssetId({
|
|
2170
|
-
assetNamespace,
|
|
2171
|
-
contract: { chainId, address },
|
|
2172
|
-
tokenId
|
|
2173
|
-
}) {
|
|
2174
|
-
return import_caip2.AssetId.format({
|
|
2175
|
-
chainId: { namespace: "eip155", reference: chainId.toString() },
|
|
2176
|
-
assetName: { namespace: assetNamespace, reference: address },
|
|
2177
|
-
tokenId: uint256ToHex32(tokenId)
|
|
2178
|
-
}).toLowerCase();
|
|
2179
|
-
}
|
|
2180
1867
|
|
|
2181
1868
|
// src/indexing-status/serialize/chain-indexing-status-snapshot.ts
|
|
2182
1869
|
function serializeChainIndexingSnapshots(chains) {
|
|
@@ -2248,158 +1935,528 @@ function serializeRealtimeIndexingStatusProjection(indexingProjection) {
|
|
|
2248
1935
|
};
|
|
2249
1936
|
}
|
|
2250
1937
|
|
|
2251
|
-
// src/
|
|
2252
|
-
function
|
|
1938
|
+
// src/ensindexer/api/indexing-status/serialize.ts
|
|
1939
|
+
function serializeEnsIndexerIndexingStatusResponse(response) {
|
|
2253
1940
|
switch (response.responseCode) {
|
|
2254
|
-
case
|
|
1941
|
+
case EnsIndexerIndexingStatusResponseCodes.Ok:
|
|
2255
1942
|
return {
|
|
2256
1943
|
responseCode: response.responseCode,
|
|
2257
1944
|
realtimeProjection: serializeRealtimeIndexingStatusProjection(response.realtimeProjection)
|
|
2258
1945
|
};
|
|
2259
|
-
case
|
|
1946
|
+
case EnsIndexerIndexingStatusResponseCodes.Error:
|
|
2260
1947
|
return response;
|
|
2261
1948
|
}
|
|
2262
1949
|
}
|
|
2263
|
-
var serializeIndexingStatusResponse = serializeEnsApiIndexingStatusResponse;
|
|
2264
|
-
|
|
2265
|
-
// src/ensapi/api/name-tokens/deserialize.ts
|
|
2266
|
-
var import_v423 = require("zod/v4");
|
|
2267
|
-
|
|
2268
|
-
// src/ensapi/api/name-tokens/zod-schemas.ts
|
|
2269
|
-
var import_viem14 = require("viem");
|
|
2270
|
-
var import_v422 = require("zod/v4");
|
|
2271
|
-
|
|
2272
|
-
// src/tokenscope/name-token.ts
|
|
2273
|
-
var import_viem13 = require("viem");
|
|
2274
|
-
var import_datasources5 = require("@ensnode/datasources");
|
|
2275
|
-
|
|
2276
|
-
// src/shared/account-id.ts
|
|
2277
|
-
var import_viem10 = require("viem");
|
|
2278
|
-
var accountIdEqual = (a, b) => {
|
|
2279
|
-
return a.chainId === b.chainId && (0, import_viem10.isAddressEqual)(a.address, b.address);
|
|
2280
|
-
};
|
|
2281
|
-
|
|
2282
|
-
// src/shared/datasource-contract.ts
|
|
2283
|
-
var import_datasources4 = require("@ensnode/datasources");
|
|
2284
|
-
var maybeGetDatasourceContract = (namespaceId, datasourceName, contractName) => {
|
|
2285
|
-
const datasource = (0, import_datasources4.maybeGetDatasource)(namespaceId, datasourceName);
|
|
2286
|
-
if (!datasource) return void 0;
|
|
2287
|
-
const address = datasource.contracts[contractName]?.address;
|
|
2288
|
-
if (address === void 0 || Array.isArray(address)) return void 0;
|
|
2289
|
-
return {
|
|
2290
|
-
chainId: datasource.chain.id,
|
|
2291
|
-
address
|
|
2292
|
-
};
|
|
2293
|
-
};
|
|
2294
|
-
var getDatasourceContract = (namespaceId, datasourceName, contractName) => {
|
|
2295
|
-
const contract = maybeGetDatasourceContract(namespaceId, datasourceName, contractName);
|
|
2296
|
-
if (!contract) {
|
|
2297
|
-
throw new Error(
|
|
2298
|
-
`Expected contract not found for ${namespaceId} ${datasourceName} ${contractName}`
|
|
2299
|
-
);
|
|
2300
|
-
}
|
|
2301
|
-
return contract;
|
|
2302
|
-
};
|
|
2303
|
-
var makeContractMatcher = (namespace, b) => (datasourceName, contractName) => {
|
|
2304
|
-
const a = maybeGetDatasourceContract(namespace, datasourceName, contractName);
|
|
2305
|
-
return a && accountIdEqual(a, b);
|
|
2306
|
-
};
|
|
2307
1950
|
|
|
2308
|
-
// src/
|
|
2309
|
-
var import_viem12 = require("viem");
|
|
1951
|
+
// src/ensindexer/api/shared/errors/deserialize.ts
|
|
2310
1952
|
var import_v420 = require("zod/v4");
|
|
2311
1953
|
|
|
2312
|
-
// src/
|
|
2313
|
-
var import_caip3 = require("caip");
|
|
2314
|
-
var import_viem11 = require("viem");
|
|
1954
|
+
// src/ensindexer/api/shared/errors/zod-schemas.ts
|
|
2315
1955
|
var import_v419 = require("zod/v4");
|
|
1956
|
+
var ErrorResponseSchema = import_v419.z.object({
|
|
1957
|
+
message: import_v419.z.string(),
|
|
1958
|
+
details: import_v419.z.optional(import_v419.z.unknown())
|
|
1959
|
+
});
|
|
2316
1960
|
|
|
2317
|
-
// src/shared/
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
var tokenIdSchemaSerializable = import_v419.z.string();
|
|
2325
|
-
var tokenIdSchemaNative = import_v419.z.preprocess(
|
|
2326
|
-
(v) => typeof v === "string" ? BigInt(v) : v,
|
|
2327
|
-
import_v419.z.bigint().positive()
|
|
2328
|
-
);
|
|
2329
|
-
function makeTokenIdSchema(_valueLabel = "Token ID Schema", serializable = false) {
|
|
2330
|
-
if (serializable) {
|
|
2331
|
-
return tokenIdSchemaSerializable;
|
|
2332
|
-
} else {
|
|
2333
|
-
return tokenIdSchemaNative;
|
|
1961
|
+
// src/ensindexer/api/shared/errors/deserialize.ts
|
|
1962
|
+
function deserializeErrorResponse(maybeErrorResponse) {
|
|
1963
|
+
const parsed = ErrorResponseSchema.safeParse(maybeErrorResponse);
|
|
1964
|
+
if (parsed.error) {
|
|
1965
|
+
throw new Error(`Cannot deserialize ErrorResponse:
|
|
1966
|
+
${(0, import_v420.prettifyError)(parsed.error)}
|
|
1967
|
+
`);
|
|
2334
1968
|
}
|
|
1969
|
+
return parsed.data;
|
|
2335
1970
|
}
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
});
|
|
2342
|
-
};
|
|
2343
|
-
var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") => import_v419.z.preprocess((v) => {
|
|
2344
|
-
if (typeof v === "string") {
|
|
2345
|
-
const result = new import_caip3.AssetId(v);
|
|
2346
|
-
return {
|
|
2347
|
-
assetNamespace: result.assetName.namespace,
|
|
2348
|
-
contract: {
|
|
2349
|
-
chainId: Number(result.chainId.reference),
|
|
2350
|
-
address: result.assetName.reference
|
|
2351
|
-
},
|
|
2352
|
-
tokenId: result.tokenId
|
|
2353
|
-
};
|
|
2354
|
-
}
|
|
2355
|
-
return v;
|
|
2356
|
-
}, makeAssetIdSchema(valueLabel));
|
|
2357
|
-
function invariant_nameTokenOwnershipHasNonZeroAddressOwner(ctx) {
|
|
2358
|
-
const ownership = ctx.value;
|
|
2359
|
-
if (ctx.value.owner.address === import_viem11.zeroAddress) {
|
|
2360
|
-
ctx.issues.push({
|
|
2361
|
-
code: "custom",
|
|
2362
|
-
input: ctx.value,
|
|
2363
|
-
message: `Name Token Ownership with '${ownership.ownershipType}' must have 'address' other than the zero address.`
|
|
2364
|
-
});
|
|
1971
|
+
|
|
1972
|
+
// src/ensindexer/client.ts
|
|
1973
|
+
var EnsIndexerClient = class {
|
|
1974
|
+
constructor(options) {
|
|
1975
|
+
this.options = options;
|
|
2365
1976
|
}
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2370
|
-
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2371
|
-
var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") => import_v419.z.object({
|
|
2372
|
-
ownershipType: import_v419.z.literal(NameTokenOwnershipTypes.FullyOnchain),
|
|
2373
|
-
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2374
|
-
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2375
|
-
var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") => import_v419.z.object({
|
|
2376
|
-
ownershipType: import_v419.z.literal(NameTokenOwnershipTypes.Burned),
|
|
2377
|
-
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2378
|
-
}).check(invariant_nameTokenOwnershipHasZeroAddressOwner);
|
|
2379
|
-
var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") => import_v419.z.object({
|
|
2380
|
-
ownershipType: import_v419.z.literal(NameTokenOwnershipTypes.Unknown),
|
|
2381
|
-
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2382
|
-
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2383
|
-
function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
|
|
2384
|
-
const ownership = ctx.value;
|
|
2385
|
-
if (ctx.value.owner.address !== import_viem11.zeroAddress) {
|
|
2386
|
-
ctx.issues.push({
|
|
2387
|
-
code: "custom",
|
|
2388
|
-
input: ctx.value,
|
|
2389
|
-
message: `Name Token Ownership with '${ownership.ownershipType}' must have 'address' set to the zero address.`
|
|
1977
|
+
getOptions() {
|
|
1978
|
+
return Object.freeze({
|
|
1979
|
+
url: new URL(this.options.url.href)
|
|
2390
1980
|
});
|
|
2391
1981
|
}
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
1982
|
+
/**
|
|
1983
|
+
* Fetch ENSIndexer Config
|
|
1984
|
+
*
|
|
1985
|
+
* Fetch the ENSIndexer's configuration.
|
|
1986
|
+
*
|
|
1987
|
+
* @returns {EnsIndexerConfigResponse}
|
|
1988
|
+
*
|
|
1989
|
+
* @throws if the ENSIndexer request fails
|
|
1990
|
+
* @throws if the ENSIndexer returns a non-ok response
|
|
1991
|
+
* @throws if the ENSIndexer response breaks required invariants
|
|
1992
|
+
*/
|
|
1993
|
+
async config() {
|
|
1994
|
+
const url = new URL(`/api/config`, this.options.url);
|
|
1995
|
+
const response = await fetch(url);
|
|
1996
|
+
let responseData;
|
|
1997
|
+
try {
|
|
1998
|
+
responseData = await response.json();
|
|
1999
|
+
} catch {
|
|
2000
|
+
throw new Error("Malformed response data: invalid JSON");
|
|
2001
|
+
}
|
|
2002
|
+
if (!response.ok) {
|
|
2003
|
+
const errorResponse = deserializeErrorResponse(responseData);
|
|
2004
|
+
throw new Error(`Fetching ENSIndexer Config Failed: ${errorResponse.message}`);
|
|
2005
|
+
}
|
|
2006
|
+
return deserializeEnsIndexerConfigResponse(
|
|
2007
|
+
responseData
|
|
2008
|
+
);
|
|
2009
|
+
}
|
|
2010
|
+
/**
|
|
2011
|
+
* Fetch ENSIndexer Indexing Status
|
|
2012
|
+
*
|
|
2013
|
+
* @returns {EnsIndexerIndexingStatusResponse}
|
|
2014
|
+
*
|
|
2015
|
+
* @throws if the ENSIndexer request fails
|
|
2016
|
+
* @throws if the ENSIndexer returns a non-ok response
|
|
2017
|
+
* @throws if the ENSIndexer response breaks required invariants
|
|
2018
|
+
*/
|
|
2019
|
+
async indexingStatus() {
|
|
2020
|
+
const url = new URL(`/api/indexing-status`, this.options.url);
|
|
2021
|
+
const response = await fetch(url);
|
|
2022
|
+
let responseData;
|
|
2023
|
+
try {
|
|
2024
|
+
responseData = await response.json();
|
|
2025
|
+
} catch {
|
|
2026
|
+
throw new Error("Malformed response data: invalid JSON");
|
|
2027
|
+
}
|
|
2028
|
+
if (!response.ok) {
|
|
2029
|
+
let errorResponse;
|
|
2030
|
+
try {
|
|
2031
|
+
errorResponse = deserializeErrorResponse(responseData);
|
|
2032
|
+
} catch {
|
|
2033
|
+
}
|
|
2034
|
+
if (typeof errorResponse !== "undefined") {
|
|
2035
|
+
throw new Error(`Fetching ENSIndexer Indexing Status Failed: ${errorResponse.message}`);
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
return deserializeEnsIndexerIndexingStatusResponse(
|
|
2039
|
+
responseData
|
|
2040
|
+
);
|
|
2041
|
+
}
|
|
2042
|
+
};
|
|
2043
|
+
|
|
2044
|
+
// src/ensindexer/config/compatibility.ts
|
|
2045
|
+
function validateEnsIndexerPublicConfigCompatibility(configA, configB) {
|
|
2046
|
+
if (configA.indexedChainIds.symmetricDifference(configB.indexedChainIds).size > 0) {
|
|
2047
|
+
throw new Error(
|
|
2048
|
+
[
|
|
2049
|
+
`'indexedChainIds' must be compatible.`,
|
|
2050
|
+
`Stored Config 'indexedChainIds': '${Array.from(configA.indexedChainIds).join(", ")}'.`,
|
|
2051
|
+
`Current Config 'indexedChainIds': '${Array.from(configB.indexedChainIds).join(", ")}'.`
|
|
2052
|
+
].join(" ")
|
|
2053
|
+
);
|
|
2054
|
+
}
|
|
2055
|
+
if (configA.isSubgraphCompatible !== configB.isSubgraphCompatible) {
|
|
2056
|
+
throw new Error(
|
|
2057
|
+
[
|
|
2058
|
+
`'isSubgraphCompatible' flag must be compatible.`,
|
|
2059
|
+
`Stored Config 'isSubgraphCompatible' flag: '${configA.isSubgraphCompatible}'.`,
|
|
2060
|
+
`Current Config 'isSubgraphCompatible' flag: '${configB.isSubgraphCompatible}'.`
|
|
2061
|
+
].join(" ")
|
|
2062
|
+
);
|
|
2063
|
+
}
|
|
2064
|
+
if (configA.namespace !== configB.namespace) {
|
|
2065
|
+
throw new Error(
|
|
2066
|
+
[
|
|
2067
|
+
`'namespace' must be compatible.`,
|
|
2068
|
+
`Stored Config 'namespace': '${configA.namespace}'.`,
|
|
2069
|
+
`Current Config 'namespace': '${configB.namespace}'.`
|
|
2070
|
+
].join(" ")
|
|
2071
|
+
);
|
|
2072
|
+
}
|
|
2073
|
+
if (configA.labelSet.labelSetId !== configB.labelSet.labelSetId) {
|
|
2074
|
+
throw new Error(
|
|
2075
|
+
[
|
|
2076
|
+
`'labelSet.labelSetId' must be compatible.`,
|
|
2077
|
+
`Stored Config 'labelSet.labelSetId': '${configA.labelSet.labelSetId}'.`,
|
|
2078
|
+
`Current Config 'labelSet.labelSetId': '${configB.labelSet.labelSetId}'.`
|
|
2079
|
+
].join(" ")
|
|
2080
|
+
);
|
|
2081
|
+
}
|
|
2082
|
+
if (configA.labelSet.labelSetVersion !== configB.labelSet.labelSetVersion) {
|
|
2083
|
+
throw new Error(
|
|
2084
|
+
[
|
|
2085
|
+
`'labelSet.labelSetVersion' must be compatible.`,
|
|
2086
|
+
`Stored Config 'labelSet.labelSetVersion': '${configA.labelSet.labelSetVersion}'.`,
|
|
2087
|
+
`Current Config 'labelSet.labelSetVersion': '${configB.labelSet.labelSetVersion}'.`
|
|
2088
|
+
].join(" ")
|
|
2089
|
+
);
|
|
2090
|
+
}
|
|
2091
|
+
const configAPluginsSet = new Set(configA.plugins);
|
|
2092
|
+
const configBPluginsSet = new Set(configB.plugins);
|
|
2093
|
+
if (configAPluginsSet.symmetricDifference(configBPluginsSet).size > 0) {
|
|
2094
|
+
throw new Error(
|
|
2095
|
+
[
|
|
2096
|
+
`'plugins' must be compatible.`,
|
|
2097
|
+
`Stored Config 'plugins': '${configA.plugins.join(", ")}'.`,
|
|
2098
|
+
`Current Config 'plugins': '${configB.plugins.join(", ")}'.`
|
|
2099
|
+
].join(" ")
|
|
2100
|
+
);
|
|
2101
|
+
}
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
// src/ensindexer/config/label-utils.ts
|
|
2105
|
+
var import_viem3 = require("viem");
|
|
2106
|
+
function labelHashToBytes(labelHash) {
|
|
2107
|
+
try {
|
|
2108
|
+
if (labelHash.length !== 66) {
|
|
2109
|
+
throw new Error(`Invalid labelHash length ${labelHash.length} characters (expected 66)`);
|
|
2110
|
+
}
|
|
2111
|
+
if (labelHash !== labelHash.toLowerCase()) {
|
|
2112
|
+
throw new Error("Labelhash must be in lowercase");
|
|
2113
|
+
}
|
|
2114
|
+
if (!labelHash.startsWith("0x")) {
|
|
2115
|
+
throw new Error("Labelhash must be 0x-prefixed");
|
|
2116
|
+
}
|
|
2117
|
+
const bytes = (0, import_viem3.hexToBytes)(labelHash);
|
|
2118
|
+
if (bytes.length !== 32) {
|
|
2119
|
+
throw new Error(`Invalid labelHash length ${bytes.length} bytes (expected 32)`);
|
|
2120
|
+
}
|
|
2121
|
+
return bytes;
|
|
2122
|
+
} catch (e) {
|
|
2123
|
+
if (e instanceof Error) {
|
|
2124
|
+
throw e;
|
|
2125
|
+
}
|
|
2126
|
+
throw new Error("Invalid hex format");
|
|
2127
|
+
}
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2130
|
+
// src/ensindexer/config/parsing.ts
|
|
2131
|
+
function parseNonNegativeInteger(maybeNumber) {
|
|
2132
|
+
const trimmed = maybeNumber.trim();
|
|
2133
|
+
if (!trimmed) {
|
|
2134
|
+
throw new Error("Input cannot be empty");
|
|
2135
|
+
}
|
|
2136
|
+
if (trimmed === "-0") {
|
|
2137
|
+
throw new Error("Negative zero is not a valid non-negative integer");
|
|
2138
|
+
}
|
|
2139
|
+
const num = Number(maybeNumber);
|
|
2140
|
+
if (Number.isNaN(num)) {
|
|
2141
|
+
throw new Error(`"${maybeNumber}" is not a valid number`);
|
|
2142
|
+
}
|
|
2143
|
+
if (!Number.isFinite(num)) {
|
|
2144
|
+
throw new Error(`"${maybeNumber}" is not a finite number`);
|
|
2145
|
+
}
|
|
2146
|
+
if (!Number.isInteger(num)) {
|
|
2147
|
+
throw new Error(`"${maybeNumber}" is not an integer`);
|
|
2148
|
+
}
|
|
2149
|
+
if (num < 0) {
|
|
2150
|
+
throw new Error(`"${maybeNumber}" is not a non-negative integer`);
|
|
2151
|
+
}
|
|
2152
|
+
return num;
|
|
2153
|
+
}
|
|
2154
|
+
|
|
2155
|
+
// src/ensindexer/config/validate/ensindexer-public-config.ts
|
|
2156
|
+
var import_v421 = require("zod/v4");
|
|
2157
|
+
function validateEnsIndexerPublicConfig(unvalidatedConfig) {
|
|
2158
|
+
const schema = makeEnsIndexerPublicConfigSchema();
|
|
2159
|
+
const result = schema.safeParse(unvalidatedConfig);
|
|
2160
|
+
if (!result.success) {
|
|
2161
|
+
throw new Error(`Invalid ENSIndexerPublicConfig: ${(0, import_v421.prettifyError)(result.error)}`);
|
|
2162
|
+
}
|
|
2163
|
+
return result.data;
|
|
2164
|
+
}
|
|
2165
|
+
|
|
2166
|
+
// src/ensindexer/config/validate/ensindexer-version-info.ts
|
|
2167
|
+
var import_v422 = require("zod/v4");
|
|
2168
|
+
function validateEnsIndexerVersionInfo(unvalidatedVersionInfo) {
|
|
2169
|
+
const schema = makeEnsIndexerVersionInfoSchema();
|
|
2170
|
+
const result = schema.safeParse(unvalidatedVersionInfo);
|
|
2171
|
+
if (!result.success) {
|
|
2172
|
+
throw new Error(`Invalid EnsIndexerVersionInfo: ${(0, import_v422.prettifyError)(result.error)}`);
|
|
2173
|
+
}
|
|
2174
|
+
return result.data;
|
|
2175
|
+
}
|
|
2176
|
+
|
|
2177
|
+
// src/ensnode/api/indexing-status/deserialize.ts
|
|
2178
|
+
var import_v427 = require("zod/v4");
|
|
2179
|
+
|
|
2180
|
+
// src/stack-info/deserialize/ensnode-stack-info.ts
|
|
2181
|
+
var import_v425 = require("zod/v4");
|
|
2182
|
+
|
|
2183
|
+
// src/stack-info/zod-schemas/ensnode-stack-info.ts
|
|
2184
|
+
var import_v424 = require("zod/v4");
|
|
2185
|
+
|
|
2186
|
+
// src/ensdb/zod-schemas/config.ts
|
|
2187
|
+
var import_v423 = require("zod/v4");
|
|
2188
|
+
var makeEnsDbVersionInfoSchema = (valueLabel) => {
|
|
2189
|
+
const label = valueLabel ?? "EnsDbVersionInfo";
|
|
2190
|
+
return import_v423.z.object({
|
|
2191
|
+
postgresql: import_v423.z.string().nonempty(`${label}.postgresql must be a non-empty string`).describe("Version of the PostgreSQL server hosting the ENSDb instance.")
|
|
2192
|
+
}).describe(label);
|
|
2193
|
+
};
|
|
2194
|
+
var makeEnsDbPublicConfigSchema = (valueLabel) => {
|
|
2195
|
+
const label = valueLabel ?? "EnsDbPublicConfig";
|
|
2196
|
+
return import_v423.z.object({
|
|
2197
|
+
versionInfo: makeEnsDbVersionInfoSchema(`${label}.versionInfo`)
|
|
2198
|
+
}).describe(label);
|
|
2199
|
+
};
|
|
2200
|
+
|
|
2201
|
+
// src/stack-info/zod-schemas/ensnode-stack-info.ts
|
|
2202
|
+
function makeSerializedEnsNodeStackInfoSchema(valueLabel) {
|
|
2203
|
+
const label = valueLabel ?? "ENSNodeStackInfo";
|
|
2204
|
+
return import_v424.z.object({
|
|
2205
|
+
ensApi: makeSerializedEnsApiPublicConfigSchema(`${label}.ensApi`),
|
|
2206
|
+
ensDb: makeEnsDbPublicConfigSchema(`${label}.ensDb`),
|
|
2207
|
+
ensIndexer: makeSerializedEnsIndexerPublicConfigSchema(`${label}.ensIndexer`),
|
|
2208
|
+
ensRainbow: makeEnsRainbowPublicConfigSchema(`${label}.ensRainbow`).optional()
|
|
2209
|
+
});
|
|
2210
|
+
}
|
|
2211
|
+
function makeEnsNodeStackInfoSchema(valueLabel) {
|
|
2212
|
+
const label = valueLabel ?? "ENSNodeStackInfo";
|
|
2213
|
+
return import_v424.z.object({
|
|
2214
|
+
ensApi: makeEnsApiPublicConfigSchema(`${label}.ensApi`),
|
|
2215
|
+
ensDb: makeEnsDbPublicConfigSchema(`${label}.ensDb`),
|
|
2216
|
+
ensIndexer: makeEnsIndexerPublicConfigSchema(`${label}.ensIndexer`),
|
|
2217
|
+
ensRainbow: makeEnsRainbowPublicConfigSchema(`${label}.ensRainbow`).optional()
|
|
2218
|
+
});
|
|
2219
|
+
}
|
|
2220
|
+
|
|
2221
|
+
// src/stack-info/deserialize/ensnode-stack-info.ts
|
|
2222
|
+
function buildUnvalidatedEnsNodeStackInfo(serializedStackInfo) {
|
|
2223
|
+
const { ensApi, ensIndexer, ...rest } = serializedStackInfo;
|
|
2224
|
+
return {
|
|
2225
|
+
...rest,
|
|
2226
|
+
ensApi: buildUnvalidatedEnsApiPublicConfig(ensApi),
|
|
2227
|
+
ensIndexer: buildUnvalidatedEnsIndexerPublicConfig(ensIndexer)
|
|
2228
|
+
};
|
|
2229
|
+
}
|
|
2230
|
+
function deserializeEnsNodeStackInfo(maybeStackInfo, valueLabel) {
|
|
2231
|
+
const parsed = makeSerializedEnsNodeStackInfoSchema(valueLabel).transform(buildUnvalidatedEnsNodeStackInfo).pipe(makeEnsNodeStackInfoSchema(valueLabel)).safeParse(maybeStackInfo);
|
|
2232
|
+
if (parsed.error) {
|
|
2233
|
+
throw new Error(`Cannot deserialize EnsNodeStackInfo:
|
|
2234
|
+
${(0, import_v425.prettifyError)(parsed.error)}
|
|
2235
|
+
`);
|
|
2236
|
+
}
|
|
2237
|
+
return parsed.data;
|
|
2238
|
+
}
|
|
2239
|
+
|
|
2240
|
+
// src/ensnode/api/indexing-status/response.ts
|
|
2241
|
+
var EnsApiIndexingStatusResponseCodes = {
|
|
2242
|
+
/**
|
|
2243
|
+
* Represents that the indexing status is available.
|
|
2244
|
+
*/
|
|
2245
|
+
Ok: "ok",
|
|
2246
|
+
/**
|
|
2247
|
+
* Represents that the indexing status is unavailable.
|
|
2248
|
+
*/
|
|
2249
|
+
Error: "error"
|
|
2250
|
+
};
|
|
2251
|
+
var IndexingStatusResponseCodes = EnsApiIndexingStatusResponseCodes;
|
|
2252
|
+
|
|
2253
|
+
// src/ensnode/api/indexing-status/zod-schemas.ts
|
|
2254
|
+
var import_v426 = require("zod/v4");
|
|
2255
|
+
var makeEnsApiIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => import_v426.z.strictObject({
|
|
2256
|
+
responseCode: import_v426.z.literal(EnsApiIndexingStatusResponseCodes.Ok),
|
|
2257
|
+
realtimeProjection: makeRealtimeIndexingStatusProjectionSchema(valueLabel),
|
|
2258
|
+
stackInfo: makeEnsNodeStackInfoSchema(valueLabel)
|
|
2259
|
+
});
|
|
2260
|
+
var makeEnsApiIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => import_v426.z.strictObject({
|
|
2261
|
+
responseCode: import_v426.z.literal(EnsApiIndexingStatusResponseCodes.Error)
|
|
2262
|
+
});
|
|
2263
|
+
var makeEnsApiIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => import_v426.z.discriminatedUnion("responseCode", [
|
|
2264
|
+
makeEnsApiIndexingStatusResponseOkSchema(valueLabel),
|
|
2265
|
+
makeEnsApiIndexingStatusResponseErrorSchema(valueLabel)
|
|
2266
|
+
]);
|
|
2267
|
+
var makeSerializedEnsApiIndexingStatusResponseOkSchema = (valueLabel = "Serialized Indexing Status Response OK") => import_v426.z.object({
|
|
2268
|
+
responseCode: import_v426.z.literal(EnsApiIndexingStatusResponseCodes.Ok),
|
|
2269
|
+
realtimeProjection: makeSerializedRealtimeIndexingStatusProjectionSchema(valueLabel),
|
|
2270
|
+
stackInfo: makeSerializedEnsNodeStackInfoSchema(valueLabel)
|
|
2271
|
+
});
|
|
2272
|
+
var makeSerializedEnsApiIndexingStatusResponseSchema = (valueLabel = "Serialized Indexing Status Response") => import_v426.z.discriminatedUnion("responseCode", [
|
|
2273
|
+
makeSerializedEnsApiIndexingStatusResponseOkSchema(valueLabel),
|
|
2274
|
+
makeEnsApiIndexingStatusResponseErrorSchema(valueLabel)
|
|
2275
|
+
]);
|
|
2276
|
+
|
|
2277
|
+
// src/ensnode/api/indexing-status/deserialize.ts
|
|
2278
|
+
function buildUnvalidatedEnsApiIndexingStatusResponse(serializedResponse) {
|
|
2279
|
+
if (serializedResponse.responseCode !== EnsApiIndexingStatusResponseCodes.Ok) {
|
|
2280
|
+
return serializedResponse;
|
|
2281
|
+
}
|
|
2282
|
+
const { realtimeProjection, stackInfo, ...rest } = serializedResponse;
|
|
2283
|
+
return {
|
|
2284
|
+
realtimeProjection: buildUnvalidatedRealtimeIndexingStatusProjection(realtimeProjection),
|
|
2285
|
+
stackInfo: buildUnvalidatedEnsNodeStackInfo(stackInfo),
|
|
2286
|
+
...rest
|
|
2287
|
+
};
|
|
2288
|
+
}
|
|
2289
|
+
function deserializeEnsApiIndexingStatusResponse(maybeResponse) {
|
|
2290
|
+
const parsed = makeSerializedEnsApiIndexingStatusResponseSchema().transform(buildUnvalidatedEnsApiIndexingStatusResponse).pipe(makeEnsApiIndexingStatusResponseSchema()).safeParse(maybeResponse);
|
|
2291
|
+
if (parsed.error) {
|
|
2292
|
+
throw new Error(
|
|
2293
|
+
`Cannot deserialize EnsApiIndexingStatusResponse:
|
|
2294
|
+
${(0, import_v427.prettifyError)(parsed.error)}
|
|
2295
|
+
`
|
|
2296
|
+
);
|
|
2297
|
+
}
|
|
2298
|
+
return parsed.data;
|
|
2299
|
+
}
|
|
2300
|
+
var deserializeIndexingStatusResponse = deserializeEnsApiIndexingStatusResponse;
|
|
2301
|
+
|
|
2302
|
+
// src/stack-info/serialize/ensnode-stack-info.ts
|
|
2303
|
+
function serializeEnsNodeStackInfo(stackInfo) {
|
|
2304
|
+
return {
|
|
2305
|
+
ensApi: serializeEnsApiPublicConfig(stackInfo.ensApi),
|
|
2306
|
+
ensDb: stackInfo.ensDb,
|
|
2307
|
+
ensIndexer: serializeEnsIndexerPublicConfig(stackInfo.ensIndexer),
|
|
2308
|
+
ensRainbow: stackInfo.ensRainbow
|
|
2309
|
+
};
|
|
2310
|
+
}
|
|
2311
|
+
|
|
2312
|
+
// src/ensnode/api/indexing-status/serialize.ts
|
|
2313
|
+
function serializeEnsApiIndexingStatusResponse(response) {
|
|
2314
|
+
switch (response.responseCode) {
|
|
2315
|
+
case EnsApiIndexingStatusResponseCodes.Ok:
|
|
2316
|
+
return {
|
|
2317
|
+
responseCode: response.responseCode,
|
|
2318
|
+
realtimeProjection: serializeRealtimeIndexingStatusProjection(response.realtimeProjection),
|
|
2319
|
+
stackInfo: serializeEnsNodeStackInfo(response.stackInfo)
|
|
2320
|
+
};
|
|
2321
|
+
case EnsApiIndexingStatusResponseCodes.Error:
|
|
2322
|
+
return response;
|
|
2323
|
+
}
|
|
2324
|
+
}
|
|
2325
|
+
var serializeIndexingStatusResponse = serializeEnsApiIndexingStatusResponse;
|
|
2326
|
+
|
|
2327
|
+
// src/ensnode/api/name-tokens/deserialize.ts
|
|
2328
|
+
var import_v432 = require("zod/v4");
|
|
2329
|
+
|
|
2330
|
+
// src/ensnode/api/name-tokens/zod-schemas.ts
|
|
2331
|
+
var import_enssdk5 = require("enssdk");
|
|
2332
|
+
var import_v431 = require("zod/v4");
|
|
2333
|
+
|
|
2334
|
+
// src/tokenscope/name-token.ts
|
|
2335
|
+
var import_enssdk4 = require("enssdk");
|
|
2336
|
+
var import_viem7 = require("viem");
|
|
2337
|
+
var import_datasources4 = require("@ensnode/datasources");
|
|
2338
|
+
|
|
2339
|
+
// src/shared/account-id.ts
|
|
2340
|
+
var import_viem4 = require("viem");
|
|
2341
|
+
var accountIdEqual = (a, b) => {
|
|
2342
|
+
return a.chainId === b.chainId && (0, import_viem4.isAddressEqual)(a.address, b.address);
|
|
2343
|
+
};
|
|
2344
|
+
|
|
2345
|
+
// src/shared/datasource-contract.ts
|
|
2346
|
+
var import_datasources3 = require("@ensnode/datasources");
|
|
2347
|
+
var maybeGetDatasourceContract = (namespaceId, datasourceName, contractName) => {
|
|
2348
|
+
const datasource = (0, import_datasources3.maybeGetDatasource)(namespaceId, datasourceName);
|
|
2349
|
+
if (!datasource) return void 0;
|
|
2350
|
+
const address = datasource.contracts[contractName]?.address;
|
|
2351
|
+
if (address === void 0 || Array.isArray(address)) return void 0;
|
|
2352
|
+
return {
|
|
2353
|
+
chainId: datasource.chain.id,
|
|
2354
|
+
address
|
|
2355
|
+
};
|
|
2356
|
+
};
|
|
2357
|
+
var getDatasourceContract = (namespaceId, datasourceName, contractName) => {
|
|
2358
|
+
const contract = maybeGetDatasourceContract(namespaceId, datasourceName, contractName);
|
|
2359
|
+
if (!contract) {
|
|
2360
|
+
throw new Error(
|
|
2361
|
+
`Expected contract not found for ${namespaceId} ${datasourceName} ${contractName}`
|
|
2362
|
+
);
|
|
2363
|
+
}
|
|
2364
|
+
return contract;
|
|
2365
|
+
};
|
|
2366
|
+
var makeContractMatcher = (namespace, b) => (datasourceName, contractName) => {
|
|
2367
|
+
const a = maybeGetDatasourceContract(namespace, datasourceName, contractName);
|
|
2368
|
+
return a && accountIdEqual(a, b);
|
|
2369
|
+
};
|
|
2370
|
+
|
|
2371
|
+
// src/tokenscope/assets.ts
|
|
2372
|
+
var import_enssdk3 = require("enssdk");
|
|
2373
|
+
var import_viem6 = require("viem");
|
|
2374
|
+
var import_v429 = require("zod/v4");
|
|
2375
|
+
|
|
2376
|
+
// src/tokenscope/zod-schemas.ts
|
|
2377
|
+
var import_caip2 = require("caip");
|
|
2378
|
+
var import_enssdk2 = require("enssdk");
|
|
2379
|
+
var import_viem5 = require("viem");
|
|
2380
|
+
var import_v428 = require("zod/v4");
|
|
2381
|
+
var tokenIdSchemaSerializable = import_v428.z.string();
|
|
2382
|
+
var tokenIdSchemaNative = import_v428.z.preprocess(
|
|
2383
|
+
(v) => typeof v === "string" ? BigInt(v) : v,
|
|
2384
|
+
import_v428.z.bigint().positive()
|
|
2385
|
+
);
|
|
2386
|
+
function makeTokenIdSchema(_valueLabel = "Token ID Schema", serializable = false) {
|
|
2387
|
+
if (serializable) {
|
|
2388
|
+
return tokenIdSchemaSerializable;
|
|
2389
|
+
} else {
|
|
2390
|
+
return tokenIdSchemaNative;
|
|
2391
|
+
}
|
|
2392
|
+
}
|
|
2393
|
+
var makeAssetIdSchema = (valueLabel = "Asset ID Schema", serializable) => {
|
|
2394
|
+
return import_v428.z.object({
|
|
2395
|
+
assetNamespace: import_v428.z.enum(import_enssdk2.AssetNamespaces),
|
|
2396
|
+
contract: makeAccountIdSchema(valueLabel),
|
|
2397
|
+
tokenId: makeTokenIdSchema(valueLabel, serializable ?? false)
|
|
2398
|
+
});
|
|
2399
|
+
};
|
|
2400
|
+
var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") => import_v428.z.preprocess((v) => {
|
|
2401
|
+
if (typeof v === "string") {
|
|
2402
|
+
const result = new import_caip2.AssetId(v);
|
|
2403
|
+
return {
|
|
2404
|
+
assetNamespace: result.assetName.namespace,
|
|
2405
|
+
contract: {
|
|
2406
|
+
chainId: Number(result.chainId.reference),
|
|
2407
|
+
address: result.assetName.reference
|
|
2408
|
+
},
|
|
2409
|
+
tokenId: result.tokenId
|
|
2410
|
+
};
|
|
2411
|
+
}
|
|
2412
|
+
return v;
|
|
2413
|
+
}, makeAssetIdSchema(valueLabel));
|
|
2414
|
+
function invariant_nameTokenOwnershipHasNonZeroAddressOwner(ctx) {
|
|
2415
|
+
const ownership = ctx.value;
|
|
2416
|
+
if (ctx.value.owner.address === import_viem5.zeroAddress) {
|
|
2417
|
+
ctx.issues.push({
|
|
2418
|
+
code: "custom",
|
|
2419
|
+
input: ctx.value,
|
|
2420
|
+
message: `Name Token Ownership with '${ownership.ownershipType}' must have 'address' other than the zero address.`
|
|
2421
|
+
});
|
|
2422
|
+
}
|
|
2423
|
+
}
|
|
2424
|
+
var makeNameTokenOwnershipNameWrapperSchema = (valueLabel = "Name Token Ownership NameWrapper") => import_v428.z.object({
|
|
2425
|
+
ownershipType: import_v428.z.literal(NameTokenOwnershipTypes.NameWrapper),
|
|
2426
|
+
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2427
|
+
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2428
|
+
var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") => import_v428.z.object({
|
|
2429
|
+
ownershipType: import_v428.z.literal(NameTokenOwnershipTypes.FullyOnchain),
|
|
2430
|
+
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2431
|
+
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2432
|
+
var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") => import_v428.z.object({
|
|
2433
|
+
ownershipType: import_v428.z.literal(NameTokenOwnershipTypes.Burned),
|
|
2434
|
+
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2435
|
+
}).check(invariant_nameTokenOwnershipHasZeroAddressOwner);
|
|
2436
|
+
var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") => import_v428.z.object({
|
|
2437
|
+
ownershipType: import_v428.z.literal(NameTokenOwnershipTypes.Unknown),
|
|
2438
|
+
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2439
|
+
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2440
|
+
function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
|
|
2441
|
+
const ownership = ctx.value;
|
|
2442
|
+
if (ctx.value.owner.address !== import_viem5.zeroAddress) {
|
|
2443
|
+
ctx.issues.push({
|
|
2444
|
+
code: "custom",
|
|
2445
|
+
input: ctx.value,
|
|
2446
|
+
message: `Name Token Ownership with '${ownership.ownershipType}' must have 'address' set to the zero address.`
|
|
2447
|
+
});
|
|
2448
|
+
}
|
|
2449
|
+
}
|
|
2450
|
+
var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") => import_v428.z.discriminatedUnion("ownershipType", [
|
|
2451
|
+
makeNameTokenOwnershipNameWrapperSchema(valueLabel),
|
|
2452
|
+
makeNameTokenOwnershipFullyOnchainSchema(valueLabel),
|
|
2453
|
+
makeNameTokenOwnershipBurnedSchema(valueLabel),
|
|
2454
|
+
makeNameTokenOwnershipUnknownSchema(valueLabel)
|
|
2455
|
+
]);
|
|
2456
|
+
var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) => import_v428.z.object({
|
|
2400
2457
|
token: makeAssetIdSchema(`${valueLabel}.token`, serializable),
|
|
2401
2458
|
ownership: makeNameTokenOwnershipSchema(`${valueLabel}.ownership`),
|
|
2402
|
-
mintStatus:
|
|
2459
|
+
mintStatus: import_v428.z.enum(NFTMintStatuses)
|
|
2403
2460
|
});
|
|
2404
2461
|
|
|
2405
2462
|
// src/tokenscope/assets.ts
|
|
@@ -2407,7 +2464,7 @@ function serializeAssetId(assetId) {
|
|
|
2407
2464
|
return {
|
|
2408
2465
|
assetNamespace: assetId.assetNamespace,
|
|
2409
2466
|
contract: assetId.contract,
|
|
2410
|
-
tokenId:
|
|
2467
|
+
tokenId: assetId.tokenId.toString()
|
|
2411
2468
|
};
|
|
2412
2469
|
}
|
|
2413
2470
|
function deserializeAssetId(maybeAssetId, valueLabel) {
|
|
@@ -2415,7 +2472,7 @@ function deserializeAssetId(maybeAssetId, valueLabel) {
|
|
|
2415
2472
|
const parsed = schema.safeParse(maybeAssetId);
|
|
2416
2473
|
if (parsed.error) {
|
|
2417
2474
|
throw new RangeError(`Cannot deserialize AssetId:
|
|
2418
|
-
${(0,
|
|
2475
|
+
${(0, import_v429.prettifyError)(parsed.error)}
|
|
2419
2476
|
`);
|
|
2420
2477
|
}
|
|
2421
2478
|
return parsed.data;
|
|
@@ -2425,7 +2482,7 @@ function parseAssetId(maybeAssetId, valueLabel) {
|
|
|
2425
2482
|
const parsed = schema.safeParse(maybeAssetId);
|
|
2426
2483
|
if (parsed.error) {
|
|
2427
2484
|
throw new RangeError(`Cannot parse AssetId:
|
|
2428
|
-
${(0,
|
|
2485
|
+
${(0, import_v429.prettifyError)(parsed.error)}
|
|
2429
2486
|
`);
|
|
2430
2487
|
}
|
|
2431
2488
|
return parsed.data;
|
|
@@ -2448,7 +2505,7 @@ var NFTMintStatuses = {
|
|
|
2448
2505
|
Burned: "burned"
|
|
2449
2506
|
};
|
|
2450
2507
|
var formatNFTTransferEventMetadata = (metadata) => {
|
|
2451
|
-
const assetIdString =
|
|
2508
|
+
const assetIdString = (0, import_enssdk3.stringifyAssetId)(metadata.nft);
|
|
2452
2509
|
return [
|
|
2453
2510
|
`Event: ${metadata.eventHandlerName}`,
|
|
2454
2511
|
`Chain ID: ${metadata.chainId}`,
|
|
@@ -2560,11 +2617,11 @@ var NFTTransferTypes = {
|
|
|
2560
2617
|
};
|
|
2561
2618
|
var getNFTTransferType = (from, to, allowMintedRemint, metadata, currentlyIndexedOwner) => {
|
|
2562
2619
|
const isIndexed = currentlyIndexedOwner !== void 0;
|
|
2563
|
-
const isIndexedAsMinted = isIndexed && !(0,
|
|
2564
|
-
const isMint = (0,
|
|
2565
|
-
const isBurn = (0,
|
|
2566
|
-
const isSelfTransfer = (0,
|
|
2567
|
-
if (isIndexed && !(0,
|
|
2620
|
+
const isIndexedAsMinted = isIndexed && !(0, import_viem6.isAddressEqual)(currentlyIndexedOwner, import_viem6.zeroAddress);
|
|
2621
|
+
const isMint = (0, import_viem6.isAddressEqual)(from, import_viem6.zeroAddress);
|
|
2622
|
+
const isBurn = (0, import_viem6.isAddressEqual)(to, import_viem6.zeroAddress);
|
|
2623
|
+
const isSelfTransfer = (0, import_viem6.isAddressEqual)(from, to);
|
|
2624
|
+
if (isIndexed && !(0, import_viem6.isAddressEqual)(currentlyIndexedOwner, from)) {
|
|
2568
2625
|
if (isMint && allowMintedRemint) {
|
|
2569
2626
|
} else {
|
|
2570
2627
|
throw new Error(
|
|
@@ -2677,12 +2734,12 @@ function serializeNameToken(nameToken) {
|
|
|
2677
2734
|
function getNameWrapperAccounts(namespaceId) {
|
|
2678
2735
|
const ethnamesNameWrapperAccount = getDatasourceContract(
|
|
2679
2736
|
namespaceId,
|
|
2680
|
-
|
|
2737
|
+
import_datasources4.DatasourceNames.ENSRoot,
|
|
2681
2738
|
"NameWrapper"
|
|
2682
2739
|
);
|
|
2683
2740
|
const lineanamesNameWrapperAccount = maybeGetDatasourceContract(
|
|
2684
2741
|
namespaceId,
|
|
2685
|
-
|
|
2742
|
+
import_datasources4.DatasourceNames.Lineanames,
|
|
2686
2743
|
"NameWrapper"
|
|
2687
2744
|
);
|
|
2688
2745
|
const nameWrapperAccounts = [
|
|
@@ -2705,13 +2762,14 @@ function getNameTokenOwnership(namespaceId, name, owner) {
|
|
|
2705
2762
|
owner
|
|
2706
2763
|
};
|
|
2707
2764
|
}
|
|
2708
|
-
if ((0,
|
|
2765
|
+
if ((0, import_viem7.isAddressEqual)(owner.address, import_viem7.zeroAddress)) {
|
|
2709
2766
|
return {
|
|
2710
2767
|
ownershipType: NameTokenOwnershipTypes.Burned,
|
|
2711
2768
|
owner
|
|
2712
2769
|
};
|
|
2713
2770
|
}
|
|
2714
|
-
const parentName =
|
|
2771
|
+
const parentName = (0, import_enssdk4.getParentInterpretedName)(name);
|
|
2772
|
+
if (parentName === null) throw new Error(`Invariant: '${name}' has no parent Name.`);
|
|
2715
2773
|
if (parentName === "eth") {
|
|
2716
2774
|
return {
|
|
2717
2775
|
ownershipType: NameTokenOwnershipTypes.FullyOnchain,
|
|
@@ -2724,14 +2782,14 @@ function getNameTokenOwnership(namespaceId, name, owner) {
|
|
|
2724
2782
|
};
|
|
2725
2783
|
}
|
|
2726
2784
|
|
|
2727
|
-
// src/
|
|
2728
|
-
var
|
|
2729
|
-
var
|
|
2730
|
-
message:
|
|
2731
|
-
details:
|
|
2785
|
+
// src/ensnode/api/shared/errors/zod-schemas.ts
|
|
2786
|
+
var import_v430 = require("zod/v4");
|
|
2787
|
+
var makeErrorResponseSchema = () => import_v430.z.object({
|
|
2788
|
+
message: import_v430.z.string(),
|
|
2789
|
+
details: import_v430.z.optional(import_v430.z.unknown())
|
|
2732
2790
|
});
|
|
2733
2791
|
|
|
2734
|
-
// src/
|
|
2792
|
+
// src/ensnode/api/name-tokens/response.ts
|
|
2735
2793
|
var NameTokensResponseCodes = {
|
|
2736
2794
|
/**
|
|
2737
2795
|
* Represents a response when Name Tokens API can respond with requested data.
|
|
@@ -2766,16 +2824,16 @@ var NameTokensResponseErrorCodes = {
|
|
|
2766
2824
|
IndexingStatusUnsupported: "unsupported-indexing-status"
|
|
2767
2825
|
};
|
|
2768
2826
|
|
|
2769
|
-
// src/
|
|
2770
|
-
var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) =>
|
|
2827
|
+
// src/ensnode/api/name-tokens/zod-schemas.ts
|
|
2828
|
+
var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) => import_v431.z.object({
|
|
2771
2829
|
domainId: makeNodeSchema(`${valueLabel}.domainId`),
|
|
2772
2830
|
name: makeReinterpretedNameSchema(valueLabel),
|
|
2773
|
-
tokens:
|
|
2831
|
+
tokens: import_v431.z.array(makeNameTokenSchema(`${valueLabel}.tokens`, serializable)).nonempty(),
|
|
2774
2832
|
expiresAt: makeUnixTimestampSchema(`${valueLabel}.expiresAt`),
|
|
2775
2833
|
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
|
|
2776
2834
|
}).check(function invariant_nameIsAssociatedWithDomainId(ctx) {
|
|
2777
2835
|
const { name, domainId } = ctx.value;
|
|
2778
|
-
if ((0,
|
|
2836
|
+
if ((0, import_enssdk5.namehashInterpretedName)(name) !== domainId) {
|
|
2779
2837
|
ctx.issues.push({
|
|
2780
2838
|
code: "custom",
|
|
2781
2839
|
input: ctx.value,
|
|
@@ -2812,51 +2870,51 @@ var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", seria
|
|
|
2812
2870
|
});
|
|
2813
2871
|
}
|
|
2814
2872
|
});
|
|
2815
|
-
var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) =>
|
|
2816
|
-
responseCode:
|
|
2873
|
+
var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) => import_v431.z.strictObject({
|
|
2874
|
+
responseCode: import_v431.z.literal(NameTokensResponseCodes.Ok),
|
|
2817
2875
|
registeredNameTokens: makeRegisteredNameTokenSchema(`${valueLabel}.nameTokens`, serializable)
|
|
2818
2876
|
});
|
|
2819
|
-
var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") =>
|
|
2820
|
-
responseCode:
|
|
2821
|
-
errorCode:
|
|
2822
|
-
error:
|
|
2877
|
+
var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") => import_v431.z.strictObject({
|
|
2878
|
+
responseCode: import_v431.z.literal(NameTokensResponseCodes.Error),
|
|
2879
|
+
errorCode: import_v431.z.literal(NameTokensResponseErrorCodes.NameTokensNotIndexed),
|
|
2880
|
+
error: makeErrorResponseSchema()
|
|
2823
2881
|
});
|
|
2824
|
-
var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") =>
|
|
2825
|
-
responseCode:
|
|
2826
|
-
errorCode:
|
|
2827
|
-
error:
|
|
2882
|
+
var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") => import_v431.z.strictObject({
|
|
2883
|
+
responseCode: import_v431.z.literal(NameTokensResponseCodes.Error),
|
|
2884
|
+
errorCode: import_v431.z.literal(NameTokensResponseErrorCodes.EnsIndexerConfigUnsupported),
|
|
2885
|
+
error: makeErrorResponseSchema()
|
|
2828
2886
|
});
|
|
2829
|
-
var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") =>
|
|
2830
|
-
responseCode:
|
|
2831
|
-
errorCode:
|
|
2832
|
-
error:
|
|
2887
|
+
var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") => import_v431.z.strictObject({
|
|
2888
|
+
responseCode: import_v431.z.literal(NameTokensResponseCodes.Error),
|
|
2889
|
+
errorCode: import_v431.z.literal(NameTokensResponseErrorCodes.IndexingStatusUnsupported),
|
|
2890
|
+
error: makeErrorResponseSchema()
|
|
2833
2891
|
});
|
|
2834
|
-
var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") =>
|
|
2892
|
+
var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") => import_v431.z.discriminatedUnion("errorCode", [
|
|
2835
2893
|
makeNameTokensResponseErrorNameTokensNotIndexedSchema(valueLabel),
|
|
2836
2894
|
makeNameTokensResponseErrorEnsIndexerConfigUnsupported(valueLabel),
|
|
2837
2895
|
makeNameTokensResponseErrorNameIndexingStatusUnsupported(valueLabel)
|
|
2838
2896
|
]);
|
|
2839
2897
|
var makeNameTokensResponseSchema = (valueLabel = "Name Tokens Response", serializable) => {
|
|
2840
|
-
return
|
|
2898
|
+
return import_v431.z.discriminatedUnion("responseCode", [
|
|
2841
2899
|
makeNameTokensResponseOkSchema(valueLabel, serializable ?? false),
|
|
2842
2900
|
makeNameTokensResponseErrorSchema(valueLabel)
|
|
2843
2901
|
]);
|
|
2844
2902
|
};
|
|
2845
2903
|
|
|
2846
|
-
// src/
|
|
2904
|
+
// src/ensnode/api/name-tokens/deserialize.ts
|
|
2847
2905
|
function deserializedNameTokensResponse(maybeResponse) {
|
|
2848
2906
|
const parsed = makeNameTokensResponseSchema("Name Tokens Response", false).safeParse(
|
|
2849
2907
|
maybeResponse
|
|
2850
2908
|
);
|
|
2851
2909
|
if (parsed.error) {
|
|
2852
2910
|
throw new Error(`Cannot deserialize NameTokensResponse:
|
|
2853
|
-
${(0,
|
|
2911
|
+
${(0, import_v432.prettifyError)(parsed.error)}
|
|
2854
2912
|
`);
|
|
2855
2913
|
}
|
|
2856
2914
|
return parsed.data;
|
|
2857
2915
|
}
|
|
2858
2916
|
|
|
2859
|
-
// src/
|
|
2917
|
+
// src/ensnode/api/name-tokens/prerequisites.ts
|
|
2860
2918
|
var nameTokensPrerequisites = Object.freeze({
|
|
2861
2919
|
/**
|
|
2862
2920
|
* Required plugins to enable Name Tokens API routes.
|
|
@@ -2895,7 +2953,7 @@ var nameTokensPrerequisites = Object.freeze({
|
|
|
2895
2953
|
}
|
|
2896
2954
|
});
|
|
2897
2955
|
|
|
2898
|
-
// src/
|
|
2956
|
+
// src/ensnode/api/name-tokens/serialize.ts
|
|
2899
2957
|
function serializeRegisteredNameTokens({
|
|
2900
2958
|
domainId,
|
|
2901
2959
|
name,
|
|
@@ -2923,45 +2981,44 @@ function serializeNameTokensResponse(response) {
|
|
|
2923
2981
|
}
|
|
2924
2982
|
}
|
|
2925
2983
|
|
|
2926
|
-
// src/
|
|
2927
|
-
var
|
|
2984
|
+
// src/ensnode/api/registrar-actions/deserialize.ts
|
|
2985
|
+
var import_v436 = require("zod/v4");
|
|
2928
2986
|
|
|
2929
|
-
// src/
|
|
2930
|
-
var
|
|
2931
|
-
var
|
|
2987
|
+
// src/ensnode/api/registrar-actions/zod-schemas.ts
|
|
2988
|
+
var import_enssdk7 = require("enssdk");
|
|
2989
|
+
var import_v435 = require("zod/v4");
|
|
2932
2990
|
|
|
2933
2991
|
// src/registrars/zod-schemas.ts
|
|
2934
|
-
var
|
|
2992
|
+
var import_v433 = require("zod/v4");
|
|
2935
2993
|
|
|
2936
2994
|
// src/registrars/encoded-referrer.ts
|
|
2937
|
-
var
|
|
2995
|
+
var import_enssdk6 = require("enssdk");
|
|
2996
|
+
var import_viem8 = require("viem");
|
|
2938
2997
|
var ENCODED_REFERRER_BYTE_OFFSET = 12;
|
|
2939
2998
|
var ENCODED_REFERRER_BYTE_LENGTH = 32;
|
|
2940
|
-
var EXPECTED_ENCODED_REFERRER_PADDING = (0,
|
|
2999
|
+
var EXPECTED_ENCODED_REFERRER_PADDING = (0, import_viem8.pad)("0x", {
|
|
2941
3000
|
size: ENCODED_REFERRER_BYTE_OFFSET,
|
|
2942
3001
|
dir: "left"
|
|
2943
3002
|
});
|
|
2944
|
-
var ZERO_ENCODED_REFERRER = (0,
|
|
3003
|
+
var ZERO_ENCODED_REFERRER = (0, import_viem8.pad)("0x", {
|
|
2945
3004
|
size: ENCODED_REFERRER_BYTE_LENGTH,
|
|
2946
3005
|
dir: "left"
|
|
2947
3006
|
});
|
|
2948
3007
|
function buildEncodedReferrer(address) {
|
|
2949
|
-
|
|
2950
|
-
return (0,
|
|
3008
|
+
if (!(0, import_enssdk6.isNormalizedAddress)(address)) throw new Error(`Address '${address}' is not normalized.`);
|
|
3009
|
+
return (0, import_viem8.pad)(address, { size: ENCODED_REFERRER_BYTE_LENGTH, dir: "left" });
|
|
2951
3010
|
}
|
|
2952
3011
|
function decodeEncodedReferrer(encodedReferrer) {
|
|
2953
|
-
if ((0,
|
|
3012
|
+
if ((0, import_viem8.size)(encodedReferrer) !== ENCODED_REFERRER_BYTE_LENGTH) {
|
|
2954
3013
|
throw new Error(
|
|
2955
3014
|
`Encoded referrer value must be represented by ${ENCODED_REFERRER_BYTE_LENGTH} bytes.`
|
|
2956
3015
|
);
|
|
2957
3016
|
}
|
|
2958
|
-
const padding = (0,
|
|
2959
|
-
if (padding !== EXPECTED_ENCODED_REFERRER_PADDING)
|
|
2960
|
-
|
|
2961
|
-
}
|
|
2962
|
-
const decodedReferrer = (0, import_viem15.slice)(encodedReferrer, ENCODED_REFERRER_BYTE_OFFSET);
|
|
3017
|
+
const padding = (0, import_viem8.slice)(encodedReferrer, 0, ENCODED_REFERRER_BYTE_OFFSET);
|
|
3018
|
+
if (padding !== EXPECTED_ENCODED_REFERRER_PADDING) return import_viem8.zeroAddress;
|
|
3019
|
+
const decodedReferrer = (0, import_viem8.slice)(encodedReferrer, ENCODED_REFERRER_BYTE_OFFSET);
|
|
2963
3020
|
try {
|
|
2964
|
-
return (0,
|
|
3021
|
+
return (0, import_enssdk6.toNormalizedAddress)(decodedReferrer);
|
|
2965
3022
|
} catch {
|
|
2966
3023
|
throw new Error(`Decoded referrer value must be a valid EVM address.`);
|
|
2967
3024
|
}
|
|
@@ -3006,11 +3063,11 @@ function serializeRegistrarAction(registrarAction) {
|
|
|
3006
3063
|
}
|
|
3007
3064
|
|
|
3008
3065
|
// src/registrars/zod-schemas.ts
|
|
3009
|
-
var makeSubregistrySchema = (valueLabel = "Subregistry") =>
|
|
3066
|
+
var makeSubregistrySchema = (valueLabel = "Subregistry") => import_v433.z.object({
|
|
3010
3067
|
subregistryId: makeAccountIdSchema(`${valueLabel} Subregistry ID`),
|
|
3011
3068
|
node: makeNodeSchema(`${valueLabel} Node`)
|
|
3012
3069
|
});
|
|
3013
|
-
var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") =>
|
|
3070
|
+
var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") => import_v433.z.object({
|
|
3014
3071
|
subregistry: makeSubregistrySchema(`${valueLabel} Subregistry`),
|
|
3015
3072
|
node: makeNodeSchema(`${valueLabel} Node`),
|
|
3016
3073
|
expiresAt: makeUnixTimestampSchema(`${valueLabel} Expires at`)
|
|
@@ -3026,24 +3083,24 @@ function invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium(ctx) {
|
|
|
3026
3083
|
});
|
|
3027
3084
|
}
|
|
3028
3085
|
}
|
|
3029
|
-
var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") =>
|
|
3086
|
+
var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") => import_v433.z.union([
|
|
3030
3087
|
// pricing available
|
|
3031
|
-
|
|
3088
|
+
import_v433.z.object({
|
|
3032
3089
|
baseCost: makePriceEthSchema(`${valueLabel} Base Cost`),
|
|
3033
3090
|
premium: makePriceEthSchema(`${valueLabel} Premium`),
|
|
3034
3091
|
total: makePriceEthSchema(`${valueLabel} Total`)
|
|
3035
3092
|
}).check(invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium).transform((v) => v),
|
|
3036
3093
|
// pricing unknown
|
|
3037
|
-
|
|
3038
|
-
baseCost:
|
|
3039
|
-
premium:
|
|
3040
|
-
total:
|
|
3094
|
+
import_v433.z.object({
|
|
3095
|
+
baseCost: import_v433.z.null(),
|
|
3096
|
+
premium: import_v433.z.null(),
|
|
3097
|
+
total: import_v433.z.null()
|
|
3041
3098
|
}).transform((v) => v)
|
|
3042
3099
|
]);
|
|
3043
3100
|
function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
|
|
3044
3101
|
const { encodedReferrer, decodedReferrer } = ctx.value;
|
|
3045
3102
|
try {
|
|
3046
|
-
const expectedDecodedReferrer = decodeEncodedReferrer(encodedReferrer)
|
|
3103
|
+
const expectedDecodedReferrer = decodeEncodedReferrer(encodedReferrer);
|
|
3047
3104
|
if (decodedReferrer !== expectedDecodedReferrer) {
|
|
3048
3105
|
ctx.issues.push({
|
|
3049
3106
|
code: "custom",
|
|
@@ -3060,19 +3117,19 @@ function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
|
|
|
3060
3117
|
});
|
|
3061
3118
|
}
|
|
3062
3119
|
}
|
|
3063
|
-
var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") =>
|
|
3120
|
+
var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") => import_v433.z.union([
|
|
3064
3121
|
// referral available
|
|
3065
|
-
|
|
3122
|
+
import_v433.z.object({
|
|
3066
3123
|
encodedReferrer: makeHexStringSchema(
|
|
3067
3124
|
{ bytesCount: ENCODED_REFERRER_BYTE_LENGTH },
|
|
3068
3125
|
`${valueLabel} Encoded Referrer`
|
|
3069
3126
|
),
|
|
3070
|
-
decodedReferrer:
|
|
3127
|
+
decodedReferrer: makeNormalizedAddressSchema(`${valueLabel} Decoded Referrer`)
|
|
3071
3128
|
}).check(invariant_registrarActionDecodedReferrerBasedOnRawReferrer),
|
|
3072
3129
|
// referral not applicable
|
|
3073
|
-
|
|
3074
|
-
encodedReferrer:
|
|
3075
|
-
decodedReferrer:
|
|
3130
|
+
import_v433.z.object({
|
|
3131
|
+
encodedReferrer: import_v433.z.null(),
|
|
3132
|
+
decodedReferrer: import_v433.z.null()
|
|
3076
3133
|
})
|
|
3077
3134
|
]);
|
|
3078
3135
|
function invariant_eventIdsInitialElementIsTheActionId(ctx) {
|
|
@@ -3085,54 +3142,53 @@ function invariant_eventIdsInitialElementIsTheActionId(ctx) {
|
|
|
3085
3142
|
});
|
|
3086
3143
|
}
|
|
3087
3144
|
}
|
|
3088
|
-
var EventIdSchema =
|
|
3089
|
-
var EventIdsSchema =
|
|
3090
|
-
var
|
|
3145
|
+
var EventIdSchema = import_v433.z.string().nonempty();
|
|
3146
|
+
var EventIdsSchema = import_v433.z.array(EventIdSchema).min(1).transform((v) => v);
|
|
3147
|
+
var makeBaseRegistrarActionSchemaWithoutCheck = (valueLabel = "Base Registrar Action") => import_v433.z.object({
|
|
3091
3148
|
id: EventIdSchema,
|
|
3092
3149
|
incrementalDuration: makeDurationSchema(`${valueLabel} Incremental Duration`),
|
|
3093
|
-
registrant:
|
|
3094
|
-
registrationLifecycle: makeRegistrationLifecycleSchema(
|
|
3095
|
-
`${valueLabel} Registration Lifecycle`
|
|
3096
|
-
),
|
|
3150
|
+
registrant: makeNormalizedAddressSchema(`${valueLabel} Registrant`),
|
|
3151
|
+
registrationLifecycle: makeRegistrationLifecycleSchema(`${valueLabel} Registration Lifecycle`),
|
|
3097
3152
|
pricing: makeRegistrarActionPricingSchema(`${valueLabel} Pricing`),
|
|
3098
3153
|
referral: makeRegistrarActionReferralSchema(`${valueLabel} Referral`),
|
|
3099
3154
|
block: makeBlockRefSchema(`${valueLabel} Block`),
|
|
3100
3155
|
transactionHash: makeTransactionHashSchema(`${valueLabel} Transaction Hash`),
|
|
3101
3156
|
eventIds: EventIdsSchema
|
|
3102
|
-
})
|
|
3157
|
+
});
|
|
3158
|
+
var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => makeBaseRegistrarActionSchemaWithoutCheck(valueLabel).check(
|
|
3159
|
+
invariant_eventIdsInitialElementIsTheActionId
|
|
3160
|
+
);
|
|
3103
3161
|
var makeRegistrarActionRegistrationSchema = (valueLabel = "Registration ") => makeBaseRegistrarActionSchema(valueLabel).extend({
|
|
3104
|
-
type:
|
|
3162
|
+
type: import_v433.z.literal(RegistrarActionTypes.Registration)
|
|
3105
3163
|
});
|
|
3106
3164
|
var makeRegistrarActionRenewalSchema = (valueLabel = "Renewal") => makeBaseRegistrarActionSchema(valueLabel).extend({
|
|
3107
|
-
type:
|
|
3165
|
+
type: import_v433.z.literal(RegistrarActionTypes.Renewal)
|
|
3108
3166
|
});
|
|
3109
|
-
var makeRegistrarActionSchema = (valueLabel = "Registrar Action") =>
|
|
3167
|
+
var makeRegistrarActionSchema = (valueLabel = "Registrar Action") => import_v433.z.discriminatedUnion("type", [
|
|
3110
3168
|
makeRegistrarActionRegistrationSchema(`${valueLabel} Registration`),
|
|
3111
3169
|
makeRegistrarActionRenewalSchema(`${valueLabel} Renewal`)
|
|
3112
3170
|
]);
|
|
3113
3171
|
|
|
3114
|
-
// src/
|
|
3115
|
-
var
|
|
3172
|
+
// src/ensnode/api/shared/pagination/zod-schemas.ts
|
|
3173
|
+
var import_v434 = require("zod/v4");
|
|
3116
3174
|
|
|
3117
|
-
// src/
|
|
3175
|
+
// src/ensnode/api/shared/pagination/request.ts
|
|
3118
3176
|
var RECORDS_PER_PAGE_DEFAULT = 10;
|
|
3119
3177
|
var RECORDS_PER_PAGE_MAX = 100;
|
|
3120
3178
|
|
|
3121
|
-
// src/
|
|
3122
|
-
var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") =>
|
|
3179
|
+
// src/ensnode/api/shared/pagination/zod-schemas.ts
|
|
3180
|
+
var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") => import_v434.z.object({
|
|
3123
3181
|
page: makePositiveIntegerSchema(`${valueLabel}.page`),
|
|
3124
3182
|
recordsPerPage: makePositiveIntegerSchema(`${valueLabel}.recordsPerPage`).max(
|
|
3125
3183
|
RECORDS_PER_PAGE_MAX,
|
|
3126
3184
|
`${valueLabel}.recordsPerPage must not exceed ${RECORDS_PER_PAGE_MAX}`
|
|
3127
3185
|
)
|
|
3128
3186
|
});
|
|
3129
|
-
var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") =>
|
|
3130
|
-
totalRecords:
|
|
3131
|
-
totalPages:
|
|
3132
|
-
hasNext:
|
|
3133
|
-
hasPrev:
|
|
3134
|
-
startIndex: import_v425.z.undefined(),
|
|
3135
|
-
endIndex: import_v425.z.undefined()
|
|
3187
|
+
var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") => import_v434.z.object({
|
|
3188
|
+
totalRecords: import_v434.z.literal(0),
|
|
3189
|
+
totalPages: import_v434.z.literal(1),
|
|
3190
|
+
hasNext: import_v434.z.literal(false),
|
|
3191
|
+
hasPrev: import_v434.z.literal(false)
|
|
3136
3192
|
}).extend(makeRequestPageParamsSchema(valueLabel).shape);
|
|
3137
3193
|
function invariant_responsePageWithRecordsIsCorrect(ctx) {
|
|
3138
3194
|
const { hasNext, hasPrev, recordsPerPage, page, totalRecords, startIndex, endIndex } = ctx.value;
|
|
@@ -3167,20 +3223,20 @@ function invariant_responsePageWithRecordsIsCorrect(ctx) {
|
|
|
3167
3223
|
});
|
|
3168
3224
|
}
|
|
3169
3225
|
}
|
|
3170
|
-
var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") =>
|
|
3226
|
+
var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") => import_v434.z.object({
|
|
3171
3227
|
totalRecords: makePositiveIntegerSchema(`${valueLabel}.totalRecords`),
|
|
3172
3228
|
totalPages: makePositiveIntegerSchema(`${valueLabel}.totalPages`),
|
|
3173
|
-
hasNext:
|
|
3174
|
-
hasPrev:
|
|
3229
|
+
hasNext: import_v434.z.boolean(),
|
|
3230
|
+
hasPrev: import_v434.z.boolean(),
|
|
3175
3231
|
startIndex: makeNonNegativeIntegerSchema(`${valueLabel}.startIndex`),
|
|
3176
3232
|
endIndex: makeNonNegativeIntegerSchema(`${valueLabel}.endIndex`)
|
|
3177
3233
|
}).extend(makeRequestPageParamsSchema(valueLabel).shape).check(invariant_responsePageWithRecordsIsCorrect);
|
|
3178
|
-
var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") =>
|
|
3234
|
+
var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") => import_v434.z.union([
|
|
3179
3235
|
makeResponsePageContextSchemaWithNoRecords(valueLabel),
|
|
3180
3236
|
makeResponsePageContextSchemaWithRecords(valueLabel)
|
|
3181
3237
|
]);
|
|
3182
3238
|
|
|
3183
|
-
// src/
|
|
3239
|
+
// src/ensnode/api/registrar-actions/response.ts
|
|
3184
3240
|
var RegistrarActionsResponseCodes = {
|
|
3185
3241
|
/**
|
|
3186
3242
|
* Represents that Registrar Actions are available.
|
|
@@ -3192,11 +3248,11 @@ var RegistrarActionsResponseCodes = {
|
|
|
3192
3248
|
Error: "error"
|
|
3193
3249
|
};
|
|
3194
3250
|
|
|
3195
|
-
// src/
|
|
3251
|
+
// src/ensnode/api/registrar-actions/zod-schemas.ts
|
|
3196
3252
|
function invariant_registrationLifecycleNodeMatchesName(ctx) {
|
|
3197
3253
|
const { name, action } = ctx.value;
|
|
3198
3254
|
const expectedNode = action.registrationLifecycle.node;
|
|
3199
|
-
const actualNode = (0,
|
|
3255
|
+
const actualNode = (0, import_enssdk7.namehashInterpretedName)(name);
|
|
3200
3256
|
if (actualNode !== expectedNode) {
|
|
3201
3257
|
ctx.issues.push({
|
|
3202
3258
|
code: "custom",
|
|
@@ -3205,39 +3261,39 @@ function invariant_registrationLifecycleNodeMatchesName(ctx) {
|
|
|
3205
3261
|
});
|
|
3206
3262
|
}
|
|
3207
3263
|
}
|
|
3208
|
-
var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") =>
|
|
3264
|
+
var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") => import_v435.z.object({
|
|
3209
3265
|
action: makeRegistrarActionSchema(valueLabel),
|
|
3210
3266
|
name: makeReinterpretedNameSchema(valueLabel)
|
|
3211
3267
|
}).check(invariant_registrationLifecycleNodeMatchesName);
|
|
3212
|
-
var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") =>
|
|
3213
|
-
responseCode:
|
|
3214
|
-
registrarActions:
|
|
3268
|
+
var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") => import_v435.z.object({
|
|
3269
|
+
responseCode: import_v435.z.literal(RegistrarActionsResponseCodes.Ok),
|
|
3270
|
+
registrarActions: import_v435.z.array(makeNamedRegistrarActionSchema(valueLabel)),
|
|
3215
3271
|
pageContext: makeResponsePageContextSchema(`${valueLabel}.pageContext`),
|
|
3216
|
-
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
|
|
3272
|
+
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
|
|
3217
3273
|
});
|
|
3218
|
-
var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") =>
|
|
3219
|
-
responseCode:
|
|
3220
|
-
error:
|
|
3274
|
+
var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") => import_v435.z.strictObject({
|
|
3275
|
+
responseCode: import_v435.z.literal(RegistrarActionsResponseCodes.Error),
|
|
3276
|
+
error: makeErrorResponseSchema()
|
|
3221
3277
|
});
|
|
3222
|
-
var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") =>
|
|
3278
|
+
var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") => import_v435.z.discriminatedUnion("responseCode", [
|
|
3223
3279
|
makeRegistrarActionsResponseOkSchema(valueLabel),
|
|
3224
3280
|
makeRegistrarActionsResponseErrorSchema(valueLabel)
|
|
3225
3281
|
]);
|
|
3226
3282
|
|
|
3227
|
-
// src/
|
|
3283
|
+
// src/ensnode/api/registrar-actions/deserialize.ts
|
|
3228
3284
|
function deserializeRegistrarActionsResponse(maybeResponse) {
|
|
3229
3285
|
const parsed = makeRegistrarActionsResponseSchema().safeParse(maybeResponse);
|
|
3230
3286
|
if (parsed.error) {
|
|
3231
3287
|
throw new Error(
|
|
3232
3288
|
`Cannot deserialize RegistrarActionsResponse:
|
|
3233
|
-
${(0,
|
|
3289
|
+
${(0, import_v436.prettifyError)(parsed.error)}
|
|
3234
3290
|
`
|
|
3235
3291
|
);
|
|
3236
3292
|
}
|
|
3237
3293
|
return parsed.data;
|
|
3238
3294
|
}
|
|
3239
3295
|
|
|
3240
|
-
// src/
|
|
3296
|
+
// src/ensnode/api/registrar-actions/request.ts
|
|
3241
3297
|
var RegistrarActionsFilterTypes = {
|
|
3242
3298
|
BySubregistryNode: "bySubregistryNode",
|
|
3243
3299
|
WithEncodedReferral: "withEncodedReferral",
|
|
@@ -3257,7 +3313,7 @@ var RegistrarActionsOrders = {
|
|
|
3257
3313
|
LatestRegistrarActions: "orderBy[timestamp]=desc"
|
|
3258
3314
|
};
|
|
3259
3315
|
|
|
3260
|
-
// src/
|
|
3316
|
+
// src/ensnode/api/registrar-actions/filters.ts
|
|
3261
3317
|
function byParentNode(parentNode) {
|
|
3262
3318
|
if (typeof parentNode === "undefined") {
|
|
3263
3319
|
return void 0;
|
|
@@ -3310,7 +3366,7 @@ var registrarActionsFilter = {
|
|
|
3310
3366
|
endTimestamp
|
|
3311
3367
|
};
|
|
3312
3368
|
|
|
3313
|
-
// src/
|
|
3369
|
+
// src/ensnode/api/registrar-actions/prerequisites.ts
|
|
3314
3370
|
var registrarActionsRequiredPlugins = [
|
|
3315
3371
|
"subgraph" /* Subgraph */,
|
|
3316
3372
|
"basenames" /* Basenames */,
|
|
@@ -3342,7 +3398,7 @@ function hasRegistrarActionsIndexingStatusSupport(omnichainIndexingStatusId) {
|
|
|
3342
3398
|
};
|
|
3343
3399
|
}
|
|
3344
3400
|
|
|
3345
|
-
// src/
|
|
3401
|
+
// src/ensnode/api/registrar-actions/serialize.ts
|
|
3346
3402
|
function serializeNamedRegistrarAction({
|
|
3347
3403
|
action,
|
|
3348
3404
|
name
|
|
@@ -3366,19 +3422,19 @@ function serializeRegistrarActionsResponse(response) {
|
|
|
3366
3422
|
}
|
|
3367
3423
|
}
|
|
3368
3424
|
|
|
3369
|
-
// src/
|
|
3370
|
-
var
|
|
3371
|
-
function
|
|
3372
|
-
const parsed =
|
|
3425
|
+
// src/ensnode/api/shared/errors/deserialize.ts
|
|
3426
|
+
var import_v437 = require("zod/v4");
|
|
3427
|
+
function deserializeErrorResponse2(maybeErrorResponse) {
|
|
3428
|
+
const parsed = makeErrorResponseSchema().safeParse(maybeErrorResponse);
|
|
3373
3429
|
if (parsed.error) {
|
|
3374
3430
|
throw new Error(`Cannot deserialize ErrorResponse:
|
|
3375
|
-
${(0,
|
|
3431
|
+
${(0, import_v437.prettifyError)(parsed.error)}
|
|
3376
3432
|
`);
|
|
3377
3433
|
}
|
|
3378
3434
|
return parsed.data;
|
|
3379
3435
|
}
|
|
3380
3436
|
|
|
3381
|
-
// src/
|
|
3437
|
+
// src/ensnode/api/shared/pagination/build-page-context.ts
|
|
3382
3438
|
function buildPageContext(page, recordsPerPage, totalRecords) {
|
|
3383
3439
|
const totalPages = Math.max(1, Math.ceil(totalRecords / recordsPerPage));
|
|
3384
3440
|
if (page > totalPages) {
|
|
@@ -3413,7 +3469,7 @@ function buildPageContext(page, recordsPerPage, totalRecords) {
|
|
|
3413
3469
|
};
|
|
3414
3470
|
}
|
|
3415
3471
|
|
|
3416
|
-
// src/
|
|
3472
|
+
// src/ensnode/client-error.ts
|
|
3417
3473
|
var ClientError = class _ClientError extends Error {
|
|
3418
3474
|
details;
|
|
3419
3475
|
constructor(message, details) {
|
|
@@ -3426,17 +3482,17 @@ var ClientError = class _ClientError extends Error {
|
|
|
3426
3482
|
}
|
|
3427
3483
|
};
|
|
3428
3484
|
|
|
3429
|
-
// src/
|
|
3430
|
-
var
|
|
3431
|
-
var
|
|
3432
|
-
var
|
|
3485
|
+
// src/ensnode/deployments.ts
|
|
3486
|
+
var import_datasources5 = require("@ensnode/datasources");
|
|
3487
|
+
var DEFAULT_ENSNODE_URL_MAINNET = "https://api.alpha.ensnode.io";
|
|
3488
|
+
var DEFAULT_ENSNODE_URL_SEPOLIA = "https://api.alpha-sepolia.ensnode.io";
|
|
3433
3489
|
var getDefaultEnsNodeUrl = (namespace) => {
|
|
3434
|
-
const effectiveNamespace = namespace ??
|
|
3490
|
+
const effectiveNamespace = namespace ?? import_datasources5.ENSNamespaceIds.Mainnet;
|
|
3435
3491
|
switch (effectiveNamespace) {
|
|
3436
|
-
case
|
|
3437
|
-
return new URL(
|
|
3438
|
-
case
|
|
3439
|
-
return new URL(
|
|
3492
|
+
case import_datasources5.ENSNamespaceIds.Mainnet:
|
|
3493
|
+
return new URL(DEFAULT_ENSNODE_URL_MAINNET);
|
|
3494
|
+
case import_datasources5.ENSNamespaceIds.Sepolia:
|
|
3495
|
+
return new URL(DEFAULT_ENSNODE_URL_SEPOLIA);
|
|
3440
3496
|
default:
|
|
3441
3497
|
throw new Error(
|
|
3442
3498
|
`ENSNamespaceId ${effectiveNamespace} does not have a default ENSNode URL defined`
|
|
@@ -3444,8 +3500,8 @@ var getDefaultEnsNodeUrl = (namespace) => {
|
|
|
3444
3500
|
}
|
|
3445
3501
|
};
|
|
3446
3502
|
|
|
3447
|
-
// src/
|
|
3448
|
-
var
|
|
3503
|
+
// src/ensnode/client.ts
|
|
3504
|
+
var EnsNodeClient = class _EnsNodeClient {
|
|
3449
3505
|
options;
|
|
3450
3506
|
static defaultOptions() {
|
|
3451
3507
|
return {
|
|
@@ -3454,7 +3510,7 @@ var EnsApiClient = class _EnsApiClient {
|
|
|
3454
3510
|
}
|
|
3455
3511
|
constructor(options = {}) {
|
|
3456
3512
|
this.options = {
|
|
3457
|
-
...
|
|
3513
|
+
..._EnsNodeClient.defaultOptions(),
|
|
3458
3514
|
...options
|
|
3459
3515
|
};
|
|
3460
3516
|
}
|
|
@@ -3498,15 +3554,21 @@ var EnsApiClient = class _EnsApiClient {
|
|
|
3498
3554
|
*/
|
|
3499
3555
|
async resolveRecords(name, selection, options) {
|
|
3500
3556
|
const url = new URL(`/api/resolve/records/${encodeURIComponent(name)}`, this.options.url);
|
|
3501
|
-
if (selection.name)
|
|
3502
|
-
|
|
3503
|
-
|
|
3557
|
+
if (selection.name) url.searchParams.set("name", "true");
|
|
3558
|
+
if (selection.contenthash) url.searchParams.set("contenthash", "true");
|
|
3559
|
+
if (selection.pubkey) url.searchParams.set("pubkey", "true");
|
|
3560
|
+
if (selection.dnszonehash) url.searchParams.set("dnszonehash", "true");
|
|
3561
|
+
if (selection.version) url.searchParams.set("version", "true");
|
|
3562
|
+
if (selection.abi !== void 0) url.searchParams.set("abi", selection.abi.toString());
|
|
3504
3563
|
if (selection.addresses && selection.addresses.length > 0) {
|
|
3505
3564
|
url.searchParams.set("addresses", selection.addresses.join(","));
|
|
3506
3565
|
}
|
|
3507
3566
|
if (selection.texts && selection.texts.length > 0) {
|
|
3508
3567
|
url.searchParams.set("texts", selection.texts.join(","));
|
|
3509
3568
|
}
|
|
3569
|
+
if (selection.interfaces && selection.interfaces.length > 0) {
|
|
3570
|
+
url.searchParams.set("interfaces", selection.interfaces.join(","));
|
|
3571
|
+
}
|
|
3510
3572
|
if (options?.trace) url.searchParams.set("trace", "true");
|
|
3511
3573
|
if (options?.accelerate) url.searchParams.set("accelerate", "true");
|
|
3512
3574
|
const response = await fetch(url);
|
|
@@ -3515,6 +3577,11 @@ var EnsApiClient = class _EnsApiClient {
|
|
|
3515
3577
|
throw ClientError.fromErrorResponse(error);
|
|
3516
3578
|
}
|
|
3517
3579
|
const data = await response.json();
|
|
3580
|
+
const records = data.records;
|
|
3581
|
+
if (typeof records.version === "string") records.version = BigInt(records.version);
|
|
3582
|
+
if (records.abi && typeof records.abi.contentType === "string") {
|
|
3583
|
+
records.abi.contentType = BigInt(records.abi.contentType);
|
|
3584
|
+
}
|
|
3518
3585
|
return data;
|
|
3519
3586
|
}
|
|
3520
3587
|
/**
|
|
@@ -3622,32 +3689,6 @@ var EnsApiClient = class _EnsApiClient {
|
|
|
3622
3689
|
const data = await response.json();
|
|
3623
3690
|
return data;
|
|
3624
3691
|
}
|
|
3625
|
-
/**
|
|
3626
|
-
* Fetch ENSApi Config
|
|
3627
|
-
*
|
|
3628
|
-
* Fetch the ENSApi's configuration.
|
|
3629
|
-
*
|
|
3630
|
-
* @returns {EnsApiConfigResponse}
|
|
3631
|
-
*
|
|
3632
|
-
* @throws if the ENSApi request fails
|
|
3633
|
-
* @throws if the ENSApi returns a non-ok response
|
|
3634
|
-
* @throws if the ENSApi response breaks required invariants
|
|
3635
|
-
*/
|
|
3636
|
-
async config() {
|
|
3637
|
-
const url = new URL(`/api/config`, this.options.url);
|
|
3638
|
-
const response = await fetch(url);
|
|
3639
|
-
let responseData;
|
|
3640
|
-
try {
|
|
3641
|
-
responseData = await response.json();
|
|
3642
|
-
} catch {
|
|
3643
|
-
throw new Error("Malformed response data: invalid JSON");
|
|
3644
|
-
}
|
|
3645
|
-
if (!response.ok) {
|
|
3646
|
-
const errorResponse = deserializeErrorResponse(responseData);
|
|
3647
|
-
throw new Error(`Fetching ENSApi Config Failed: ${errorResponse.message}`);
|
|
3648
|
-
}
|
|
3649
|
-
return deserializeEnsApiConfigResponse(responseData);
|
|
3650
|
-
}
|
|
3651
3692
|
/**
|
|
3652
3693
|
* Fetch ENSApi Indexing Status
|
|
3653
3694
|
*
|
|
@@ -3669,7 +3710,7 @@ var EnsApiClient = class _EnsApiClient {
|
|
|
3669
3710
|
if (!response.ok) {
|
|
3670
3711
|
let errorResponse;
|
|
3671
3712
|
try {
|
|
3672
|
-
errorResponse =
|
|
3713
|
+
errorResponse = deserializeErrorResponse2(responseData);
|
|
3673
3714
|
} catch {
|
|
3674
3715
|
}
|
|
3675
3716
|
if (typeof errorResponse !== "undefined") {
|
|
@@ -3700,11 +3741,13 @@ var EnsApiClient = class _EnsApiClient {
|
|
|
3700
3741
|
* ```ts
|
|
3701
3742
|
* import {
|
|
3702
3743
|
* registrarActionsFilter,
|
|
3703
|
-
*
|
|
3744
|
+
* EnsNodeClient,
|
|
3704
3745
|
* } from "@ensnode/ensnode-sdk";
|
|
3705
|
-
* import {
|
|
3746
|
+
* import { ETH_NODE, namehashInterpretedName, asInterpretedName } from "enssdk";
|
|
3747
|
+
*
|
|
3748
|
+
* const BASE_NODE = namehashInterpretedName(asInterpretedName("base.eth"));
|
|
3706
3749
|
*
|
|
3707
|
-
* const client:
|
|
3750
|
+
* const client: EnsNodeClient;
|
|
3708
3751
|
*
|
|
3709
3752
|
* // Get first page with default page size (10 records)
|
|
3710
3753
|
* const response = await client.registrarActions();
|
|
@@ -3724,7 +3767,7 @@ var EnsApiClient = class _EnsApiClient {
|
|
|
3724
3767
|
* // get latest registrar action records associated with
|
|
3725
3768
|
* // subregistry managing `eth` name
|
|
3726
3769
|
* await client.registrarActions({
|
|
3727
|
-
* filters: [registrarActionsFilter.byParentNode(
|
|
3770
|
+
* filters: [registrarActionsFilter.byParentNode(ETH_NODE)],
|
|
3728
3771
|
* });
|
|
3729
3772
|
*
|
|
3730
3773
|
* // get latest registrar action records which include referral info
|
|
@@ -3740,7 +3783,7 @@ var EnsApiClient = class _EnsApiClient {
|
|
|
3740
3783
|
* // get latest 10 registrar action records associated with
|
|
3741
3784
|
* // subregistry managing `base.eth` name
|
|
3742
3785
|
* await client.registrarActions({
|
|
3743
|
-
* filters: [registrarActionsFilter.byParentNode(
|
|
3786
|
+
* filters: [registrarActionsFilter.byParentNode(BASE_NODE)],
|
|
3744
3787
|
* recordsPerPage: 10
|
|
3745
3788
|
* });
|
|
3746
3789
|
*
|
|
@@ -3844,7 +3887,7 @@ var EnsApiClient = class _EnsApiClient {
|
|
|
3844
3887
|
if (!response.ok) {
|
|
3845
3888
|
let errorResponse;
|
|
3846
3889
|
try {
|
|
3847
|
-
errorResponse =
|
|
3890
|
+
errorResponse = deserializeErrorResponse2(responseData);
|
|
3848
3891
|
} catch {
|
|
3849
3892
|
console.log("Registrar Actions API: handling a known server error.");
|
|
3850
3893
|
}
|
|
@@ -3867,207 +3910,32 @@ var EnsApiClient = class _EnsApiClient {
|
|
|
3867
3910
|
* @example
|
|
3868
3911
|
* ```ts
|
|
3869
3912
|
* import {
|
|
3870
|
-
*
|
|
3913
|
+
* EnsNodeClient,
|
|
3871
3914
|
* } from "@ensnode/ensnode-sdk";
|
|
3872
|
-
* import {
|
|
3873
|
-
*
|
|
3874
|
-
* const client: EnsApiClient;
|
|
3875
|
-
*
|
|
3876
|
-
* // get latest name token records from the indexed subregistry based on the requested name
|
|
3877
|
-
* const response = await client.nameTokens({
|
|
3878
|
-
* name: "vitalik.eth"
|
|
3879
|
-
* });
|
|
3880
|
-
*
|
|
3881
|
-
* const response = await client.nameTokens({
|
|
3882
|
-
* domainId: "0xee6c4522aab0003e8d14cd40a6af439055fd2577951148c14b6cea9a53475835" // namehash('vitalik.eth')
|
|
3883
|
-
* })
|
|
3884
|
-
* ```
|
|
3885
|
-
*/
|
|
3886
|
-
async nameTokens(request) {
|
|
3887
|
-
const url = new URL(`/api/name-tokens`, this.options.url);
|
|
3888
|
-
if (request.name !== void 0) {
|
|
3889
|
-
url.searchParams.set("name", request.name);
|
|
3890
|
-
} else if (request.domainId !== void 0) {
|
|
3891
|
-
url.searchParams.set("domainId", request.domainId);
|
|
3892
|
-
}
|
|
3893
|
-
const response = await fetch(url);
|
|
3894
|
-
let responseData;
|
|
3895
|
-
try {
|
|
3896
|
-
responseData = await response.json();
|
|
3897
|
-
} catch {
|
|
3898
|
-
throw new Error("Malformed response data: invalid JSON");
|
|
3899
|
-
}
|
|
3900
|
-
if (!response.ok) {
|
|
3901
|
-
let errorResponse;
|
|
3902
|
-
try {
|
|
3903
|
-
errorResponse = deserializeErrorResponse(responseData);
|
|
3904
|
-
} catch {
|
|
3905
|
-
console.log("Name Tokens API: handling a known server error.");
|
|
3906
|
-
}
|
|
3907
|
-
if (typeof errorResponse !== "undefined") {
|
|
3908
|
-
throw new Error(`Fetching ENSNode Name Tokens Failed: ${errorResponse.message}`);
|
|
3909
|
-
}
|
|
3910
|
-
}
|
|
3911
|
-
return deserializedNameTokensResponse(responseData);
|
|
3912
|
-
}
|
|
3913
|
-
};
|
|
3914
|
-
var ENSNodeClient = class extends EnsApiClient {
|
|
3915
|
-
};
|
|
3916
|
-
|
|
3917
|
-
// src/ensindexer/api/config/deserialize.ts
|
|
3918
|
-
function deserializeEnsIndexerConfigResponse(maybeResponse) {
|
|
3919
|
-
return deserializeEnsIndexerPublicConfig(maybeResponse, "EnsIndexerConfigResponse");
|
|
3920
|
-
}
|
|
3921
|
-
|
|
3922
|
-
// src/ensindexer/api/config/serialize.ts
|
|
3923
|
-
function serializeEnsIndexerConfigResponse(response) {
|
|
3924
|
-
return serializeEnsIndexerPublicConfig(response);
|
|
3925
|
-
}
|
|
3926
|
-
|
|
3927
|
-
// src/ensindexer/api/indexing-status/deserialize.ts
|
|
3928
|
-
var import_v430 = require("zod/v4");
|
|
3929
|
-
|
|
3930
|
-
// src/ensindexer/api/indexing-status/response.ts
|
|
3931
|
-
var EnsIndexerIndexingStatusResponseCodes = {
|
|
3932
|
-
/**
|
|
3933
|
-
* Represents that the indexing status is available.
|
|
3934
|
-
*/
|
|
3935
|
-
Ok: "ok",
|
|
3936
|
-
/**
|
|
3937
|
-
* Represents that the indexing status is unavailable.
|
|
3938
|
-
*/
|
|
3939
|
-
Error: "error"
|
|
3940
|
-
};
|
|
3941
|
-
|
|
3942
|
-
// src/ensindexer/api/indexing-status/zod-schemas.ts
|
|
3943
|
-
var import_v429 = require("zod/v4");
|
|
3944
|
-
var makeEnsIndexerIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => import_v429.z.strictObject({
|
|
3945
|
-
responseCode: import_v429.z.literal(EnsIndexerIndexingStatusResponseCodes.Ok),
|
|
3946
|
-
realtimeProjection: makeRealtimeIndexingStatusProjectionSchema(valueLabel)
|
|
3947
|
-
});
|
|
3948
|
-
var makeEnsIndexerIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => import_v429.z.strictObject({
|
|
3949
|
-
responseCode: import_v429.z.literal(EnsIndexerIndexingStatusResponseCodes.Error)
|
|
3950
|
-
});
|
|
3951
|
-
var makeEnsIndexerIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => import_v429.z.discriminatedUnion("responseCode", [
|
|
3952
|
-
makeEnsIndexerIndexingStatusResponseOkSchema(valueLabel),
|
|
3953
|
-
makeEnsIndexerIndexingStatusResponseErrorSchema(valueLabel)
|
|
3954
|
-
]);
|
|
3955
|
-
var makeSerializedEnsIndexerIndexingStatusResponseOkSchema = (valueLabel = "Serialized Indexing Status Response OK") => import_v429.z.strictObject({
|
|
3956
|
-
responseCode: import_v429.z.literal(EnsIndexerIndexingStatusResponseCodes.Ok),
|
|
3957
|
-
realtimeProjection: makeSerializedRealtimeIndexingStatusProjectionSchema(valueLabel)
|
|
3958
|
-
});
|
|
3959
|
-
var makeSerializedEnsIndexerIndexingStatusResponseSchema = (valueLabel = "Serialized Indexing Status Response") => import_v429.z.discriminatedUnion("responseCode", [
|
|
3960
|
-
makeSerializedEnsIndexerIndexingStatusResponseOkSchema(valueLabel),
|
|
3961
|
-
makeEnsIndexerIndexingStatusResponseErrorSchema(valueLabel)
|
|
3962
|
-
]);
|
|
3963
|
-
|
|
3964
|
-
// src/ensindexer/api/indexing-status/deserialize.ts
|
|
3965
|
-
function buildUnvalidatedEnsIndexerIndexingStatusResponse(serializedResponse) {
|
|
3966
|
-
if (serializedResponse.responseCode !== EnsIndexerIndexingStatusResponseCodes.Ok) {
|
|
3967
|
-
return serializedResponse;
|
|
3968
|
-
}
|
|
3969
|
-
return {
|
|
3970
|
-
...serializedResponse,
|
|
3971
|
-
realtimeProjection: buildUnvalidatedRealtimeIndexingStatusProjection(
|
|
3972
|
-
serializedResponse.realtimeProjection
|
|
3973
|
-
)
|
|
3974
|
-
};
|
|
3975
|
-
}
|
|
3976
|
-
function deserializeEnsIndexerIndexingStatusResponse(maybeResponse) {
|
|
3977
|
-
const parsed = makeSerializedEnsIndexerIndexingStatusResponseSchema().transform(buildUnvalidatedEnsIndexerIndexingStatusResponse).pipe(makeEnsIndexerIndexingStatusResponseSchema()).safeParse(maybeResponse);
|
|
3978
|
-
if (parsed.error) {
|
|
3979
|
-
throw new Error(
|
|
3980
|
-
`Cannot deserialize EnsIndexerIndexingStatusResponse:
|
|
3981
|
-
${(0, import_v430.prettifyError)(parsed.error)}
|
|
3982
|
-
`
|
|
3983
|
-
);
|
|
3984
|
-
}
|
|
3985
|
-
return parsed.data;
|
|
3986
|
-
}
|
|
3987
|
-
|
|
3988
|
-
// src/ensindexer/api/indexing-status/serialize.ts
|
|
3989
|
-
function serializeEnsIndexerIndexingStatusResponse(response) {
|
|
3990
|
-
switch (response.responseCode) {
|
|
3991
|
-
case EnsIndexerIndexingStatusResponseCodes.Ok:
|
|
3992
|
-
return {
|
|
3993
|
-
responseCode: response.responseCode,
|
|
3994
|
-
realtimeProjection: serializeRealtimeIndexingStatusProjection(response.realtimeProjection)
|
|
3995
|
-
};
|
|
3996
|
-
case EnsIndexerIndexingStatusResponseCodes.Error:
|
|
3997
|
-
return response;
|
|
3998
|
-
}
|
|
3999
|
-
}
|
|
4000
|
-
|
|
4001
|
-
// src/ensindexer/api/shared/errors/deserialize.ts
|
|
4002
|
-
var import_v432 = require("zod/v4");
|
|
4003
|
-
|
|
4004
|
-
// src/ensindexer/api/shared/errors/zod-schemas.ts
|
|
4005
|
-
var import_v431 = require("zod/v4");
|
|
4006
|
-
var ErrorResponseSchema2 = import_v431.z.object({
|
|
4007
|
-
message: import_v431.z.string(),
|
|
4008
|
-
details: import_v431.z.optional(import_v431.z.unknown())
|
|
4009
|
-
});
|
|
4010
|
-
|
|
4011
|
-
// src/ensindexer/api/shared/errors/deserialize.ts
|
|
4012
|
-
function deserializeErrorResponse2(maybeErrorResponse) {
|
|
4013
|
-
const parsed = ErrorResponseSchema2.safeParse(maybeErrorResponse);
|
|
4014
|
-
if (parsed.error) {
|
|
4015
|
-
throw new Error(`Cannot deserialize ErrorResponse:
|
|
4016
|
-
${(0, import_v432.prettifyError)(parsed.error)}
|
|
4017
|
-
`);
|
|
4018
|
-
}
|
|
4019
|
-
return parsed.data;
|
|
4020
|
-
}
|
|
4021
|
-
|
|
4022
|
-
// src/ensindexer/client.ts
|
|
4023
|
-
var EnsIndexerClient = class {
|
|
4024
|
-
constructor(options) {
|
|
4025
|
-
this.options = options;
|
|
4026
|
-
}
|
|
4027
|
-
getOptions() {
|
|
4028
|
-
return Object.freeze({
|
|
4029
|
-
url: new URL(this.options.url.href)
|
|
4030
|
-
});
|
|
4031
|
-
}
|
|
4032
|
-
/**
|
|
4033
|
-
* Fetch ENSIndexer Config
|
|
4034
|
-
*
|
|
4035
|
-
* Fetch the ENSIndexer's configuration.
|
|
3915
|
+
* import { namehashInterpretedName, asInterpretedName } from "enssdk";
|
|
4036
3916
|
*
|
|
4037
|
-
*
|
|
3917
|
+
* const VITALIK_NAME = asInterpretedName("vitalik.eth");
|
|
3918
|
+
* const VITALIK_DOMAIN_ID = namehashInterpretedName(VITALIK_NAME);
|
|
4038
3919
|
*
|
|
4039
|
-
*
|
|
4040
|
-
* @throws if the ENSIndexer returns a non-ok response
|
|
4041
|
-
* @throws if the ENSIndexer response breaks required invariants
|
|
4042
|
-
*/
|
|
4043
|
-
async config() {
|
|
4044
|
-
const url = new URL(`/api/config`, this.options.url);
|
|
4045
|
-
const response = await fetch(url);
|
|
4046
|
-
let responseData;
|
|
4047
|
-
try {
|
|
4048
|
-
responseData = await response.json();
|
|
4049
|
-
} catch {
|
|
4050
|
-
throw new Error("Malformed response data: invalid JSON");
|
|
4051
|
-
}
|
|
4052
|
-
if (!response.ok) {
|
|
4053
|
-
const errorResponse = deserializeErrorResponse2(responseData);
|
|
4054
|
-
throw new Error(`Fetching ENSIndexer Config Failed: ${errorResponse.message}`);
|
|
4055
|
-
}
|
|
4056
|
-
return deserializeEnsIndexerConfigResponse(
|
|
4057
|
-
responseData
|
|
4058
|
-
);
|
|
4059
|
-
}
|
|
4060
|
-
/**
|
|
4061
|
-
* Fetch ENSIndexer Indexing Status
|
|
3920
|
+
* const client: EnsNodeClient;
|
|
4062
3921
|
*
|
|
4063
|
-
*
|
|
3922
|
+
* // get latest name token records from the indexed subregistry based on the requested name
|
|
3923
|
+
* const response = await client.nameTokens({
|
|
3924
|
+
* name: VITALIK_NAME,
|
|
3925
|
+
* });
|
|
4064
3926
|
*
|
|
4065
|
-
*
|
|
4066
|
-
*
|
|
4067
|
-
*
|
|
3927
|
+
* const response = await client.nameTokens({
|
|
3928
|
+
* domainId: VITALIK_DOMAIN_ID,
|
|
3929
|
+
* })
|
|
3930
|
+
* ```
|
|
4068
3931
|
*/
|
|
4069
|
-
async
|
|
4070
|
-
const url = new URL(`/api/
|
|
3932
|
+
async nameTokens(request) {
|
|
3933
|
+
const url = new URL(`/api/name-tokens`, this.options.url);
|
|
3934
|
+
if (request.name !== void 0) {
|
|
3935
|
+
url.searchParams.set("name", request.name);
|
|
3936
|
+
} else if (request.domainId !== void 0) {
|
|
3937
|
+
url.searchParams.set("domainId", request.domainId);
|
|
3938
|
+
}
|
|
4071
3939
|
const response = await fetch(url);
|
|
4072
3940
|
let responseData;
|
|
4073
3941
|
try {
|
|
@@ -4080,184 +3948,18 @@ var EnsIndexerClient = class {
|
|
|
4080
3948
|
try {
|
|
4081
3949
|
errorResponse = deserializeErrorResponse2(responseData);
|
|
4082
3950
|
} catch {
|
|
3951
|
+
console.log("Name Tokens API: handling a known server error.");
|
|
4083
3952
|
}
|
|
4084
3953
|
if (typeof errorResponse !== "undefined") {
|
|
4085
|
-
throw new Error(`Fetching
|
|
3954
|
+
throw new Error(`Fetching ENSNode Name Tokens Failed: ${errorResponse.message}`);
|
|
4086
3955
|
}
|
|
4087
3956
|
}
|
|
4088
|
-
return
|
|
4089
|
-
responseData
|
|
4090
|
-
);
|
|
4091
|
-
}
|
|
4092
|
-
};
|
|
4093
|
-
|
|
4094
|
-
// src/ensindexer/config/compatibility.ts
|
|
4095
|
-
function validateEnsIndexerPublicConfigCompatibility(configA, configB) {
|
|
4096
|
-
if (configA.indexedChainIds.symmetricDifference(configB.indexedChainIds).size > 0) {
|
|
4097
|
-
throw new Error(
|
|
4098
|
-
[
|
|
4099
|
-
`'indexedChainIds' must be compatible.`,
|
|
4100
|
-
`Stored Config 'indexedChainIds': '${Array.from(configA.indexedChainIds).join(", ")}'.`,
|
|
4101
|
-
`Current Config 'indexedChainIds': '${Array.from(configB.indexedChainIds).join(", ")}'.`
|
|
4102
|
-
].join(" ")
|
|
4103
|
-
);
|
|
4104
|
-
}
|
|
4105
|
-
if (configA.isSubgraphCompatible !== configB.isSubgraphCompatible) {
|
|
4106
|
-
throw new Error(
|
|
4107
|
-
[
|
|
4108
|
-
`'isSubgraphCompatible' flag must be compatible.`,
|
|
4109
|
-
`Stored Config 'isSubgraphCompatible' flag: '${configA.isSubgraphCompatible}'.`,
|
|
4110
|
-
`Current Config 'isSubgraphCompatible' flag: '${configB.isSubgraphCompatible}'.`
|
|
4111
|
-
].join(" ")
|
|
4112
|
-
);
|
|
4113
|
-
}
|
|
4114
|
-
if (configA.namespace !== configB.namespace) {
|
|
4115
|
-
throw new Error(
|
|
4116
|
-
[
|
|
4117
|
-
`'namespace' must be compatible.`,
|
|
4118
|
-
`Stored Config 'namespace': '${configA.namespace}'.`,
|
|
4119
|
-
`Current Config 'namespace': '${configB.namespace}'.`
|
|
4120
|
-
].join(" ")
|
|
4121
|
-
);
|
|
4122
|
-
}
|
|
4123
|
-
if (configA.labelSet.labelSetId !== configB.labelSet.labelSetId) {
|
|
4124
|
-
throw new Error(
|
|
4125
|
-
[
|
|
4126
|
-
`'labelSet.labelSetId' must be compatible.`,
|
|
4127
|
-
`Stored Config 'labelSet.labelSetId': '${configA.labelSet.labelSetId}'.`,
|
|
4128
|
-
`Current Config 'labelSet.labelSetId': '${configB.labelSet.labelSetId}'.`
|
|
4129
|
-
].join(" ")
|
|
4130
|
-
);
|
|
4131
|
-
}
|
|
4132
|
-
if (configA.labelSet.labelSetVersion !== configB.labelSet.labelSetVersion) {
|
|
4133
|
-
throw new Error(
|
|
4134
|
-
[
|
|
4135
|
-
`'labelSet.labelSetVersion' must be compatible.`,
|
|
4136
|
-
`Stored Config 'labelSet.labelSetVersion': '${configA.labelSet.labelSetVersion}'.`,
|
|
4137
|
-
`Current Config 'labelSet.labelSetVersion': '${configB.labelSet.labelSetVersion}'.`
|
|
4138
|
-
].join(" ")
|
|
4139
|
-
);
|
|
4140
|
-
}
|
|
4141
|
-
const configAPluginsSet = new Set(configA.plugins);
|
|
4142
|
-
const configBPluginsSet = new Set(configB.plugins);
|
|
4143
|
-
if (configAPluginsSet.symmetricDifference(configBPluginsSet).size > 0) {
|
|
4144
|
-
throw new Error(
|
|
4145
|
-
[
|
|
4146
|
-
`'plugins' must be compatible.`,
|
|
4147
|
-
`Stored Config 'plugins': '${configA.plugins.join(", ")}'.`,
|
|
4148
|
-
`Current Config 'plugins': '${configB.plugins.join(", ")}'.`
|
|
4149
|
-
].join(" ")
|
|
4150
|
-
);
|
|
4151
|
-
}
|
|
4152
|
-
}
|
|
4153
|
-
|
|
4154
|
-
// src/ensindexer/config/label-utils.ts
|
|
4155
|
-
var import_viem16 = require("viem");
|
|
4156
|
-
function labelHashToBytes(labelHash) {
|
|
4157
|
-
try {
|
|
4158
|
-
if (labelHash.length !== 66) {
|
|
4159
|
-
throw new Error(`Invalid labelHash length ${labelHash.length} characters (expected 66)`);
|
|
4160
|
-
}
|
|
4161
|
-
if (labelHash !== labelHash.toLowerCase()) {
|
|
4162
|
-
throw new Error("Labelhash must be in lowercase");
|
|
4163
|
-
}
|
|
4164
|
-
if (!labelHash.startsWith("0x")) {
|
|
4165
|
-
throw new Error("Labelhash must be 0x-prefixed");
|
|
4166
|
-
}
|
|
4167
|
-
const bytes = (0, import_viem16.hexToBytes)(labelHash);
|
|
4168
|
-
if (bytes.length !== 32) {
|
|
4169
|
-
throw new Error(`Invalid labelHash length ${bytes.length} bytes (expected 32)`);
|
|
4170
|
-
}
|
|
4171
|
-
return bytes;
|
|
4172
|
-
} catch (e) {
|
|
4173
|
-
if (e instanceof Error) {
|
|
4174
|
-
throw e;
|
|
4175
|
-
}
|
|
4176
|
-
throw new Error("Invalid hex format");
|
|
4177
|
-
}
|
|
4178
|
-
}
|
|
4179
|
-
|
|
4180
|
-
// src/ensindexer/config/parsing.ts
|
|
4181
|
-
function parseNonNegativeInteger(maybeNumber) {
|
|
4182
|
-
const trimmed = maybeNumber.trim();
|
|
4183
|
-
if (!trimmed) {
|
|
4184
|
-
throw new Error("Input cannot be empty");
|
|
4185
|
-
}
|
|
4186
|
-
if (trimmed === "-0") {
|
|
4187
|
-
throw new Error("Negative zero is not a valid non-negative integer");
|
|
4188
|
-
}
|
|
4189
|
-
const num = Number(maybeNumber);
|
|
4190
|
-
if (Number.isNaN(num)) {
|
|
4191
|
-
throw new Error(`"${maybeNumber}" is not a valid number`);
|
|
4192
|
-
}
|
|
4193
|
-
if (!Number.isFinite(num)) {
|
|
4194
|
-
throw new Error(`"${maybeNumber}" is not a finite number`);
|
|
4195
|
-
}
|
|
4196
|
-
if (!Number.isInteger(num)) {
|
|
4197
|
-
throw new Error(`"${maybeNumber}" is not an integer`);
|
|
4198
|
-
}
|
|
4199
|
-
if (num < 0) {
|
|
4200
|
-
throw new Error(`"${maybeNumber}" is not a non-negative integer`);
|
|
4201
|
-
}
|
|
4202
|
-
return num;
|
|
4203
|
-
}
|
|
4204
|
-
|
|
4205
|
-
// src/ensindexer/config/validate/ensindexer-public-config.ts
|
|
4206
|
-
var import_v433 = require("zod/v4");
|
|
4207
|
-
function validateEnsIndexerPublicConfig(unvalidatedConfig) {
|
|
4208
|
-
const schema = makeEnsIndexerPublicConfigSchema();
|
|
4209
|
-
const result = schema.safeParse(unvalidatedConfig);
|
|
4210
|
-
if (!result.success) {
|
|
4211
|
-
throw new Error(`Invalid ENSIndexerPublicConfig: ${(0, import_v433.prettifyError)(result.error)}`);
|
|
4212
|
-
}
|
|
4213
|
-
return result.data;
|
|
4214
|
-
}
|
|
4215
|
-
|
|
4216
|
-
// src/ensindexer/config/validate/ensindexer-version-info.ts
|
|
4217
|
-
var import_v434 = require("zod/v4");
|
|
4218
|
-
function validateEnsIndexerVersionInfo(unvalidatedVersionInfo) {
|
|
4219
|
-
const schema = makeEnsIndexerVersionInfoSchema();
|
|
4220
|
-
const result = schema.safeParse(unvalidatedVersionInfo);
|
|
4221
|
-
if (!result.success) {
|
|
4222
|
-
throw new Error(`Invalid EnsIndexerVersionInfo: ${(0, import_v434.prettifyError)(result.error)}`);
|
|
3957
|
+
return deserializedNameTokensResponse(responseData);
|
|
4223
3958
|
}
|
|
4224
|
-
return result.data;
|
|
4225
|
-
}
|
|
4226
|
-
|
|
4227
|
-
// src/ensv2/ids-lib.ts
|
|
4228
|
-
var import_viem17 = require("viem");
|
|
4229
|
-
var makeRegistryId = (accountId) => formatAccountId(accountId);
|
|
4230
|
-
var makeENSv1DomainId = (node) => node;
|
|
4231
|
-
var makeENSv2DomainId = (registry, canonicalId) => formatAssetId({
|
|
4232
|
-
assetNamespace: AssetNamespaces.ERC1155,
|
|
4233
|
-
contract: registry,
|
|
4234
|
-
tokenId: canonicalId
|
|
4235
|
-
});
|
|
4236
|
-
var maskLower32Bits = (num) => num ^ num & 0xffffffffn;
|
|
4237
|
-
var getCanonicalId = (input) => {
|
|
4238
|
-
if (typeof input === "bigint") return maskLower32Bits(input);
|
|
4239
|
-
return getCanonicalId((0, import_viem17.hexToBigInt)(input));
|
|
4240
3959
|
};
|
|
4241
|
-
var makePermissionsId = (contract) => formatAccountId(contract);
|
|
4242
|
-
var makePermissionsResourceId = (contract, resource) => `${makePermissionsId(contract)}/${resource}`;
|
|
4243
|
-
var makePermissionsUserId = (contract, resource, user) => `${makePermissionsId(contract)}/${resource}/${user}`;
|
|
4244
|
-
var makeResolverId = (contract) => formatAccountId(contract);
|
|
4245
|
-
var makeResolverRecordsId = (resolver, node) => `${makeResolverId(resolver)}/${node}`;
|
|
4246
|
-
var makeRegistrationId = (domainId, index) => `${domainId}/${index}`;
|
|
4247
|
-
var makeRenewalId = (domainId, registrationIndex, index) => `${makeRegistrationId(domainId, registrationIndex)}/${index}`;
|
|
4248
|
-
|
|
4249
|
-
// src/graphql-api/prerequisites.ts
|
|
4250
|
-
function hasGraphqlApiConfigSupport(config) {
|
|
4251
|
-
const supported = config.plugins.includes("ensv2" /* ENSv2 */);
|
|
4252
|
-
if (supported) return { supported };
|
|
4253
|
-
return {
|
|
4254
|
-
supported: false,
|
|
4255
|
-
reason: `The connected ENSNode's Config must have the '${"ensv2" /* ENSv2 */}' plugin enabled.`
|
|
4256
|
-
};
|
|
4257
|
-
}
|
|
4258
3960
|
|
|
4259
3961
|
// src/identity/identity.ts
|
|
4260
|
-
var
|
|
3962
|
+
var import_datasources6 = require("@ensnode/datasources");
|
|
4261
3963
|
|
|
4262
3964
|
// src/identity/types.ts
|
|
4263
3965
|
var ResolutionStatusIds = {
|
|
@@ -4284,7 +3986,7 @@ var ResolutionStatusIds = {
|
|
|
4284
3986
|
function buildUnresolvedIdentity(address, namespaceId, chainId) {
|
|
4285
3987
|
return {
|
|
4286
3988
|
resolutionStatus: ResolutionStatusIds.Unresolved,
|
|
4287
|
-
chainId: chainId ?? (0,
|
|
3989
|
+
chainId: chainId ?? (0, import_datasources6.getENSRootChainId)(namespaceId),
|
|
4288
3990
|
address
|
|
4289
3991
|
};
|
|
4290
3992
|
}
|
|
@@ -4293,14 +3995,14 @@ function isResolvedIdentity(identity) {
|
|
|
4293
3995
|
}
|
|
4294
3996
|
|
|
4295
3997
|
// src/indexing-status/deserialize/chain-indexing-status-snapshot.ts
|
|
4296
|
-
var
|
|
3998
|
+
var import_v438 = require("zod/v4");
|
|
4297
3999
|
function deserializeChainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
4298
4000
|
const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
|
|
4299
4001
|
const parsed = schema.safeParse(maybeSnapshot);
|
|
4300
4002
|
if (parsed.error) {
|
|
4301
4003
|
throw new Error(
|
|
4302
4004
|
`Cannot deserialize into ChainIndexingStatusSnapshot:
|
|
4303
|
-
${(0,
|
|
4005
|
+
${(0, import_v438.prettifyError)(parsed.error)}
|
|
4304
4006
|
`
|
|
4305
4007
|
);
|
|
4306
4008
|
}
|
|
@@ -4318,55 +4020,63 @@ function createRealtimeIndexingStatusProjection(snapshot, now) {
|
|
|
4318
4020
|
}
|
|
4319
4021
|
|
|
4320
4022
|
// src/indexing-status/validate/chain-indexing-status-snapshot.ts
|
|
4321
|
-
var
|
|
4023
|
+
var import_v439 = require("zod/v4");
|
|
4322
4024
|
function validateChainIndexingStatusSnapshot(unvalidatedSnapshot, valueLabel) {
|
|
4323
4025
|
const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
|
|
4324
4026
|
const parsed = schema.safeParse(unvalidatedSnapshot);
|
|
4325
4027
|
if (parsed.error) {
|
|
4326
4028
|
throw new Error(`Invalid ChainIndexingStatusSnapshot:
|
|
4327
|
-
${(0,
|
|
4029
|
+
${(0, import_v439.prettifyError)(parsed.error)}
|
|
4328
4030
|
`);
|
|
4329
4031
|
}
|
|
4330
4032
|
return parsed.data;
|
|
4331
4033
|
}
|
|
4332
4034
|
|
|
4333
4035
|
// src/indexing-status/validate/realtime-indexing-status-projection.ts
|
|
4334
|
-
var
|
|
4036
|
+
var import_v440 = require("zod/v4");
|
|
4335
4037
|
function validateRealtimeIndexingStatusProjection(unvalidatedProjection, valueLabel) {
|
|
4336
4038
|
const schema = makeRealtimeIndexingStatusProjectionSchema(valueLabel);
|
|
4337
4039
|
const parsed = schema.safeParse(unvalidatedProjection);
|
|
4338
4040
|
if (parsed.error) {
|
|
4339
4041
|
throw new Error(`Invalid RealtimeIndexingStatusProjection:
|
|
4340
|
-
${(0,
|
|
4042
|
+
${(0, import_v440.prettifyError)(parsed.error)}
|
|
4341
4043
|
`);
|
|
4342
4044
|
}
|
|
4343
4045
|
return parsed.data;
|
|
4344
4046
|
}
|
|
4345
4047
|
|
|
4048
|
+
// src/omnigraph-api/prerequisites.ts
|
|
4049
|
+
function hasOmnigraphApiConfigSupport(config) {
|
|
4050
|
+
const supported = config.plugins.includes("ensv2" /* ENSv2 */);
|
|
4051
|
+
if (supported) return { supported };
|
|
4052
|
+
return {
|
|
4053
|
+
supported: false,
|
|
4054
|
+
reason: `The connected ENSNode's Config must have the '${"ensv2" /* ENSv2 */}' plugin enabled.`
|
|
4055
|
+
};
|
|
4056
|
+
}
|
|
4057
|
+
|
|
4346
4058
|
// src/registrars/basenames-subregistry.ts
|
|
4347
|
-
var
|
|
4059
|
+
var import_enssdk8 = require("enssdk");
|
|
4060
|
+
var import_datasources7 = require("@ensnode/datasources");
|
|
4348
4061
|
function getBasenamesSubregistryId(namespace) {
|
|
4349
|
-
const datasource = (0,
|
|
4062
|
+
const datasource = (0, import_datasources7.maybeGetDatasource)(namespace, import_datasources7.DatasourceNames.Basenames);
|
|
4350
4063
|
if (!datasource) {
|
|
4351
|
-
throw new Error(`Datasource not found for ${namespace} ${
|
|
4064
|
+
throw new Error(`Datasource not found for ${namespace} ${import_datasources7.DatasourceNames.Basenames}`);
|
|
4352
4065
|
}
|
|
4353
4066
|
const address = datasource.contracts.BaseRegistrar?.address;
|
|
4354
4067
|
if (address === void 0 || Array.isArray(address)) {
|
|
4355
4068
|
throw new Error(`BaseRegistrar contract not found or has multiple addresses for ${namespace}`);
|
|
4356
4069
|
}
|
|
4357
|
-
return {
|
|
4358
|
-
chainId: datasource.chain.id,
|
|
4359
|
-
address
|
|
4360
|
-
};
|
|
4070
|
+
return { chainId: datasource.chain.id, address };
|
|
4361
4071
|
}
|
|
4362
4072
|
function getBasenamesSubregistryManagedName(namespaceId) {
|
|
4363
4073
|
switch (namespaceId) {
|
|
4364
|
-
case
|
|
4365
|
-
return "base.eth";
|
|
4366
|
-
case
|
|
4367
|
-
case
|
|
4368
|
-
return "basetest.eth";
|
|
4369
|
-
case
|
|
4074
|
+
case import_datasources7.ENSNamespaceIds.Mainnet:
|
|
4075
|
+
return (0, import_enssdk8.asInterpretedName)("base.eth");
|
|
4076
|
+
case import_datasources7.ENSNamespaceIds.Sepolia:
|
|
4077
|
+
case import_datasources7.ENSNamespaceIds.SepoliaV2:
|
|
4078
|
+
return (0, import_enssdk8.asInterpretedName)("basetest.eth");
|
|
4079
|
+
case import_datasources7.ENSNamespaceIds.EnsTestEnv:
|
|
4370
4080
|
throw new Error(
|
|
4371
4081
|
`No registrar managed name is known for the 'basenames' subregistry within the "${namespaceId}" namespace.`
|
|
4372
4082
|
);
|
|
@@ -4374,55 +4084,51 @@ function getBasenamesSubregistryManagedName(namespaceId) {
|
|
|
4374
4084
|
}
|
|
4375
4085
|
|
|
4376
4086
|
// src/registrars/ethnames-subregistry.ts
|
|
4377
|
-
var
|
|
4087
|
+
var import_enssdk9 = require("enssdk");
|
|
4088
|
+
var import_datasources8 = require("@ensnode/datasources");
|
|
4378
4089
|
function getEthnamesSubregistryId(namespace) {
|
|
4379
|
-
const datasource = (0,
|
|
4090
|
+
const datasource = (0, import_datasources8.maybeGetDatasource)(namespace, import_datasources8.DatasourceNames.ENSRoot);
|
|
4380
4091
|
if (!datasource) {
|
|
4381
|
-
throw new Error(`Datasource not found for ${namespace} ${
|
|
4092
|
+
throw new Error(`Datasource not found for ${namespace} ${import_datasources8.DatasourceNames.ENSRoot}`);
|
|
4382
4093
|
}
|
|
4383
4094
|
const address = datasource.contracts.BaseRegistrar?.address;
|
|
4384
4095
|
if (address === void 0 || Array.isArray(address)) {
|
|
4385
4096
|
throw new Error(`BaseRegistrar contract not found or has multiple addresses for ${namespace}`);
|
|
4386
4097
|
}
|
|
4387
|
-
return {
|
|
4388
|
-
chainId: datasource.chain.id,
|
|
4389
|
-
address
|
|
4390
|
-
};
|
|
4098
|
+
return { chainId: datasource.chain.id, address };
|
|
4391
4099
|
}
|
|
4392
4100
|
function getEthnamesSubregistryManagedName(namespaceId) {
|
|
4393
4101
|
switch (namespaceId) {
|
|
4394
|
-
case
|
|
4395
|
-
case
|
|
4396
|
-
case
|
|
4397
|
-
case
|
|
4398
|
-
return "eth";
|
|
4102
|
+
case import_datasources8.ENSNamespaceIds.Mainnet:
|
|
4103
|
+
case import_datasources8.ENSNamespaceIds.Sepolia:
|
|
4104
|
+
case import_datasources8.ENSNamespaceIds.SepoliaV2:
|
|
4105
|
+
case import_datasources8.ENSNamespaceIds.EnsTestEnv:
|
|
4106
|
+
return (0, import_enssdk9.asInterpretedName)("eth");
|
|
4399
4107
|
}
|
|
4400
4108
|
}
|
|
4401
4109
|
|
|
4402
4110
|
// src/registrars/lineanames-subregistry.ts
|
|
4403
|
-
var
|
|
4111
|
+
var import_enssdk10 = require("enssdk");
|
|
4112
|
+
var import_datasources9 = require("@ensnode/datasources");
|
|
4404
4113
|
function getLineanamesSubregistryId(namespace) {
|
|
4405
|
-
const datasource = (0,
|
|
4114
|
+
const datasource = (0, import_datasources9.maybeGetDatasource)(namespace, import_datasources9.DatasourceNames.Lineanames);
|
|
4406
4115
|
if (!datasource) {
|
|
4407
|
-
throw new Error(`Datasource not found for ${namespace} ${
|
|
4116
|
+
throw new Error(`Datasource not found for ${namespace} ${import_datasources9.DatasourceNames.Lineanames}`);
|
|
4408
4117
|
}
|
|
4409
4118
|
const address = datasource.contracts.BaseRegistrar?.address;
|
|
4410
4119
|
if (address === void 0 || Array.isArray(address)) {
|
|
4411
4120
|
throw new Error(`BaseRegistrar contract not found or has multiple addresses for ${namespace}`);
|
|
4412
4121
|
}
|
|
4413
|
-
return {
|
|
4414
|
-
chainId: datasource.chain.id,
|
|
4415
|
-
address
|
|
4416
|
-
};
|
|
4122
|
+
return { chainId: datasource.chain.id, address };
|
|
4417
4123
|
}
|
|
4418
4124
|
function getLineanamesSubregistryManagedName(namespaceId) {
|
|
4419
4125
|
switch (namespaceId) {
|
|
4420
|
-
case
|
|
4421
|
-
return "linea.eth";
|
|
4422
|
-
case
|
|
4423
|
-
case
|
|
4424
|
-
return "linea-sepolia.eth";
|
|
4425
|
-
case
|
|
4126
|
+
case import_datasources9.ENSNamespaceIds.Mainnet:
|
|
4127
|
+
return (0, import_enssdk10.asInterpretedName)("linea.eth");
|
|
4128
|
+
case import_datasources9.ENSNamespaceIds.Sepolia:
|
|
4129
|
+
case import_datasources9.ENSNamespaceIds.SepoliaV2:
|
|
4130
|
+
return (0, import_enssdk10.asInterpretedName)("linea-sepolia.eth");
|
|
4131
|
+
case import_datasources9.ENSNamespaceIds.EnsTestEnv:
|
|
4426
4132
|
throw new Error(
|
|
4427
4133
|
`No registrar managed name is known for the 'Lineanames' subregistry within the "${namespaceId}" namespace.`
|
|
4428
4134
|
);
|
|
@@ -4445,18 +4151,19 @@ function isRegistrationInGracePeriod(info, now) {
|
|
|
4445
4151
|
}
|
|
4446
4152
|
|
|
4447
4153
|
// src/resolution/ensip19-chainid.ts
|
|
4154
|
+
var import_enssdk11 = require("enssdk");
|
|
4448
4155
|
var import_chains = require("viem/chains");
|
|
4449
|
-
var
|
|
4156
|
+
var import_datasources10 = require("@ensnode/datasources");
|
|
4450
4157
|
var getResolvePrimaryNameChainIdParam = (chainId, namespaceId) => {
|
|
4451
|
-
const ensRootChainId = (0,
|
|
4158
|
+
const ensRootChainId = (0, import_datasources10.getENSRootChainId)(namespaceId);
|
|
4452
4159
|
return chainId === ensRootChainId ? import_chains.mainnet.id : chainId;
|
|
4453
4160
|
};
|
|
4454
4161
|
var translateDefaultableChainIdToChainId = (chainId, namespaceId) => {
|
|
4455
|
-
return chainId === DEFAULT_EVM_CHAIN_ID ? (0,
|
|
4162
|
+
return chainId === import_enssdk11.DEFAULT_EVM_CHAIN_ID ? (0, import_datasources10.getENSRootChainId)(namespaceId) : chainId;
|
|
4456
4163
|
};
|
|
4457
4164
|
|
|
4458
4165
|
// src/resolution/resolver-records-selection.ts
|
|
4459
|
-
var isSelectionEmpty = (selection) => !selection.name && !selection.addresses?.length && !selection.texts?.length;
|
|
4166
|
+
var isSelectionEmpty = (selection) => !selection.name && !selection.addresses?.length && !selection.texts?.length && !selection.contenthash && !selection.pubkey && !selection.dnszonehash && selection.abi === void 0 && !selection.interfaces?.length && !selection.version;
|
|
4460
4167
|
|
|
4461
4168
|
// src/shared/cache/lru-cache.ts
|
|
4462
4169
|
var LruCache = class {
|
|
@@ -4515,13 +4222,13 @@ var import_getUnixTime2 = require("date-fns/getUnixTime");
|
|
|
4515
4222
|
var import_getUnixTime = require("date-fns/getUnixTime");
|
|
4516
4223
|
|
|
4517
4224
|
// src/shared/deserialize.ts
|
|
4518
|
-
var
|
|
4225
|
+
var import_v441 = __toESM(require("zod/v4"), 1);
|
|
4519
4226
|
function deserializeChainId(maybeChainId, valueLabel) {
|
|
4520
4227
|
const schema = makeChainIdStringSchema(valueLabel);
|
|
4521
4228
|
const parsed = schema.safeParse(maybeChainId);
|
|
4522
4229
|
if (parsed.error) {
|
|
4523
4230
|
throw new Error(`Cannot deserialize ChainId:
|
|
4524
|
-
${(0,
|
|
4231
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4525
4232
|
`);
|
|
4526
4233
|
}
|
|
4527
4234
|
return parsed.data;
|
|
@@ -4531,7 +4238,7 @@ function deserializeDatetime(maybeDatetime, valueLabel) {
|
|
|
4531
4238
|
const parsed = schema.safeParse(maybeDatetime);
|
|
4532
4239
|
if (parsed.error) {
|
|
4533
4240
|
throw new Error(`Cannot deserialize Datetime:
|
|
4534
|
-
${(0,
|
|
4241
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4535
4242
|
`);
|
|
4536
4243
|
}
|
|
4537
4244
|
return parsed.data;
|
|
@@ -4541,7 +4248,7 @@ function deserializeUnixTimestamp(maybeTimestamp, valueLabel) {
|
|
|
4541
4248
|
const parsed = schema.safeParse(maybeTimestamp);
|
|
4542
4249
|
if (parsed.error) {
|
|
4543
4250
|
throw new Error(`Cannot deserialize Unix Timestamp:
|
|
4544
|
-
${(0,
|
|
4251
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4545
4252
|
`);
|
|
4546
4253
|
}
|
|
4547
4254
|
return parsed.data;
|
|
@@ -4551,7 +4258,7 @@ function deserializeUrl(maybeUrl, valueLabel) {
|
|
|
4551
4258
|
const parsed = schema.safeParse(maybeUrl);
|
|
4552
4259
|
if (parsed.error) {
|
|
4553
4260
|
throw new Error(`Cannot deserialize URL:
|
|
4554
|
-
${(0,
|
|
4261
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4555
4262
|
`);
|
|
4556
4263
|
}
|
|
4557
4264
|
return parsed.data;
|
|
@@ -4561,7 +4268,7 @@ function deserializeBlockNumber(maybeBlockNumber, valueLabel) {
|
|
|
4561
4268
|
const parsed = schema.safeParse(maybeBlockNumber);
|
|
4562
4269
|
if (parsed.error) {
|
|
4563
4270
|
throw new Error(`Cannot deserialize BlockNumber:
|
|
4564
|
-
${(0,
|
|
4271
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4565
4272
|
`);
|
|
4566
4273
|
}
|
|
4567
4274
|
return parsed.data;
|
|
@@ -4571,17 +4278,17 @@ function deserializeBlockRef(maybeBlockRef, valueLabel) {
|
|
|
4571
4278
|
const parsed = schema.safeParse(maybeBlockRef);
|
|
4572
4279
|
if (parsed.error) {
|
|
4573
4280
|
throw new Error(`Cannot deserialize BlockRef:
|
|
4574
|
-
${(0,
|
|
4281
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4575
4282
|
`);
|
|
4576
4283
|
}
|
|
4577
4284
|
return parsed.data;
|
|
4578
4285
|
}
|
|
4579
4286
|
function deserializeDuration(maybeDuration, valueLabel) {
|
|
4580
|
-
const schema =
|
|
4287
|
+
const schema = import_v441.default.coerce.number().pipe(makeDurationSchema(valueLabel));
|
|
4581
4288
|
const parsed = schema.safeParse(maybeDuration);
|
|
4582
4289
|
if (parsed.error) {
|
|
4583
4290
|
throw new RangeError(`Cannot deserialize Duration:
|
|
4584
|
-
${(0,
|
|
4291
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4585
4292
|
`);
|
|
4586
4293
|
}
|
|
4587
4294
|
return parsed.data;
|
|
@@ -4591,7 +4298,7 @@ function parseAccountId(maybeAccountId, valueLabel) {
|
|
|
4591
4298
|
const parsed = schema.safeParse(maybeAccountId);
|
|
4592
4299
|
if (parsed.error) {
|
|
4593
4300
|
throw new RangeError(`Cannot deserialize AccountId:
|
|
4594
|
-
${(0,
|
|
4301
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4595
4302
|
`);
|
|
4596
4303
|
}
|
|
4597
4304
|
return parsed.data;
|
|
@@ -4601,7 +4308,7 @@ function deserializePriceEth(maybePrice, valueLabel) {
|
|
|
4601
4308
|
const parsed = schema.safeParse(maybePrice);
|
|
4602
4309
|
if (parsed.error) {
|
|
4603
4310
|
throw new Error(`Cannot deserialize PriceEth:
|
|
4604
|
-
${(0,
|
|
4311
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4605
4312
|
`);
|
|
4606
4313
|
}
|
|
4607
4314
|
return parsed.data;
|
|
@@ -4611,7 +4318,7 @@ function deserializePriceUsdc(maybePrice, valueLabel) {
|
|
|
4611
4318
|
const parsed = schema.safeParse(maybePrice);
|
|
4612
4319
|
if (parsed.error) {
|
|
4613
4320
|
throw new Error(`Cannot deserialize PriceUsdc:
|
|
4614
|
-
${(0,
|
|
4321
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4615
4322
|
`);
|
|
4616
4323
|
}
|
|
4617
4324
|
return parsed.data;
|
|
@@ -4621,7 +4328,7 @@ function deserializePriceDai(maybePrice, valueLabel) {
|
|
|
4621
4328
|
const parsed = schema.safeParse(maybePrice);
|
|
4622
4329
|
if (parsed.error) {
|
|
4623
4330
|
throw new Error(`Cannot deserialize PriceDai:
|
|
4624
|
-
${(0,
|
|
4331
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4625
4332
|
`);
|
|
4626
4333
|
}
|
|
4627
4334
|
return parsed.data;
|
|
@@ -4773,12 +4480,12 @@ var TtlCache = class {
|
|
|
4773
4480
|
};
|
|
4774
4481
|
|
|
4775
4482
|
// src/shared/config/indexed-blockranges.ts
|
|
4776
|
-
var
|
|
4483
|
+
var import_datasources11 = require("@ensnode/datasources");
|
|
4777
4484
|
function buildIndexedBlockranges(namespace, pluginsDatasourceNames) {
|
|
4778
4485
|
const indexedBlockranges = /* @__PURE__ */ new Map();
|
|
4779
4486
|
for (const [, datasourceNames] of pluginsDatasourceNames) {
|
|
4780
4487
|
for (const datasourceName of datasourceNames) {
|
|
4781
|
-
const datasource = (0,
|
|
4488
|
+
const datasource = (0, import_datasources11.maybeGetDatasource)(namespace, datasourceName);
|
|
4782
4489
|
if (!datasource) continue;
|
|
4783
4490
|
const datasourceChainId = datasource.chain.id;
|
|
4784
4491
|
const datasourceContracts = Object.values(datasource.contracts);
|
|
@@ -4802,11 +4509,12 @@ function buildIndexedBlockranges(namespace, pluginsDatasourceNames) {
|
|
|
4802
4509
|
}
|
|
4803
4510
|
|
|
4804
4511
|
// src/shared/interpretation/interpret-address.ts
|
|
4805
|
-
var
|
|
4806
|
-
var interpretAddress = (owner) => (0,
|
|
4512
|
+
var import_viem9 = require("viem");
|
|
4513
|
+
var interpretAddress = (owner) => (0, import_viem9.isAddressEqual)(import_viem9.zeroAddress, owner) ? null : owner;
|
|
4807
4514
|
|
|
4808
4515
|
// src/shared/interpretation/interpret-record-values.ts
|
|
4809
|
-
var
|
|
4516
|
+
var import_enssdk12 = require("enssdk");
|
|
4517
|
+
var import_viem10 = require("viem");
|
|
4810
4518
|
|
|
4811
4519
|
// src/shared/null-bytes.ts
|
|
4812
4520
|
var hasNullByte = (value) => value.indexOf("\0") !== -1;
|
|
@@ -4815,16 +4523,16 @@ var stripNullBytes = (value) => value.replaceAll("\0", "");
|
|
|
4815
4523
|
// src/shared/interpretation/interpret-record-values.ts
|
|
4816
4524
|
function interpretNameRecordValue(value) {
|
|
4817
4525
|
if (value === "") return null;
|
|
4818
|
-
if (!
|
|
4526
|
+
if (!(0, import_enssdk12.isInterpretedName)(value)) return null;
|
|
4819
4527
|
return value;
|
|
4820
4528
|
}
|
|
4821
4529
|
function interpretAddressRecordValue(value) {
|
|
4822
4530
|
if (hasNullByte(value)) return null;
|
|
4823
4531
|
if (value === "") return null;
|
|
4824
4532
|
if (value === "0x") return null;
|
|
4825
|
-
if (!(0,
|
|
4826
|
-
if ((0,
|
|
4827
|
-
return
|
|
4533
|
+
if (!(0, import_viem10.isAddress)(value, { strict: false })) return value;
|
|
4534
|
+
if ((0, import_viem10.isAddressEqual)(value, import_viem10.zeroAddress)) return null;
|
|
4535
|
+
return (0, import_enssdk12.toNormalizedAddress)(value);
|
|
4828
4536
|
}
|
|
4829
4537
|
function interpretTextRecordKey(key) {
|
|
4830
4538
|
if (hasNullByte(key)) return null;
|
|
@@ -4837,83 +4545,19 @@ function interpretTextRecordValue(value) {
|
|
|
4837
4545
|
return value;
|
|
4838
4546
|
}
|
|
4839
4547
|
|
|
4840
|
-
// src/shared/interpretation/interpret-
|
|
4841
|
-
var
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
var import_viem21 = require("viem");
|
|
4846
|
-
var import_ens10 = require("viem/ens");
|
|
4847
|
-
|
|
4848
|
-
// src/shared/labelhash.ts
|
|
4849
|
-
var import_viem20 = require("viem");
|
|
4850
|
-
var labelhashLiteralLabel = (label) => (0, import_viem20.keccak256)((0, import_viem20.stringToBytes)(label));
|
|
4851
|
-
|
|
4852
|
-
// src/shared/interpretation/interpreted-names-and-labels.ts
|
|
4853
|
-
function literalLabelToInterpretedLabel(label) {
|
|
4854
|
-
if (isNormalizedLabel(label)) return label;
|
|
4855
|
-
return encodeLabelHash(labelhashLiteralLabel(label));
|
|
4856
|
-
}
|
|
4857
|
-
function literalLabelsToInterpretedName(labels) {
|
|
4858
|
-
return labels.map(literalLabelToInterpretedLabel).join(".");
|
|
4859
|
-
}
|
|
4860
|
-
function interpretedLabelsToInterpretedName(labels) {
|
|
4861
|
-
return labels.join(".");
|
|
4862
|
-
}
|
|
4863
|
-
function literalLabelsToLiteralName(labels) {
|
|
4864
|
-
return labels.join(".");
|
|
4865
|
-
}
|
|
4866
|
-
function interpretedNameToInterpretedLabels(name) {
|
|
4867
|
-
return name.split(".");
|
|
4868
|
-
}
|
|
4869
|
-
function encodedLabelToLabelhash(label) {
|
|
4870
|
-
if (label.length !== 66) return null;
|
|
4871
|
-
if (label.indexOf("[") !== 0) return null;
|
|
4872
|
-
if (label.indexOf("]") !== 65) return null;
|
|
4873
|
-
const hash = `0x${label.slice(1, 65)}`;
|
|
4874
|
-
if (!(0, import_viem21.isHex)(hash)) return null;
|
|
4875
|
-
return hash;
|
|
4876
|
-
}
|
|
4877
|
-
function isInterpetedLabel(label) {
|
|
4878
|
-
if (label.startsWith("[")) {
|
|
4879
|
-
const labelHash = encodedLabelToLabelhash(label);
|
|
4880
|
-
return labelHash != null;
|
|
4881
|
-
}
|
|
4882
|
-
return isNormalizedLabel(label);
|
|
4548
|
+
// src/shared/interpretation/interpret-resolver-values.ts
|
|
4549
|
+
var import_viem11 = require("viem");
|
|
4550
|
+
function interpretContenthashValue(value) {
|
|
4551
|
+
if ((0, import_viem11.size)(value) === 0) return null;
|
|
4552
|
+
return value;
|
|
4883
4553
|
}
|
|
4884
|
-
function
|
|
4885
|
-
|
|
4554
|
+
function interpretPubkeyValue(x, y) {
|
|
4555
|
+
if (x === import_viem11.zeroHash && y === import_viem11.zeroHash) return null;
|
|
4556
|
+
return { x, y };
|
|
4886
4557
|
}
|
|
4887
|
-
function
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
throw new Error(
|
|
4891
|
-
`Invariant(interpretedLabelsToLabelHashPath): Expected InterpretedLabel, received '${label}'.`
|
|
4892
|
-
);
|
|
4893
|
-
}
|
|
4894
|
-
const maybeLabelHash = encodedLabelToLabelhash(label);
|
|
4895
|
-
if (maybeLabelHash !== null) return maybeLabelHash;
|
|
4896
|
-
return (0, import_ens10.labelhash)(label);
|
|
4897
|
-
}).toReversed();
|
|
4898
|
-
}
|
|
4899
|
-
function constructSubInterpretedName(label, name) {
|
|
4900
|
-
if (name === void 0 || name === "") return label;
|
|
4901
|
-
return [label, name].join(".");
|
|
4902
|
-
}
|
|
4903
|
-
function ensureInterpretedLabel(labelHash, label) {
|
|
4904
|
-
return label ?? encodeLabelHash(labelHash);
|
|
4905
|
-
}
|
|
4906
|
-
function parsePartialInterpretedName(partialInterpretedName) {
|
|
4907
|
-
if (partialInterpretedName === "") return { concrete: [], partial: "" };
|
|
4908
|
-
const concrete = partialInterpretedName.split(".");
|
|
4909
|
-
const partial = concrete.pop();
|
|
4910
|
-
if (!concrete.every(isInterpetedLabel)) {
|
|
4911
|
-
throw new Error(
|
|
4912
|
-
`Invariant(parsePartialInterpretedName): Concrete portion of Partial InterpretedName contains segments that are not InterpretedLabels.
|
|
4913
|
-
${JSON.stringify(concrete)}`
|
|
4914
|
-
);
|
|
4915
|
-
}
|
|
4916
|
-
return { concrete, partial };
|
|
4558
|
+
function interpretDnszonehashValue(value) {
|
|
4559
|
+
if ((0, import_viem11.size)(value) === 0) return null;
|
|
4560
|
+
return value;
|
|
4917
4561
|
}
|
|
4918
4562
|
|
|
4919
4563
|
// src/shared/namespace-specific-value.ts
|
|
@@ -4922,17 +4566,18 @@ function getNamespaceSpecificValue(namespace, value) {
|
|
|
4922
4566
|
}
|
|
4923
4567
|
|
|
4924
4568
|
// src/shared/root-registry.ts
|
|
4925
|
-
var
|
|
4926
|
-
var
|
|
4569
|
+
var import_enssdk13 = require("enssdk");
|
|
4570
|
+
var import_datasources12 = require("@ensnode/datasources");
|
|
4571
|
+
var getENSv1Registry = (namespace) => getDatasourceContract(namespace, import_datasources12.DatasourceNames.ENSRoot, "ENSv1Registry");
|
|
4927
4572
|
var isENSv1Registry = (namespace, contract) => accountIdEqual(getENSv1Registry(namespace), contract);
|
|
4928
|
-
var getENSv2RootRegistry = (namespace) => getDatasourceContract(namespace,
|
|
4929
|
-
var getENSv2RootRegistryId = (namespace) => makeRegistryId(getENSv2RootRegistry(namespace));
|
|
4573
|
+
var getENSv2RootRegistry = (namespace) => getDatasourceContract(namespace, import_datasources12.DatasourceNames.ENSv2Root, "RootRegistry");
|
|
4574
|
+
var getENSv2RootRegistryId = (namespace) => (0, import_enssdk13.makeRegistryId)(getENSv2RootRegistry(namespace));
|
|
4930
4575
|
var isENSv2RootRegistry = (namespace, contract) => accountIdEqual(getENSv2RootRegistry(namespace), contract);
|
|
4931
|
-
var maybeGetENSv2RootRegistry = (namespace) => maybeGetDatasourceContract(namespace,
|
|
4576
|
+
var maybeGetENSv2RootRegistry = (namespace) => maybeGetDatasourceContract(namespace, import_datasources12.DatasourceNames.ENSv2Root, "RootRegistry");
|
|
4932
4577
|
var maybeGetENSv2RootRegistryId = (namespace) => {
|
|
4933
4578
|
const root = maybeGetENSv2RootRegistry(namespace);
|
|
4934
4579
|
if (!root) return void 0;
|
|
4935
|
-
return makeRegistryId(root);
|
|
4580
|
+
return (0, import_enssdk13.makeRegistryId)(root);
|
|
4936
4581
|
};
|
|
4937
4582
|
|
|
4938
4583
|
// src/shared/url.ts
|
|
@@ -4943,6 +4588,16 @@ function isWebSocketProtocol(url) {
|
|
|
4943
4588
|
return ["ws:", "wss:"].includes(url.protocol);
|
|
4944
4589
|
}
|
|
4945
4590
|
|
|
4591
|
+
// src/stack-info/ensnode-stack-info.ts
|
|
4592
|
+
function buildEnsNodeStackInfo(ensApiPublicConfig, ensDbPublicConfig) {
|
|
4593
|
+
return {
|
|
4594
|
+
ensApi: ensApiPublicConfig,
|
|
4595
|
+
ensDb: ensDbPublicConfig,
|
|
4596
|
+
ensIndexer: ensApiPublicConfig.ensIndexerPublicConfig,
|
|
4597
|
+
ensRainbow: ensApiPublicConfig.ensIndexerPublicConfig.ensRainbowPublicConfig
|
|
4598
|
+
};
|
|
4599
|
+
}
|
|
4600
|
+
|
|
4946
4601
|
// src/subgraph-api/prerequisites.ts
|
|
4947
4602
|
function hasSubgraphApiConfigSupport(config) {
|
|
4948
4603
|
const supported = config.plugins.includes("subgraph" /* Subgraph */);
|