@ensnode/ensnode-sdk 0.34.0 → 0.36.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
 
@@ -48,6 +48,8 @@ const { names } = await client.resolvePrimaryNames("0x179A862703a4adfb29896552DF
48
48
 
49
49
  Resolves records for an ENS name (Forward Resolution), via ENSNode, which implements Protocol Acceleration for indexed names.
50
50
 
51
+ The returned `name` field, if set, is guaranteed to be a [Normalized Name](https://ensnode.io/docs/reference/terminology#normalized-name). If the name record returned by the resolver is not normalized, `null` is returned as if no name record was set.
52
+
51
53
  - `name`: The ENS Name whose records to resolve
52
54
  - `selection`: Optional selection of Resolver records:
53
55
  - `addresses`: Array of coin types to resolve addresses for
@@ -83,7 +85,9 @@ console.log(records);
83
85
 
84
86
  ##### `resolvePrimaryName(address, chainId, options)`
85
87
 
86
- 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
+
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.
87
91
 
88
92
  - `address`: The Address whose Primary Name to resolve
89
93
  - `chainId`: The chain id within which to query the address' ENSIP-19 Multichain Primary Name
@@ -110,7 +114,9 @@ const { name } = await client.resolvePrimaryName("0x179A862703a4adfb29896552DF9e
110
114
 
111
115
  ##### `resolvePrimaryNames(address, options)`
112
116
 
113
- 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
+
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.
114
120
 
115
121
  - `address`: The Address whose Primary Names to resolve
116
122
  - `options`: (optional) additional options
@@ -126,12 +132,12 @@ const { names } = await client.resolvePrimaryNames("0x179A862703a4adfb29896552DF
126
132
 
127
133
  console.log(names);
128
134
  // {
129
- // "1": "gregskril.eth",
130
- // "10": "gregskril.eth",
131
- // "8453": "greg.base.eth", // base-specific Primary Name!
132
- // "42161": "gregskril.eth",
133
- // "59144": "gregskril.eth",
134
- // "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
135
141
  // }
136
142
 
137
143
  // Resolve an address' Primary Names on specific chain Ids
@@ -146,6 +152,45 @@ console.log(names);
146
152
  // }
147
153
  ```
148
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
+ ```
149
194
 
150
195
  ### Configuration
151
196