@ensnode/ensnode-sdk 1.15.1 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 NameHash
3
+ Copyright (c) 2026 NameHash Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -13,6 +13,7 @@ npm install @ensnode/ensnode-sdk
13
13
  ## EnsNodeClient
14
14
 
15
15
  The `EnsNodeClient` provides a unified interface for the ENSNode REST APIs:
16
+
16
17
  - Resolution API (Protocol Accelerated Forward/Reverse Resolution)
17
18
  - Indexing Status API
18
19
 
@@ -31,7 +32,10 @@ const { records } = await client.resolveRecords("jesse.base.eth", {
31
32
  });
32
33
 
33
34
  // Resolution API: Primary Name Resolution
34
- const { name } = await client.resolvePrimaryName("0x179A862703a4adfb29896552DF9e307980D19285", mainnet.id);
35
+ const { name } = await client.resolvePrimaryName(
36
+ "0x179A862703a4adfb29896552DF9e307980D19285",
37
+ mainnet.id,
38
+ );
35
39
  // name === 'gregskril.eth'
36
40
 
37
41
  // Resolution API: Primary Names Resolution
@@ -57,9 +61,8 @@ The returned `name` field, if set, is guaranteed to be a [Normalized Name](https
57
61
  - `trace`: (optional) Whether to include a trace in the response (default: false)
58
62
  - `accelerate`: (optional) Whether to attempt Protocol Acceleration (default: false)
59
63
 
60
-
61
64
  ```ts
62
- import { mainnet, base } from 'viem/chains';
65
+ import { mainnet, base } from "viem/chains";
63
66
 
64
67
  const { records } = await client.resolveRecords("greg.base.eth", {
65
68
  // Resolve ETH Mainnet Address (if set) and Base Address (if set)
@@ -95,19 +98,28 @@ The returned Primary Name, if set, is guaranteed to be a [Normalized Name](https
95
98
  - `accelerate`: (optional) Whether to attempt Protocol Acceleration (default: false)
96
99
 
97
100
  ```ts
98
- import { mainnet, base } from 'viem/chains';
99
- import { DEFAULT_EVM_CHAIN_ID } from '@ensnode/ensnode-sdk';
101
+ import { mainnet, base } from "viem/chains";
102
+ import { DEFAULT_EVM_CHAIN_ID } from "@ensnode/ensnode-sdk";
100
103
 
101
104
  // Resolve the address' Primary Name on Ethereum Mainnet
102
- const { name } = await client.resolvePrimaryName("0x179A862703a4adfb29896552DF9e307980D19285", mainnet.id);
105
+ const { name } = await client.resolvePrimaryName(
106
+ "0x179A862703a4adfb29896552DF9e307980D19285",
107
+ mainnet.id,
108
+ );
103
109
  // name === 'gregskril.eth'
104
110
 
105
111
  // Resolve the address' Primary Name on Base
106
- const { name } = await client.resolvePrimaryName("0x179A862703a4adfb29896552DF9e307980D19285", base.id);
112
+ const { name } = await client.resolvePrimaryName(
113
+ "0x179A862703a4adfb29896552DF9e307980D19285",
114
+ base.id,
115
+ );
107
116
  // name === 'greg.base.eth'
108
117
 
109
118
  // Resolve the address' Default Primary Name
110
- const { name } = await client.resolvePrimaryName("0x179A862703a4adfb29896552DF9e307980D19285", DEFAULT_EVM_CHAIN_ID);
119
+ const { name } = await client.resolvePrimaryName(
120
+ "0x179A862703a4adfb29896552DF9e307980D19285",
121
+ DEFAULT_EVM_CHAIN_ID,
122
+ );
111
123
  // name === 'gregskril.eth'
112
124
  ```
113
125
 
@@ -124,7 +136,7 @@ Each returned Primary Name, if set, is guaranteed to be a [Normalized Name](http
124
136
  - `accelerate`: (optional) Whether to attempt Protocol Acceleration (default: false)
125
137
 
126
138
  ```ts
127
- import { mainnet, base } from 'viem/chains';
139
+ import { mainnet, base } from "viem/chains";
128
140
 
129
141
  // Resolve an address' Primary Names on all ENSIP-19 supported chain ids
130
142
  const { names } = await client.resolvePrimaryNames("0x179A862703a4adfb29896552DF9e307980D19285");
package/dist/index.cjs CHANGED
@@ -39,6 +39,7 @@ __export(index_exports, {
39
39
  CurrencyIds: () => CurrencyIds,
40
40
  DEFAULT_ENSNODE_URL_MAINNET: () => DEFAULT_ENSNODE_URL_MAINNET,
41
41
  DEFAULT_ENSNODE_URL_SEPOLIA: () => DEFAULT_ENSNODE_URL_SEPOLIA,
42
+ DEFAULT_ENSNODE_URL_SEPOLIA_V2: () => DEFAULT_ENSNODE_URL_SEPOLIA_V2,
42
43
  ENCODED_REFERRER_BYTE_LENGTH: () => ENCODED_REFERRER_BYTE_LENGTH,
43
44
  ENCODED_REFERRER_BYTE_OFFSET: () => ENCODED_REFERRER_BYTE_OFFSET,
44
45
  ENSNamespaceIds: () => import_datasources11.ENSNamespaceIds,
@@ -157,6 +158,7 @@ __export(index_exports, {
157
158
  getOmnichainIndexingCursor: () => getOmnichainIndexingCursor,
158
159
  getOmnichainIndexingStatus: () => getOmnichainIndexingStatus,
159
160
  getResolvePrimaryNameChainIdParam: () => getResolvePrimaryNameChainIdParam,
161
+ getRootRegistry: () => getRootRegistry,
160
162
  getRootRegistryId: () => getRootRegistryId,
161
163
  getTimestampForHighestOmnichainKnownBlock: () => getTimestampForHighestOmnichainKnownBlock,
162
164
  getTimestampForLowestOmnichainStartBlock: () => getTimestampForLowestOmnichainStartBlock,
@@ -2059,6 +2061,7 @@ var EnsIndexerClient = class {
2059
2061
  constructor(options) {
2060
2062
  this.options = options;
2061
2063
  }
2064
+ options;
2062
2065
  getOptions() {
2063
2066
  return Object.freeze({
2064
2067
  url: new URL(this.options.url.href)
@@ -3669,6 +3672,7 @@ var ClientError = class _ClientError extends Error {
3669
3672
  var import_datasources5 = require("@ensnode/datasources");
3670
3673
  var DEFAULT_ENSNODE_URL_MAINNET = "https://api.alpha.ensnode.io";
3671
3674
  var DEFAULT_ENSNODE_URL_SEPOLIA = "https://api.alpha-sepolia.ensnode.io";
3675
+ var DEFAULT_ENSNODE_URL_SEPOLIA_V2 = "https://api.v2-sepolia.ensnode.io";
3672
3676
  var getDefaultEnsNodeUrl = (namespace) => {
3673
3677
  const effectiveNamespace = namespace ?? import_datasources5.ENSNamespaceIds.Mainnet;
3674
3678
  switch (effectiveNamespace) {
@@ -3676,6 +3680,8 @@ var getDefaultEnsNodeUrl = (namespace) => {
3676
3680
  return new URL(DEFAULT_ENSNODE_URL_MAINNET);
3677
3681
  case import_datasources5.ENSNamespaceIds.Sepolia:
3678
3682
  return new URL(DEFAULT_ENSNODE_URL_SEPOLIA);
3683
+ case import_datasources5.ENSNamespaceIds.SepoliaV2:
3684
+ return new URL(DEFAULT_ENSNODE_URL_SEPOLIA_V2);
3679
3685
  default:
3680
3686
  throw new Error(
3681
3687
  `ENSNamespaceId ${effectiveNamespace} does not have a default ENSNode URL defined`
@@ -4672,6 +4678,7 @@ var SWRCache = class {
4672
4678
  }
4673
4679
  if (options.proactivelyInitialize) this.revalidate();
4674
4680
  }
4681
+ options;
4675
4682
  cache = null;
4676
4683
  inProgressRevalidate = null;
4677
4684
  backgroundInterval = null;
@@ -4862,12 +4869,11 @@ function interpretNameRecordValue(value) {
4862
4869
  return value;
4863
4870
  }
4864
4871
  function interpretAddressRecordValue(value) {
4865
- if (hasNullByte(value)) return null;
4866
- if (value === "") return null;
4867
4872
  if (value === "0x") return null;
4868
- if (!(0, import_viem10.isAddress)(value, { strict: false })) return value;
4869
- if ((0, import_viem10.isAddressEqual)(value, import_viem10.zeroAddress)) return null;
4870
- return (0, import_enssdk9.toNormalizedAddress)(value);
4873
+ if (!(0, import_viem10.isHex)(value, { strict: true })) return null;
4874
+ const normalized = value.toLowerCase();
4875
+ if (normalized === import_viem10.zeroAddress) return null;
4876
+ return normalized;
4871
4877
  }
4872
4878
  function interpretTextRecordKey(key) {
4873
4879
  if (hasNullByte(key)) return null;
@@ -5079,7 +5085,8 @@ var maybeGetENSv2RootRegistryId = (namespace) => {
5079
5085
  if (!root) return void 0;
5080
5086
  return (0, import_enssdk11.makeENSv2RegistryId)(root);
5081
5087
  };
5082
- var getRootRegistryId = (namespace) => maybeGetENSv2RootRegistryId(namespace) ?? getENSv1RootRegistryId(namespace);
5088
+ var getRootRegistry = (namespace) => maybeGetENSv2RootRegistry(namespace) ?? getENSv1RootRegistry(namespace);
5089
+ var getRootRegistryId = (namespace) => (0, import_enssdk11.makeConcreteRegistryId)(getRootRegistry(namespace));
5083
5090
  var isRootRegistryId = (namespace, registryId) => registryId === getENSv1RootRegistryId(namespace) || registryId === maybeGetENSv2RootRegistryId(namespace);
5084
5091
 
5085
5092
  // src/shared/url.ts