@ensnode/ensnode-sdk 1.9.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -26
- package/dist/index.cjs +877 -1222
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1477 -2240
- package/dist/index.d.ts +1477 -2240
- package/dist/index.js +861 -1205
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -10,20 +10,19 @@ Learn more about [ENSNode](https://ensnode.io/) from [the ENSNode docs](https://
|
|
|
10
10
|
npm install @ensnode/ensnode-sdk
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## EnsNodeClient
|
|
14
14
|
|
|
15
|
-
The `
|
|
15
|
+
The `EnsNodeClient` provides a unified interface for the ENSNode REST APIs:
|
|
16
16
|
- Resolution API (Protocol Accelerated Forward/Reverse Resolution)
|
|
17
17
|
- Indexing Status API
|
|
18
|
-
- Configuration API
|
|
19
18
|
|
|
20
19
|
### Basic Usage
|
|
21
20
|
|
|
22
21
|
```typescript
|
|
23
|
-
import {
|
|
24
|
-
import { mainnet } from
|
|
22
|
+
import { EnsNodeClient, evmChainIdToCoinType } from "@ensnode/ensnode-sdk";
|
|
23
|
+
import { mainnet } from "viem/chains";
|
|
25
24
|
|
|
26
|
-
const client = new
|
|
25
|
+
const client = new EnsNodeClient();
|
|
27
26
|
|
|
28
27
|
// Resolution API: Records Resolution
|
|
29
28
|
const { records } = await client.resolveRecords("jesse.base.eth", {
|
|
@@ -152,41 +151,32 @@ console.log(names);
|
|
|
152
151
|
// }
|
|
153
152
|
```
|
|
154
153
|
|
|
155
|
-
#### Configuration API
|
|
156
|
-
|
|
157
|
-
##### `config()`
|
|
158
|
-
|
|
159
|
-
Fetches the ENSNode's configuration.
|
|
160
|
-
|
|
161
|
-
- Returns: `ConfigResponse` - The ENSNode configuration data
|
|
162
|
-
- Throws: Error if the request fails or the ENSNode API returns an error response
|
|
163
|
-
|
|
164
|
-
```ts
|
|
165
|
-
const config = await client.config();
|
|
166
|
-
console.log(config);
|
|
167
|
-
// Returns the ENSNode configuration including indexed chains, etc.
|
|
168
|
-
```
|
|
169
|
-
|
|
170
154
|
#### Indexing Status API
|
|
171
155
|
|
|
172
156
|
##### `indexingStatus()`
|
|
173
157
|
|
|
174
|
-
Fetches the ENSNode's
|
|
158
|
+
Fetches the ENSNode's omnichain indexing status.
|
|
175
159
|
|
|
176
160
|
- Returns: `IndexingStatusResponse` - The indexing status data for all indexed chains
|
|
177
161
|
- Throws: Error if the request fails or the ENSNode API returns an error response
|
|
178
162
|
|
|
179
163
|
```ts
|
|
180
164
|
// Get current indexing status
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
165
|
+
const indexingStatusResponse = await client.indexingStatus();
|
|
166
|
+
|
|
167
|
+
if (indexingStatusResponse.responseCode === EnsApiIndexingStatusResponseCodes.Ok) {
|
|
168
|
+
const { realtimeProjection, stackInfo } = indexingStatusResponse;
|
|
169
|
+
console.log("RealtimeIndexingStatusProjection:", realtimeProjection);
|
|
170
|
+
console.log("EnsNodeStackInfo:", stackInfo);
|
|
171
|
+
} else {
|
|
172
|
+
console.error("Error while fetching Indexing Status");
|
|
173
|
+
}
|
|
184
174
|
```
|
|
185
175
|
|
|
186
176
|
### Configuration
|
|
187
177
|
|
|
188
178
|
```typescript
|
|
189
|
-
const client = new
|
|
179
|
+
const client = new EnsNodeClient({
|
|
190
180
|
url: new URL("https://my-ensnode-instance.com"),
|
|
191
181
|
});
|
|
192
182
|
```
|