@ensnode/ensnode-sdk 0.0.0-next-20260102143513
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 +21 -0
- package/README.md +192 -0
- package/dist/index.cjs +4396 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +4592 -0
- package/dist/index.d.ts +4592 -0
- package/dist/index.js +4378 -0
- package/dist/index.js.map +1 -0
- package/package.json +66 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,4592 @@
|
|
|
1
|
+
import z$1, { z } from 'zod/v4';
|
|
2
|
+
import { ENSNamespaceId, DatasourceName } from '@ensnode/datasources';
|
|
3
|
+
export { ENSNamespaceId, ENSNamespaceIds, getENSRootChainId } from '@ensnode/datasources';
|
|
4
|
+
import { Hex, Address, ByteArray, Hash } from 'viem';
|
|
5
|
+
import { CoinType, EvmCoinType } from '@ensdomains/address-encoder';
|
|
6
|
+
export { CoinType, EvmCoinType } from '@ensdomains/address-encoder';
|
|
7
|
+
import { UnixTimestamp as UnixTimestamp$1, EncodedReferrer, ReferrerLeaderboardPageParams, ReferrerLeaderboardPage, ReferrerDetail, AwardedReferrerMetrics, AggregatedReferrerMetrics, ReferrerDetailRanked, ReferrerDetailUnranked, UnrankedReferrerMetrics, ReferralProgramRules } from '@namehash/ens-referrals';
|
|
8
|
+
export { EncodedReferrer, ZERO_ENCODED_REFERRER, decodeEncodedReferrer } from '@namehash/ens-referrals';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The ETH coinType.
|
|
12
|
+
*
|
|
13
|
+
* @see https://docs.ens.domains/ensip/9
|
|
14
|
+
*/
|
|
15
|
+
declare const ETH_COIN_TYPE: CoinType;
|
|
16
|
+
/**
|
|
17
|
+
* The 'default' chainId corresponding to the below {@link DEFAULT_EVM_COIN_TYPE} in the context of
|
|
18
|
+
* ENSIP-19.
|
|
19
|
+
*
|
|
20
|
+
* @see https://docs.ens.domains/ensip/19
|
|
21
|
+
*/
|
|
22
|
+
declare const DEFAULT_EVM_CHAIN_ID = 0;
|
|
23
|
+
/**
|
|
24
|
+
* ENSIP-19 EVM CoinType representing the 'default' coinType for EVM chains in ENS.
|
|
25
|
+
*
|
|
26
|
+
* @see https://docs.ens.domains/ensip/19/#reverse-resolution
|
|
27
|
+
*/
|
|
28
|
+
declare const DEFAULT_EVM_COIN_TYPE: EvmCoinType;
|
|
29
|
+
/**
|
|
30
|
+
* Converts a CoinType to an EVM Chain Id.
|
|
31
|
+
*
|
|
32
|
+
* NOTE: for whatever reason @ensdomains/address-encoder#coinTypeToEvmChainId doesn't handle the
|
|
33
|
+
* mainnet case so we implement that here
|
|
34
|
+
*
|
|
35
|
+
* @see https://docs.ens.domains/ensip/11/
|
|
36
|
+
*/
|
|
37
|
+
declare const coinTypeToEvmChainId: (coinType: CoinType) => ChainId;
|
|
38
|
+
/**
|
|
39
|
+
* Converts an EVM Chain Id to a CoinType.
|
|
40
|
+
*
|
|
41
|
+
* NOTE: for whatever reason @ensdomains/address-encoder#evmChainIdToCoinType doesn't handle the
|
|
42
|
+
* mainnet case so we implement that here
|
|
43
|
+
*/
|
|
44
|
+
declare const evmChainIdToCoinType: (chainId: ChainId) => CoinType;
|
|
45
|
+
/**
|
|
46
|
+
* Converts a bigint value representing a CoinType into a valid CoinType.
|
|
47
|
+
*
|
|
48
|
+
* This is useful when onchain events emit coinTypes as bigint but we want to constrain them to
|
|
49
|
+
* the CoinType type.
|
|
50
|
+
*
|
|
51
|
+
* @throws if `value` is too large to fit in Number.MAX_SAFE_INTEGER
|
|
52
|
+
*/
|
|
53
|
+
declare const bigintToCoinType: (value: bigint) => CoinType;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* A hash value that uniquely identifies a single ENS name.
|
|
57
|
+
* Result of `namehash` function as specified in ENSIP-1.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```
|
|
61
|
+
* namehash("vitalik.eth") === "0xee6c4522aab0003e8d14cd40a6af439055fd2577951148c14b6cea9a53475835"
|
|
62
|
+
* ```
|
|
63
|
+
* @see https://docs.ens.domains/ensip/1#namehash-algorithm
|
|
64
|
+
* @see https://ensnode.io/docs/reference/terminology#name-node-namehash
|
|
65
|
+
*/
|
|
66
|
+
type Node = Hex;
|
|
67
|
+
/**
|
|
68
|
+
* An ENS Name that may or may not be normalized.
|
|
69
|
+
*
|
|
70
|
+
* @example vitalik.eth
|
|
71
|
+
* @see https://ensnode.io/docs/reference/terminology#name-node-namehash
|
|
72
|
+
* @see https://docs.ens.domains/ensip/15
|
|
73
|
+
*/
|
|
74
|
+
type Name = string;
|
|
75
|
+
/**
|
|
76
|
+
* A Normalized Name is an ENS Name that is guaranteed to be normalized.
|
|
77
|
+
*
|
|
78
|
+
* @example vitalik.eth
|
|
79
|
+
* @see https://ensnode.io/docs/reference/terminology#name-node-namehash
|
|
80
|
+
* @see https://docs.ens.domains/ensip/15
|
|
81
|
+
* @dev nominally typed to enforce usage & enhance codebase clarity
|
|
82
|
+
*/
|
|
83
|
+
type NormalizedName = Name & {
|
|
84
|
+
__brand: "NormalizedName";
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* A LabelHash is the result of the labelhash function (which is just keccak256) on a Label.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```
|
|
91
|
+
* labelhash('vitalik') === '0xaf2caa1c2ca1d027f1ac823b529d0a67cd144264b2789fa2ea4d63a67c7103cc'
|
|
92
|
+
* ```
|
|
93
|
+
*
|
|
94
|
+
* @see https://docs.ens.domains/terminology#labelhash
|
|
95
|
+
* @see https://ensnode.io/docs/reference/terminology#labels-labelhashes-labelhash-function
|
|
96
|
+
*/
|
|
97
|
+
type LabelHash = Hex;
|
|
98
|
+
/**
|
|
99
|
+
* A Label is a single part of an ENS Name.
|
|
100
|
+
*
|
|
101
|
+
* @example vitalik
|
|
102
|
+
*
|
|
103
|
+
* @see https://docs.ens.domains/terminology#label
|
|
104
|
+
* @see https://ensnode.io/docs/reference/terminology#labels-labelhashes-labelhash-function
|
|
105
|
+
*/
|
|
106
|
+
type Label = string;
|
|
107
|
+
/**
|
|
108
|
+
* An EncodedLabelHash is a specially formatted (unnormalized) Label formatted
|
|
109
|
+
* as a non-0x prefixed 32-byte hex string enclosed in square brackets.
|
|
110
|
+
*
|
|
111
|
+
* Care should be taken to distinguish Label values formatted as an
|
|
112
|
+
* EncodedLabelHash as either a LiteralLabel or an InterpretedLabel:
|
|
113
|
+
* - If a LiteralLabel is formatted as an EncodedLabelHash it does NOT
|
|
114
|
+
* symbolically represent the encoding of a LabelHash literal.
|
|
115
|
+
* - If an InterpretedLabel is formatted as an EncodedLabelHash it should be
|
|
116
|
+
* interpreted as encoding a LabelHash literal.
|
|
117
|
+
*
|
|
118
|
+
* An InterpretedLabel may be formatted as an EncodedLabelHash if the related
|
|
119
|
+
* LiteralLabel is:
|
|
120
|
+
* - not a normalized label
|
|
121
|
+
* - is an unknown value that could not be healed.
|
|
122
|
+
* - is too long for DNS-Encoding in contexts where DNS-Encoding was required.
|
|
123
|
+
*
|
|
124
|
+
* @example [af2caa1c2ca1d027f1ac823b529d0a67cd144264b2789fa2ea4d63a67c7103cc]
|
|
125
|
+
*
|
|
126
|
+
* @see https://ensnode.io/docs/reference/terminology#encoded-labelhash
|
|
127
|
+
*/
|
|
128
|
+
type EncodedLabelHash = `[${string}]`;
|
|
129
|
+
/**
|
|
130
|
+
* A Literal Label is a Label as it literally appears onchain, without any interpretation
|
|
131
|
+
* or normalization processing. It may be an unnormalized label for reasons including:
|
|
132
|
+
* - being an empty label,
|
|
133
|
+
* - containing '.' characters,
|
|
134
|
+
* - being formatted as an EncodedLabelHash (which are not normalizable). Note that
|
|
135
|
+
* when LiteralLabel are formatted as an EncodedLabelHash they do NOT symbolically
|
|
136
|
+
* represent the encoding of a LabelHash literal, or
|
|
137
|
+
* - containing other unnormalized characters such as null bytes or other characters
|
|
138
|
+
* not suitable for display.
|
|
139
|
+
*
|
|
140
|
+
*
|
|
141
|
+
* @see https://ensnode.io/docs/reference/terminology#literal-label
|
|
142
|
+
* @dev nominally typed to enforce usage & enhance codebase clarity
|
|
143
|
+
*/
|
|
144
|
+
type LiteralLabel = Label & {
|
|
145
|
+
__brand: "LiteralLabel";
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* An Interpreted Label is a Label that is either:
|
|
149
|
+
* a) a Normalized Label, or
|
|
150
|
+
* b) an Unnormalizable Label exclusively for the reason that it is formatted
|
|
151
|
+
* as an Encoded LabelHash that should be interpreted as encoding a
|
|
152
|
+
* LabelHash literal, where the encoded LabelHash literal is the `labelhash`
|
|
153
|
+
* of the related LiteralLabel.
|
|
154
|
+
*
|
|
155
|
+
* @see https://ensnode.io/docs/reference/terminology#interpreted-label
|
|
156
|
+
* @dev nominally typed to enforce usage & enhance codebase clarity
|
|
157
|
+
*/
|
|
158
|
+
type InterpretedLabel = Label & {
|
|
159
|
+
__brand: "InterpretedLabel";
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* A Literal Name is a Name as it literally appears onchain, composed of 0 or more Literal Labels
|
|
163
|
+
* joined by dots. It may be an unnormalized name for reasons including:
|
|
164
|
+
* - containing empty labels,
|
|
165
|
+
* - containing LiteralLabel values formatted as an EncodedLabelHash (which are
|
|
166
|
+
* not normalizable)). Note that when LiteralLabel values are formatted as an
|
|
167
|
+
* EncodedLabelHash they do NOT symbolically represent the encoding of a
|
|
168
|
+
* LabelHash literal, or
|
|
169
|
+
* - containing other unnormalized characters such as null bytes or other characters
|
|
170
|
+
* not suitable for display.
|
|
171
|
+
*
|
|
172
|
+
* @see https://ensnode.io/docs/reference/terminology#literal-name
|
|
173
|
+
* @dev nominally typed to enforce usage & enhance codebase clarity
|
|
174
|
+
*/
|
|
175
|
+
type LiteralName = Name & {
|
|
176
|
+
__brand: "LiteralName";
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* An Interpreted Name is a Name that is entirely composed of 0 or more Interpreted Labels.
|
|
180
|
+
*
|
|
181
|
+
* That is, it is either:
|
|
182
|
+
* a) a Normalized Name, or
|
|
183
|
+
* b) an Unnormalizable Name exclusively for the reason that it contains 1 or
|
|
184
|
+
* more labels formatted as Encoded LabelHashes that should be interpreted
|
|
185
|
+
* as encoding a LabelHash literal, where the encoded LabelHash literal is
|
|
186
|
+
* the `labelhash` of the related LiteralLabel.
|
|
187
|
+
*
|
|
188
|
+
* @see https://ensnode.io/docs/reference/terminology#interpreted-name
|
|
189
|
+
* @dev nominally typed to enforce usage & enhance codebase clarity
|
|
190
|
+
*/
|
|
191
|
+
type InterpretedName = Name & {
|
|
192
|
+
__brand: "InterpretedName";
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* A Subgraph Interpreted Label is a Literal Label that is either:
|
|
196
|
+
* a) (if subgraph-indexable): a Literal Label, of unknown normalization status, guaranteed to not
|
|
197
|
+
* contain any of the subgraph-unindexable UTF-8 characters (and therefore guaranteed not to be
|
|
198
|
+
* an Encoded LabelHash), or
|
|
199
|
+
* b) (if subgraph-unindexable): an Encoded LabelHash.
|
|
200
|
+
*
|
|
201
|
+
* @see https://ensnode.io/docs/reference/terminology#subgraph-interpreted-label
|
|
202
|
+
* @dev nominally typed to enforce usage & enhance codebase clarity
|
|
203
|
+
*/
|
|
204
|
+
type SubgraphInterpretedLabel = Label & {
|
|
205
|
+
__brand: "SubgraphInterpretedLabel";
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* A Subgraph Interpreted Name is a name exclusively composed of 0 or more Subgraph Interpreted Labels.
|
|
209
|
+
*
|
|
210
|
+
* @see https://ensnode.io/docs/reference/terminology#subgraph-interpreted-name
|
|
211
|
+
* @dev nominally typed to enforce usage & enhance codebase clarity
|
|
212
|
+
*/
|
|
213
|
+
type SubgraphInterpretedName = Name & {
|
|
214
|
+
__brand: "SubgraphInterpretedName";
|
|
215
|
+
};
|
|
216
|
+
/**
|
|
217
|
+
* A DNS-Encoded Name as a hex string, representing the binary DNS wire format encoding
|
|
218
|
+
* of a domain name. Used in ENS contracts for efficient name storage and transmission.
|
|
219
|
+
* Each label is prefixed with a length byte, and the entire sequence is null-terminated.
|
|
220
|
+
*
|
|
221
|
+
* @example "0x076578616d706c650365746800" represents "example.eth"
|
|
222
|
+
*
|
|
223
|
+
* @see https://docs.ens.domains/resolution/names/#dns-encoding
|
|
224
|
+
* @see https://github.com/ensdomains/ens-contracts/blob/staging/contracts/utils/NameCoder.sol
|
|
225
|
+
*
|
|
226
|
+
* DNS Packet Format for Domain Names:
|
|
227
|
+
* - Domain names are encoded as a sequence of 0 or more labels
|
|
228
|
+
* - Each label begins with a length byte (1 byte) indicating how many bytes follow for that label
|
|
229
|
+
* Note how this constrains each label in DNS encoded names to a max byte length of 255 bytes.
|
|
230
|
+
* - The bytes after the length byte represent the label, as a UTF-8 byte array
|
|
231
|
+
* - Labels are concatenated with no separators
|
|
232
|
+
* - The sequence ends with a null byte (0x00)
|
|
233
|
+
*
|
|
234
|
+
* Example: "example.eth" is encoded as:
|
|
235
|
+
* [0x07, 'e', 'x', 'a', 'm', 'p', 'l', 'e', 0x03, 'e', 't', 'h', 0x00]
|
|
236
|
+
* Where 0x07 is the length of "example", 0x03 is the length of "eth", and 0x00 marks the end
|
|
237
|
+
*
|
|
238
|
+
* Example: "" (empty string, i.e. root node) is encoded as:
|
|
239
|
+
* [0x00]
|
|
240
|
+
*
|
|
241
|
+
* Example: "👩🏼❤💋👨🏼.eth" (multi-byte unicode character) is encoded as:
|
|
242
|
+
* [0x20, 240, 159, 145, 169, 240, 159, 143, 188, 226, 128, 141, 226, 157, 164, 226,
|
|
243
|
+
* 128, 141, 240, 159, 146, 139, 226, 128, 141, 240, 159, 145, 168, 240, 159, 143,
|
|
244
|
+
* 188, 3, 'e', 't', 'h', 0x00]
|
|
245
|
+
*
|
|
246
|
+
* A DNS-Encoded Name Packet may be malformed if it does not exactly follow that specification.
|
|
247
|
+
* Possible reasons a DNS-Encoded Name may be malfomed include:
|
|
248
|
+
* - 'empty' packet
|
|
249
|
+
* - e.g. []
|
|
250
|
+
* ^-- that's empty!
|
|
251
|
+
* - 'length' byte overflowing packet byte length
|
|
252
|
+
* - e.g. [0x06, 'e', 't', 'h', 0x00]
|
|
253
|
+
* ^-- length overflows available bytes!
|
|
254
|
+
* - 'junk' at the end of the dns-encoded
|
|
255
|
+
* - e.g. [0x03, 'e', 't', 'h', 0x00, 0x01]
|
|
256
|
+
* ^-- junk!
|
|
257
|
+
*
|
|
258
|
+
* @dev This type is _structurally_ typed to aid Event Argument Typing — consumers should further
|
|
259
|
+
* cast the type of the event argument to a _nominally_ typed DNSEncodedName like {@link DNSEncodedLiteralName}
|
|
260
|
+
* or {@link DNSEncodedPartiallyInterpretedName} depending on the context.
|
|
261
|
+
*/
|
|
262
|
+
type DNSEncodedName = Hex;
|
|
263
|
+
/**
|
|
264
|
+
* A DNSEncodedName that encodes a name containing 0 or more {@link LiteralLabel}s.
|
|
265
|
+
*
|
|
266
|
+
* In a DNSEncodedLiteralName, all labels are Literal Labels, including any Encoded-LabelHash-looking
|
|
267
|
+
* labels. Any Encoded-LabelHash-looking Literal Label values, when interpreted, will be formatted as
|
|
268
|
+
* the `labelhash` of the Literal Label value.
|
|
269
|
+
*
|
|
270
|
+
* The NameWrapper contract emits DNSEncodedLiteralNames:
|
|
271
|
+
* @see https://github.com/ensdomains/ens-contracts/blob/staging/contracts/utils/BytesUtils_LEGACY.sol
|
|
272
|
+
*
|
|
273
|
+
* The ThreeDNSToken contract emits DNSEncodedLiteralNames:
|
|
274
|
+
* @see https://github.com/3dns-xyz/contracts/blob/44937318ae26cc036982e8c6a496cd82ebdc2b12/src/regcontrol/libraries/BytesUtils.sol
|
|
275
|
+
*
|
|
276
|
+
* @dev nominally typed to enforce usage & enhance codebase clarity
|
|
277
|
+
*/
|
|
278
|
+
type DNSEncodedLiteralName = DNSEncodedName & {
|
|
279
|
+
__brand: "DNSEncodedLiteralName";
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* A DNSEncodedName that encodes a name consisting of 0 or more labels that are either:
|
|
283
|
+
* a) Literal Labels, or
|
|
284
|
+
* b) Encoded LabelHashes, which are already an Interpreted Label.
|
|
285
|
+
*
|
|
286
|
+
* In a DNSEncodedPartiallyInterpretedName, any Encoded-LabelHash-looking decoded Labels (i.e. ones
|
|
287
|
+
* that match the regex /^\[[\da-f]{64}\]$/) represent an Encoded LabelHash. When decoding a
|
|
288
|
+
* DNSEncodedPartiallyInterpretedName, these labels are already considered Interpreted.
|
|
289
|
+
*
|
|
290
|
+
* NOTE: This type is unused in ENSv1, but its usage is anticipated in ENSv2 due to Encoded
|
|
291
|
+
* LabelHash support in the ENSv2 implementation of the NameCoder contract.
|
|
292
|
+
*
|
|
293
|
+
* @see https://github.com/ensdomains/ens-contracts/blob/staging/contracts/utils/NameCoder.sol
|
|
294
|
+
*
|
|
295
|
+
* @dev nominally typed to enforce usage & enhance codebase clarity
|
|
296
|
+
*/
|
|
297
|
+
type DNSEncodedPartiallyInterpretedName = DNSEncodedName & {
|
|
298
|
+
__brand: "DNSEncodedPartiallyInterpretedName";
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
declare const ROOT_NODE: Node;
|
|
302
|
+
declare const ETH_NODE: Node;
|
|
303
|
+
declare const BASENAMES_NODE: Node;
|
|
304
|
+
declare const LINEANAMES_NODE: Node;
|
|
305
|
+
declare const ADDR_REVERSE_NODE: Node;
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Decodes a DNS-Encoded name consisting of Literal Labels into an ordered list of Literal Labels.
|
|
309
|
+
*
|
|
310
|
+
* For discussion on DNS-Encoding, see the {@link DNSEncodedName} and {@link DNSEncodedLiteralName} types.
|
|
311
|
+
*
|
|
312
|
+
* Due to the constraints of DNS-Encoding, there is an additional guarantee that each Literal Label
|
|
313
|
+
* in the resulting list is guaranteed to have a maximum byte length of 255.
|
|
314
|
+
*
|
|
315
|
+
* @param packet a hex string that encodes a DNSEncodedLiteralName
|
|
316
|
+
* @returns A list of the LiteralLabels contained in packet
|
|
317
|
+
* @throws If the packet is malformed
|
|
318
|
+
* @dev This is just `decodeDNSEncodedName` with semantic input/output
|
|
319
|
+
*/
|
|
320
|
+
declare function decodeDNSEncodedLiteralName(packet: DNSEncodedLiteralName): LiteralLabel[];
|
|
321
|
+
/**
|
|
322
|
+
* Decodes a DNS-Encoded Name into an ordered list of string segments.
|
|
323
|
+
*
|
|
324
|
+
* For discussion on DNS-Encoding, see the {@link DNSEncodedName} type.
|
|
325
|
+
*
|
|
326
|
+
* Due to the constraints of DNS-Encoding, there is an additional guarantee that each segment
|
|
327
|
+
* in the resulting list is guaranteed to have a maximum byte length of 255.
|
|
328
|
+
*
|
|
329
|
+
* @param packet a hex string that encodes a DNSEncodedName
|
|
330
|
+
* @returns A UTF-8 string array of the segments contained in packet
|
|
331
|
+
* @throws If the packet is malformed
|
|
332
|
+
* @dev This is the generic implementation of DNS-Encoded Name Decoding
|
|
333
|
+
*/
|
|
334
|
+
declare function decodeDNSEncodedName(packet: DNSEncodedName): string[];
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Formats a LabelHash as an Encoded LabelHash.
|
|
338
|
+
*
|
|
339
|
+
* @see https://ensnode.io/docs/reference/terminology#encoded-labelhash
|
|
340
|
+
*
|
|
341
|
+
* @param labelHash - A 32-byte lowercase hash string starting with '0x'
|
|
342
|
+
* @returns The encoded label hash in format `[hash_without_0x_prefix]`
|
|
343
|
+
*/
|
|
344
|
+
declare const encodeLabelHash: (labelHash: LabelHash) => EncodedLabelHash;
|
|
345
|
+
/**
|
|
346
|
+
* Checks if the input value is an {@link EncodedLabelHash}.
|
|
347
|
+
*/
|
|
348
|
+
declare function isEncodedLabelHash(maybeEncodedLabelHash: string): maybeEncodedLabelHash is EncodedLabelHash;
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Determines whether the Name is normalized.
|
|
352
|
+
*
|
|
353
|
+
* @param name - The Name to check for normalization
|
|
354
|
+
* @returns True if the name is normalized according to ENS normalization rules, false otherwise
|
|
355
|
+
*/
|
|
356
|
+
declare function isNormalizedName(name: Name): name is NormalizedName;
|
|
357
|
+
/**
|
|
358
|
+
* Determines whether the Label is normalized.
|
|
359
|
+
*
|
|
360
|
+
* @param label - The Label to check for normalization
|
|
361
|
+
* @returns True if the label is normalized according to ENS normalization rules, false otherwise
|
|
362
|
+
*/
|
|
363
|
+
declare function isNormalizedLabel(label: Label): boolean;
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Checks if the input is a {@link LabelHash}.
|
|
367
|
+
*
|
|
368
|
+
* @see https://ensnode.io/docs/reference/terminology#label-processing-and-classification
|
|
369
|
+
*/
|
|
370
|
+
declare function isLabelHash(maybeLabelHash: string): maybeLabelHash is LabelHash;
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Name for the ENS Root
|
|
374
|
+
*/
|
|
375
|
+
declare const ENS_ROOT: Name;
|
|
376
|
+
/**
|
|
377
|
+
* Constructs a name hierarchy from a given NormalizedName.
|
|
378
|
+
*
|
|
379
|
+
* @example
|
|
380
|
+
* ```
|
|
381
|
+
* getNameHierarchy("sub.example.eth") -> ["sub.example.eth", "example.eth", "eth"]
|
|
382
|
+
* ```
|
|
383
|
+
*
|
|
384
|
+
* @dev by restricting the input type to NormalizedName we guarantee that we can split and join
|
|
385
|
+
* on '.' and receive NormalizedNames as a result
|
|
386
|
+
*/
|
|
387
|
+
declare const getNameHierarchy: (name: NormalizedName) => NormalizedName[];
|
|
388
|
+
/**
|
|
389
|
+
* Get FQDN of parent for a name.
|
|
390
|
+
*/
|
|
391
|
+
declare const getParentNameFQDN: (name: Name) => Name;
|
|
392
|
+
/**
|
|
393
|
+
* Beautifies a name by converting each normalized label in the provided name to
|
|
394
|
+
* its "beautified" form. Labels that are not normalized retain their original value.
|
|
395
|
+
*
|
|
396
|
+
* Invariants:
|
|
397
|
+
* - The number of labels in the returned name is the same as the number of labels in the input name.
|
|
398
|
+
* - The order of the labels in the returned name is the same as the order of the labels in the input name.
|
|
399
|
+
* - If a label in the input is normalized, it is returned in its "beautified" form.
|
|
400
|
+
* - If a label in the input name is not normalized, it is returned without modification.
|
|
401
|
+
* - Therefore, the result of ens_normalize(beautifyName(name)) is the same as the result of ens_normalize(name).
|
|
402
|
+
*
|
|
403
|
+
* The "beautified form" of a normalized label converts special sequences of
|
|
404
|
+
* emojis and other special characters to their "beautified" equivalents. All
|
|
405
|
+
* such conversions transform X -> Y where Y is normalizable and normalizes back to X.
|
|
406
|
+
* Ex: '1⃣2⃣' (normalized) to '1️⃣2️⃣' (normalizable but not normalized).
|
|
407
|
+
* Ex: 'ξethereum' (normalized) to 'Ξethereum' (normalizable, but not normalized).
|
|
408
|
+
* Ex: 'abc' (normalized) to 'abc' (also normalized, no conversion).
|
|
409
|
+
* Ex: 'ABC' (normalizable but not normalized) to 'ABC' (no conversion).
|
|
410
|
+
* Ex: 'invalid|label' (not normalizable) to 'invalid|label' (no conversion).
|
|
411
|
+
* Ex: '' (unnormalized as a label) to '' (no conversion).
|
|
412
|
+
*
|
|
413
|
+
* @param name - The name to beautify.
|
|
414
|
+
* @returns The beautified name.
|
|
415
|
+
*/
|
|
416
|
+
declare const beautifyName: (name: Name) => Name;
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Parse the address and coinType out of an ENSIP-19 reverse name.
|
|
420
|
+
*/
|
|
421
|
+
declare function parseReverseName(name: Name): {
|
|
422
|
+
address: Address;
|
|
423
|
+
coinType: CoinType;
|
|
424
|
+
} | null;
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Gets the Label used for the reverse names of subnames as per ENSIP-11 & ENSIP-19.
|
|
428
|
+
*
|
|
429
|
+
* @see https://docs.ens.domains/ensip/19/#reverse-resolution
|
|
430
|
+
*/
|
|
431
|
+
declare const addrReverseLabel: (address: Address) => LiteralLabel;
|
|
432
|
+
/**
|
|
433
|
+
* Converts `coinType` to prefix-free hex string.
|
|
434
|
+
*
|
|
435
|
+
* @see https://docs.ens.domains/ensip/19
|
|
436
|
+
*/
|
|
437
|
+
declare const coinTypeReverseLabel: (coinType: CoinType) => Label;
|
|
438
|
+
/**
|
|
439
|
+
* Gets the reverse name for an address according to ENSIP-11 & ENSIP-19.
|
|
440
|
+
*
|
|
441
|
+
* @see https://docs.ens.domains/ensip/11#specification
|
|
442
|
+
* @see https://docs.ens.domains/ensip/19#specification
|
|
443
|
+
*
|
|
444
|
+
* @param address - The address to get the reverse name for
|
|
445
|
+
* @param coinType - The coin type to use for the reverse name
|
|
446
|
+
* @returns The reverse name for the address
|
|
447
|
+
*
|
|
448
|
+
* @example
|
|
449
|
+
* ```ts
|
|
450
|
+
* reverseName("0x1234", BigInt(ETH_COIN_TYPE)) // "1234.addr.reverse"
|
|
451
|
+
* reverseName("0x1234", BigInt(0x80000000)) // "1234.default.reverse"
|
|
452
|
+
* reverseName("0x1234", BigInt(0x5678)) // "1234.5678.reverse"
|
|
453
|
+
* ```
|
|
454
|
+
*/
|
|
455
|
+
declare function reverseName(address: Address, coinType: CoinType): Name;
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Implements one step of the namehash algorithm, combining `labelHash` with `node` to produce
|
|
459
|
+
* the `node` of a given subdomain. Note that the order of the arguments is 'reversed' (as compared to
|
|
460
|
+
* the actual concatenation) in order to improve readability (i.e. read as [labelHash].[node]).
|
|
461
|
+
*/
|
|
462
|
+
declare const makeSubdomainNode: (labelHash: LabelHash, node: Node) => Node;
|
|
463
|
+
/**
|
|
464
|
+
* Encodes a uint256 bigint as hex string sized to 32 bytes.
|
|
465
|
+
* Uses include, in the context of ENS, decoding the uint256-encoded tokenId of NFT-issuing contracts
|
|
466
|
+
* into Node or LabelHash, which is a common behavior in the ENS ecosystem.
|
|
467
|
+
* (see NameWrapper, ETHRegistrarController)
|
|
468
|
+
*/
|
|
469
|
+
declare const uint256ToHex32: (num: bigint) => Hex;
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* Chain ID
|
|
473
|
+
*
|
|
474
|
+
* Represents a unique identifier for a chain.
|
|
475
|
+
* Guaranteed to be a positive integer.
|
|
476
|
+
**/
|
|
477
|
+
type ChainId = number;
|
|
478
|
+
/**
|
|
479
|
+
* Defaultable Chain ID
|
|
480
|
+
*
|
|
481
|
+
* Represents a unique identifier for a chain, or
|
|
482
|
+
* the default chain as defined by ENSIP-19.
|
|
483
|
+
*
|
|
484
|
+
* @see https://docs.ens.domains/ensip/19/#annex-supported-chains
|
|
485
|
+
*
|
|
486
|
+
* Guaranteed to be a non-negative integer.
|
|
487
|
+
**/
|
|
488
|
+
type DefaultableChainId = typeof DEFAULT_EVM_CHAIN_ID | ChainId;
|
|
489
|
+
/**
|
|
490
|
+
* Represents an account (contract or EOA) at `address` on chain `chainId`.
|
|
491
|
+
*
|
|
492
|
+
* @see https://chainagnostic.org/CAIPs/caip-10
|
|
493
|
+
*/
|
|
494
|
+
interface AccountId {
|
|
495
|
+
chainId: ChainId;
|
|
496
|
+
address: Address;
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Block Number
|
|
500
|
+
*
|
|
501
|
+
* Guaranteed to be a non-negative integer.
|
|
502
|
+
*/
|
|
503
|
+
type BlockNumber = number;
|
|
504
|
+
/**
|
|
505
|
+
* Datetime value
|
|
506
|
+
*/
|
|
507
|
+
type Datetime = Date;
|
|
508
|
+
/**
|
|
509
|
+
* Unix timestamp value
|
|
510
|
+
*
|
|
511
|
+
* Represents the number of seconds that have elapsed
|
|
512
|
+
* since January 1, 1970 (midnight UTC/GMT).
|
|
513
|
+
*
|
|
514
|
+
* Guaranteed to be an integer. May be zero or negative to represent a time at or
|
|
515
|
+
* before Jan 1, 1970.
|
|
516
|
+
*/
|
|
517
|
+
type UnixTimestamp = number;
|
|
518
|
+
/**
|
|
519
|
+
* Represents a URL that is used for RPC endpoints.
|
|
520
|
+
*/
|
|
521
|
+
type RpcUrl = URL;
|
|
522
|
+
/**
|
|
523
|
+
* BlockRef
|
|
524
|
+
*
|
|
525
|
+
* Describes a block.
|
|
526
|
+
*
|
|
527
|
+
* We use parameter types to maintain fields layout and documentation across
|
|
528
|
+
* the domain model and its serialized counterpart.
|
|
529
|
+
*/
|
|
530
|
+
interface BlockRef {
|
|
531
|
+
/** Block number (height) */
|
|
532
|
+
number: BlockNumber;
|
|
533
|
+
/** Block timestamp */
|
|
534
|
+
timestamp: UnixTimestamp;
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Block range
|
|
538
|
+
*
|
|
539
|
+
* Represents a range of blocks
|
|
540
|
+
*/
|
|
541
|
+
interface Blockrange<BlockType = BlockNumber> {
|
|
542
|
+
/** Start block number */
|
|
543
|
+
startBlock?: BlockType;
|
|
544
|
+
/** End block number */
|
|
545
|
+
endBlock?: BlockType;
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* Duration
|
|
549
|
+
*
|
|
550
|
+
* Representing a duration in seconds.
|
|
551
|
+
*
|
|
552
|
+
* Guaranteed to be a non-negative integer.
|
|
553
|
+
*/
|
|
554
|
+
type Duration = number;
|
|
555
|
+
/**
|
|
556
|
+
* A utility type that makes all properties of a type optional recursively,
|
|
557
|
+
* including nested objects and arrays.
|
|
558
|
+
*
|
|
559
|
+
* @example
|
|
560
|
+
* ```typescript
|
|
561
|
+
* type Config = {
|
|
562
|
+
* a: string;
|
|
563
|
+
* b: {
|
|
564
|
+
* x: number;
|
|
565
|
+
* y: { z: boolean };
|
|
566
|
+
* };
|
|
567
|
+
* c: { id: string }[];
|
|
568
|
+
* }
|
|
569
|
+
*
|
|
570
|
+
* type PartialConfig = DeepPartial<Config>;
|
|
571
|
+
* // Results in:
|
|
572
|
+
* // {
|
|
573
|
+
* // a?: string;
|
|
574
|
+
* // b?: {
|
|
575
|
+
* // x?: number;
|
|
576
|
+
* // y?: { z?: boolean };
|
|
577
|
+
* // };
|
|
578
|
+
* // c?: { id?: string }[];
|
|
579
|
+
* // }
|
|
580
|
+
*
|
|
581
|
+
* // Usage:
|
|
582
|
+
* const update: PartialConfig = { b: { y: { z: true } } };
|
|
583
|
+
* ```
|
|
584
|
+
*/
|
|
585
|
+
type DeepPartial<T> = {
|
|
586
|
+
[P in keyof T]?: T[P] extends (infer U)[] ? DeepPartial<U>[] : T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
587
|
+
};
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* Determines where the provided AccountId values represent the same address on the same chain.
|
|
591
|
+
*/
|
|
592
|
+
declare const accountIdEqual: (a: AccountId, b: AccountId) => boolean;
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* Converts an EVM address to its lowercase representation.
|
|
596
|
+
*
|
|
597
|
+
* @param address - EVM address to convert.
|
|
598
|
+
* @returns The lowercase representation of the EVM address.
|
|
599
|
+
*/
|
|
600
|
+
declare function asLowerCaseAddress(address: Address): Address;
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Cache that maps from string -> ValueType.
|
|
604
|
+
*/
|
|
605
|
+
interface Cache<KeyType extends string, ValueType> {
|
|
606
|
+
/**
|
|
607
|
+
* Store a value in the cache with the given key.
|
|
608
|
+
*
|
|
609
|
+
* @param key Cache key
|
|
610
|
+
* @param value Value to store
|
|
611
|
+
*/
|
|
612
|
+
set(key: KeyType, value: ValueType): void;
|
|
613
|
+
/**
|
|
614
|
+
* Retrieve a value from the cache with the given key.
|
|
615
|
+
*
|
|
616
|
+
* @param key Cache key
|
|
617
|
+
* @returns The cached value if it exists, otherwise undefined
|
|
618
|
+
*/
|
|
619
|
+
get(key: KeyType): ValueType | undefined;
|
|
620
|
+
/**
|
|
621
|
+
* Clear the cache.
|
|
622
|
+
*/
|
|
623
|
+
clear(): void;
|
|
624
|
+
/**
|
|
625
|
+
* The current number of items in the cache. Always a non-negative integer.
|
|
626
|
+
*/
|
|
627
|
+
get size(): number;
|
|
628
|
+
/**
|
|
629
|
+
* The maximum number of items in the cache. Always a non-negative integer that is >= size().
|
|
630
|
+
*/
|
|
631
|
+
get capacity(): number;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* Cache that maps from string -> ValueType with a LRU (least recently used) eviction policy.
|
|
636
|
+
*
|
|
637
|
+
* `get` and `set` are O(1) operations.
|
|
638
|
+
*
|
|
639
|
+
* @link https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU
|
|
640
|
+
*/
|
|
641
|
+
declare class LruCache<KeyType extends string, ValueType> implements Cache<KeyType, ValueType> {
|
|
642
|
+
private readonly _cache;
|
|
643
|
+
private readonly _capacity;
|
|
644
|
+
/**
|
|
645
|
+
* Create a new LRU cache with the given capacity.
|
|
646
|
+
*
|
|
647
|
+
* @param capacity The maximum number of items in the cache. If set to 0, the cache is effectively disabled.
|
|
648
|
+
* @throws Error if capacity is not a non-negative integer.
|
|
649
|
+
*/
|
|
650
|
+
constructor(capacity: number);
|
|
651
|
+
set(key: string, value: ValueType): void;
|
|
652
|
+
get(key: string): ValueType | undefined;
|
|
653
|
+
clear(): void;
|
|
654
|
+
get size(): number;
|
|
655
|
+
get capacity(): number;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
interface SWRCacheOptions<ValueType> {
|
|
659
|
+
/**
|
|
660
|
+
* The async function generating a value of `ValueType` to wrap with SWR caching. It may throw an
|
|
661
|
+
* Error type.
|
|
662
|
+
*/
|
|
663
|
+
fn: () => Promise<ValueType>;
|
|
664
|
+
/**
|
|
665
|
+
* Time-to-live duration of a cached result in seconds. After this duration:
|
|
666
|
+
* - the currently cached result is considered "stale" but is still retained in the cache
|
|
667
|
+
* until successfully replaced.
|
|
668
|
+
* - Each time the cache is read, if the cached result is "stale" and no background
|
|
669
|
+
* revalidation attempt is already in progress, a new background revalidation
|
|
670
|
+
* attempt will be made.
|
|
671
|
+
*/
|
|
672
|
+
ttl: Duration;
|
|
673
|
+
/**
|
|
674
|
+
* Optional time-to-proactively-revalidate duration in seconds. After a cached result is
|
|
675
|
+
* initialized, and this duration has passed, attempts to asynchronously revalidate
|
|
676
|
+
* the cached result will be proactively made in the background on this interval.
|
|
677
|
+
*/
|
|
678
|
+
proactiveRevalidationInterval?: Duration;
|
|
679
|
+
/**
|
|
680
|
+
* Optional proactive initialization. Defaults to `false`.
|
|
681
|
+
*
|
|
682
|
+
* If `true`: The SWR cache will proactively initialize itself.
|
|
683
|
+
* If `false`: The SWR cache will lazily wait to initialize itself until the first read.
|
|
684
|
+
*/
|
|
685
|
+
proactivelyInitialize?: boolean;
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Stale-While-Revalidate (SWR) cache for async functions.
|
|
689
|
+
*
|
|
690
|
+
* This caching strategy serves cached data immediately (even if stale) while
|
|
691
|
+
* asynchronously revalidating the cache in the background. This provides:
|
|
692
|
+
* - Sub-millisecond response times (after first fetch)
|
|
693
|
+
* - Always available data (serves stale data during revalidation)
|
|
694
|
+
* - Automatic background updates via configurable intervals
|
|
695
|
+
*
|
|
696
|
+
* @example
|
|
697
|
+
* ```typescript
|
|
698
|
+
* const cache = new SWRCache({
|
|
699
|
+
* fn: async () => fetch('/api/data').then(r => r.json()),
|
|
700
|
+
* ttl: 60, // 1 minute TTL
|
|
701
|
+
* proactiveRevalidationInterval: 300 // proactively revalidate every 5 minutes
|
|
702
|
+
* });
|
|
703
|
+
*
|
|
704
|
+
* // Returns cached data or waits for initial fetch
|
|
705
|
+
* const data = await cache.read();
|
|
706
|
+
*
|
|
707
|
+
* if (data instanceof Error) { ... }
|
|
708
|
+
* ```
|
|
709
|
+
*
|
|
710
|
+
* @link https://web.dev/stale-while-revalidate/
|
|
711
|
+
* @link https://datatracker.ietf.org/doc/html/rfc5861
|
|
712
|
+
*/
|
|
713
|
+
declare class SWRCache<ValueType> {
|
|
714
|
+
private readonly options;
|
|
715
|
+
private cache;
|
|
716
|
+
private inProgressRevalidate;
|
|
717
|
+
private backgroundInterval;
|
|
718
|
+
constructor(options: SWRCacheOptions<ValueType>);
|
|
719
|
+
private revalidate;
|
|
720
|
+
/**
|
|
721
|
+
* Read the most recently cached result from the `SWRCache`.
|
|
722
|
+
*
|
|
723
|
+
* @returns a `ValueType` that was most recently successfully returned by `fn` or `Error` if `fn`
|
|
724
|
+
* has never successfully returned.
|
|
725
|
+
*/
|
|
726
|
+
read(): Promise<ValueType | Error>;
|
|
727
|
+
/**
|
|
728
|
+
* Destroys the background revalidation interval, if exists.
|
|
729
|
+
*/
|
|
730
|
+
destroy(): void;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
* Cache that maps from string -> ValueType with TTL (time-to-live) expiration.
|
|
735
|
+
*
|
|
736
|
+
* Items are automatically removed when they expire.
|
|
737
|
+
*/
|
|
738
|
+
declare class TtlCache<KeyType extends string, ValueType> implements Cache<KeyType, ValueType> {
|
|
739
|
+
private readonly _cache;
|
|
740
|
+
private readonly _ttl;
|
|
741
|
+
/**
|
|
742
|
+
* Create a new TTL cache with the given TTL.
|
|
743
|
+
*
|
|
744
|
+
* @param ttl Time-to-live duration in seconds. Items expire after this duration.
|
|
745
|
+
*/
|
|
746
|
+
constructor(ttl: Duration);
|
|
747
|
+
private _cleanup;
|
|
748
|
+
set(key: string, value: ValueType): void;
|
|
749
|
+
get(key: string): ValueType | undefined;
|
|
750
|
+
clear(): void;
|
|
751
|
+
get size(): number;
|
|
752
|
+
get capacity(): number;
|
|
753
|
+
has(key: string): boolean;
|
|
754
|
+
delete(key: string): boolean;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
/**
|
|
758
|
+
* Filter out duplicates.
|
|
759
|
+
*/
|
|
760
|
+
declare const uniq: <T>(arr: T[]) => T[];
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* Identifiers for supported currencies.
|
|
764
|
+
*
|
|
765
|
+
* TODO: Add support for WETH
|
|
766
|
+
*/
|
|
767
|
+
declare const CurrencyIds: {
|
|
768
|
+
readonly ETH: "ETH";
|
|
769
|
+
readonly USDC: "USDC";
|
|
770
|
+
readonly DAI: "DAI";
|
|
771
|
+
};
|
|
772
|
+
type CurrencyId = (typeof CurrencyIds)[keyof typeof CurrencyIds];
|
|
773
|
+
/**
|
|
774
|
+
* The amount of the currency in the smallest unit of the currency
|
|
775
|
+
* (see {@link CurrencyInfo.decimals} for the currency).
|
|
776
|
+
*
|
|
777
|
+
* Guaranteed to be non-negative.
|
|
778
|
+
*/
|
|
779
|
+
type CurrencyAmount = bigint;
|
|
780
|
+
/**
|
|
781
|
+
* Serialized representation of {@link CurrencyAmount}.
|
|
782
|
+
*/
|
|
783
|
+
type SerializedCurrencyAmount = string;
|
|
784
|
+
interface PriceEth {
|
|
785
|
+
currency: typeof CurrencyIds.ETH;
|
|
786
|
+
amount: CurrencyAmount;
|
|
787
|
+
}
|
|
788
|
+
interface PriceDai {
|
|
789
|
+
currency: typeof CurrencyIds.DAI;
|
|
790
|
+
amount: CurrencyAmount;
|
|
791
|
+
}
|
|
792
|
+
interface PriceUsdc {
|
|
793
|
+
currency: typeof CurrencyIds.USDC;
|
|
794
|
+
amount: CurrencyAmount;
|
|
795
|
+
}
|
|
796
|
+
type Price = PriceEth | PriceDai | PriceUsdc;
|
|
797
|
+
/**
|
|
798
|
+
* Serialized representation of {@link PriceEth}.
|
|
799
|
+
*/
|
|
800
|
+
interface SerializedPriceEth extends Omit<PriceEth, "amount"> {
|
|
801
|
+
amount: SerializedCurrencyAmount;
|
|
802
|
+
}
|
|
803
|
+
/**
|
|
804
|
+
* Serialized representation of {@link PriceDai}.
|
|
805
|
+
*/
|
|
806
|
+
interface SerializedPriceDai extends Omit<PriceDai, "amount"> {
|
|
807
|
+
amount: SerializedCurrencyAmount;
|
|
808
|
+
}
|
|
809
|
+
/**
|
|
810
|
+
* Serialized representation of {@link PriceUsdc}.
|
|
811
|
+
*/
|
|
812
|
+
interface SerializedPriceUsdc extends Omit<PriceUsdc, "amount"> {
|
|
813
|
+
amount: SerializedCurrencyAmount;
|
|
814
|
+
}
|
|
815
|
+
/**
|
|
816
|
+
* Serialized representation of {@link Price}.
|
|
817
|
+
*/
|
|
818
|
+
type SerializedPrice = SerializedPriceEth | SerializedPriceDai | SerializedPriceUsdc;
|
|
819
|
+
interface CurrencyInfo {
|
|
820
|
+
id: CurrencyId;
|
|
821
|
+
name: string;
|
|
822
|
+
decimals: number;
|
|
823
|
+
}
|
|
824
|
+
/**
|
|
825
|
+
* Get currency info for a provided currency.
|
|
826
|
+
*/
|
|
827
|
+
declare function getCurrencyInfo(currencyId: CurrencyId): CurrencyInfo;
|
|
828
|
+
/**
|
|
829
|
+
* Create price in ETH for given amount.
|
|
830
|
+
*/
|
|
831
|
+
declare function priceEth(amount: Price["amount"]): PriceEth;
|
|
832
|
+
/**
|
|
833
|
+
* Create price in USDC for given amount.
|
|
834
|
+
*/
|
|
835
|
+
declare function priceUsdc(amount: Price["amount"]): PriceUsdc;
|
|
836
|
+
/**
|
|
837
|
+
* Create price in DAI for given amount.
|
|
838
|
+
*/
|
|
839
|
+
declare function priceDai(amount: Price["amount"]): PriceDai;
|
|
840
|
+
/**
|
|
841
|
+
* Check if two prices have the same currency.
|
|
842
|
+
*/
|
|
843
|
+
declare function isPriceCurrencyEqual(priceA: Price, priceB: Price): boolean;
|
|
844
|
+
/**
|
|
845
|
+
* Check if two {@link Price} values have the same currency and amount.
|
|
846
|
+
*/
|
|
847
|
+
declare function isPriceEqual(priceA: Price, priceB: Price): boolean;
|
|
848
|
+
/**
|
|
849
|
+
* Add prices
|
|
850
|
+
*
|
|
851
|
+
* @param prices at least two {@link Price} values to be added together.
|
|
852
|
+
* @returns total of all prices.
|
|
853
|
+
* @throws if not all prices have the same currency.
|
|
854
|
+
*/
|
|
855
|
+
declare function addPrices<const PriceType extends Price = Price>(...prices: [PriceType, PriceType, ...PriceType[]]): PriceType;
|
|
856
|
+
|
|
857
|
+
/**
|
|
858
|
+
* Gets the AccountId for the contract in the specified namespace, datasource, and
|
|
859
|
+
* contract name, or undefined if it is not defined or is not a single AccountId.
|
|
860
|
+
*
|
|
861
|
+
* This is useful when you want to retrieve the AccountId for a contract by its name
|
|
862
|
+
* where it may or may not actually be defined for the given namespace and datasource.
|
|
863
|
+
*
|
|
864
|
+
* @param namespaceId - The ENSNamespace identifier (e.g. 'mainnet', 'sepolia', 'holesky',
|
|
865
|
+
* 'ens-test-env')
|
|
866
|
+
* @param datasourceName - The name of the Datasource to search for contractName in
|
|
867
|
+
* @param contractName - The name of the contract to retrieve
|
|
868
|
+
* @returns The AccountId of the contract with the given namespace, datasource,
|
|
869
|
+
* and contract name, or undefined if it is not found or is not a single AccountId
|
|
870
|
+
*/
|
|
871
|
+
declare const maybeGetDatasourceContract: (namespaceId: ENSNamespaceId, datasourceName: DatasourceName, contractName: string) => AccountId | undefined;
|
|
872
|
+
/**
|
|
873
|
+
* Gets the AccountId for the contract in the specified namespace, datasource, and
|
|
874
|
+
* contract name, or throws an error if it is not defined or is not a single AccountId.
|
|
875
|
+
*
|
|
876
|
+
* @param namespaceId - The ENSNamespace identifier (e.g. 'mainnet', 'sepolia', 'holesky',
|
|
877
|
+
* 'ens-test-env')
|
|
878
|
+
* @param datasourceName - The name of the Datasource to search for contractName in
|
|
879
|
+
* @param contractName - The name of the contract to retrieve
|
|
880
|
+
* @returns The AccountId of the contract with the given namespace, datasource,
|
|
881
|
+
* and contract name
|
|
882
|
+
* @throws Error if the contract is not found or is not a single AccountId
|
|
883
|
+
*/
|
|
884
|
+
declare const getDatasourceContract: (namespaceId: ENSNamespaceId, datasourceName: DatasourceName, contractName: string) => AccountId;
|
|
885
|
+
|
|
886
|
+
/**
|
|
887
|
+
* Duration between two moments in time.
|
|
888
|
+
*/
|
|
889
|
+
declare function durationBetween(start: UnixTimestamp, end: UnixTimestamp): Duration;
|
|
890
|
+
/**
|
|
891
|
+
* Add a duration to a timestamp.
|
|
892
|
+
*/
|
|
893
|
+
declare function addDuration(timestamp: UnixTimestamp, duration: Duration): UnixTimestamp;
|
|
894
|
+
|
|
895
|
+
/**
|
|
896
|
+
* Serialized representation of {@link ChainId}.
|
|
897
|
+
**/
|
|
898
|
+
type ChainIdString = string;
|
|
899
|
+
/**
|
|
900
|
+
* Datetime value following the ISO 8601 standard.
|
|
901
|
+
*
|
|
902
|
+
* @see https://www.iso.org/iso-8601-date-and-time-format.html
|
|
903
|
+
*/
|
|
904
|
+
type DatetimeISO8601 = string;
|
|
905
|
+
/**
|
|
906
|
+
* Serialized representation of a {@link URL}.
|
|
907
|
+
*/
|
|
908
|
+
type UrlString = string;
|
|
909
|
+
/**
|
|
910
|
+
* String representation of {@link AccountId}.
|
|
911
|
+
*
|
|
912
|
+
* Formatted as a fully lowercase CAIP-10 AccountId.
|
|
913
|
+
*
|
|
914
|
+
* @see https://chainagnostic.org/CAIPs/caip-10
|
|
915
|
+
*/
|
|
916
|
+
type AccountIdString = string;
|
|
917
|
+
|
|
918
|
+
declare function deserializeChainId(maybeChainId: ChainIdString, valueLabel?: string): ChainId;
|
|
919
|
+
declare function deserializeDatetime(maybeDatetime: string, valueLabel?: string): Datetime;
|
|
920
|
+
declare function deserializeUnixTimestamp(maybeTimestamp: number, valueLabel?: string): number;
|
|
921
|
+
declare function deserializeUrl(maybeUrl: UrlString, valueLabel?: string): URL;
|
|
922
|
+
declare function deserializeBlockNumber(maybeBlockNumber: number, valueLabel?: string): BlockNumber;
|
|
923
|
+
declare function deserializeBlockrange(maybeBlockrange: Partial<Blockrange>, valueLabel?: string): {
|
|
924
|
+
startBlock?: number | undefined;
|
|
925
|
+
endBlock?: number | undefined;
|
|
926
|
+
};
|
|
927
|
+
declare function deserializeBlockRef(maybeBlockRef: Partial<BlockRef>, valueLabel?: string): BlockRef;
|
|
928
|
+
declare function deserializeDuration(maybeDuration: unknown, valueLabel?: string): Duration;
|
|
929
|
+
declare function parseAccountId(maybeAccountId: unknown, valueLabel?: string): AccountId;
|
|
930
|
+
|
|
931
|
+
/**
|
|
932
|
+
* Interprets a Literal Label, producing an Interpreted Label.
|
|
933
|
+
*
|
|
934
|
+
* @see https://ensnode.io/docs/reference/terminology#literal-label
|
|
935
|
+
* @see https://ensnode.io/docs/reference/terminology#interpreted-label
|
|
936
|
+
*
|
|
937
|
+
* @param label - The Literal Label string to interpret
|
|
938
|
+
* @returns The provided label if it is a normalized label, else the EncodedLabelHash of the label
|
|
939
|
+
*/
|
|
940
|
+
declare function literalLabelToInterpretedLabel(label: LiteralLabel): InterpretedLabel;
|
|
941
|
+
/**
|
|
942
|
+
* Interprets an ordered list of Literal Labels, producing an Interpreted Name.
|
|
943
|
+
*
|
|
944
|
+
* Note that it's important that the Literal Labels are provided as an array, otherwise it's
|
|
945
|
+
* impossible to differentiate between 'a.label.eth' being ['a.label', 'eth'] or ['a', 'label', 'eth'].
|
|
946
|
+
*
|
|
947
|
+
* Note that the input is an ordered list of _Literal_ Labels: in this context, any literal label
|
|
948
|
+
* that is formatted as an Encoded LabelHash will NOT be interpreted as such. Instead it will be
|
|
949
|
+
* interpreted into an Encoded LabelHash that encodes the literal labelhash of the Literal Label.
|
|
950
|
+
*
|
|
951
|
+
* @param labels An ordered list of 0 or more Literal Labels
|
|
952
|
+
* @returns An InterpretedName
|
|
953
|
+
*/
|
|
954
|
+
declare function literalLabelsToInterpretedName(labels: LiteralLabel[]): InterpretedName;
|
|
955
|
+
/**
|
|
956
|
+
* Joins the list of Interpreted Labels with '.' to form an Interpreted Name.
|
|
957
|
+
*
|
|
958
|
+
* @param labels An ordered list of 0 or more Interpreted Labels
|
|
959
|
+
* @returns An InterpretedName
|
|
960
|
+
*/
|
|
961
|
+
declare function interpretedLabelsToInterpretedName(labels: InterpretedLabel[]): InterpretedName;
|
|
962
|
+
/**
|
|
963
|
+
* Joins the list of Literal Labels with '.' to form a Literal Name.
|
|
964
|
+
*
|
|
965
|
+
* Note: LiteralLabel values may contain '.' characters, which will be preserved
|
|
966
|
+
* in the resulting LiteralName. Therefore, the number of labels in the returned
|
|
967
|
+
* LiteralName may be greater than the number of LiteralLabels in the input array.
|
|
968
|
+
*
|
|
969
|
+
* @param labels An ordered list of 0 or more Literal Labels
|
|
970
|
+
* @returns An LiteralName
|
|
971
|
+
*/
|
|
972
|
+
declare function literalLabelsToLiteralName(labels: LiteralLabel[]): LiteralName;
|
|
973
|
+
|
|
974
|
+
/**
|
|
975
|
+
* Implements the ENS `labelhash` function for Literal Labels.
|
|
976
|
+
* @see https://docs.ens.domains/ensip/1
|
|
977
|
+
*
|
|
978
|
+
* @param label the Literal Label to hash
|
|
979
|
+
* @returns the hash of the provided label
|
|
980
|
+
* @dev This function is viem/ens#labelhash but without the special-case handling of Encoded LabelHashes.
|
|
981
|
+
*/
|
|
982
|
+
declare const labelhashLiteralLabel: (label: LiteralLabel) => LabelHash;
|
|
983
|
+
|
|
984
|
+
declare const hasNullByte: (value: string) => boolean;
|
|
985
|
+
declare const stripNullBytes: (value: string) => string;
|
|
986
|
+
|
|
987
|
+
/**
|
|
988
|
+
* Converts a bigint value into a number value.
|
|
989
|
+
*
|
|
990
|
+
* @throws when value is outside the range of `Number.MIN_SAFE_INTEGER` and
|
|
991
|
+
* `Number.MAX_SAFE_INTEGER`.
|
|
992
|
+
*/
|
|
993
|
+
declare function bigIntToNumber(n: bigint): number;
|
|
994
|
+
|
|
995
|
+
/**
|
|
996
|
+
* Serializes a {@link ChainId} value into its string representation.
|
|
997
|
+
*/
|
|
998
|
+
declare function serializeChainId(chainId: ChainId): ChainIdString;
|
|
999
|
+
/**
|
|
1000
|
+
* Serializes a {@link Datetime} value into its string representation.
|
|
1001
|
+
*/
|
|
1002
|
+
declare function serializeDatetime(datetime: Datetime): DatetimeISO8601;
|
|
1003
|
+
/**
|
|
1004
|
+
* Serializes a {@link URL} value into its string representation.
|
|
1005
|
+
*/
|
|
1006
|
+
declare function serializeUrl(url: URL): UrlString;
|
|
1007
|
+
/**
|
|
1008
|
+
* Serializes a {@link Price} object.
|
|
1009
|
+
*/
|
|
1010
|
+
declare function serializePrice(price: Price): SerializedPrice;
|
|
1011
|
+
/**
|
|
1012
|
+
* Serializes a {@link PriceEth} object.
|
|
1013
|
+
*/
|
|
1014
|
+
declare function serializePriceEth(price: PriceEth): SerializedPriceEth;
|
|
1015
|
+
/**
|
|
1016
|
+
* Format {@link AccountId} object as a string.
|
|
1017
|
+
*
|
|
1018
|
+
* Formatted as a fully lowercase CAIP-10 AccountId.
|
|
1019
|
+
*
|
|
1020
|
+
* @see https://chainagnostic.org/CAIPs/caip-10
|
|
1021
|
+
*/
|
|
1022
|
+
declare function formatAccountId(accountId: AccountId): AccountIdString;
|
|
1023
|
+
|
|
1024
|
+
declare function isHttpProtocol(url: URL): boolean;
|
|
1025
|
+
declare function isWebSocketProtocol(url: URL): boolean;
|
|
1026
|
+
|
|
1027
|
+
/**
|
|
1028
|
+
* A label set ID identifies a set of labels that can be used for deterministic healing.
|
|
1029
|
+
* A label set allows clients to deterministically heal their state against a server,
|
|
1030
|
+
* ensuring that both are operating on the same version of data.
|
|
1031
|
+
*
|
|
1032
|
+
* It is guaranteed to be 1 to 50 characters long and contain only lowercase letters (a-z)
|
|
1033
|
+
* and hyphens (-).
|
|
1034
|
+
*/
|
|
1035
|
+
type LabelSetId = string;
|
|
1036
|
+
/**
|
|
1037
|
+
* A label set version identifies a specific version of a label set. It allows clients to
|
|
1038
|
+
* request data from a specific snapshot in time, ensuring deterministic results.
|
|
1039
|
+
*
|
|
1040
|
+
* It is guaranteed to be a non-negative integer.
|
|
1041
|
+
*/
|
|
1042
|
+
type LabelSetVersion = number;
|
|
1043
|
+
/**
|
|
1044
|
+
* The label set preferences of an ENSRainbow client.
|
|
1045
|
+
*/
|
|
1046
|
+
interface EnsRainbowClientLabelSet {
|
|
1047
|
+
/**
|
|
1048
|
+
* Optional label set ID that the ENSRainbow server is expected to use. If provided, heal
|
|
1049
|
+
* operations will validate the ENSRainbow server is using this labelSetId.
|
|
1050
|
+
* Required if `labelSetVersion` is defined.
|
|
1051
|
+
*/
|
|
1052
|
+
labelSetId?: LabelSetId;
|
|
1053
|
+
/**
|
|
1054
|
+
* Optional highest label set version of label set id to query. Enables deterministic heal
|
|
1055
|
+
* results across time even if the ENSRainbow server ingests label sets with greater versions
|
|
1056
|
+
* than this value. If provided, only labels from label sets with versions less than or equal to this
|
|
1057
|
+
* value will be returned. If not provided, the server will use the latest available version.
|
|
1058
|
+
* When `labelSetVersion` is defined, `labelSetId` must also be defined.
|
|
1059
|
+
*/
|
|
1060
|
+
labelSetVersion?: LabelSetVersion;
|
|
1061
|
+
}
|
|
1062
|
+
/**
|
|
1063
|
+
* The state of label sets managed by an ENSRainbow server.
|
|
1064
|
+
*/
|
|
1065
|
+
interface EnsRainbowServerLabelSet {
|
|
1066
|
+
/**
|
|
1067
|
+
* The LabelSetId managed by the ENSRainbow server.
|
|
1068
|
+
*/
|
|
1069
|
+
labelSetId: LabelSetId;
|
|
1070
|
+
/**
|
|
1071
|
+
* The highest label set version available on the ENSRainbow server for the current
|
|
1072
|
+
* label set ID. This represents the most recent version of the label set that the
|
|
1073
|
+
* server has ingested and can provide label healing results for.
|
|
1074
|
+
*/
|
|
1075
|
+
highestLabelSetVersion: LabelSetVersion;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
/**
|
|
1079
|
+
* A PluginName is a unique id for a 'plugin': we use the notion of
|
|
1080
|
+
* 'plugins' to describe bundles of indexing logic.
|
|
1081
|
+
*/
|
|
1082
|
+
declare enum PluginName {
|
|
1083
|
+
Subgraph = "subgraph",
|
|
1084
|
+
Basenames = "basenames",
|
|
1085
|
+
Lineanames = "lineanames",
|
|
1086
|
+
ThreeDNS = "threedns",
|
|
1087
|
+
ProtocolAcceleration = "protocol-acceleration",
|
|
1088
|
+
Registrars = "registrars",
|
|
1089
|
+
TokenScope = "tokenscope"
|
|
1090
|
+
}
|
|
1091
|
+
/**
|
|
1092
|
+
* Version info about ENSIndexer and its dependencies.
|
|
1093
|
+
*/
|
|
1094
|
+
interface ENSIndexerVersionInfo {
|
|
1095
|
+
/**
|
|
1096
|
+
* Node.js runtime version
|
|
1097
|
+
*
|
|
1098
|
+
* @see https://nodejs.org/en/about/previous-releases
|
|
1099
|
+
**/
|
|
1100
|
+
nodejs: string;
|
|
1101
|
+
/**
|
|
1102
|
+
* Ponder framework version
|
|
1103
|
+
*
|
|
1104
|
+
* @see https://www.npmjs.com/package/ponder
|
|
1105
|
+
**/
|
|
1106
|
+
ponder: string;
|
|
1107
|
+
/**
|
|
1108
|
+
* ENSDb service version
|
|
1109
|
+
*
|
|
1110
|
+
* Guaranteed to be the same as {@link ENSIndexerVersionInfo.ensIndexer}.
|
|
1111
|
+
* */
|
|
1112
|
+
ensDb: string;
|
|
1113
|
+
/**
|
|
1114
|
+
* ENSIndexer service version
|
|
1115
|
+
*
|
|
1116
|
+
* @see https://ghcr.io/namehash/ensnode/ensindexer
|
|
1117
|
+
**/
|
|
1118
|
+
ensIndexer: string;
|
|
1119
|
+
/**
|
|
1120
|
+
* ENSRainbow service version
|
|
1121
|
+
*
|
|
1122
|
+
* @see https://ghcr.io/namehash/ensnode/ensindexer
|
|
1123
|
+
**/
|
|
1124
|
+
ensRainbow: string;
|
|
1125
|
+
/**
|
|
1126
|
+
* ENSRainbow schema version
|
|
1127
|
+
**/
|
|
1128
|
+
ensRainbowSchema: number;
|
|
1129
|
+
/**
|
|
1130
|
+
* ENS Normalize package version
|
|
1131
|
+
*
|
|
1132
|
+
* Available on NPM as: `@adraffy/ens-normalize`
|
|
1133
|
+
*
|
|
1134
|
+
* @see https://www.npmjs.com/package/@adraffy/ens-normalize
|
|
1135
|
+
**/
|
|
1136
|
+
ensNormalize: string;
|
|
1137
|
+
}
|
|
1138
|
+
/**
|
|
1139
|
+
* Complete public configuration object for ENSIndexer.
|
|
1140
|
+
*
|
|
1141
|
+
* We use parameter types to maintain fields layout and documentation across
|
|
1142
|
+
* the domain model and its serialized counterpart.
|
|
1143
|
+
*/
|
|
1144
|
+
interface ENSIndexerPublicConfig {
|
|
1145
|
+
/**
|
|
1146
|
+
* The ENS namespace that ENSNode operates in the context of.
|
|
1147
|
+
*
|
|
1148
|
+
* See {@link ENSNamespaceIds} for available namespace identifiers.
|
|
1149
|
+
*/
|
|
1150
|
+
namespace: ENSNamespaceId;
|
|
1151
|
+
/**
|
|
1152
|
+
* The "fully pinned" label set reference that ENSIndexer will request ENSRainbow use for deterministic label healing across time. This label set reference is "fully pinned" as it requires both the labelSetId and labelSetVersion fields to be defined.
|
|
1153
|
+
*/
|
|
1154
|
+
labelSet: Required<EnsRainbowClientLabelSet>;
|
|
1155
|
+
/**
|
|
1156
|
+
* A Postgres database schema name. This instance of ENSIndexer will write
|
|
1157
|
+
* indexed data to the tables in this schema.
|
|
1158
|
+
*
|
|
1159
|
+
* Invariants:
|
|
1160
|
+
* - Must be a non-empty string that is a valid Postgres database schema
|
|
1161
|
+
* identifier.
|
|
1162
|
+
*/
|
|
1163
|
+
databaseSchemaName: string;
|
|
1164
|
+
/**
|
|
1165
|
+
* A set of strings referring to the names of plugins that are active.
|
|
1166
|
+
*
|
|
1167
|
+
* For future-proofing, this is a list of strings that may or may
|
|
1168
|
+
* not be currently valid {@link PluginName} values.
|
|
1169
|
+
*
|
|
1170
|
+
* Invariants:
|
|
1171
|
+
* - A set of strings with at least one value.
|
|
1172
|
+
*/
|
|
1173
|
+
plugins: string[];
|
|
1174
|
+
/**
|
|
1175
|
+
* Indexed Chain IDs
|
|
1176
|
+
*
|
|
1177
|
+
* Includes the {@link ChainId} for each chain being indexed.
|
|
1178
|
+
*/
|
|
1179
|
+
indexedChainIds: Set<ChainId>;
|
|
1180
|
+
/**
|
|
1181
|
+
* A feature flag to enable/disable ENSIndexer's Subgraph Compatible Indexing Behavior.
|
|
1182
|
+
*
|
|
1183
|
+
* If {@link isSubgraphCompatible} is true, indexing behavior will match that of the legacy ENS
|
|
1184
|
+
* Subgraph.
|
|
1185
|
+
*
|
|
1186
|
+
* ENSIndexer will store and return Literal Labels and Literal Names without further interpretation.
|
|
1187
|
+
* @see https://ensnode.io/docs/reference/terminology#literal-label
|
|
1188
|
+
* @see https://ensnode.io/docs/reference/terminology#literal-name
|
|
1189
|
+
*
|
|
1190
|
+
* If {@link isSubgraphCompatible} is true, the following invariants are true for the ENSIndexerConfig:
|
|
1191
|
+
* 1. only the 'subgraph' plugin is enabled, and
|
|
1192
|
+
* 2. the labelSet must be { labelSetId: 'subgraph', labelSetVersion: 0 }
|
|
1193
|
+
*
|
|
1194
|
+
* If {@link isSubgraphCompatible} is false, ENSIndexer will additionally:
|
|
1195
|
+
*
|
|
1196
|
+
* 1. ENSIndexer will heal all subnames of addr.reverse on the ENS Root Chain.
|
|
1197
|
+
*
|
|
1198
|
+
* 2. ENSIndexer will track both the keys and the values of Resolver records.
|
|
1199
|
+
*
|
|
1200
|
+
* WARNING: Special care must be taken when interacting with indexed resolver record values. It
|
|
1201
|
+
* is unsafe to naively assume that indexed resolver record values are equivalent to the
|
|
1202
|
+
* resolver record values that would be returned through dynamic lookups via the ENS protocol.
|
|
1203
|
+
* For example, if a resolver implements CCIP-Read, the resolver records may not be
|
|
1204
|
+
* discoverable through onchain indexing.
|
|
1205
|
+
*
|
|
1206
|
+
* 3. Literal Labels and Literal Names encountered by ENSIndexer will be Interpreted.
|
|
1207
|
+
* @see https://ensnode.io/docs/reference/terminology#interpreted-label
|
|
1208
|
+
* @see https://ensnode.io/docs/reference/terminology#interpreted-name
|
|
1209
|
+
*
|
|
1210
|
+
* That is,
|
|
1211
|
+
* a) all Labels stored and returned by ENSIndexer will be Interpreted Labels, which are either:
|
|
1212
|
+
* i. normalized, or
|
|
1213
|
+
* ii. represented as an Encoded LabelHash of the Literal Label value found onchain, and
|
|
1214
|
+
* b) all Names stored and returned by ENSIndexer will be Interpreted Names, which are exclusively
|
|
1215
|
+
* composed of Interpreted Labels.
|
|
1216
|
+
*/
|
|
1217
|
+
isSubgraphCompatible: boolean;
|
|
1218
|
+
/**
|
|
1219
|
+
* Version info about ENSIndexer.
|
|
1220
|
+
*/
|
|
1221
|
+
versionInfo: ENSIndexerVersionInfo;
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
type SerializedIndexedChainIds = Array<ChainId>;
|
|
1225
|
+
/**
|
|
1226
|
+
* Serialized representation of {@link ENSIndexerPublicConfig}
|
|
1227
|
+
*/
|
|
1228
|
+
interface SerializedENSIndexerPublicConfig extends Omit<ENSIndexerPublicConfig, "indexedChainIds"> {
|
|
1229
|
+
/**
|
|
1230
|
+
* Array representation of {@link ENSIndexerPublicConfig.indexedChainIds}.
|
|
1231
|
+
*/
|
|
1232
|
+
indexedChainIds: ChainId[];
|
|
1233
|
+
}
|
|
1234
|
+
/**
|
|
1235
|
+
* Serialized representation of {@link ENSIndexerVersionInfo}
|
|
1236
|
+
*/
|
|
1237
|
+
type SerializedENSIndexerVersionInfo = ENSIndexerVersionInfo;
|
|
1238
|
+
|
|
1239
|
+
/**
|
|
1240
|
+
* Serialize a {@link ENSIndexerPublicConfig} object.
|
|
1241
|
+
*/
|
|
1242
|
+
declare function deserializeENSIndexerPublicConfig(maybeConfig: SerializedENSIndexerPublicConfig, valueLabel?: string): ENSIndexerPublicConfig;
|
|
1243
|
+
|
|
1244
|
+
/**
|
|
1245
|
+
* Determines if the provided `config` results in indexing behavior compatible with the legacy ENS
|
|
1246
|
+
* Subgraph.
|
|
1247
|
+
*
|
|
1248
|
+
* @see https://ensnode.io/docs/reference/subgraph-compatibility/
|
|
1249
|
+
*/
|
|
1250
|
+
declare function isSubgraphCompatible(config: Pick<ENSIndexerPublicConfig, "namespace" | "plugins" | "labelSet">): boolean;
|
|
1251
|
+
|
|
1252
|
+
/**
|
|
1253
|
+
* Converts a Labelhash to bytes, with validation
|
|
1254
|
+
* @param labelHash The Labelhash to convert
|
|
1255
|
+
* @returns A ByteArray containing the bytes
|
|
1256
|
+
* @throws Error if `labelHash` is not a valid 32-byte hex string
|
|
1257
|
+
*/
|
|
1258
|
+
declare function labelHashToBytes(labelHash: LabelHash): ByteArray;
|
|
1259
|
+
|
|
1260
|
+
/**
|
|
1261
|
+
* Builds a valid LabelSetId from a string.
|
|
1262
|
+
* @param maybeLabelSetId - The string to validate and convert to a LabelSetId.
|
|
1263
|
+
* @returns A valid LabelSetId.
|
|
1264
|
+
* @throws If the input string is not a valid LabelSetId.
|
|
1265
|
+
*/
|
|
1266
|
+
declare function buildLabelSetId(maybeLabelSetId: string): LabelSetId;
|
|
1267
|
+
/**
|
|
1268
|
+
* Builds a valid LabelSetVersion from a number or string.
|
|
1269
|
+
* @param maybeLabelSetVersion - The number or string to validate and convert to a LabelSetVersion.
|
|
1270
|
+
* @returns A valid LabelSetVersion.
|
|
1271
|
+
* @throws If the input is not a valid LabelSetVersion.
|
|
1272
|
+
*/
|
|
1273
|
+
declare function buildLabelSetVersion(maybeLabelSetVersion: number | string): LabelSetVersion;
|
|
1274
|
+
/**
|
|
1275
|
+
* Builds an EnsRainbowClientLabelSet.
|
|
1276
|
+
* @param labelSetId - The label set ID.
|
|
1277
|
+
* @param labelSetVersion - The label set version.
|
|
1278
|
+
* @returns A valid EnsRainbowClientLabelSet object.
|
|
1279
|
+
* @throws If `labelSetVersion` is defined without `labelSetId`.
|
|
1280
|
+
*/
|
|
1281
|
+
declare function buildEnsRainbowClientLabelSet(labelSetId?: LabelSetId, labelSetVersion?: LabelSetVersion): EnsRainbowClientLabelSet;
|
|
1282
|
+
/**
|
|
1283
|
+
* Validates that the server's label set is compatible with the client's requested label set.
|
|
1284
|
+
* @param serverSet - The label set provided by the server.
|
|
1285
|
+
* @param clientSet - The label set requested by the client.
|
|
1286
|
+
* @throws If the server set is not compatible with the client set.
|
|
1287
|
+
*/
|
|
1288
|
+
declare function validateSupportedLabelSetAndVersion(serverSet: EnsRainbowServerLabelSet, clientSet: EnsRainbowClientLabelSet): void;
|
|
1289
|
+
|
|
1290
|
+
/**
|
|
1291
|
+
* Parses a string into a non-negative integer.
|
|
1292
|
+
* @param input The string to parse
|
|
1293
|
+
* @returns The parsed non-negative integer
|
|
1294
|
+
* @throws Error if the input is not a valid non-negative integer
|
|
1295
|
+
*/
|
|
1296
|
+
declare function parseNonNegativeInteger(maybeNumber: string): number;
|
|
1297
|
+
|
|
1298
|
+
/**
|
|
1299
|
+
* Serializes a {@link ChainConfig} object.
|
|
1300
|
+
*/
|
|
1301
|
+
declare function serializeIndexedChainIds(indexedChainIds: Set<ChainId>): SerializedIndexedChainIds;
|
|
1302
|
+
/**
|
|
1303
|
+
* Serialize a {@link ENSIndexerPublicConfig} object.
|
|
1304
|
+
*/
|
|
1305
|
+
declare function serializeENSIndexerPublicConfig(config: ENSIndexerPublicConfig): SerializedENSIndexerPublicConfig;
|
|
1306
|
+
|
|
1307
|
+
/**
|
|
1308
|
+
* The type of indexing configuration for a chain.
|
|
1309
|
+
*/
|
|
1310
|
+
declare const ChainIndexingConfigTypeIds: {
|
|
1311
|
+
/**
|
|
1312
|
+
* Represents that indexing of the chain should be performed for an indefinite range.
|
|
1313
|
+
*/
|
|
1314
|
+
readonly Indefinite: "indefinite";
|
|
1315
|
+
/**
|
|
1316
|
+
* Represents that indexing of the chain should be performed for a definite range.
|
|
1317
|
+
*/
|
|
1318
|
+
readonly Definite: "definite";
|
|
1319
|
+
};
|
|
1320
|
+
/**
|
|
1321
|
+
* The derived string union of possible {@link ChainIndexingConfigTypeIds}.
|
|
1322
|
+
*/
|
|
1323
|
+
type ChainIndexingConfigTypeId = (typeof ChainIndexingConfigTypeIds)[keyof typeof ChainIndexingConfigTypeIds];
|
|
1324
|
+
/**
|
|
1325
|
+
* Chain indexing config for a chain whose indexing config `configType` is
|
|
1326
|
+
* {@link ChainIndexingConfigTypeIds.Indefinite}.
|
|
1327
|
+
*
|
|
1328
|
+
* Invariants:
|
|
1329
|
+
* - `configType` is always `ChainIndexingConfigTypeIds.Indefinite`.
|
|
1330
|
+
*/
|
|
1331
|
+
interface ChainIndexingConfigIndefinite {
|
|
1332
|
+
/**
|
|
1333
|
+
* The type of chain indexing config.
|
|
1334
|
+
*/
|
|
1335
|
+
configType: typeof ChainIndexingConfigTypeIds.Indefinite;
|
|
1336
|
+
/**
|
|
1337
|
+
* A {@link BlockRef} to the block where indexing of the chain should start.
|
|
1338
|
+
*/
|
|
1339
|
+
startBlock: BlockRef;
|
|
1340
|
+
}
|
|
1341
|
+
/**
|
|
1342
|
+
* Chain indexing config for a chain whose indexing config `configType` is
|
|
1343
|
+
* {@link ChainIndexingConfigTypeIds.Definite}.
|
|
1344
|
+
*
|
|
1345
|
+
* Invariants:
|
|
1346
|
+
* - `configType` is always `ChainIndexingConfigTypeIds.Definite`.
|
|
1347
|
+
* - `startBlock` is always before or the same as `endBlock`.
|
|
1348
|
+
*/
|
|
1349
|
+
interface ChainIndexingConfigDefinite {
|
|
1350
|
+
/**
|
|
1351
|
+
* The type of chain indexing config.
|
|
1352
|
+
*/
|
|
1353
|
+
configType: typeof ChainIndexingConfigTypeIds.Definite;
|
|
1354
|
+
/**
|
|
1355
|
+
* A {@link BlockRef} to the block where indexing of the chain should start.
|
|
1356
|
+
*/
|
|
1357
|
+
startBlock: BlockRef;
|
|
1358
|
+
/**
|
|
1359
|
+
* A {@link BlockRef} to the block where indexing of the chain should end.
|
|
1360
|
+
*/
|
|
1361
|
+
endBlock: BlockRef;
|
|
1362
|
+
}
|
|
1363
|
+
/**
|
|
1364
|
+
* Indexing configuration for a chain.
|
|
1365
|
+
*
|
|
1366
|
+
* Use the `configType` field to determine the specific type interpretation
|
|
1367
|
+
* at runtime.
|
|
1368
|
+
*/
|
|
1369
|
+
type ChainIndexingConfig = ChainIndexingConfigIndefinite | ChainIndexingConfigDefinite;
|
|
1370
|
+
/**
|
|
1371
|
+
* The status of indexing a chain at the time an indexing status snapshot
|
|
1372
|
+
* is captured.
|
|
1373
|
+
*/
|
|
1374
|
+
declare const ChainIndexingStatusIds: {
|
|
1375
|
+
/**
|
|
1376
|
+
* Represents that indexing of the chain is not ready to begin yet because:
|
|
1377
|
+
* - ENSIndexer is in its initialization phase and the data to build a
|
|
1378
|
+
* "true" {@link ChainIndexingSnapshot} for the chain is still being loaded; or
|
|
1379
|
+
* - ENSIndexer is using an omnichain indexing strategy and the
|
|
1380
|
+
* `omnichainIndexingCursor` is <= `config.startBlock.timestamp` for the chain's
|
|
1381
|
+
* {@link ChainIndexingSnapshot}.
|
|
1382
|
+
*/
|
|
1383
|
+
readonly Queued: "chain-queued";
|
|
1384
|
+
/**
|
|
1385
|
+
* Represents that indexing of the chain is in progress and under a special
|
|
1386
|
+
* "backfill" phase that optimizes for accelerated indexing until reaching the
|
|
1387
|
+
* "fixed target" `backfillEndBlock`.
|
|
1388
|
+
*/
|
|
1389
|
+
readonly Backfill: "chain-backfill";
|
|
1390
|
+
/**
|
|
1391
|
+
* Represents that the "backfill" phase of indexing the chain is completed
|
|
1392
|
+
* and that the chain is configured to be indexed for an indefinite range.
|
|
1393
|
+
* Therefore, indexing of the chain remains indefinitely in progress where
|
|
1394
|
+
* ENSIndexer will continuously work to discover and index new blocks as they
|
|
1395
|
+
* are added to the chain across time.
|
|
1396
|
+
*/
|
|
1397
|
+
readonly Following: "chain-following";
|
|
1398
|
+
/**
|
|
1399
|
+
* Represents that indexing of the chain is completed as the chain is configured
|
|
1400
|
+
* to be indexed for a definite range and the indexing of all blocks through
|
|
1401
|
+
* that definite range is completed.
|
|
1402
|
+
*/
|
|
1403
|
+
readonly Completed: "chain-completed";
|
|
1404
|
+
};
|
|
1405
|
+
/**
|
|
1406
|
+
* The derived string union of possible {@link ChainIndexingStatusIds}.
|
|
1407
|
+
*/
|
|
1408
|
+
type ChainIndexingStatusId = (typeof ChainIndexingStatusIds)[keyof typeof ChainIndexingStatusIds];
|
|
1409
|
+
/**
|
|
1410
|
+
* Chain indexing status snapshot for a chain whose `chainStatus` is
|
|
1411
|
+
* {@link ChainIndexingStatusIds.Queued}.
|
|
1412
|
+
*
|
|
1413
|
+
* Invariants:
|
|
1414
|
+
* - `chainStatus` is always {@link ChainIndexingStatusIds.Queued}.
|
|
1415
|
+
*/
|
|
1416
|
+
interface ChainIndexingStatusSnapshotQueued {
|
|
1417
|
+
/**
|
|
1418
|
+
* The status of indexing the chain at the time the indexing status snapshot
|
|
1419
|
+
* was captured.
|
|
1420
|
+
*/
|
|
1421
|
+
chainStatus: typeof ChainIndexingStatusIds.Queued;
|
|
1422
|
+
/**
|
|
1423
|
+
* The indexing configuration of the chain.
|
|
1424
|
+
*/
|
|
1425
|
+
config: ChainIndexingConfig;
|
|
1426
|
+
}
|
|
1427
|
+
/**
|
|
1428
|
+
* Chain indexing status snapshot for a chain whose `chainStatus` is
|
|
1429
|
+
* {@link ChainIndexingStatusIds.Backfill}.
|
|
1430
|
+
*
|
|
1431
|
+
* During a backfill, special performance optimizations are applied to
|
|
1432
|
+
* index all blocks between `config.startBlock` and `backfillEndBlock`
|
|
1433
|
+
* as fast as possible.
|
|
1434
|
+
*
|
|
1435
|
+
* Note how `backfillEndBlock` is a "fixed target" that does not change during
|
|
1436
|
+
* the lifetime of an ENSIndexer process instance:
|
|
1437
|
+
* - If the `config` is {@link ChainIndexingConfigDefinite}:
|
|
1438
|
+
* `backfillEndBlock` is always the same as `config.endBlock`.
|
|
1439
|
+
* - If the `config` is {@link ChainIndexingConfigIndefinite}:
|
|
1440
|
+
* `backfillEndBlock` is a {@link BlockRef} to what was the latest block on the
|
|
1441
|
+
* chain when the ENSIndexer process was performing its initialization. Note how
|
|
1442
|
+
* this means that if the backfill process takes X hours to complete, because the
|
|
1443
|
+
* `backfillEndBlock` is a "fixed target", when `chainStatus` transitions to
|
|
1444
|
+
* {@link ChainIndexingStatusIds.Following} the chain will be X hours behind
|
|
1445
|
+
* "realtime" indexing.
|
|
1446
|
+
*
|
|
1447
|
+
* When `latestIndexedBlock` reaches `backfillEndBlock` the backfill is complete.
|
|
1448
|
+
* The moment backfill is complete the `chainStatus` may not immediately transition.
|
|
1449
|
+
* Instead, internal processing is completed for a period of time while
|
|
1450
|
+
* `chainStatus` remains {@link ChainIndexingStatusIds.Backfill}. After this internal
|
|
1451
|
+
* processing is completed `chainStatus` will transition:
|
|
1452
|
+
* - to {@link ChainIndexingStatusIds.Following} if the `config` is
|
|
1453
|
+
* {@link ChainIndexingConfigIndefinite}.
|
|
1454
|
+
* - to {@link ChainIndexingStatusIds.Completed} if the `config` is
|
|
1455
|
+
* {@link ChainIndexingConfigDefinite}.
|
|
1456
|
+
*
|
|
1457
|
+
* Invariants:
|
|
1458
|
+
* - `chainStatus` is always {@link ChainIndexingStatusIds.Backfill}.
|
|
1459
|
+
* - `config.startBlock` is always before or the same as `latestIndexedBlock`
|
|
1460
|
+
* - `config.endBlock` is always the same as `backfillEndBlock` if and only if
|
|
1461
|
+
* the config is {@link ChainIndexingConfigDefinite}.
|
|
1462
|
+
* - `latestIndexedBlock` is always before or the same as `backfillEndBlock`
|
|
1463
|
+
*/
|
|
1464
|
+
interface ChainIndexingStatusSnapshotBackfill {
|
|
1465
|
+
/**
|
|
1466
|
+
* The status of indexing the chain at the time the indexing status snapshot
|
|
1467
|
+
* was captured.
|
|
1468
|
+
*/
|
|
1469
|
+
chainStatus: typeof ChainIndexingStatusIds.Backfill;
|
|
1470
|
+
/**
|
|
1471
|
+
* The indexing configuration of the chain.
|
|
1472
|
+
*/
|
|
1473
|
+
config: ChainIndexingConfig;
|
|
1474
|
+
/**
|
|
1475
|
+
* A {@link BlockRef} to the block that was most recently indexed as of the time the
|
|
1476
|
+
* indexing status snapshot was captured.
|
|
1477
|
+
*/
|
|
1478
|
+
latestIndexedBlock: BlockRef;
|
|
1479
|
+
/**
|
|
1480
|
+
* A {@link BlockRef} to the block where the backfill will end.
|
|
1481
|
+
*/
|
|
1482
|
+
backfillEndBlock: BlockRef;
|
|
1483
|
+
}
|
|
1484
|
+
/**
|
|
1485
|
+
* Chain indexing status snapshot for a chain whose `chainStatus` is
|
|
1486
|
+
* {@link ChainIndexingStatusIds.Following}.
|
|
1487
|
+
*
|
|
1488
|
+
* Invariants:
|
|
1489
|
+
* - `chainStatus` is always {@link ChainIndexingStatusIds.Following}.
|
|
1490
|
+
* - `config` is always {@link ChainIndexingConfigIndefinite}
|
|
1491
|
+
* - `config.startBlock` is always before or the same as `latestIndexedBlock`
|
|
1492
|
+
* - `latestIndexedBlock` is always before or the same as `latestKnownBlock`
|
|
1493
|
+
*/
|
|
1494
|
+
interface ChainIndexingStatusSnapshotFollowing {
|
|
1495
|
+
/**
|
|
1496
|
+
* The status of indexing the chain at the time the indexing status snapshot
|
|
1497
|
+
* was captured.
|
|
1498
|
+
*/
|
|
1499
|
+
chainStatus: typeof ChainIndexingStatusIds.Following;
|
|
1500
|
+
/**
|
|
1501
|
+
* The indexing configuration of the chain.
|
|
1502
|
+
*/
|
|
1503
|
+
config: ChainIndexingConfigIndefinite;
|
|
1504
|
+
/**
|
|
1505
|
+
* A {@link BlockRef} to the block that was most recently indexed as of the time the
|
|
1506
|
+
* indexing status snapshot was captured.
|
|
1507
|
+
*/
|
|
1508
|
+
latestIndexedBlock: BlockRef;
|
|
1509
|
+
/**
|
|
1510
|
+
* A {@link BlockRef} to the "highest" block that has been discovered by RPCs
|
|
1511
|
+
* and stored in the RPC cache as of the time the indexing status snapshot was
|
|
1512
|
+
* captured.
|
|
1513
|
+
*/
|
|
1514
|
+
latestKnownBlock: BlockRef;
|
|
1515
|
+
}
|
|
1516
|
+
/**
|
|
1517
|
+
* Chain indexing status snapshot for a chain whose `chainStatus` is
|
|
1518
|
+
* {@link ChainIndexingStatusIds.Completed}.
|
|
1519
|
+
*
|
|
1520
|
+
* After the backfill of a chain is completed, if the chain was configured
|
|
1521
|
+
* to be indexed for a definite range, the chain indexing status will transition to
|
|
1522
|
+
* {@link ChainIndexingStatusIds.Completed}.
|
|
1523
|
+
*
|
|
1524
|
+
* Invariants:
|
|
1525
|
+
* - `chainStatus` is always {@link ChainIndexingStatusIds.Completed}.
|
|
1526
|
+
* - `config` is always {@link ChainIndexingConfigDefinite}
|
|
1527
|
+
* - `config.startBlock` is always before or the same as `latestIndexedBlock`
|
|
1528
|
+
* - `latestIndexedBlock` is always the same as `config.endBlock`.
|
|
1529
|
+
*/
|
|
1530
|
+
interface ChainIndexingStatusSnapshotCompleted {
|
|
1531
|
+
/**
|
|
1532
|
+
* The status of indexing the chain at the time the indexing status snapshot
|
|
1533
|
+
* was captured.
|
|
1534
|
+
*/
|
|
1535
|
+
chainStatus: typeof ChainIndexingStatusIds.Completed;
|
|
1536
|
+
/**
|
|
1537
|
+
* The indexing configuration of the chain.
|
|
1538
|
+
*/
|
|
1539
|
+
config: ChainIndexingConfigDefinite;
|
|
1540
|
+
/**
|
|
1541
|
+
* A {@link BlockRef} to the block that was most recently indexed as of the time the
|
|
1542
|
+
* indexing status snapshot was captured.
|
|
1543
|
+
*/
|
|
1544
|
+
latestIndexedBlock: BlockRef;
|
|
1545
|
+
}
|
|
1546
|
+
/**
|
|
1547
|
+
* Indexing status snapshot for a single chain.
|
|
1548
|
+
*
|
|
1549
|
+
* Use the `chainStatus` field to determine the specific type interpretation
|
|
1550
|
+
* at runtime.
|
|
1551
|
+
*/
|
|
1552
|
+
type ChainIndexingStatusSnapshot = ChainIndexingStatusSnapshotQueued | ChainIndexingStatusSnapshotBackfill | ChainIndexingStatusSnapshotFollowing | ChainIndexingStatusSnapshotCompleted;
|
|
1553
|
+
/**
|
|
1554
|
+
* The status of omnichain indexing at the time an omnichain indexing status
|
|
1555
|
+
* snapshot is captured.
|
|
1556
|
+
*/
|
|
1557
|
+
declare const OmnichainIndexingStatusIds: {
|
|
1558
|
+
/**
|
|
1559
|
+
* Represents that omnichain indexing is not ready to begin yet because
|
|
1560
|
+
* ENSIndexer is in its initialization phase and the data to build a "true"
|
|
1561
|
+
* {@link OmnichainIndexingStatusSnapshot} is still being loaded.
|
|
1562
|
+
*/
|
|
1563
|
+
readonly Unstarted: "omnichain-unstarted";
|
|
1564
|
+
/**
|
|
1565
|
+
* Represents that omnichain indexing is in an overall "backfill" status because
|
|
1566
|
+
* - At least one indexed chain has a `chainStatus` of
|
|
1567
|
+
* {@link ChainIndexingStatusIds.Backfill}; and
|
|
1568
|
+
* - No indexed chain has a `chainStatus` of {@link ChainIndexingStatusIds.Following}.
|
|
1569
|
+
*/
|
|
1570
|
+
readonly Backfill: "omnichain-backfill";
|
|
1571
|
+
/**
|
|
1572
|
+
* Represents that omnichain indexing is in an overall "following" status because
|
|
1573
|
+
* at least one indexed chain has a `chainStatus` of
|
|
1574
|
+
* {@link ChainIndexingStatusIds.Following}.
|
|
1575
|
+
*/
|
|
1576
|
+
readonly Following: "omnichain-following";
|
|
1577
|
+
/**
|
|
1578
|
+
* Represents that omnichain indexing has completed because all indexed chains have
|
|
1579
|
+
* a `chainStatus` of {@link ChainIndexingStatusIds.Completed}.
|
|
1580
|
+
*/
|
|
1581
|
+
readonly Completed: "omnichain-completed";
|
|
1582
|
+
};
|
|
1583
|
+
/**
|
|
1584
|
+
* The derived string union of possible {@link OmnichainIndexingStatusIds}.
|
|
1585
|
+
*/
|
|
1586
|
+
type OmnichainIndexingStatusId = (typeof OmnichainIndexingStatusIds)[keyof typeof OmnichainIndexingStatusIds];
|
|
1587
|
+
/**
|
|
1588
|
+
* Omnichain indexing status snapshot when the overall `omnichainStatus` is
|
|
1589
|
+
* {@link OmnichainIndexingStatusIds.Unstarted}.
|
|
1590
|
+
*
|
|
1591
|
+
* Invariants:
|
|
1592
|
+
* - `omnichainStatus` is always {@link OmnichainIndexingStatusIds.Unstarted}.
|
|
1593
|
+
* - `chains` is always a map to {@link ChainIndexingStatusSnapshotQueued} values exclusively.
|
|
1594
|
+
* - `omnichainIndexingCursor` is always < the `config.startBlock.timestamp` for all
|
|
1595
|
+
* chains with `chainStatus` of {@link ChainIndexingStatusIds.Queued}.
|
|
1596
|
+
*/
|
|
1597
|
+
interface OmnichainIndexingStatusSnapshotUnstarted {
|
|
1598
|
+
/**
|
|
1599
|
+
* The status of omnichain indexing.
|
|
1600
|
+
*/
|
|
1601
|
+
omnichainStatus: typeof OmnichainIndexingStatusIds.Unstarted;
|
|
1602
|
+
/**
|
|
1603
|
+
* The indexing status snapshot for each indexed chain.
|
|
1604
|
+
*/
|
|
1605
|
+
chains: Map<ChainId, ChainIndexingStatusSnapshotQueued>;
|
|
1606
|
+
/**
|
|
1607
|
+
* The timestamp of omnichain indexing progress across all indexed chains.
|
|
1608
|
+
*/
|
|
1609
|
+
omnichainIndexingCursor: UnixTimestamp;
|
|
1610
|
+
}
|
|
1611
|
+
/**
|
|
1612
|
+
* The range of {@link ChainIndexingSnapshot} types allowed when the
|
|
1613
|
+
* overall omnichain indexing status is {@link OmnichainIndexingStatusIds.Backfill}.
|
|
1614
|
+
*
|
|
1615
|
+
* Note that this is all of the {@link ChainIndexingSnapshot} types with the exception
|
|
1616
|
+
* of {@link ChainIndexingStatusSnapshotFollowing}.
|
|
1617
|
+
*/
|
|
1618
|
+
type ChainIndexingStatusSnapshotForOmnichainIndexingStatusSnapshotBackfill = ChainIndexingStatusSnapshotQueued | ChainIndexingStatusSnapshotBackfill | ChainIndexingStatusSnapshotCompleted;
|
|
1619
|
+
/**
|
|
1620
|
+
* Omnichain indexing status snapshot when the `omnichainStatus` is
|
|
1621
|
+
* {@link OmnichainIndexingStatusIds.Backfill}.
|
|
1622
|
+
*
|
|
1623
|
+
* Invariants:
|
|
1624
|
+
* - `omnichainStatus` is always {@link OmnichainIndexingStatusIds.Backfill}.
|
|
1625
|
+
* - `chains` is guaranteed to contain at least one chain with a `chainStatus` of
|
|
1626
|
+
* {@link ChainIndexingStatusIds.Backfill}.
|
|
1627
|
+
* - `chains` is guaranteed to not to contain any chain with a `chainStatus` of
|
|
1628
|
+
* {@link ChainIndexingStatusIds.Following}
|
|
1629
|
+
* - `omnichainIndexingCursor` is always < the `config.startBlock.timestamp` for all
|
|
1630
|
+
* chains with `chainStatus` of {@link ChainIndexingStatusIds.Queued}.
|
|
1631
|
+
* - `omnichainIndexingCursor` is always <= the `backfillEndBlock.timestamp` for all
|
|
1632
|
+
* chains with `chainStatus` of {@link ChainIndexingStatusIds.Backfill}.
|
|
1633
|
+
* - `omnichainIndexingCursor` is always >= the `latestIndexedBlock.timestamp` for all
|
|
1634
|
+
* chains with `chainStatus` of {@link ChainIndexingStatusIds.Completed}.
|
|
1635
|
+
* - `omnichainIndexingCursor` is always equal to the timestamp of the highest
|
|
1636
|
+
* `latestIndexedBlock` across all chains that have started indexing
|
|
1637
|
+
* (`chainStatus` is not {@link ChainIndexingStatusIds.Queued}).
|
|
1638
|
+
*/
|
|
1639
|
+
interface OmnichainIndexingStatusSnapshotBackfill {
|
|
1640
|
+
/**
|
|
1641
|
+
* The status of omnichain indexing.
|
|
1642
|
+
*/
|
|
1643
|
+
omnichainStatus: typeof OmnichainIndexingStatusIds.Backfill;
|
|
1644
|
+
/**
|
|
1645
|
+
* The indexing status snapshot for each indexed chain.
|
|
1646
|
+
*/
|
|
1647
|
+
chains: Map<ChainId, ChainIndexingStatusSnapshotForOmnichainIndexingStatusSnapshotBackfill>;
|
|
1648
|
+
/**
|
|
1649
|
+
* The timestamp of omnichain indexing progress across all indexed chains.
|
|
1650
|
+
*/
|
|
1651
|
+
omnichainIndexingCursor: UnixTimestamp;
|
|
1652
|
+
}
|
|
1653
|
+
/**
|
|
1654
|
+
* Omnichain indexing status snapshot when the overall `omnichainStatus` is
|
|
1655
|
+
* {@link OmnichainIndexingStatusIds.Following}.
|
|
1656
|
+
*
|
|
1657
|
+
* Invariants:
|
|
1658
|
+
* - `omnichainStatus` is always {@link OmnichainIndexingStatusIds.Following}.
|
|
1659
|
+
* - `chains` is guaranteed to contain at least one chain with a `status` of
|
|
1660
|
+
* {@link ChainIndexingStatusIds.Following}.
|
|
1661
|
+
* - `omnichainIndexingCursor` is always < the `config.startBlock.timestamp` for all
|
|
1662
|
+
* chains with `chainStatus` of {@link ChainIndexingStatusIds.Queued}.
|
|
1663
|
+
* - `omnichainIndexingCursor` is always <= the `backfillEndBlock.timestamp` for all
|
|
1664
|
+
* chains with `chainStatus` of {@link ChainIndexingStatusIds.Backfill}.
|
|
1665
|
+
* - `omnichainIndexingCursor` is always >= the `latestIndexedBlock.timestamp` for all
|
|
1666
|
+
* chains with `chainStatus` of {@link ChainIndexingStatusIds.Completed}.
|
|
1667
|
+
* - `omnichainIndexingCursor` is always equal to the timestamp of the highest
|
|
1668
|
+
* `latestIndexedBlock` across all chains that have started indexing
|
|
1669
|
+
* (`chainStatus` is not {@link ChainIndexingStatusIds.Queued}).
|
|
1670
|
+
*/
|
|
1671
|
+
interface OmnichainIndexingStatusSnapshotFollowing {
|
|
1672
|
+
/**
|
|
1673
|
+
* The status of omnichain indexing.
|
|
1674
|
+
*/
|
|
1675
|
+
omnichainStatus: typeof OmnichainIndexingStatusIds.Following;
|
|
1676
|
+
/**
|
|
1677
|
+
* The indexing status snapshot for each indexed chain.
|
|
1678
|
+
*/
|
|
1679
|
+
chains: Map<ChainId, ChainIndexingStatusSnapshot>;
|
|
1680
|
+
/**
|
|
1681
|
+
* The timestamp of omnichain indexing progress across all indexed chains.
|
|
1682
|
+
*/
|
|
1683
|
+
omnichainIndexingCursor: UnixTimestamp;
|
|
1684
|
+
}
|
|
1685
|
+
/**
|
|
1686
|
+
* Omnichain indexing status snapshot when the overall `omnichainStatus` is
|
|
1687
|
+
* {@link OmnichainIndexingStatusIds.Completed}.
|
|
1688
|
+
*
|
|
1689
|
+
* Invariants:
|
|
1690
|
+
* - `omnichainStatus` is always {@link OmnichainIndexingStatusIds.Completed}.
|
|
1691
|
+
* - `chains` is always a map to {@link ChainIndexingStatusSnapshotCompleted} values exclusively.
|
|
1692
|
+
* - `omnichainIndexingCursor` is always equal to the highest
|
|
1693
|
+
* `latestIndexedBlock.timestamp` for all chains.
|
|
1694
|
+
*/
|
|
1695
|
+
interface OmnichainIndexingStatusSnapshotCompleted {
|
|
1696
|
+
/**
|
|
1697
|
+
* The status of omnichain indexing.
|
|
1698
|
+
*/
|
|
1699
|
+
omnichainStatus: typeof OmnichainIndexingStatusIds.Completed;
|
|
1700
|
+
/**
|
|
1701
|
+
* The indexing status snapshot for each indexed chain.
|
|
1702
|
+
*/
|
|
1703
|
+
chains: Map<ChainId, ChainIndexingStatusSnapshotCompleted>;
|
|
1704
|
+
/**
|
|
1705
|
+
* The timestamp of omnichain indexing progress across all indexed chains.
|
|
1706
|
+
*/
|
|
1707
|
+
omnichainIndexingCursor: UnixTimestamp;
|
|
1708
|
+
}
|
|
1709
|
+
/**
|
|
1710
|
+
* Omnichain indexing status snapshot for one or more chains.
|
|
1711
|
+
*
|
|
1712
|
+
* Use the `omnichainStatus` field to determine the specific type interpretation
|
|
1713
|
+
* at runtime.
|
|
1714
|
+
*/
|
|
1715
|
+
type OmnichainIndexingStatusSnapshot = OmnichainIndexingStatusSnapshotUnstarted | OmnichainIndexingStatusSnapshotBackfill | OmnichainIndexingStatusSnapshotCompleted | OmnichainIndexingStatusSnapshotFollowing;
|
|
1716
|
+
/**
|
|
1717
|
+
* The strategy used for indexing one or more chains.
|
|
1718
|
+
*
|
|
1719
|
+
* @see https://ponder.sh/docs/api-reference/ponder/config#parameters
|
|
1720
|
+
*/
|
|
1721
|
+
declare const CrossChainIndexingStrategyIds: {
|
|
1722
|
+
/**
|
|
1723
|
+
* Represents that the indexing of events across all indexed chains will
|
|
1724
|
+
* proceed in a deterministic "omnichain" ordering by block timestamp, chain ID,
|
|
1725
|
+
* and block number.
|
|
1726
|
+
*
|
|
1727
|
+
* This strategy is "deterministic" in that the order of processing cross-chain indexed
|
|
1728
|
+
* events and each resulting indexed data state transition recorded in ENSDb is always
|
|
1729
|
+
* the same for each ENSIndexer instance operating with an equivalent
|
|
1730
|
+
* `ENSIndexerConfig` and ENSIndexer version. However it also has the drawbacks of:
|
|
1731
|
+
* - increased indexing latency that must wait for the slowest indexed chain to
|
|
1732
|
+
* add new blocks or to discover new blocks through the configured RPCs.
|
|
1733
|
+
* - if any indexed chain gets "stuck" due to chain or RPC failures, all indexed chains
|
|
1734
|
+
* will be affected.
|
|
1735
|
+
*/
|
|
1736
|
+
readonly Omnichain: "omnichain";
|
|
1737
|
+
};
|
|
1738
|
+
/**
|
|
1739
|
+
* The derived string union of possible {@link CrossChainIndexingStrategyIds}.
|
|
1740
|
+
*/
|
|
1741
|
+
type CrossChainIndexingStrategyId = (typeof CrossChainIndexingStrategyIds)[keyof typeof CrossChainIndexingStrategyIds];
|
|
1742
|
+
/**
|
|
1743
|
+
* Cross-chain indexing status snapshot when the `strategy` is
|
|
1744
|
+
* {@link CrossChainIndexingStrategyId.Omnichain}.
|
|
1745
|
+
*
|
|
1746
|
+
* Invariants:
|
|
1747
|
+
* - `strategy` is always {@link CrossChainIndexingStrategyId.Omnichain}.
|
|
1748
|
+
* - `slowestChainIndexingCursor` is always equal to
|
|
1749
|
+
* `omnichainSnapshot.omnichainIndexingCursor`.
|
|
1750
|
+
* - `snapshotTime` is always >= the "highest known block timestamp", defined as the max of:
|
|
1751
|
+
* - the `slowestChainIndexingCursor`.
|
|
1752
|
+
* - the `config.startBlock.timestamp` for all indexed chains.
|
|
1753
|
+
* - the `config.endBlock.timestamp` for all indexed chains with a `config.configType` of
|
|
1754
|
+
* {@link ChainIndexingConfigTypeIds.Definite}.
|
|
1755
|
+
* - the `backfillEndBlock.timestamp` for all chains with `chainStatus` of
|
|
1756
|
+
* {@link ChainIndexingStatusIds.Backfill}.
|
|
1757
|
+
* - the `latestKnownBlock.timestamp` for all chains with `chainStatus` of
|
|
1758
|
+
* {@link ChainIndexingStatusIds.Following}.
|
|
1759
|
+
*/
|
|
1760
|
+
interface CrossChainIndexingStatusSnapshotOmnichain {
|
|
1761
|
+
/**
|
|
1762
|
+
* The strategy used for indexing one or more chains.
|
|
1763
|
+
*/
|
|
1764
|
+
strategy: typeof CrossChainIndexingStrategyIds.Omnichain;
|
|
1765
|
+
/**
|
|
1766
|
+
* The timestamp of the "slowest" latest indexed block timestamp
|
|
1767
|
+
* across all indexed chains.
|
|
1768
|
+
*/
|
|
1769
|
+
slowestChainIndexingCursor: UnixTimestamp;
|
|
1770
|
+
/**
|
|
1771
|
+
* The timestamp when the cross-chain indexing status snapshot was generated.
|
|
1772
|
+
*
|
|
1773
|
+
* Due to possible clock skew between different systems this value must be set
|
|
1774
|
+
* to the max of each of the following values to ensure all invariants are followed:
|
|
1775
|
+
* - the current system time of the system generating this cross-chain indexing
|
|
1776
|
+
* status snapshot.
|
|
1777
|
+
* - the "highest known block timestamp" (see invariants above for full definition).
|
|
1778
|
+
*/
|
|
1779
|
+
snapshotTime: UnixTimestamp;
|
|
1780
|
+
/**
|
|
1781
|
+
* The omnichain indexing status snapshot for one or more chains.
|
|
1782
|
+
*/
|
|
1783
|
+
omnichainSnapshot: OmnichainIndexingStatusSnapshot;
|
|
1784
|
+
}
|
|
1785
|
+
/**
|
|
1786
|
+
* Cross-chain indexing status snapshot for one or more chains.
|
|
1787
|
+
*
|
|
1788
|
+
* Use the `strategy` field to determine the specific type interpretation
|
|
1789
|
+
* at runtime.
|
|
1790
|
+
*
|
|
1791
|
+
* Currently, only omnichain indexing is supported. This type could theoretically
|
|
1792
|
+
* be extended to support other cross-chain indexing strategies in the future,
|
|
1793
|
+
* such as Ponder's "multichain" indexing strategy that indexes each chain
|
|
1794
|
+
* independently without deterministic ordering.
|
|
1795
|
+
*/
|
|
1796
|
+
type CrossChainIndexingStatusSnapshot = CrossChainIndexingStatusSnapshotOmnichain;
|
|
1797
|
+
/**
|
|
1798
|
+
* A "realtime" indexing status projection based on worst-case assumptions
|
|
1799
|
+
* from the `snapshot`.
|
|
1800
|
+
*
|
|
1801
|
+
* Invariants:
|
|
1802
|
+
* - `projectedAt` is always >= `snapshot.snapshotTime`.
|
|
1803
|
+
* - `worstCaseDistance` is always equal to
|
|
1804
|
+
* `projectedAt - snapshot.slowestChainIndexingCursor`.
|
|
1805
|
+
*/
|
|
1806
|
+
type RealtimeIndexingStatusProjection = {
|
|
1807
|
+
/**
|
|
1808
|
+
* The timestamp representing "now" as of the time this projection was generated.
|
|
1809
|
+
*/
|
|
1810
|
+
projectedAt: UnixTimestamp;
|
|
1811
|
+
/**
|
|
1812
|
+
* The distance between `projectedAt` and `snapshot.slowestChainIndexingCursor`.
|
|
1813
|
+
*
|
|
1814
|
+
* This is "worst-case" because it assumes all of the following:
|
|
1815
|
+
* - the `snapshot` (which may have `snapshot.snapshotTime < projectedAt`) is still the
|
|
1816
|
+
* latest snapshot and no indexing progress has been made since `snapshotTime`.
|
|
1817
|
+
* - each indexed chain has added a new block as of `projectedAt`.
|
|
1818
|
+
*/
|
|
1819
|
+
worstCaseDistance: Duration;
|
|
1820
|
+
/**
|
|
1821
|
+
* The {@link CrossChainIndexingStatusSnapshot} that this projection is based on.
|
|
1822
|
+
*/
|
|
1823
|
+
snapshot: CrossChainIndexingStatusSnapshot;
|
|
1824
|
+
};
|
|
1825
|
+
|
|
1826
|
+
/**
|
|
1827
|
+
* Serialized representation of {@link ChainIndexingStatusSnapshot}
|
|
1828
|
+
*/
|
|
1829
|
+
type SerializedChainIndexingStatusSnapshot = ChainIndexingStatusSnapshot;
|
|
1830
|
+
/**
|
|
1831
|
+
* Serialized representation of {@link ChainIndexingStatusSnapshotQueued}
|
|
1832
|
+
*/
|
|
1833
|
+
type SerializedChainIndexingStatusSnapshotQueued = ChainIndexingStatusSnapshotQueued;
|
|
1834
|
+
/**
|
|
1835
|
+
* Serialized representation of {@link ChainIndexingStatusSnapshotBackfill}
|
|
1836
|
+
*/
|
|
1837
|
+
type SerializedChainIndexingStatusSnapshotBackfill = ChainIndexingStatusSnapshotBackfill;
|
|
1838
|
+
/**
|
|
1839
|
+
* Serialized representation of {@link ChainIndexingStatusSnapshotCompleted}
|
|
1840
|
+
*/
|
|
1841
|
+
type SerializedChainIndexingStatusSnapshotCompleted = ChainIndexingStatusSnapshotCompleted;
|
|
1842
|
+
/**
|
|
1843
|
+
* Serialized representation of {@link ChainIndexingStatusSnapshotFollowing}
|
|
1844
|
+
*/
|
|
1845
|
+
type SerializedChainIndexingStatusSnapshotFollowing = ChainIndexingStatusSnapshotFollowing;
|
|
1846
|
+
/**
|
|
1847
|
+
* Serialized representation of {@link OmnichainIndexingStatusSnapshotUnstarted}
|
|
1848
|
+
*/
|
|
1849
|
+
interface SerializedOmnichainIndexingStatusSnapshotUnstarted extends Omit<OmnichainIndexingStatusSnapshotUnstarted, "chains"> {
|
|
1850
|
+
chains: Record<ChainIdString, ChainIndexingStatusSnapshotQueued>;
|
|
1851
|
+
}
|
|
1852
|
+
/**
|
|
1853
|
+
* Serialized representation of {@link OmnichainIndexingStatusSnapshotBackfill}
|
|
1854
|
+
*/
|
|
1855
|
+
interface SerializedOmnichainIndexingStatusSnapshotBackfill extends Omit<OmnichainIndexingStatusSnapshotBackfill, "chains"> {
|
|
1856
|
+
chains: Record<ChainIdString, ChainIndexingStatusSnapshotForOmnichainIndexingStatusSnapshotBackfill>;
|
|
1857
|
+
}
|
|
1858
|
+
/**
|
|
1859
|
+
* Serialized representation of {@link OmnichainIndexingStatusSnapshotCompleted}
|
|
1860
|
+
*/
|
|
1861
|
+
interface SerializedOmnichainIndexingStatusSnapshotCompleted extends Omit<OmnichainIndexingStatusSnapshotCompleted, "chains"> {
|
|
1862
|
+
chains: Record<ChainIdString, ChainIndexingStatusSnapshotCompleted>;
|
|
1863
|
+
}
|
|
1864
|
+
/**
|
|
1865
|
+
* Serialized representation of {@link OmnichainIndexingStatusSnapshotFollowing}
|
|
1866
|
+
*/
|
|
1867
|
+
interface SerializedOmnichainIndexingStatusSnapshotFollowing extends Omit<OmnichainIndexingStatusSnapshotFollowing, "chains"> {
|
|
1868
|
+
chains: Record<ChainIdString, ChainIndexingStatusSnapshot>;
|
|
1869
|
+
}
|
|
1870
|
+
/**
|
|
1871
|
+
* Serialized representation of {@link OmnichainIndexingStatusSnapshot}
|
|
1872
|
+
*/
|
|
1873
|
+
type SerializedOmnichainIndexingStatusSnapshot = SerializedOmnichainIndexingStatusSnapshotUnstarted | SerializedOmnichainIndexingStatusSnapshotBackfill | SerializedOmnichainIndexingStatusSnapshotCompleted | SerializedOmnichainIndexingStatusSnapshotFollowing;
|
|
1874
|
+
/**
|
|
1875
|
+
* Serialized representation of {@link CrossChainIndexingStatusSnapshotOmnichain}
|
|
1876
|
+
*/
|
|
1877
|
+
interface SerializedCrossChainIndexingStatusSnapshotOmnichain extends Omit<CrossChainIndexingStatusSnapshotOmnichain, "omnichainSnapshot"> {
|
|
1878
|
+
omnichainSnapshot: SerializedOmnichainIndexingStatusSnapshot;
|
|
1879
|
+
}
|
|
1880
|
+
/**
|
|
1881
|
+
* Serialized representation of {@link CrossChainIndexingStatusSnapshot}
|
|
1882
|
+
*/
|
|
1883
|
+
type SerializedCrossChainIndexingStatusSnapshot = SerializedCrossChainIndexingStatusSnapshotOmnichain;
|
|
1884
|
+
/**
|
|
1885
|
+
* Serialized representation of {@link RealtimeIndexingStatusProjection}
|
|
1886
|
+
*/
|
|
1887
|
+
interface SerializedCurrentIndexingProjectionOmnichain extends Omit<RealtimeIndexingStatusProjection, "snapshot"> {
|
|
1888
|
+
snapshot: SerializedOmnichainIndexingStatusSnapshot;
|
|
1889
|
+
}
|
|
1890
|
+
/**
|
|
1891
|
+
* Serialized representation of {@link RealtimeIndexingStatusProjection}
|
|
1892
|
+
*/
|
|
1893
|
+
interface SerializedRealtimeIndexingStatusProjection extends Omit<RealtimeIndexingStatusProjection, "snapshot"> {
|
|
1894
|
+
snapshot: SerializedCrossChainIndexingStatusSnapshot;
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1897
|
+
/**
|
|
1898
|
+
* Deserialize into a {@link ChainIndexingSnapshot} object.
|
|
1899
|
+
*/
|
|
1900
|
+
declare function deserializeChainIndexingStatusSnapshot(maybeSnapshot: SerializedChainIndexingStatusSnapshot, valueLabel?: string): ChainIndexingStatusSnapshot;
|
|
1901
|
+
/**
|
|
1902
|
+
* Deserialize an {@link OmnichainIndexingStatusSnapshot} object.
|
|
1903
|
+
*/
|
|
1904
|
+
declare function deserializeOmnichainIndexingStatusSnapshot(maybeSnapshot: SerializedOmnichainIndexingStatusSnapshot, valueLabel?: string): OmnichainIndexingStatusSnapshot;
|
|
1905
|
+
/**
|
|
1906
|
+
* Deserialize an {@link CrossChainIndexingStatusSnapshot} object.
|
|
1907
|
+
*/
|
|
1908
|
+
declare function deserializeCrossChainIndexingStatusSnapshot(maybeSnapshot: SerializedCrossChainIndexingStatusSnapshot, valueLabel?: string): CrossChainIndexingStatusSnapshot;
|
|
1909
|
+
/**
|
|
1910
|
+
* Deserialize into a {@link RealtimeIndexingStatusProjection} object.
|
|
1911
|
+
*/
|
|
1912
|
+
declare function deserializeRealtimeIndexingStatusProjection(maybeProjection: SerializedRealtimeIndexingStatusProjection, valueLabel?: string): RealtimeIndexingStatusProjection;
|
|
1913
|
+
|
|
1914
|
+
/**
|
|
1915
|
+
* Get {@link OmnichainIndexingStatusId} based on indexed chains' statuses.
|
|
1916
|
+
*
|
|
1917
|
+
* This function decides what is the `OmnichainIndexingStatusId` is,
|
|
1918
|
+
* based on provided chain indexing statuses.
|
|
1919
|
+
*
|
|
1920
|
+
* @throws an error if unable to determine overall indexing status
|
|
1921
|
+
*/
|
|
1922
|
+
declare function getOmnichainIndexingStatus(chains: ChainIndexingStatusSnapshot[]): OmnichainIndexingStatusId;
|
|
1923
|
+
/**
|
|
1924
|
+
* Get the timestamp of the lowest `config.startBlock` across all chains
|
|
1925
|
+
* in the provided array of {@link ChainIndexingStatusSnapshot}.
|
|
1926
|
+
*
|
|
1927
|
+
* Such timestamp is useful when presenting the "lowest" block
|
|
1928
|
+
* to be indexed across all chains.
|
|
1929
|
+
*/
|
|
1930
|
+
declare function getTimestampForLowestOmnichainStartBlock(chains: ChainIndexingStatusSnapshot[]): UnixTimestamp;
|
|
1931
|
+
/**
|
|
1932
|
+
* Get the timestamp of the "highest known block" across all chains
|
|
1933
|
+
* in the provided array of {@link ChainIndexingStatusSnapshot}.
|
|
1934
|
+
*
|
|
1935
|
+
* Such timestamp is useful when presenting the "highest known block"
|
|
1936
|
+
* to be indexed across all chains.
|
|
1937
|
+
*
|
|
1938
|
+
* The "highest known block" for a chain depends on its status:
|
|
1939
|
+
* - `config.endBlock` for a "queued" chain,
|
|
1940
|
+
* - `backfillEndBlock` for a "backfill" chain,
|
|
1941
|
+
* - `latestIndexedBlock` for a "completed" chain,
|
|
1942
|
+
* - `latestKnownBlock` for a "following" chain.
|
|
1943
|
+
*/
|
|
1944
|
+
declare function getTimestampForHighestOmnichainKnownBlock(chains: ChainIndexingStatusSnapshot[]): UnixTimestamp;
|
|
1945
|
+
/**
|
|
1946
|
+
* Get Omnichain Indexing Cursor
|
|
1947
|
+
*
|
|
1948
|
+
* The cursor tracks the "highest" latest indexed block timestamp across
|
|
1949
|
+
* all indexed chains. If all chains are queued, the cursor tracks the moment
|
|
1950
|
+
* just before the earliest start block timestamp across those chains.
|
|
1951
|
+
*
|
|
1952
|
+
* @throws an error if no chains are provided
|
|
1953
|
+
*/
|
|
1954
|
+
declare function getOmnichainIndexingCursor(chains: ChainIndexingStatusSnapshot[]): UnixTimestamp;
|
|
1955
|
+
/**
|
|
1956
|
+
* Create {@link ChainIndexingConfig} for given block refs.
|
|
1957
|
+
*
|
|
1958
|
+
* @param startBlock required block ref
|
|
1959
|
+
* @param endBlock optional block ref
|
|
1960
|
+
*/
|
|
1961
|
+
declare function createIndexingConfig(startBlock: BlockRef, endBlock: BlockRef | null): ChainIndexingConfig;
|
|
1962
|
+
/**
|
|
1963
|
+
* Check if Chain Indexing Status Snapshots fit the 'unstarted' overall status
|
|
1964
|
+
* snapshot requirements:
|
|
1965
|
+
* - All chains are guaranteed to have a status of "queued".
|
|
1966
|
+
*
|
|
1967
|
+
* Note: This function narrows the {@link ChainIndexingStatusSnapshot} type to
|
|
1968
|
+
* {@link ChainIndexingStatusSnapshotQueued}.
|
|
1969
|
+
*/
|
|
1970
|
+
declare function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted(chains: ChainIndexingStatusSnapshot[]): chains is ChainIndexingStatusSnapshotQueued[];
|
|
1971
|
+
/**
|
|
1972
|
+
* Check if Chain Indexing Status Snapshots fit the 'backfill' overall status
|
|
1973
|
+
* snapshot requirements:
|
|
1974
|
+
* - At least one chain is guaranteed to be in the "backfill" status.
|
|
1975
|
+
* - Each chain is guaranteed to have a status of either "queued",
|
|
1976
|
+
* "backfill" or "completed".
|
|
1977
|
+
*
|
|
1978
|
+
* Note: This function narrows the {@link ChainIndexingStatusSnapshot} type to
|
|
1979
|
+
* {@link ChainIndexingStatusSnapshotForOmnichainIndexingStatusSnapshotBackfill}.
|
|
1980
|
+
*/
|
|
1981
|
+
declare function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill(chains: ChainIndexingStatusSnapshot[]): chains is ChainIndexingStatusSnapshotForOmnichainIndexingStatusSnapshotBackfill[];
|
|
1982
|
+
/**
|
|
1983
|
+
* Checks if Chain Indexing Status Snapshots fit the 'completed' overall status
|
|
1984
|
+
* snapshot requirements:
|
|
1985
|
+
* - All chains are guaranteed to have a status of "completed".
|
|
1986
|
+
*
|
|
1987
|
+
* Note: This function narrows the {@link ChainIndexingStatusSnapshot} type to
|
|
1988
|
+
* {@link ChainIndexingStatusSnapshotCompleted}.
|
|
1989
|
+
*/
|
|
1990
|
+
declare function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted(chains: ChainIndexingStatusSnapshot[]): chains is ChainIndexingStatusSnapshotCompleted[];
|
|
1991
|
+
/**
|
|
1992
|
+
* Checks Chain Indexing Status Snapshots fit the 'following' overall status
|
|
1993
|
+
* snapshot requirements:
|
|
1994
|
+
* - At least one chain is guaranteed to be in the "following" status.
|
|
1995
|
+
* - Any other chain can have any status.
|
|
1996
|
+
*/
|
|
1997
|
+
declare function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing(chains: ChainIndexingStatusSnapshot[]): chains is ChainIndexingStatusSnapshot[];
|
|
1998
|
+
/**
|
|
1999
|
+
* Sort a list of [{@link ChainId}, {@link ChainIndexingStatusSnapshot}] tuples
|
|
2000
|
+
* by the omnichain start block timestamp in ascending order.
|
|
2001
|
+
*/
|
|
2002
|
+
declare function sortChainStatusesByStartBlockAsc<ChainStatusType extends ChainIndexingStatusSnapshot>(chains: [ChainId, ChainStatusType][]): [ChainId, ChainStatusType][];
|
|
2003
|
+
/**
|
|
2004
|
+
* Gets the latest indexed {@link BlockRef} for the given {@link ChainId}.
|
|
2005
|
+
*
|
|
2006
|
+
* @returns the latest indexed {@link BlockRef} for the given {@link ChainId}, or null if the chain
|
|
2007
|
+
* isn't being indexed at all or is queued and therefore hasn't started indexing yet.
|
|
2008
|
+
*/
|
|
2009
|
+
declare function getLatestIndexedBlockRef(indexingStatus: CrossChainIndexingStatusSnapshot, chainId: ChainId): BlockRef | null;
|
|
2010
|
+
|
|
2011
|
+
/**
|
|
2012
|
+
* Create realtime indexing status projection from
|
|
2013
|
+
* a {@link CrossChainIndexingStatusSnapshot}.
|
|
2014
|
+
*/
|
|
2015
|
+
declare function createRealtimeIndexingStatusProjection(snapshot: CrossChainIndexingStatusSnapshot, now: UnixTimestamp): RealtimeIndexingStatusProjection;
|
|
2016
|
+
|
|
2017
|
+
declare function serializeCrossChainIndexingStatusSnapshotOmnichain({ strategy, slowestChainIndexingCursor, snapshotTime, omnichainSnapshot, }: CrossChainIndexingStatusSnapshot): SerializedCrossChainIndexingStatusSnapshot;
|
|
2018
|
+
declare function serializeRealtimeIndexingStatusProjection(indexingProjection: RealtimeIndexingStatusProjection): SerializedRealtimeIndexingStatusProjection;
|
|
2019
|
+
/**
|
|
2020
|
+
* Serialize chain indexing snapshots.
|
|
2021
|
+
*/
|
|
2022
|
+
declare function serializeChainIndexingSnapshots<ChainIndexingStatusSnapshotType extends ChainIndexingStatusSnapshot>(chains: Map<ChainId, ChainIndexingStatusSnapshotType>): Record<ChainIdString, ChainIndexingStatusSnapshotType>;
|
|
2023
|
+
/**
|
|
2024
|
+
* Serialize a {@link OmnichainIndexingStatusSnapshot} object.
|
|
2025
|
+
*/
|
|
2026
|
+
declare function serializeOmnichainIndexingStatusSnapshot(indexingStatus: OmnichainIndexingStatusSnapshot): SerializedOmnichainIndexingStatusSnapshot;
|
|
2027
|
+
|
|
2028
|
+
/**
|
|
2029
|
+
* Reasons why TheGraph fallback cannot be used.
|
|
2030
|
+
*/
|
|
2031
|
+
declare const TheGraphCannotFallbackReasonSchema: z.ZodEnum<{
|
|
2032
|
+
readonly NotSubgraphCompatible: "not-subgraph-compatible";
|
|
2033
|
+
readonly NoApiKey: "no-api-key";
|
|
2034
|
+
readonly NoSubgraphUrl: "no-subgraph-url";
|
|
2035
|
+
}>;
|
|
2036
|
+
type TheGraphCannotFallbackReason = z.infer<typeof TheGraphCannotFallbackReasonSchema>;
|
|
2037
|
+
/**
|
|
2038
|
+
* Configuration for TheGraph fallback behavior.
|
|
2039
|
+
* Indicates whether fallback to TheGraph is possible and the reason if not.
|
|
2040
|
+
*/
|
|
2041
|
+
declare const TheGraphFallbackSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2042
|
+
canFallback: z.ZodLiteral<true>;
|
|
2043
|
+
url: z.ZodString;
|
|
2044
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2045
|
+
canFallback: z.ZodLiteral<false>;
|
|
2046
|
+
reason: z.ZodEnum<{
|
|
2047
|
+
readonly NotSubgraphCompatible: "not-subgraph-compatible";
|
|
2048
|
+
readonly NoApiKey: "no-api-key";
|
|
2049
|
+
readonly NoSubgraphUrl: "no-subgraph-url";
|
|
2050
|
+
}>;
|
|
2051
|
+
}, z.core.$strict>]>;
|
|
2052
|
+
type TheGraphFallback = z.infer<typeof TheGraphFallbackSchema>;
|
|
2053
|
+
|
|
2054
|
+
/**
|
|
2055
|
+
* Complete public configuration object for ENSApi.
|
|
2056
|
+
*
|
|
2057
|
+
* Contains ENSApi-specific configuration at the top level and
|
|
2058
|
+
* embeds the complete ENSIndexer public configuration.
|
|
2059
|
+
*/
|
|
2060
|
+
interface ENSApiPublicConfig {
|
|
2061
|
+
/**
|
|
2062
|
+
* ENSApi service version
|
|
2063
|
+
*
|
|
2064
|
+
* @see https://ghcr.io/namehash/ensnode/ensapi
|
|
2065
|
+
*/
|
|
2066
|
+
version: string;
|
|
2067
|
+
/**
|
|
2068
|
+
* The Graph Fallback-related info.
|
|
2069
|
+
*/
|
|
2070
|
+
theGraphFallback: TheGraphFallback;
|
|
2071
|
+
/**
|
|
2072
|
+
* Complete ENSIndexer public configuration
|
|
2073
|
+
*
|
|
2074
|
+
* Contains all ENSIndexer public configuration including
|
|
2075
|
+
* namespace, plugins, version info, etc.
|
|
2076
|
+
*/
|
|
2077
|
+
ensIndexerPublicConfig: ENSIndexerPublicConfig;
|
|
2078
|
+
}
|
|
2079
|
+
|
|
2080
|
+
/**
|
|
2081
|
+
* Serialized representation of {@link ENSApiPublicConfig}
|
|
2082
|
+
*/
|
|
2083
|
+
interface SerializedENSApiPublicConfig extends Omit<ENSApiPublicConfig, "ensIndexerPublicConfig"> {
|
|
2084
|
+
/**
|
|
2085
|
+
* Serialized representation of {@link ENSApiPublicConfig.ensIndexerPublicConfig}.
|
|
2086
|
+
*/
|
|
2087
|
+
ensIndexerPublicConfig: SerializedENSIndexerPublicConfig;
|
|
2088
|
+
}
|
|
2089
|
+
|
|
2090
|
+
/**
|
|
2091
|
+
* Deserialize a {@link ENSApiPublicConfig} object.
|
|
2092
|
+
*/
|
|
2093
|
+
declare function deserializeENSApiPublicConfig(maybeConfig: SerializedENSApiPublicConfig, valueLabel?: string): ENSApiPublicConfig;
|
|
2094
|
+
|
|
2095
|
+
/**
|
|
2096
|
+
* Serialize a {@link ENSApiPublicConfig} object.
|
|
2097
|
+
*/
|
|
2098
|
+
declare function serializeENSApiPublicConfig(config: ENSApiPublicConfig): SerializedENSApiPublicConfig;
|
|
2099
|
+
|
|
2100
|
+
/**
|
|
2101
|
+
* Create a Zod schema for validating a serialized ENSApiPublicConfig.
|
|
2102
|
+
*
|
|
2103
|
+
* @param valueLabel - Optional label for the value being validated (used in error messages)
|
|
2104
|
+
*/
|
|
2105
|
+
declare function makeENSApiPublicConfigSchema(valueLabel?: string): z.ZodObject<{
|
|
2106
|
+
version: z.ZodString;
|
|
2107
|
+
theGraphFallback: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2108
|
+
canFallback: z.ZodLiteral<true>;
|
|
2109
|
+
url: z.ZodString;
|
|
2110
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2111
|
+
canFallback: z.ZodLiteral<false>;
|
|
2112
|
+
reason: z.ZodEnum<{
|
|
2113
|
+
readonly NotSubgraphCompatible: "not-subgraph-compatible";
|
|
2114
|
+
readonly NoApiKey: "no-api-key";
|
|
2115
|
+
readonly NoSubgraphUrl: "no-subgraph-url";
|
|
2116
|
+
}>;
|
|
2117
|
+
}, z.core.$strict>]>;
|
|
2118
|
+
ensIndexerPublicConfig: z.ZodObject<{
|
|
2119
|
+
labelSet: z.ZodObject<{
|
|
2120
|
+
labelSetId: z.ZodString;
|
|
2121
|
+
labelSetVersion: z.ZodPipe<z.ZodCoercedNumber<unknown>, z.ZodInt>;
|
|
2122
|
+
}, z.core.$strip>;
|
|
2123
|
+
indexedChainIds: z.ZodPipe<z.ZodArray<z.ZodPipe<z.ZodInt, z.ZodTransform<number, number>>>, z.ZodTransform<Set<number>, number[]>>;
|
|
2124
|
+
isSubgraphCompatible: z.ZodBoolean;
|
|
2125
|
+
namespace: z.ZodEnum<{
|
|
2126
|
+
readonly Mainnet: "mainnet";
|
|
2127
|
+
readonly Sepolia: "sepolia";
|
|
2128
|
+
readonly Holesky: "holesky";
|
|
2129
|
+
readonly EnsTestEnv: "ens-test-env";
|
|
2130
|
+
}>;
|
|
2131
|
+
plugins: z.ZodArray<z.ZodString>;
|
|
2132
|
+
databaseSchemaName: z.ZodString;
|
|
2133
|
+
versionInfo: z.ZodObject<{
|
|
2134
|
+
nodejs: z.ZodString;
|
|
2135
|
+
ponder: z.ZodString;
|
|
2136
|
+
ensDb: z.ZodString;
|
|
2137
|
+
ensIndexer: z.ZodString;
|
|
2138
|
+
ensNormalize: z.ZodString;
|
|
2139
|
+
ensRainbow: z.ZodString;
|
|
2140
|
+
ensRainbowSchema: z.ZodInt;
|
|
2141
|
+
}, z.core.$strict>;
|
|
2142
|
+
}, z.core.$strip>;
|
|
2143
|
+
}, z.core.$strict>;
|
|
2144
|
+
|
|
2145
|
+
/**
|
|
2146
|
+
* ENSApi Public Config Response
|
|
2147
|
+
*/
|
|
2148
|
+
type ConfigResponse = ENSApiPublicConfig;
|
|
2149
|
+
|
|
2150
|
+
type SerializedConfigResponse = SerializedENSApiPublicConfig;
|
|
2151
|
+
|
|
2152
|
+
/**
|
|
2153
|
+
* Deserialize a {@link ConfigResponse} object.
|
|
2154
|
+
*/
|
|
2155
|
+
declare function deserializeConfigResponse(serializedResponse: SerializedConfigResponse): ConfigResponse;
|
|
2156
|
+
|
|
2157
|
+
declare function serializeConfigResponse(response: ConfigResponse): SerializedConfigResponse;
|
|
2158
|
+
|
|
2159
|
+
/**
|
|
2160
|
+
* A status code for indexing status responses.
|
|
2161
|
+
*/
|
|
2162
|
+
declare const IndexingStatusResponseCodes: {
|
|
2163
|
+
/**
|
|
2164
|
+
* Represents that the indexing status is available.
|
|
2165
|
+
*/
|
|
2166
|
+
readonly Ok: "ok";
|
|
2167
|
+
/**
|
|
2168
|
+
* Represents that the indexing status is unavailable.
|
|
2169
|
+
*/
|
|
2170
|
+
readonly Error: "error";
|
|
2171
|
+
};
|
|
2172
|
+
/**
|
|
2173
|
+
* The derived string union of possible {@link IndexingStatusResponseCodes}.
|
|
2174
|
+
*/
|
|
2175
|
+
type IndexingStatusResponseCode = (typeof IndexingStatusResponseCodes)[keyof typeof IndexingStatusResponseCodes];
|
|
2176
|
+
/**
|
|
2177
|
+
* An indexing status response when the indexing status is available.
|
|
2178
|
+
*/
|
|
2179
|
+
type IndexingStatusResponseOk = {
|
|
2180
|
+
responseCode: typeof IndexingStatusResponseCodes.Ok;
|
|
2181
|
+
realtimeProjection: RealtimeIndexingStatusProjection;
|
|
2182
|
+
};
|
|
2183
|
+
/**
|
|
2184
|
+
* An indexing status response when the indexing status is unavailable.
|
|
2185
|
+
*/
|
|
2186
|
+
type IndexingStatusResponseError = {
|
|
2187
|
+
responseCode: typeof IndexingStatusResponseCodes.Error;
|
|
2188
|
+
};
|
|
2189
|
+
/**
|
|
2190
|
+
* Indexing status response.
|
|
2191
|
+
*
|
|
2192
|
+
* Use the `responseCode` field to determine the specific type interpretation
|
|
2193
|
+
* at runtime.
|
|
2194
|
+
*/
|
|
2195
|
+
type IndexingStatusResponse = IndexingStatusResponseOk | IndexingStatusResponseError;
|
|
2196
|
+
|
|
2197
|
+
/**
|
|
2198
|
+
* Serialized representation of {@link IndexingStatusResponseError}.
|
|
2199
|
+
*/
|
|
2200
|
+
type SerializedIndexingStatusResponseError = IndexingStatusResponseError;
|
|
2201
|
+
/**
|
|
2202
|
+
* Serialized representation of {@link IndexingStatusResponseOk}.
|
|
2203
|
+
*/
|
|
2204
|
+
interface SerializedIndexingStatusResponseOk extends Omit<IndexingStatusResponseOk, "realtimeProjection"> {
|
|
2205
|
+
realtimeProjection: SerializedRealtimeIndexingStatusProjection;
|
|
2206
|
+
}
|
|
2207
|
+
/**
|
|
2208
|
+
* Serialized representation of {@link IndexingStatusResponse}.
|
|
2209
|
+
*/
|
|
2210
|
+
type SerializedIndexingStatusResponse = SerializedIndexingStatusResponseOk | SerializedIndexingStatusResponseError;
|
|
2211
|
+
|
|
2212
|
+
/**
|
|
2213
|
+
* Deserialize a {@link IndexingStatusResponse} object.
|
|
2214
|
+
*/
|
|
2215
|
+
declare function deserializeIndexingStatusResponse(maybeResponse: SerializedIndexingStatusResponse): IndexingStatusResponse;
|
|
2216
|
+
|
|
2217
|
+
/**
|
|
2218
|
+
* Represents a request to Indexing Status API.
|
|
2219
|
+
*/
|
|
2220
|
+
type IndexingStatusRequest = {};
|
|
2221
|
+
|
|
2222
|
+
declare function serializeIndexingStatusResponse(response: IndexingStatusResponse): SerializedIndexingStatusResponse;
|
|
2223
|
+
|
|
2224
|
+
/**
|
|
2225
|
+
* Deserialize a {@link NameTokensResponse} object.
|
|
2226
|
+
*/
|
|
2227
|
+
declare function deserializedNameTokensResponse(maybeResponse: SerializedNameTokensResponse): NameTokensResponse;
|
|
2228
|
+
|
|
2229
|
+
declare const nameTokensPrerequisites: Readonly<{
|
|
2230
|
+
/**
|
|
2231
|
+
* Required plugins to enable Name Tokens API routes.
|
|
2232
|
+
*
|
|
2233
|
+
* 1. `registrars` plugin is required so that data in the `registrationLifecycles`
|
|
2234
|
+
* table is populated.
|
|
2235
|
+
* 2. `tokenscope` plugin is required so that data in the `nameTokens`
|
|
2236
|
+
* table is populated.
|
|
2237
|
+
*/
|
|
2238
|
+
requiredPlugins: readonly [PluginName.Registrars, PluginName.TokenScope];
|
|
2239
|
+
/**
|
|
2240
|
+
* Check if provided ENSApiPublicConfig supports the Name Tokens API.
|
|
2241
|
+
*/
|
|
2242
|
+
hasEnsIndexerConfigSupport(config: ENSIndexerPublicConfig): boolean;
|
|
2243
|
+
/**
|
|
2244
|
+
* Required Indexing Status IDs
|
|
2245
|
+
*
|
|
2246
|
+
* Database indexes are created by the time the omnichain indexing status
|
|
2247
|
+
* is either `completed` or `following`.
|
|
2248
|
+
*/
|
|
2249
|
+
supportedIndexingStatusIds: ("omnichain-following" | "omnichain-completed")[];
|
|
2250
|
+
/**
|
|
2251
|
+
* Check if provided indexing status supports the Name Tokens API.
|
|
2252
|
+
*/
|
|
2253
|
+
hasIndexingStatusSupport(omnichainIndexingStatusId: OmnichainIndexingStatusId): boolean;
|
|
2254
|
+
}>;
|
|
2255
|
+
|
|
2256
|
+
/**
|
|
2257
|
+
* Represents request to Name Tokens API.
|
|
2258
|
+
*
|
|
2259
|
+
* Either `domainId` or `name` must be provided, but not both.
|
|
2260
|
+
*/
|
|
2261
|
+
interface NameTokensRequest {
|
|
2262
|
+
/**
|
|
2263
|
+
* Domain ID (namehash) for which name tokens were requested.
|
|
2264
|
+
*/
|
|
2265
|
+
domainId?: Node;
|
|
2266
|
+
/**
|
|
2267
|
+
* Name for which name tokens were requested.
|
|
2268
|
+
*/
|
|
2269
|
+
name?: Name;
|
|
2270
|
+
}
|
|
2271
|
+
|
|
2272
|
+
/**
|
|
2273
|
+
* An enum representing the possible CAIP-19 Asset Namespace values.
|
|
2274
|
+
*/
|
|
2275
|
+
declare const AssetNamespaces: {
|
|
2276
|
+
readonly ERC721: "erc721";
|
|
2277
|
+
readonly ERC1155: "erc1155";
|
|
2278
|
+
};
|
|
2279
|
+
type AssetNamespace = (typeof AssetNamespaces)[keyof typeof AssetNamespaces];
|
|
2280
|
+
/**
|
|
2281
|
+
* A uint256 value that identifies a specific NFT within a NFT contract.
|
|
2282
|
+
*/
|
|
2283
|
+
type TokenId = bigint;
|
|
2284
|
+
/**
|
|
2285
|
+
* Serialized representation of {@link TokenId}.
|
|
2286
|
+
*/
|
|
2287
|
+
type SerializedTokenId = string;
|
|
2288
|
+
/**
|
|
2289
|
+
* A globally unique reference to an NFT.
|
|
2290
|
+
*/
|
|
2291
|
+
interface AssetId {
|
|
2292
|
+
assetNamespace: AssetNamespace;
|
|
2293
|
+
contract: AccountId;
|
|
2294
|
+
tokenId: TokenId;
|
|
2295
|
+
}
|
|
2296
|
+
/**
|
|
2297
|
+
* Serialized representation of {@link AssetId}.
|
|
2298
|
+
*/
|
|
2299
|
+
interface SerializedAssetId extends Omit<AssetId, "tokenId"> {
|
|
2300
|
+
tokenId: SerializedTokenId;
|
|
2301
|
+
}
|
|
2302
|
+
/**
|
|
2303
|
+
* String representation of an {@link AssetId}.
|
|
2304
|
+
*
|
|
2305
|
+
* Formatted as a fully lowercase CAIP-19 AssetId.
|
|
2306
|
+
*
|
|
2307
|
+
* @see https://chainagnostic.org/CAIPs/caip-19
|
|
2308
|
+
* @example "eip155:1/erc721:0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85/0xaf2caa1c2ca1d027f1ac823b529d0a67cd144264b2789fa2ea4d63a67c7103cc"
|
|
2309
|
+
* for vitalik.eth in the eth base registrar on mainnet.
|
|
2310
|
+
*/
|
|
2311
|
+
type AssetIdString = string;
|
|
2312
|
+
/**
|
|
2313
|
+
* Serializes {@link AssetId} object.
|
|
2314
|
+
*/
|
|
2315
|
+
declare function serializeAssetId(assetId: AssetId): SerializedAssetId;
|
|
2316
|
+
/**
|
|
2317
|
+
* Deserialize a {@link AssetId} object.
|
|
2318
|
+
*/
|
|
2319
|
+
declare function deserializeAssetId(maybeAssetId: unknown, valueLabel?: string): AssetId;
|
|
2320
|
+
/**
|
|
2321
|
+
* Format {@link AssetId} object as a string.
|
|
2322
|
+
*/
|
|
2323
|
+
declare function formatAssetId(assetId: AssetId): AssetIdString;
|
|
2324
|
+
/**
|
|
2325
|
+
* Parse a stringified representation of {@link AssetId} object.
|
|
2326
|
+
*/
|
|
2327
|
+
declare function parseAssetId(maybeAssetId: AssetIdString, valueLabel?: string): AssetId;
|
|
2328
|
+
/**
|
|
2329
|
+
* Builds an AssetId for the NFT represented by the given contract,
|
|
2330
|
+
* tokenId, and assetNamespace.
|
|
2331
|
+
*
|
|
2332
|
+
* @param contract - The contract that manages the NFT
|
|
2333
|
+
* @param tokenId - The tokenId of the NFT
|
|
2334
|
+
* @param assetNamespace - The assetNamespace of the NFT
|
|
2335
|
+
* @returns The AssetId for the NFT represented by the given contract,
|
|
2336
|
+
* tokenId, and assetNamespace
|
|
2337
|
+
*/
|
|
2338
|
+
declare const buildAssetId: (contract: AccountId, tokenId: TokenId, assetNamespace: AssetNamespace) => AssetId;
|
|
2339
|
+
/**
|
|
2340
|
+
* A globally unique reference to an NFT tokenizing the ownership of a domain.
|
|
2341
|
+
*/
|
|
2342
|
+
interface DomainAssetId extends AssetId {
|
|
2343
|
+
/**
|
|
2344
|
+
* The namehash (node) of the domain who's ownership is tokenized by
|
|
2345
|
+
* this `AssetId`.
|
|
2346
|
+
*/
|
|
2347
|
+
domainId: Node;
|
|
2348
|
+
}
|
|
2349
|
+
/**
|
|
2350
|
+
* Serialized representation of {@link DomainAssetId}.
|
|
2351
|
+
*/
|
|
2352
|
+
interface SerializedDomainAssetId extends SerializedAssetId {
|
|
2353
|
+
domainId: Node;
|
|
2354
|
+
}
|
|
2355
|
+
declare function serializeDomainAssetId(domainAsset: DomainAssetId): SerializedDomainAssetId;
|
|
2356
|
+
/**
|
|
2357
|
+
* An enum representing the mint status of a DomainAssetId.
|
|
2358
|
+
*
|
|
2359
|
+
* After we index a NFT we never delete it from our index. Instead, when an
|
|
2360
|
+
* indexed NFT is burned onchain we retain its record and update its mint
|
|
2361
|
+
* status as `burned`. If a NFT is minted again after it is burned its mint
|
|
2362
|
+
* status is updated to `minted`.
|
|
2363
|
+
*/
|
|
2364
|
+
declare const NFTMintStatuses: {
|
|
2365
|
+
readonly Minted: "minted";
|
|
2366
|
+
readonly Burned: "burned";
|
|
2367
|
+
};
|
|
2368
|
+
type NFTMintStatus = (typeof NFTMintStatuses)[keyof typeof NFTMintStatuses];
|
|
2369
|
+
/**
|
|
2370
|
+
* Metadata about a NFT transfer event.
|
|
2371
|
+
*
|
|
2372
|
+
* This metadata can be used for building more helpful messages when processing
|
|
2373
|
+
* NFT transfer events.
|
|
2374
|
+
*/
|
|
2375
|
+
interface NFTTransferEventMetadata {
|
|
2376
|
+
chainId: ChainId;
|
|
2377
|
+
blockNumber: bigint;
|
|
2378
|
+
transactionHash: Hex;
|
|
2379
|
+
eventHandlerName: string;
|
|
2380
|
+
nft: DomainAssetId;
|
|
2381
|
+
}
|
|
2382
|
+
declare const formatNFTTransferEventMetadata: (metadata: NFTTransferEventMetadata) => string;
|
|
2383
|
+
/**
|
|
2384
|
+
* An enum representing the type of transfer that has occurred to a DomainAssetId.
|
|
2385
|
+
*/
|
|
2386
|
+
declare const NFTTransferTypes: {
|
|
2387
|
+
/**
|
|
2388
|
+
* Initial transfer from zeroAddress to a non-zeroAddress
|
|
2389
|
+
* Can happen at most once to a NFT AssetId
|
|
2390
|
+
*
|
|
2391
|
+
* Invariants:
|
|
2392
|
+
* - NFT is not indexed and therefore has no previous mint status or owner
|
|
2393
|
+
* - new NFT mint status is `minted`
|
|
2394
|
+
* - new NFT owner is a non-zeroAddress
|
|
2395
|
+
*/
|
|
2396
|
+
readonly Mint: "mint";
|
|
2397
|
+
/**
|
|
2398
|
+
* Subsequent transfer from zeroAddress to a non-zeroAddress
|
|
2399
|
+
* Can happen any number of times to a NFT AssetId as it passes in a cycle from
|
|
2400
|
+
* mint -> burn -> remint -> burn -> remint -> ...
|
|
2401
|
+
*
|
|
2402
|
+
* Invariants:
|
|
2403
|
+
* - NFT is indexed
|
|
2404
|
+
* - previous NFT mint status was `burned`
|
|
2405
|
+
* - previous NFT owner is the zeroAddress
|
|
2406
|
+
* - new NFT mint status is `minted`
|
|
2407
|
+
* - new NFT owner is a non-zeroAddress
|
|
2408
|
+
*/
|
|
2409
|
+
readonly Remint: "remint";
|
|
2410
|
+
/**
|
|
2411
|
+
* Special transfer type for improperly implemented NFT contracts that allow a NFT
|
|
2412
|
+
* that is currently minted to be reminted before an intermediate burn.
|
|
2413
|
+
*
|
|
2414
|
+
* Transfer from zeroAddress to non-zeroAddress for an indexed NFT where the
|
|
2415
|
+
* previously indexed nft had status `minted` with a non-zeroAddress owner.
|
|
2416
|
+
*
|
|
2417
|
+
* Invariants:
|
|
2418
|
+
* - NFT is indexed
|
|
2419
|
+
* - previous NFT mint status was `minted`
|
|
2420
|
+
* - previous NFT owner was a non-zeroAddress
|
|
2421
|
+
* - new NFT mint status is `minted`
|
|
2422
|
+
* - new NFT owner is a non-zeroAddress
|
|
2423
|
+
*/
|
|
2424
|
+
readonly MintedRemint: "minted-remint";
|
|
2425
|
+
/**
|
|
2426
|
+
* Transfer from a non-zeroAddress to zeroAddress
|
|
2427
|
+
*
|
|
2428
|
+
* Invariants:
|
|
2429
|
+
* - NFT is indexed
|
|
2430
|
+
* - previous NFT mint status was `minted`
|
|
2431
|
+
* - previous NFT owner is a non-zeroAddress
|
|
2432
|
+
* - new NFT mint status is `burned`
|
|
2433
|
+
* - new NFT owner is the zeroAddress
|
|
2434
|
+
*/
|
|
2435
|
+
readonly Burn: "burn";
|
|
2436
|
+
/**
|
|
2437
|
+
* Transfer from a non-zeroAddress to a distinct non-zeroAddress
|
|
2438
|
+
*
|
|
2439
|
+
* Invariants:
|
|
2440
|
+
* - NFT is indexed
|
|
2441
|
+
* - previous and new NFT mint status is `minted`
|
|
2442
|
+
* - previous and new NFT owner are distinct non-zeroAddress
|
|
2443
|
+
*/
|
|
2444
|
+
readonly Transfer: "transfer";
|
|
2445
|
+
/**
|
|
2446
|
+
* Transfer from a non-zeroAddress to the same non-zeroAddress
|
|
2447
|
+
*
|
|
2448
|
+
* Invariants:
|
|
2449
|
+
* - NFT is indexed
|
|
2450
|
+
* - previous and new NFT mint status is `minted`
|
|
2451
|
+
* - previous and new NFT owner are equivalent non-zeroAddress
|
|
2452
|
+
*/
|
|
2453
|
+
readonly SelfTransfer: "self-transfer";
|
|
2454
|
+
/**
|
|
2455
|
+
* Transfer from zeroAddress to zeroAddress for an indexed NFT
|
|
2456
|
+
*
|
|
2457
|
+
* Invariants:
|
|
2458
|
+
* - NFT is indexed
|
|
2459
|
+
* - previous and new NFT mint status is `burned`
|
|
2460
|
+
* - previous and new NFT owner are zeroAddress
|
|
2461
|
+
*/
|
|
2462
|
+
readonly RemintBurn: "remint-burn";
|
|
2463
|
+
/**
|
|
2464
|
+
* Special transfer type for improperly implemented NFT contracts that allow a NFT
|
|
2465
|
+
* that is currently minted to be reminted again before an intermediate burn.
|
|
2466
|
+
*
|
|
2467
|
+
* Transfer from zeroAddress to zeroAddress for an indexed NFT where the
|
|
2468
|
+
* previously indexed nft had status `minted` with a non-zeroAddress owner.
|
|
2469
|
+
*
|
|
2470
|
+
* Invariants:
|
|
2471
|
+
* - NFT is indexed
|
|
2472
|
+
* - previous NFT mint status was `minted`
|
|
2473
|
+
* - previous NFT owner was a non-zeroAddress
|
|
2474
|
+
* - new NFT mint status is `burned`
|
|
2475
|
+
* - new NFT owner is the zeroAddress
|
|
2476
|
+
*/
|
|
2477
|
+
readonly MintedRemintBurn: "minted-remint-burn";
|
|
2478
|
+
/**
|
|
2479
|
+
* Transfer from zeroAddress to zeroAddress for an unindexed NFT
|
|
2480
|
+
*
|
|
2481
|
+
* Invariants:
|
|
2482
|
+
* - NFT is not indexed and therefore has no previous mint status or owner
|
|
2483
|
+
* - NFT should remain unindexed and without any mint status or owner
|
|
2484
|
+
*/
|
|
2485
|
+
readonly MintBurn: "mint-burn";
|
|
2486
|
+
};
|
|
2487
|
+
type NFTTransferType = (typeof NFTTransferTypes)[keyof typeof NFTTransferTypes];
|
|
2488
|
+
declare const getNFTTransferType: (from: Address, to: Address, allowMintedRemint: boolean, metadata: NFTTransferEventMetadata, currentlyIndexedOwner?: Address) => NFTTransferType;
|
|
2489
|
+
|
|
2490
|
+
/**
|
|
2491
|
+
* An enum representing the possible Name Token Ownership types.
|
|
2492
|
+
*/
|
|
2493
|
+
declare const NameTokenOwnershipTypes: {
|
|
2494
|
+
/**
|
|
2495
|
+
* Name Token is owned by NameWrapper account.
|
|
2496
|
+
*/
|
|
2497
|
+
readonly NameWrapper: "namewrapper";
|
|
2498
|
+
/**
|
|
2499
|
+
* Name Token is owned fully onchain.
|
|
2500
|
+
*
|
|
2501
|
+
* This ownership type can only apply to direct subnames of `.eth`
|
|
2502
|
+
*/
|
|
2503
|
+
readonly FullyOnchain: "fully-onchain";
|
|
2504
|
+
/**
|
|
2505
|
+
* Name Token ownership has been transferred to the null address.
|
|
2506
|
+
*/
|
|
2507
|
+
readonly Burned: "burned";
|
|
2508
|
+
/**
|
|
2509
|
+
* Name Token ownership is unknown.
|
|
2510
|
+
*/
|
|
2511
|
+
readonly Unknown: "unknown";
|
|
2512
|
+
};
|
|
2513
|
+
type NameTokenOwnershipType = (typeof NameTokenOwnershipTypes)[keyof typeof NameTokenOwnershipTypes];
|
|
2514
|
+
interface NameTokenOwnershipNameWrapper {
|
|
2515
|
+
ownershipType: typeof NameTokenOwnershipTypes.NameWrapper;
|
|
2516
|
+
/**
|
|
2517
|
+
* Owner
|
|
2518
|
+
*
|
|
2519
|
+
* Guarantees:
|
|
2520
|
+
* - `owner.address` is not the zero address.
|
|
2521
|
+
* - `owner.chainId` is same as the chainId of the associated NFT,
|
|
2522
|
+
* even if that NFT has been burned.
|
|
2523
|
+
*/
|
|
2524
|
+
owner: AccountId;
|
|
2525
|
+
}
|
|
2526
|
+
interface NameTokenOwnershipFullyOnchain {
|
|
2527
|
+
ownershipType: typeof NameTokenOwnershipTypes.FullyOnchain;
|
|
2528
|
+
/**
|
|
2529
|
+
* Owner
|
|
2530
|
+
*
|
|
2531
|
+
* Guarantees:
|
|
2532
|
+
* - `owner.address` is not the zero address.
|
|
2533
|
+
* - `owner.chainId` is same as the chainId of the associated NFT,
|
|
2534
|
+
* even if that NFT has been burned.
|
|
2535
|
+
*/
|
|
2536
|
+
owner: AccountId;
|
|
2537
|
+
}
|
|
2538
|
+
interface NameTokenOwnershipBurned {
|
|
2539
|
+
ownershipType: typeof NameTokenOwnershipTypes.Burned;
|
|
2540
|
+
/**
|
|
2541
|
+
* Owner
|
|
2542
|
+
*
|
|
2543
|
+
* Guarantees:
|
|
2544
|
+
* - `owner.address` is the zero address.
|
|
2545
|
+
* - `owner.chainId` is same as the chainId of the associated NFT,
|
|
2546
|
+
* even if that NFT has been burned.
|
|
2547
|
+
*/
|
|
2548
|
+
owner: AccountId;
|
|
2549
|
+
}
|
|
2550
|
+
interface NameTokenOwnershipUnknown {
|
|
2551
|
+
ownershipType: typeof NameTokenOwnershipTypes.Unknown;
|
|
2552
|
+
/**
|
|
2553
|
+
* Owner
|
|
2554
|
+
*
|
|
2555
|
+
* Guarantees:
|
|
2556
|
+
* - `owner.address` is the zero address.
|
|
2557
|
+
* - `owner.chainId` is same as the chainId of the associated NFT,
|
|
2558
|
+
* even if that NFT has been burned.
|
|
2559
|
+
*/
|
|
2560
|
+
owner: AccountId;
|
|
2561
|
+
}
|
|
2562
|
+
type NameTokenOwnership = NameTokenOwnershipNameWrapper | NameTokenOwnershipFullyOnchain | NameTokenOwnershipBurned | NameTokenOwnershipUnknown;
|
|
2563
|
+
interface NameToken {
|
|
2564
|
+
/**
|
|
2565
|
+
* Token
|
|
2566
|
+
*
|
|
2567
|
+
* References the NFT that currently or previously tokenized ownership of
|
|
2568
|
+
* `name`.
|
|
2569
|
+
*/
|
|
2570
|
+
token: AssetId;
|
|
2571
|
+
/**
|
|
2572
|
+
* Owner
|
|
2573
|
+
*
|
|
2574
|
+
* Identifies the ownership state of the token.
|
|
2575
|
+
*
|
|
2576
|
+
* Guarantees:
|
|
2577
|
+
* - The `ownership.owner.chainId` of this address is the same as is referenced
|
|
2578
|
+
* in `domainAsset.contract.chainId`.
|
|
2579
|
+
*/
|
|
2580
|
+
ownership: NameTokenOwnership;
|
|
2581
|
+
/**
|
|
2582
|
+
* The mint status of the token.
|
|
2583
|
+
*
|
|
2584
|
+
* After ENSNode indexes the token for a name, even if that token is burned,
|
|
2585
|
+
* ENSNode will never forget how the token once represented the name.
|
|
2586
|
+
* When the token for a name is burned, ENSNode remembers this token but
|
|
2587
|
+
* updates its `mintStatus` to `burned`. If this token becomes minted again
|
|
2588
|
+
* after it was burned, its `mintStatus` is updated to `minted` again.
|
|
2589
|
+
*
|
|
2590
|
+
* NOTE: Tokens managed by the .eth BaseRegistrar for
|
|
2591
|
+
* direct subnames of .eth can only be burned when undergoing
|
|
2592
|
+
* a state transition of `minted` -> `burned` -> `minted` all within
|
|
2593
|
+
* the same registrar action for the case that a direct subname of .eth
|
|
2594
|
+
* has expired and has been fully released and is now being registered again.
|
|
2595
|
+
* Since all of those mint status state transitions are processed within
|
|
2596
|
+
* a single block, once the token managed by the .eth BaseRegistrar for
|
|
2597
|
+
* a direct subname of .eth has been minted, our state model will forever
|
|
2598
|
+
* represent it as `minted`.
|
|
2599
|
+
*
|
|
2600
|
+
* Guarantees:
|
|
2601
|
+
* - The `mintStatus` will be burned if and only
|
|
2602
|
+
* if `ownership.ownershipType` is `NameTokenOwnershipTypes.Burned`.
|
|
2603
|
+
*/
|
|
2604
|
+
mintStatus: NFTMintStatus;
|
|
2605
|
+
}
|
|
2606
|
+
/**
|
|
2607
|
+
* Serialized representation of {@link NameToken}.
|
|
2608
|
+
*/
|
|
2609
|
+
interface SerializedNameToken extends Omit<NameToken, "token"> {
|
|
2610
|
+
token: SerializedAssetId;
|
|
2611
|
+
}
|
|
2612
|
+
declare function serializeNameToken(nameToken: NameToken): SerializedNameToken;
|
|
2613
|
+
/**
|
|
2614
|
+
* Get all NameWrapper accounts within provided ENS Namespace.
|
|
2615
|
+
*
|
|
2616
|
+
* Guaranteed to return at least one account for ENSRoot Datasource.
|
|
2617
|
+
*/
|
|
2618
|
+
declare function getNameWrapperAccounts(namespaceId: ENSNamespaceId): [AccountId, ...AccountId[]];
|
|
2619
|
+
/**
|
|
2620
|
+
* Get name token ownership for provided owner account within selected ENS Namespace.
|
|
2621
|
+
*/
|
|
2622
|
+
declare function getNameTokenOwnership(namespaceId: ENSNamespaceId, name: InterpretedName, owner: AccountId): NameTokenOwnership;
|
|
2623
|
+
|
|
2624
|
+
/**
|
|
2625
|
+
* Schema for {@link ErrorResponse}.
|
|
2626
|
+
*/
|
|
2627
|
+
declare const ErrorResponseSchema: z$1.ZodObject<{
|
|
2628
|
+
message: z$1.ZodString;
|
|
2629
|
+
details: z$1.ZodOptional<z$1.ZodUnknown>;
|
|
2630
|
+
}, z$1.core.$strip>;
|
|
2631
|
+
|
|
2632
|
+
/**
|
|
2633
|
+
* API Error Response Type
|
|
2634
|
+
*/
|
|
2635
|
+
type ErrorResponse = z$1.infer<typeof ErrorResponseSchema>;
|
|
2636
|
+
|
|
2637
|
+
/**
|
|
2638
|
+
* Deserialize a {@link ErrorResponse} object.
|
|
2639
|
+
*/
|
|
2640
|
+
declare function deserializeErrorResponse(maybeErrorResponse: unknown): ErrorResponse;
|
|
2641
|
+
|
|
2642
|
+
/**
|
|
2643
|
+
* A status code for Name Tokens API responses.
|
|
2644
|
+
*/
|
|
2645
|
+
declare const NameTokensResponseCodes: {
|
|
2646
|
+
/**
|
|
2647
|
+
* Represents a response when Name Tokens API can respond with requested data.
|
|
2648
|
+
*/
|
|
2649
|
+
readonly Ok: "ok";
|
|
2650
|
+
/**
|
|
2651
|
+
* Represents a response when Name Tokens API could not respond with requested data.
|
|
2652
|
+
*/
|
|
2653
|
+
readonly Error: "error";
|
|
2654
|
+
};
|
|
2655
|
+
/**
|
|
2656
|
+
* The derived string union of possible {@link NameTokensResponseCodes}.
|
|
2657
|
+
*/
|
|
2658
|
+
type NameTokensResponseCode = (typeof NameTokensResponseCodes)[keyof typeof NameTokensResponseCodes];
|
|
2659
|
+
/**
|
|
2660
|
+
* Error codes for Name Tokens API responses with 'error' response code.
|
|
2661
|
+
*/
|
|
2662
|
+
declare const NameTokensResponseErrorCodes: {
|
|
2663
|
+
/**
|
|
2664
|
+
* Name tokens not indexed
|
|
2665
|
+
*
|
|
2666
|
+
* Represents an error when tokens for the requested name are not indexed by
|
|
2667
|
+
* the ENSNode instance's configuration.
|
|
2668
|
+
*/
|
|
2669
|
+
readonly NameTokensNotIndexed: "name-tokens-not-indexed";
|
|
2670
|
+
/**
|
|
2671
|
+
* Unsupported ENSIndexer Config
|
|
2672
|
+
*
|
|
2673
|
+
* Represents a prerequisites error when connected ENSIndexer config lacks
|
|
2674
|
+
* params required to enable Name Tokens API.
|
|
2675
|
+
*/
|
|
2676
|
+
readonly EnsIndexerConfigUnsupported: "unsupported-ensindexer-config";
|
|
2677
|
+
/**
|
|
2678
|
+
* Unsupported Indexing Status
|
|
2679
|
+
*
|
|
2680
|
+
* Represents a prerequisites error when Indexing Status has not yet reached
|
|
2681
|
+
* status required to enable Name Tokens API.
|
|
2682
|
+
*/
|
|
2683
|
+
readonly IndexingStatusUnsupported: "unsupported-indexing-status";
|
|
2684
|
+
};
|
|
2685
|
+
/**
|
|
2686
|
+
* The derived string union of possible {@link NameTokensResponseErrorCodes}.
|
|
2687
|
+
*/
|
|
2688
|
+
type NameTokensResponseErrorCode = (typeof NameTokensResponseErrorCodes)[keyof typeof NameTokensResponseErrorCodes];
|
|
2689
|
+
/**
|
|
2690
|
+
* Name Tokens for a name who's tokens are configured to
|
|
2691
|
+
* be indexed by the ENSNode instance's configuration.
|
|
2692
|
+
*/
|
|
2693
|
+
interface RegisteredNameTokens {
|
|
2694
|
+
/**
|
|
2695
|
+
* Domain ID
|
|
2696
|
+
*/
|
|
2697
|
+
domainId: Node;
|
|
2698
|
+
/**
|
|
2699
|
+
* Name
|
|
2700
|
+
*
|
|
2701
|
+
* FQDN of the name associated with `domainId`.
|
|
2702
|
+
*
|
|
2703
|
+
* Guarantees:
|
|
2704
|
+
* - `namehash(name)` is always `domainId`.
|
|
2705
|
+
*/
|
|
2706
|
+
name: InterpretedName;
|
|
2707
|
+
/**
|
|
2708
|
+
* Name Tokens associated with the `domainId`.
|
|
2709
|
+
*
|
|
2710
|
+
* It contains every tokenized representation of `name` that
|
|
2711
|
+
* has ever been indexed for the given name as of `accurateAsOf`,
|
|
2712
|
+
* even if the given token has been burned or expired.
|
|
2713
|
+
*
|
|
2714
|
+
* Guarantees:
|
|
2715
|
+
* - Always includes at least one name token.
|
|
2716
|
+
* - When it includes more than one name token, it means that:
|
|
2717
|
+
* 1) More than 1 distinct tokenized representation of the ownership of
|
|
2718
|
+
* the `name` has been indexed as of `accurateAsOf`.
|
|
2719
|
+
* 2) All possible permutations of mint statuses of these tokens are
|
|
2720
|
+
* possible:
|
|
2721
|
+
* a) Multiple could be actively minted.
|
|
2722
|
+
* b) Multiple could be burned.
|
|
2723
|
+
* c) Some could be burned, others could be minted.
|
|
2724
|
+
* - Order of name tokens follows the order of onchain events that were
|
|
2725
|
+
* indexed when a token was minted, or burned.
|
|
2726
|
+
* - Each name token has a distinct `token` value which references
|
|
2727
|
+
* the NFT that currently or previously tokenized ownership of `name`.
|
|
2728
|
+
* - Each name token has ownership type (`ownership.ownershipType`) assigned:
|
|
2729
|
+
* - If there's a name token with ownership type
|
|
2730
|
+
* {@link NameTokenOwnershipTypes.NameWrapper}, it means that there must be also
|
|
2731
|
+
* another name token with ownership type either
|
|
2732
|
+
* {@link NameTokenOwnershipTypes.FullyOnchain}, or
|
|
2733
|
+
* {@link NameTokenOwnershipTypes.Unknown}.
|
|
2734
|
+
* - There can be at most one name token with ownership type
|
|
2735
|
+
* {@link NameTokenOwnershipTypes.FullyOnchain}.
|
|
2736
|
+
* - There can be any number of name tokens with ownership type
|
|
2737
|
+
* {@link NameTokenOwnershipTypes.Burned}.
|
|
2738
|
+
*
|
|
2739
|
+
* NOTE: It can be useful to get tokenized representations of the name that
|
|
2740
|
+
* are now burned: This can be helpful for looking up historical activity for
|
|
2741
|
+
* the name, including past buy orders, sell orders, and sales.
|
|
2742
|
+
*
|
|
2743
|
+
* How will the direct subnames of .eth that are wrapped by the NameWrapper
|
|
2744
|
+
* be represented?
|
|
2745
|
+
* 1) A direct subname of .eth that has been registered but
|
|
2746
|
+
* has never been wrapped by the NameWrapper, and:
|
|
2747
|
+
* a) Is still actively minted (independent of its expiry state).
|
|
2748
|
+
* b) Has been burned by sending it to the null address.
|
|
2749
|
+
* 2) A direct subname of .eth that has been registered and
|
|
2750
|
+
* has been wrapped by the NameWrapper, and:
|
|
2751
|
+
* a) Is still actively wrapped by the NameWrapper (independent of its
|
|
2752
|
+
* expiry state).
|
|
2753
|
+
* b) Is no longer wrapped by the NameWrapper, but is still actively
|
|
2754
|
+
* minted by the BaseRegistrar (independent of its expiry state).
|
|
2755
|
+
* c) Is no longer wrapped by the NameWrapper, and is also no longer
|
|
2756
|
+
* minted by the BaseRegistrar (both tokens now burned by sending to
|
|
2757
|
+
* the null address).
|
|
2758
|
+
*/
|
|
2759
|
+
tokens: NameToken[];
|
|
2760
|
+
/**
|
|
2761
|
+
* Expiry date for the Registration Lifecycle
|
|
2762
|
+
*
|
|
2763
|
+
* The latest Registration Lifecycle for a node referenced in `domainId`.
|
|
2764
|
+
*/
|
|
2765
|
+
expiresAt: UnixTimestamp$1;
|
|
2766
|
+
/**
|
|
2767
|
+
* The {@link UnixTimestamp} of when the data used to build the {@link NameTokensResponseOk.nameTokens} was accurate as of.
|
|
2768
|
+
*/
|
|
2769
|
+
accurateAsOf: UnixTimestamp$1;
|
|
2770
|
+
}
|
|
2771
|
+
/**
|
|
2772
|
+
* A response when Name Tokens API can respond with requested data.
|
|
2773
|
+
*/
|
|
2774
|
+
type NameTokensResponseOk = {
|
|
2775
|
+
responseCode: typeof NameTokensResponseCodes.Ok;
|
|
2776
|
+
/**
|
|
2777
|
+
* Name Tokens for the requested name.
|
|
2778
|
+
*/
|
|
2779
|
+
registeredNameTokens: RegisteredNameTokens;
|
|
2780
|
+
};
|
|
2781
|
+
/**
|
|
2782
|
+
* Represents an error response when requested name was not indexed by ENSNode.
|
|
2783
|
+
*/
|
|
2784
|
+
interface NameTokensResponseErrorNameTokensNotIndexed {
|
|
2785
|
+
responseCode: typeof NameTokensResponseCodes.Error;
|
|
2786
|
+
errorCode: typeof NameTokensResponseErrorCodes.NameTokensNotIndexed;
|
|
2787
|
+
error: ErrorResponse;
|
|
2788
|
+
}
|
|
2789
|
+
/**
|
|
2790
|
+
* Represents an error response when connected ENSIndexer config lacks
|
|
2791
|
+
* params required to enable Name Tokens API.
|
|
2792
|
+
*/
|
|
2793
|
+
interface NameTokensResponseErrorEnsIndexerConfigUnsupported {
|
|
2794
|
+
responseCode: typeof NameTokensResponseCodes.Error;
|
|
2795
|
+
errorCode: typeof NameTokensResponseErrorCodes.EnsIndexerConfigUnsupported;
|
|
2796
|
+
error: ErrorResponse;
|
|
2797
|
+
}
|
|
2798
|
+
/**
|
|
2799
|
+
* Represents an error response when Indexing Status has not yet reached
|
|
2800
|
+
* status required to enable Name Tokens API.
|
|
2801
|
+
*/
|
|
2802
|
+
interface NameTokensResponseErrorIndexingStatusUnsupported {
|
|
2803
|
+
responseCode: typeof NameTokensResponseCodes.Error;
|
|
2804
|
+
errorCode: typeof NameTokensResponseErrorCodes.IndexingStatusUnsupported;
|
|
2805
|
+
error: ErrorResponse;
|
|
2806
|
+
}
|
|
2807
|
+
type NameTokensResponseError = NameTokensResponseErrorNameTokensNotIndexed | NameTokensResponseErrorEnsIndexerConfigUnsupported | NameTokensResponseErrorIndexingStatusUnsupported;
|
|
2808
|
+
/**
|
|
2809
|
+
* Name Tokens response.
|
|
2810
|
+
*
|
|
2811
|
+
* Use the `responseCode` field to determine the specific type interpretation
|
|
2812
|
+
* at runtime.
|
|
2813
|
+
*/
|
|
2814
|
+
type NameTokensResponse = NameTokensResponseOk | NameTokensResponseError;
|
|
2815
|
+
|
|
2816
|
+
/**
|
|
2817
|
+
* Serialized representation of {@link NameTokensResponseError}.
|
|
2818
|
+
*/
|
|
2819
|
+
type SerializedNameTokensResponseError = NameTokensResponseError;
|
|
2820
|
+
/**
|
|
2821
|
+
* Serialized representation of {@link RegisteredNameToken}.
|
|
2822
|
+
*/
|
|
2823
|
+
interface SerializedRegisteredNameTokens extends Omit<RegisteredNameTokens, "tokens"> {
|
|
2824
|
+
tokens: SerializedNameToken[];
|
|
2825
|
+
}
|
|
2826
|
+
/**
|
|
2827
|
+
* Serialized representation of {@link NameTokensResponseOk}.
|
|
2828
|
+
*/
|
|
2829
|
+
interface SerializedNameTokensResponseOk extends Omit<NameTokensResponseOk, "registeredNameTokens"> {
|
|
2830
|
+
registeredNameTokens: SerializedRegisteredNameTokens;
|
|
2831
|
+
}
|
|
2832
|
+
/**
|
|
2833
|
+
* Serialized representation of {@link NameTokensResponse}.
|
|
2834
|
+
*/
|
|
2835
|
+
type SerializedNameTokensResponse = SerializedNameTokensResponseOk | SerializedNameTokensResponseError;
|
|
2836
|
+
|
|
2837
|
+
declare function serializeRegisteredNameTokens({ domainId, name, tokens, expiresAt, accurateAsOf, }: RegisteredNameTokens): SerializedRegisteredNameTokens;
|
|
2838
|
+
declare function serializeNameTokensResponse(response: NameTokensResponse): SerializedNameTokensResponse;
|
|
2839
|
+
|
|
2840
|
+
/**
|
|
2841
|
+
* Gets the SubregistryId (an AccountId) of the Basenames Subregistry contract (this is the
|
|
2842
|
+
* "BaseRegistrar" contract for Basenames) for the provided namespace.
|
|
2843
|
+
*
|
|
2844
|
+
* @param namespace The ENS namespace to get the Basenames Subregistry ID for
|
|
2845
|
+
* @returns The AccountId for the Basenames Subregistry contract for the provided namespace.
|
|
2846
|
+
* @throws Error if the contract is not found for the given namespace.
|
|
2847
|
+
*/
|
|
2848
|
+
declare function getBasenamesSubregistryId(namespace: ENSNamespaceId): AccountId;
|
|
2849
|
+
/**
|
|
2850
|
+
* Get the managed name for the Basenames subregistry for the selected ENS namespace.
|
|
2851
|
+
*
|
|
2852
|
+
* @param namespaceId
|
|
2853
|
+
* @returns registrar managed name
|
|
2854
|
+
* @throws an error when no registrar managed name could be returned
|
|
2855
|
+
*/
|
|
2856
|
+
declare function getBasenamesSubregistryManagedName(namespaceId: ENSNamespaceId): Name;
|
|
2857
|
+
|
|
2858
|
+
/**
|
|
2859
|
+
* Gets the SubregistryId (an AccountId) of the Ethnames Subregistry contract (this is the
|
|
2860
|
+
* "BaseRegistrar" contract for direct subnames of .eth) for the provided namespace.
|
|
2861
|
+
*
|
|
2862
|
+
* @param namespace The ENS namespace to get the Ethnames Subregistry ID for
|
|
2863
|
+
* @returns The AccountId for the Ethnames Subregistry contract for the provided namespace.
|
|
2864
|
+
* @throws Error if the contract is not found for the given namespace.
|
|
2865
|
+
*/
|
|
2866
|
+
declare function getEthnamesSubregistryId(namespace: ENSNamespaceId): AccountId;
|
|
2867
|
+
/**
|
|
2868
|
+
* Get the managed name for the Ethnames subregistry for the selected ENS namespace.
|
|
2869
|
+
*
|
|
2870
|
+
* @param namespaceId
|
|
2871
|
+
* @returns registrar managed name
|
|
2872
|
+
*/
|
|
2873
|
+
declare function getEthnamesSubregistryManagedName(namespaceId: ENSNamespaceId): Name;
|
|
2874
|
+
|
|
2875
|
+
/**
|
|
2876
|
+
* Gets the SubregistryId (an AccountId) of the Lineanames Subregistry contract (this is the
|
|
2877
|
+
* "BaseRegistrar" contract for Lineanames) for the provided namespace.
|
|
2878
|
+
*
|
|
2879
|
+
* @param namespace The ENS namespace to get the Lineanames Subregistry ID for
|
|
2880
|
+
* @returns The AccountId for the Lineanames Subregistry contract for the provided namespace.
|
|
2881
|
+
* @throws Error if the contract is not found for the given namespace.
|
|
2882
|
+
*/
|
|
2883
|
+
declare function getLineanamesSubregistryId(namespace: ENSNamespaceId): AccountId;
|
|
2884
|
+
/**
|
|
2885
|
+
* Get the managed name for the Lineanames subregistry for the selected ENS namespace.
|
|
2886
|
+
*
|
|
2887
|
+
* @param namespaceId
|
|
2888
|
+
* @returns registrar managed name
|
|
2889
|
+
* @throws an error when no registrar managed name could be returned
|
|
2890
|
+
*/
|
|
2891
|
+
declare function getLineanamesSubregistryManagedName(namespaceId: ENSNamespaceId): Name;
|
|
2892
|
+
|
|
2893
|
+
/**
|
|
2894
|
+
* Subregistry
|
|
2895
|
+
*/
|
|
2896
|
+
interface Subregistry {
|
|
2897
|
+
/**
|
|
2898
|
+
* Subregistry ID
|
|
2899
|
+
*
|
|
2900
|
+
* The ID of the subregistry the "logical registrar action" was taken on.
|
|
2901
|
+
*
|
|
2902
|
+
* Identifies the chainId and address of the associated subregistry smart
|
|
2903
|
+
* contract.
|
|
2904
|
+
*/
|
|
2905
|
+
subregistryId: AccountId;
|
|
2906
|
+
/**
|
|
2907
|
+
* The node (namehash) of the name the subregistry manages subnames of.
|
|
2908
|
+
* Example subregistry managed names:
|
|
2909
|
+
* - `eth`
|
|
2910
|
+
* - `base.eth`
|
|
2911
|
+
* - `linea.eth`
|
|
2912
|
+
*/
|
|
2913
|
+
node: Node;
|
|
2914
|
+
}
|
|
2915
|
+
|
|
2916
|
+
/**
|
|
2917
|
+
* Registration Lifecycle Stages
|
|
2918
|
+
*
|
|
2919
|
+
* Important: this definition should not be used anywhere.
|
|
2920
|
+
* It's only here to capture some ideas that were shared in the team.
|
|
2921
|
+
*/
|
|
2922
|
+
declare const RegistrationLifecycleStages: {
|
|
2923
|
+
/**
|
|
2924
|
+
* Active
|
|
2925
|
+
*
|
|
2926
|
+
* Happens when
|
|
2927
|
+
* the current timestamp <= expiry.
|
|
2928
|
+
*/
|
|
2929
|
+
readonly Active: "registrationLifecycle_active";
|
|
2930
|
+
/**
|
|
2931
|
+
* Grace Period
|
|
2932
|
+
*
|
|
2933
|
+
* Happens when
|
|
2934
|
+
* `expiry < the current timestamp <= expiry + 90 days`.
|
|
2935
|
+
*/
|
|
2936
|
+
readonly GracePeriod: "registrationLifecycle_gracePeriod";
|
|
2937
|
+
/**
|
|
2938
|
+
* Released with Temporary Premium Price
|
|
2939
|
+
*
|
|
2940
|
+
* Happens when
|
|
2941
|
+
* `expiry + 90 days < the current timestamp <= expiry + 120 days`.
|
|
2942
|
+
*/
|
|
2943
|
+
readonly ReleasedWithTempPrice: "registrationLifecycle_releasedWithTempPrice";
|
|
2944
|
+
/**
|
|
2945
|
+
* Fully Released (Regular Price)
|
|
2946
|
+
*
|
|
2947
|
+
* Happens when
|
|
2948
|
+
* ` expiry + 120 days < the current timestamp`.
|
|
2949
|
+
*/
|
|
2950
|
+
readonly FullyReleased: "registrationLifecycle_fullyReleased";
|
|
2951
|
+
};
|
|
2952
|
+
type RegistrationLifecycleStage = (typeof RegistrationLifecycleStages)[keyof typeof RegistrationLifecycleStages];
|
|
2953
|
+
/**
|
|
2954
|
+
* Registration Lifecycle
|
|
2955
|
+
*/
|
|
2956
|
+
interface RegistrationLifecycle {
|
|
2957
|
+
/**
|
|
2958
|
+
* Subregistry that manages this Registration Lifecycle.
|
|
2959
|
+
*/
|
|
2960
|
+
subregistry: Subregistry;
|
|
2961
|
+
/**
|
|
2962
|
+
* The node (namehash) of the FQDN of the domain the registration lifecycle
|
|
2963
|
+
* is associated with.
|
|
2964
|
+
*
|
|
2965
|
+
* Guaranteed to be a subname of the node (namehash) of the subregistry
|
|
2966
|
+
* identified by `subregistryId.subregistryId`.
|
|
2967
|
+
*/
|
|
2968
|
+
node: Node;
|
|
2969
|
+
/**
|
|
2970
|
+
* Expires at
|
|
2971
|
+
*
|
|
2972
|
+
* Identifies when the Registration Lifecycle is scheduled to expire.
|
|
2973
|
+
*/
|
|
2974
|
+
expiresAt: UnixTimestamp;
|
|
2975
|
+
}
|
|
2976
|
+
|
|
2977
|
+
/**
|
|
2978
|
+
* Globally unique, deterministic ID of an indexed onchain event
|
|
2979
|
+
* associated with the "logical registrar action".
|
|
2980
|
+
*/
|
|
2981
|
+
type RegistrarActionEventId = string;
|
|
2982
|
+
/**
|
|
2983
|
+
* Types of "logical registrar action".
|
|
2984
|
+
*/
|
|
2985
|
+
declare const RegistrarActionTypes: {
|
|
2986
|
+
readonly Registration: "registration";
|
|
2987
|
+
readonly Renewal: "renewal";
|
|
2988
|
+
};
|
|
2989
|
+
type RegistrarActionType = (typeof RegistrarActionTypes)[keyof typeof RegistrarActionTypes];
|
|
2990
|
+
/**
|
|
2991
|
+
* Pricing information for a "logical registrar action".
|
|
2992
|
+
*/
|
|
2993
|
+
interface RegistrarActionPricingAvailable {
|
|
2994
|
+
/**
|
|
2995
|
+
* Base cost
|
|
2996
|
+
*
|
|
2997
|
+
* Base cost (before any `premium`) of Ether measured in units of Wei
|
|
2998
|
+
* paid to execute the "logical registrar action".
|
|
2999
|
+
*
|
|
3000
|
+
* May be 0.
|
|
3001
|
+
*/
|
|
3002
|
+
baseCost: PriceEth;
|
|
3003
|
+
/**
|
|
3004
|
+
* Premium
|
|
3005
|
+
*
|
|
3006
|
+
* "premium" cost (in excesses of the `baseCost`) of Ether measured in
|
|
3007
|
+
* units of Wei paid to execute the "logical registrar action".
|
|
3008
|
+
*
|
|
3009
|
+
* May be 0.
|
|
3010
|
+
*/
|
|
3011
|
+
premium: PriceEth;
|
|
3012
|
+
/**
|
|
3013
|
+
* Total
|
|
3014
|
+
*
|
|
3015
|
+
* Total cost of Ether measured in units of Wei paid to execute
|
|
3016
|
+
* the "logical registrar action".
|
|
3017
|
+
*
|
|
3018
|
+
* May be 0.
|
|
3019
|
+
*/
|
|
3020
|
+
total: PriceEth;
|
|
3021
|
+
}
|
|
3022
|
+
/**
|
|
3023
|
+
* Pricing information for a "logical registrar action" when
|
|
3024
|
+
* there is no known pricing data.
|
|
3025
|
+
*/
|
|
3026
|
+
interface RegistrarActionPricingUnknown {
|
|
3027
|
+
/**
|
|
3028
|
+
* Base cost
|
|
3029
|
+
*
|
|
3030
|
+
* Base cost (before any `premium`) of Ether measured in units of Wei
|
|
3031
|
+
* paid to execute the "logical registrar action".
|
|
3032
|
+
*/
|
|
3033
|
+
baseCost: null;
|
|
3034
|
+
/**
|
|
3035
|
+
* Premium
|
|
3036
|
+
*
|
|
3037
|
+
* "premium" cost (in excesses of the `baseCost`) of Ether measured in
|
|
3038
|
+
* units of Wei paid to execute the "logical registrar action".
|
|
3039
|
+
*/
|
|
3040
|
+
premium: null;
|
|
3041
|
+
/**
|
|
3042
|
+
* Total
|
|
3043
|
+
*
|
|
3044
|
+
* Total cost of Ether measured in units of Wei paid to execute
|
|
3045
|
+
* the "logical registrar action".
|
|
3046
|
+
*/
|
|
3047
|
+
total: null;
|
|
3048
|
+
}
|
|
3049
|
+
type RegistrarActionPricing = RegistrarActionPricingAvailable | RegistrarActionPricingUnknown;
|
|
3050
|
+
declare function isRegistrarActionPricingAvailable(registrarActionPricing: RegistrarActionPricing): registrarActionPricing is RegistrarActionPricingAvailable;
|
|
3051
|
+
/**
|
|
3052
|
+
* * Referral information for performing a "logical registrar action".
|
|
3053
|
+
*/
|
|
3054
|
+
interface RegistrarActionReferralAvailable {
|
|
3055
|
+
/**
|
|
3056
|
+
* Encoded Referrer
|
|
3057
|
+
*
|
|
3058
|
+
* Represents the "raw" 32-byte "referrer" value emitted onchain in
|
|
3059
|
+
* association with the registrar action.
|
|
3060
|
+
*/
|
|
3061
|
+
encodedReferrer: EncodedReferrer;
|
|
3062
|
+
/**
|
|
3063
|
+
* Decoded Referrer
|
|
3064
|
+
*
|
|
3065
|
+
* Decoded referrer according to the subjective interpretation of
|
|
3066
|
+
* `encodedReferrer` defined for ENS Holiday Awards.
|
|
3067
|
+
*
|
|
3068
|
+
* Identifies the interpreted address of the referrer.
|
|
3069
|
+
* The "chainId" of this address is the same as is referenced in
|
|
3070
|
+
* `subregistryId`.
|
|
3071
|
+
*
|
|
3072
|
+
* May be the "zero address" to represent that an `encodedReferrer` is
|
|
3073
|
+
* defined but that it is interpreted as no referrer.
|
|
3074
|
+
*/
|
|
3075
|
+
decodedReferrer: Address;
|
|
3076
|
+
}
|
|
3077
|
+
/**
|
|
3078
|
+
* Referral information for performing a "logical registrar action" when
|
|
3079
|
+
* registrar controller does not implement referrals.
|
|
3080
|
+
*/
|
|
3081
|
+
interface RegistrarActionReferralNotApplicable {
|
|
3082
|
+
/**
|
|
3083
|
+
* Encoded Referrer
|
|
3084
|
+
*
|
|
3085
|
+
* Represents the "raw" 32-byte "referrer" value emitted onchain in
|
|
3086
|
+
* association with the registrar action.
|
|
3087
|
+
*/
|
|
3088
|
+
encodedReferrer: null;
|
|
3089
|
+
/**
|
|
3090
|
+
* Decoded Referrer
|
|
3091
|
+
*
|
|
3092
|
+
* Decoded referrer according to the subjective interpretation of
|
|
3093
|
+
* `encodedReferrer` defined for ENS Holiday Awards.
|
|
3094
|
+
*
|
|
3095
|
+
*/
|
|
3096
|
+
decodedReferrer: null;
|
|
3097
|
+
}
|
|
3098
|
+
type RegistrarActionReferral = RegistrarActionReferralAvailable | RegistrarActionReferralNotApplicable;
|
|
3099
|
+
declare function isRegistrarActionReferralAvailable(registrarActionReferral: RegistrarActionReferral): registrarActionReferral is RegistrarActionReferralAvailable;
|
|
3100
|
+
/**
|
|
3101
|
+
* "Logical registrar action"
|
|
3102
|
+
*
|
|
3103
|
+
* Represents a state of "logical registrar action". May be built using data
|
|
3104
|
+
* from multiple events within the same "logical" registration / renewal action.
|
|
3105
|
+
*/
|
|
3106
|
+
interface RegistrarAction {
|
|
3107
|
+
/**
|
|
3108
|
+
* "Logical registrar action" ID
|
|
3109
|
+
*
|
|
3110
|
+
* The `id` value is a deterministic and globally unique identifier for
|
|
3111
|
+
* the "logical registrar action".
|
|
3112
|
+
*
|
|
3113
|
+
* The `id` value represents the *initial* onchain event associated with
|
|
3114
|
+
* the "logical registrar action", but the full state of
|
|
3115
|
+
* the "logical registrar action" is an aggregate across each of
|
|
3116
|
+
* the onchain events referenced in the `eventIds` field.
|
|
3117
|
+
*
|
|
3118
|
+
* Guaranteed to be the very first element in `eventIds` array.
|
|
3119
|
+
*/
|
|
3120
|
+
id: RegistrarActionEventId;
|
|
3121
|
+
/**
|
|
3122
|
+
* The type of the "logical registrar action".
|
|
3123
|
+
*/
|
|
3124
|
+
type: RegistrarActionType;
|
|
3125
|
+
/**
|
|
3126
|
+
*
|
|
3127
|
+
* Incremental Duration
|
|
3128
|
+
*
|
|
3129
|
+
* If `type` is "registration":
|
|
3130
|
+
* - Represents the duration between `block.timestamp` and
|
|
3131
|
+
* the initial `registrationLifecycle.expiresAt` value that the associated
|
|
3132
|
+
* "registration lifecycle" will be initialized with.
|
|
3133
|
+
* If `type` is "renewal":
|
|
3134
|
+
* - Represents the incremental increase in duration made to
|
|
3135
|
+
* the `registrationLifecycle.expiresAt` value in the associated
|
|
3136
|
+
* "registration lifecycle".
|
|
3137
|
+
*
|
|
3138
|
+
* A "registration lifecycle" may be extended via renewal even after it
|
|
3139
|
+
* expires if it is still within its grace period.
|
|
3140
|
+
*
|
|
3141
|
+
* Consider the following scenario:
|
|
3142
|
+
*
|
|
3143
|
+
* The "registration lifecycle" of a direct subname of .eth is scheduled to
|
|
3144
|
+
* expire on Jan 1, midnight UTC. It is currently 30 days after this
|
|
3145
|
+
* expiration time. Therefore, there are currently another 60 days of grace
|
|
3146
|
+
* period remaining for this name. Anyone can still make a renewal to
|
|
3147
|
+
* extend the "registration lifecycle" of this name.
|
|
3148
|
+
*
|
|
3149
|
+
* Given this scenario, consider the following examples:
|
|
3150
|
+
*
|
|
3151
|
+
* 1. If a renewal is made with 10 days incremental duration,
|
|
3152
|
+
* the "registration lifecycle" for this name will remain in
|
|
3153
|
+
* an "expired" state, but it will now have another 70 days of
|
|
3154
|
+
* grace period remaining.
|
|
3155
|
+
*
|
|
3156
|
+
* 2. If a renewal is made with 50 days incremental duration,
|
|
3157
|
+
* the "registration lifecycle" for this name will no longer be
|
|
3158
|
+
* "expired" and will become "active", but the "registration lifecycle"
|
|
3159
|
+
* will now be scheduled to expire again in 20 days.
|
|
3160
|
+
*
|
|
3161
|
+
* After the "registration lifecycle" for a name becomes expired by more
|
|
3162
|
+
* than its grace period, it can no longer be renewed by anyone and is
|
|
3163
|
+
* considered "released". The name must first be registered again, starting
|
|
3164
|
+
* a new "registration lifecycle" of
|
|
3165
|
+
* active / expired / grace period / released.
|
|
3166
|
+
*
|
|
3167
|
+
* May be 0.
|
|
3168
|
+
*
|
|
3169
|
+
* Guaranteed to be a non-negative bigint value.
|
|
3170
|
+
*/
|
|
3171
|
+
incrementalDuration: Duration;
|
|
3172
|
+
/**
|
|
3173
|
+
* Registrant
|
|
3174
|
+
*
|
|
3175
|
+
* Identifies the address that initiated the "logical registrar action" and
|
|
3176
|
+
* is paying the `pricing.total` cost (if applicable).
|
|
3177
|
+
*
|
|
3178
|
+
* It may not be the owner of the name:
|
|
3179
|
+
* 1. When a name is registered, the initial owner of the name may be
|
|
3180
|
+
* distinct from the registrant.
|
|
3181
|
+
* 2. There are no restrictions on who may renew a name.
|
|
3182
|
+
* Therefore the owner of the name may be distinct from the registrant.
|
|
3183
|
+
*
|
|
3184
|
+
* The "chainId" of this address is the same as is referenced in
|
|
3185
|
+
* `registrationLifecycle.subregistry.subregistryId`.
|
|
3186
|
+
*/
|
|
3187
|
+
registrant: Address;
|
|
3188
|
+
/**
|
|
3189
|
+
* Registration Lifecycle associated with this "logical registrar action".
|
|
3190
|
+
*/
|
|
3191
|
+
registrationLifecycle: RegistrationLifecycle;
|
|
3192
|
+
/**
|
|
3193
|
+
* Pricing information associated with this "logical registrar action".
|
|
3194
|
+
*/
|
|
3195
|
+
pricing: RegistrarActionPricing;
|
|
3196
|
+
/**
|
|
3197
|
+
* Referral information associated with this "logical registrar action".
|
|
3198
|
+
*/
|
|
3199
|
+
referral: RegistrarActionReferral;
|
|
3200
|
+
/**
|
|
3201
|
+
* Block ref
|
|
3202
|
+
*
|
|
3203
|
+
* References the block where the "logical registrar action" was executed.
|
|
3204
|
+
*
|
|
3205
|
+
* The "chainId" of this block is the same as is referenced in
|
|
3206
|
+
* `registrationLifecycle.subregistry.subregistryId`.
|
|
3207
|
+
*/
|
|
3208
|
+
block: BlockRef;
|
|
3209
|
+
/**
|
|
3210
|
+
* Transaction hash
|
|
3211
|
+
*
|
|
3212
|
+
* Transaction hash of the transaction associated with
|
|
3213
|
+
* the "logical registrar action".
|
|
3214
|
+
*
|
|
3215
|
+
* The "chainId" of this transaction is the same as is referenced in
|
|
3216
|
+
* `registrationLifecycle.subregistry.subregistryId`.
|
|
3217
|
+
*
|
|
3218
|
+
* Note that a single transaction may be associated with any number of
|
|
3219
|
+
* "logical registrar actions".
|
|
3220
|
+
*/
|
|
3221
|
+
transactionHash: Hash;
|
|
3222
|
+
/**
|
|
3223
|
+
* Event IDs
|
|
3224
|
+
*
|
|
3225
|
+
* Array of the eventIds that have contributed to the state of
|
|
3226
|
+
* the "logical registrar action" record.
|
|
3227
|
+
*
|
|
3228
|
+
* Each eventId is a deterministic and globally unique onchain event
|
|
3229
|
+
* identifier.
|
|
3230
|
+
*
|
|
3231
|
+
* Guarantees:
|
|
3232
|
+
* - Each eventId is of events that occurred within the block
|
|
3233
|
+
* referenced by `block.number`.
|
|
3234
|
+
* - At least 1 eventId.
|
|
3235
|
+
* - Ordered chronologically (ascending) by logIndex within `block.number`.
|
|
3236
|
+
* - The first element in the array is equal to the `id` of
|
|
3237
|
+
* the overall "logical registrar action" record.
|
|
3238
|
+
*
|
|
3239
|
+
* The following ideas are not generalized for ENS overall but happen to
|
|
3240
|
+
* be a characteristic of the scope of our current indexing logic:
|
|
3241
|
+
* 1. These id's always reference events emitted by
|
|
3242
|
+
* a related "BaseRegistrar" contract.
|
|
3243
|
+
* 2. These id's optionally reference events emitted by
|
|
3244
|
+
* a related "Registrar Controller" contract. This is because our
|
|
3245
|
+
* current indexing logic doesn't guarantee to index
|
|
3246
|
+
* all "Registrar Controller" contracts.
|
|
3247
|
+
*/
|
|
3248
|
+
eventIds: [RegistrarActionEventId, ...RegistrarActionEventId[]];
|
|
3249
|
+
}
|
|
3250
|
+
/**
|
|
3251
|
+
* Serialized representation of {@link RegistrarActionPricingUnknown}.
|
|
3252
|
+
*/
|
|
3253
|
+
type SerializedRegistrarActionPricingUnknown = RegistrarActionPricingUnknown;
|
|
3254
|
+
/**
|
|
3255
|
+
* Serialized representation of {@link RegistrarActionPricingAvailable}.
|
|
3256
|
+
*/
|
|
3257
|
+
interface SerializedRegistrarActionPricingAvailable {
|
|
3258
|
+
baseCost: SerializedPriceEth;
|
|
3259
|
+
premium: SerializedPriceEth;
|
|
3260
|
+
total: SerializedPriceEth;
|
|
3261
|
+
}
|
|
3262
|
+
/**
|
|
3263
|
+
* Serialized representation of {@link RegistrarActionPricing}.
|
|
3264
|
+
*/
|
|
3265
|
+
type SerializedRegistrarActionPricing = SerializedRegistrarActionPricingAvailable | SerializedRegistrarActionPricingUnknown;
|
|
3266
|
+
/**
|
|
3267
|
+
* Serialized representation of {@link RegistrarAction}.
|
|
3268
|
+
*/
|
|
3269
|
+
interface SerializedRegistrarAction extends Omit<RegistrarAction, "pricing"> {
|
|
3270
|
+
pricing: SerializedRegistrarActionPricing;
|
|
3271
|
+
}
|
|
3272
|
+
declare function serializeRegistrarActionPricing(pricing: RegistrarActionPricing): SerializedRegistrarActionPricing;
|
|
3273
|
+
declare function serializeRegistrarAction(registrarAction: RegistrarAction): SerializedRegistrarAction;
|
|
3274
|
+
|
|
3275
|
+
declare const RECORDS_PER_PAGE_DEFAULT = 10;
|
|
3276
|
+
declare const RECORDS_PER_PAGE_MAX = 100;
|
|
3277
|
+
/**
|
|
3278
|
+
* Request page params.
|
|
3279
|
+
*/
|
|
3280
|
+
interface RequestPageParams {
|
|
3281
|
+
/**
|
|
3282
|
+
* Requested page number (1-indexed)
|
|
3283
|
+
* @invariant Must be a positive integer (>= 1)
|
|
3284
|
+
* @default 1
|
|
3285
|
+
*/
|
|
3286
|
+
page?: number;
|
|
3287
|
+
/**
|
|
3288
|
+
* Maximum number of records to return per page
|
|
3289
|
+
* @invariant Must be a positive integer (>= 1) and less than or equal to {@link RECORDS_PER_PAGE_MAX}
|
|
3290
|
+
* @default {@link RECORDS_PER_PAGE_DEFAULT}
|
|
3291
|
+
*/
|
|
3292
|
+
recordsPerPage?: number;
|
|
3293
|
+
}
|
|
3294
|
+
|
|
3295
|
+
interface ResponsePageContextWithNoRecords extends Required<RequestPageParams> {
|
|
3296
|
+
/**
|
|
3297
|
+
* Total number of records across all pages
|
|
3298
|
+
*/
|
|
3299
|
+
totalRecords: 0;
|
|
3300
|
+
/**
|
|
3301
|
+
* Total number of pages
|
|
3302
|
+
*/
|
|
3303
|
+
totalPages: 1;
|
|
3304
|
+
/**
|
|
3305
|
+
* Indicates if there is a next page available
|
|
3306
|
+
*/
|
|
3307
|
+
hasNext: false;
|
|
3308
|
+
/**
|
|
3309
|
+
* Indicates if there is a previous page available
|
|
3310
|
+
*/
|
|
3311
|
+
hasPrev: false;
|
|
3312
|
+
/**
|
|
3313
|
+
* The start index of the records on the page (0-indexed)
|
|
3314
|
+
*/
|
|
3315
|
+
startIndex: undefined;
|
|
3316
|
+
/**
|
|
3317
|
+
* The end index of the records on the page (0-indexed)
|
|
3318
|
+
*/
|
|
3319
|
+
endIndex: undefined;
|
|
3320
|
+
}
|
|
3321
|
+
interface ResponsePageContextWithRecords extends Required<RequestPageParams> {
|
|
3322
|
+
/**
|
|
3323
|
+
* Total number of records across all pages
|
|
3324
|
+
* @invariant Guaranteed to be a positive integer (>= 1)
|
|
3325
|
+
*/
|
|
3326
|
+
totalRecords: number;
|
|
3327
|
+
/**
|
|
3328
|
+
* Total number of pages
|
|
3329
|
+
* @invariant Guaranteed to be a positive integer (>= 1)
|
|
3330
|
+
*/
|
|
3331
|
+
totalPages: number;
|
|
3332
|
+
/**
|
|
3333
|
+
* Indicates if there is a next page available
|
|
3334
|
+
* @invariant true if and only if (`page` * `recordsPerPage` < `totalRecords`)
|
|
3335
|
+
*/
|
|
3336
|
+
hasNext: boolean;
|
|
3337
|
+
/**
|
|
3338
|
+
* Indicates if there is a previous page available
|
|
3339
|
+
* @invariant true if and only if (`page` > 1)
|
|
3340
|
+
*/
|
|
3341
|
+
hasPrev: boolean;
|
|
3342
|
+
/**
|
|
3343
|
+
* The start index of the records on the page (0-indexed)
|
|
3344
|
+
*
|
|
3345
|
+
* @invariant Guaranteed to be a non-negative integer (>= 0)
|
|
3346
|
+
*/
|
|
3347
|
+
startIndex: number;
|
|
3348
|
+
/**
|
|
3349
|
+
* The end index of the records on the page (0-indexed)
|
|
3350
|
+
*
|
|
3351
|
+
* @invariant Guaranteed to be a non-negative integer (>= 0)
|
|
3352
|
+
* @invariant Guaranteed to be greater than or equal to `startIndex`.
|
|
3353
|
+
* @invariant Guaranteed to be less than `totalRecords`.
|
|
3354
|
+
*/
|
|
3355
|
+
endIndex: number;
|
|
3356
|
+
}
|
|
3357
|
+
type ResponsePageContext = ResponsePageContextWithNoRecords | ResponsePageContextWithRecords;
|
|
3358
|
+
|
|
3359
|
+
/**
|
|
3360
|
+
* Build page context from request params and total records count.
|
|
3361
|
+
*/
|
|
3362
|
+
declare function buildPageContext(page: number, recordsPerPage: number, totalRecords: number): ResponsePageContext;
|
|
3363
|
+
|
|
3364
|
+
/**
|
|
3365
|
+
* A status code for Registrar Actions API responses.
|
|
3366
|
+
*/
|
|
3367
|
+
declare const RegistrarActionsResponseCodes: {
|
|
3368
|
+
/**
|
|
3369
|
+
* Represents that Registrar Actions are available.
|
|
3370
|
+
*/
|
|
3371
|
+
readonly Ok: "ok";
|
|
3372
|
+
/**
|
|
3373
|
+
* Represents that Registrar Actions are unavailable.
|
|
3374
|
+
*/
|
|
3375
|
+
readonly Error: "error";
|
|
3376
|
+
};
|
|
3377
|
+
/**
|
|
3378
|
+
* The derived string union of possible {@link RegistrarActionsResponseCodes}.
|
|
3379
|
+
*/
|
|
3380
|
+
type RegistrarActionsResponseCode = (typeof RegistrarActionsResponseCodes)[keyof typeof RegistrarActionsResponseCodes];
|
|
3381
|
+
/**
|
|
3382
|
+
* "Logical registrar action" with its associated name.
|
|
3383
|
+
*/
|
|
3384
|
+
interface NamedRegistrarAction {
|
|
3385
|
+
action: RegistrarAction;
|
|
3386
|
+
/**
|
|
3387
|
+
* Name
|
|
3388
|
+
*
|
|
3389
|
+
* FQDN of the name associated with `action`.
|
|
3390
|
+
*
|
|
3391
|
+
* Guarantees:
|
|
3392
|
+
* - `namehash(name)` is always `action.registrationLifecycle.node`.
|
|
3393
|
+
*/
|
|
3394
|
+
name: InterpretedName;
|
|
3395
|
+
}
|
|
3396
|
+
/**
|
|
3397
|
+
* A response when Registrar Actions are available.
|
|
3398
|
+
*/
|
|
3399
|
+
type RegistrarActionsResponseOk = {
|
|
3400
|
+
responseCode: typeof RegistrarActionsResponseCodes.Ok;
|
|
3401
|
+
registrarActions: NamedRegistrarAction[];
|
|
3402
|
+
pageContext: ResponsePageContext;
|
|
3403
|
+
};
|
|
3404
|
+
/**
|
|
3405
|
+
* A response when Registrar Actions are unavailable.
|
|
3406
|
+
*/
|
|
3407
|
+
interface RegistrarActionsResponseError {
|
|
3408
|
+
responseCode: typeof IndexingStatusResponseCodes.Error;
|
|
3409
|
+
error: ErrorResponse;
|
|
3410
|
+
}
|
|
3411
|
+
/**
|
|
3412
|
+
* Registrar Actions response.
|
|
3413
|
+
*
|
|
3414
|
+
* Use the `responseCode` field to determine the specific type interpretation
|
|
3415
|
+
* at runtime.
|
|
3416
|
+
*/
|
|
3417
|
+
type RegistrarActionsResponse = RegistrarActionsResponseOk | RegistrarActionsResponseError;
|
|
3418
|
+
|
|
3419
|
+
/**
|
|
3420
|
+
* Serialized representation of {@link RegistrarActionsResponseError}.
|
|
3421
|
+
*/
|
|
3422
|
+
type SerializedRegistrarActionsResponseError = RegistrarActionsResponseError;
|
|
3423
|
+
/**
|
|
3424
|
+
* Serialized representation of {@link NamedRegistrarAction}.
|
|
3425
|
+
*/
|
|
3426
|
+
interface SerializedNamedRegistrarAction extends Omit<NamedRegistrarAction, "action"> {
|
|
3427
|
+
action: SerializedRegistrarAction;
|
|
3428
|
+
}
|
|
3429
|
+
/**
|
|
3430
|
+
* Serialized representation of {@link RegistrarActionsResponseOk}.
|
|
3431
|
+
*/
|
|
3432
|
+
interface SerializedRegistrarActionsResponseOk extends Omit<RegistrarActionsResponseOk, "registrarActions"> {
|
|
3433
|
+
registrarActions: SerializedNamedRegistrarAction[];
|
|
3434
|
+
}
|
|
3435
|
+
/**
|
|
3436
|
+
* Serialized representation of {@link SerializedRegistrarActionsResponse}.
|
|
3437
|
+
*/
|
|
3438
|
+
type SerializedRegistrarActionsResponse = SerializedRegistrarActionsResponseOk | SerializedRegistrarActionsResponseError;
|
|
3439
|
+
|
|
3440
|
+
/**
|
|
3441
|
+
* Deserialize a {@link RegistrarActionsResponse} object.
|
|
3442
|
+
*/
|
|
3443
|
+
declare function deserializeRegistrarActionsResponse(maybeResponse: SerializedRegistrarActionsResponse): RegistrarActionsResponse;
|
|
3444
|
+
|
|
3445
|
+
/**
|
|
3446
|
+
* Records Filters: Filter Types
|
|
3447
|
+
*/
|
|
3448
|
+
declare const RegistrarActionsFilterTypes: {
|
|
3449
|
+
readonly BySubregistryNode: "bySubregistryNode";
|
|
3450
|
+
readonly WithEncodedReferral: "withEncodedReferral";
|
|
3451
|
+
readonly ByDecodedReferrer: "byDecodedReferrer";
|
|
3452
|
+
readonly BeginTimestamp: "beginTimestamp";
|
|
3453
|
+
readonly EndTimestamp: "endTimestamp";
|
|
3454
|
+
};
|
|
3455
|
+
type RegistrarActionsFilterType = (typeof RegistrarActionsFilterTypes)[keyof typeof RegistrarActionsFilterTypes];
|
|
3456
|
+
type RegistrarActionsFilterBySubregistryNode = {
|
|
3457
|
+
filterType: typeof RegistrarActionsFilterTypes.BySubregistryNode;
|
|
3458
|
+
value: Node;
|
|
3459
|
+
};
|
|
3460
|
+
type RegistrarActionsFilterWithEncodedReferral = {
|
|
3461
|
+
filterType: typeof RegistrarActionsFilterTypes.WithEncodedReferral;
|
|
3462
|
+
};
|
|
3463
|
+
type RegistrarActionsFilterByDecodedReferrer = {
|
|
3464
|
+
filterType: typeof RegistrarActionsFilterTypes.ByDecodedReferrer;
|
|
3465
|
+
value: Address;
|
|
3466
|
+
};
|
|
3467
|
+
type RegistrarActionsFilterBeginTimestamp = {
|
|
3468
|
+
filterType: typeof RegistrarActionsFilterTypes.BeginTimestamp;
|
|
3469
|
+
value: UnixTimestamp;
|
|
3470
|
+
};
|
|
3471
|
+
type RegistrarActionsFilterEndTimestamp = {
|
|
3472
|
+
filterType: typeof RegistrarActionsFilterTypes.EndTimestamp;
|
|
3473
|
+
value: UnixTimestamp;
|
|
3474
|
+
};
|
|
3475
|
+
type RegistrarActionsFilter = RegistrarActionsFilterBySubregistryNode | RegistrarActionsFilterWithEncodedReferral | RegistrarActionsFilterByDecodedReferrer | RegistrarActionsFilterBeginTimestamp | RegistrarActionsFilterEndTimestamp;
|
|
3476
|
+
/**
|
|
3477
|
+
* Records Orders
|
|
3478
|
+
*/
|
|
3479
|
+
declare const RegistrarActionsOrders: {
|
|
3480
|
+
readonly LatestRegistrarActions: "orderBy[timestamp]=desc";
|
|
3481
|
+
};
|
|
3482
|
+
type RegistrarActionsOrder = (typeof RegistrarActionsOrders)[keyof typeof RegistrarActionsOrders];
|
|
3483
|
+
/**
|
|
3484
|
+
* Represents a request to Registrar Actions API.
|
|
3485
|
+
*/
|
|
3486
|
+
interface RegistrarActionsRequest extends RequestPageParams {
|
|
3487
|
+
/**
|
|
3488
|
+
* Filters to be applied while generating results.
|
|
3489
|
+
*/
|
|
3490
|
+
filters?: RegistrarActionsFilter[];
|
|
3491
|
+
/**
|
|
3492
|
+
* Order applied while generating results.
|
|
3493
|
+
*/
|
|
3494
|
+
order?: RegistrarActionsOrder;
|
|
3495
|
+
}
|
|
3496
|
+
|
|
3497
|
+
/**
|
|
3498
|
+
* Build a "parent node" filter object for Registrar Actions query.
|
|
3499
|
+
*/
|
|
3500
|
+
declare function byParentNode(parentNode: Node): RegistrarActionsFilter;
|
|
3501
|
+
declare function byParentNode(parentNode: undefined): undefined;
|
|
3502
|
+
/**
|
|
3503
|
+
* Build a "with referral" filter object for Registrar Actions query.
|
|
3504
|
+
*/
|
|
3505
|
+
declare function withReferral(withReferral: true): RegistrarActionsFilter;
|
|
3506
|
+
declare function withReferral(withReferral: false | undefined): undefined;
|
|
3507
|
+
/**
|
|
3508
|
+
* Build a "decoded referrer" filter object for Registrar Actions query.
|
|
3509
|
+
*/
|
|
3510
|
+
declare function byDecodedReferrer(decodedReferrer: Address): RegistrarActionsFilter;
|
|
3511
|
+
declare function byDecodedReferrer(decodedReferrer: undefined): undefined;
|
|
3512
|
+
/**
|
|
3513
|
+
* Build a "begin timestamp" filter object for Registrar Actions query.
|
|
3514
|
+
*
|
|
3515
|
+
* Filters registrar actions to only include those at or after the specified timestamp (inclusive).
|
|
3516
|
+
*/
|
|
3517
|
+
declare function beginTimestamp(timestamp: UnixTimestamp): RegistrarActionsFilter;
|
|
3518
|
+
declare function beginTimestamp(timestamp: undefined): undefined;
|
|
3519
|
+
/**
|
|
3520
|
+
* Build an "end timestamp" filter object for Registrar Actions query.
|
|
3521
|
+
*
|
|
3522
|
+
* Filters registrar actions to only include those at or before the specified timestamp (inclusive).
|
|
3523
|
+
*/
|
|
3524
|
+
declare function endTimestamp(timestamp: UnixTimestamp): RegistrarActionsFilter;
|
|
3525
|
+
declare function endTimestamp(timestamp: undefined): undefined;
|
|
3526
|
+
declare const registrarActionsFilter: {
|
|
3527
|
+
byParentNode: typeof byParentNode;
|
|
3528
|
+
withReferral: typeof withReferral;
|
|
3529
|
+
byDecodedReferrer: typeof byDecodedReferrer;
|
|
3530
|
+
beginTimestamp: typeof beginTimestamp;
|
|
3531
|
+
endTimestamp: typeof endTimestamp;
|
|
3532
|
+
};
|
|
3533
|
+
|
|
3534
|
+
declare const registrarActionsPrerequisites: Readonly<{
|
|
3535
|
+
/**
|
|
3536
|
+
* Required plugins to enable Registrar Actions API routes.
|
|
3537
|
+
*
|
|
3538
|
+
* 1. `registrars` plugin is required so that data in the `registrarActions`
|
|
3539
|
+
* table is populated.
|
|
3540
|
+
* 2. `subgraph`, `basenames`, and `lineanames` are required to get the data
|
|
3541
|
+
* for the name associated with each registrar action.
|
|
3542
|
+
* 3. In theory not all of `subgraph`, `basenames`, and `lineanames` plugins
|
|
3543
|
+
* might be required. Ex: At least one, but the current logic in
|
|
3544
|
+
* the `registrars` plugin always indexes registrar actions across
|
|
3545
|
+
* Ethnames (subgraph), Basenames, and Lineanames and therefore we need to
|
|
3546
|
+
* ensure each value in the registrar actions table has
|
|
3547
|
+
* an associated record in the domains table.
|
|
3548
|
+
*/
|
|
3549
|
+
requiredPlugins: readonly [PluginName.Subgraph, PluginName.Basenames, PluginName.Lineanames, PluginName.Registrars];
|
|
3550
|
+
/**
|
|
3551
|
+
* Check if provided ENSApiPublicConfig supports the Registrar Actions API.
|
|
3552
|
+
*/
|
|
3553
|
+
hasEnsIndexerConfigSupport(config: ENSIndexerPublicConfig): boolean;
|
|
3554
|
+
/**
|
|
3555
|
+
* Required Indexing Status IDs
|
|
3556
|
+
*
|
|
3557
|
+
* Database indexes are created by the time the omnichain indexing status
|
|
3558
|
+
* is either `completed` or `following`.
|
|
3559
|
+
*/
|
|
3560
|
+
supportedIndexingStatusIds: ("omnichain-following" | "omnichain-completed")[];
|
|
3561
|
+
/**
|
|
3562
|
+
* Check if provided indexing status supports the Registrar Actions API.
|
|
3563
|
+
*/
|
|
3564
|
+
hasIndexingStatusSupport(omnichainIndexingStatusId: OmnichainIndexingStatusId): boolean;
|
|
3565
|
+
}>;
|
|
3566
|
+
|
|
3567
|
+
declare function serializeNamedRegistrarAction({ action, name, }: NamedRegistrarAction): SerializedNamedRegistrarAction;
|
|
3568
|
+
declare function serializeRegistrarActionsResponse(response: RegistrarActionsResponse): SerializedRegistrarActionsResponse;
|
|
3569
|
+
|
|
3570
|
+
/**
|
|
3571
|
+
* The resolution status for an `Identity`.
|
|
3572
|
+
*/
|
|
3573
|
+
declare const ResolutionStatusIds: {
|
|
3574
|
+
/**
|
|
3575
|
+
* Represents that the `Identity` is not resolved yet.
|
|
3576
|
+
*/
|
|
3577
|
+
readonly Unresolved: "unresolved";
|
|
3578
|
+
/**
|
|
3579
|
+
* Represents that resolution of the `Identity` resulted in a named identity.
|
|
3580
|
+
*/
|
|
3581
|
+
readonly Named: "named";
|
|
3582
|
+
/**
|
|
3583
|
+
* Represents that resolution of the `Identity` resulted in an unnamed identity.
|
|
3584
|
+
*/
|
|
3585
|
+
readonly Unnamed: "unnamed";
|
|
3586
|
+
/**
|
|
3587
|
+
* Represents that attempted resolution of the `Identity` resulted in an error
|
|
3588
|
+
* and therefore it is unknown if the `Identity` resolves to a named or unnamed identity.
|
|
3589
|
+
*/
|
|
3590
|
+
readonly Unknown: "unknown";
|
|
3591
|
+
};
|
|
3592
|
+
/**
|
|
3593
|
+
* The derived string union of possible {@link ResolutionStatusIds}.
|
|
3594
|
+
*/
|
|
3595
|
+
type ResolutionStatusId = (typeof ResolutionStatusIds)[keyof typeof ResolutionStatusIds];
|
|
3596
|
+
/**
|
|
3597
|
+
* Represents an {@link Identity} that has not become a {@link ResolvedIdentity} yet.
|
|
3598
|
+
*
|
|
3599
|
+
* Invariants:
|
|
3600
|
+
* - `resolutionStatus` is always {@link ResolutionStatusIds.Unresolved}.
|
|
3601
|
+
*/
|
|
3602
|
+
interface UnresolvedIdentity {
|
|
3603
|
+
resolutionStatus: typeof ResolutionStatusIds.Unresolved;
|
|
3604
|
+
/**
|
|
3605
|
+
* The {@link DefaultableChainId} for an ENSIP-19 primary name lookup of the
|
|
3606
|
+
* identity associated with `address`.
|
|
3607
|
+
*/
|
|
3608
|
+
chainId: DefaultableChainId;
|
|
3609
|
+
/**
|
|
3610
|
+
* The {@link Address} of the identity.
|
|
3611
|
+
*/
|
|
3612
|
+
address: Address;
|
|
3613
|
+
}
|
|
3614
|
+
/**
|
|
3615
|
+
* Represents an `Identity` that resolved to a primary name.
|
|
3616
|
+
*
|
|
3617
|
+
* Invariants:
|
|
3618
|
+
* - `resolutionStatus` is always {@link ResolutionStatusIds.Named}.
|
|
3619
|
+
*/
|
|
3620
|
+
interface NamedIdentity {
|
|
3621
|
+
resolutionStatus: typeof ResolutionStatusIds.Named;
|
|
3622
|
+
/**
|
|
3623
|
+
* The {@link DefaultableChainId} for an ENSIP-19 primary name lookup of the
|
|
3624
|
+
* identity associated with `address`.
|
|
3625
|
+
*/
|
|
3626
|
+
chainId: DefaultableChainId;
|
|
3627
|
+
/**
|
|
3628
|
+
* The address of the identity.
|
|
3629
|
+
*/
|
|
3630
|
+
address: Address;
|
|
3631
|
+
/**
|
|
3632
|
+
* The ENSIP-19 primary name lookup result of `address` on `chainId`.
|
|
3633
|
+
*/
|
|
3634
|
+
name: Name;
|
|
3635
|
+
}
|
|
3636
|
+
/**
|
|
3637
|
+
* Represents an `Identity` that did not resolve to a primary name.
|
|
3638
|
+
*
|
|
3639
|
+
* Invariants:
|
|
3640
|
+
* - `resolutionStatus` is always {@link ResolutionStatusIds.Unnamed}.
|
|
3641
|
+
* - `name` is always `null`.
|
|
3642
|
+
*/
|
|
3643
|
+
interface UnnamedIdentity {
|
|
3644
|
+
resolutionStatus: typeof ResolutionStatusIds.Unnamed;
|
|
3645
|
+
/**
|
|
3646
|
+
* The {@link DefaultableChainId} for an ENSIP-19 primary name lookup of the
|
|
3647
|
+
* identity associated with `address`.
|
|
3648
|
+
*/
|
|
3649
|
+
chainId: DefaultableChainId;
|
|
3650
|
+
/**
|
|
3651
|
+
* The address of the identity.
|
|
3652
|
+
*/
|
|
3653
|
+
address: Address;
|
|
3654
|
+
/**
|
|
3655
|
+
* The ENSIP-19 primary name lookup result of `address` on `chainId`.
|
|
3656
|
+
*/
|
|
3657
|
+
name: null;
|
|
3658
|
+
}
|
|
3659
|
+
/**
|
|
3660
|
+
* Represents an `Identity` that was attempted to be resolved but the resolution attempt
|
|
3661
|
+
* resulted in an error and therefore it is unknown if the `Identity` resolves to a named
|
|
3662
|
+
* or unnamed identity.
|
|
3663
|
+
*
|
|
3664
|
+
* Invariants:
|
|
3665
|
+
* - `resolutionStatus` is always {@link ResolutionStatusIds.Unknown}.
|
|
3666
|
+
*/
|
|
3667
|
+
interface UnknownIdentity {
|
|
3668
|
+
resolutionStatus: typeof ResolutionStatusIds.Unknown;
|
|
3669
|
+
/**
|
|
3670
|
+
* The {@link DefaultableChainId} for an ENSIP-19 primary name lookup of the
|
|
3671
|
+
* identity associated with `address`.
|
|
3672
|
+
*/
|
|
3673
|
+
chainId: DefaultableChainId;
|
|
3674
|
+
/**
|
|
3675
|
+
* The address of the identity.
|
|
3676
|
+
*/
|
|
3677
|
+
address: Address;
|
|
3678
|
+
}
|
|
3679
|
+
/**
|
|
3680
|
+
* Represents an ENSIP-19 identity resolution result.
|
|
3681
|
+
*
|
|
3682
|
+
* Use the `resolutionStatus` field to determine the specific type interpretation
|
|
3683
|
+
* at runtime.
|
|
3684
|
+
*/
|
|
3685
|
+
type ResolvedIdentity = NamedIdentity | UnnamedIdentity | UnknownIdentity;
|
|
3686
|
+
/**
|
|
3687
|
+
* Represents an ENSIP-19 identity resolution (which may or not have been
|
|
3688
|
+
* resolved to a result yet).
|
|
3689
|
+
*
|
|
3690
|
+
* Use the `resolutionStatus` field to determine the specific type interpretation
|
|
3691
|
+
* at runtime.
|
|
3692
|
+
*/
|
|
3693
|
+
type Identity = UnresolvedIdentity | ResolvedIdentity;
|
|
3694
|
+
|
|
3695
|
+
/**
|
|
3696
|
+
* Builds an {@link UnresolvedIdentity} for the provided {@link Address},
|
|
3697
|
+
* {@link DefaultableChainId} and {@link ENSNamespaceId}.
|
|
3698
|
+
*
|
|
3699
|
+
* If no `chainId` is provided, uses the ENS Root Chain Id for the provided
|
|
3700
|
+
* `namespaceId`.
|
|
3701
|
+
*/
|
|
3702
|
+
declare function buildUnresolvedIdentity(address: Address, namespaceId: ENSNamespaceId, chainId?: DefaultableChainId): UnresolvedIdentity;
|
|
3703
|
+
/**
|
|
3704
|
+
* Returns whether the provided {@link Identity} is a {@link ResolvedIdentity}.
|
|
3705
|
+
*
|
|
3706
|
+
* @param identity - The {@link Identity} to check.
|
|
3707
|
+
* @returns Whether the provided {@link Identity} is a {@link ResolvedIdentity}.
|
|
3708
|
+
*/
|
|
3709
|
+
declare function isResolvedIdentity(identity: Identity): identity is ResolvedIdentity;
|
|
3710
|
+
|
|
3711
|
+
/**
|
|
3712
|
+
* Gets the "chainId param" that should be used for a primary name resolution
|
|
3713
|
+
* request.
|
|
3714
|
+
*
|
|
3715
|
+
* ENSIP-19 defines special rules for the "chainId param" used
|
|
3716
|
+
* in primary name resolutions for the case that the `chainId` is the
|
|
3717
|
+
* ENS Root Chain Id for the provided `namespaceId`.
|
|
3718
|
+
*
|
|
3719
|
+
* Whenever this case happens, ENSIP-19 requires that the
|
|
3720
|
+
* "chainId param" is always set to chainId: 1 (mainnet), even if the
|
|
3721
|
+
* `chainId` where the primary name lookup is actually happening
|
|
3722
|
+
* on a non-mainnet ENS Root Chain, such as on a testnet or
|
|
3723
|
+
* the ens-test-env.
|
|
3724
|
+
*
|
|
3725
|
+
* @param namespaceId The namespace id for the primary name lookup.
|
|
3726
|
+
* @param chainId The chain id where the primary name lookup will actually happen.
|
|
3727
|
+
* @returns The "chainId param" that should be used for the primary name lookup.
|
|
3728
|
+
*/
|
|
3729
|
+
declare const getResolvePrimaryNameChainIdParam: (chainId: DefaultableChainId, namespaceId: ENSNamespaceId) => DefaultableChainId;
|
|
3730
|
+
/**
|
|
3731
|
+
* Translates a `DefaultableChainId` a `ChainId`
|
|
3732
|
+
* such that if the provided `chainId` is `DEFAULT_EVM_CHAIN_ID`,
|
|
3733
|
+
* the `ChainId` of the ENS Root Chain for the provided `namespaceId` is returned.
|
|
3734
|
+
*
|
|
3735
|
+
* @param chainId The `DefaultableChainId` to translate.
|
|
3736
|
+
* @param namespaceId The namespace id for the translation.
|
|
3737
|
+
* @returns the translated `ChainId`.
|
|
3738
|
+
*/
|
|
3739
|
+
declare const translateDefaultableChainIdToChainId: (chainId: DefaultableChainId, namespaceId: ENSNamespaceId) => ChainId;
|
|
3740
|
+
|
|
3741
|
+
/**
|
|
3742
|
+
* Encodes a selection of Resolver records in the context of a specific Name.
|
|
3743
|
+
*/
|
|
3744
|
+
interface ResolverRecordsSelection {
|
|
3745
|
+
/**
|
|
3746
|
+
* Whether to fetch the name's `name` record. This value is primarily used in the context of
|
|
3747
|
+
* Reverse Resolution.
|
|
3748
|
+
*
|
|
3749
|
+
* @see https://docs.ens.domains/ensip/19/#reverse-resolution
|
|
3750
|
+
*/
|
|
3751
|
+
name?: boolean;
|
|
3752
|
+
/**
|
|
3753
|
+
* Which coinTypes to fetch address records for.
|
|
3754
|
+
*/
|
|
3755
|
+
addresses?: CoinType[];
|
|
3756
|
+
/**
|
|
3757
|
+
* Which keys to fetch text records for.
|
|
3758
|
+
*/
|
|
3759
|
+
texts?: string[];
|
|
3760
|
+
}
|
|
3761
|
+
declare const isSelectionEmpty: (selection: ResolverRecordsSelection) => boolean;
|
|
3762
|
+
|
|
3763
|
+
/**
|
|
3764
|
+
* An internal type representing a non-inferred ResolverRecordsResponse, used in situations where
|
|
3765
|
+
* access to the more specific inferred type (ResolverRecordsResponse<SELECTION>) is difficult or
|
|
3766
|
+
* unnecessary.
|
|
3767
|
+
*/
|
|
3768
|
+
type ResolverRecordsResponseBase = {
|
|
3769
|
+
/**
|
|
3770
|
+
* The name record, relevant in the context of Reverse Resolution.
|
|
3771
|
+
* Null if no name record is set.
|
|
3772
|
+
*/
|
|
3773
|
+
name: Name | null;
|
|
3774
|
+
/**
|
|
3775
|
+
* Address records, keyed by CoinType.
|
|
3776
|
+
* Value is null if no record for the specified CoinType is set.
|
|
3777
|
+
*
|
|
3778
|
+
* NOTE: ENS resolver address records can store arbitrary string values,
|
|
3779
|
+
* including non-EVM addresses — always validate the record value against
|
|
3780
|
+
* the format your application expects.
|
|
3781
|
+
*/
|
|
3782
|
+
addresses: Record<CoinType, string | null>;
|
|
3783
|
+
/**
|
|
3784
|
+
* Text records, keyed by key.
|
|
3785
|
+
* Value is null if no record for the specified key is set.
|
|
3786
|
+
*/
|
|
3787
|
+
texts: Record<string, string | null>;
|
|
3788
|
+
};
|
|
3789
|
+
/**
|
|
3790
|
+
* Represents the strongly-typed set of records based on the provided SELECTION
|
|
3791
|
+
*
|
|
3792
|
+
* @example
|
|
3793
|
+
* ```typescript
|
|
3794
|
+
* const selection = {
|
|
3795
|
+
* name: true,
|
|
3796
|
+
* addresses: [60],
|
|
3797
|
+
* texts: ["com.twitter", "avatar"],
|
|
3798
|
+
* } as const satisfies ResolverRecordsSelection;
|
|
3799
|
+
*
|
|
3800
|
+
* type Response = ResolverRecordsResponse<typeof selection>;
|
|
3801
|
+
*
|
|
3802
|
+
* // results in the following type
|
|
3803
|
+
* type Response = {
|
|
3804
|
+
* readonly name: Name | null;
|
|
3805
|
+
* readonly addresses: Record<"60", string | null>;
|
|
3806
|
+
* readonly texts: Record<"avatar" | "com.twitter", string | null>;
|
|
3807
|
+
* }
|
|
3808
|
+
* ```
|
|
3809
|
+
*/
|
|
3810
|
+
type ResolverRecordsResponse<T extends ResolverRecordsSelection = ResolverRecordsSelection> = {
|
|
3811
|
+
[K in keyof T as T[K] extends true | any[] ? K : never]: K extends "addresses" ? Record<`${T["addresses"] extends readonly CoinType[] ? T["addresses"][number] : never}`, string | null> : K extends "texts" ? Record<T["texts"] extends readonly string[] ? T["texts"][number] : never, string | null> : ResolverRecordsResponseBase[K & keyof ResolverRecordsResponseBase];
|
|
3812
|
+
};
|
|
3813
|
+
|
|
3814
|
+
/**
|
|
3815
|
+
* Arguments required to perform Forward Resolution
|
|
3816
|
+
*/
|
|
3817
|
+
interface ForwardResolutionArgs<SELECTION extends ResolverRecordsSelection> {
|
|
3818
|
+
name: Name;
|
|
3819
|
+
selection: SELECTION;
|
|
3820
|
+
}
|
|
3821
|
+
/**
|
|
3822
|
+
* The result of performing ForwardResolution
|
|
3823
|
+
*/
|
|
3824
|
+
type ForwardResolutionResult<SELECTION extends ResolverRecordsSelection> = ResolverRecordsResponse<SELECTION>;
|
|
3825
|
+
/**
|
|
3826
|
+
* Arguments required to perform Reverse Resolution
|
|
3827
|
+
*/
|
|
3828
|
+
interface ReverseResolutionArgs {
|
|
3829
|
+
address: Address;
|
|
3830
|
+
chainId: ChainId;
|
|
3831
|
+
}
|
|
3832
|
+
/**
|
|
3833
|
+
* The result of performing ReverseResolution
|
|
3834
|
+
*/
|
|
3835
|
+
type ReverseResolutionResult = Name | null;
|
|
3836
|
+
/**
|
|
3837
|
+
* Arguments required to perform Multichain Primary Name Resolution
|
|
3838
|
+
*/
|
|
3839
|
+
interface MultichainPrimaryNameResolutionArgs {
|
|
3840
|
+
address: Address;
|
|
3841
|
+
chainIds?: ChainId[];
|
|
3842
|
+
}
|
|
3843
|
+
/**
|
|
3844
|
+
* The result of performing MultichainPrimaryNameResolution
|
|
3845
|
+
*/
|
|
3846
|
+
type MultichainPrimaryNameResolutionResult = Record<ChainId, Name | null>;
|
|
3847
|
+
|
|
3848
|
+
declare const PROTOCOL_ATTRIBUTE_PREFIX = "ens";
|
|
3849
|
+
declare const ATTR_PROTOCOL_NAME = "ens.protocol";
|
|
3850
|
+
declare const ATTR_PROTOCOL_STEP = "ens.protocol.step";
|
|
3851
|
+
declare const ATTR_PROTOCOL_STEP_RESULT = "ens.protocol.step.result";
|
|
3852
|
+
/**
|
|
3853
|
+
* Identifiers for each traceable ENS protocol.
|
|
3854
|
+
*/
|
|
3855
|
+
declare enum TraceableENSProtocol {
|
|
3856
|
+
ForwardResolution = "forward-resolution",
|
|
3857
|
+
ReverseResolution = "reverse-resolution"
|
|
3858
|
+
}
|
|
3859
|
+
/**
|
|
3860
|
+
* Encodes the set of well-known steps in the ENS Forward Resolution protocol.
|
|
3861
|
+
*/
|
|
3862
|
+
declare enum ForwardResolutionProtocolStep {
|
|
3863
|
+
Operation = "forward-resolution",
|
|
3864
|
+
FindResolver = "find-resolver",
|
|
3865
|
+
ActiveResolverExists = "active-resolver-exists",
|
|
3866
|
+
AccelerateENSIP19ReverseResolver = "accelerate-ensip-19-reverse-resolver",
|
|
3867
|
+
AccelerateKnownOffchainLookupResolver = "accelerate-known-offchain-lookup-resolver",
|
|
3868
|
+
AccelerateKnownOnchainStaticResolver = "accelerate-known-onchain-static-resolver",
|
|
3869
|
+
RequireResolver = "require-resolver",
|
|
3870
|
+
ExecuteResolveCalls = "execute-resolve-calls"
|
|
3871
|
+
}
|
|
3872
|
+
/**
|
|
3873
|
+
* Encodes the set of well-known steps in the ENS Reverse Resolution protocol.
|
|
3874
|
+
*/
|
|
3875
|
+
declare enum ReverseResolutionProtocolStep {
|
|
3876
|
+
Operation = "reverse-resolution",
|
|
3877
|
+
ResolveReverseName = "resolve-reverse-name",
|
|
3878
|
+
NameRecordExists = "name-record-exists-check",
|
|
3879
|
+
ForwardResolveAddressRecord = "forward-resolve-address-record",
|
|
3880
|
+
VerifyResolvedAddressMatchesAddress = "verify-resolved-address-matches-address"
|
|
3881
|
+
}
|
|
3882
|
+
|
|
3883
|
+
interface TracingSpanAttributes {
|
|
3884
|
+
[key: string]: unknown;
|
|
3885
|
+
}
|
|
3886
|
+
interface TracingSpanEvent {
|
|
3887
|
+
name: string;
|
|
3888
|
+
attributes: TracingSpanAttributes;
|
|
3889
|
+
time: number;
|
|
3890
|
+
}
|
|
3891
|
+
interface TracingSpan {
|
|
3892
|
+
scope: string;
|
|
3893
|
+
id: string;
|
|
3894
|
+
traceId: string;
|
|
3895
|
+
parentSpanContext: {
|
|
3896
|
+
traceId: string;
|
|
3897
|
+
spanId: string;
|
|
3898
|
+
} | undefined;
|
|
3899
|
+
name: string;
|
|
3900
|
+
timestamp: number;
|
|
3901
|
+
duration: number;
|
|
3902
|
+
attributes: TracingSpanAttributes;
|
|
3903
|
+
status: {
|
|
3904
|
+
code: number;
|
|
3905
|
+
message?: string;
|
|
3906
|
+
};
|
|
3907
|
+
events: TracingSpanEvent[];
|
|
3908
|
+
}
|
|
3909
|
+
type TracingNode = TracingSpan & {
|
|
3910
|
+
children: TracingNode[];
|
|
3911
|
+
};
|
|
3912
|
+
type TracingTrace = TracingNode[];
|
|
3913
|
+
|
|
3914
|
+
interface TraceableRequest {
|
|
3915
|
+
trace?: boolean;
|
|
3916
|
+
}
|
|
3917
|
+
interface TraceableResponse {
|
|
3918
|
+
trace?: TracingTrace;
|
|
3919
|
+
}
|
|
3920
|
+
interface AcceleratableRequest {
|
|
3921
|
+
accelerate?: boolean;
|
|
3922
|
+
}
|
|
3923
|
+
interface AcceleratableResponse {
|
|
3924
|
+
accelerationRequested: boolean;
|
|
3925
|
+
accelerationAttempted: boolean;
|
|
3926
|
+
}
|
|
3927
|
+
/**
|
|
3928
|
+
* Resolve Records Request Type
|
|
3929
|
+
*/
|
|
3930
|
+
interface ResolveRecordsRequest<SELECTION extends ResolverRecordsSelection> extends ForwardResolutionArgs<SELECTION>, AcceleratableRequest, TraceableRequest {
|
|
3931
|
+
}
|
|
3932
|
+
/**
|
|
3933
|
+
* Resolve Records Response Type
|
|
3934
|
+
*/
|
|
3935
|
+
interface ResolveRecordsResponse<SELECTION extends ResolverRecordsSelection> extends AcceleratableResponse, TraceableResponse {
|
|
3936
|
+
records: ResolverRecordsResponse<SELECTION>;
|
|
3937
|
+
}
|
|
3938
|
+
/**
|
|
3939
|
+
* Resolve Primary Name Request Type
|
|
3940
|
+
*/
|
|
3941
|
+
interface ResolvePrimaryNameRequest extends ReverseResolutionArgs, AcceleratableRequest, TraceableRequest {
|
|
3942
|
+
}
|
|
3943
|
+
/**
|
|
3944
|
+
* Resolve Primary Name Response Type
|
|
3945
|
+
*/
|
|
3946
|
+
interface ResolvePrimaryNameResponse extends AcceleratableResponse, TraceableResponse {
|
|
3947
|
+
name: ReverseResolutionResult;
|
|
3948
|
+
}
|
|
3949
|
+
interface ResolvePrimaryNamesRequest extends MultichainPrimaryNameResolutionArgs, AcceleratableRequest, TraceableRequest {
|
|
3950
|
+
}
|
|
3951
|
+
interface ResolvePrimaryNamesResponse extends AcceleratableResponse, TraceableResponse {
|
|
3952
|
+
names: MultichainPrimaryNameResolutionResult;
|
|
3953
|
+
}
|
|
3954
|
+
|
|
3955
|
+
/**
|
|
3956
|
+
* Request parameters for a referrer leaderboard page query.
|
|
3957
|
+
*/
|
|
3958
|
+
interface ReferrerLeaderboardPageRequest extends ReferrerLeaderboardPageParams {
|
|
3959
|
+
}
|
|
3960
|
+
/**
|
|
3961
|
+
* A status code for a referrer leaderboard page API response.
|
|
3962
|
+
*/
|
|
3963
|
+
declare const ReferrerLeaderboardPageResponseCodes: {
|
|
3964
|
+
/**
|
|
3965
|
+
* Represents that the requested referrer leaderboard page is available.
|
|
3966
|
+
*/
|
|
3967
|
+
readonly Ok: "ok";
|
|
3968
|
+
/**
|
|
3969
|
+
* Represents that the referrer leaderboard data is not available.
|
|
3970
|
+
*/
|
|
3971
|
+
readonly Error: "error";
|
|
3972
|
+
};
|
|
3973
|
+
/**
|
|
3974
|
+
* The derived string union of possible {@link ReferrerLeaderboardPageResponseCodes}.
|
|
3975
|
+
*/
|
|
3976
|
+
type ReferrerLeaderboardPageResponseCode = (typeof ReferrerLeaderboardPageResponseCodes)[keyof typeof ReferrerLeaderboardPageResponseCodes];
|
|
3977
|
+
/**
|
|
3978
|
+
* A referrer leaderboard page response when the data is available.
|
|
3979
|
+
*/
|
|
3980
|
+
type ReferrerLeaderboardPageResponseOk = {
|
|
3981
|
+
responseCode: typeof ReferrerLeaderboardPageResponseCodes.Ok;
|
|
3982
|
+
data: ReferrerLeaderboardPage;
|
|
3983
|
+
};
|
|
3984
|
+
/**
|
|
3985
|
+
* A referrer leaderboard page response when the data is not available.
|
|
3986
|
+
*/
|
|
3987
|
+
type ReferrerLeaderboardPageResponseError = {
|
|
3988
|
+
responseCode: typeof ReferrerLeaderboardPageResponseCodes.Error;
|
|
3989
|
+
error: string;
|
|
3990
|
+
errorMessage: string;
|
|
3991
|
+
};
|
|
3992
|
+
/**
|
|
3993
|
+
* A referrer leaderboard page API response.
|
|
3994
|
+
*
|
|
3995
|
+
* Use the `responseCode` field to determine the specific type interpretation
|
|
3996
|
+
* at runtime.
|
|
3997
|
+
*/
|
|
3998
|
+
type ReferrerLeaderboardPageResponse = ReferrerLeaderboardPageResponseOk | ReferrerLeaderboardPageResponseError;
|
|
3999
|
+
/**
|
|
4000
|
+
* Request parameters for referrer detail query.
|
|
4001
|
+
*/
|
|
4002
|
+
interface ReferrerDetailRequest {
|
|
4003
|
+
/** The Ethereum address of the referrer to query */
|
|
4004
|
+
referrer: Address;
|
|
4005
|
+
}
|
|
4006
|
+
/**
|
|
4007
|
+
* A status code for referrer detail API responses.
|
|
4008
|
+
*/
|
|
4009
|
+
declare const ReferrerDetailResponseCodes: {
|
|
4010
|
+
/**
|
|
4011
|
+
* Represents that the referrer detail data is available.
|
|
4012
|
+
*/
|
|
4013
|
+
readonly Ok: "ok";
|
|
4014
|
+
/**
|
|
4015
|
+
* Represents that an error occurred while fetching the data.
|
|
4016
|
+
*/
|
|
4017
|
+
readonly Error: "error";
|
|
4018
|
+
};
|
|
4019
|
+
/**
|
|
4020
|
+
* The derived string union of possible {@link ReferrerDetailResponseCodes}.
|
|
4021
|
+
*/
|
|
4022
|
+
type ReferrerDetailResponseCode = (typeof ReferrerDetailResponseCodes)[keyof typeof ReferrerDetailResponseCodes];
|
|
4023
|
+
/**
|
|
4024
|
+
* A referrer detail response when the data is available for a referrer on the leaderboard.
|
|
4025
|
+
*/
|
|
4026
|
+
type ReferrerDetailResponseOk = {
|
|
4027
|
+
responseCode: typeof ReferrerDetailResponseCodes.Ok;
|
|
4028
|
+
data: ReferrerDetail;
|
|
4029
|
+
};
|
|
4030
|
+
/**
|
|
4031
|
+
* A referrer detail response when an error occurs.
|
|
4032
|
+
*/
|
|
4033
|
+
type ReferrerDetailResponseError = {
|
|
4034
|
+
responseCode: typeof ReferrerDetailResponseCodes.Error;
|
|
4035
|
+
error: string;
|
|
4036
|
+
errorMessage: string;
|
|
4037
|
+
};
|
|
4038
|
+
/**
|
|
4039
|
+
* A referrer detail API response.
|
|
4040
|
+
*
|
|
4041
|
+
* Use the `responseCode` field to determine the specific type interpretation
|
|
4042
|
+
* at runtime.
|
|
4043
|
+
*/
|
|
4044
|
+
type ReferrerDetailResponse = ReferrerDetailResponseOk | ReferrerDetailResponseError;
|
|
4045
|
+
|
|
4046
|
+
/**
|
|
4047
|
+
* Serialized representation of {@link RevenueContribution}.
|
|
4048
|
+
*
|
|
4049
|
+
* RevenueContribution is a bigint, which is serialized as a string for JSON compatibility.
|
|
4050
|
+
*/
|
|
4051
|
+
type SerializedRevenueContribution = string;
|
|
4052
|
+
/**
|
|
4053
|
+
* Serialized representation of {@link ReferralProgramRules}.
|
|
4054
|
+
*
|
|
4055
|
+
* Note: All fields are already serializable primitives, so this type is identical to the source type.
|
|
4056
|
+
*/
|
|
4057
|
+
type SerializedReferralProgramRules = ReferralProgramRules;
|
|
4058
|
+
/**
|
|
4059
|
+
* Serialized representation of {@link AwardedReferrerMetrics}.
|
|
4060
|
+
*/
|
|
4061
|
+
interface SerializedAwardedReferrerMetrics extends Omit<AwardedReferrerMetrics, "totalRevenueContribution"> {
|
|
4062
|
+
totalRevenueContribution: SerializedRevenueContribution;
|
|
4063
|
+
}
|
|
4064
|
+
/**
|
|
4065
|
+
* Serialized representation of {@link UnrankedReferrerMetrics}.
|
|
4066
|
+
*/
|
|
4067
|
+
interface SerializedUnrankedReferrerMetrics extends Omit<UnrankedReferrerMetrics, "totalRevenueContribution"> {
|
|
4068
|
+
totalRevenueContribution: SerializedRevenueContribution;
|
|
4069
|
+
}
|
|
4070
|
+
/**
|
|
4071
|
+
* Serialized representation of {@link AggregatedReferrerMetrics}.
|
|
4072
|
+
*/
|
|
4073
|
+
interface SerializedAggregatedReferrerMetrics extends Omit<AggregatedReferrerMetrics, "grandTotalRevenueContribution"> {
|
|
4074
|
+
grandTotalRevenueContribution: SerializedRevenueContribution;
|
|
4075
|
+
}
|
|
4076
|
+
/**
|
|
4077
|
+
* Serialized representation of {@link ReferrerLeaderboardPage}.
|
|
4078
|
+
*/
|
|
4079
|
+
interface SerializedReferrerLeaderboardPage extends Omit<ReferrerLeaderboardPage, "referrers" | "aggregatedMetrics"> {
|
|
4080
|
+
referrers: SerializedAwardedReferrerMetrics[];
|
|
4081
|
+
aggregatedMetrics: SerializedAggregatedReferrerMetrics;
|
|
4082
|
+
}
|
|
4083
|
+
/**
|
|
4084
|
+
* Serialized representation of {@link ReferrerDetailRanked}.
|
|
4085
|
+
*/
|
|
4086
|
+
interface SerializedReferrerDetailRanked extends Omit<ReferrerDetailRanked, "referrer" | "aggregatedMetrics"> {
|
|
4087
|
+
referrer: SerializedAwardedReferrerMetrics;
|
|
4088
|
+
aggregatedMetrics: SerializedAggregatedReferrerMetrics;
|
|
4089
|
+
}
|
|
4090
|
+
/**
|
|
4091
|
+
* Serialized representation of {@link ReferrerDetailUnranked}.
|
|
4092
|
+
*/
|
|
4093
|
+
interface SerializedReferrerDetailUnranked extends Omit<ReferrerDetailUnranked, "referrer" | "aggregatedMetrics"> {
|
|
4094
|
+
referrer: SerializedUnrankedReferrerMetrics;
|
|
4095
|
+
aggregatedMetrics: SerializedAggregatedReferrerMetrics;
|
|
4096
|
+
}
|
|
4097
|
+
/**
|
|
4098
|
+
* Serialized representation of {@link ReferrerDetail} (union of ranked and unranked).
|
|
4099
|
+
*/
|
|
4100
|
+
type SerializedReferrerDetail = SerializedReferrerDetailRanked | SerializedReferrerDetailUnranked;
|
|
4101
|
+
/**
|
|
4102
|
+
* Serialized representation of {@link ReferrerLeaderboardPageResponseError}.
|
|
4103
|
+
*
|
|
4104
|
+
* Note: All fields are already serializable, so this type is identical to the source type.
|
|
4105
|
+
*/
|
|
4106
|
+
type SerializedReferrerLeaderboardPageResponseError = ReferrerLeaderboardPageResponseError;
|
|
4107
|
+
/**
|
|
4108
|
+
* Serialized representation of {@link ReferrerLeaderboardPageResponseOk}.
|
|
4109
|
+
*/
|
|
4110
|
+
interface SerializedReferrerLeaderboardPageResponseOk extends Omit<ReferrerLeaderboardPageResponseOk, "data"> {
|
|
4111
|
+
data: SerializedReferrerLeaderboardPage;
|
|
4112
|
+
}
|
|
4113
|
+
/**
|
|
4114
|
+
* Serialized representation of {@link ReferrerLeaderboardPageResponse}.
|
|
4115
|
+
*/
|
|
4116
|
+
type SerializedReferrerLeaderboardPageResponse = SerializedReferrerLeaderboardPageResponseOk | SerializedReferrerLeaderboardPageResponseError;
|
|
4117
|
+
/**
|
|
4118
|
+
* Serialized representation of {@link ReferrerDetailResponseError}.
|
|
4119
|
+
*
|
|
4120
|
+
* Note: All fields are already serializable, so this type is identical to the source type.
|
|
4121
|
+
*/
|
|
4122
|
+
type SerializedReferrerDetailResponseError = ReferrerDetailResponseError;
|
|
4123
|
+
/**
|
|
4124
|
+
* Serialized representation of {@link ReferrerDetailResponseOk}.
|
|
4125
|
+
*/
|
|
4126
|
+
interface SerializedReferrerDetailResponseOk extends Omit<ReferrerDetailResponseOk, "data"> {
|
|
4127
|
+
data: SerializedReferrerDetail;
|
|
4128
|
+
}
|
|
4129
|
+
/**
|
|
4130
|
+
* Serialized representation of {@link ReferrerDetailResponse}.
|
|
4131
|
+
*/
|
|
4132
|
+
type SerializedReferrerDetailResponse = SerializedReferrerDetailResponseOk | SerializedReferrerDetailResponseError;
|
|
4133
|
+
|
|
4134
|
+
/**
|
|
4135
|
+
* Deserialize a {@link ReferrerLeaderboardPageResponse} object.
|
|
4136
|
+
*
|
|
4137
|
+
* Note: This function explicitly deserializes each subobject to convert string
|
|
4138
|
+
* RevenueContribution values back to bigint, then validates using Zod schemas
|
|
4139
|
+
* to enforce invariants on the data.
|
|
4140
|
+
*/
|
|
4141
|
+
declare function deserializeReferrerLeaderboardPageResponse(maybeResponse: SerializedReferrerLeaderboardPageResponse, valueLabel?: string): ReferrerLeaderboardPageResponse;
|
|
4142
|
+
/**
|
|
4143
|
+
* Deserialize a {@link ReferrerDetailResponse} object.
|
|
4144
|
+
*
|
|
4145
|
+
* Note: This function explicitly deserializes each subobject to convert string
|
|
4146
|
+
* RevenueContribution values back to bigint, then validates using Zod schemas
|
|
4147
|
+
* to enforce invariants on the data.
|
|
4148
|
+
*/
|
|
4149
|
+
declare function deserializeReferrerDetailResponse(maybeResponse: SerializedReferrerDetailResponse, valueLabel?: string): ReferrerDetailResponse;
|
|
4150
|
+
|
|
4151
|
+
/**
|
|
4152
|
+
* Serialize a {@link ReferrerLeaderboardPageResponse} object.
|
|
4153
|
+
*/
|
|
4154
|
+
declare function serializeReferrerLeaderboardPageResponse(response: ReferrerLeaderboardPageResponse): SerializedReferrerLeaderboardPageResponse;
|
|
4155
|
+
/**
|
|
4156
|
+
* Serialize a {@link ReferrerDetailResponse} object.
|
|
4157
|
+
*/
|
|
4158
|
+
declare function serializeReferrerDetailResponse(response: ReferrerDetailResponse): SerializedReferrerDetailResponse;
|
|
4159
|
+
|
|
4160
|
+
/**
|
|
4161
|
+
* Configuration options for ENSNode API client
|
|
4162
|
+
*/
|
|
4163
|
+
interface ClientOptions {
|
|
4164
|
+
/** The ENSNode API URL */
|
|
4165
|
+
url: URL;
|
|
4166
|
+
}
|
|
4167
|
+
/**
|
|
4168
|
+
* ENSNode API Client
|
|
4169
|
+
*
|
|
4170
|
+
* Provides access to the following ENSNode APIs:
|
|
4171
|
+
* - Resolution API
|
|
4172
|
+
* - ENSAnalytics API
|
|
4173
|
+
* - 🚧 Configuration API
|
|
4174
|
+
* - 🚧 Indexing Status API
|
|
4175
|
+
*
|
|
4176
|
+
* @example
|
|
4177
|
+
* ```typescript
|
|
4178
|
+
* // Create client with default options
|
|
4179
|
+
* const client = new ENSNodeClient();
|
|
4180
|
+
*
|
|
4181
|
+
* // Use resolution methods
|
|
4182
|
+
* const { records } = await client.resolveRecords("jesse.base.eth", {
|
|
4183
|
+
* addresses: [60],
|
|
4184
|
+
* texts: ["avatar"]
|
|
4185
|
+
* });
|
|
4186
|
+
* ```
|
|
4187
|
+
*
|
|
4188
|
+
* @example
|
|
4189
|
+
* ```typescript
|
|
4190
|
+
* // Custom configuration
|
|
4191
|
+
* const client = new ENSNodeClient({
|
|
4192
|
+
* url: new URL("https://my-ensnode-instance.com"),
|
|
4193
|
+
* });
|
|
4194
|
+
* ```
|
|
4195
|
+
*/
|
|
4196
|
+
declare class ENSNodeClient {
|
|
4197
|
+
private readonly options;
|
|
4198
|
+
static defaultOptions(): ClientOptions;
|
|
4199
|
+
constructor(options?: Partial<ClientOptions>);
|
|
4200
|
+
getOptions(): Readonly<ClientOptions>;
|
|
4201
|
+
/**
|
|
4202
|
+
* Resolves records for an ENS name (Forward Resolution).
|
|
4203
|
+
*
|
|
4204
|
+
* The returned `name` field, if set, is guaranteed to be a [Normalized Name](https://ensnode.io/docs/reference/terminology#normalized-name).
|
|
4205
|
+
* If the name record returned by the resolver is not normalized, `null` is returned as if no name record was set.
|
|
4206
|
+
*
|
|
4207
|
+
* @param name The ENS Name whose records to resolve
|
|
4208
|
+
* @param selection selection of Resolver records
|
|
4209
|
+
* @param options additional options
|
|
4210
|
+
* @param options.accelerate whether to attempt Protocol Acceleration (default false)
|
|
4211
|
+
* @param options.trace whether to include a trace in the response (default false)
|
|
4212
|
+
* @returns ResolveRecordsResponse<SELECTION>
|
|
4213
|
+
* @throws If the request fails or the ENSNode API returns an error response
|
|
4214
|
+
*
|
|
4215
|
+
* @example
|
|
4216
|
+
* ```typescript
|
|
4217
|
+
* const { records } = await client.resolveRecords("jesse.base.eth", {
|
|
4218
|
+
* addresses: [60],
|
|
4219
|
+
* texts: ["avatar", "com.twitter"]
|
|
4220
|
+
* });
|
|
4221
|
+
*
|
|
4222
|
+
* console.log(records);
|
|
4223
|
+
* // {
|
|
4224
|
+
* // addresses: {
|
|
4225
|
+
* // 60: "0xabcd..."
|
|
4226
|
+
* // },
|
|
4227
|
+
* // texts: {
|
|
4228
|
+
* // avatar: "https://example.com/image.jpg",
|
|
4229
|
+
* // "com.twitter": null, // if not set, for example
|
|
4230
|
+
* // }
|
|
4231
|
+
* // }
|
|
4232
|
+
* ```
|
|
4233
|
+
*/
|
|
4234
|
+
resolveRecords<SELECTION extends ResolverRecordsSelection>(name: ResolveRecordsRequest<SELECTION>["name"], selection: ResolveRecordsRequest<SELECTION>["selection"], options?: Omit<ResolveRecordsRequest<SELECTION>, "name" | "selection">): Promise<ResolveRecordsResponse<SELECTION>>;
|
|
4235
|
+
/**
|
|
4236
|
+
* Resolves the primary name of a specified address (Reverse Resolution) on a specific chain.
|
|
4237
|
+
*
|
|
4238
|
+
* If the chainId-specific Primary Name is not defined, but the `address` specifies a valid
|
|
4239
|
+
* [ENSIP-19 Default Name](https://docs.ens.domains/ensip/19/#default-primary-name), the Default
|
|
4240
|
+
* Name will be returned. You _may_ query the Default EVM Chain Id (`0`) in order to determine the
|
|
4241
|
+
* `address`'s Default Name directly.
|
|
4242
|
+
*
|
|
4243
|
+
* The returned Primary Name, if set, is guaranteed to be a [Normalized Name](https://ensnode.io/docs/reference/terminology#normalized-name).
|
|
4244
|
+
* If the primary name set for the address is not normalized, `null` is returned as if no primary name was set.
|
|
4245
|
+
*
|
|
4246
|
+
* @param address The Address whose Primary Name to resolve
|
|
4247
|
+
* @param chainId The chain id within which to query the address' ENSIP-19 Multichain Primary Name
|
|
4248
|
+
* @param options additional options
|
|
4249
|
+
* @param options.accelerate whether to attempt Protocol Acceleration (default false)
|
|
4250
|
+
* @param options.trace whether to include a trace in the response (default false)
|
|
4251
|
+
* @returns ResolvePrimaryNameResponse
|
|
4252
|
+
* @throws If the request fails or the ENSNode API returns an error response
|
|
4253
|
+
*
|
|
4254
|
+
* @example
|
|
4255
|
+
* ```typescript
|
|
4256
|
+
* // Resolve the address' Primary Name on Ethereum Mainnet
|
|
4257
|
+
* const { name } = await client.resolvePrimaryName("0x179A862703a4adfb29896552DF9e307980D19285", 1);
|
|
4258
|
+
* // name === 'gregskril.eth'
|
|
4259
|
+
*
|
|
4260
|
+
* // Resolve the address' Primary Name on Base
|
|
4261
|
+
* const { name } = await client.resolvePrimaryName("0x179A862703a4adfb29896552DF9e307980D19285", 8453);
|
|
4262
|
+
* // name === 'greg.base.eth'
|
|
4263
|
+
*
|
|
4264
|
+
* // Resolve the address' Default Primary Name
|
|
4265
|
+
* const { name } = await client.resolvePrimaryName("0x179A862703a4adfb29896552DF9e307980D19285", 0);
|
|
4266
|
+
* // name === 'gregskril.eth'
|
|
4267
|
+
* ```
|
|
4268
|
+
*/
|
|
4269
|
+
resolvePrimaryName(address: ResolvePrimaryNameRequest["address"], chainId: ResolvePrimaryNameRequest["chainId"], options?: Omit<ResolvePrimaryNameRequest, "address" | "chainId">): Promise<ResolvePrimaryNameResponse>;
|
|
4270
|
+
/**
|
|
4271
|
+
* Resolves the primary names of a specified address across multiple chains.
|
|
4272
|
+
*
|
|
4273
|
+
* For each Primary Name, if the chainId-specific Primary Name is not defined, but the `address`
|
|
4274
|
+
* specifies a valid [ENSIP-19 Default Name](https://docs.ens.domains/ensip/19/#default-primary-name),
|
|
4275
|
+
* the Default Name will be returned. You _may not_ query the Default EVM Chain Id (`0`) directly,
|
|
4276
|
+
* and should rely on the aforementioned per-chain defaulting behavior.
|
|
4277
|
+
*
|
|
4278
|
+
* Each returned Primary Name, if set, is guaranteed to be a [Normalized Name](https://ensnode.io/docs/reference/terminology#normalized-name).
|
|
4279
|
+
* If the primary name set for the address on any chain is not normalized, `null` is returned for
|
|
4280
|
+
* that chain as if no primary name was set.
|
|
4281
|
+
*
|
|
4282
|
+
* @param address The Address whose Primary Names to resolve
|
|
4283
|
+
* @param options additional options
|
|
4284
|
+
* @param options.chainIds The set of chain ids within which to query the address' ENSIP-19
|
|
4285
|
+
* Multichain Primary Name (default: all ENSIP-19 supported chains)
|
|
4286
|
+
* @param options.accelerate whether to attempt Protocol Acceleration (default: true)
|
|
4287
|
+
* @param options.trace whether to include a trace in the response (default: false)
|
|
4288
|
+
* @returns ResolvePrimaryNamesResponse
|
|
4289
|
+
* @throws If the request fails or the ENSNode API returns an error response
|
|
4290
|
+
*
|
|
4291
|
+
* @example
|
|
4292
|
+
* ```typescript
|
|
4293
|
+
* // Resolve the address' Primary Names on all ENSIP-19 supported chain ids
|
|
4294
|
+
* const { names } = await client.resolvePrimaryNames("0x179A862703a4adfb29896552DF9e307980D19285");
|
|
4295
|
+
*
|
|
4296
|
+
* console.log(names);
|
|
4297
|
+
* // {
|
|
4298
|
+
* // "1": "gregskril.eth", // Default Primary Name
|
|
4299
|
+
* // "10": "gregskril.eth", // Default Primary Name
|
|
4300
|
+
* // "8453": "greg.base.eth", // Base-specific Primary Name!
|
|
4301
|
+
* // "42161": "gregskril.eth", // Default Primary Name
|
|
4302
|
+
* // "59144": "gregskril.eth", // Default Primary Name
|
|
4303
|
+
* // "534352": "gregskril.eth" // Default Primary Name
|
|
4304
|
+
* // }
|
|
4305
|
+
*
|
|
4306
|
+
* // Resolve the address' Primary Names on specific chain Ids
|
|
4307
|
+
* const { names } = await client.resolvePrimaryNames("0xabcd...", [1, 8453]);
|
|
4308
|
+
*
|
|
4309
|
+
* console.log(names);
|
|
4310
|
+
* // {
|
|
4311
|
+
* // "1": "gregskril.eth",
|
|
4312
|
+
* // "8453": "greg.base.eth", // base-specific Primary Name!
|
|
4313
|
+
* // }
|
|
4314
|
+
* ```
|
|
4315
|
+
*/
|
|
4316
|
+
resolvePrimaryNames(address: ResolvePrimaryNamesRequest["address"], options?: Omit<ResolvePrimaryNamesRequest, "address">): Promise<ResolvePrimaryNamesResponse>;
|
|
4317
|
+
/**
|
|
4318
|
+
* Fetch ENSNode Config
|
|
4319
|
+
*
|
|
4320
|
+
* Fetch the ENSNode's configuration.
|
|
4321
|
+
*
|
|
4322
|
+
* @returns {ConfigResponse}
|
|
4323
|
+
*
|
|
4324
|
+
* @throws if the ENSNode request fails
|
|
4325
|
+
* @throws if the ENSNode API returns an error response
|
|
4326
|
+
* @throws if the ENSNode response breaks required invariants
|
|
4327
|
+
*/
|
|
4328
|
+
config(): Promise<ConfigResponse>;
|
|
4329
|
+
/**
|
|
4330
|
+
* Fetch ENSNode Indexing Status
|
|
4331
|
+
*
|
|
4332
|
+
* @returns {IndexingStatusResponse}
|
|
4333
|
+
*
|
|
4334
|
+
* @throws if the ENSNode request fails
|
|
4335
|
+
* @throws if the ENSNode API returns an error response
|
|
4336
|
+
* @throws if the ENSNode response breaks required invariants
|
|
4337
|
+
*/
|
|
4338
|
+
indexingStatus(): Promise<IndexingStatusResponse>;
|
|
4339
|
+
/**
|
|
4340
|
+
* Fetch Referrer Leaderboard Page
|
|
4341
|
+
*
|
|
4342
|
+
* Retrieves a paginated list of referrer leaderboard metrics with contribution percentages.
|
|
4343
|
+
* Each referrer's contribution is calculated as a percentage of the grand totals across all referrers.
|
|
4344
|
+
*
|
|
4345
|
+
* @param request - Pagination parameters
|
|
4346
|
+
* @param request.page - The page number to retrieve (1-indexed, default: 1)
|
|
4347
|
+
* @param request.recordsPerPage - Number of records per page (default: 25, max: 100)
|
|
4348
|
+
* @returns {ReferrerLeaderboardPageResponse}
|
|
4349
|
+
*
|
|
4350
|
+
* @throws if the ENSNode request fails
|
|
4351
|
+
* @throws if the ENSNode API returns an error response
|
|
4352
|
+
* @throws if the ENSNode response breaks required invariants
|
|
4353
|
+
*
|
|
4354
|
+
* @example
|
|
4355
|
+
* ```typescript
|
|
4356
|
+
* // Get first page with default page size (25 records)
|
|
4357
|
+
* const response = await client.getReferrerLeaderboardPage();
|
|
4358
|
+
* if (response.responseCode === ReferrerLeaderboardPageResponseCodes.Ok) {
|
|
4359
|
+
* const {
|
|
4360
|
+
* aggregatedMetrics,
|
|
4361
|
+
* referrers,
|
|
4362
|
+
* rules,
|
|
4363
|
+
* pageContext,
|
|
4364
|
+
* updatedAt
|
|
4365
|
+
* } = response.data;
|
|
4366
|
+
* console.log(aggregatedMetrics);
|
|
4367
|
+
* console.log(referrers);
|
|
4368
|
+
* console.log(rules);
|
|
4369
|
+
* console.log(updatedAt);
|
|
4370
|
+
* console.log(`Page ${pageContext.page} of ${pageContext.totalPages}`);
|
|
4371
|
+
* }
|
|
4372
|
+
* ```
|
|
4373
|
+
*
|
|
4374
|
+
* @example
|
|
4375
|
+
* ```typescript
|
|
4376
|
+
* // Get second page with 50 records per page
|
|
4377
|
+
* const response = await client.getReferrerLeaderboardPage({ page: 2, recordsPerPage: 50 });
|
|
4378
|
+
* ```
|
|
4379
|
+
*
|
|
4380
|
+
* @example
|
|
4381
|
+
* ```typescript
|
|
4382
|
+
* // Handle error response, ie. when Referrer Leaderboard is not currently available.
|
|
4383
|
+
* const response = await client.getReferrerLeaderboardPage();
|
|
4384
|
+
*
|
|
4385
|
+
* if (response.responseCode === ReferrerLeaderboardPageResponseCodes.Error) {
|
|
4386
|
+
* console.error(response.error);
|
|
4387
|
+
* console.error(response.errorMessage);
|
|
4388
|
+
* }
|
|
4389
|
+
* ```
|
|
4390
|
+
*/
|
|
4391
|
+
getReferrerLeaderboardPage(request?: ReferrerLeaderboardPageRequest): Promise<ReferrerLeaderboardPageResponse>;
|
|
4392
|
+
/**
|
|
4393
|
+
* Fetch Referrer Detail
|
|
4394
|
+
*
|
|
4395
|
+
* Retrieves detailed information about a specific referrer, whether they are on the
|
|
4396
|
+
* leaderboard or not.
|
|
4397
|
+
*
|
|
4398
|
+
* The response data is a discriminated union type with a `type` field:
|
|
4399
|
+
*
|
|
4400
|
+
* **For referrers on the leaderboard** (`ReferrerDetailRanked`):
|
|
4401
|
+
* - `type`: {@link ReferrerDetailTypeIds.Ranked}
|
|
4402
|
+
* - `referrer`: The `AwardedReferrerMetrics` from @namehash/ens-referrals
|
|
4403
|
+
* - `rules`: The referral program rules
|
|
4404
|
+
* - `aggregatedMetrics`: Aggregated metrics for all referrers on the leaderboard
|
|
4405
|
+
* - `accurateAsOf`: Unix timestamp indicating when the data was last updated
|
|
4406
|
+
*
|
|
4407
|
+
* **For referrers NOT on the leaderboard** (`ReferrerDetailUnranked`):
|
|
4408
|
+
* - `type`: {@link ReferrerDetailTypeIds.Unranked}
|
|
4409
|
+
* - `referrer`: The `UnrankedReferrerMetrics` from @namehash/ens-referrals
|
|
4410
|
+
* - `rules`: The referral program rules
|
|
4411
|
+
* - `aggregatedMetrics`: Aggregated metrics for all referrers on the leaderboard
|
|
4412
|
+
* - `accurateAsOf`: Unix timestamp indicating when the data was last updated
|
|
4413
|
+
*
|
|
4414
|
+
* @see {@link https://www.npmjs.com/package/@namehash/ens-referrals|@namehash/ens-referrals} for calculation details
|
|
4415
|
+
*
|
|
4416
|
+
* @param request The referrer address to query
|
|
4417
|
+
* @returns {ReferrerDetailResponse} Returns the referrer detail response
|
|
4418
|
+
*
|
|
4419
|
+
* @throws if the ENSNode request fails
|
|
4420
|
+
* @throws if the response data is malformed
|
|
4421
|
+
*
|
|
4422
|
+
* @example
|
|
4423
|
+
* ```typescript
|
|
4424
|
+
* // Get referrer detail for a specific address
|
|
4425
|
+
* const response = await client.getReferrerDetail({
|
|
4426
|
+
* referrer: "0x1234567890123456789012345678901234567890"
|
|
4427
|
+
* });
|
|
4428
|
+
* if (response.responseCode === ReferrerDetailResponseCodes.Ok) {
|
|
4429
|
+
* const { type, referrer, rules, aggregatedMetrics, accurateAsOf } = response.data;
|
|
4430
|
+
* console.log(type); // ReferrerDetailTypeIds.Ranked or ReferrerDetailTypeIds.Unranked
|
|
4431
|
+
* console.log(referrer);
|
|
4432
|
+
* console.log(accurateAsOf);
|
|
4433
|
+
* }
|
|
4434
|
+
* ```
|
|
4435
|
+
*
|
|
4436
|
+
* @example
|
|
4437
|
+
* ```typescript
|
|
4438
|
+
* // Use discriminated union to check if referrer is ranked
|
|
4439
|
+
* const response = await client.getReferrerDetail({
|
|
4440
|
+
* referrer: "0x1234567890123456789012345678901234567890"
|
|
4441
|
+
* });
|
|
4442
|
+
* if (response.responseCode === ReferrerDetailResponseCodes.Ok) {
|
|
4443
|
+
* if (response.data.type === ReferrerDetailTypeIds.Ranked) {
|
|
4444
|
+
* // TypeScript knows this is ReferrerDetailRanked
|
|
4445
|
+
* console.log(`Rank: ${response.data.referrer.rank}`);
|
|
4446
|
+
* console.log(`Qualified: ${response.data.referrer.isQualified}`);
|
|
4447
|
+
* console.log(`Award Pool Share: ${response.data.referrer.awardPoolShare * 100}%`);
|
|
4448
|
+
* } else {
|
|
4449
|
+
* // TypeScript knows this is ReferrerDetailUnranked
|
|
4450
|
+
* console.log("Referrer is not on the leaderboard (no referrals yet)");
|
|
4451
|
+
* }
|
|
4452
|
+
* }
|
|
4453
|
+
* ```
|
|
4454
|
+
*
|
|
4455
|
+
* @example
|
|
4456
|
+
* ```typescript
|
|
4457
|
+
* // Handle error response, ie. when Referrer Detail is not currently available.
|
|
4458
|
+
* const response = await client.getReferrerDetail({
|
|
4459
|
+
* referrer: "0x1234567890123456789012345678901234567890"
|
|
4460
|
+
* });
|
|
4461
|
+
*
|
|
4462
|
+
* if (response.responseCode === ReferrerDetailResponseCodes.Error) {
|
|
4463
|
+
* console.error(response.error);
|
|
4464
|
+
* console.error(response.errorMessage);
|
|
4465
|
+
* }
|
|
4466
|
+
* ```
|
|
4467
|
+
*/
|
|
4468
|
+
getReferrerDetail(request: ReferrerDetailRequest): Promise<ReferrerDetailResponse>;
|
|
4469
|
+
/**
|
|
4470
|
+
* Fetch ENSNode Registrar Actions
|
|
4471
|
+
*
|
|
4472
|
+
* Retrieves a paginated list of registrar actions with optional filters.
|
|
4473
|
+
*
|
|
4474
|
+
* @param request is a request configuration.
|
|
4475
|
+
* @param request.page sets the page number to retrieve (1-indexed, default: 1)
|
|
4476
|
+
* @param request.recordsPerPage sets the number of records per page (default: 10, max: 100)
|
|
4477
|
+
* @param request.filters is an optional request filter configuration.
|
|
4478
|
+
* @param request.order sets the order of results in the response by field and direction.
|
|
4479
|
+
* @returns {RegistrarActionsResponse}
|
|
4480
|
+
*
|
|
4481
|
+
* @throws if the ENSNode request fails
|
|
4482
|
+
* @throws if the ENSNode API returns an error response
|
|
4483
|
+
* @throws if the ENSNode response breaks required invariants
|
|
4484
|
+
*
|
|
4485
|
+
* @example
|
|
4486
|
+
* ```ts
|
|
4487
|
+
* import {
|
|
4488
|
+
* registrarActionsFilter,
|
|
4489
|
+
* ENSNodeClient,
|
|
4490
|
+
* } from "@ensnode/ensnode-sdk";
|
|
4491
|
+
* import { namehash } from "viem/ens";
|
|
4492
|
+
*
|
|
4493
|
+
* const client: ENSNodeClient;
|
|
4494
|
+
*
|
|
4495
|
+
* // Get first page with default page size (10 records)
|
|
4496
|
+
* const response = await client.registrarActions();
|
|
4497
|
+
* if (response.responseCode === RegistrarActionsResponseCodes.Ok) {
|
|
4498
|
+
* const { registrarActions, pageContext } = response;
|
|
4499
|
+
* console.log(registrarActions);
|
|
4500
|
+
* console.log(`Page ${pageContext.page} of ${pageContext.totalPages}`);
|
|
4501
|
+
* }
|
|
4502
|
+
*
|
|
4503
|
+
* // Get second page with 25 records per page
|
|
4504
|
+
* const response = await client.registrarActions({
|
|
4505
|
+
* page: 2,
|
|
4506
|
+
* recordsPerPage: 25,
|
|
4507
|
+
* });
|
|
4508
|
+
*
|
|
4509
|
+
* // get latest registrar action records associated with
|
|
4510
|
+
* // subregistry managing `eth` name
|
|
4511
|
+
* await client.registrarActions({
|
|
4512
|
+
* filters: [registrarActionsFilter.byParentNode(namehash('eth'))],
|
|
4513
|
+
* });
|
|
4514
|
+
*
|
|
4515
|
+
* // get latest registrar action records which include referral info
|
|
4516
|
+
* await client.registrarActions({
|
|
4517
|
+
* filters: [registrarActionsFilter.withReferral(true)],
|
|
4518
|
+
* });
|
|
4519
|
+
*
|
|
4520
|
+
* // get latest registrar action records for a specific decoded referrer
|
|
4521
|
+
* await client.registrarActions({
|
|
4522
|
+
* filters: [registrarActionsFilter.byDecodedReferrer("0x1234567890123456789012345678901234567890")],
|
|
4523
|
+
* });
|
|
4524
|
+
*
|
|
4525
|
+
* // get latest 10 registrar action records associated with
|
|
4526
|
+
* // subregistry managing `base.eth` name
|
|
4527
|
+
* await client.registrarActions({
|
|
4528
|
+
* filters: [registrarActionsFilter.byParentNode(namehash('base.eth'))],
|
|
4529
|
+
* recordsPerPage: 10
|
|
4530
|
+
* });
|
|
4531
|
+
*
|
|
4532
|
+
* // get registrar actions within a specific time range
|
|
4533
|
+
* const beginTimestamp = 1764547200; // Dec 1, 2025, 00:00:00 UTC
|
|
4534
|
+
* const endTimestamp = 1767225600; // Jan 1, 2026, 00:00:00 UTC
|
|
4535
|
+
* await client.registrarActions({
|
|
4536
|
+
* filters: [
|
|
4537
|
+
* registrarActionsFilter.beginTimestamp(beginTimestamp),
|
|
4538
|
+
* registrarActionsFilter.endTimestamp(endTimestamp),
|
|
4539
|
+
* ],
|
|
4540
|
+
* });
|
|
4541
|
+
*
|
|
4542
|
+
* // get registrar actions from a specific timestamp onwards
|
|
4543
|
+
* await client.registrarActions({
|
|
4544
|
+
* filters: [registrarActionsFilter.beginTimestamp(1764547200)],
|
|
4545
|
+
* });
|
|
4546
|
+
*
|
|
4547
|
+
* // get registrar actions up to a specific timestamp
|
|
4548
|
+
* await client.registrarActions({
|
|
4549
|
+
* filters: [registrarActionsFilter.endTimestamp(1767225600)],
|
|
4550
|
+
* });
|
|
4551
|
+
* ```
|
|
4552
|
+
*/
|
|
4553
|
+
registrarActions(request?: RegistrarActionsRequest): Promise<RegistrarActionsResponse>;
|
|
4554
|
+
/**
|
|
4555
|
+
* Fetch Name Tokens for requested name.
|
|
4556
|
+
*
|
|
4557
|
+
* @param request.name - Name for which Name Tokens will be fetched.
|
|
4558
|
+
* @returns {NameTokensResponse}
|
|
4559
|
+
*
|
|
4560
|
+
* @throws if the ENSNode request fails
|
|
4561
|
+
* @throws if the ENSNode API returns an error response
|
|
4562
|
+
* @throws if the ENSNode response breaks required invariants
|
|
4563
|
+
*
|
|
4564
|
+
* @example
|
|
4565
|
+
* ```ts
|
|
4566
|
+
* import {
|
|
4567
|
+
* ENSNodeClient,
|
|
4568
|
+
* } from "@ensnode/ensnode-sdk";
|
|
4569
|
+
* import { namehash } from "viem/ens";
|
|
4570
|
+
*
|
|
4571
|
+
* const client: ENSNodeClient;
|
|
4572
|
+
*
|
|
4573
|
+
* // get latest name token records from the indexed subregistry based on the requested name
|
|
4574
|
+
* const response = await client.nameTokens({
|
|
4575
|
+
* name: "vitalik.eth"
|
|
4576
|
+
* });
|
|
4577
|
+
*
|
|
4578
|
+
* const response = await client.nameTokens({
|
|
4579
|
+
* domainId: "0xee6c4522aab0003e8d14cd40a6af439055fd2577951148c14b6cea9a53475835" // namehash('vitalik.eth')
|
|
4580
|
+
* })
|
|
4581
|
+
* ```
|
|
4582
|
+
*/
|
|
4583
|
+
nameTokens(request: NameTokensRequest): Promise<NameTokensResponse>;
|
|
4584
|
+
}
|
|
4585
|
+
|
|
4586
|
+
declare class ClientError extends Error {
|
|
4587
|
+
details?: unknown;
|
|
4588
|
+
constructor(message: string, details?: unknown);
|
|
4589
|
+
static fromErrorResponse({ message, details }: ErrorResponse): ClientError;
|
|
4590
|
+
}
|
|
4591
|
+
|
|
4592
|
+
export { ADDR_REVERSE_NODE, ATTR_PROTOCOL_NAME, ATTR_PROTOCOL_STEP, ATTR_PROTOCOL_STEP_RESULT, type AcceleratableRequest, type AcceleratableResponse, type AccountId, type AccountIdString, type AssetId, type AssetIdString, type AssetNamespace, AssetNamespaces, BASENAMES_NODE, type BlockNumber, type BlockRef, type Blockrange, type Cache, type ChainId, type ChainIdString, type ChainIndexingConfig, type ChainIndexingConfigDefinite, type ChainIndexingConfigIndefinite, type ChainIndexingConfigTypeId, ChainIndexingConfigTypeIds, type ChainIndexingStatusId, ChainIndexingStatusIds, type ChainIndexingStatusSnapshot, type ChainIndexingStatusSnapshotBackfill, type ChainIndexingStatusSnapshotCompleted, type ChainIndexingStatusSnapshotFollowing, type ChainIndexingStatusSnapshotForOmnichainIndexingStatusSnapshotBackfill, type ChainIndexingStatusSnapshotQueued, ClientError, type ClientOptions, type ConfigResponse, type CrossChainIndexingStatusSnapshot, type CrossChainIndexingStatusSnapshotOmnichain, type CrossChainIndexingStrategyId, CrossChainIndexingStrategyIds, type CurrencyAmount, type CurrencyId, CurrencyIds, type CurrencyInfo, DEFAULT_EVM_CHAIN_ID, DEFAULT_EVM_COIN_TYPE, type DNSEncodedLiteralName, type DNSEncodedName, type DNSEncodedPartiallyInterpretedName, type Datetime, type DatetimeISO8601, type DeepPartial, type DefaultableChainId, type DomainAssetId, type Duration, type ENSApiPublicConfig, type ENSIndexerPublicConfig, type ENSIndexerVersionInfo, ENSNodeClient, ENS_ROOT, ETH_COIN_TYPE, ETH_NODE, type EncodedLabelHash, type EnsRainbowClientLabelSet, type EnsRainbowServerLabelSet, type ErrorResponse, type ForwardResolutionArgs, ForwardResolutionProtocolStep, type ForwardResolutionResult, type Identity, type IndexingStatusRequest, type IndexingStatusResponse, type IndexingStatusResponseCode, IndexingStatusResponseCodes, type IndexingStatusResponseError, type IndexingStatusResponseOk, type InterpretedLabel, type InterpretedName, LINEANAMES_NODE, type Label, type LabelHash, type LabelSetId, type LabelSetVersion, type LiteralLabel, type LiteralName, LruCache, type MultichainPrimaryNameResolutionArgs, type MultichainPrimaryNameResolutionResult, type NFTMintStatus, NFTMintStatuses, type NFTTransferEventMetadata, type NFTTransferType, NFTTransferTypes, type Name, type NameToken, type NameTokenOwnership, type NameTokenOwnershipBurned, type NameTokenOwnershipFullyOnchain, type NameTokenOwnershipNameWrapper, type NameTokenOwnershipType, NameTokenOwnershipTypes, type NameTokenOwnershipUnknown, type NameTokensRequest, type NameTokensResponse, type NameTokensResponseCode, NameTokensResponseCodes, type NameTokensResponseError, type NameTokensResponseErrorCode, NameTokensResponseErrorCodes, type NameTokensResponseErrorEnsIndexerConfigUnsupported, type NameTokensResponseErrorIndexingStatusUnsupported, type NameTokensResponseErrorNameTokensNotIndexed, type NameTokensResponseOk, type NamedIdentity, type NamedRegistrarAction, type Node, type NormalizedName, type OmnichainIndexingStatusId, OmnichainIndexingStatusIds, type OmnichainIndexingStatusSnapshot, type OmnichainIndexingStatusSnapshotBackfill, type OmnichainIndexingStatusSnapshotCompleted, type OmnichainIndexingStatusSnapshotFollowing, type OmnichainIndexingStatusSnapshotUnstarted, PROTOCOL_ATTRIBUTE_PREFIX, PluginName, type Price, type PriceDai, type PriceEth, type PriceUsdc, RECORDS_PER_PAGE_DEFAULT, RECORDS_PER_PAGE_MAX, ROOT_NODE, type RealtimeIndexingStatusProjection, type ReferrerDetailRequest, type ReferrerDetailResponse, type ReferrerDetailResponseCode, ReferrerDetailResponseCodes, type ReferrerDetailResponseError, type ReferrerDetailResponseOk, type ReferrerLeaderboardPageRequest, type ReferrerLeaderboardPageResponse, type ReferrerLeaderboardPageResponseCode, ReferrerLeaderboardPageResponseCodes, type ReferrerLeaderboardPageResponseError, type ReferrerLeaderboardPageResponseOk, type RegisteredNameTokens, type RegistrarAction, type RegistrarActionEventId, type RegistrarActionPricing, type RegistrarActionPricingAvailable, type RegistrarActionPricingUnknown, type RegistrarActionReferral, type RegistrarActionReferralAvailable, type RegistrarActionReferralNotApplicable, type RegistrarActionType, RegistrarActionTypes, type RegistrarActionsFilter, type RegistrarActionsFilterBeginTimestamp, type RegistrarActionsFilterByDecodedReferrer, type RegistrarActionsFilterBySubregistryNode, type RegistrarActionsFilterEndTimestamp, type RegistrarActionsFilterType, RegistrarActionsFilterTypes, type RegistrarActionsFilterWithEncodedReferral, type RegistrarActionsOrder, RegistrarActionsOrders, type RegistrarActionsRequest, type RegistrarActionsResponse, type RegistrarActionsResponseCode, RegistrarActionsResponseCodes, type RegistrarActionsResponseError, type RegistrarActionsResponseOk, type RegistrationLifecycle, type RegistrationLifecycleStage, type RequestPageParams, type ResolutionStatusId, ResolutionStatusIds, type ResolvePrimaryNameRequest, type ResolvePrimaryNameResponse, type ResolvePrimaryNamesRequest, type ResolvePrimaryNamesResponse, type ResolveRecordsRequest, type ResolveRecordsResponse, type ResolvedIdentity, type ResolverRecordsResponse, type ResolverRecordsResponseBase, type ResolverRecordsSelection, type ResponsePageContext, type ResponsePageContextWithNoRecords, type ResponsePageContextWithRecords, type ReverseResolutionArgs, ReverseResolutionProtocolStep, type ReverseResolutionResult, type RpcUrl, SWRCache, type SWRCacheOptions, type SerializedAggregatedReferrerMetrics, type SerializedAssetId, type SerializedAwardedReferrerMetrics, type SerializedChainIndexingStatusSnapshot, type SerializedChainIndexingStatusSnapshotBackfill, type SerializedChainIndexingStatusSnapshotCompleted, type SerializedChainIndexingStatusSnapshotFollowing, type SerializedChainIndexingStatusSnapshotQueued, type SerializedConfigResponse, type SerializedCrossChainIndexingStatusSnapshot, type SerializedCrossChainIndexingStatusSnapshotOmnichain, type SerializedCurrencyAmount, type SerializedCurrentIndexingProjectionOmnichain, type SerializedDomainAssetId, type SerializedENSApiPublicConfig, type SerializedENSIndexerPublicConfig, type SerializedENSIndexerVersionInfo, type SerializedIndexedChainIds, type SerializedIndexingStatusResponse, type SerializedIndexingStatusResponseError, type SerializedIndexingStatusResponseOk, type SerializedNameToken, type SerializedNameTokensResponse, type SerializedNameTokensResponseError, type SerializedNameTokensResponseOk, type SerializedNamedRegistrarAction, type SerializedOmnichainIndexingStatusSnapshot, type SerializedOmnichainIndexingStatusSnapshotBackfill, type SerializedOmnichainIndexingStatusSnapshotCompleted, type SerializedOmnichainIndexingStatusSnapshotFollowing, type SerializedOmnichainIndexingStatusSnapshotUnstarted, type SerializedPrice, type SerializedPriceDai, type SerializedPriceEth, type SerializedPriceUsdc, type SerializedRealtimeIndexingStatusProjection, type SerializedReferralProgramRules, type SerializedReferrerDetail, type SerializedReferrerDetailRanked, type SerializedReferrerDetailResponse, type SerializedReferrerDetailResponseError, type SerializedReferrerDetailResponseOk, type SerializedReferrerDetailUnranked, type SerializedReferrerLeaderboardPage, type SerializedReferrerLeaderboardPageResponse, type SerializedReferrerLeaderboardPageResponseError, type SerializedReferrerLeaderboardPageResponseOk, type SerializedRegisteredNameTokens, type SerializedRegistrarAction, type SerializedRegistrarActionPricing, type SerializedRegistrarActionPricingAvailable, type SerializedRegistrarActionPricingUnknown, type SerializedRegistrarActionsResponse, type SerializedRegistrarActionsResponseError, type SerializedRegistrarActionsResponseOk, type SerializedRevenueContribution, type SerializedTokenId, type SerializedUnrankedReferrerMetrics, type SubgraphInterpretedLabel, type SubgraphInterpretedName, type Subregistry, type TheGraphCannotFallbackReason, TheGraphCannotFallbackReasonSchema, type TheGraphFallback, TheGraphFallbackSchema, type TokenId, TraceableENSProtocol, type TraceableRequest, type TraceableResponse, type TracingNode, type TracingSpan, type TracingTrace, TtlCache, type UnixTimestamp, type UnknownIdentity, type UnnamedIdentity, type UnresolvedIdentity, type UrlString, accountIdEqual, addDuration, addPrices, addrReverseLabel, asLowerCaseAddress, beautifyName, bigIntToNumber, bigintToCoinType, buildAssetId, buildEnsRainbowClientLabelSet, buildLabelSetId, buildLabelSetVersion, buildPageContext, buildUnresolvedIdentity, checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill, checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted, checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing, checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted, coinTypeReverseLabel, coinTypeToEvmChainId, createIndexingConfig, createRealtimeIndexingStatusProjection, decodeDNSEncodedLiteralName, decodeDNSEncodedName, deserializeAssetId, deserializeBlockNumber, deserializeBlockRef, deserializeBlockrange, deserializeChainId, deserializeChainIndexingStatusSnapshot, deserializeConfigResponse, deserializeCrossChainIndexingStatusSnapshot, deserializeDatetime, deserializeDuration, deserializeENSApiPublicConfig, deserializeENSIndexerPublicConfig, deserializeErrorResponse, deserializeIndexingStatusResponse, deserializeOmnichainIndexingStatusSnapshot, deserializeRealtimeIndexingStatusProjection, deserializeReferrerDetailResponse, deserializeReferrerLeaderboardPageResponse, deserializeRegistrarActionsResponse, deserializeUnixTimestamp, deserializeUrl, deserializedNameTokensResponse, durationBetween, encodeLabelHash, evmChainIdToCoinType, formatAccountId, formatAssetId, formatNFTTransferEventMetadata, getBasenamesSubregistryId, getBasenamesSubregistryManagedName, getCurrencyInfo, getDatasourceContract, getEthnamesSubregistryId, getEthnamesSubregistryManagedName, getLatestIndexedBlockRef, getLineanamesSubregistryId, getLineanamesSubregistryManagedName, getNFTTransferType, getNameHierarchy, getNameTokenOwnership, getNameWrapperAccounts, getOmnichainIndexingCursor, getOmnichainIndexingStatus, getParentNameFQDN, getResolvePrimaryNameChainIdParam, getTimestampForHighestOmnichainKnownBlock, getTimestampForLowestOmnichainStartBlock, hasNullByte, interpretedLabelsToInterpretedName, isEncodedLabelHash, isHttpProtocol, isLabelHash, isNormalizedLabel, isNormalizedName, isPriceCurrencyEqual, isPriceEqual, isRegistrarActionPricingAvailable, isRegistrarActionReferralAvailable, isResolvedIdentity, isSelectionEmpty, isSubgraphCompatible, isWebSocketProtocol, labelHashToBytes, labelhashLiteralLabel, literalLabelToInterpretedLabel, literalLabelsToInterpretedName, literalLabelsToLiteralName, makeENSApiPublicConfigSchema, makeSubdomainNode, maybeGetDatasourceContract, nameTokensPrerequisites, parseAccountId, parseAssetId, parseNonNegativeInteger, parseReverseName, priceDai, priceEth, priceUsdc, registrarActionsFilter, registrarActionsPrerequisites, reverseName, serializeAssetId, serializeChainId, serializeChainIndexingSnapshots, serializeConfigResponse, serializeCrossChainIndexingStatusSnapshotOmnichain, serializeDatetime, serializeDomainAssetId, serializeENSApiPublicConfig, serializeENSIndexerPublicConfig, serializeIndexedChainIds, serializeIndexingStatusResponse, serializeNameToken, serializeNameTokensResponse, serializeNamedRegistrarAction, serializeOmnichainIndexingStatusSnapshot, serializePrice, serializePriceEth, serializeRealtimeIndexingStatusProjection, serializeReferrerDetailResponse, serializeReferrerLeaderboardPageResponse, serializeRegisteredNameTokens, serializeRegistrarAction, serializeRegistrarActionPricing, serializeRegistrarActionsResponse, serializeUrl, sortChainStatusesByStartBlockAsc, stripNullBytes, translateDefaultableChainIdToChainId, uint256ToHex32, uniq, validateSupportedLabelSetAndVersion };
|