@ensnode/ensnode-sdk 0.0.0-next-20260408193027 → 0.0.0-next-20260408210304

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -17,7 +17,6 @@ var __copyProps = (to, from, except, desc) => {
17
17
  }
18
18
  return to;
19
19
  };
20
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
21
  // If the importer is in node compatibility mode or this is not an ESM
23
22
  // file that has been converted to a CommonJS file using a Babel-
@@ -31,25 +30,18 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
30
  // src/index.ts
32
31
  var index_exports = {};
33
32
  __export(index_exports, {
34
- ADDR_REVERSE_NODE: () => ADDR_REVERSE_NODE,
35
33
  ATTR_PROTOCOL_NAME: () => ATTR_PROTOCOL_NAME,
36
34
  ATTR_PROTOCOL_STEP: () => ATTR_PROTOCOL_STEP,
37
35
  ATTR_PROTOCOL_STEP_RESULT: () => ATTR_PROTOCOL_STEP_RESULT,
38
- BASENAMES_NODE: () => BASENAMES_NODE,
39
36
  ChainIndexingStatusIds: () => ChainIndexingStatusIds,
40
37
  ClientError: () => ClientError,
41
38
  CrossChainIndexingStrategyIds: () => CrossChainIndexingStrategyIds,
42
39
  CurrencyIds: () => CurrencyIds,
43
40
  DEFAULT_ENSNODE_API_URL_MAINNET: () => DEFAULT_ENSNODE_API_URL_MAINNET,
44
41
  DEFAULT_ENSNODE_API_URL_SEPOLIA: () => DEFAULT_ENSNODE_API_URL_SEPOLIA,
45
- DEFAULT_EVM_CHAIN_ID: () => DEFAULT_EVM_CHAIN_ID,
46
- DEFAULT_EVM_COIN_TYPE: () => DEFAULT_EVM_COIN_TYPE,
47
42
  ENCODED_REFERRER_BYTE_LENGTH: () => ENCODED_REFERRER_BYTE_LENGTH,
48
43
  ENCODED_REFERRER_BYTE_OFFSET: () => ENCODED_REFERRER_BYTE_OFFSET,
49
44
  ENSNamespaceIds: () => import_datasources13.ENSNamespaceIds,
50
- ENS_ROOT: () => ENS_ROOT,
51
- ETH_COIN_TYPE: () => ETH_COIN_TYPE,
52
- ETH_NODE: () => ETH_NODE,
53
45
  EXPECTED_ENCODED_REFERRER_PADDING: () => EXPECTED_ENCODED_REFERRER_PADDING,
54
46
  EnsApiClient: () => EnsApiClient,
55
47
  EnsApiIndexingStatusResponseCodes: () => EnsApiIndexingStatusResponseCodes,
@@ -57,11 +49,9 @@ __export(index_exports, {
57
49
  EnsIndexerIndexingStatusResponseCodes: () => EnsIndexerIndexingStatusResponseCodes,
58
50
  ForwardResolutionProtocolStep: () => ForwardResolutionProtocolStep,
59
51
  IndexingStatusResponseCodes: () => IndexingStatusResponseCodes,
60
- LINEANAMES_NODE: () => LINEANAMES_NODE,
61
52
  LruCache: () => LruCache,
62
53
  NFTMintStatuses: () => NFTMintStatuses,
63
54
  NFTTransferTypes: () => NFTTransferTypes,
64
- NODE_ANY: () => NODE_ANY,
65
55
  NameTokenOwnershipTypes: () => NameTokenOwnershipTypes,
66
56
  NameTokensResponseCodes: () => NameTokensResponseCodes,
67
57
  NameTokensResponseErrorCodes: () => NameTokensResponseErrorCodes,
@@ -70,8 +60,6 @@ __export(index_exports, {
70
60
  PluginName: () => PluginName,
71
61
  RECORDS_PER_PAGE_DEFAULT: () => RECORDS_PER_PAGE_DEFAULT,
72
62
  RECORDS_PER_PAGE_MAX: () => RECORDS_PER_PAGE_MAX,
73
- ROOT_NODE: () => ROOT_NODE,
74
- ROOT_RESOURCE: () => ROOT_RESOURCE,
75
63
  RangeTypeIds: () => RangeTypeIds,
76
64
  RegistrarActionTypes: () => RegistrarActionTypes,
77
65
  RegistrarActionsFilterTypes: () => RegistrarActionsFilterTypes,
@@ -88,11 +76,7 @@ __export(index_exports, {
88
76
  accountIdEqual: () => accountIdEqual,
89
77
  addDuration: () => addDuration,
90
78
  addPrices: () => addPrices,
91
- addrReverseLabel: () => addrReverseLabel,
92
- asLowerCaseAddress: () => asLowerCaseAddress,
93
- beautifyName: () => beautifyName,
94
79
  bigIntToNumber: () => bigIntToNumber,
95
- bigintToCoinType: () => bigintToCoinType,
96
80
  buildAssetId: () => buildAssetId,
97
81
  buildBlockNumberRange: () => buildBlockNumberRange,
98
82
  buildBlockRefRange: () => buildBlockRefRange,
@@ -113,12 +97,7 @@ __export(index_exports, {
113
97
  checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted: () => checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted,
114
98
  checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing: () => checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing,
115
99
  checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted: () => checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted,
116
- coinTypeReverseLabel: () => coinTypeReverseLabel,
117
- coinTypeToEvmChainId: () => coinTypeToEvmChainId,
118
- constructSubInterpretedName: () => constructSubInterpretedName,
119
100
  createRealtimeIndexingStatusProjection: () => createRealtimeIndexingStatusProjection,
120
- decodeDNSEncodedLiteralName: () => decodeDNSEncodedLiteralName,
121
- decodeDNSEncodedName: () => decodeDNSEncodedName,
122
101
  decodeEncodedReferrer: () => decodeEncodedReferrer,
123
102
  deserializeAssetId: () => deserializeAssetId,
124
103
  deserializeBlockNumber: () => deserializeBlockNumber,
@@ -149,10 +128,6 @@ __export(index_exports, {
149
128
  deserializeUrl: () => deserializeUrl,
150
129
  deserializedNameTokensResponse: () => deserializedNameTokensResponse,
151
130
  durationBetween: () => durationBetween,
152
- encodeLabelHash: () => encodeLabelHash,
153
- encodedLabelToLabelhash: () => encodedLabelToLabelhash,
154
- ensureInterpretedLabel: () => ensureInterpretedLabel,
155
- evmChainIdToCoinType: () => evmChainIdToCoinType,
156
131
  formatNFTTransferEventMetadata: () => formatNFTTransferEventMetadata,
157
132
  getBasenamesSubregistryId: () => getBasenamesSubregistryId,
158
133
  getBasenamesSubregistryManagedName: () => getBasenamesSubregistryManagedName,
@@ -170,13 +145,11 @@ __export(index_exports, {
170
145
  getLineanamesSubregistryId: () => getLineanamesSubregistryId,
171
146
  getLineanamesSubregistryManagedName: () => getLineanamesSubregistryManagedName,
172
147
  getNFTTransferType: () => getNFTTransferType,
173
- getNameHierarchy: () => getNameHierarchy,
174
148
  getNameTokenOwnership: () => getNameTokenOwnership,
175
149
  getNameWrapperAccounts: () => getNameWrapperAccounts,
176
150
  getNamespaceSpecificValue: () => getNamespaceSpecificValue,
177
151
  getOmnichainIndexingCursor: () => getOmnichainIndexingCursor,
178
152
  getOmnichainIndexingStatus: () => getOmnichainIndexingStatus,
179
- getParentNameFQDN: () => getParentNameFQDN,
180
153
  getResolvePrimaryNameChainIdParam: () => getResolvePrimaryNameChainIdParam,
181
154
  getTimestampForHighestOmnichainKnownBlock: () => getTimestampForHighestOmnichainKnownBlock,
182
155
  getTimestampForLowestOmnichainStartBlock: () => getTimestampForLowestOmnichainStartBlock,
@@ -190,18 +163,9 @@ __export(index_exports, {
190
163
  interpretNameRecordValue: () => interpretNameRecordValue,
191
164
  interpretTextRecordKey: () => interpretTextRecordKey,
192
165
  interpretTextRecordValue: () => interpretTextRecordValue,
193
- interpretedLabelsToInterpretedName: () => interpretedLabelsToInterpretedName,
194
- interpretedLabelsToLabelHashPath: () => interpretedLabelsToLabelHashPath,
195
- interpretedNameToInterpretedLabels: () => interpretedNameToInterpretedLabels,
196
166
  isENSv1Registry: () => isENSv1Registry,
197
167
  isENSv2RootRegistry: () => isENSv2RootRegistry,
198
- isEncodedLabelHash: () => isEncodedLabelHash,
199
168
  isHttpProtocol: () => isHttpProtocol,
200
- isInterpetedLabel: () => isInterpetedLabel,
201
- isInterpretedName: () => isInterpretedName,
202
- isLabelHash: () => isLabelHash,
203
- isNormalizedLabel: () => isNormalizedLabel,
204
- isNormalizedName: () => isNormalizedName,
205
169
  isPccFuseSet: () => isPccFuseSet,
206
170
  isPriceCurrencyEqual: () => isPriceCurrencyEqual,
207
171
  isPriceEqual: () => isPriceEqual,
@@ -215,15 +179,10 @@ __export(index_exports, {
215
179
  isSubgraphCompatible: () => isSubgraphCompatible,
216
180
  isWebSocketProtocol: () => isWebSocketProtocol,
217
181
  labelHashToBytes: () => labelHashToBytes,
218
- labelhashLiteralLabel: () => labelhashLiteralLabel,
219
- literalLabelToInterpretedLabel: () => literalLabelToInterpretedLabel,
220
- literalLabelsToInterpretedName: () => literalLabelsToInterpretedName,
221
- literalLabelsToLiteralName: () => literalLabelsToLiteralName,
222
182
  makeContractMatcher: () => makeContractMatcher,
223
183
  makeENSApiPublicConfigSchema: () => makeENSApiPublicConfigSchema,
224
184
  makeEnsApiPublicConfigSchema: () => makeEnsApiPublicConfigSchema,
225
185
  makeSerializedEnsApiPublicConfigSchema: () => makeSerializedEnsApiPublicConfigSchema,
226
- makeSubdomainNode: () => makeSubdomainNode,
227
186
  maybeGetDatasourceContract: () => maybeGetDatasourceContract,
228
187
  maybeGetENSv2RootRegistry: () => maybeGetENSv2RootRegistry,
229
188
  maybeGetENSv2RootRegistryId: () => maybeGetENSv2RootRegistryId,
@@ -232,20 +191,14 @@ __export(index_exports, {
232
191
  parseAccountId: () => parseAccountId,
233
192
  parseAssetId: () => parseAssetId,
234
193
  parseDai: () => parseDai,
235
- parseEncodedLabelHash: () => parseEncodedLabelHash,
236
194
  parseEth: () => parseEth,
237
- parseLabelHash: () => parseLabelHash,
238
- parseLabelHashOrEncodedLabelHash: () => parseLabelHashOrEncodedLabelHash,
239
195
  parseNonNegativeInteger: () => parseNonNegativeInteger,
240
- parsePartialInterpretedName: () => parsePartialInterpretedName,
241
- parseReverseName: () => parseReverseName,
242
196
  parseTimestamp: () => parseTimestamp,
243
197
  parseUsdc: () => parseUsdc,
244
198
  priceDai: () => priceDai,
245
199
  priceEth: () => priceEth,
246
200
  priceUsdc: () => priceUsdc,
247
201
  registrarActionsFilter: () => registrarActionsFilter,
248
- reverseName: () => reverseName,
249
202
  scaleBigintByNumber: () => scaleBigintByNumber,
250
203
  scalePrice: () => scalePrice,
251
204
  serializeAssetId: () => serializeAssetId,
@@ -297,265 +250,12 @@ module.exports = __toCommonJS(index_exports);
297
250
  var import_datasources13 = require("@ensnode/datasources");
298
251
 
299
252
  // src/ens/index.ts
300
- var ens_exports = {};
301
- __export(ens_exports, {
302
- ADDR_REVERSE_NODE: () => ADDR_REVERSE_NODE,
303
- BASENAMES_NODE: () => BASENAMES_NODE,
304
- DEFAULT_EVM_CHAIN_ID: () => DEFAULT_EVM_CHAIN_ID,
305
- DEFAULT_EVM_COIN_TYPE: () => DEFAULT_EVM_COIN_TYPE,
306
- ENSNamespaceIds: () => import_datasources.ENSNamespaceIds,
307
- ENS_ROOT: () => ENS_ROOT,
308
- ETH_COIN_TYPE: () => ETH_COIN_TYPE,
309
- ETH_NODE: () => ETH_NODE,
310
- LINEANAMES_NODE: () => LINEANAMES_NODE,
311
- NODE_ANY: () => NODE_ANY,
312
- ROOT_NODE: () => ROOT_NODE,
313
- ROOT_RESOURCE: () => ROOT_RESOURCE,
314
- addrReverseLabel: () => addrReverseLabel,
315
- beautifyName: () => beautifyName,
316
- bigintToCoinType: () => bigintToCoinType,
317
- coinTypeReverseLabel: () => coinTypeReverseLabel,
318
- coinTypeToEvmChainId: () => coinTypeToEvmChainId,
319
- decodeDNSEncodedLiteralName: () => decodeDNSEncodedLiteralName,
320
- decodeDNSEncodedName: () => decodeDNSEncodedName,
321
- encodeLabelHash: () => encodeLabelHash,
322
- evmChainIdToCoinType: () => evmChainIdToCoinType,
323
- getENSRootChainId: () => import_datasources.getENSRootChainId,
324
- getNameHierarchy: () => getNameHierarchy,
325
- getParentNameFQDN: () => getParentNameFQDN,
326
- isEncodedLabelHash: () => isEncodedLabelHash,
327
- isLabelHash: () => isLabelHash,
328
- isNormalizedLabel: () => isNormalizedLabel,
329
- isNormalizedName: () => isNormalizedName,
330
- isPccFuseSet: () => isPccFuseSet,
331
- makeSubdomainNode: () => makeSubdomainNode,
332
- parseEncodedLabelHash: () => parseEncodedLabelHash,
333
- parseLabelHash: () => parseLabelHash,
334
- parseLabelHashOrEncodedLabelHash: () => parseLabelHashOrEncodedLabelHash,
335
- parseReverseName: () => parseReverseName,
336
- reverseName: () => reverseName
337
- });
338
- __reExport(ens_exports, require("enssdk"));
339
253
  var import_datasources = require("@ensnode/datasources");
340
254
 
341
- // src/ens/coin-type.ts
342
- var import_utils = require("@ensdomains/address-encoder/utils");
343
- var ETH_COIN_TYPE = 60;
344
- var DEFAULT_EVM_CHAIN_ID = 0;
345
- var DEFAULT_EVM_COIN_TYPE = 2147483648;
346
- var coinTypeToEvmChainId = (coinType) => {
347
- if (coinType === ETH_COIN_TYPE) return 1;
348
- return (0, import_utils.coinTypeToEvmChainId)(coinType);
349
- };
350
- var evmChainIdToCoinType = (chainId) => {
351
- if (chainId === 1) return ETH_COIN_TYPE;
352
- return (0, import_utils.evmChainIdToCoinType)(chainId);
353
- };
354
- var bigintToCoinType = (value) => {
355
- if (value > BigInt(Number.MAX_SAFE_INTEGER)) {
356
- throw new Error(`'${value}' cannot represent as CoinType, it is too large.`);
357
- }
358
- return Number(value);
359
- };
360
-
361
- // src/ens/constants.ts
362
- var import_viem = require("viem");
363
- var ROOT_NODE = (0, import_viem.namehash)("");
364
- var ETH_NODE = (0, import_viem.namehash)("eth");
365
- var BASENAMES_NODE = (0, import_viem.namehash)("base.eth");
366
- var LINEANAMES_NODE = (0, import_viem.namehash)("linea.eth");
367
- var ADDR_REVERSE_NODE = (0, import_viem.namehash)("addr.reverse");
368
- var NODE_ANY = import_viem.zeroHash;
369
- var ROOT_RESOURCE = 0n;
370
-
371
- // src/ens/dns-encoded-name.ts
372
- var import_viem2 = require("viem");
373
- function decodeDNSEncodedLiteralName(packet) {
374
- return decodeDNSEncodedName(packet);
375
- }
376
- function decodeDNSEncodedName(packet) {
377
- const segments = [];
378
- const bytes = (0, import_viem2.hexToBytes)(packet);
379
- if (bytes.length === 0) throw new Error(`Packet is empty.`);
380
- let offset = 0;
381
- while (offset < bytes.length) {
382
- const len = bytes[offset];
383
- if (len === void 0) {
384
- throw new Error(`Invariant: bytes[offset] is undefined after offset < bytes.length check.`);
385
- }
386
- if (len < 0 || len > 255) {
387
- throw new Error(
388
- `Invariant: this should be literally impossible, but an unsigned byte was less than zero or greater than 255. The value in question is ${len}`
389
- );
390
- }
391
- if (len === 0) break;
392
- const segment = (0, import_viem2.bytesToString)(bytes.subarray(offset + 1, offset + len + 1));
393
- segments.push(segment);
394
- offset += len + 1;
395
- }
396
- if (offset >= bytes.length) throw new Error(`Overflow, offset >= bytes.length`);
397
- if (offset !== bytes.length - 1) throw new Error(`Junk at end of name`);
398
- return segments;
399
- }
400
-
401
- // src/ens/labelhash.ts
402
- var import_viem3 = require("viem");
403
- function isLabelHash(maybeLabelHash) {
404
- const expectedLength = maybeLabelHash.length === 66;
405
- const expectedEncoding = (0, import_viem3.isHex)(maybeLabelHash);
406
- const expectedCasing = maybeLabelHash === maybeLabelHash.toLowerCase();
407
- return expectedLength && expectedEncoding && expectedCasing;
408
- }
409
-
410
- // src/ens/encode-labelhash.ts
411
- var encodeLabelHash = (labelHash) => `[${labelHash.slice(2)}]`;
412
- function isEncodedLabelHash(maybeEncodedLabelHash) {
413
- const expectedFormatting = maybeEncodedLabelHash.startsWith("[") && maybeEncodedLabelHash.endsWith("]");
414
- const includesLabelHash = isLabelHash(`0x${maybeEncodedLabelHash.slice(1, -1)}`);
415
- return expectedFormatting && includesLabelHash;
416
- }
417
-
418
255
  // src/ens/fuses.ts
419
256
  var PARENT_CANNOT_CONTROL = 65536;
420
257
  var isPccFuseSet = (fuses) => (fuses & PARENT_CANNOT_CONTROL) === PARENT_CANNOT_CONTROL;
421
258
 
422
- // src/ens/is-normalized.ts
423
- var import_ens = require("viem/ens");
424
- function isNormalizedName(name) {
425
- try {
426
- return name === (0, import_ens.normalize)(name);
427
- } catch {
428
- return false;
429
- }
430
- }
431
- function isNormalizedLabel(label) {
432
- if (label === "") return false;
433
- if (label.includes(".")) return false;
434
- try {
435
- return label === (0, import_ens.normalize)(label);
436
- } catch {
437
- return false;
438
- }
439
- }
440
-
441
- // src/ens/names.ts
442
- var import_ens_normalize = require("@adraffy/ens-normalize");
443
- var ENS_ROOT = "";
444
- var getNameHierarchy = (name) => name.split(".").map((_, i, labels) => labels.slice(i).join("."));
445
- var getParentNameFQDN = (name) => {
446
- if (name === ENS_ROOT) {
447
- throw new Error("There is no parent name for ENS Root.");
448
- }
449
- const labels = name.split(".");
450
- if (labels.length === 1) {
451
- return ENS_ROOT;
452
- }
453
- return labels.slice(1).join(".");
454
- };
455
- var beautifyName = (name) => {
456
- const beautifiedLabels = name.split(".").map((label) => {
457
- if (isNormalizedLabel(label)) {
458
- return (0, import_ens_normalize.ens_beautify)(label);
459
- } else {
460
- return label;
461
- }
462
- });
463
- return beautifiedLabels.join(".");
464
- };
465
-
466
- // src/ens/parse-labelhash.ts
467
- var import_viem4 = require("viem");
468
- function parseLabelHash(maybeLabelHash) {
469
- const hexPart = maybeLabelHash.startsWith("0x") ? maybeLabelHash.slice(2) : maybeLabelHash;
470
- if (!(0, import_viem4.isHex)(`0x${hexPart}`, { strict: true })) {
471
- throw new Error(`Invalid labelHash: contains non-hex characters: ${maybeLabelHash}`);
472
- }
473
- const normalizedHexPart = hexPart.length % 2 === 1 ? `0${hexPart}` : hexPart;
474
- if (normalizedHexPart.length !== 64) {
475
- throw new Error(
476
- `Invalid labelHash length: expected 32 bytes (64 hex chars), got ${normalizedHexPart.length / 2} bytes: ${maybeLabelHash}`
477
- );
478
- }
479
- return `0x${normalizedHexPart.toLowerCase()}`;
480
- }
481
- function parseEncodedLabelHash(maybeEncodedLabelHash) {
482
- if (!maybeEncodedLabelHash.startsWith("[") || !maybeEncodedLabelHash.endsWith("]")) {
483
- throw new Error(
484
- `Invalid encoded labelHash: must be enclosed in square brackets: ${maybeEncodedLabelHash}`
485
- );
486
- }
487
- return parseLabelHash(maybeEncodedLabelHash.slice(1, -1));
488
- }
489
- function parseLabelHashOrEncodedLabelHash(maybeLabelHash) {
490
- if (maybeLabelHash.startsWith("[") && maybeLabelHash.endsWith("]")) {
491
- return parseEncodedLabelHash(maybeLabelHash);
492
- }
493
- return parseLabelHash(maybeLabelHash);
494
- }
495
-
496
- // src/ens/parse-reverse-name.ts
497
- var import_viem5 = require("viem");
498
-
499
- // src/shared/address.ts
500
- function asLowerCaseAddress(address) {
501
- return address.toLowerCase();
502
- }
503
-
504
- // src/ens/parse-reverse-name.ts
505
- var REVERSE_NAME_REGEX = /^([0-9a-fA-F]+)\.([0-9a-f]{1,64}|addr|default)\.reverse$/;
506
- var parseAddressLabel = (addressLabel) => {
507
- const maybeAddress = `0x${addressLabel}`;
508
- if (!(0, import_viem5.isAddress)(maybeAddress)) {
509
- throw new Error(`Invalid EVM address "${maybeAddress}"`);
510
- }
511
- return asLowerCaseAddress(maybeAddress);
512
- };
513
- var parseCoinTypeLabel = (coinTypeLabel) => {
514
- if (coinTypeLabel === "default") return DEFAULT_EVM_COIN_TYPE;
515
- if (coinTypeLabel === "addr") return ETH_COIN_TYPE;
516
- return bigintToCoinType((0, import_viem5.hexToBigInt)(`0x${coinTypeLabel}`));
517
- };
518
- function parseReverseName(name) {
519
- const match = name.match(REVERSE_NAME_REGEX);
520
- if (!match) return null;
521
- try {
522
- const [, addressLabel, coinTypeLabel] = match;
523
- if (!addressLabel) return null;
524
- if (!coinTypeLabel) return null;
525
- return {
526
- address: parseAddressLabel(addressLabel),
527
- coinType: parseCoinTypeLabel(coinTypeLabel)
528
- };
529
- } catch {
530
- return null;
531
- }
532
- }
533
-
534
- // src/ens/reverse-name.ts
535
- var addrReverseLabel = (address) => address.slice(2);
536
- var coinTypeReverseLabel = (coinType) => coinType.toString(16);
537
- function reverseName(address, coinType) {
538
- const label = addrReverseLabel(address);
539
- const middle = (() => {
540
- switch (coinType) {
541
- case ETH_COIN_TYPE:
542
- return "addr";
543
- case DEFAULT_EVM_COIN_TYPE:
544
- return "default";
545
- default:
546
- return coinTypeReverseLabel(coinType);
547
- }
548
- })();
549
- return `${label}.${middle}.reverse`;
550
- }
551
-
552
- // src/ens/subname-helpers.ts
553
- var import_viem6 = require("viem");
554
- var makeSubdomainNode = (labelHash, node) => (0, import_viem6.keccak256)((0, import_viem6.concat)([node, labelHash]));
555
-
556
- // src/index.ts
557
- __reExport(index_exports, ens_exports, module.exports);
558
-
559
259
  // src/ensapi/config/deserialize.ts
560
260
  var import_v47 = require("zod/v4");
561
261
 
@@ -570,11 +270,12 @@ var import_v42 = require("zod/v4");
570
270
 
571
271
  // src/shared/zod-schemas.ts
572
272
  var import_caip = require("caip");
573
- var import_viem9 = require("viem");
273
+ var import_enssdk = require("enssdk");
274
+ var import_viem2 = require("viem");
574
275
  var import_v4 = require("zod/v4");
575
276
 
576
277
  // src/shared/currencies.ts
577
- var import_viem7 = require("viem");
278
+ var import_viem = require("viem");
578
279
 
579
280
  // src/shared/numbers.ts
580
281
  function bigIntToNumber(n) {
@@ -709,42 +410,22 @@ function validateAmountToParse(value) {
709
410
  function parseEth(value) {
710
411
  validateAmountToParse(value);
711
412
  const currencyInfo2 = getCurrencyInfo(CurrencyIds.ETH);
712
- const amount = (0, import_viem7.parseUnits)(value, currencyInfo2.decimals);
413
+ const amount = (0, import_viem.parseUnits)(value, currencyInfo2.decimals);
713
414
  return priceEth(amount);
714
415
  }
715
416
  function parseUsdc(value) {
716
417
  validateAmountToParse(value);
717
418
  const currencyInfo2 = getCurrencyInfo(CurrencyIds.USDC);
718
- const amount = (0, import_viem7.parseUnits)(value, currencyInfo2.decimals);
419
+ const amount = (0, import_viem.parseUnits)(value, currencyInfo2.decimals);
719
420
  return priceUsdc(amount);
720
421
  }
721
422
  function parseDai(value) {
722
423
  validateAmountToParse(value);
723
424
  const currencyInfo2 = getCurrencyInfo(CurrencyIds.DAI);
724
- const amount = (0, import_viem7.parseUnits)(value, currencyInfo2.decimals);
425
+ const amount = (0, import_viem.parseUnits)(value, currencyInfo2.decimals);
725
426
  return priceDai(amount);
726
427
  }
727
428
 
728
- // src/shared/interpretation/reinterpretation.ts
729
- var import_viem8 = require("viem");
730
- function reinterpretLabel(label) {
731
- if (label === "") {
732
- throw new Error(
733
- `Cannot reinterpret an empty label that violates the invariants of an InterpretedLabel.`
734
- );
735
- }
736
- if (isEncodedLabelHash(label)) return label;
737
- if (isNormalizedLabel(label)) return label;
738
- return encodeLabelHash((0, import_viem8.labelhash)(label));
739
- }
740
- function reinterpretName(name) {
741
- if (name === "") return name;
742
- const interpretedLabels = name.split(".");
743
- const reinterpretedLabels = interpretedLabels.map(reinterpretLabel);
744
- const reinterpretedName = reinterpretedLabels.join(".");
745
- return reinterpretedName;
746
- }
747
-
748
429
  // src/shared/zod-schemas.ts
749
430
  var makeIntegerSchema = (valueLabel = "Value") => import_v4.z.int({
750
431
  error: `${valueLabel} must be an integer.`
@@ -761,14 +442,14 @@ var makeDurationSchema = (valueLabel = "Value") => import_v4.z.number({
761
442
  var makeChainIdSchema = (valueLabel = "Chain ID") => makePositiveIntegerSchema(valueLabel).transform((val) => val);
762
443
  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}`));
763
444
  var makeLowercaseAddressSchema = (valueLabel = "EVM address") => import_v4.z.string().check((ctx) => {
764
- if (!(0, import_viem9.isAddress)(ctx.value)) {
445
+ if (!(0, import_viem2.isAddress)(ctx.value)) {
765
446
  ctx.issues.push({
766
447
  code: "custom",
767
448
  message: `${valueLabel} must be a valid EVM address`,
768
449
  input: ctx.value
769
450
  });
770
451
  }
771
- }).transform((val) => asLowerCaseAddress(val));
452
+ }).transform((val) => (0, import_enssdk.asLowerCaseAddress)(val));
772
453
  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));
773
454
  var makeUnixTimestampSchema = (valueLabel = "Timestamp") => makeIntegerSchema(valueLabel);
774
455
  var makeUrlSchema = (valueLabel = "Value") => import_v4.z.url({
@@ -816,7 +497,7 @@ var makeAccountIdStringSchema = (valueLabel = "Account ID String") => import_v4.
816
497
  };
817
498
  }).pipe(makeAccountIdSchema(valueLabel));
818
499
  var makeHexStringSchema = (options, valueLabel = "String representation of bytes array") => import_v4.z.string().check(function invariant_isHexEncoded(ctx) {
819
- if (!(0, import_viem9.isHex)(ctx.value)) {
500
+ if (!(0, import_viem2.isHex)(ctx.value)) {
820
501
  ctx.issues.push({
821
502
  code: "custom",
822
503
  input: ctx.value,
@@ -825,7 +506,7 @@ var makeHexStringSchema = (options, valueLabel = "String representation of bytes
825
506
  }
826
507
  }).transform((v) => v).check(function invariant_encodesRequiredBytesCount(ctx) {
827
508
  const expectedBytesCount = options.bytesCount;
828
- const actualBytesCount = (0, import_viem9.size)(ctx.value);
509
+ const actualBytesCount = (0, import_viem2.size)(ctx.value);
829
510
  if (actualBytesCount !== expectedBytesCount) {
830
511
  ctx.issues.push({
831
512
  code: "custom",
@@ -838,7 +519,7 @@ var makeNodeSchema = (valueLabel = "Node") => makeHexStringSchema({ bytesCount:
838
519
  var makeTransactionHashSchema = (valueLabel = "Transaction hash") => makeHexStringSchema({ bytesCount: 32 }, valueLabel);
839
520
  var makeReinterpretedNameSchema = (valueLabel = "Reinterpreted Name") => import_v4.z.string().transform((v) => v).check((ctx) => {
840
521
  try {
841
- reinterpretName(ctx.value);
522
+ (0, import_enssdk.reinterpretName)(ctx.value);
842
523
  } catch (error) {
843
524
  const errorMessage = error instanceof Error ? error.message : "Unknown error";
844
525
  ctx.issues.push({
@@ -847,7 +528,7 @@ var makeReinterpretedNameSchema = (valueLabel = "Reinterpreted Name") => import_
847
528
  message: `${valueLabel} cannot be reinterpreted: ${errorMessage}`
848
529
  });
849
530
  }
850
- }).transform(reinterpretName);
531
+ }).transform(import_enssdk.reinterpretName);
851
532
 
852
533
  // src/ensrainbow/zod-schemas/config.ts
853
534
  var makeLabelSetIdSchema = (valueLabel = "Label set ID") => {
@@ -2273,17 +1954,18 @@ var serializeIndexingStatusResponse = serializeEnsApiIndexingStatusResponse;
2273
1954
  var import_v423 = require("zod/v4");
2274
1955
 
2275
1956
  // src/ensapi/api/name-tokens/zod-schemas.ts
2276
- var import_viem14 = require("viem");
1957
+ var import_enssdk5 = require("enssdk");
2277
1958
  var import_v422 = require("zod/v4");
2278
1959
 
2279
1960
  // src/tokenscope/name-token.ts
2280
- var import_viem13 = require("viem");
1961
+ var import_enssdk4 = require("enssdk");
1962
+ var import_viem6 = require("viem");
2281
1963
  var import_datasources4 = require("@ensnode/datasources");
2282
1964
 
2283
1965
  // src/shared/account-id.ts
2284
- var import_viem10 = require("viem");
1966
+ var import_viem3 = require("viem");
2285
1967
  var accountIdEqual = (a, b) => {
2286
- return a.chainId === b.chainId && (0, import_viem10.isAddressEqual)(a.address, b.address);
1968
+ return a.chainId === b.chainId && (0, import_viem3.isAddressEqual)(a.address, b.address);
2287
1969
  };
2288
1970
 
2289
1971
  // src/shared/datasource-contract.ts
@@ -2313,14 +1995,14 @@ var makeContractMatcher = (namespace, b) => (datasourceName, contractName) => {
2313
1995
  };
2314
1996
 
2315
1997
  // src/tokenscope/assets.ts
2316
- var import_enssdk2 = require("enssdk");
2317
- var import_viem12 = require("viem");
1998
+ var import_enssdk3 = require("enssdk");
1999
+ var import_viem5 = require("viem");
2318
2000
  var import_v420 = require("zod/v4");
2319
2001
 
2320
2002
  // src/tokenscope/zod-schemas.ts
2321
2003
  var import_caip2 = require("caip");
2322
- var import_enssdk = require("enssdk");
2323
- var import_viem11 = require("viem");
2004
+ var import_enssdk2 = require("enssdk");
2005
+ var import_viem4 = require("viem");
2324
2006
  var import_v419 = require("zod/v4");
2325
2007
  var tokenIdSchemaSerializable = import_v419.z.string();
2326
2008
  var tokenIdSchemaNative = import_v419.z.preprocess(
@@ -2336,7 +2018,7 @@ function makeTokenIdSchema(_valueLabel = "Token ID Schema", serializable = false
2336
2018
  }
2337
2019
  var makeAssetIdSchema = (valueLabel = "Asset ID Schema", serializable) => {
2338
2020
  return import_v419.z.object({
2339
- assetNamespace: import_v419.z.enum(import_enssdk.AssetNamespaces),
2021
+ assetNamespace: import_v419.z.enum(import_enssdk2.AssetNamespaces),
2340
2022
  contract: makeAccountIdSchema(valueLabel),
2341
2023
  tokenId: makeTokenIdSchema(valueLabel, serializable ?? false)
2342
2024
  });
@@ -2357,7 +2039,7 @@ var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") => import_
2357
2039
  }, makeAssetIdSchema(valueLabel));
2358
2040
  function invariant_nameTokenOwnershipHasNonZeroAddressOwner(ctx) {
2359
2041
  const ownership = ctx.value;
2360
- if (ctx.value.owner.address === import_viem11.zeroAddress) {
2042
+ if (ctx.value.owner.address === import_viem4.zeroAddress) {
2361
2043
  ctx.issues.push({
2362
2044
  code: "custom",
2363
2045
  input: ctx.value,
@@ -2383,7 +2065,7 @@ var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Un
2383
2065
  }).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
2384
2066
  function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
2385
2067
  const ownership = ctx.value;
2386
- if (ctx.value.owner.address !== import_viem11.zeroAddress) {
2068
+ if (ctx.value.owner.address !== import_viem4.zeroAddress) {
2387
2069
  ctx.issues.push({
2388
2070
  code: "custom",
2389
2071
  input: ctx.value,
@@ -2449,7 +2131,7 @@ var NFTMintStatuses = {
2449
2131
  Burned: "burned"
2450
2132
  };
2451
2133
  var formatNFTTransferEventMetadata = (metadata) => {
2452
- const assetIdString = (0, import_enssdk2.stringifyAssetId)(metadata.nft);
2134
+ const assetIdString = (0, import_enssdk3.stringifyAssetId)(metadata.nft);
2453
2135
  return [
2454
2136
  `Event: ${metadata.eventHandlerName}`,
2455
2137
  `Chain ID: ${metadata.chainId}`,
@@ -2561,11 +2243,11 @@ var NFTTransferTypes = {
2561
2243
  };
2562
2244
  var getNFTTransferType = (from, to, allowMintedRemint, metadata, currentlyIndexedOwner) => {
2563
2245
  const isIndexed = currentlyIndexedOwner !== void 0;
2564
- const isIndexedAsMinted = isIndexed && !(0, import_viem12.isAddressEqual)(currentlyIndexedOwner, import_viem12.zeroAddress);
2565
- const isMint = (0, import_viem12.isAddressEqual)(from, import_viem12.zeroAddress);
2566
- const isBurn = (0, import_viem12.isAddressEqual)(to, import_viem12.zeroAddress);
2567
- const isSelfTransfer = (0, import_viem12.isAddressEqual)(from, to);
2568
- if (isIndexed && !(0, import_viem12.isAddressEqual)(currentlyIndexedOwner, from)) {
2246
+ const isIndexedAsMinted = isIndexed && !(0, import_viem5.isAddressEqual)(currentlyIndexedOwner, import_viem5.zeroAddress);
2247
+ const isMint = (0, import_viem5.isAddressEqual)(from, import_viem5.zeroAddress);
2248
+ const isBurn = (0, import_viem5.isAddressEqual)(to, import_viem5.zeroAddress);
2249
+ const isSelfTransfer = (0, import_viem5.isAddressEqual)(from, to);
2250
+ if (isIndexed && !(0, import_viem5.isAddressEqual)(currentlyIndexedOwner, from)) {
2569
2251
  if (isMint && allowMintedRemint) {
2570
2252
  } else {
2571
2253
  throw new Error(
@@ -2706,13 +2388,13 @@ function getNameTokenOwnership(namespaceId, name, owner) {
2706
2388
  owner
2707
2389
  };
2708
2390
  }
2709
- if ((0, import_viem13.isAddressEqual)(owner.address, import_viem13.zeroAddress)) {
2391
+ if ((0, import_viem6.isAddressEqual)(owner.address, import_viem6.zeroAddress)) {
2710
2392
  return {
2711
2393
  ownershipType: NameTokenOwnershipTypes.Burned,
2712
2394
  owner
2713
2395
  };
2714
2396
  }
2715
- const parentName = getParentNameFQDN(name);
2397
+ const parentName = (0, import_enssdk4.getParentNameFQDN)(name);
2716
2398
  if (parentName === "eth") {
2717
2399
  return {
2718
2400
  ownershipType: NameTokenOwnershipTypes.FullyOnchain,
@@ -2776,7 +2458,7 @@ var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", seria
2776
2458
  accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
2777
2459
  }).check(function invariant_nameIsAssociatedWithDomainId(ctx) {
2778
2460
  const { name, domainId } = ctx.value;
2779
- if ((0, import_viem14.namehash)(name) !== domainId) {
2461
+ if ((0, import_enssdk5.namehashInterpretedName)(name) !== domainId) {
2780
2462
  ctx.issues.push({
2781
2463
  code: "custom",
2782
2464
  input: ctx.value,
@@ -2928,41 +2610,41 @@ function serializeNameTokensResponse(response) {
2928
2610
  var import_v427 = require("zod/v4");
2929
2611
 
2930
2612
  // src/ensapi/api/registrar-actions/zod-schemas.ts
2931
- var import_ens5 = require("viem/ens");
2613
+ var import_enssdk6 = require("enssdk");
2932
2614
  var import_v426 = require("zod/v4");
2933
2615
 
2934
2616
  // src/registrars/zod-schemas.ts
2935
2617
  var import_v424 = require("zod/v4");
2936
2618
 
2937
2619
  // src/registrars/encoded-referrer.ts
2938
- var import_viem15 = require("viem");
2620
+ var import_viem7 = require("viem");
2939
2621
  var ENCODED_REFERRER_BYTE_OFFSET = 12;
2940
2622
  var ENCODED_REFERRER_BYTE_LENGTH = 32;
2941
- var EXPECTED_ENCODED_REFERRER_PADDING = (0, import_viem15.pad)("0x", {
2623
+ var EXPECTED_ENCODED_REFERRER_PADDING = (0, import_viem7.pad)("0x", {
2942
2624
  size: ENCODED_REFERRER_BYTE_OFFSET,
2943
2625
  dir: "left"
2944
2626
  });
2945
- var ZERO_ENCODED_REFERRER = (0, import_viem15.pad)("0x", {
2627
+ var ZERO_ENCODED_REFERRER = (0, import_viem7.pad)("0x", {
2946
2628
  size: ENCODED_REFERRER_BYTE_LENGTH,
2947
2629
  dir: "left"
2948
2630
  });
2949
2631
  function buildEncodedReferrer(address) {
2950
2632
  const lowercaseAddress = address.toLowerCase();
2951
- return (0, import_viem15.pad)(lowercaseAddress, { size: ENCODED_REFERRER_BYTE_LENGTH, dir: "left" });
2633
+ return (0, import_viem7.pad)(lowercaseAddress, { size: ENCODED_REFERRER_BYTE_LENGTH, dir: "left" });
2952
2634
  }
2953
2635
  function decodeEncodedReferrer(encodedReferrer) {
2954
- if ((0, import_viem15.size)(encodedReferrer) !== ENCODED_REFERRER_BYTE_LENGTH) {
2636
+ if ((0, import_viem7.size)(encodedReferrer) !== ENCODED_REFERRER_BYTE_LENGTH) {
2955
2637
  throw new Error(
2956
2638
  `Encoded referrer value must be represented by ${ENCODED_REFERRER_BYTE_LENGTH} bytes.`
2957
2639
  );
2958
2640
  }
2959
- const padding = (0, import_viem15.slice)(encodedReferrer, 0, ENCODED_REFERRER_BYTE_OFFSET);
2641
+ const padding = (0, import_viem7.slice)(encodedReferrer, 0, ENCODED_REFERRER_BYTE_OFFSET);
2960
2642
  if (padding !== EXPECTED_ENCODED_REFERRER_PADDING) {
2961
- return import_viem15.zeroAddress;
2643
+ return import_viem7.zeroAddress;
2962
2644
  }
2963
- const decodedReferrer = (0, import_viem15.slice)(encodedReferrer, ENCODED_REFERRER_BYTE_OFFSET);
2645
+ const decodedReferrer = (0, import_viem7.slice)(encodedReferrer, ENCODED_REFERRER_BYTE_OFFSET);
2964
2646
  try {
2965
- return (0, import_viem15.getAddress)(decodedReferrer);
2647
+ return (0, import_viem7.getAddress)(decodedReferrer);
2966
2648
  } catch {
2967
2649
  throw new Error(`Decoded referrer value must be a valid EVM address.`);
2968
2650
  }
@@ -3197,7 +2879,7 @@ var RegistrarActionsResponseCodes = {
3197
2879
  function invariant_registrationLifecycleNodeMatchesName(ctx) {
3198
2880
  const { name, action } = ctx.value;
3199
2881
  const expectedNode = action.registrationLifecycle.node;
3200
- const actualNode = (0, import_ens5.namehash)(name);
2882
+ const actualNode = (0, import_enssdk6.namehashInterpretedName)(name);
3201
2883
  if (actualNode !== expectedNode) {
3202
2884
  ctx.issues.push({
3203
2885
  code: "custom",
@@ -3703,7 +3385,9 @@ var EnsApiClient = class _EnsApiClient {
3703
3385
  * registrarActionsFilter,
3704
3386
  * EnsApiClient,
3705
3387
  * } from "@ensnode/ensnode-sdk";
3706
- * import { namehash } from "viem/ens";
3388
+ * import { ETH_NODE, namehashInterpretedName, asInterpretedName } from "enssdk";
3389
+ *
3390
+ * const BASE_NODE = namehashInterpretedName(asInterpretedName("base.eth"));
3707
3391
  *
3708
3392
  * const client: EnsApiClient;
3709
3393
  *
@@ -3725,7 +3409,7 @@ var EnsApiClient = class _EnsApiClient {
3725
3409
  * // get latest registrar action records associated with
3726
3410
  * // subregistry managing `eth` name
3727
3411
  * await client.registrarActions({
3728
- * filters: [registrarActionsFilter.byParentNode(namehash('eth'))],
3412
+ * filters: [registrarActionsFilter.byParentNode(ETH_NODE)],
3729
3413
  * });
3730
3414
  *
3731
3415
  * // get latest registrar action records which include referral info
@@ -3741,7 +3425,7 @@ var EnsApiClient = class _EnsApiClient {
3741
3425
  * // get latest 10 registrar action records associated with
3742
3426
  * // subregistry managing `base.eth` name
3743
3427
  * await client.registrarActions({
3744
- * filters: [registrarActionsFilter.byParentNode(namehash('base.eth'))],
3428
+ * filters: [registrarActionsFilter.byParentNode(BASE_NODE)],
3745
3429
  * recordsPerPage: 10
3746
3430
  * });
3747
3431
  *
@@ -3870,17 +3554,20 @@ var EnsApiClient = class _EnsApiClient {
3870
3554
  * import {
3871
3555
  * EnsApiClient,
3872
3556
  * } from "@ensnode/ensnode-sdk";
3873
- * import { namehash } from "viem/ens";
3557
+ * import { namehashInterpretedName, asInterpretedName } from "enssdk";
3558
+ *
3559
+ * const VITALIK_NAME = asInterpretedName("vitalik.eth");
3560
+ * const VITALIK_DOMAIN_ID = namehashInterpretedName(VITALIK_NAME);
3874
3561
  *
3875
3562
  * const client: EnsApiClient;
3876
3563
  *
3877
3564
  * // get latest name token records from the indexed subregistry based on the requested name
3878
3565
  * const response = await client.nameTokens({
3879
- * name: "vitalik.eth"
3566
+ * name: VITALIK_NAME,
3880
3567
  * });
3881
3568
  *
3882
3569
  * const response = await client.nameTokens({
3883
- * domainId: "0xee6c4522aab0003e8d14cd40a6af439055fd2577951148c14b6cea9a53475835" // namehash('vitalik.eth')
3570
+ * domainId: VITALIK_DOMAIN_ID,
3884
3571
  * })
3885
3572
  * ```
3886
3573
  */
@@ -4151,7 +3838,7 @@ function validateEnsIndexerPublicConfigCompatibility(configA, configB) {
4151
3838
  }
4152
3839
 
4153
3840
  // src/ensindexer/config/label-utils.ts
4154
- var import_viem16 = require("viem");
3841
+ var import_viem8 = require("viem");
4155
3842
  function labelHashToBytes(labelHash) {
4156
3843
  try {
4157
3844
  if (labelHash.length !== 66) {
@@ -4163,7 +3850,7 @@ function labelHashToBytes(labelHash) {
4163
3850
  if (!labelHash.startsWith("0x")) {
4164
3851
  throw new Error("Labelhash must be 0x-prefixed");
4165
3852
  }
4166
- const bytes = (0, import_viem16.hexToBytes)(labelHash);
3853
+ const bytes = (0, import_viem8.hexToBytes)(labelHash);
4167
3854
  if (bytes.length !== 32) {
4168
3855
  throw new Error(`Invalid labelHash length ${bytes.length} bytes (expected 32)`);
4169
3856
  }
@@ -4321,6 +4008,7 @@ function hasOmnigraphApiConfigSupport(config) {
4321
4008
  }
4322
4009
 
4323
4010
  // src/registrars/basenames-subregistry.ts
4011
+ var import_enssdk7 = require("enssdk");
4324
4012
  var import_datasources7 = require("@ensnode/datasources");
4325
4013
  function getBasenamesSubregistryId(namespace) {
4326
4014
  const datasource = (0, import_datasources7.maybeGetDatasource)(namespace, import_datasources7.DatasourceNames.Basenames);
@@ -4331,18 +4019,15 @@ function getBasenamesSubregistryId(namespace) {
4331
4019
  if (address === void 0 || Array.isArray(address)) {
4332
4020
  throw new Error(`BaseRegistrar contract not found or has multiple addresses for ${namespace}`);
4333
4021
  }
4334
- return {
4335
- chainId: datasource.chain.id,
4336
- address
4337
- };
4022
+ return { chainId: datasource.chain.id, address };
4338
4023
  }
4339
4024
  function getBasenamesSubregistryManagedName(namespaceId) {
4340
4025
  switch (namespaceId) {
4341
4026
  case import_datasources7.ENSNamespaceIds.Mainnet:
4342
- return "base.eth";
4027
+ return (0, import_enssdk7.asInterpretedName)("base.eth");
4343
4028
  case import_datasources7.ENSNamespaceIds.Sepolia:
4344
4029
  case import_datasources7.ENSNamespaceIds.SepoliaV2:
4345
- return "basetest.eth";
4030
+ return (0, import_enssdk7.asInterpretedName)("basetest.eth");
4346
4031
  case import_datasources7.ENSNamespaceIds.EnsTestEnv:
4347
4032
  throw new Error(
4348
4033
  `No registrar managed name is known for the 'basenames' subregistry within the "${namespaceId}" namespace.`
@@ -4351,6 +4036,7 @@ function getBasenamesSubregistryManagedName(namespaceId) {
4351
4036
  }
4352
4037
 
4353
4038
  // src/registrars/ethnames-subregistry.ts
4039
+ var import_enssdk8 = require("enssdk");
4354
4040
  var import_datasources8 = require("@ensnode/datasources");
4355
4041
  function getEthnamesSubregistryId(namespace) {
4356
4042
  const datasource = (0, import_datasources8.maybeGetDatasource)(namespace, import_datasources8.DatasourceNames.ENSRoot);
@@ -4361,10 +4047,7 @@ function getEthnamesSubregistryId(namespace) {
4361
4047
  if (address === void 0 || Array.isArray(address)) {
4362
4048
  throw new Error(`BaseRegistrar contract not found or has multiple addresses for ${namespace}`);
4363
4049
  }
4364
- return {
4365
- chainId: datasource.chain.id,
4366
- address
4367
- };
4050
+ return { chainId: datasource.chain.id, address };
4368
4051
  }
4369
4052
  function getEthnamesSubregistryManagedName(namespaceId) {
4370
4053
  switch (namespaceId) {
@@ -4372,11 +4055,12 @@ function getEthnamesSubregistryManagedName(namespaceId) {
4372
4055
  case import_datasources8.ENSNamespaceIds.Sepolia:
4373
4056
  case import_datasources8.ENSNamespaceIds.SepoliaV2:
4374
4057
  case import_datasources8.ENSNamespaceIds.EnsTestEnv:
4375
- return "eth";
4058
+ return (0, import_enssdk8.asInterpretedName)("eth");
4376
4059
  }
4377
4060
  }
4378
4061
 
4379
4062
  // src/registrars/lineanames-subregistry.ts
4063
+ var import_enssdk9 = require("enssdk");
4380
4064
  var import_datasources9 = require("@ensnode/datasources");
4381
4065
  function getLineanamesSubregistryId(namespace) {
4382
4066
  const datasource = (0, import_datasources9.maybeGetDatasource)(namespace, import_datasources9.DatasourceNames.Lineanames);
@@ -4387,18 +4071,15 @@ function getLineanamesSubregistryId(namespace) {
4387
4071
  if (address === void 0 || Array.isArray(address)) {
4388
4072
  throw new Error(`BaseRegistrar contract not found or has multiple addresses for ${namespace}`);
4389
4073
  }
4390
- return {
4391
- chainId: datasource.chain.id,
4392
- address
4393
- };
4074
+ return { chainId: datasource.chain.id, address };
4394
4075
  }
4395
4076
  function getLineanamesSubregistryManagedName(namespaceId) {
4396
4077
  switch (namespaceId) {
4397
4078
  case import_datasources9.ENSNamespaceIds.Mainnet:
4398
- return "linea.eth";
4079
+ return (0, import_enssdk9.asInterpretedName)("linea.eth");
4399
4080
  case import_datasources9.ENSNamespaceIds.Sepolia:
4400
4081
  case import_datasources9.ENSNamespaceIds.SepoliaV2:
4401
- return "linea-sepolia.eth";
4082
+ return (0, import_enssdk9.asInterpretedName)("linea-sepolia.eth");
4402
4083
  case import_datasources9.ENSNamespaceIds.EnsTestEnv:
4403
4084
  throw new Error(
4404
4085
  `No registrar managed name is known for the 'Lineanames' subregistry within the "${namespaceId}" namespace.`
@@ -4422,6 +4103,7 @@ function isRegistrationInGracePeriod(info, now) {
4422
4103
  }
4423
4104
 
4424
4105
  // src/resolution/ensip19-chainid.ts
4106
+ var import_enssdk10 = require("enssdk");
4425
4107
  var import_chains = require("viem/chains");
4426
4108
  var import_datasources10 = require("@ensnode/datasources");
4427
4109
  var getResolvePrimaryNameChainIdParam = (chainId, namespaceId) => {
@@ -4429,7 +4111,7 @@ var getResolvePrimaryNameChainIdParam = (chainId, namespaceId) => {
4429
4111
  return chainId === ensRootChainId ? import_chains.mainnet.id : chainId;
4430
4112
  };
4431
4113
  var translateDefaultableChainIdToChainId = (chainId, namespaceId) => {
4432
- return chainId === DEFAULT_EVM_CHAIN_ID ? (0, import_datasources10.getENSRootChainId)(namespaceId) : chainId;
4114
+ return chainId === import_enssdk10.DEFAULT_EVM_CHAIN_ID ? (0, import_datasources10.getENSRootChainId)(namespaceId) : chainId;
4433
4115
  };
4434
4116
 
4435
4117
  // src/resolution/resolver-records-selection.ts
@@ -4779,11 +4461,12 @@ function buildIndexedBlockranges(namespace, pluginsDatasourceNames) {
4779
4461
  }
4780
4462
 
4781
4463
  // src/shared/interpretation/interpret-address.ts
4782
- var import_viem17 = require("viem");
4783
- var interpretAddress = (owner) => (0, import_viem17.isAddressEqual)(import_viem17.zeroAddress, owner) ? null : owner;
4464
+ var import_viem9 = require("viem");
4465
+ var interpretAddress = (owner) => (0, import_viem9.isAddressEqual)(import_viem9.zeroAddress, owner) ? null : owner;
4784
4466
 
4785
4467
  // src/shared/interpretation/interpret-record-values.ts
4786
- var import_viem18 = require("viem");
4468
+ var import_enssdk11 = require("enssdk");
4469
+ var import_viem10 = require("viem");
4787
4470
 
4788
4471
  // src/shared/null-bytes.ts
4789
4472
  var hasNullByte = (value) => value.indexOf("\0") !== -1;
@@ -4792,16 +4475,16 @@ var stripNullBytes = (value) => value.replaceAll("\0", "");
4792
4475
  // src/shared/interpretation/interpret-record-values.ts
4793
4476
  function interpretNameRecordValue(value) {
4794
4477
  if (value === "") return null;
4795
- if (!isNormalizedName(value)) return null;
4478
+ if (!(0, import_enssdk11.isNormalizedName)(value)) return null;
4796
4479
  return value;
4797
4480
  }
4798
4481
  function interpretAddressRecordValue(value) {
4799
4482
  if (hasNullByte(value)) return null;
4800
4483
  if (value === "") return null;
4801
4484
  if (value === "0x") return null;
4802
- if (!(0, import_viem18.isAddress)(value)) return value;
4803
- if ((0, import_viem18.isAddressEqual)(value, import_viem18.zeroAddress)) return null;
4804
- return asLowerCaseAddress(value);
4485
+ if (!(0, import_viem10.isAddress)(value)) return value;
4486
+ if ((0, import_viem10.isAddressEqual)(value, import_viem10.zeroAddress)) return null;
4487
+ return (0, import_enssdk11.asLowerCaseAddress)(value);
4805
4488
  }
4806
4489
  function interpretTextRecordKey(key) {
4807
4490
  if (hasNullByte(key)) return null;
@@ -4814,98 +4497,24 @@ function interpretTextRecordValue(value) {
4814
4497
  return value;
4815
4498
  }
4816
4499
 
4817
- // src/shared/interpretation/interpreted-names-and-labels.ts
4818
- var import_viem20 = require("viem");
4819
- var import_ens7 = require("viem/ens");
4820
-
4821
- // src/shared/labelhash.ts
4822
- var import_viem19 = require("viem");
4823
- var labelhashLiteralLabel = (label) => (0, import_viem19.keccak256)((0, import_viem19.stringToBytes)(label));
4824
-
4825
- // src/shared/interpretation/interpreted-names-and-labels.ts
4826
- function literalLabelToInterpretedLabel(label) {
4827
- if (isNormalizedLabel(label)) return label;
4828
- return encodeLabelHash(labelhashLiteralLabel(label));
4829
- }
4830
- function literalLabelsToInterpretedName(labels) {
4831
- return labels.map(literalLabelToInterpretedLabel).join(".");
4832
- }
4833
- function interpretedLabelsToInterpretedName(labels) {
4834
- return labels.join(".");
4835
- }
4836
- function literalLabelsToLiteralName(labels) {
4837
- return labels.join(".");
4838
- }
4839
- function interpretedNameToInterpretedLabels(name) {
4840
- return name.split(".");
4841
- }
4842
- function encodedLabelToLabelhash(label) {
4843
- if (label.length !== 66) return null;
4844
- if (label.indexOf("[") !== 0) return null;
4845
- if (label.indexOf("]") !== 65) return null;
4846
- const hash = `0x${label.slice(1, 65)}`;
4847
- if (!(0, import_viem20.isHex)(hash)) return null;
4848
- return hash;
4849
- }
4850
- function isInterpetedLabel(label) {
4851
- if (label.startsWith("[")) {
4852
- const labelHash = encodedLabelToLabelhash(label);
4853
- return labelHash != null;
4854
- }
4855
- return isNormalizedLabel(label);
4856
- }
4857
- function isInterpretedName(name) {
4858
- return name.split(".").every(isInterpetedLabel);
4859
- }
4860
- function interpretedLabelsToLabelHashPath(labels) {
4861
- return labels.map((label) => {
4862
- if (!isInterpetedLabel(label)) {
4863
- throw new Error(
4864
- `Invariant(interpretedLabelsToLabelHashPath): Expected InterpretedLabel, received '${label}'.`
4865
- );
4866
- }
4867
- const maybeLabelHash = encodedLabelToLabelhash(label);
4868
- if (maybeLabelHash !== null) return maybeLabelHash;
4869
- return (0, import_ens7.labelhash)(label);
4870
- }).toReversed();
4871
- }
4872
- function constructSubInterpretedName(label, name) {
4873
- if (name === void 0 || name === "") return label;
4874
- return [label, name].join(".");
4875
- }
4876
- function ensureInterpretedLabel(labelHash, label) {
4877
- return label ?? encodeLabelHash(labelHash);
4878
- }
4879
- function parsePartialInterpretedName(partialInterpretedName) {
4880
- if (partialInterpretedName === "") return { concrete: [], partial: "" };
4881
- const concrete = partialInterpretedName.split(".");
4882
- const partial = concrete.pop();
4883
- if (!concrete.every(isInterpetedLabel)) {
4884
- throw new Error(
4885
- `Invariant(parsePartialInterpretedName): Concrete portion of Partial InterpretedName contains segments that are not InterpretedLabels.
4886
- ${JSON.stringify(concrete)}`
4887
- );
4888
- }
4889
- return { concrete, partial };
4890
- }
4891
-
4892
4500
  // src/shared/namespace-specific-value.ts
4893
4501
  function getNamespaceSpecificValue(namespace, value) {
4894
4502
  return value[namespace] ?? value.default;
4895
4503
  }
4896
4504
 
4897
4505
  // src/shared/root-registry.ts
4506
+ var import_enssdk12 = require("enssdk");
4898
4507
  var import_datasources12 = require("@ensnode/datasources");
4899
4508
  var getENSv1Registry = (namespace) => getDatasourceContract(namespace, import_datasources12.DatasourceNames.ENSRoot, "ENSv1Registry");
4900
4509
  var isENSv1Registry = (namespace, contract) => accountIdEqual(getENSv1Registry(namespace), contract);
4901
4510
  var getENSv2RootRegistry = (namespace) => getDatasourceContract(namespace, import_datasources12.DatasourceNames.ENSv2Root, "RootRegistry");
4902
- var getENSv2RootRegistryId = (namespace) => (0, index_exports.makeRegistryId)(getENSv2RootRegistry(namespace));
4511
+ var getENSv2RootRegistryId = (namespace) => (0, import_enssdk12.makeRegistryId)(getENSv2RootRegistry(namespace));
4903
4512
  var isENSv2RootRegistry = (namespace, contract) => accountIdEqual(getENSv2RootRegistry(namespace), contract);
4904
4513
  var maybeGetENSv2RootRegistry = (namespace) => maybeGetDatasourceContract(namespace, import_datasources12.DatasourceNames.ENSv2Root, "RootRegistry");
4905
4514
  var maybeGetENSv2RootRegistryId = (namespace) => {
4906
4515
  const root = maybeGetENSv2RootRegistry(namespace);
4907
4516
  if (!root) return void 0;
4908
- return (0, index_exports.makeRegistryId)(root);
4517
+ return (0, import_enssdk12.makeRegistryId)(root);
4909
4518
  };
4910
4519
 
4911
4520
  // src/shared/url.ts