@ensnode/ensnode-sdk 1.15.1 → 1.15.2
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 +1 -1
- package/README.md +21 -9
- package/dist/index.cjs +11 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -9
- package/dist/index.d.ts +18 -9
- package/dist/index.js +18 -9
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +364 -90
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +11 -5
- package/dist/internal.d.ts +11 -5
- package/dist/internal.js +353 -75
- package/dist/internal.js.map +1 -1
- package/dist/{namespace-specific-value-CPvcFpGI.d.cts → namespace-specific-value-BBZET9O0.d.cts} +7 -10
- package/dist/{namespace-specific-value-CPvcFpGI.d.ts → namespace-specific-value-BBZET9O0.d.ts} +7 -10
- package/package.json +6 -5
package/LICENSE
CHANGED
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(
|
|
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
|
|
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
|
|
99
|
-
import { DEFAULT_EVM_CHAIN_ID } from
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
|
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,
|
|
@@ -3669,6 +3671,7 @@ var ClientError = class _ClientError extends Error {
|
|
|
3669
3671
|
var import_datasources5 = require("@ensnode/datasources");
|
|
3670
3672
|
var DEFAULT_ENSNODE_URL_MAINNET = "https://api.alpha.ensnode.io";
|
|
3671
3673
|
var DEFAULT_ENSNODE_URL_SEPOLIA = "https://api.alpha-sepolia.ensnode.io";
|
|
3674
|
+
var DEFAULT_ENSNODE_URL_SEPOLIA_V2 = "https://api.v2-sepolia.ensnode.io";
|
|
3672
3675
|
var getDefaultEnsNodeUrl = (namespace) => {
|
|
3673
3676
|
const effectiveNamespace = namespace ?? import_datasources5.ENSNamespaceIds.Mainnet;
|
|
3674
3677
|
switch (effectiveNamespace) {
|
|
@@ -3676,6 +3679,8 @@ var getDefaultEnsNodeUrl = (namespace) => {
|
|
|
3676
3679
|
return new URL(DEFAULT_ENSNODE_URL_MAINNET);
|
|
3677
3680
|
case import_datasources5.ENSNamespaceIds.Sepolia:
|
|
3678
3681
|
return new URL(DEFAULT_ENSNODE_URL_SEPOLIA);
|
|
3682
|
+
case import_datasources5.ENSNamespaceIds.SepoliaV2:
|
|
3683
|
+
return new URL(DEFAULT_ENSNODE_URL_SEPOLIA_V2);
|
|
3679
3684
|
default:
|
|
3680
3685
|
throw new Error(
|
|
3681
3686
|
`ENSNamespaceId ${effectiveNamespace} does not have a default ENSNode URL defined`
|
|
@@ -4862,12 +4867,11 @@ function interpretNameRecordValue(value) {
|
|
|
4862
4867
|
return value;
|
|
4863
4868
|
}
|
|
4864
4869
|
function interpretAddressRecordValue(value) {
|
|
4865
|
-
if (hasNullByte(value)) return null;
|
|
4866
|
-
if (value === "") return null;
|
|
4867
4870
|
if (value === "0x") return null;
|
|
4868
|
-
if (!(0, import_viem10.
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
+
if (!(0, import_viem10.isHex)(value, { strict: true })) return null;
|
|
4872
|
+
const normalized = value.toLowerCase();
|
|
4873
|
+
if (normalized === import_viem10.zeroAddress) return null;
|
|
4874
|
+
return normalized;
|
|
4871
4875
|
}
|
|
4872
4876
|
function interpretTextRecordKey(key) {
|
|
4873
4877
|
if (hasNullByte(key)) return null;
|
|
@@ -5079,7 +5083,8 @@ var maybeGetENSv2RootRegistryId = (namespace) => {
|
|
|
5079
5083
|
if (!root) return void 0;
|
|
5080
5084
|
return (0, import_enssdk11.makeENSv2RegistryId)(root);
|
|
5081
5085
|
};
|
|
5082
|
-
var
|
|
5086
|
+
var getRootRegistry = (namespace) => maybeGetENSv2RootRegistry(namespace) ?? getENSv1RootRegistry(namespace);
|
|
5087
|
+
var getRootRegistryId = (namespace) => (0, import_enssdk11.makeConcreteRegistryId)(getRootRegistry(namespace));
|
|
5083
5088
|
var isRootRegistryId = (namespace, registryId) => registryId === getENSv1RootRegistryId(namespace) || registryId === maybeGetENSv2RootRegistryId(namespace);
|
|
5084
5089
|
|
|
5085
5090
|
// src/shared/url.ts
|