@ensnode/ensnode-sdk 0.35.0 → 1.0.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 CHANGED
@@ -14,8 +14,8 @@ npm install @ensnode/ensnode-sdk
14
14
 
15
15
  The `ENSNodeClient` provides a unified interface for the supported ENSNode APIs:
16
16
  - Resolution API (Protocol Accelerated Forward/Reverse Resolution)
17
- - 🚧 Configuration API
18
- - 🚧 Indexing Status API
17
+ - Indexing Status API
18
+ - Configuration API
19
19
 
20
20
  ### Basic Usage
21
21
 
@@ -85,7 +85,7 @@ console.log(records);
85
85
 
86
86
  ##### `resolvePrimaryName(address, chainId, options)`
87
87
 
88
- Resolves the primary name of the provided `address` on the specified `chainId`, via ENSNode, which implements Protocol Acceleration for indexed names. If the `address` specifies a valid [ENSIP-19 Default Name](https://docs.ens.domains/ensip/19/#default-primary-name), the Default Name will be returned. You _may_ query the Default EVM Chain Id (`0`) in order to determine the `address`'s Default Name directly.
88
+ Resolves the primary name of the provided `address` on the specified `chainId`, via ENSNode, which implements Protocol Acceleration for indexed names. If the chainId-specific Primary Name is not defined, but the `address` specifies a valid [ENSIP-19 Default Name](https://docs.ens.domains/ensip/19/#default-primary-name), the Default Name will be returned. You _may_ query the Default EVM Chain Id (`0`) in order to determine the `address`'s Default Name directly.
89
89
 
90
90
  The returned Primary Name, if set, is guaranteed to be a [Normalized Name](https://ensnode.io/docs/reference/terminology#normalized-name). If the primary name set for the address is not normalized, `null` is returned as if no primary name was set.
91
91
 
@@ -114,7 +114,7 @@ const { name } = await client.resolvePrimaryName("0x179A862703a4adfb29896552DF9e
114
114
 
115
115
  ##### `resolvePrimaryNames(address, options)`
116
116
 
117
- Resolves the primary names of the provided `address` on the specified chainIds, via ENSNode, which implements Protocol Acceleration for indexed names. If the `address` specifies a valid [ENSIP-19 Default Name](https://docs.ens.domains/ensip/19/#default-primary-name), the Default Name will be returned for all chainIds for which there is not a chain-specific Primary Name. To avoid misuse, you _may not_ query the Default EVM Chain Id (`0`) directly, and should rely on the aforementioned per-chain defaulting behavior.
117
+ Resolves the primary names of the provided `address` on the specified chainIds, via ENSNode, which implements Protocol Acceleration for indexed names. For each Primary Name, if the chainId-specific Primary Name is not defined, but the `address` specifies a valid [ENSIP-19 Default Name](https://docs.ens.domains/ensip/19/#default-primary-name), the Default Name will be returned. You _may not_ query the Default EVM Chain Id (`0`) directly, and should rely on the aforementioned per-chain defaulting behavior.
118
118
 
119
119
  Each returned Primary Name, if set, is guaranteed to be a [Normalized Name](https://ensnode.io/docs/reference/terminology#normalized-name). If the primary name set for the address on any chain is not normalized, `null` is returned for that chain as if no primary name was set.
120
120
 
@@ -132,12 +132,12 @@ const { names } = await client.resolvePrimaryNames("0x179A862703a4adfb29896552DF
132
132
 
133
133
  console.log(names);
134
134
  // {
135
- // "1": "gregskril.eth",
136
- // "10": "gregskril.eth",
137
- // "8453": "greg.base.eth", // base-specific Primary Name!
138
- // "42161": "gregskril.eth",
139
- // "59144": "gregskril.eth",
140
- // "534352": "gregskril.eth"
135
+ // "1": "gregskril.eth", // Default Primary Name
136
+ // "10": "gregskril.eth", // Default Primary Name
137
+ // "8453": "greg.base.eth", // Base-specific Primary Name!
138
+ // "42161": "gregskril.eth", // Default Primary Name
139
+ // "59144": "gregskril.eth", // Default Primary Name
140
+ // "534352": "gregskril.eth" // Default Primary Name
141
141
  // }
142
142
 
143
143
  // Resolve an address' Primary Names on specific chain Ids
@@ -152,6 +152,45 @@ console.log(names);
152
152
  // }
153
153
  ```
154
154
 
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
+ #### Indexing Status API
171
+
172
+ ##### `indexingStatus(options)`
173
+
174
+ Fetches the ENSNode's multichain indexing status.
175
+
176
+ - `options`: (optional) additional options
177
+ - `maxRealtimeDistance`: (optional) The max allowed distance in seconds between the latest indexed block of the slowest indexed chain and the current time. Setting this parameter influences the HTTP response code:
178
+ - Success (200 OK): The latest indexed block of each chain is within the requested distance from realtime
179
+ - Service Unavailable (503): The latest indexed block of each chain is NOT within the requested distance from realtime
180
+ - Returns: `IndexingStatusResponse` - The indexing status data for all indexed chains
181
+ - Throws: Error if the request fails or the ENSNode API returns an error response
182
+
183
+ ```ts
184
+ // Get current indexing status
185
+ const status = await client.indexingStatus();
186
+ console.log(status);
187
+ // Returns indexing status for all indexed chains
188
+
189
+ // Check if omnichain indexing is within 60 seconds of realtime
190
+ const status = await client.indexingStatus({ maxRealtimeDistance: 60 });
191
+ console.log(status);
192
+ // Returns indexing status, throws if not within 60 seconds of realtime
193
+ ```
155
194
 
156
195
  ### Configuration
157
196