@ensnode/ensnode-sdk 1.9.0 → 1.10.1
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 +893 -1209
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1511 -2246
- package/dist/index.d.ts +1511 -2246
- package/dist/index.js +865 -1180
- 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,65 +184,45 @@ __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
|
-
|
|
191
|
+
maxPrice: () => maxPrice,
|
|
243
192
|
maybeGetDatasourceContract: () => maybeGetDatasourceContract,
|
|
244
193
|
maybeGetENSv2RootRegistry: () => maybeGetENSv2RootRegistry,
|
|
245
194
|
maybeGetENSv2RootRegistryId: () => maybeGetENSv2RootRegistryId,
|
|
246
195
|
mergeBlockNumberRanges: () => mergeBlockNumberRanges,
|
|
196
|
+
minPrice: () => minPrice,
|
|
247
197
|
nameTokensPrerequisites: () => nameTokensPrerequisites,
|
|
248
198
|
parseAccountId: () => parseAccountId,
|
|
249
199
|
parseAssetId: () => parseAssetId,
|
|
250
200
|
parseDai: () => parseDai,
|
|
251
|
-
parseEncodedLabelHash: () => parseEncodedLabelHash,
|
|
252
201
|
parseEth: () => parseEth,
|
|
253
|
-
parseLabelHash: () => parseLabelHash,
|
|
254
|
-
parseLabelHashOrEncodedLabelHash: () => parseLabelHashOrEncodedLabelHash,
|
|
255
202
|
parseNonNegativeInteger: () => parseNonNegativeInteger,
|
|
256
|
-
parsePartialInterpretedName: () => parsePartialInterpretedName,
|
|
257
|
-
parseReverseName: () => parseReverseName,
|
|
258
203
|
parseTimestamp: () => parseTimestamp,
|
|
259
204
|
parseUsdc: () => parseUsdc,
|
|
260
205
|
priceDai: () => priceDai,
|
|
261
206
|
priceEth: () => priceEth,
|
|
262
207
|
priceUsdc: () => priceUsdc,
|
|
263
208
|
registrarActionsFilter: () => registrarActionsFilter,
|
|
264
|
-
reverseName: () => reverseName,
|
|
265
209
|
scaleBigintByNumber: () => scaleBigintByNumber,
|
|
266
210
|
scalePrice: () => scalePrice,
|
|
267
211
|
serializeAssetId: () => serializeAssetId,
|
|
268
212
|
serializeChainId: () => serializeChainId,
|
|
269
213
|
serializeChainIndexingSnapshots: () => serializeChainIndexingSnapshots,
|
|
270
|
-
serializeConfigResponse: () => serializeConfigResponse,
|
|
271
214
|
serializeCrossChainIndexingStatusSnapshot: () => serializeCrossChainIndexingStatusSnapshot,
|
|
272
215
|
serializeCrossChainIndexingStatusSnapshotOmnichain: () => serializeCrossChainIndexingStatusSnapshotOmnichain,
|
|
273
216
|
serializeDatetime: () => serializeDatetime,
|
|
274
217
|
serializeDomainAssetId: () => serializeDomainAssetId,
|
|
275
218
|
serializeENSApiPublicConfig: () => serializeENSApiPublicConfig,
|
|
276
219
|
serializeENSIndexerPublicConfig: () => serializeENSIndexerPublicConfig,
|
|
277
|
-
serializeEnsApiConfigResponse: () => serializeEnsApiConfigResponse,
|
|
278
220
|
serializeEnsApiIndexingStatusResponse: () => serializeEnsApiIndexingStatusResponse,
|
|
279
221
|
serializeEnsApiPublicConfig: () => serializeEnsApiPublicConfig,
|
|
280
222
|
serializeEnsIndexerConfigResponse: () => serializeEnsIndexerConfigResponse,
|
|
281
223
|
serializeEnsIndexerIndexingStatusResponse: () => serializeEnsIndexerIndexingStatusResponse,
|
|
282
224
|
serializeEnsIndexerPublicConfig: () => serializeEnsIndexerPublicConfig,
|
|
225
|
+
serializeEnsNodeStackInfo: () => serializeEnsNodeStackInfo,
|
|
283
226
|
serializeIndexedChainIds: () => serializeIndexedChainIds,
|
|
284
227
|
serializeIndexingStatusResponse: () => serializeIndexingStatusResponse,
|
|
285
228
|
serializeNameToken: () => serializeNameToken,
|
|
@@ -298,8 +241,8 @@ __export(index_exports, {
|
|
|
298
241
|
serializeUrl: () => serializeUrl,
|
|
299
242
|
sortChainStatusesByStartBlockAsc: () => sortChainStatusesByStartBlockAsc,
|
|
300
243
|
stripNullBytes: () => stripNullBytes,
|
|
244
|
+
subtractPrice: () => subtractPrice,
|
|
301
245
|
translateDefaultableChainIdToChainId: () => translateDefaultableChainIdToChainId,
|
|
302
|
-
uint256ToHex32: () => uint256ToHex32,
|
|
303
246
|
uniq: () => uniq,
|
|
304
247
|
validateChainIndexingStatusSnapshot: () => validateChainIndexingStatusSnapshot,
|
|
305
248
|
validateCrossChainIndexingStatusSnapshot: () => validateCrossChainIndexingStatusSnapshot,
|
|
@@ -311,229 +254,15 @@ __export(index_exports, {
|
|
|
311
254
|
validateSupportedLabelSetAndVersion: () => validateSupportedLabelSetAndVersion
|
|
312
255
|
});
|
|
313
256
|
module.exports = __toCommonJS(index_exports);
|
|
257
|
+
var import_datasources13 = require("@ensnode/datasources");
|
|
314
258
|
|
|
315
259
|
// 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
|
-
}
|
|
260
|
+
var import_datasources = require("@ensnode/datasources");
|
|
394
261
|
|
|
395
262
|
// src/ens/fuses.ts
|
|
396
263
|
var PARENT_CANNOT_CONTROL = 65536;
|
|
397
264
|
var isPccFuseSet = (fuses) => (fuses & PARENT_CANNOT_CONTROL) === PARENT_CANNOT_CONTROL;
|
|
398
265
|
|
|
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
266
|
// src/ensapi/config/deserialize.ts
|
|
538
267
|
var import_v47 = require("zod/v4");
|
|
539
268
|
|
|
@@ -548,11 +277,12 @@ var import_v42 = require("zod/v4");
|
|
|
548
277
|
|
|
549
278
|
// src/shared/zod-schemas.ts
|
|
550
279
|
var import_caip = require("caip");
|
|
551
|
-
var
|
|
280
|
+
var import_enssdk = require("enssdk");
|
|
281
|
+
var import_viem2 = require("viem");
|
|
552
282
|
var import_v4 = require("zod/v4");
|
|
553
283
|
|
|
554
284
|
// src/shared/currencies.ts
|
|
555
|
-
var
|
|
285
|
+
var import_viem = require("viem");
|
|
556
286
|
|
|
557
287
|
// src/shared/numbers.ts
|
|
558
288
|
function bigIntToNumber(n) {
|
|
@@ -665,6 +395,32 @@ function addPrices(...prices) {
|
|
|
665
395
|
}
|
|
666
396
|
);
|
|
667
397
|
}
|
|
398
|
+
function subtractPrice(a, b) {
|
|
399
|
+
if (!isPriceCurrencyEqual(a, b)) {
|
|
400
|
+
throw new Error("All prices must have the same currency to be subtracted.");
|
|
401
|
+
}
|
|
402
|
+
const resultAmount = a.amount - b.amount;
|
|
403
|
+
if (resultAmount < 0n) {
|
|
404
|
+
throw new Error("subtractPrice result must be non-negative.");
|
|
405
|
+
}
|
|
406
|
+
return { amount: resultAmount, currency: a.currency };
|
|
407
|
+
}
|
|
408
|
+
function minPrice(...prices) {
|
|
409
|
+
const firstPrice = prices[0];
|
|
410
|
+
const allPricesInSameCurrency = prices.every((price) => isPriceCurrencyEqual(firstPrice, price));
|
|
411
|
+
if (allPricesInSameCurrency === false) {
|
|
412
|
+
throw new Error("All prices must have the same currency to be compared.");
|
|
413
|
+
}
|
|
414
|
+
return prices.reduce((acc, price) => price.amount < acc.amount ? price : acc);
|
|
415
|
+
}
|
|
416
|
+
function maxPrice(...prices) {
|
|
417
|
+
const firstPrice = prices[0];
|
|
418
|
+
const allPricesInSameCurrency = prices.every((price) => isPriceCurrencyEqual(firstPrice, price));
|
|
419
|
+
if (allPricesInSameCurrency === false) {
|
|
420
|
+
throw new Error("All prices must have the same currency to be compared.");
|
|
421
|
+
}
|
|
422
|
+
return prices.reduce((acc, price) => price.amount > acc.amount ? price : acc);
|
|
423
|
+
}
|
|
668
424
|
function scalePrice(price, scaleFactor) {
|
|
669
425
|
const scaledAmount = scaleBigintByNumber(price.amount, scaleFactor);
|
|
670
426
|
return {
|
|
@@ -687,42 +443,22 @@ function validateAmountToParse(value) {
|
|
|
687
443
|
function parseEth(value) {
|
|
688
444
|
validateAmountToParse(value);
|
|
689
445
|
const currencyInfo2 = getCurrencyInfo(CurrencyIds.ETH);
|
|
690
|
-
const amount = (0,
|
|
446
|
+
const amount = (0, import_viem.parseUnits)(value, currencyInfo2.decimals);
|
|
691
447
|
return priceEth(amount);
|
|
692
448
|
}
|
|
693
449
|
function parseUsdc(value) {
|
|
694
450
|
validateAmountToParse(value);
|
|
695
451
|
const currencyInfo2 = getCurrencyInfo(CurrencyIds.USDC);
|
|
696
|
-
const amount = (0,
|
|
452
|
+
const amount = (0, import_viem.parseUnits)(value, currencyInfo2.decimals);
|
|
697
453
|
return priceUsdc(amount);
|
|
698
454
|
}
|
|
699
455
|
function parseDai(value) {
|
|
700
456
|
validateAmountToParse(value);
|
|
701
457
|
const currencyInfo2 = getCurrencyInfo(CurrencyIds.DAI);
|
|
702
|
-
const amount = (0,
|
|
458
|
+
const amount = (0, import_viem.parseUnits)(value, currencyInfo2.decimals);
|
|
703
459
|
return priceDai(amount);
|
|
704
460
|
}
|
|
705
461
|
|
|
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
462
|
// src/shared/zod-schemas.ts
|
|
727
463
|
var makeIntegerSchema = (valueLabel = "Value") => import_v4.z.int({
|
|
728
464
|
error: `${valueLabel} must be an integer.`
|
|
@@ -738,15 +474,15 @@ var makeDurationSchema = (valueLabel = "Value") => import_v4.z.number({
|
|
|
738
474
|
}).pipe(makeNonNegativeIntegerSchema(valueLabel));
|
|
739
475
|
var makeChainIdSchema = (valueLabel = "Chain ID") => makePositiveIntegerSchema(valueLabel).transform((val) => val);
|
|
740
476
|
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,
|
|
477
|
+
var makeNormalizedAddressSchema = (valueLabel = "EVM address") => import_v4.z.string().check((ctx) => {
|
|
478
|
+
if (!(0, import_viem2.isAddress)(ctx.value, { strict: false })) {
|
|
743
479
|
ctx.issues.push({
|
|
744
480
|
code: "custom",
|
|
745
481
|
message: `${valueLabel} must be a valid EVM address`,
|
|
746
482
|
input: ctx.value
|
|
747
483
|
});
|
|
748
484
|
}
|
|
749
|
-
}).transform((val) =>
|
|
485
|
+
}).transform((val) => (0, import_enssdk.toNormalizedAddress)(val));
|
|
750
486
|
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
487
|
var makeUnixTimestampSchema = (valueLabel = "Timestamp") => makeIntegerSchema(valueLabel);
|
|
752
488
|
var makeUrlSchema = (valueLabel = "Value") => import_v4.z.url({
|
|
@@ -784,7 +520,7 @@ var makePriceUsdcSchema = (valueLabel = "Price USDC") => makePriceCurrencySchema
|
|
|
784
520
|
var makePriceDaiSchema = (valueLabel = "Price DAI") => makePriceCurrencySchema(CurrencyIds.DAI, valueLabel).transform((v) => v);
|
|
785
521
|
var makeAccountIdSchema = (valueLabel = "AccountId") => import_v4.z.strictObject({
|
|
786
522
|
chainId: makeChainIdSchema(`${valueLabel} chain ID`),
|
|
787
|
-
address:
|
|
523
|
+
address: makeNormalizedAddressSchema(`${valueLabel} address`)
|
|
788
524
|
});
|
|
789
525
|
var makeAccountIdStringSchema = (valueLabel = "Account ID String") => import_v4.z.coerce.string().transform((v) => {
|
|
790
526
|
const result = new import_caip.AccountId(v);
|
|
@@ -794,7 +530,7 @@ var makeAccountIdStringSchema = (valueLabel = "Account ID String") => import_v4.
|
|
|
794
530
|
};
|
|
795
531
|
}).pipe(makeAccountIdSchema(valueLabel));
|
|
796
532
|
var makeHexStringSchema = (options, valueLabel = "String representation of bytes array") => import_v4.z.string().check(function invariant_isHexEncoded(ctx) {
|
|
797
|
-
if (!(0,
|
|
533
|
+
if (!(0, import_viem2.isHex)(ctx.value)) {
|
|
798
534
|
ctx.issues.push({
|
|
799
535
|
code: "custom",
|
|
800
536
|
input: ctx.value,
|
|
@@ -803,7 +539,7 @@ var makeHexStringSchema = (options, valueLabel = "String representation of bytes
|
|
|
803
539
|
}
|
|
804
540
|
}).transform((v) => v).check(function invariant_encodesRequiredBytesCount(ctx) {
|
|
805
541
|
const expectedBytesCount = options.bytesCount;
|
|
806
|
-
const actualBytesCount = (0,
|
|
542
|
+
const actualBytesCount = (0, import_viem2.size)(ctx.value);
|
|
807
543
|
if (actualBytesCount !== expectedBytesCount) {
|
|
808
544
|
ctx.issues.push({
|
|
809
545
|
code: "custom",
|
|
@@ -816,7 +552,7 @@ var makeNodeSchema = (valueLabel = "Node") => makeHexStringSchema({ bytesCount:
|
|
|
816
552
|
var makeTransactionHashSchema = (valueLabel = "Transaction hash") => makeHexStringSchema({ bytesCount: 32 }, valueLabel);
|
|
817
553
|
var makeReinterpretedNameSchema = (valueLabel = "Reinterpreted Name") => import_v4.z.string().transform((v) => v).check((ctx) => {
|
|
818
554
|
try {
|
|
819
|
-
reinterpretName(ctx.value);
|
|
555
|
+
(0, import_enssdk.reinterpretName)(ctx.value);
|
|
820
556
|
} catch (error) {
|
|
821
557
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
822
558
|
ctx.issues.push({
|
|
@@ -825,7 +561,7 @@ var makeReinterpretedNameSchema = (valueLabel = "Reinterpreted Name") => import_
|
|
|
825
561
|
message: `${valueLabel} cannot be reinterpreted: ${errorMessage}`
|
|
826
562
|
});
|
|
827
563
|
}
|
|
828
|
-
}).transform(reinterpretName);
|
|
564
|
+
}).transform(import_enssdk.reinterpretName);
|
|
829
565
|
|
|
830
566
|
// src/ensrainbow/zod-schemas/config.ts
|
|
831
567
|
var makeLabelSetIdSchema = (valueLabel = "Label set ID") => {
|
|
@@ -833,9 +569,8 @@ var makeLabelSetIdSchema = (valueLabel = "Label set ID") => {
|
|
|
833
569
|
error: `${valueLabel} can only contain lowercase letters (a-z) and hyphens (-)`
|
|
834
570
|
});
|
|
835
571
|
};
|
|
836
|
-
var makeLabelSetVersionSchema = (valueLabel = "Label set version") =>
|
|
837
|
-
|
|
838
|
-
};
|
|
572
|
+
var makeLabelSetVersionSchema = (valueLabel = "Label set version") => makeNonNegativeIntegerSchema(valueLabel);
|
|
573
|
+
var makeLabelSetVersionStringSchema = (valueLabel = "Label set version") => import_v42.z.coerce.number({ error: `${valueLabel} must be a non-negative integer` }).pipe(makeLabelSetVersionSchema(valueLabel));
|
|
839
574
|
var makeEnsRainbowPublicConfigSchema = (valueLabel = "EnsRainbowPublicConfig") => import_v42.z.object({
|
|
840
575
|
version: import_v42.z.string().nonempty({ error: `${valueLabel}.version must be a non-empty string.` }),
|
|
841
576
|
labelSet: import_v42.z.object({
|
|
@@ -851,7 +586,7 @@ var makeEnsRainbowPublicConfigSchema = (valueLabel = "EnsRainbowPublicConfig") =
|
|
|
851
586
|
var uniq = (arr) => [...new Set(arr)];
|
|
852
587
|
|
|
853
588
|
// src/ensindexer/config/is-subgraph-compatible.ts
|
|
854
|
-
var
|
|
589
|
+
var import_datasources2 = require("@ensnode/datasources");
|
|
855
590
|
|
|
856
591
|
// src/ensindexer/config/types.ts
|
|
857
592
|
var PluginName = /* @__PURE__ */ ((PluginName2) => {
|
|
@@ -871,7 +606,7 @@ function isSubgraphCompatible(config) {
|
|
|
871
606
|
const onlySubgraphPluginActivated = config.plugins.length === 1 && config.plugins[0] === "subgraph" /* Subgraph */;
|
|
872
607
|
const isSubgraphLabelSet = config.labelSet.labelSetId === "subgraph" && config.labelSet.labelSetVersion === 0;
|
|
873
608
|
const isEnsTestEnvLabelSet = config.labelSet.labelSetId === "ens-test-env" && config.labelSet.labelSetVersion === 0;
|
|
874
|
-
const labelSetIsSubgraphCompatible = isSubgraphLabelSet || config.namespace ===
|
|
609
|
+
const labelSetIsSubgraphCompatible = isSubgraphLabelSet || config.namespace === import_datasources2.ENSNamespaceIds.EnsTestEnv && isEnsTestEnvLabelSet;
|
|
875
610
|
return onlySubgraphPluginActivated && labelSetIsSubgraphCompatible;
|
|
876
611
|
}
|
|
877
612
|
|
|
@@ -880,7 +615,7 @@ function buildLabelSetId(maybeLabelSetId) {
|
|
|
880
615
|
return makeLabelSetIdSchema("LabelSetId").parse(maybeLabelSetId);
|
|
881
616
|
}
|
|
882
617
|
function buildLabelSetVersion(maybeLabelSetVersion) {
|
|
883
|
-
return
|
|
618
|
+
return makeLabelSetVersionStringSchema("LabelSetVersion").parse(maybeLabelSetVersion);
|
|
884
619
|
}
|
|
885
620
|
function buildEnsRainbowClientLabelSet(labelSetId, labelSetVersion) {
|
|
886
621
|
if (labelSetVersion !== void 0 && labelSetId === void 0) {
|
|
@@ -932,7 +667,7 @@ var makePluginsListSchema = (valueLabel = "Plugins") => import_v43.z.array(impor
|
|
|
932
667
|
}).refine((arr) => arr.length === uniq(arr).length, {
|
|
933
668
|
error: `${valueLabel} cannot contain duplicate values.`
|
|
934
669
|
});
|
|
935
|
-
var
|
|
670
|
+
var makeEnsIndexerSchemaNameSchema = (valueLabel = "ENS Indexer Schema Name") => import_v43.z.string({ error: `${valueLabel} must be a string` }).trim().nonempty({
|
|
936
671
|
error: `${valueLabel} is required and must be a non-empty string.`
|
|
937
672
|
});
|
|
938
673
|
var makeFullyPinnedLabelSetSchema = (valueLabel = "Label set") => {
|
|
@@ -947,13 +682,12 @@ var makeFullyPinnedLabelSetSchema = (valueLabel = "Label set") => {
|
|
|
947
682
|
}
|
|
948
683
|
return import_v43.z.object({
|
|
949
684
|
labelSetId: makeLabelSetIdSchema(valueLabelLabelSetId),
|
|
950
|
-
labelSetVersion:
|
|
685
|
+
labelSetVersion: makeLabelSetVersionStringSchema(valueLabelLabelSetVersion)
|
|
951
686
|
});
|
|
952
687
|
};
|
|
953
688
|
var makeNonEmptyStringSchema = (valueLabel = "Value") => import_v43.z.string().nonempty({ error: `${valueLabel} must be a non-empty string.` });
|
|
954
689
|
var makeEnsIndexerVersionInfoSchema = (valueLabel = "Value") => import_v43.z.object(
|
|
955
690
|
{
|
|
956
|
-
nodejs: makeNonEmptyStringSchema(),
|
|
957
691
|
ponder: makeNonEmptyStringSchema(),
|
|
958
692
|
ensDb: makeNonEmptyStringSchema(),
|
|
959
693
|
ensIndexer: makeNonEmptyStringSchema(),
|
|
@@ -988,7 +722,7 @@ function invariant_ensRainbowSupportedLabelSetAndVersion(ctx) {
|
|
|
988
722
|
}
|
|
989
723
|
}
|
|
990
724
|
var makeEnsIndexerPublicConfigSchema = (valueLabel = "ENSIndexerPublicConfig") => import_v43.z.object({
|
|
991
|
-
|
|
725
|
+
ensIndexerSchemaName: makeEnsIndexerSchemaNameSchema(`${valueLabel}.ensIndexerSchemaName`),
|
|
992
726
|
ensRainbowPublicConfig: makeEnsRainbowPublicConfigSchema(
|
|
993
727
|
`${valueLabel}.ensRainbowPublicConfig`
|
|
994
728
|
),
|
|
@@ -1002,7 +736,7 @@ var makeEnsIndexerPublicConfigSchema = (valueLabel = "ENSIndexerPublicConfig") =
|
|
|
1002
736
|
versionInfo: makeEnsIndexerVersionInfoSchema(`${valueLabel}.versionInfo`)
|
|
1003
737
|
}).check(invariant_isSubgraphCompatibleRequirements).check(invariant_ensRainbowSupportedLabelSetAndVersion);
|
|
1004
738
|
var makeSerializedEnsIndexerPublicConfigSchema = (valueLabel = "Serialized ENSIndexerPublicConfig") => import_v43.z.object({
|
|
1005
|
-
|
|
739
|
+
ensIndexerSchemaName: makeEnsIndexerSchemaNameSchema(`${valueLabel}.ensIndexerSchemaName`),
|
|
1006
740
|
ensRainbowPublicConfig: makeEnsRainbowPublicConfigSchema(
|
|
1007
741
|
`${valueLabel}.ensRainbowPublicConfig`
|
|
1008
742
|
),
|
|
@@ -1056,23 +790,27 @@ var TheGraphFallbackSchema = import_v45.z.discriminatedUnion("canFallback", [
|
|
|
1056
790
|
]);
|
|
1057
791
|
|
|
1058
792
|
// src/ensapi/config/zod-schemas.ts
|
|
793
|
+
var makeEnsApiVersionInfoSchema = (valueLabel = "ENS API version info") => import_v46.z.object({
|
|
794
|
+
ensApi: import_v46.z.string().nonempty(`${valueLabel}.ensApi must be a non-empty string`),
|
|
795
|
+
ensNormalize: import_v46.z.string().nonempty(`${valueLabel}.ensNormalize must be a non-empty string`)
|
|
796
|
+
});
|
|
1059
797
|
function makeEnsApiPublicConfigSchema(valueLabel) {
|
|
1060
798
|
const label = valueLabel ?? "ENSApiPublicConfig";
|
|
1061
799
|
return import_v46.z.object({
|
|
1062
|
-
version: import_v46.z.string().min(1, `${label}.version must be a non-empty string`),
|
|
1063
800
|
theGraphFallback: TheGraphFallbackSchema,
|
|
1064
|
-
ensIndexerPublicConfig: makeEnsIndexerPublicConfigSchema(`${label}.ensIndexerPublicConfig`)
|
|
801
|
+
ensIndexerPublicConfig: makeEnsIndexerPublicConfigSchema(`${label}.ensIndexerPublicConfig`),
|
|
802
|
+
versionInfo: makeEnsApiVersionInfoSchema(`${label}.versionInfo`)
|
|
1065
803
|
});
|
|
1066
804
|
}
|
|
1067
805
|
var makeENSApiPublicConfigSchema = makeEnsApiPublicConfigSchema;
|
|
1068
806
|
function makeSerializedEnsApiPublicConfigSchema(valueLabel) {
|
|
1069
807
|
const label = valueLabel ?? "ENSApiPublicConfig";
|
|
1070
808
|
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
809
|
ensIndexerPublicConfig: makeSerializedEnsIndexerPublicConfigSchema(
|
|
1074
810
|
`${label}.ensIndexerPublicConfig`
|
|
1075
|
-
)
|
|
811
|
+
),
|
|
812
|
+
theGraphFallback: TheGraphFallbackSchema,
|
|
813
|
+
versionInfo: makeEnsApiVersionInfoSchema(`${label}.versionInfo`)
|
|
1076
814
|
});
|
|
1077
815
|
}
|
|
1078
816
|
|
|
@@ -1096,19 +834,13 @@ ${(0, import_v47.prettifyError)(parsed.error)}
|
|
|
1096
834
|
}
|
|
1097
835
|
var deserializeENSApiPublicConfig = deserializeEnsApiPublicConfig;
|
|
1098
836
|
|
|
1099
|
-
// src/ensapi/api/config/deserialize.ts
|
|
1100
|
-
function deserializeEnsApiConfigResponse(maybeResponse) {
|
|
1101
|
-
return deserializeEnsApiPublicConfig(maybeResponse);
|
|
1102
|
-
}
|
|
1103
|
-
var deserializeConfigResponse = deserializeEnsApiConfigResponse;
|
|
1104
|
-
|
|
1105
837
|
// src/ensindexer/config/serialize.ts
|
|
1106
838
|
function serializeIndexedChainIds(indexedChainIds) {
|
|
1107
839
|
return Array.from(indexedChainIds);
|
|
1108
840
|
}
|
|
1109
841
|
function serializeEnsIndexerPublicConfig(config) {
|
|
1110
842
|
const {
|
|
1111
|
-
|
|
843
|
+
ensIndexerSchemaName,
|
|
1112
844
|
ensRainbowPublicConfig,
|
|
1113
845
|
indexedChainIds,
|
|
1114
846
|
isSubgraphCompatible: isSubgraphCompatible2,
|
|
@@ -1118,7 +850,7 @@ function serializeEnsIndexerPublicConfig(config) {
|
|
|
1118
850
|
versionInfo
|
|
1119
851
|
} = config;
|
|
1120
852
|
return {
|
|
1121
|
-
|
|
853
|
+
ensIndexerSchemaName,
|
|
1122
854
|
ensRainbowPublicConfig,
|
|
1123
855
|
indexedChainIds: serializeIndexedChainIds(indexedChainIds),
|
|
1124
856
|
isSubgraphCompatible: isSubgraphCompatible2,
|
|
@@ -1132,22 +864,26 @@ var serializeENSIndexerPublicConfig = serializeEnsIndexerPublicConfig;
|
|
|
1132
864
|
|
|
1133
865
|
// src/ensapi/config/serialize.ts
|
|
1134
866
|
function serializeEnsApiPublicConfig(config) {
|
|
1135
|
-
const {
|
|
867
|
+
const { ensIndexerPublicConfig, theGraphFallback, versionInfo } = config;
|
|
1136
868
|
return {
|
|
1137
|
-
|
|
869
|
+
ensIndexerPublicConfig: serializeEnsIndexerPublicConfig(ensIndexerPublicConfig),
|
|
1138
870
|
theGraphFallback,
|
|
1139
|
-
|
|
871
|
+
versionInfo
|
|
1140
872
|
};
|
|
1141
873
|
}
|
|
1142
874
|
var serializeENSApiPublicConfig = serializeEnsApiPublicConfig;
|
|
1143
875
|
|
|
1144
|
-
// src/
|
|
1145
|
-
function
|
|
1146
|
-
return
|
|
876
|
+
// src/ensindexer/api/config/deserialize.ts
|
|
877
|
+
function deserializeEnsIndexerConfigResponse(maybeResponse) {
|
|
878
|
+
return deserializeEnsIndexerPublicConfig(maybeResponse, "EnsIndexerConfigResponse");
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
// src/ensindexer/api/config/serialize.ts
|
|
882
|
+
function serializeEnsIndexerConfigResponse(response) {
|
|
883
|
+
return serializeEnsIndexerPublicConfig(response);
|
|
1147
884
|
}
|
|
1148
|
-
var serializeConfigResponse = serializeEnsApiConfigResponse;
|
|
1149
885
|
|
|
1150
|
-
// src/
|
|
886
|
+
// src/ensindexer/api/indexing-status/deserialize.ts
|
|
1151
887
|
var import_v418 = require("zod/v4");
|
|
1152
888
|
|
|
1153
889
|
// src/indexing-status/deserialize/realtime-indexing-status-projection.ts
|
|
@@ -2074,8 +1810,8 @@ ${(0, import_v416.prettifyError)(parsed.error)}
|
|
|
2074
1810
|
return parsed.data;
|
|
2075
1811
|
}
|
|
2076
1812
|
|
|
2077
|
-
// src/
|
|
2078
|
-
var
|
|
1813
|
+
// src/ensindexer/api/indexing-status/response.ts
|
|
1814
|
+
var EnsIndexerIndexingStatusResponseCodes = {
|
|
2079
1815
|
/**
|
|
2080
1816
|
* Represents that the indexing status is available.
|
|
2081
1817
|
*/
|
|
@@ -2085,33 +1821,32 @@ var EnsApiIndexingStatusResponseCodes = {
|
|
|
2085
1821
|
*/
|
|
2086
1822
|
Error: "error"
|
|
2087
1823
|
};
|
|
2088
|
-
var IndexingStatusResponseCodes = EnsApiIndexingStatusResponseCodes;
|
|
2089
1824
|
|
|
2090
|
-
// src/
|
|
1825
|
+
// src/ensindexer/api/indexing-status/zod-schemas.ts
|
|
2091
1826
|
var import_v417 = require("zod/v4");
|
|
2092
|
-
var
|
|
2093
|
-
responseCode: import_v417.z.literal(
|
|
1827
|
+
var makeEnsIndexerIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => import_v417.z.strictObject({
|
|
1828
|
+
responseCode: import_v417.z.literal(EnsIndexerIndexingStatusResponseCodes.Ok),
|
|
2094
1829
|
realtimeProjection: makeRealtimeIndexingStatusProjectionSchema(valueLabel)
|
|
2095
1830
|
});
|
|
2096
|
-
var
|
|
2097
|
-
responseCode: import_v417.z.literal(
|
|
1831
|
+
var makeEnsIndexerIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => import_v417.z.strictObject({
|
|
1832
|
+
responseCode: import_v417.z.literal(EnsIndexerIndexingStatusResponseCodes.Error)
|
|
2098
1833
|
});
|
|
2099
|
-
var
|
|
2100
|
-
|
|
2101
|
-
|
|
1834
|
+
var makeEnsIndexerIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => import_v417.z.discriminatedUnion("responseCode", [
|
|
1835
|
+
makeEnsIndexerIndexingStatusResponseOkSchema(valueLabel),
|
|
1836
|
+
makeEnsIndexerIndexingStatusResponseErrorSchema(valueLabel)
|
|
2102
1837
|
]);
|
|
2103
|
-
var
|
|
2104
|
-
responseCode: import_v417.z.literal(
|
|
1838
|
+
var makeSerializedEnsIndexerIndexingStatusResponseOkSchema = (valueLabel = "Serialized Indexing Status Response OK") => import_v417.z.strictObject({
|
|
1839
|
+
responseCode: import_v417.z.literal(EnsIndexerIndexingStatusResponseCodes.Ok),
|
|
2105
1840
|
realtimeProjection: makeSerializedRealtimeIndexingStatusProjectionSchema(valueLabel)
|
|
2106
1841
|
});
|
|
2107
|
-
var
|
|
2108
|
-
|
|
2109
|
-
|
|
1842
|
+
var makeSerializedEnsIndexerIndexingStatusResponseSchema = (valueLabel = "Serialized Indexing Status Response") => import_v417.z.discriminatedUnion("responseCode", [
|
|
1843
|
+
makeSerializedEnsIndexerIndexingStatusResponseOkSchema(valueLabel),
|
|
1844
|
+
makeEnsIndexerIndexingStatusResponseErrorSchema(valueLabel)
|
|
2110
1845
|
]);
|
|
2111
1846
|
|
|
2112
|
-
// src/
|
|
2113
|
-
function
|
|
2114
|
-
if (serializedResponse.responseCode !==
|
|
1847
|
+
// src/ensindexer/api/indexing-status/deserialize.ts
|
|
1848
|
+
function buildUnvalidatedEnsIndexerIndexingStatusResponse(serializedResponse) {
|
|
1849
|
+
if (serializedResponse.responseCode !== EnsIndexerIndexingStatusResponseCodes.Ok) {
|
|
2115
1850
|
return serializedResponse;
|
|
2116
1851
|
}
|
|
2117
1852
|
return {
|
|
@@ -2121,21 +1856,19 @@ function buildUnvalidatedEnsApiIndexingStatusResponse(serializedResponse) {
|
|
|
2121
1856
|
)
|
|
2122
1857
|
};
|
|
2123
1858
|
}
|
|
2124
|
-
function
|
|
2125
|
-
const parsed =
|
|
1859
|
+
function deserializeEnsIndexerIndexingStatusResponse(maybeResponse) {
|
|
1860
|
+
const parsed = makeSerializedEnsIndexerIndexingStatusResponseSchema().transform(buildUnvalidatedEnsIndexerIndexingStatusResponse).pipe(makeEnsIndexerIndexingStatusResponseSchema()).safeParse(maybeResponse);
|
|
2126
1861
|
if (parsed.error) {
|
|
2127
1862
|
throw new Error(
|
|
2128
|
-
`Cannot deserialize
|
|
1863
|
+
`Cannot deserialize EnsIndexerIndexingStatusResponse:
|
|
2129
1864
|
${(0, import_v418.prettifyError)(parsed.error)}
|
|
2130
1865
|
`
|
|
2131
1866
|
);
|
|
2132
1867
|
}
|
|
2133
1868
|
return parsed.data;
|
|
2134
1869
|
}
|
|
2135
|
-
var deserializeIndexingStatusResponse = deserializeEnsApiIndexingStatusResponse;
|
|
2136
1870
|
|
|
2137
1871
|
// src/shared/serialize.ts
|
|
2138
|
-
var import_caip2 = require("caip");
|
|
2139
1872
|
function serializeChainId(chainId) {
|
|
2140
1873
|
return chainId.toString();
|
|
2141
1874
|
}
|
|
@@ -2160,23 +1893,6 @@ function serializePriceUsdc(price) {
|
|
|
2160
1893
|
function serializePriceDai(price) {
|
|
2161
1894
|
return serializePrice(price);
|
|
2162
1895
|
}
|
|
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
1896
|
|
|
2181
1897
|
// src/indexing-status/serialize/chain-indexing-status-snapshot.ts
|
|
2182
1898
|
function serializeChainIndexingSnapshots(chains) {
|
|
@@ -2248,141 +1964,511 @@ function serializeRealtimeIndexingStatusProjection(indexingProjection) {
|
|
|
2248
1964
|
};
|
|
2249
1965
|
}
|
|
2250
1966
|
|
|
2251
|
-
// src/
|
|
2252
|
-
function
|
|
1967
|
+
// src/ensindexer/api/indexing-status/serialize.ts
|
|
1968
|
+
function serializeEnsIndexerIndexingStatusResponse(response) {
|
|
2253
1969
|
switch (response.responseCode) {
|
|
2254
|
-
case
|
|
1970
|
+
case EnsIndexerIndexingStatusResponseCodes.Ok:
|
|
2255
1971
|
return {
|
|
2256
1972
|
responseCode: response.responseCode,
|
|
2257
1973
|
realtimeProjection: serializeRealtimeIndexingStatusProjection(response.realtimeProjection)
|
|
2258
1974
|
};
|
|
2259
|
-
case
|
|
1975
|
+
case EnsIndexerIndexingStatusResponseCodes.Error:
|
|
2260
1976
|
return response;
|
|
2261
1977
|
}
|
|
2262
1978
|
}
|
|
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
1979
|
|
|
2308
|
-
// src/
|
|
2309
|
-
var import_viem12 = require("viem");
|
|
1980
|
+
// src/ensindexer/api/shared/errors/deserialize.ts
|
|
2310
1981
|
var import_v420 = require("zod/v4");
|
|
2311
1982
|
|
|
2312
|
-
// src/
|
|
2313
|
-
var import_caip3 = require("caip");
|
|
2314
|
-
var import_viem11 = require("viem");
|
|
1983
|
+
// src/ensindexer/api/shared/errors/zod-schemas.ts
|
|
2315
1984
|
var import_v419 = require("zod/v4");
|
|
1985
|
+
var ErrorResponseSchema = import_v419.z.object({
|
|
1986
|
+
message: import_v419.z.string(),
|
|
1987
|
+
details: import_v419.z.optional(import_v419.z.unknown())
|
|
1988
|
+
});
|
|
2316
1989
|
|
|
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;
|
|
1990
|
+
// src/ensindexer/api/shared/errors/deserialize.ts
|
|
1991
|
+
function deserializeErrorResponse(maybeErrorResponse) {
|
|
1992
|
+
const parsed = ErrorResponseSchema.safeParse(maybeErrorResponse);
|
|
1993
|
+
if (parsed.error) {
|
|
1994
|
+
throw new Error(`Cannot deserialize ErrorResponse:
|
|
1995
|
+
${(0, import_v420.prettifyError)(parsed.error)}
|
|
1996
|
+
`);
|
|
2334
1997
|
}
|
|
1998
|
+
return parsed.data;
|
|
2335
1999
|
}
|
|
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
|
-
};
|
|
2000
|
+
|
|
2001
|
+
// src/ensindexer/client.ts
|
|
2002
|
+
var EnsIndexerClient = class {
|
|
2003
|
+
constructor(options) {
|
|
2004
|
+
this.options = options;
|
|
2354
2005
|
}
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
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.`
|
|
2006
|
+
getOptions() {
|
|
2007
|
+
return Object.freeze({
|
|
2008
|
+
url: new URL(this.options.url.href)
|
|
2364
2009
|
});
|
|
2365
2010
|
}
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2011
|
+
/**
|
|
2012
|
+
* Fetch ENSIndexer Config
|
|
2013
|
+
*
|
|
2014
|
+
* Fetch the ENSIndexer's configuration.
|
|
2015
|
+
*
|
|
2016
|
+
* @returns {EnsIndexerConfigResponse}
|
|
2017
|
+
*
|
|
2018
|
+
* @throws if the ENSIndexer request fails
|
|
2019
|
+
* @throws if the ENSIndexer returns a non-ok response
|
|
2020
|
+
* @throws if the ENSIndexer response breaks required invariants
|
|
2021
|
+
*/
|
|
2022
|
+
async config() {
|
|
2023
|
+
const url = new URL(`/api/config`, this.options.url);
|
|
2024
|
+
const response = await fetch(url);
|
|
2025
|
+
let responseData;
|
|
2026
|
+
try {
|
|
2027
|
+
responseData = await response.json();
|
|
2028
|
+
} catch {
|
|
2029
|
+
throw new Error("Malformed response data: invalid JSON");
|
|
2030
|
+
}
|
|
2031
|
+
if (!response.ok) {
|
|
2032
|
+
const errorResponse = deserializeErrorResponse(responseData);
|
|
2033
|
+
throw new Error(`Fetching ENSIndexer Config Failed: ${errorResponse.message}`);
|
|
2034
|
+
}
|
|
2035
|
+
return deserializeEnsIndexerConfigResponse(
|
|
2036
|
+
responseData
|
|
2037
|
+
);
|
|
2038
|
+
}
|
|
2039
|
+
/**
|
|
2040
|
+
* Fetch ENSIndexer Indexing Status
|
|
2041
|
+
*
|
|
2042
|
+
* @returns {EnsIndexerIndexingStatusResponse}
|
|
2043
|
+
*
|
|
2044
|
+
* @throws if the ENSIndexer request fails
|
|
2045
|
+
* @throws if the ENSIndexer returns a non-ok response
|
|
2046
|
+
* @throws if the ENSIndexer response breaks required invariants
|
|
2047
|
+
*/
|
|
2048
|
+
async indexingStatus() {
|
|
2049
|
+
const url = new URL(`/api/indexing-status`, this.options.url);
|
|
2050
|
+
const response = await fetch(url);
|
|
2051
|
+
let responseData;
|
|
2052
|
+
try {
|
|
2053
|
+
responseData = await response.json();
|
|
2054
|
+
} catch {
|
|
2055
|
+
throw new Error("Malformed response data: invalid JSON");
|
|
2056
|
+
}
|
|
2057
|
+
if (!response.ok) {
|
|
2058
|
+
let errorResponse;
|
|
2059
|
+
try {
|
|
2060
|
+
errorResponse = deserializeErrorResponse(responseData);
|
|
2061
|
+
} catch {
|
|
2062
|
+
}
|
|
2063
|
+
if (typeof errorResponse !== "undefined") {
|
|
2064
|
+
throw new Error(`Fetching ENSIndexer Indexing Status Failed: ${errorResponse.message}`);
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2067
|
+
return deserializeEnsIndexerIndexingStatusResponse(
|
|
2068
|
+
responseData
|
|
2069
|
+
);
|
|
2070
|
+
}
|
|
2071
|
+
};
|
|
2072
|
+
|
|
2073
|
+
// src/ensindexer/config/compatibility.ts
|
|
2074
|
+
function validateEnsIndexerPublicConfigCompatibility(configA, configB) {
|
|
2075
|
+
if (configA.indexedChainIds.symmetricDifference(configB.indexedChainIds).size > 0) {
|
|
2076
|
+
throw new Error(
|
|
2077
|
+
[
|
|
2078
|
+
`'indexedChainIds' must be compatible.`,
|
|
2079
|
+
`Stored Config 'indexedChainIds': '${Array.from(configA.indexedChainIds).join(", ")}'.`,
|
|
2080
|
+
`Current Config 'indexedChainIds': '${Array.from(configB.indexedChainIds).join(", ")}'.`
|
|
2081
|
+
].join(" ")
|
|
2082
|
+
);
|
|
2083
|
+
}
|
|
2084
|
+
if (configA.isSubgraphCompatible !== configB.isSubgraphCompatible) {
|
|
2085
|
+
throw new Error(
|
|
2086
|
+
[
|
|
2087
|
+
`'isSubgraphCompatible' flag must be compatible.`,
|
|
2088
|
+
`Stored Config 'isSubgraphCompatible' flag: '${configA.isSubgraphCompatible}'.`,
|
|
2089
|
+
`Current Config 'isSubgraphCompatible' flag: '${configB.isSubgraphCompatible}'.`
|
|
2090
|
+
].join(" ")
|
|
2091
|
+
);
|
|
2092
|
+
}
|
|
2093
|
+
if (configA.namespace !== configB.namespace) {
|
|
2094
|
+
throw new Error(
|
|
2095
|
+
[
|
|
2096
|
+
`'namespace' must be compatible.`,
|
|
2097
|
+
`Stored Config 'namespace': '${configA.namespace}'.`,
|
|
2098
|
+
`Current Config 'namespace': '${configB.namespace}'.`
|
|
2099
|
+
].join(" ")
|
|
2100
|
+
);
|
|
2101
|
+
}
|
|
2102
|
+
if (configA.labelSet.labelSetId !== configB.labelSet.labelSetId) {
|
|
2103
|
+
throw new Error(
|
|
2104
|
+
[
|
|
2105
|
+
`'labelSet.labelSetId' must be compatible.`,
|
|
2106
|
+
`Stored Config 'labelSet.labelSetId': '${configA.labelSet.labelSetId}'.`,
|
|
2107
|
+
`Current Config 'labelSet.labelSetId': '${configB.labelSet.labelSetId}'.`
|
|
2108
|
+
].join(" ")
|
|
2109
|
+
);
|
|
2110
|
+
}
|
|
2111
|
+
if (configA.labelSet.labelSetVersion !== configB.labelSet.labelSetVersion) {
|
|
2112
|
+
throw new Error(
|
|
2113
|
+
[
|
|
2114
|
+
`'labelSet.labelSetVersion' must be compatible.`,
|
|
2115
|
+
`Stored Config 'labelSet.labelSetVersion': '${configA.labelSet.labelSetVersion}'.`,
|
|
2116
|
+
`Current Config 'labelSet.labelSetVersion': '${configB.labelSet.labelSetVersion}'.`
|
|
2117
|
+
].join(" ")
|
|
2118
|
+
);
|
|
2119
|
+
}
|
|
2120
|
+
const configAPluginsSet = new Set(configA.plugins);
|
|
2121
|
+
const configBPluginsSet = new Set(configB.plugins);
|
|
2122
|
+
if (configAPluginsSet.symmetricDifference(configBPluginsSet).size > 0) {
|
|
2123
|
+
throw new Error(
|
|
2124
|
+
[
|
|
2125
|
+
`'plugins' must be compatible.`,
|
|
2126
|
+
`Stored Config 'plugins': '${configA.plugins.join(", ")}'.`,
|
|
2127
|
+
`Current Config 'plugins': '${configB.plugins.join(", ")}'.`
|
|
2128
|
+
].join(" ")
|
|
2129
|
+
);
|
|
2130
|
+
}
|
|
2131
|
+
}
|
|
2132
|
+
|
|
2133
|
+
// src/ensindexer/config/label-utils.ts
|
|
2134
|
+
var import_viem3 = require("viem");
|
|
2135
|
+
function labelHashToBytes(labelHash) {
|
|
2136
|
+
try {
|
|
2137
|
+
if (labelHash.length !== 66) {
|
|
2138
|
+
throw new Error(`Invalid labelHash length ${labelHash.length} characters (expected 66)`);
|
|
2139
|
+
}
|
|
2140
|
+
if (labelHash !== labelHash.toLowerCase()) {
|
|
2141
|
+
throw new Error("Labelhash must be in lowercase");
|
|
2142
|
+
}
|
|
2143
|
+
if (!labelHash.startsWith("0x")) {
|
|
2144
|
+
throw new Error("Labelhash must be 0x-prefixed");
|
|
2145
|
+
}
|
|
2146
|
+
const bytes = (0, import_viem3.hexToBytes)(labelHash);
|
|
2147
|
+
if (bytes.length !== 32) {
|
|
2148
|
+
throw new Error(`Invalid labelHash length ${bytes.length} bytes (expected 32)`);
|
|
2149
|
+
}
|
|
2150
|
+
return bytes;
|
|
2151
|
+
} catch (e) {
|
|
2152
|
+
if (e instanceof Error) {
|
|
2153
|
+
throw e;
|
|
2154
|
+
}
|
|
2155
|
+
throw new Error("Invalid hex format");
|
|
2156
|
+
}
|
|
2157
|
+
}
|
|
2158
|
+
|
|
2159
|
+
// src/ensindexer/config/parsing.ts
|
|
2160
|
+
function parseNonNegativeInteger(maybeNumber) {
|
|
2161
|
+
const trimmed = maybeNumber.trim();
|
|
2162
|
+
if (!trimmed) {
|
|
2163
|
+
throw new Error("Input cannot be empty");
|
|
2164
|
+
}
|
|
2165
|
+
if (trimmed === "-0") {
|
|
2166
|
+
throw new Error("Negative zero is not a valid non-negative integer");
|
|
2167
|
+
}
|
|
2168
|
+
const num = Number(maybeNumber);
|
|
2169
|
+
if (Number.isNaN(num)) {
|
|
2170
|
+
throw new Error(`"${maybeNumber}" is not a valid number`);
|
|
2171
|
+
}
|
|
2172
|
+
if (!Number.isFinite(num)) {
|
|
2173
|
+
throw new Error(`"${maybeNumber}" is not a finite number`);
|
|
2174
|
+
}
|
|
2175
|
+
if (!Number.isInteger(num)) {
|
|
2176
|
+
throw new Error(`"${maybeNumber}" is not an integer`);
|
|
2177
|
+
}
|
|
2178
|
+
if (num < 0) {
|
|
2179
|
+
throw new Error(`"${maybeNumber}" is not a non-negative integer`);
|
|
2180
|
+
}
|
|
2181
|
+
return num;
|
|
2182
|
+
}
|
|
2183
|
+
|
|
2184
|
+
// src/ensindexer/config/validate/ensindexer-public-config.ts
|
|
2185
|
+
var import_v421 = require("zod/v4");
|
|
2186
|
+
function validateEnsIndexerPublicConfig(unvalidatedConfig) {
|
|
2187
|
+
const schema = makeEnsIndexerPublicConfigSchema();
|
|
2188
|
+
const result = schema.safeParse(unvalidatedConfig);
|
|
2189
|
+
if (!result.success) {
|
|
2190
|
+
throw new Error(`Invalid ENSIndexerPublicConfig: ${(0, import_v421.prettifyError)(result.error)}`);
|
|
2191
|
+
}
|
|
2192
|
+
return result.data;
|
|
2193
|
+
}
|
|
2194
|
+
|
|
2195
|
+
// src/ensindexer/config/validate/ensindexer-version-info.ts
|
|
2196
|
+
var import_v422 = require("zod/v4");
|
|
2197
|
+
function validateEnsIndexerVersionInfo(unvalidatedVersionInfo) {
|
|
2198
|
+
const schema = makeEnsIndexerVersionInfoSchema();
|
|
2199
|
+
const result = schema.safeParse(unvalidatedVersionInfo);
|
|
2200
|
+
if (!result.success) {
|
|
2201
|
+
throw new Error(`Invalid EnsIndexerVersionInfo: ${(0, import_v422.prettifyError)(result.error)}`);
|
|
2202
|
+
}
|
|
2203
|
+
return result.data;
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2206
|
+
// src/ensnode/api/indexing-status/deserialize.ts
|
|
2207
|
+
var import_v427 = require("zod/v4");
|
|
2208
|
+
|
|
2209
|
+
// src/stack-info/deserialize/ensnode-stack-info.ts
|
|
2210
|
+
var import_v425 = require("zod/v4");
|
|
2211
|
+
|
|
2212
|
+
// src/stack-info/zod-schemas/ensnode-stack-info.ts
|
|
2213
|
+
var import_v424 = require("zod/v4");
|
|
2214
|
+
|
|
2215
|
+
// src/ensdb/zod-schemas/config.ts
|
|
2216
|
+
var import_v423 = require("zod/v4");
|
|
2217
|
+
var makeEnsDbVersionInfoSchema = (valueLabel) => {
|
|
2218
|
+
const label = valueLabel ?? "EnsDbVersionInfo";
|
|
2219
|
+
return import_v423.z.object({
|
|
2220
|
+
postgresql: import_v423.z.string().nonempty(`${label}.postgresql must be a non-empty string`).describe("Version of the PostgreSQL server hosting the ENSDb instance.")
|
|
2221
|
+
}).describe(label);
|
|
2222
|
+
};
|
|
2223
|
+
var makeEnsDbPublicConfigSchema = (valueLabel) => {
|
|
2224
|
+
const label = valueLabel ?? "EnsDbPublicConfig";
|
|
2225
|
+
return import_v423.z.object({
|
|
2226
|
+
versionInfo: makeEnsDbVersionInfoSchema(`${label}.versionInfo`)
|
|
2227
|
+
}).describe(label);
|
|
2228
|
+
};
|
|
2229
|
+
|
|
2230
|
+
// src/stack-info/zod-schemas/ensnode-stack-info.ts
|
|
2231
|
+
function makeSerializedEnsNodeStackInfoSchema(valueLabel) {
|
|
2232
|
+
const label = valueLabel ?? "ENSNodeStackInfo";
|
|
2233
|
+
return import_v424.z.object({
|
|
2234
|
+
ensApi: makeSerializedEnsApiPublicConfigSchema(`${label}.ensApi`),
|
|
2235
|
+
ensDb: makeEnsDbPublicConfigSchema(`${label}.ensDb`),
|
|
2236
|
+
ensIndexer: makeSerializedEnsIndexerPublicConfigSchema(`${label}.ensIndexer`),
|
|
2237
|
+
ensRainbow: makeEnsRainbowPublicConfigSchema(`${label}.ensRainbow`).optional()
|
|
2238
|
+
});
|
|
2239
|
+
}
|
|
2240
|
+
function makeEnsNodeStackInfoSchema(valueLabel) {
|
|
2241
|
+
const label = valueLabel ?? "ENSNodeStackInfo";
|
|
2242
|
+
return import_v424.z.object({
|
|
2243
|
+
ensApi: makeEnsApiPublicConfigSchema(`${label}.ensApi`),
|
|
2244
|
+
ensDb: makeEnsDbPublicConfigSchema(`${label}.ensDb`),
|
|
2245
|
+
ensIndexer: makeEnsIndexerPublicConfigSchema(`${label}.ensIndexer`),
|
|
2246
|
+
ensRainbow: makeEnsRainbowPublicConfigSchema(`${label}.ensRainbow`).optional()
|
|
2247
|
+
});
|
|
2248
|
+
}
|
|
2249
|
+
|
|
2250
|
+
// src/stack-info/deserialize/ensnode-stack-info.ts
|
|
2251
|
+
function buildUnvalidatedEnsNodeStackInfo(serializedStackInfo) {
|
|
2252
|
+
const { ensApi, ensIndexer, ...rest } = serializedStackInfo;
|
|
2253
|
+
return {
|
|
2254
|
+
...rest,
|
|
2255
|
+
ensApi: buildUnvalidatedEnsApiPublicConfig(ensApi),
|
|
2256
|
+
ensIndexer: buildUnvalidatedEnsIndexerPublicConfig(ensIndexer)
|
|
2257
|
+
};
|
|
2258
|
+
}
|
|
2259
|
+
function deserializeEnsNodeStackInfo(maybeStackInfo, valueLabel) {
|
|
2260
|
+
const parsed = makeSerializedEnsNodeStackInfoSchema(valueLabel).transform(buildUnvalidatedEnsNodeStackInfo).pipe(makeEnsNodeStackInfoSchema(valueLabel)).safeParse(maybeStackInfo);
|
|
2261
|
+
if (parsed.error) {
|
|
2262
|
+
throw new Error(`Cannot deserialize EnsNodeStackInfo:
|
|
2263
|
+
${(0, import_v425.prettifyError)(parsed.error)}
|
|
2264
|
+
`);
|
|
2265
|
+
}
|
|
2266
|
+
return parsed.data;
|
|
2267
|
+
}
|
|
2268
|
+
|
|
2269
|
+
// src/ensnode/api/indexing-status/response.ts
|
|
2270
|
+
var EnsApiIndexingStatusResponseCodes = {
|
|
2271
|
+
/**
|
|
2272
|
+
* Represents that the indexing status is available.
|
|
2273
|
+
*/
|
|
2274
|
+
Ok: "ok",
|
|
2275
|
+
/**
|
|
2276
|
+
* Represents that the indexing status is unavailable.
|
|
2277
|
+
*/
|
|
2278
|
+
Error: "error"
|
|
2279
|
+
};
|
|
2280
|
+
var IndexingStatusResponseCodes = EnsApiIndexingStatusResponseCodes;
|
|
2281
|
+
|
|
2282
|
+
// src/ensnode/api/indexing-status/zod-schemas.ts
|
|
2283
|
+
var import_v426 = require("zod/v4");
|
|
2284
|
+
var makeEnsApiIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => import_v426.z.strictObject({
|
|
2285
|
+
responseCode: import_v426.z.literal(EnsApiIndexingStatusResponseCodes.Ok),
|
|
2286
|
+
realtimeProjection: makeRealtimeIndexingStatusProjectionSchema(valueLabel),
|
|
2287
|
+
stackInfo: makeEnsNodeStackInfoSchema(valueLabel)
|
|
2288
|
+
});
|
|
2289
|
+
var makeEnsApiIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => import_v426.z.strictObject({
|
|
2290
|
+
responseCode: import_v426.z.literal(EnsApiIndexingStatusResponseCodes.Error)
|
|
2291
|
+
});
|
|
2292
|
+
var makeEnsApiIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => import_v426.z.discriminatedUnion("responseCode", [
|
|
2293
|
+
makeEnsApiIndexingStatusResponseOkSchema(valueLabel),
|
|
2294
|
+
makeEnsApiIndexingStatusResponseErrorSchema(valueLabel)
|
|
2295
|
+
]);
|
|
2296
|
+
var makeSerializedEnsApiIndexingStatusResponseOkSchema = (valueLabel = "Serialized Indexing Status Response OK") => import_v426.z.object({
|
|
2297
|
+
responseCode: import_v426.z.literal(EnsApiIndexingStatusResponseCodes.Ok),
|
|
2298
|
+
realtimeProjection: makeSerializedRealtimeIndexingStatusProjectionSchema(valueLabel),
|
|
2299
|
+
stackInfo: makeSerializedEnsNodeStackInfoSchema(valueLabel)
|
|
2300
|
+
});
|
|
2301
|
+
var makeSerializedEnsApiIndexingStatusResponseSchema = (valueLabel = "Serialized Indexing Status Response") => import_v426.z.discriminatedUnion("responseCode", [
|
|
2302
|
+
makeSerializedEnsApiIndexingStatusResponseOkSchema(valueLabel),
|
|
2303
|
+
makeEnsApiIndexingStatusResponseErrorSchema(valueLabel)
|
|
2304
|
+
]);
|
|
2305
|
+
|
|
2306
|
+
// src/ensnode/api/indexing-status/deserialize.ts
|
|
2307
|
+
function buildUnvalidatedEnsApiIndexingStatusResponse(serializedResponse) {
|
|
2308
|
+
if (serializedResponse.responseCode !== EnsApiIndexingStatusResponseCodes.Ok) {
|
|
2309
|
+
return serializedResponse;
|
|
2310
|
+
}
|
|
2311
|
+
const { realtimeProjection, stackInfo, ...rest } = serializedResponse;
|
|
2312
|
+
return {
|
|
2313
|
+
realtimeProjection: buildUnvalidatedRealtimeIndexingStatusProjection(realtimeProjection),
|
|
2314
|
+
stackInfo: buildUnvalidatedEnsNodeStackInfo(stackInfo),
|
|
2315
|
+
...rest
|
|
2316
|
+
};
|
|
2317
|
+
}
|
|
2318
|
+
function deserializeEnsApiIndexingStatusResponse(maybeResponse) {
|
|
2319
|
+
const parsed = makeSerializedEnsApiIndexingStatusResponseSchema().transform(buildUnvalidatedEnsApiIndexingStatusResponse).pipe(makeEnsApiIndexingStatusResponseSchema()).safeParse(maybeResponse);
|
|
2320
|
+
if (parsed.error) {
|
|
2321
|
+
throw new Error(
|
|
2322
|
+
`Cannot deserialize EnsApiIndexingStatusResponse:
|
|
2323
|
+
${(0, import_v427.prettifyError)(parsed.error)}
|
|
2324
|
+
`
|
|
2325
|
+
);
|
|
2326
|
+
}
|
|
2327
|
+
return parsed.data;
|
|
2328
|
+
}
|
|
2329
|
+
var deserializeIndexingStatusResponse = deserializeEnsApiIndexingStatusResponse;
|
|
2330
|
+
|
|
2331
|
+
// src/stack-info/serialize/ensnode-stack-info.ts
|
|
2332
|
+
function serializeEnsNodeStackInfo(stackInfo) {
|
|
2333
|
+
return {
|
|
2334
|
+
ensApi: serializeEnsApiPublicConfig(stackInfo.ensApi),
|
|
2335
|
+
ensDb: stackInfo.ensDb,
|
|
2336
|
+
ensIndexer: serializeEnsIndexerPublicConfig(stackInfo.ensIndexer),
|
|
2337
|
+
ensRainbow: stackInfo.ensRainbow
|
|
2338
|
+
};
|
|
2339
|
+
}
|
|
2340
|
+
|
|
2341
|
+
// src/ensnode/api/indexing-status/serialize.ts
|
|
2342
|
+
function serializeEnsApiIndexingStatusResponse(response) {
|
|
2343
|
+
switch (response.responseCode) {
|
|
2344
|
+
case EnsApiIndexingStatusResponseCodes.Ok:
|
|
2345
|
+
return {
|
|
2346
|
+
responseCode: response.responseCode,
|
|
2347
|
+
realtimeProjection: serializeRealtimeIndexingStatusProjection(response.realtimeProjection),
|
|
2348
|
+
stackInfo: serializeEnsNodeStackInfo(response.stackInfo)
|
|
2349
|
+
};
|
|
2350
|
+
case EnsApiIndexingStatusResponseCodes.Error:
|
|
2351
|
+
return response;
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
var serializeIndexingStatusResponse = serializeEnsApiIndexingStatusResponse;
|
|
2355
|
+
|
|
2356
|
+
// src/ensnode/api/name-tokens/deserialize.ts
|
|
2357
|
+
var import_v432 = require("zod/v4");
|
|
2358
|
+
|
|
2359
|
+
// src/ensnode/api/name-tokens/zod-schemas.ts
|
|
2360
|
+
var import_enssdk5 = require("enssdk");
|
|
2361
|
+
var import_v431 = require("zod/v4");
|
|
2362
|
+
|
|
2363
|
+
// src/tokenscope/name-token.ts
|
|
2364
|
+
var import_enssdk4 = require("enssdk");
|
|
2365
|
+
var import_viem7 = require("viem");
|
|
2366
|
+
var import_datasources4 = require("@ensnode/datasources");
|
|
2367
|
+
|
|
2368
|
+
// src/shared/account-id.ts
|
|
2369
|
+
var import_viem4 = require("viem");
|
|
2370
|
+
var accountIdEqual = (a, b) => {
|
|
2371
|
+
return a.chainId === b.chainId && (0, import_viem4.isAddressEqual)(a.address, b.address);
|
|
2372
|
+
};
|
|
2373
|
+
|
|
2374
|
+
// src/shared/datasource-contract.ts
|
|
2375
|
+
var import_datasources3 = require("@ensnode/datasources");
|
|
2376
|
+
var maybeGetDatasourceContract = (namespaceId, datasourceName, contractName) => {
|
|
2377
|
+
const datasource = (0, import_datasources3.maybeGetDatasource)(namespaceId, datasourceName);
|
|
2378
|
+
if (!datasource) return void 0;
|
|
2379
|
+
const address = datasource.contracts[contractName]?.address;
|
|
2380
|
+
if (address === void 0 || Array.isArray(address)) return void 0;
|
|
2381
|
+
return {
|
|
2382
|
+
chainId: datasource.chain.id,
|
|
2383
|
+
address
|
|
2384
|
+
};
|
|
2385
|
+
};
|
|
2386
|
+
var getDatasourceContract = (namespaceId, datasourceName, contractName) => {
|
|
2387
|
+
const contract = maybeGetDatasourceContract(namespaceId, datasourceName, contractName);
|
|
2388
|
+
if (!contract) {
|
|
2389
|
+
throw new Error(
|
|
2390
|
+
`Expected contract not found for ${namespaceId} ${datasourceName} ${contractName}`
|
|
2391
|
+
);
|
|
2392
|
+
}
|
|
2393
|
+
return contract;
|
|
2394
|
+
};
|
|
2395
|
+
var makeContractMatcher = (namespace, b) => (datasourceName, contractName) => {
|
|
2396
|
+
const a = maybeGetDatasourceContract(namespace, datasourceName, contractName);
|
|
2397
|
+
return a && accountIdEqual(a, b);
|
|
2398
|
+
};
|
|
2399
|
+
|
|
2400
|
+
// src/tokenscope/assets.ts
|
|
2401
|
+
var import_enssdk3 = require("enssdk");
|
|
2402
|
+
var import_viem6 = require("viem");
|
|
2403
|
+
var import_v429 = require("zod/v4");
|
|
2404
|
+
|
|
2405
|
+
// src/tokenscope/zod-schemas.ts
|
|
2406
|
+
var import_caip2 = require("caip");
|
|
2407
|
+
var import_enssdk2 = require("enssdk");
|
|
2408
|
+
var import_viem5 = require("viem");
|
|
2409
|
+
var import_v428 = require("zod/v4");
|
|
2410
|
+
var tokenIdSchemaSerializable = import_v428.z.string();
|
|
2411
|
+
var tokenIdSchemaNative = import_v428.z.preprocess(
|
|
2412
|
+
(v) => typeof v === "string" ? BigInt(v) : v,
|
|
2413
|
+
import_v428.z.bigint().positive()
|
|
2414
|
+
);
|
|
2415
|
+
function makeTokenIdSchema(_valueLabel = "Token ID Schema", serializable = false) {
|
|
2416
|
+
if (serializable) {
|
|
2417
|
+
return tokenIdSchemaSerializable;
|
|
2418
|
+
} else {
|
|
2419
|
+
return tokenIdSchemaNative;
|
|
2420
|
+
}
|
|
2421
|
+
}
|
|
2422
|
+
var makeAssetIdSchema = (valueLabel = "Asset ID Schema", serializable) => {
|
|
2423
|
+
return import_v428.z.object({
|
|
2424
|
+
assetNamespace: import_v428.z.enum(import_enssdk2.AssetNamespaces),
|
|
2425
|
+
contract: makeAccountIdSchema(valueLabel),
|
|
2426
|
+
tokenId: makeTokenIdSchema(valueLabel, serializable ?? false)
|
|
2427
|
+
});
|
|
2428
|
+
};
|
|
2429
|
+
var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") => import_v428.z.preprocess((v) => {
|
|
2430
|
+
if (typeof v === "string") {
|
|
2431
|
+
const result = new import_caip2.AssetId(v);
|
|
2432
|
+
return {
|
|
2433
|
+
assetNamespace: result.assetName.namespace,
|
|
2434
|
+
contract: {
|
|
2435
|
+
chainId: Number(result.chainId.reference),
|
|
2436
|
+
address: result.assetName.reference
|
|
2437
|
+
},
|
|
2438
|
+
tokenId: result.tokenId
|
|
2439
|
+
};
|
|
2440
|
+
}
|
|
2441
|
+
return v;
|
|
2442
|
+
}, makeAssetIdSchema(valueLabel));
|
|
2443
|
+
function invariant_nameTokenOwnershipHasNonZeroAddressOwner(ctx) {
|
|
2444
|
+
const ownership = ctx.value;
|
|
2445
|
+
if (ctx.value.owner.address === import_viem5.zeroAddress) {
|
|
2446
|
+
ctx.issues.push({
|
|
2447
|
+
code: "custom",
|
|
2448
|
+
input: ctx.value,
|
|
2449
|
+
message: `Name Token Ownership with '${ownership.ownershipType}' must have 'address' other than the zero address.`
|
|
2450
|
+
});
|
|
2451
|
+
}
|
|
2452
|
+
}
|
|
2453
|
+
var makeNameTokenOwnershipNameWrapperSchema = (valueLabel = "Name Token Ownership NameWrapper") => import_v428.z.object({
|
|
2454
|
+
ownershipType: import_v428.z.literal(NameTokenOwnershipTypes.NameWrapper),
|
|
2455
|
+
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2456
|
+
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2457
|
+
var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") => import_v428.z.object({
|
|
2458
|
+
ownershipType: import_v428.z.literal(NameTokenOwnershipTypes.FullyOnchain),
|
|
2459
|
+
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2460
|
+
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2461
|
+
var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") => import_v428.z.object({
|
|
2462
|
+
ownershipType: import_v428.z.literal(NameTokenOwnershipTypes.Burned),
|
|
2463
|
+
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2464
|
+
}).check(invariant_nameTokenOwnershipHasZeroAddressOwner);
|
|
2465
|
+
var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") => import_v428.z.object({
|
|
2466
|
+
ownershipType: import_v428.z.literal(NameTokenOwnershipTypes.Unknown),
|
|
2467
|
+
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2468
|
+
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2469
|
+
function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
|
|
2384
2470
|
const ownership = ctx.value;
|
|
2385
|
-
if (ctx.value.owner.address !==
|
|
2471
|
+
if (ctx.value.owner.address !== import_viem5.zeroAddress) {
|
|
2386
2472
|
ctx.issues.push({
|
|
2387
2473
|
code: "custom",
|
|
2388
2474
|
input: ctx.value,
|
|
@@ -2390,16 +2476,16 @@ function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
|
|
|
2390
2476
|
});
|
|
2391
2477
|
}
|
|
2392
2478
|
}
|
|
2393
|
-
var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") =>
|
|
2479
|
+
var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") => import_v428.z.discriminatedUnion("ownershipType", [
|
|
2394
2480
|
makeNameTokenOwnershipNameWrapperSchema(valueLabel),
|
|
2395
2481
|
makeNameTokenOwnershipFullyOnchainSchema(valueLabel),
|
|
2396
2482
|
makeNameTokenOwnershipBurnedSchema(valueLabel),
|
|
2397
2483
|
makeNameTokenOwnershipUnknownSchema(valueLabel)
|
|
2398
2484
|
]);
|
|
2399
|
-
var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) =>
|
|
2485
|
+
var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) => import_v428.z.object({
|
|
2400
2486
|
token: makeAssetIdSchema(`${valueLabel}.token`, serializable),
|
|
2401
2487
|
ownership: makeNameTokenOwnershipSchema(`${valueLabel}.ownership`),
|
|
2402
|
-
mintStatus:
|
|
2488
|
+
mintStatus: import_v428.z.enum(NFTMintStatuses)
|
|
2403
2489
|
});
|
|
2404
2490
|
|
|
2405
2491
|
// src/tokenscope/assets.ts
|
|
@@ -2407,7 +2493,7 @@ function serializeAssetId(assetId) {
|
|
|
2407
2493
|
return {
|
|
2408
2494
|
assetNamespace: assetId.assetNamespace,
|
|
2409
2495
|
contract: assetId.contract,
|
|
2410
|
-
tokenId:
|
|
2496
|
+
tokenId: assetId.tokenId.toString()
|
|
2411
2497
|
};
|
|
2412
2498
|
}
|
|
2413
2499
|
function deserializeAssetId(maybeAssetId, valueLabel) {
|
|
@@ -2415,7 +2501,7 @@ function deserializeAssetId(maybeAssetId, valueLabel) {
|
|
|
2415
2501
|
const parsed = schema.safeParse(maybeAssetId);
|
|
2416
2502
|
if (parsed.error) {
|
|
2417
2503
|
throw new RangeError(`Cannot deserialize AssetId:
|
|
2418
|
-
${(0,
|
|
2504
|
+
${(0, import_v429.prettifyError)(parsed.error)}
|
|
2419
2505
|
`);
|
|
2420
2506
|
}
|
|
2421
2507
|
return parsed.data;
|
|
@@ -2425,7 +2511,7 @@ function parseAssetId(maybeAssetId, valueLabel) {
|
|
|
2425
2511
|
const parsed = schema.safeParse(maybeAssetId);
|
|
2426
2512
|
if (parsed.error) {
|
|
2427
2513
|
throw new RangeError(`Cannot parse AssetId:
|
|
2428
|
-
${(0,
|
|
2514
|
+
${(0, import_v429.prettifyError)(parsed.error)}
|
|
2429
2515
|
`);
|
|
2430
2516
|
}
|
|
2431
2517
|
return parsed.data;
|
|
@@ -2448,7 +2534,7 @@ var NFTMintStatuses = {
|
|
|
2448
2534
|
Burned: "burned"
|
|
2449
2535
|
};
|
|
2450
2536
|
var formatNFTTransferEventMetadata = (metadata) => {
|
|
2451
|
-
const assetIdString =
|
|
2537
|
+
const assetIdString = (0, import_enssdk3.stringifyAssetId)(metadata.nft);
|
|
2452
2538
|
return [
|
|
2453
2539
|
`Event: ${metadata.eventHandlerName}`,
|
|
2454
2540
|
`Chain ID: ${metadata.chainId}`,
|
|
@@ -2560,11 +2646,11 @@ var NFTTransferTypes = {
|
|
|
2560
2646
|
};
|
|
2561
2647
|
var getNFTTransferType = (from, to, allowMintedRemint, metadata, currentlyIndexedOwner) => {
|
|
2562
2648
|
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,
|
|
2649
|
+
const isIndexedAsMinted = isIndexed && !(0, import_viem6.isAddressEqual)(currentlyIndexedOwner, import_viem6.zeroAddress);
|
|
2650
|
+
const isMint = (0, import_viem6.isAddressEqual)(from, import_viem6.zeroAddress);
|
|
2651
|
+
const isBurn = (0, import_viem6.isAddressEqual)(to, import_viem6.zeroAddress);
|
|
2652
|
+
const isSelfTransfer = (0, import_viem6.isAddressEqual)(from, to);
|
|
2653
|
+
if (isIndexed && !(0, import_viem6.isAddressEqual)(currentlyIndexedOwner, from)) {
|
|
2568
2654
|
if (isMint && allowMintedRemint) {
|
|
2569
2655
|
} else {
|
|
2570
2656
|
throw new Error(
|
|
@@ -2677,12 +2763,12 @@ function serializeNameToken(nameToken) {
|
|
|
2677
2763
|
function getNameWrapperAccounts(namespaceId) {
|
|
2678
2764
|
const ethnamesNameWrapperAccount = getDatasourceContract(
|
|
2679
2765
|
namespaceId,
|
|
2680
|
-
|
|
2766
|
+
import_datasources4.DatasourceNames.ENSRoot,
|
|
2681
2767
|
"NameWrapper"
|
|
2682
2768
|
);
|
|
2683
2769
|
const lineanamesNameWrapperAccount = maybeGetDatasourceContract(
|
|
2684
2770
|
namespaceId,
|
|
2685
|
-
|
|
2771
|
+
import_datasources4.DatasourceNames.Lineanames,
|
|
2686
2772
|
"NameWrapper"
|
|
2687
2773
|
);
|
|
2688
2774
|
const nameWrapperAccounts = [
|
|
@@ -2705,13 +2791,14 @@ function getNameTokenOwnership(namespaceId, name, owner) {
|
|
|
2705
2791
|
owner
|
|
2706
2792
|
};
|
|
2707
2793
|
}
|
|
2708
|
-
if ((0,
|
|
2794
|
+
if ((0, import_viem7.isAddressEqual)(owner.address, import_viem7.zeroAddress)) {
|
|
2709
2795
|
return {
|
|
2710
2796
|
ownershipType: NameTokenOwnershipTypes.Burned,
|
|
2711
2797
|
owner
|
|
2712
2798
|
};
|
|
2713
2799
|
}
|
|
2714
|
-
const parentName =
|
|
2800
|
+
const parentName = (0, import_enssdk4.getParentInterpretedName)(name);
|
|
2801
|
+
if (parentName === null) throw new Error(`Invariant: '${name}' has no parent Name.`);
|
|
2715
2802
|
if (parentName === "eth") {
|
|
2716
2803
|
return {
|
|
2717
2804
|
ownershipType: NameTokenOwnershipTypes.FullyOnchain,
|
|
@@ -2724,14 +2811,14 @@ function getNameTokenOwnership(namespaceId, name, owner) {
|
|
|
2724
2811
|
};
|
|
2725
2812
|
}
|
|
2726
2813
|
|
|
2727
|
-
// src/
|
|
2728
|
-
var
|
|
2729
|
-
var
|
|
2730
|
-
message:
|
|
2731
|
-
details:
|
|
2814
|
+
// src/ensnode/api/shared/errors/zod-schemas.ts
|
|
2815
|
+
var import_v430 = require("zod/v4");
|
|
2816
|
+
var makeErrorResponseSchema = () => import_v430.z.object({
|
|
2817
|
+
message: import_v430.z.string(),
|
|
2818
|
+
details: import_v430.z.optional(import_v430.z.unknown())
|
|
2732
2819
|
});
|
|
2733
2820
|
|
|
2734
|
-
// src/
|
|
2821
|
+
// src/ensnode/api/name-tokens/response.ts
|
|
2735
2822
|
var NameTokensResponseCodes = {
|
|
2736
2823
|
/**
|
|
2737
2824
|
* Represents a response when Name Tokens API can respond with requested data.
|
|
@@ -2766,16 +2853,16 @@ var NameTokensResponseErrorCodes = {
|
|
|
2766
2853
|
IndexingStatusUnsupported: "unsupported-indexing-status"
|
|
2767
2854
|
};
|
|
2768
2855
|
|
|
2769
|
-
// src/
|
|
2770
|
-
var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) =>
|
|
2856
|
+
// src/ensnode/api/name-tokens/zod-schemas.ts
|
|
2857
|
+
var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) => import_v431.z.object({
|
|
2771
2858
|
domainId: makeNodeSchema(`${valueLabel}.domainId`),
|
|
2772
2859
|
name: makeReinterpretedNameSchema(valueLabel),
|
|
2773
|
-
tokens:
|
|
2860
|
+
tokens: import_v431.z.array(makeNameTokenSchema(`${valueLabel}.tokens`, serializable)).nonempty(),
|
|
2774
2861
|
expiresAt: makeUnixTimestampSchema(`${valueLabel}.expiresAt`),
|
|
2775
2862
|
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
|
|
2776
2863
|
}).check(function invariant_nameIsAssociatedWithDomainId(ctx) {
|
|
2777
2864
|
const { name, domainId } = ctx.value;
|
|
2778
|
-
if ((0,
|
|
2865
|
+
if ((0, import_enssdk5.namehashInterpretedName)(name) !== domainId) {
|
|
2779
2866
|
ctx.issues.push({
|
|
2780
2867
|
code: "custom",
|
|
2781
2868
|
input: ctx.value,
|
|
@@ -2812,51 +2899,51 @@ var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", seria
|
|
|
2812
2899
|
});
|
|
2813
2900
|
}
|
|
2814
2901
|
});
|
|
2815
|
-
var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) =>
|
|
2816
|
-
responseCode:
|
|
2902
|
+
var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) => import_v431.z.strictObject({
|
|
2903
|
+
responseCode: import_v431.z.literal(NameTokensResponseCodes.Ok),
|
|
2817
2904
|
registeredNameTokens: makeRegisteredNameTokenSchema(`${valueLabel}.nameTokens`, serializable)
|
|
2818
2905
|
});
|
|
2819
|
-
var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") =>
|
|
2820
|
-
responseCode:
|
|
2821
|
-
errorCode:
|
|
2822
|
-
error:
|
|
2906
|
+
var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") => import_v431.z.strictObject({
|
|
2907
|
+
responseCode: import_v431.z.literal(NameTokensResponseCodes.Error),
|
|
2908
|
+
errorCode: import_v431.z.literal(NameTokensResponseErrorCodes.NameTokensNotIndexed),
|
|
2909
|
+
error: makeErrorResponseSchema()
|
|
2823
2910
|
});
|
|
2824
|
-
var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") =>
|
|
2825
|
-
responseCode:
|
|
2826
|
-
errorCode:
|
|
2827
|
-
error:
|
|
2911
|
+
var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") => import_v431.z.strictObject({
|
|
2912
|
+
responseCode: import_v431.z.literal(NameTokensResponseCodes.Error),
|
|
2913
|
+
errorCode: import_v431.z.literal(NameTokensResponseErrorCodes.EnsIndexerConfigUnsupported),
|
|
2914
|
+
error: makeErrorResponseSchema()
|
|
2828
2915
|
});
|
|
2829
|
-
var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") =>
|
|
2830
|
-
responseCode:
|
|
2831
|
-
errorCode:
|
|
2832
|
-
error:
|
|
2916
|
+
var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") => import_v431.z.strictObject({
|
|
2917
|
+
responseCode: import_v431.z.literal(NameTokensResponseCodes.Error),
|
|
2918
|
+
errorCode: import_v431.z.literal(NameTokensResponseErrorCodes.IndexingStatusUnsupported),
|
|
2919
|
+
error: makeErrorResponseSchema()
|
|
2833
2920
|
});
|
|
2834
|
-
var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") =>
|
|
2921
|
+
var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") => import_v431.z.discriminatedUnion("errorCode", [
|
|
2835
2922
|
makeNameTokensResponseErrorNameTokensNotIndexedSchema(valueLabel),
|
|
2836
2923
|
makeNameTokensResponseErrorEnsIndexerConfigUnsupported(valueLabel),
|
|
2837
2924
|
makeNameTokensResponseErrorNameIndexingStatusUnsupported(valueLabel)
|
|
2838
2925
|
]);
|
|
2839
2926
|
var makeNameTokensResponseSchema = (valueLabel = "Name Tokens Response", serializable) => {
|
|
2840
|
-
return
|
|
2927
|
+
return import_v431.z.discriminatedUnion("responseCode", [
|
|
2841
2928
|
makeNameTokensResponseOkSchema(valueLabel, serializable ?? false),
|
|
2842
2929
|
makeNameTokensResponseErrorSchema(valueLabel)
|
|
2843
2930
|
]);
|
|
2844
2931
|
};
|
|
2845
2932
|
|
|
2846
|
-
// src/
|
|
2933
|
+
// src/ensnode/api/name-tokens/deserialize.ts
|
|
2847
2934
|
function deserializedNameTokensResponse(maybeResponse) {
|
|
2848
2935
|
const parsed = makeNameTokensResponseSchema("Name Tokens Response", false).safeParse(
|
|
2849
2936
|
maybeResponse
|
|
2850
2937
|
);
|
|
2851
2938
|
if (parsed.error) {
|
|
2852
2939
|
throw new Error(`Cannot deserialize NameTokensResponse:
|
|
2853
|
-
${(0,
|
|
2940
|
+
${(0, import_v432.prettifyError)(parsed.error)}
|
|
2854
2941
|
`);
|
|
2855
2942
|
}
|
|
2856
2943
|
return parsed.data;
|
|
2857
2944
|
}
|
|
2858
2945
|
|
|
2859
|
-
// src/
|
|
2946
|
+
// src/ensnode/api/name-tokens/prerequisites.ts
|
|
2860
2947
|
var nameTokensPrerequisites = Object.freeze({
|
|
2861
2948
|
/**
|
|
2862
2949
|
* Required plugins to enable Name Tokens API routes.
|
|
@@ -2895,7 +2982,7 @@ var nameTokensPrerequisites = Object.freeze({
|
|
|
2895
2982
|
}
|
|
2896
2983
|
});
|
|
2897
2984
|
|
|
2898
|
-
// src/
|
|
2985
|
+
// src/ensnode/api/name-tokens/serialize.ts
|
|
2899
2986
|
function serializeRegisteredNameTokens({
|
|
2900
2987
|
domainId,
|
|
2901
2988
|
name,
|
|
@@ -2923,45 +3010,44 @@ function serializeNameTokensResponse(response) {
|
|
|
2923
3010
|
}
|
|
2924
3011
|
}
|
|
2925
3012
|
|
|
2926
|
-
// src/
|
|
2927
|
-
var
|
|
3013
|
+
// src/ensnode/api/registrar-actions/deserialize.ts
|
|
3014
|
+
var import_v436 = require("zod/v4");
|
|
2928
3015
|
|
|
2929
|
-
// src/
|
|
2930
|
-
var
|
|
2931
|
-
var
|
|
3016
|
+
// src/ensnode/api/registrar-actions/zod-schemas.ts
|
|
3017
|
+
var import_enssdk7 = require("enssdk");
|
|
3018
|
+
var import_v435 = require("zod/v4");
|
|
2932
3019
|
|
|
2933
3020
|
// src/registrars/zod-schemas.ts
|
|
2934
|
-
var
|
|
3021
|
+
var import_v433 = require("zod/v4");
|
|
2935
3022
|
|
|
2936
3023
|
// src/registrars/encoded-referrer.ts
|
|
2937
|
-
var
|
|
3024
|
+
var import_enssdk6 = require("enssdk");
|
|
3025
|
+
var import_viem8 = require("viem");
|
|
2938
3026
|
var ENCODED_REFERRER_BYTE_OFFSET = 12;
|
|
2939
3027
|
var ENCODED_REFERRER_BYTE_LENGTH = 32;
|
|
2940
|
-
var EXPECTED_ENCODED_REFERRER_PADDING = (0,
|
|
3028
|
+
var EXPECTED_ENCODED_REFERRER_PADDING = (0, import_viem8.pad)("0x", {
|
|
2941
3029
|
size: ENCODED_REFERRER_BYTE_OFFSET,
|
|
2942
3030
|
dir: "left"
|
|
2943
3031
|
});
|
|
2944
|
-
var ZERO_ENCODED_REFERRER = (0,
|
|
3032
|
+
var ZERO_ENCODED_REFERRER = (0, import_viem8.pad)("0x", {
|
|
2945
3033
|
size: ENCODED_REFERRER_BYTE_LENGTH,
|
|
2946
3034
|
dir: "left"
|
|
2947
3035
|
});
|
|
2948
3036
|
function buildEncodedReferrer(address) {
|
|
2949
|
-
|
|
2950
|
-
return (0,
|
|
3037
|
+
if (!(0, import_enssdk6.isNormalizedAddress)(address)) throw new Error(`Address '${address}' is not normalized.`);
|
|
3038
|
+
return (0, import_viem8.pad)(address, { size: ENCODED_REFERRER_BYTE_LENGTH, dir: "left" });
|
|
2951
3039
|
}
|
|
2952
3040
|
function decodeEncodedReferrer(encodedReferrer) {
|
|
2953
|
-
if ((0,
|
|
3041
|
+
if ((0, import_viem8.size)(encodedReferrer) !== ENCODED_REFERRER_BYTE_LENGTH) {
|
|
2954
3042
|
throw new Error(
|
|
2955
3043
|
`Encoded referrer value must be represented by ${ENCODED_REFERRER_BYTE_LENGTH} bytes.`
|
|
2956
3044
|
);
|
|
2957
3045
|
}
|
|
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);
|
|
3046
|
+
const padding = (0, import_viem8.slice)(encodedReferrer, 0, ENCODED_REFERRER_BYTE_OFFSET);
|
|
3047
|
+
if (padding !== EXPECTED_ENCODED_REFERRER_PADDING) return import_viem8.zeroAddress;
|
|
3048
|
+
const decodedReferrer = (0, import_viem8.slice)(encodedReferrer, ENCODED_REFERRER_BYTE_OFFSET);
|
|
2963
3049
|
try {
|
|
2964
|
-
return (0,
|
|
3050
|
+
return (0, import_enssdk6.toNormalizedAddress)(decodedReferrer);
|
|
2965
3051
|
} catch {
|
|
2966
3052
|
throw new Error(`Decoded referrer value must be a valid EVM address.`);
|
|
2967
3053
|
}
|
|
@@ -3006,11 +3092,11 @@ function serializeRegistrarAction(registrarAction) {
|
|
|
3006
3092
|
}
|
|
3007
3093
|
|
|
3008
3094
|
// src/registrars/zod-schemas.ts
|
|
3009
|
-
var makeSubregistrySchema = (valueLabel = "Subregistry") =>
|
|
3095
|
+
var makeSubregistrySchema = (valueLabel = "Subregistry") => import_v433.z.object({
|
|
3010
3096
|
subregistryId: makeAccountIdSchema(`${valueLabel} Subregistry ID`),
|
|
3011
3097
|
node: makeNodeSchema(`${valueLabel} Node`)
|
|
3012
3098
|
});
|
|
3013
|
-
var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") =>
|
|
3099
|
+
var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") => import_v433.z.object({
|
|
3014
3100
|
subregistry: makeSubregistrySchema(`${valueLabel} Subregistry`),
|
|
3015
3101
|
node: makeNodeSchema(`${valueLabel} Node`),
|
|
3016
3102
|
expiresAt: makeUnixTimestampSchema(`${valueLabel} Expires at`)
|
|
@@ -3026,24 +3112,24 @@ function invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium(ctx) {
|
|
|
3026
3112
|
});
|
|
3027
3113
|
}
|
|
3028
3114
|
}
|
|
3029
|
-
var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") =>
|
|
3115
|
+
var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") => import_v433.z.union([
|
|
3030
3116
|
// pricing available
|
|
3031
|
-
|
|
3117
|
+
import_v433.z.object({
|
|
3032
3118
|
baseCost: makePriceEthSchema(`${valueLabel} Base Cost`),
|
|
3033
3119
|
premium: makePriceEthSchema(`${valueLabel} Premium`),
|
|
3034
3120
|
total: makePriceEthSchema(`${valueLabel} Total`)
|
|
3035
3121
|
}).check(invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium).transform((v) => v),
|
|
3036
3122
|
// pricing unknown
|
|
3037
|
-
|
|
3038
|
-
baseCost:
|
|
3039
|
-
premium:
|
|
3040
|
-
total:
|
|
3123
|
+
import_v433.z.object({
|
|
3124
|
+
baseCost: import_v433.z.null(),
|
|
3125
|
+
premium: import_v433.z.null(),
|
|
3126
|
+
total: import_v433.z.null()
|
|
3041
3127
|
}).transform((v) => v)
|
|
3042
3128
|
]);
|
|
3043
3129
|
function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
|
|
3044
3130
|
const { encodedReferrer, decodedReferrer } = ctx.value;
|
|
3045
3131
|
try {
|
|
3046
|
-
const expectedDecodedReferrer = decodeEncodedReferrer(encodedReferrer)
|
|
3132
|
+
const expectedDecodedReferrer = decodeEncodedReferrer(encodedReferrer);
|
|
3047
3133
|
if (decodedReferrer !== expectedDecodedReferrer) {
|
|
3048
3134
|
ctx.issues.push({
|
|
3049
3135
|
code: "custom",
|
|
@@ -3060,19 +3146,19 @@ function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
|
|
|
3060
3146
|
});
|
|
3061
3147
|
}
|
|
3062
3148
|
}
|
|
3063
|
-
var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") =>
|
|
3149
|
+
var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") => import_v433.z.union([
|
|
3064
3150
|
// referral available
|
|
3065
|
-
|
|
3151
|
+
import_v433.z.object({
|
|
3066
3152
|
encodedReferrer: makeHexStringSchema(
|
|
3067
3153
|
{ bytesCount: ENCODED_REFERRER_BYTE_LENGTH },
|
|
3068
3154
|
`${valueLabel} Encoded Referrer`
|
|
3069
3155
|
),
|
|
3070
|
-
decodedReferrer:
|
|
3156
|
+
decodedReferrer: makeNormalizedAddressSchema(`${valueLabel} Decoded Referrer`)
|
|
3071
3157
|
}).check(invariant_registrarActionDecodedReferrerBasedOnRawReferrer),
|
|
3072
3158
|
// referral not applicable
|
|
3073
|
-
|
|
3074
|
-
encodedReferrer:
|
|
3075
|
-
decodedReferrer:
|
|
3159
|
+
import_v433.z.object({
|
|
3160
|
+
encodedReferrer: import_v433.z.null(),
|
|
3161
|
+
decodedReferrer: import_v433.z.null()
|
|
3076
3162
|
})
|
|
3077
3163
|
]);
|
|
3078
3164
|
function invariant_eventIdsInitialElementIsTheActionId(ctx) {
|
|
@@ -3085,54 +3171,53 @@ function invariant_eventIdsInitialElementIsTheActionId(ctx) {
|
|
|
3085
3171
|
});
|
|
3086
3172
|
}
|
|
3087
3173
|
}
|
|
3088
|
-
var EventIdSchema =
|
|
3089
|
-
var EventIdsSchema =
|
|
3090
|
-
var
|
|
3174
|
+
var EventIdSchema = import_v433.z.string().nonempty();
|
|
3175
|
+
var EventIdsSchema = import_v433.z.array(EventIdSchema).min(1).transform((v) => v);
|
|
3176
|
+
var makeBaseRegistrarActionSchemaWithoutCheck = (valueLabel = "Base Registrar Action") => import_v433.z.object({
|
|
3091
3177
|
id: EventIdSchema,
|
|
3092
3178
|
incrementalDuration: makeDurationSchema(`${valueLabel} Incremental Duration`),
|
|
3093
|
-
registrant:
|
|
3094
|
-
registrationLifecycle: makeRegistrationLifecycleSchema(
|
|
3095
|
-
`${valueLabel} Registration Lifecycle`
|
|
3096
|
-
),
|
|
3179
|
+
registrant: makeNormalizedAddressSchema(`${valueLabel} Registrant`),
|
|
3180
|
+
registrationLifecycle: makeRegistrationLifecycleSchema(`${valueLabel} Registration Lifecycle`),
|
|
3097
3181
|
pricing: makeRegistrarActionPricingSchema(`${valueLabel} Pricing`),
|
|
3098
3182
|
referral: makeRegistrarActionReferralSchema(`${valueLabel} Referral`),
|
|
3099
3183
|
block: makeBlockRefSchema(`${valueLabel} Block`),
|
|
3100
3184
|
transactionHash: makeTransactionHashSchema(`${valueLabel} Transaction Hash`),
|
|
3101
3185
|
eventIds: EventIdsSchema
|
|
3102
|
-
})
|
|
3186
|
+
});
|
|
3187
|
+
var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => makeBaseRegistrarActionSchemaWithoutCheck(valueLabel).check(
|
|
3188
|
+
invariant_eventIdsInitialElementIsTheActionId
|
|
3189
|
+
);
|
|
3103
3190
|
var makeRegistrarActionRegistrationSchema = (valueLabel = "Registration ") => makeBaseRegistrarActionSchema(valueLabel).extend({
|
|
3104
|
-
type:
|
|
3191
|
+
type: import_v433.z.literal(RegistrarActionTypes.Registration)
|
|
3105
3192
|
});
|
|
3106
3193
|
var makeRegistrarActionRenewalSchema = (valueLabel = "Renewal") => makeBaseRegistrarActionSchema(valueLabel).extend({
|
|
3107
|
-
type:
|
|
3194
|
+
type: import_v433.z.literal(RegistrarActionTypes.Renewal)
|
|
3108
3195
|
});
|
|
3109
|
-
var makeRegistrarActionSchema = (valueLabel = "Registrar Action") =>
|
|
3196
|
+
var makeRegistrarActionSchema = (valueLabel = "Registrar Action") => import_v433.z.discriminatedUnion("type", [
|
|
3110
3197
|
makeRegistrarActionRegistrationSchema(`${valueLabel} Registration`),
|
|
3111
3198
|
makeRegistrarActionRenewalSchema(`${valueLabel} Renewal`)
|
|
3112
3199
|
]);
|
|
3113
3200
|
|
|
3114
|
-
// src/
|
|
3115
|
-
var
|
|
3201
|
+
// src/ensnode/api/shared/pagination/zod-schemas.ts
|
|
3202
|
+
var import_v434 = require("zod/v4");
|
|
3116
3203
|
|
|
3117
|
-
// src/
|
|
3204
|
+
// src/ensnode/api/shared/pagination/request.ts
|
|
3118
3205
|
var RECORDS_PER_PAGE_DEFAULT = 10;
|
|
3119
3206
|
var RECORDS_PER_PAGE_MAX = 100;
|
|
3120
3207
|
|
|
3121
|
-
// src/
|
|
3122
|
-
var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") =>
|
|
3208
|
+
// src/ensnode/api/shared/pagination/zod-schemas.ts
|
|
3209
|
+
var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") => import_v434.z.object({
|
|
3123
3210
|
page: makePositiveIntegerSchema(`${valueLabel}.page`),
|
|
3124
3211
|
recordsPerPage: makePositiveIntegerSchema(`${valueLabel}.recordsPerPage`).max(
|
|
3125
3212
|
RECORDS_PER_PAGE_MAX,
|
|
3126
3213
|
`${valueLabel}.recordsPerPage must not exceed ${RECORDS_PER_PAGE_MAX}`
|
|
3127
3214
|
)
|
|
3128
3215
|
});
|
|
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()
|
|
3216
|
+
var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") => import_v434.z.object({
|
|
3217
|
+
totalRecords: import_v434.z.literal(0),
|
|
3218
|
+
totalPages: import_v434.z.literal(1),
|
|
3219
|
+
hasNext: import_v434.z.literal(false),
|
|
3220
|
+
hasPrev: import_v434.z.literal(false)
|
|
3136
3221
|
}).extend(makeRequestPageParamsSchema(valueLabel).shape);
|
|
3137
3222
|
function invariant_responsePageWithRecordsIsCorrect(ctx) {
|
|
3138
3223
|
const { hasNext, hasPrev, recordsPerPage, page, totalRecords, startIndex, endIndex } = ctx.value;
|
|
@@ -3167,20 +3252,20 @@ function invariant_responsePageWithRecordsIsCorrect(ctx) {
|
|
|
3167
3252
|
});
|
|
3168
3253
|
}
|
|
3169
3254
|
}
|
|
3170
|
-
var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") =>
|
|
3255
|
+
var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") => import_v434.z.object({
|
|
3171
3256
|
totalRecords: makePositiveIntegerSchema(`${valueLabel}.totalRecords`),
|
|
3172
3257
|
totalPages: makePositiveIntegerSchema(`${valueLabel}.totalPages`),
|
|
3173
|
-
hasNext:
|
|
3174
|
-
hasPrev:
|
|
3258
|
+
hasNext: import_v434.z.boolean(),
|
|
3259
|
+
hasPrev: import_v434.z.boolean(),
|
|
3175
3260
|
startIndex: makeNonNegativeIntegerSchema(`${valueLabel}.startIndex`),
|
|
3176
3261
|
endIndex: makeNonNegativeIntegerSchema(`${valueLabel}.endIndex`)
|
|
3177
3262
|
}).extend(makeRequestPageParamsSchema(valueLabel).shape).check(invariant_responsePageWithRecordsIsCorrect);
|
|
3178
|
-
var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") =>
|
|
3263
|
+
var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") => import_v434.z.union([
|
|
3179
3264
|
makeResponsePageContextSchemaWithNoRecords(valueLabel),
|
|
3180
3265
|
makeResponsePageContextSchemaWithRecords(valueLabel)
|
|
3181
3266
|
]);
|
|
3182
3267
|
|
|
3183
|
-
// src/
|
|
3268
|
+
// src/ensnode/api/registrar-actions/response.ts
|
|
3184
3269
|
var RegistrarActionsResponseCodes = {
|
|
3185
3270
|
/**
|
|
3186
3271
|
* Represents that Registrar Actions are available.
|
|
@@ -3192,11 +3277,11 @@ var RegistrarActionsResponseCodes = {
|
|
|
3192
3277
|
Error: "error"
|
|
3193
3278
|
};
|
|
3194
3279
|
|
|
3195
|
-
// src/
|
|
3280
|
+
// src/ensnode/api/registrar-actions/zod-schemas.ts
|
|
3196
3281
|
function invariant_registrationLifecycleNodeMatchesName(ctx) {
|
|
3197
3282
|
const { name, action } = ctx.value;
|
|
3198
3283
|
const expectedNode = action.registrationLifecycle.node;
|
|
3199
|
-
const actualNode = (0,
|
|
3284
|
+
const actualNode = (0, import_enssdk7.namehashInterpretedName)(name);
|
|
3200
3285
|
if (actualNode !== expectedNode) {
|
|
3201
3286
|
ctx.issues.push({
|
|
3202
3287
|
code: "custom",
|
|
@@ -3205,39 +3290,39 @@ function invariant_registrationLifecycleNodeMatchesName(ctx) {
|
|
|
3205
3290
|
});
|
|
3206
3291
|
}
|
|
3207
3292
|
}
|
|
3208
|
-
var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") =>
|
|
3293
|
+
var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") => import_v435.z.object({
|
|
3209
3294
|
action: makeRegistrarActionSchema(valueLabel),
|
|
3210
3295
|
name: makeReinterpretedNameSchema(valueLabel)
|
|
3211
3296
|
}).check(invariant_registrationLifecycleNodeMatchesName);
|
|
3212
|
-
var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") =>
|
|
3213
|
-
responseCode:
|
|
3214
|
-
registrarActions:
|
|
3297
|
+
var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") => import_v435.z.object({
|
|
3298
|
+
responseCode: import_v435.z.literal(RegistrarActionsResponseCodes.Ok),
|
|
3299
|
+
registrarActions: import_v435.z.array(makeNamedRegistrarActionSchema(valueLabel)),
|
|
3215
3300
|
pageContext: makeResponsePageContextSchema(`${valueLabel}.pageContext`),
|
|
3216
|
-
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
|
|
3301
|
+
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
|
|
3217
3302
|
});
|
|
3218
|
-
var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") =>
|
|
3219
|
-
responseCode:
|
|
3220
|
-
error:
|
|
3303
|
+
var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") => import_v435.z.strictObject({
|
|
3304
|
+
responseCode: import_v435.z.literal(RegistrarActionsResponseCodes.Error),
|
|
3305
|
+
error: makeErrorResponseSchema()
|
|
3221
3306
|
});
|
|
3222
|
-
var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") =>
|
|
3307
|
+
var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") => import_v435.z.discriminatedUnion("responseCode", [
|
|
3223
3308
|
makeRegistrarActionsResponseOkSchema(valueLabel),
|
|
3224
3309
|
makeRegistrarActionsResponseErrorSchema(valueLabel)
|
|
3225
3310
|
]);
|
|
3226
3311
|
|
|
3227
|
-
// src/
|
|
3312
|
+
// src/ensnode/api/registrar-actions/deserialize.ts
|
|
3228
3313
|
function deserializeRegistrarActionsResponse(maybeResponse) {
|
|
3229
3314
|
const parsed = makeRegistrarActionsResponseSchema().safeParse(maybeResponse);
|
|
3230
3315
|
if (parsed.error) {
|
|
3231
3316
|
throw new Error(
|
|
3232
3317
|
`Cannot deserialize RegistrarActionsResponse:
|
|
3233
|
-
${(0,
|
|
3318
|
+
${(0, import_v436.prettifyError)(parsed.error)}
|
|
3234
3319
|
`
|
|
3235
3320
|
);
|
|
3236
3321
|
}
|
|
3237
3322
|
return parsed.data;
|
|
3238
3323
|
}
|
|
3239
3324
|
|
|
3240
|
-
// src/
|
|
3325
|
+
// src/ensnode/api/registrar-actions/request.ts
|
|
3241
3326
|
var RegistrarActionsFilterTypes = {
|
|
3242
3327
|
BySubregistryNode: "bySubregistryNode",
|
|
3243
3328
|
WithEncodedReferral: "withEncodedReferral",
|
|
@@ -3257,7 +3342,7 @@ var RegistrarActionsOrders = {
|
|
|
3257
3342
|
LatestRegistrarActions: "orderBy[timestamp]=desc"
|
|
3258
3343
|
};
|
|
3259
3344
|
|
|
3260
|
-
// src/
|
|
3345
|
+
// src/ensnode/api/registrar-actions/filters.ts
|
|
3261
3346
|
function byParentNode(parentNode) {
|
|
3262
3347
|
if (typeof parentNode === "undefined") {
|
|
3263
3348
|
return void 0;
|
|
@@ -3310,7 +3395,7 @@ var registrarActionsFilter = {
|
|
|
3310
3395
|
endTimestamp
|
|
3311
3396
|
};
|
|
3312
3397
|
|
|
3313
|
-
// src/
|
|
3398
|
+
// src/ensnode/api/registrar-actions/prerequisites.ts
|
|
3314
3399
|
var registrarActionsRequiredPlugins = [
|
|
3315
3400
|
"subgraph" /* Subgraph */,
|
|
3316
3401
|
"basenames" /* Basenames */,
|
|
@@ -3342,7 +3427,7 @@ function hasRegistrarActionsIndexingStatusSupport(omnichainIndexingStatusId) {
|
|
|
3342
3427
|
};
|
|
3343
3428
|
}
|
|
3344
3429
|
|
|
3345
|
-
// src/
|
|
3430
|
+
// src/ensnode/api/registrar-actions/serialize.ts
|
|
3346
3431
|
function serializeNamedRegistrarAction({
|
|
3347
3432
|
action,
|
|
3348
3433
|
name
|
|
@@ -3366,19 +3451,19 @@ function serializeRegistrarActionsResponse(response) {
|
|
|
3366
3451
|
}
|
|
3367
3452
|
}
|
|
3368
3453
|
|
|
3369
|
-
// src/
|
|
3370
|
-
var
|
|
3371
|
-
function
|
|
3372
|
-
const parsed =
|
|
3454
|
+
// src/ensnode/api/shared/errors/deserialize.ts
|
|
3455
|
+
var import_v437 = require("zod/v4");
|
|
3456
|
+
function deserializeErrorResponse2(maybeErrorResponse) {
|
|
3457
|
+
const parsed = makeErrorResponseSchema().safeParse(maybeErrorResponse);
|
|
3373
3458
|
if (parsed.error) {
|
|
3374
3459
|
throw new Error(`Cannot deserialize ErrorResponse:
|
|
3375
|
-
${(0,
|
|
3460
|
+
${(0, import_v437.prettifyError)(parsed.error)}
|
|
3376
3461
|
`);
|
|
3377
3462
|
}
|
|
3378
3463
|
return parsed.data;
|
|
3379
3464
|
}
|
|
3380
3465
|
|
|
3381
|
-
// src/
|
|
3466
|
+
// src/ensnode/api/shared/pagination/build-page-context.ts
|
|
3382
3467
|
function buildPageContext(page, recordsPerPage, totalRecords) {
|
|
3383
3468
|
const totalPages = Math.max(1, Math.ceil(totalRecords / recordsPerPage));
|
|
3384
3469
|
if (page > totalPages) {
|
|
@@ -3413,7 +3498,7 @@ function buildPageContext(page, recordsPerPage, totalRecords) {
|
|
|
3413
3498
|
};
|
|
3414
3499
|
}
|
|
3415
3500
|
|
|
3416
|
-
// src/
|
|
3501
|
+
// src/ensnode/client-error.ts
|
|
3417
3502
|
var ClientError = class _ClientError extends Error {
|
|
3418
3503
|
details;
|
|
3419
3504
|
constructor(message, details) {
|
|
@@ -3426,17 +3511,17 @@ var ClientError = class _ClientError extends Error {
|
|
|
3426
3511
|
}
|
|
3427
3512
|
};
|
|
3428
3513
|
|
|
3429
|
-
// src/
|
|
3430
|
-
var
|
|
3431
|
-
var
|
|
3432
|
-
var
|
|
3514
|
+
// src/ensnode/deployments.ts
|
|
3515
|
+
var import_datasources5 = require("@ensnode/datasources");
|
|
3516
|
+
var DEFAULT_ENSNODE_URL_MAINNET = "https://api.alpha.ensnode.io";
|
|
3517
|
+
var DEFAULT_ENSNODE_URL_SEPOLIA = "https://api.alpha-sepolia.ensnode.io";
|
|
3433
3518
|
var getDefaultEnsNodeUrl = (namespace) => {
|
|
3434
|
-
const effectiveNamespace = namespace ??
|
|
3519
|
+
const effectiveNamespace = namespace ?? import_datasources5.ENSNamespaceIds.Mainnet;
|
|
3435
3520
|
switch (effectiveNamespace) {
|
|
3436
|
-
case
|
|
3437
|
-
return new URL(
|
|
3438
|
-
case
|
|
3439
|
-
return new URL(
|
|
3521
|
+
case import_datasources5.ENSNamespaceIds.Mainnet:
|
|
3522
|
+
return new URL(DEFAULT_ENSNODE_URL_MAINNET);
|
|
3523
|
+
case import_datasources5.ENSNamespaceIds.Sepolia:
|
|
3524
|
+
return new URL(DEFAULT_ENSNODE_URL_SEPOLIA);
|
|
3440
3525
|
default:
|
|
3441
3526
|
throw new Error(
|
|
3442
3527
|
`ENSNamespaceId ${effectiveNamespace} does not have a default ENSNode URL defined`
|
|
@@ -3444,8 +3529,8 @@ var getDefaultEnsNodeUrl = (namespace) => {
|
|
|
3444
3529
|
}
|
|
3445
3530
|
};
|
|
3446
3531
|
|
|
3447
|
-
// src/
|
|
3448
|
-
var
|
|
3532
|
+
// src/ensnode/client.ts
|
|
3533
|
+
var EnsNodeClient = class _EnsNodeClient {
|
|
3449
3534
|
options;
|
|
3450
3535
|
static defaultOptions() {
|
|
3451
3536
|
return {
|
|
@@ -3454,7 +3539,7 @@ var EnsApiClient = class _EnsApiClient {
|
|
|
3454
3539
|
}
|
|
3455
3540
|
constructor(options = {}) {
|
|
3456
3541
|
this.options = {
|
|
3457
|
-
...
|
|
3542
|
+
..._EnsNodeClient.defaultOptions(),
|
|
3458
3543
|
...options
|
|
3459
3544
|
};
|
|
3460
3545
|
}
|
|
@@ -3498,15 +3583,21 @@ var EnsApiClient = class _EnsApiClient {
|
|
|
3498
3583
|
*/
|
|
3499
3584
|
async resolveRecords(name, selection, options) {
|
|
3500
3585
|
const url = new URL(`/api/resolve/records/${encodeURIComponent(name)}`, this.options.url);
|
|
3501
|
-
if (selection.name)
|
|
3502
|
-
|
|
3503
|
-
|
|
3586
|
+
if (selection.name) url.searchParams.set("name", "true");
|
|
3587
|
+
if (selection.contenthash) url.searchParams.set("contenthash", "true");
|
|
3588
|
+
if (selection.pubkey) url.searchParams.set("pubkey", "true");
|
|
3589
|
+
if (selection.dnszonehash) url.searchParams.set("dnszonehash", "true");
|
|
3590
|
+
if (selection.version) url.searchParams.set("version", "true");
|
|
3591
|
+
if (selection.abi !== void 0) url.searchParams.set("abi", selection.abi.toString());
|
|
3504
3592
|
if (selection.addresses && selection.addresses.length > 0) {
|
|
3505
3593
|
url.searchParams.set("addresses", selection.addresses.join(","));
|
|
3506
3594
|
}
|
|
3507
3595
|
if (selection.texts && selection.texts.length > 0) {
|
|
3508
3596
|
url.searchParams.set("texts", selection.texts.join(","));
|
|
3509
3597
|
}
|
|
3598
|
+
if (selection.interfaces && selection.interfaces.length > 0) {
|
|
3599
|
+
url.searchParams.set("interfaces", selection.interfaces.join(","));
|
|
3600
|
+
}
|
|
3510
3601
|
if (options?.trace) url.searchParams.set("trace", "true");
|
|
3511
3602
|
if (options?.accelerate) url.searchParams.set("accelerate", "true");
|
|
3512
3603
|
const response = await fetch(url);
|
|
@@ -3515,6 +3606,11 @@ var EnsApiClient = class _EnsApiClient {
|
|
|
3515
3606
|
throw ClientError.fromErrorResponse(error);
|
|
3516
3607
|
}
|
|
3517
3608
|
const data = await response.json();
|
|
3609
|
+
const records = data.records;
|
|
3610
|
+
if (typeof records.version === "string") records.version = BigInt(records.version);
|
|
3611
|
+
if (records.abi && typeof records.abi.contentType === "string") {
|
|
3612
|
+
records.abi.contentType = BigInt(records.abi.contentType);
|
|
3613
|
+
}
|
|
3518
3614
|
return data;
|
|
3519
3615
|
}
|
|
3520
3616
|
/**
|
|
@@ -3622,32 +3718,6 @@ var EnsApiClient = class _EnsApiClient {
|
|
|
3622
3718
|
const data = await response.json();
|
|
3623
3719
|
return data;
|
|
3624
3720
|
}
|
|
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
3721
|
/**
|
|
3652
3722
|
* Fetch ENSApi Indexing Status
|
|
3653
3723
|
*
|
|
@@ -3669,7 +3739,7 @@ var EnsApiClient = class _EnsApiClient {
|
|
|
3669
3739
|
if (!response.ok) {
|
|
3670
3740
|
let errorResponse;
|
|
3671
3741
|
try {
|
|
3672
|
-
errorResponse =
|
|
3742
|
+
errorResponse = deserializeErrorResponse2(responseData);
|
|
3673
3743
|
} catch {
|
|
3674
3744
|
}
|
|
3675
3745
|
if (typeof errorResponse !== "undefined") {
|
|
@@ -3700,11 +3770,13 @@ var EnsApiClient = class _EnsApiClient {
|
|
|
3700
3770
|
* ```ts
|
|
3701
3771
|
* import {
|
|
3702
3772
|
* registrarActionsFilter,
|
|
3703
|
-
*
|
|
3773
|
+
* EnsNodeClient,
|
|
3704
3774
|
* } from "@ensnode/ensnode-sdk";
|
|
3705
|
-
* import {
|
|
3775
|
+
* import { ETH_NODE, namehashInterpretedName, asInterpretedName } from "enssdk";
|
|
3776
|
+
*
|
|
3777
|
+
* const BASE_NODE = namehashInterpretedName(asInterpretedName("base.eth"));
|
|
3706
3778
|
*
|
|
3707
|
-
* const client:
|
|
3779
|
+
* const client: EnsNodeClient;
|
|
3708
3780
|
*
|
|
3709
3781
|
* // Get first page with default page size (10 records)
|
|
3710
3782
|
* const response = await client.registrarActions();
|
|
@@ -3724,7 +3796,7 @@ var EnsApiClient = class _EnsApiClient {
|
|
|
3724
3796
|
* // get latest registrar action records associated with
|
|
3725
3797
|
* // subregistry managing `eth` name
|
|
3726
3798
|
* await client.registrarActions({
|
|
3727
|
-
* filters: [registrarActionsFilter.byParentNode(
|
|
3799
|
+
* filters: [registrarActionsFilter.byParentNode(ETH_NODE)],
|
|
3728
3800
|
* });
|
|
3729
3801
|
*
|
|
3730
3802
|
* // get latest registrar action records which include referral info
|
|
@@ -3740,7 +3812,7 @@ var EnsApiClient = class _EnsApiClient {
|
|
|
3740
3812
|
* // get latest 10 registrar action records associated with
|
|
3741
3813
|
* // subregistry managing `base.eth` name
|
|
3742
3814
|
* await client.registrarActions({
|
|
3743
|
-
* filters: [registrarActionsFilter.byParentNode(
|
|
3815
|
+
* filters: [registrarActionsFilter.byParentNode(BASE_NODE)],
|
|
3744
3816
|
* recordsPerPage: 10
|
|
3745
3817
|
* });
|
|
3746
3818
|
*
|
|
@@ -3844,7 +3916,7 @@ var EnsApiClient = class _EnsApiClient {
|
|
|
3844
3916
|
if (!response.ok) {
|
|
3845
3917
|
let errorResponse;
|
|
3846
3918
|
try {
|
|
3847
|
-
errorResponse =
|
|
3919
|
+
errorResponse = deserializeErrorResponse2(responseData);
|
|
3848
3920
|
} catch {
|
|
3849
3921
|
console.log("Registrar Actions API: handling a known server error.");
|
|
3850
3922
|
}
|
|
@@ -3867,207 +3939,32 @@ var EnsApiClient = class _EnsApiClient {
|
|
|
3867
3939
|
* @example
|
|
3868
3940
|
* ```ts
|
|
3869
3941
|
* import {
|
|
3870
|
-
*
|
|
3942
|
+
* EnsNodeClient,
|
|
3871
3943
|
* } 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.
|
|
3944
|
+
* import { namehashInterpretedName, asInterpretedName } from "enssdk";
|
|
4036
3945
|
*
|
|
4037
|
-
*
|
|
3946
|
+
* const VITALIK_NAME = asInterpretedName("vitalik.eth");
|
|
3947
|
+
* const VITALIK_DOMAIN_ID = namehashInterpretedName(VITALIK_NAME);
|
|
4038
3948
|
*
|
|
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
|
|
3949
|
+
* const client: EnsNodeClient;
|
|
4062
3950
|
*
|
|
4063
|
-
*
|
|
3951
|
+
* // get latest name token records from the indexed subregistry based on the requested name
|
|
3952
|
+
* const response = await client.nameTokens({
|
|
3953
|
+
* name: VITALIK_NAME,
|
|
3954
|
+
* });
|
|
4064
3955
|
*
|
|
4065
|
-
*
|
|
4066
|
-
*
|
|
4067
|
-
*
|
|
3956
|
+
* const response = await client.nameTokens({
|
|
3957
|
+
* domainId: VITALIK_DOMAIN_ID,
|
|
3958
|
+
* })
|
|
3959
|
+
* ```
|
|
4068
3960
|
*/
|
|
4069
|
-
async
|
|
4070
|
-
const url = new URL(`/api/
|
|
3961
|
+
async nameTokens(request) {
|
|
3962
|
+
const url = new URL(`/api/name-tokens`, this.options.url);
|
|
3963
|
+
if (request.name !== void 0) {
|
|
3964
|
+
url.searchParams.set("name", request.name);
|
|
3965
|
+
} else if (request.domainId !== void 0) {
|
|
3966
|
+
url.searchParams.set("domainId", request.domainId);
|
|
3967
|
+
}
|
|
4071
3968
|
const response = await fetch(url);
|
|
4072
3969
|
let responseData;
|
|
4073
3970
|
try {
|
|
@@ -4080,184 +3977,18 @@ var EnsIndexerClient = class {
|
|
|
4080
3977
|
try {
|
|
4081
3978
|
errorResponse = deserializeErrorResponse2(responseData);
|
|
4082
3979
|
} catch {
|
|
3980
|
+
console.log("Name Tokens API: handling a known server error.");
|
|
4083
3981
|
}
|
|
4084
3982
|
if (typeof errorResponse !== "undefined") {
|
|
4085
|
-
throw new Error(`Fetching
|
|
3983
|
+
throw new Error(`Fetching ENSNode Name Tokens Failed: ${errorResponse.message}`);
|
|
4086
3984
|
}
|
|
4087
3985
|
}
|
|
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)}`);
|
|
3986
|
+
return deserializedNameTokensResponse(responseData);
|
|
4223
3987
|
}
|
|
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
3988
|
};
|
|
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
3989
|
|
|
4259
3990
|
// src/identity/identity.ts
|
|
4260
|
-
var
|
|
3991
|
+
var import_datasources6 = require("@ensnode/datasources");
|
|
4261
3992
|
|
|
4262
3993
|
// src/identity/types.ts
|
|
4263
3994
|
var ResolutionStatusIds = {
|
|
@@ -4284,7 +4015,7 @@ var ResolutionStatusIds = {
|
|
|
4284
4015
|
function buildUnresolvedIdentity(address, namespaceId, chainId) {
|
|
4285
4016
|
return {
|
|
4286
4017
|
resolutionStatus: ResolutionStatusIds.Unresolved,
|
|
4287
|
-
chainId: chainId ?? (0,
|
|
4018
|
+
chainId: chainId ?? (0, import_datasources6.getENSRootChainId)(namespaceId),
|
|
4288
4019
|
address
|
|
4289
4020
|
};
|
|
4290
4021
|
}
|
|
@@ -4293,14 +4024,14 @@ function isResolvedIdentity(identity) {
|
|
|
4293
4024
|
}
|
|
4294
4025
|
|
|
4295
4026
|
// src/indexing-status/deserialize/chain-indexing-status-snapshot.ts
|
|
4296
|
-
var
|
|
4027
|
+
var import_v438 = require("zod/v4");
|
|
4297
4028
|
function deserializeChainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
4298
4029
|
const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
|
|
4299
4030
|
const parsed = schema.safeParse(maybeSnapshot);
|
|
4300
4031
|
if (parsed.error) {
|
|
4301
4032
|
throw new Error(
|
|
4302
4033
|
`Cannot deserialize into ChainIndexingStatusSnapshot:
|
|
4303
|
-
${(0,
|
|
4034
|
+
${(0, import_v438.prettifyError)(parsed.error)}
|
|
4304
4035
|
`
|
|
4305
4036
|
);
|
|
4306
4037
|
}
|
|
@@ -4318,55 +4049,63 @@ function createRealtimeIndexingStatusProjection(snapshot, now) {
|
|
|
4318
4049
|
}
|
|
4319
4050
|
|
|
4320
4051
|
// src/indexing-status/validate/chain-indexing-status-snapshot.ts
|
|
4321
|
-
var
|
|
4052
|
+
var import_v439 = require("zod/v4");
|
|
4322
4053
|
function validateChainIndexingStatusSnapshot(unvalidatedSnapshot, valueLabel) {
|
|
4323
4054
|
const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
|
|
4324
4055
|
const parsed = schema.safeParse(unvalidatedSnapshot);
|
|
4325
4056
|
if (parsed.error) {
|
|
4326
4057
|
throw new Error(`Invalid ChainIndexingStatusSnapshot:
|
|
4327
|
-
${(0,
|
|
4058
|
+
${(0, import_v439.prettifyError)(parsed.error)}
|
|
4328
4059
|
`);
|
|
4329
4060
|
}
|
|
4330
4061
|
return parsed.data;
|
|
4331
4062
|
}
|
|
4332
4063
|
|
|
4333
4064
|
// src/indexing-status/validate/realtime-indexing-status-projection.ts
|
|
4334
|
-
var
|
|
4065
|
+
var import_v440 = require("zod/v4");
|
|
4335
4066
|
function validateRealtimeIndexingStatusProjection(unvalidatedProjection, valueLabel) {
|
|
4336
4067
|
const schema = makeRealtimeIndexingStatusProjectionSchema(valueLabel);
|
|
4337
4068
|
const parsed = schema.safeParse(unvalidatedProjection);
|
|
4338
4069
|
if (parsed.error) {
|
|
4339
4070
|
throw new Error(`Invalid RealtimeIndexingStatusProjection:
|
|
4340
|
-
${(0,
|
|
4071
|
+
${(0, import_v440.prettifyError)(parsed.error)}
|
|
4341
4072
|
`);
|
|
4342
4073
|
}
|
|
4343
4074
|
return parsed.data;
|
|
4344
4075
|
}
|
|
4345
4076
|
|
|
4077
|
+
// src/omnigraph-api/prerequisites.ts
|
|
4078
|
+
function hasOmnigraphApiConfigSupport(config) {
|
|
4079
|
+
const supported = config.plugins.includes("ensv2" /* ENSv2 */);
|
|
4080
|
+
if (supported) return { supported };
|
|
4081
|
+
return {
|
|
4082
|
+
supported: false,
|
|
4083
|
+
reason: `The connected ENSNode's Config must have the '${"ensv2" /* ENSv2 */}' plugin enabled.`
|
|
4084
|
+
};
|
|
4085
|
+
}
|
|
4086
|
+
|
|
4346
4087
|
// src/registrars/basenames-subregistry.ts
|
|
4347
|
-
var
|
|
4088
|
+
var import_enssdk8 = require("enssdk");
|
|
4089
|
+
var import_datasources7 = require("@ensnode/datasources");
|
|
4348
4090
|
function getBasenamesSubregistryId(namespace) {
|
|
4349
|
-
const datasource = (0,
|
|
4091
|
+
const datasource = (0, import_datasources7.maybeGetDatasource)(namespace, import_datasources7.DatasourceNames.Basenames);
|
|
4350
4092
|
if (!datasource) {
|
|
4351
|
-
throw new Error(`Datasource not found for ${namespace} ${
|
|
4093
|
+
throw new Error(`Datasource not found for ${namespace} ${import_datasources7.DatasourceNames.Basenames}`);
|
|
4352
4094
|
}
|
|
4353
4095
|
const address = datasource.contracts.BaseRegistrar?.address;
|
|
4354
4096
|
if (address === void 0 || Array.isArray(address)) {
|
|
4355
4097
|
throw new Error(`BaseRegistrar contract not found or has multiple addresses for ${namespace}`);
|
|
4356
4098
|
}
|
|
4357
|
-
return {
|
|
4358
|
-
chainId: datasource.chain.id,
|
|
4359
|
-
address
|
|
4360
|
-
};
|
|
4099
|
+
return { chainId: datasource.chain.id, address };
|
|
4361
4100
|
}
|
|
4362
4101
|
function getBasenamesSubregistryManagedName(namespaceId) {
|
|
4363
4102
|
switch (namespaceId) {
|
|
4364
|
-
case
|
|
4365
|
-
return "base.eth";
|
|
4366
|
-
case
|
|
4367
|
-
case
|
|
4368
|
-
return "basetest.eth";
|
|
4369
|
-
case
|
|
4103
|
+
case import_datasources7.ENSNamespaceIds.Mainnet:
|
|
4104
|
+
return (0, import_enssdk8.asInterpretedName)("base.eth");
|
|
4105
|
+
case import_datasources7.ENSNamespaceIds.Sepolia:
|
|
4106
|
+
case import_datasources7.ENSNamespaceIds.SepoliaV2:
|
|
4107
|
+
return (0, import_enssdk8.asInterpretedName)("basetest.eth");
|
|
4108
|
+
case import_datasources7.ENSNamespaceIds.EnsTestEnv:
|
|
4370
4109
|
throw new Error(
|
|
4371
4110
|
`No registrar managed name is known for the 'basenames' subregistry within the "${namespaceId}" namespace.`
|
|
4372
4111
|
);
|
|
@@ -4374,55 +4113,51 @@ function getBasenamesSubregistryManagedName(namespaceId) {
|
|
|
4374
4113
|
}
|
|
4375
4114
|
|
|
4376
4115
|
// src/registrars/ethnames-subregistry.ts
|
|
4377
|
-
var
|
|
4116
|
+
var import_enssdk9 = require("enssdk");
|
|
4117
|
+
var import_datasources8 = require("@ensnode/datasources");
|
|
4378
4118
|
function getEthnamesSubregistryId(namespace) {
|
|
4379
|
-
const datasource = (0,
|
|
4119
|
+
const datasource = (0, import_datasources8.maybeGetDatasource)(namespace, import_datasources8.DatasourceNames.ENSRoot);
|
|
4380
4120
|
if (!datasource) {
|
|
4381
|
-
throw new Error(`Datasource not found for ${namespace} ${
|
|
4121
|
+
throw new Error(`Datasource not found for ${namespace} ${import_datasources8.DatasourceNames.ENSRoot}`);
|
|
4382
4122
|
}
|
|
4383
4123
|
const address = datasource.contracts.BaseRegistrar?.address;
|
|
4384
4124
|
if (address === void 0 || Array.isArray(address)) {
|
|
4385
4125
|
throw new Error(`BaseRegistrar contract not found or has multiple addresses for ${namespace}`);
|
|
4386
4126
|
}
|
|
4387
|
-
return {
|
|
4388
|
-
chainId: datasource.chain.id,
|
|
4389
|
-
address
|
|
4390
|
-
};
|
|
4127
|
+
return { chainId: datasource.chain.id, address };
|
|
4391
4128
|
}
|
|
4392
4129
|
function getEthnamesSubregistryManagedName(namespaceId) {
|
|
4393
4130
|
switch (namespaceId) {
|
|
4394
|
-
case
|
|
4395
|
-
case
|
|
4396
|
-
case
|
|
4397
|
-
case
|
|
4398
|
-
return "eth";
|
|
4131
|
+
case import_datasources8.ENSNamespaceIds.Mainnet:
|
|
4132
|
+
case import_datasources8.ENSNamespaceIds.Sepolia:
|
|
4133
|
+
case import_datasources8.ENSNamespaceIds.SepoliaV2:
|
|
4134
|
+
case import_datasources8.ENSNamespaceIds.EnsTestEnv:
|
|
4135
|
+
return (0, import_enssdk9.asInterpretedName)("eth");
|
|
4399
4136
|
}
|
|
4400
4137
|
}
|
|
4401
4138
|
|
|
4402
4139
|
// src/registrars/lineanames-subregistry.ts
|
|
4403
|
-
var
|
|
4140
|
+
var import_enssdk10 = require("enssdk");
|
|
4141
|
+
var import_datasources9 = require("@ensnode/datasources");
|
|
4404
4142
|
function getLineanamesSubregistryId(namespace) {
|
|
4405
|
-
const datasource = (0,
|
|
4143
|
+
const datasource = (0, import_datasources9.maybeGetDatasource)(namespace, import_datasources9.DatasourceNames.Lineanames);
|
|
4406
4144
|
if (!datasource) {
|
|
4407
|
-
throw new Error(`Datasource not found for ${namespace} ${
|
|
4145
|
+
throw new Error(`Datasource not found for ${namespace} ${import_datasources9.DatasourceNames.Lineanames}`);
|
|
4408
4146
|
}
|
|
4409
4147
|
const address = datasource.contracts.BaseRegistrar?.address;
|
|
4410
4148
|
if (address === void 0 || Array.isArray(address)) {
|
|
4411
4149
|
throw new Error(`BaseRegistrar contract not found or has multiple addresses for ${namespace}`);
|
|
4412
4150
|
}
|
|
4413
|
-
return {
|
|
4414
|
-
chainId: datasource.chain.id,
|
|
4415
|
-
address
|
|
4416
|
-
};
|
|
4151
|
+
return { chainId: datasource.chain.id, address };
|
|
4417
4152
|
}
|
|
4418
4153
|
function getLineanamesSubregistryManagedName(namespaceId) {
|
|
4419
4154
|
switch (namespaceId) {
|
|
4420
|
-
case
|
|
4421
|
-
return "linea.eth";
|
|
4422
|
-
case
|
|
4423
|
-
case
|
|
4424
|
-
return "linea-sepolia.eth";
|
|
4425
|
-
case
|
|
4155
|
+
case import_datasources9.ENSNamespaceIds.Mainnet:
|
|
4156
|
+
return (0, import_enssdk10.asInterpretedName)("linea.eth");
|
|
4157
|
+
case import_datasources9.ENSNamespaceIds.Sepolia:
|
|
4158
|
+
case import_datasources9.ENSNamespaceIds.SepoliaV2:
|
|
4159
|
+
return (0, import_enssdk10.asInterpretedName)("linea-sepolia.eth");
|
|
4160
|
+
case import_datasources9.ENSNamespaceIds.EnsTestEnv:
|
|
4426
4161
|
throw new Error(
|
|
4427
4162
|
`No registrar managed name is known for the 'Lineanames' subregistry within the "${namespaceId}" namespace.`
|
|
4428
4163
|
);
|
|
@@ -4445,18 +4180,19 @@ function isRegistrationInGracePeriod(info, now) {
|
|
|
4445
4180
|
}
|
|
4446
4181
|
|
|
4447
4182
|
// src/resolution/ensip19-chainid.ts
|
|
4183
|
+
var import_enssdk11 = require("enssdk");
|
|
4448
4184
|
var import_chains = require("viem/chains");
|
|
4449
|
-
var
|
|
4185
|
+
var import_datasources10 = require("@ensnode/datasources");
|
|
4450
4186
|
var getResolvePrimaryNameChainIdParam = (chainId, namespaceId) => {
|
|
4451
|
-
const ensRootChainId = (0,
|
|
4187
|
+
const ensRootChainId = (0, import_datasources10.getENSRootChainId)(namespaceId);
|
|
4452
4188
|
return chainId === ensRootChainId ? import_chains.mainnet.id : chainId;
|
|
4453
4189
|
};
|
|
4454
4190
|
var translateDefaultableChainIdToChainId = (chainId, namespaceId) => {
|
|
4455
|
-
return chainId === DEFAULT_EVM_CHAIN_ID ? (0,
|
|
4191
|
+
return chainId === import_enssdk11.DEFAULT_EVM_CHAIN_ID ? (0, import_datasources10.getENSRootChainId)(namespaceId) : chainId;
|
|
4456
4192
|
};
|
|
4457
4193
|
|
|
4458
4194
|
// src/resolution/resolver-records-selection.ts
|
|
4459
|
-
var isSelectionEmpty = (selection) => !selection.name && !selection.addresses?.length && !selection.texts?.length;
|
|
4195
|
+
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
4196
|
|
|
4461
4197
|
// src/shared/cache/lru-cache.ts
|
|
4462
4198
|
var LruCache = class {
|
|
@@ -4515,13 +4251,13 @@ var import_getUnixTime2 = require("date-fns/getUnixTime");
|
|
|
4515
4251
|
var import_getUnixTime = require("date-fns/getUnixTime");
|
|
4516
4252
|
|
|
4517
4253
|
// src/shared/deserialize.ts
|
|
4518
|
-
var
|
|
4254
|
+
var import_v441 = __toESM(require("zod/v4"), 1);
|
|
4519
4255
|
function deserializeChainId(maybeChainId, valueLabel) {
|
|
4520
4256
|
const schema = makeChainIdStringSchema(valueLabel);
|
|
4521
4257
|
const parsed = schema.safeParse(maybeChainId);
|
|
4522
4258
|
if (parsed.error) {
|
|
4523
4259
|
throw new Error(`Cannot deserialize ChainId:
|
|
4524
|
-
${(0,
|
|
4260
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4525
4261
|
`);
|
|
4526
4262
|
}
|
|
4527
4263
|
return parsed.data;
|
|
@@ -4531,7 +4267,7 @@ function deserializeDatetime(maybeDatetime, valueLabel) {
|
|
|
4531
4267
|
const parsed = schema.safeParse(maybeDatetime);
|
|
4532
4268
|
if (parsed.error) {
|
|
4533
4269
|
throw new Error(`Cannot deserialize Datetime:
|
|
4534
|
-
${(0,
|
|
4270
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4535
4271
|
`);
|
|
4536
4272
|
}
|
|
4537
4273
|
return parsed.data;
|
|
@@ -4541,7 +4277,7 @@ function deserializeUnixTimestamp(maybeTimestamp, valueLabel) {
|
|
|
4541
4277
|
const parsed = schema.safeParse(maybeTimestamp);
|
|
4542
4278
|
if (parsed.error) {
|
|
4543
4279
|
throw new Error(`Cannot deserialize Unix Timestamp:
|
|
4544
|
-
${(0,
|
|
4280
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4545
4281
|
`);
|
|
4546
4282
|
}
|
|
4547
4283
|
return parsed.data;
|
|
@@ -4551,7 +4287,7 @@ function deserializeUrl(maybeUrl, valueLabel) {
|
|
|
4551
4287
|
const parsed = schema.safeParse(maybeUrl);
|
|
4552
4288
|
if (parsed.error) {
|
|
4553
4289
|
throw new Error(`Cannot deserialize URL:
|
|
4554
|
-
${(0,
|
|
4290
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4555
4291
|
`);
|
|
4556
4292
|
}
|
|
4557
4293
|
return parsed.data;
|
|
@@ -4561,7 +4297,7 @@ function deserializeBlockNumber(maybeBlockNumber, valueLabel) {
|
|
|
4561
4297
|
const parsed = schema.safeParse(maybeBlockNumber);
|
|
4562
4298
|
if (parsed.error) {
|
|
4563
4299
|
throw new Error(`Cannot deserialize BlockNumber:
|
|
4564
|
-
${(0,
|
|
4300
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4565
4301
|
`);
|
|
4566
4302
|
}
|
|
4567
4303
|
return parsed.data;
|
|
@@ -4571,17 +4307,17 @@ function deserializeBlockRef(maybeBlockRef, valueLabel) {
|
|
|
4571
4307
|
const parsed = schema.safeParse(maybeBlockRef);
|
|
4572
4308
|
if (parsed.error) {
|
|
4573
4309
|
throw new Error(`Cannot deserialize BlockRef:
|
|
4574
|
-
${(0,
|
|
4310
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4575
4311
|
`);
|
|
4576
4312
|
}
|
|
4577
4313
|
return parsed.data;
|
|
4578
4314
|
}
|
|
4579
4315
|
function deserializeDuration(maybeDuration, valueLabel) {
|
|
4580
|
-
const schema =
|
|
4316
|
+
const schema = import_v441.default.coerce.number().pipe(makeDurationSchema(valueLabel));
|
|
4581
4317
|
const parsed = schema.safeParse(maybeDuration);
|
|
4582
4318
|
if (parsed.error) {
|
|
4583
4319
|
throw new RangeError(`Cannot deserialize Duration:
|
|
4584
|
-
${(0,
|
|
4320
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4585
4321
|
`);
|
|
4586
4322
|
}
|
|
4587
4323
|
return parsed.data;
|
|
@@ -4591,7 +4327,7 @@ function parseAccountId(maybeAccountId, valueLabel) {
|
|
|
4591
4327
|
const parsed = schema.safeParse(maybeAccountId);
|
|
4592
4328
|
if (parsed.error) {
|
|
4593
4329
|
throw new RangeError(`Cannot deserialize AccountId:
|
|
4594
|
-
${(0,
|
|
4330
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4595
4331
|
`);
|
|
4596
4332
|
}
|
|
4597
4333
|
return parsed.data;
|
|
@@ -4601,7 +4337,7 @@ function deserializePriceEth(maybePrice, valueLabel) {
|
|
|
4601
4337
|
const parsed = schema.safeParse(maybePrice);
|
|
4602
4338
|
if (parsed.error) {
|
|
4603
4339
|
throw new Error(`Cannot deserialize PriceEth:
|
|
4604
|
-
${(0,
|
|
4340
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4605
4341
|
`);
|
|
4606
4342
|
}
|
|
4607
4343
|
return parsed.data;
|
|
@@ -4611,7 +4347,7 @@ function deserializePriceUsdc(maybePrice, valueLabel) {
|
|
|
4611
4347
|
const parsed = schema.safeParse(maybePrice);
|
|
4612
4348
|
if (parsed.error) {
|
|
4613
4349
|
throw new Error(`Cannot deserialize PriceUsdc:
|
|
4614
|
-
${(0,
|
|
4350
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4615
4351
|
`);
|
|
4616
4352
|
}
|
|
4617
4353
|
return parsed.data;
|
|
@@ -4621,7 +4357,7 @@ function deserializePriceDai(maybePrice, valueLabel) {
|
|
|
4621
4357
|
const parsed = schema.safeParse(maybePrice);
|
|
4622
4358
|
if (parsed.error) {
|
|
4623
4359
|
throw new Error(`Cannot deserialize PriceDai:
|
|
4624
|
-
${(0,
|
|
4360
|
+
${(0, import_v441.prettifyError)(parsed.error)}
|
|
4625
4361
|
`);
|
|
4626
4362
|
}
|
|
4627
4363
|
return parsed.data;
|
|
@@ -4773,12 +4509,12 @@ var TtlCache = class {
|
|
|
4773
4509
|
};
|
|
4774
4510
|
|
|
4775
4511
|
// src/shared/config/indexed-blockranges.ts
|
|
4776
|
-
var
|
|
4512
|
+
var import_datasources11 = require("@ensnode/datasources");
|
|
4777
4513
|
function buildIndexedBlockranges(namespace, pluginsDatasourceNames) {
|
|
4778
4514
|
const indexedBlockranges = /* @__PURE__ */ new Map();
|
|
4779
4515
|
for (const [, datasourceNames] of pluginsDatasourceNames) {
|
|
4780
4516
|
for (const datasourceName of datasourceNames) {
|
|
4781
|
-
const datasource = (0,
|
|
4517
|
+
const datasource = (0, import_datasources11.maybeGetDatasource)(namespace, datasourceName);
|
|
4782
4518
|
if (!datasource) continue;
|
|
4783
4519
|
const datasourceChainId = datasource.chain.id;
|
|
4784
4520
|
const datasourceContracts = Object.values(datasource.contracts);
|
|
@@ -4802,11 +4538,12 @@ function buildIndexedBlockranges(namespace, pluginsDatasourceNames) {
|
|
|
4802
4538
|
}
|
|
4803
4539
|
|
|
4804
4540
|
// src/shared/interpretation/interpret-address.ts
|
|
4805
|
-
var
|
|
4806
|
-
var interpretAddress = (owner) => (0,
|
|
4541
|
+
var import_viem9 = require("viem");
|
|
4542
|
+
var interpretAddress = (owner) => (0, import_viem9.isAddressEqual)(import_viem9.zeroAddress, owner) ? null : owner;
|
|
4807
4543
|
|
|
4808
4544
|
// src/shared/interpretation/interpret-record-values.ts
|
|
4809
|
-
var
|
|
4545
|
+
var import_enssdk12 = require("enssdk");
|
|
4546
|
+
var import_viem10 = require("viem");
|
|
4810
4547
|
|
|
4811
4548
|
// src/shared/null-bytes.ts
|
|
4812
4549
|
var hasNullByte = (value) => value.indexOf("\0") !== -1;
|
|
@@ -4815,16 +4552,16 @@ var stripNullBytes = (value) => value.replaceAll("\0", "");
|
|
|
4815
4552
|
// src/shared/interpretation/interpret-record-values.ts
|
|
4816
4553
|
function interpretNameRecordValue(value) {
|
|
4817
4554
|
if (value === "") return null;
|
|
4818
|
-
if (!
|
|
4555
|
+
if (!(0, import_enssdk12.isInterpretedName)(value)) return null;
|
|
4819
4556
|
return value;
|
|
4820
4557
|
}
|
|
4821
4558
|
function interpretAddressRecordValue(value) {
|
|
4822
4559
|
if (hasNullByte(value)) return null;
|
|
4823
4560
|
if (value === "") return null;
|
|
4824
4561
|
if (value === "0x") return null;
|
|
4825
|
-
if (!(0,
|
|
4826
|
-
if ((0,
|
|
4827
|
-
return
|
|
4562
|
+
if (!(0, import_viem10.isAddress)(value, { strict: false })) return value;
|
|
4563
|
+
if ((0, import_viem10.isAddressEqual)(value, import_viem10.zeroAddress)) return null;
|
|
4564
|
+
return (0, import_enssdk12.toNormalizedAddress)(value);
|
|
4828
4565
|
}
|
|
4829
4566
|
function interpretTextRecordKey(key) {
|
|
4830
4567
|
if (hasNullByte(key)) return null;
|
|
@@ -4837,83 +4574,19 @@ function interpretTextRecordValue(value) {
|
|
|
4837
4574
|
return value;
|
|
4838
4575
|
}
|
|
4839
4576
|
|
|
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);
|
|
4577
|
+
// src/shared/interpretation/interpret-resolver-values.ts
|
|
4578
|
+
var import_viem11 = require("viem");
|
|
4579
|
+
function interpretContenthashValue(value) {
|
|
4580
|
+
if ((0, import_viem11.size)(value) === 0) return null;
|
|
4581
|
+
return value;
|
|
4883
4582
|
}
|
|
4884
|
-
function
|
|
4885
|
-
|
|
4583
|
+
function interpretPubkeyValue(x, y) {
|
|
4584
|
+
if (x === import_viem11.zeroHash && y === import_viem11.zeroHash) return null;
|
|
4585
|
+
return { x, y };
|
|
4886
4586
|
}
|
|
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 };
|
|
4587
|
+
function interpretDnszonehashValue(value) {
|
|
4588
|
+
if ((0, import_viem11.size)(value) === 0) return null;
|
|
4589
|
+
return value;
|
|
4917
4590
|
}
|
|
4918
4591
|
|
|
4919
4592
|
// src/shared/namespace-specific-value.ts
|
|
@@ -4922,17 +4595,18 @@ function getNamespaceSpecificValue(namespace, value) {
|
|
|
4922
4595
|
}
|
|
4923
4596
|
|
|
4924
4597
|
// src/shared/root-registry.ts
|
|
4925
|
-
var
|
|
4926
|
-
var
|
|
4598
|
+
var import_enssdk13 = require("enssdk");
|
|
4599
|
+
var import_datasources12 = require("@ensnode/datasources");
|
|
4600
|
+
var getENSv1Registry = (namespace) => getDatasourceContract(namespace, import_datasources12.DatasourceNames.ENSRoot, "ENSv1Registry");
|
|
4927
4601
|
var isENSv1Registry = (namespace, contract) => accountIdEqual(getENSv1Registry(namespace), contract);
|
|
4928
|
-
var getENSv2RootRegistry = (namespace) => getDatasourceContract(namespace,
|
|
4929
|
-
var getENSv2RootRegistryId = (namespace) => makeRegistryId(getENSv2RootRegistry(namespace));
|
|
4602
|
+
var getENSv2RootRegistry = (namespace) => getDatasourceContract(namespace, import_datasources12.DatasourceNames.ENSv2Root, "RootRegistry");
|
|
4603
|
+
var getENSv2RootRegistryId = (namespace) => (0, import_enssdk13.makeRegistryId)(getENSv2RootRegistry(namespace));
|
|
4930
4604
|
var isENSv2RootRegistry = (namespace, contract) => accountIdEqual(getENSv2RootRegistry(namespace), contract);
|
|
4931
|
-
var maybeGetENSv2RootRegistry = (namespace) => maybeGetDatasourceContract(namespace,
|
|
4605
|
+
var maybeGetENSv2RootRegistry = (namespace) => maybeGetDatasourceContract(namespace, import_datasources12.DatasourceNames.ENSv2Root, "RootRegistry");
|
|
4932
4606
|
var maybeGetENSv2RootRegistryId = (namespace) => {
|
|
4933
4607
|
const root = maybeGetENSv2RootRegistry(namespace);
|
|
4934
4608
|
if (!root) return void 0;
|
|
4935
|
-
return makeRegistryId(root);
|
|
4609
|
+
return (0, import_enssdk13.makeRegistryId)(root);
|
|
4936
4610
|
};
|
|
4937
4611
|
|
|
4938
4612
|
// src/shared/url.ts
|
|
@@ -4943,6 +4617,16 @@ function isWebSocketProtocol(url) {
|
|
|
4943
4617
|
return ["ws:", "wss:"].includes(url.protocol);
|
|
4944
4618
|
}
|
|
4945
4619
|
|
|
4620
|
+
// src/stack-info/ensnode-stack-info.ts
|
|
4621
|
+
function buildEnsNodeStackInfo(ensApiPublicConfig, ensDbPublicConfig) {
|
|
4622
|
+
return {
|
|
4623
|
+
ensApi: ensApiPublicConfig,
|
|
4624
|
+
ensDb: ensDbPublicConfig,
|
|
4625
|
+
ensIndexer: ensApiPublicConfig.ensIndexerPublicConfig,
|
|
4626
|
+
ensRainbow: ensApiPublicConfig.ensIndexerPublicConfig.ensRainbowPublicConfig
|
|
4627
|
+
};
|
|
4628
|
+
}
|
|
4629
|
+
|
|
4946
4630
|
// src/subgraph-api/prerequisites.ts
|
|
4947
4631
|
function hasSubgraphApiConfigSupport(config) {
|
|
4948
4632
|
const supported = config.plugins.includes("subgraph" /* Subgraph */);
|