@ensnode/ensnode-sdk 0.35.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -10
- package/dist/index.d.ts +2696 -937
- package/dist/index.js +2253 -836
- package/dist/index.js.map +1 -1
- package/package.json +8 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { Hex, Address, ByteArray } from 'viem';
|
|
2
|
-
import * as _ensdomains_address_encoder from '@ensdomains/address-encoder';
|
|
1
|
+
import { Hex, Address, ByteArray, Hash } from 'viem';
|
|
3
2
|
import { CoinType, EvmCoinType } from '@ensdomains/address-encoder';
|
|
4
3
|
export { CoinType, EvmCoinType } from '@ensdomains/address-encoder';
|
|
4
|
+
import { EncodedReferrer } from '@namehash/ens-referrals';
|
|
5
|
+
export { EncodedReferrer, decodeEncodedReferrer, zeroEncodedReferrer } from '@namehash/ens-referrals';
|
|
6
|
+
import z$1, { z } from 'zod/v4';
|
|
5
7
|
import { ENSNamespaceId } from '@ensnode/datasources';
|
|
6
|
-
export { ENSNamespaceId, ENSNamespaceIds } from '@ensnode/datasources';
|
|
7
|
-
import z from 'zod/v4';
|
|
8
|
+
export { ENSNamespaceId, ENSNamespaceIds, getENSRootChainId } from '@ensnode/datasources';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* A hash value that uniquely identifies a single ENS name.
|
|
@@ -14,147 +15,450 @@ import z from 'zod/v4';
|
|
|
14
15
|
* ```
|
|
15
16
|
* namehash("vitalik.eth") === "0xee6c4522aab0003e8d14cd40a6af439055fd2577951148c14b6cea9a53475835"
|
|
16
17
|
* ```
|
|
17
|
-
* @
|
|
18
|
+
* @see https://docs.ens.domains/ensip/1#namehash-algorithm
|
|
19
|
+
* @see https://ensnode.io/docs/reference/terminology#name-node-namehash
|
|
18
20
|
*/
|
|
19
21
|
type Node = Hex;
|
|
20
22
|
/**
|
|
21
|
-
*
|
|
23
|
+
* An ENS Name that may or may not be normalized.
|
|
22
24
|
*
|
|
23
|
-
*
|
|
25
|
+
* @example vitalik.eth
|
|
26
|
+
* @see https://ensnode.io/docs/reference/terminology#name-node-namehash
|
|
27
|
+
* @see https://docs.ens.domains/ensip/15
|
|
24
28
|
*/
|
|
25
29
|
type Name = string;
|
|
30
|
+
/**
|
|
31
|
+
* A Normalized Name is an ENS Name that is guaranteed to be normalized.
|
|
32
|
+
*
|
|
33
|
+
* @example vitalik.eth
|
|
34
|
+
* @see https://ensnode.io/docs/reference/terminology#name-node-namehash
|
|
35
|
+
* @see https://docs.ens.domains/ensip/15
|
|
36
|
+
* @dev nominally typed to enforce usage & enhance codebase clarity
|
|
37
|
+
*/
|
|
38
|
+
type NormalizedName = Name & {
|
|
39
|
+
__brand: "NormalizedName";
|
|
40
|
+
};
|
|
26
41
|
/**
|
|
27
42
|
* A LabelHash is the result of the labelhash function (which is just keccak256) on a Label.
|
|
28
43
|
*
|
|
29
|
-
* @
|
|
44
|
+
* @example
|
|
45
|
+
* ```
|
|
46
|
+
* labelhash('vitalik') === '0xaf2caa1c2ca1d027f1ac823b529d0a67cd144264b2789fa2ea4d63a67c7103cc'
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @see https://docs.ens.domains/terminology#labelhash
|
|
50
|
+
* @see https://ensnode.io/docs/reference/terminology#labels-labelhashes-labelhash-function
|
|
30
51
|
*/
|
|
31
52
|
type LabelHash = Hex;
|
|
32
53
|
/**
|
|
33
54
|
* A Label is a single part of an ENS Name.
|
|
34
55
|
*
|
|
35
|
-
* @
|
|
56
|
+
* @example vitalik
|
|
57
|
+
*
|
|
58
|
+
* @see https://docs.ens.domains/terminology#label
|
|
59
|
+
* @see https://ensnode.io/docs/reference/terminology#labels-labelhashes-labelhash-function
|
|
36
60
|
*/
|
|
37
61
|
type Label = string;
|
|
38
62
|
/**
|
|
39
|
-
* An EncodedLabelHash is a specially formatted unnormalized Label
|
|
40
|
-
*
|
|
63
|
+
* An EncodedLabelHash is a specially formatted (unnormalized) Label formatted
|
|
64
|
+
* as a non-0x prefixed 32-byte hex string enclosed in square brackets.
|
|
65
|
+
*
|
|
66
|
+
* Care should be taken to distinguish Label values formatted as an
|
|
67
|
+
* EncodedLabelHash as either a LiteralLabel or an InterpretedLabel:
|
|
68
|
+
* - If a LiteralLabel is formatted as an EncodedLabelHash it does NOT
|
|
69
|
+
* symbolically represent the encoding of a LabelHash literal.
|
|
70
|
+
* - If an InterpretedLabel is formatted as an EncodedLabelHash it should be
|
|
71
|
+
* interpreted as encoding a LabelHash literal.
|
|
72
|
+
*
|
|
73
|
+
* An InterpretedLabel may be formatted as an EncodedLabelHash if the related
|
|
74
|
+
* LiteralLabel is:
|
|
75
|
+
* - not a normalized label
|
|
76
|
+
* - is an unknown value that could not be healed.
|
|
77
|
+
* - is too long for DNS-Encoding in contexts where DNS-Encoding was required.
|
|
78
|
+
*
|
|
79
|
+
* @example [af2caa1c2ca1d027f1ac823b529d0a67cd144264b2789fa2ea4d63a67c7103cc]
|
|
41
80
|
*
|
|
42
|
-
* @
|
|
43
|
-
* @example [abcd].example.eth
|
|
81
|
+
* @see https://ensnode.io/docs/reference/terminology#encoded-labelhash
|
|
44
82
|
*/
|
|
45
83
|
type EncodedLabelHash = `[${string}]`;
|
|
84
|
+
/**
|
|
85
|
+
* A Literal Label is a Label as it literally appears onchain, without any interpretation
|
|
86
|
+
* or normalization processing. It may be an unnormalized label for reasons including:
|
|
87
|
+
* - being an empty label,
|
|
88
|
+
* - containing '.' characters,
|
|
89
|
+
* - being formatted as an EncodedLabelHash (which are not normalizable). Note that
|
|
90
|
+
* when LiteralLabel are formatted as an EncodedLabelHash they do NOT symbolically
|
|
91
|
+
* represent the encoding of a LabelHash literal, or
|
|
92
|
+
* - containing other unnormalized characters such as null bytes or other characters
|
|
93
|
+
* not suitable for display.
|
|
94
|
+
*
|
|
95
|
+
*
|
|
96
|
+
* @see https://ensnode.io/docs/reference/terminology#literal-label
|
|
97
|
+
* @dev nominally typed to enforce usage & enhance codebase clarity
|
|
98
|
+
*/
|
|
99
|
+
type LiteralLabel = Label & {
|
|
100
|
+
__brand: "LiteralLabel";
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* An Interpreted Label is a Label that is either:
|
|
104
|
+
* a) a Normalized Label, or
|
|
105
|
+
* b) an Unnormalizable Label exclusively for the reason that it is formatted
|
|
106
|
+
* as an Encoded LabelHash that should be interpreted as encoding a
|
|
107
|
+
* LabelHash literal, where the encoded LabelHash literal is the `labelhash`
|
|
108
|
+
* of the related LiteralLabel.
|
|
109
|
+
*
|
|
110
|
+
* @see https://ensnode.io/docs/reference/terminology#interpreted-label
|
|
111
|
+
* @dev nominally typed to enforce usage & enhance codebase clarity
|
|
112
|
+
*/
|
|
113
|
+
type InterpretedLabel = Label & {
|
|
114
|
+
__brand: "InterpretedLabel";
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* A Literal Name is a Name as it literally appears onchain, composed of 0 or more Literal Labels
|
|
118
|
+
* joined by dots. It may be an unnormalized name for reasons including:
|
|
119
|
+
* - containing empty labels,
|
|
120
|
+
* - containing LiteralLabel values formatted as an EncodedLabelHash (which are
|
|
121
|
+
* not normalizable)). Note that when LiteralLabel values are formatted as an
|
|
122
|
+
* EncodedLabelHash they do NOT symbolically represent the encoding of a
|
|
123
|
+
* LabelHash literal, or
|
|
124
|
+
* - containing other unnormalized characters such as null bytes or other characters
|
|
125
|
+
* not suitable for display.
|
|
126
|
+
*
|
|
127
|
+
* @see https://ensnode.io/docs/reference/terminology#literal-name
|
|
128
|
+
* @dev nominally typed to enforce usage & enhance codebase clarity
|
|
129
|
+
*/
|
|
130
|
+
type LiteralName = Name & {
|
|
131
|
+
__brand: "LiteralName";
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* An Interpreted Name is a Name that is entirely composed of 0 or more Interpreted Labels.
|
|
135
|
+
*
|
|
136
|
+
* That is, it is either:
|
|
137
|
+
* a) a Normalized Name, or
|
|
138
|
+
* b) an Unnormalizable Name exclusively for the reason that it contains 1 or
|
|
139
|
+
* more labels formatted as Encoded LabelHashes that should be interpreted
|
|
140
|
+
* as encoding a LabelHash literal, where the encoded LabelHash literal is
|
|
141
|
+
* the `labelhash` of the related LiteralLabel.
|
|
142
|
+
*
|
|
143
|
+
* @see https://ensnode.io/docs/reference/terminology#interpreted-name
|
|
144
|
+
* @dev nominally typed to enforce usage & enhance codebase clarity
|
|
145
|
+
*/
|
|
146
|
+
type InterpretedName = Name & {
|
|
147
|
+
__brand: "InterpretedName";
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* A Subgraph Interpreted Label is a Literal Label that is either:
|
|
151
|
+
* a) (if subgraph-indexable): a Literal Label, of unknown normalization status, guaranteed to not
|
|
152
|
+
* contain any of the subgraph-unindexable UTF-8 characters (and therefore guaranteed not to be
|
|
153
|
+
* an Encoded LabelHash), or
|
|
154
|
+
* b) (if subgraph-unindexable): an Encoded LabelHash.
|
|
155
|
+
*
|
|
156
|
+
* @see https://ensnode.io/docs/reference/terminology#subgraph-interpreted-label
|
|
157
|
+
* @dev nominally typed to enforce usage & enhance codebase clarity
|
|
158
|
+
*/
|
|
159
|
+
type SubgraphInterpretedLabel = Label & {
|
|
160
|
+
__brand: "SubgraphInterpretedLabel";
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* A Subgraph Interpreted Name is a name exclusively composed of 0 or more Subgraph Interpreted Labels.
|
|
164
|
+
*
|
|
165
|
+
* @see https://ensnode.io/docs/reference/terminology#subgraph-interpreted-name
|
|
166
|
+
* @dev nominally typed to enforce usage & enhance codebase clarity
|
|
167
|
+
*/
|
|
168
|
+
type SubgraphInterpretedName = Name & {
|
|
169
|
+
__brand: "SubgraphInterpretedName";
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* A DNS-Encoded Name as a hex string, representing the binary DNS wire format encoding
|
|
173
|
+
* of a domain name. Used in ENS contracts for efficient name storage and transmission.
|
|
174
|
+
* Each label is prefixed with a length byte, and the entire sequence is null-terminated.
|
|
175
|
+
*
|
|
176
|
+
* @example "0x076578616d706c650365746800" represents "example.eth"
|
|
177
|
+
*
|
|
178
|
+
* @see https://docs.ens.domains/resolution/names/#dns-encoding
|
|
179
|
+
* @see https://github.com/ensdomains/ens-contracts/blob/staging/contracts/utils/NameCoder.sol
|
|
180
|
+
*
|
|
181
|
+
* DNS Packet Format for Domain Names:
|
|
182
|
+
* - Domain names are encoded as a sequence of 0 or more labels
|
|
183
|
+
* - Each label begins with a length byte (1 byte) indicating how many bytes follow for that label
|
|
184
|
+
* Note how this constrains each label in DNS encoded names to a max byte length of 255 bytes.
|
|
185
|
+
* - The bytes after the length byte represent the label, as a UTF-8 byte array
|
|
186
|
+
* - Labels are concatenated with no separators
|
|
187
|
+
* - The sequence ends with a null byte (0x00)
|
|
188
|
+
*
|
|
189
|
+
* Example: "example.eth" is encoded as:
|
|
190
|
+
* [0x07, 'e', 'x', 'a', 'm', 'p', 'l', 'e', 0x03, 'e', 't', 'h', 0x00]
|
|
191
|
+
* Where 0x07 is the length of "example", 0x03 is the length of "eth", and 0x00 marks the end
|
|
192
|
+
*
|
|
193
|
+
* Example: "" (empty string, i.e. root node) is encoded as:
|
|
194
|
+
* [0x00]
|
|
195
|
+
*
|
|
196
|
+
* Example: "👩🏼❤💋👨🏼.eth" (multi-byte unicode character) is encoded as:
|
|
197
|
+
* [0x20, 240, 159, 145, 169, 240, 159, 143, 188, 226, 128, 141, 226, 157, 164, 226,
|
|
198
|
+
* 128, 141, 240, 159, 146, 139, 226, 128, 141, 240, 159, 145, 168, 240, 159, 143,
|
|
199
|
+
* 188, 3, 'e', 't', 'h', 0x00]
|
|
200
|
+
*
|
|
201
|
+
* A DNS-Encoded Name Packet may be malformed if it does not exactly follow that specification.
|
|
202
|
+
* Possible reasons a DNS-Encoded Name may be malfomed include:
|
|
203
|
+
* - 'empty' packet
|
|
204
|
+
* - e.g. []
|
|
205
|
+
* ^-- that's empty!
|
|
206
|
+
* - 'length' byte overflowing packet byte length
|
|
207
|
+
* - e.g. [0x06, 'e', 't', 'h', 0x00]
|
|
208
|
+
* ^-- length overflows available bytes!
|
|
209
|
+
* - 'junk' at the end of the dns-encoded
|
|
210
|
+
* - e.g. [0x03, 'e', 't', 'h', 0x00, 0x01]
|
|
211
|
+
* ^-- junk!
|
|
212
|
+
*
|
|
213
|
+
* @dev This type is _structurally_ typed to aid Event Argument Typing — consumers should further
|
|
214
|
+
* cast the type of the event argument to a _nominally_ typed DNSEncodedName like {@link DNSEncodedLiteralName}
|
|
215
|
+
* or {@link DNSEncodedPartiallyInterpretedName} depending on the context.
|
|
216
|
+
*/
|
|
217
|
+
type DNSEncodedName = Hex;
|
|
218
|
+
/**
|
|
219
|
+
* A DNSEncodedName that encodes a name containing 0 or more {@link LiteralLabel}s.
|
|
220
|
+
*
|
|
221
|
+
* In a DNSEncodedLiteralName, all labels are Literal Labels, including any Encoded-LabelHash-looking
|
|
222
|
+
* labels. Any Encoded-LabelHash-looking Literal Label values, when interpreted, will be formatted as
|
|
223
|
+
* the `labelhash` of the Literal Label value.
|
|
224
|
+
*
|
|
225
|
+
* The NameWrapper contract emits DNSEncodedLiteralNames:
|
|
226
|
+
* @see https://github.com/ensdomains/ens-contracts/blob/staging/contracts/utils/BytesUtils_LEGACY.sol
|
|
227
|
+
*
|
|
228
|
+
* The ThreeDNSToken contract emits DNSEncodedLiteralNames:
|
|
229
|
+
* @see https://github.com/3dns-xyz/contracts/blob/44937318ae26cc036982e8c6a496cd82ebdc2b12/src/regcontrol/libraries/BytesUtils.sol
|
|
230
|
+
*
|
|
231
|
+
* @dev nominally typed to enforce usage & enhance codebase clarity
|
|
232
|
+
*/
|
|
233
|
+
type DNSEncodedLiteralName = DNSEncodedName & {
|
|
234
|
+
__brand: "DNSEncodedLiteralName";
|
|
235
|
+
};
|
|
236
|
+
/**
|
|
237
|
+
* A DNSEncodedName that encodes a name consisting of 0 or more labels that are either:
|
|
238
|
+
* a) Literal Labels, or
|
|
239
|
+
* b) Encoded LabelHashes, which are already an Interpreted Label.
|
|
240
|
+
*
|
|
241
|
+
* In a DNSEncodedPartiallyInterpretedName, any Encoded-LabelHash-looking decoded Labels (i.e. ones
|
|
242
|
+
* that match the regex /^\[[\da-f]{64}\]$/) represent an Encoded LabelHash. When decoding a
|
|
243
|
+
* DNSEncodedPartiallyInterpretedName, these labels are already considered Interpreted.
|
|
244
|
+
*
|
|
245
|
+
* NOTE: This type is unused in ENSv1, but its usage is anticipated in ENSv2 due to Encoded
|
|
246
|
+
* LabelHash support in the ENSv2 implementation of the NameCoder contract.
|
|
247
|
+
*
|
|
248
|
+
* @see https://github.com/ensdomains/ens-contracts/blob/staging/contracts/utils/NameCoder.sol
|
|
249
|
+
*
|
|
250
|
+
* @dev nominally typed to enforce usage & enhance codebase clarity
|
|
251
|
+
*/
|
|
252
|
+
type DNSEncodedPartiallyInterpretedName = DNSEncodedName & {
|
|
253
|
+
__brand: "DNSEncodedPartiallyInterpretedName";
|
|
254
|
+
};
|
|
46
255
|
|
|
47
|
-
declare const ROOT_NODE: Node;
|
|
48
|
-
declare const ETH_NODE: `0x${string}`;
|
|
49
|
-
declare const BASENAMES_NODE: `0x${string}`;
|
|
50
|
-
declare const LINEANAMES_NODE: `0x${string}`;
|
|
51
256
|
/**
|
|
52
|
-
*
|
|
257
|
+
* Determines whether the Name is normalized.
|
|
258
|
+
*
|
|
259
|
+
* @param name - The Name to check for normalization
|
|
260
|
+
* @returns True if the name is normalized according to ENS normalization rules, false otherwise
|
|
261
|
+
*/
|
|
262
|
+
declare function isNormalizedName(name: Name): name is NormalizedName;
|
|
263
|
+
/**
|
|
264
|
+
* Determines whether the Label is normalized.
|
|
53
265
|
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
266
|
+
* @param label - The Label to check for normalization
|
|
267
|
+
* @returns True if the label is normalized according to ENS normalization rules, false otherwise
|
|
56
268
|
*/
|
|
57
|
-
declare
|
|
269
|
+
declare function isNormalizedLabel(label: Label): boolean;
|
|
58
270
|
|
|
59
271
|
/**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
272
|
+
* The ETH coinType.
|
|
273
|
+
*
|
|
274
|
+
* @see https://docs.ens.domains/ensip/9
|
|
63
275
|
*/
|
|
64
|
-
declare const
|
|
276
|
+
declare const ETH_COIN_TYPE: CoinType;
|
|
65
277
|
/**
|
|
66
|
-
*
|
|
278
|
+
* The 'default' chainId corresponding to the below {@link DEFAULT_EVM_COIN_TYPE} in the context of
|
|
279
|
+
* ENSIP-19.
|
|
67
280
|
*
|
|
68
|
-
* @
|
|
69
|
-
|
|
281
|
+
* @see https://docs.ens.domains/ensip/19
|
|
282
|
+
*/
|
|
283
|
+
declare const DEFAULT_EVM_CHAIN_ID = 0;
|
|
284
|
+
/**
|
|
285
|
+
* ENSIP-19 EVM CoinType representing the 'default' coinType for EVM chains in ENS.
|
|
70
286
|
*
|
|
71
|
-
* @
|
|
287
|
+
* @see https://docs.ens.domains/ensip/19/#reverse-resolution
|
|
72
288
|
*/
|
|
73
|
-
declare const
|
|
74
|
-
/** The address that is possibly associated with the addr.reverse subname */
|
|
75
|
-
maybeReverseAddress: Address;
|
|
76
|
-
/** The labelhash of the addr.reverse subname */
|
|
77
|
-
labelHash: LabelHash;
|
|
78
|
-
}) => string | null;
|
|
289
|
+
declare const DEFAULT_EVM_COIN_TYPE: EvmCoinType;
|
|
79
290
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
291
|
+
* Converts a CoinType to an EVM Chain Id.
|
|
292
|
+
*
|
|
293
|
+
* NOTE: for whatever reason @ensdomains/address-encoder#coinTypeToEvmChainId doesn't handle the
|
|
294
|
+
* mainnet case so we implement that here
|
|
295
|
+
*
|
|
296
|
+
* @see https://docs.ens.domains/ensip/11/
|
|
84
297
|
*/
|
|
85
|
-
declare const
|
|
298
|
+
declare const coinTypeToEvmChainId: (coinType: CoinType) => ChainId;
|
|
86
299
|
/**
|
|
87
|
-
*
|
|
300
|
+
* Converts an EVM Chain Id to a CoinType.
|
|
88
301
|
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
302
|
+
* NOTE: for whatever reason @ensdomains/address-encoder#evmChainIdToCoinType doesn't handle the
|
|
303
|
+
* mainnet case so we implement that here
|
|
304
|
+
*/
|
|
305
|
+
declare const evmChainIdToCoinType: (chainId: ChainId) => CoinType;
|
|
306
|
+
/**
|
|
307
|
+
* Converts a bigint value representing a CoinType into a valid CoinType.
|
|
91
308
|
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
309
|
+
* This is useful when onchain events emit coinTypes as bigint but we want to constrain them to
|
|
310
|
+
* the CoinType type.
|
|
94
311
|
*
|
|
95
|
-
* @
|
|
312
|
+
* @throws if `value` is too large to fit in Number.MAX_SAFE_INTEGER
|
|
96
313
|
*/
|
|
97
|
-
declare const
|
|
314
|
+
declare const bigintToCoinType: (value: bigint) => CoinType;
|
|
315
|
+
|
|
316
|
+
declare const ROOT_NODE: Node;
|
|
317
|
+
declare const ETH_NODE: Node;
|
|
318
|
+
declare const BASENAMES_NODE: Node;
|
|
319
|
+
declare const LINEANAMES_NODE: Node;
|
|
320
|
+
declare const ADDR_REVERSE_NODE: Node;
|
|
98
321
|
|
|
99
322
|
/**
|
|
100
|
-
*
|
|
323
|
+
* Decodes a DNS-Encoded name consisting of Literal Labels into an ordered list of Literal Labels.
|
|
324
|
+
*
|
|
325
|
+
* For discussion on DNS-Encoding, see the {@link DNSEncodedName} and {@link DNSEncodedLiteralName} types.
|
|
326
|
+
*
|
|
327
|
+
* Due to the constraints of DNS-Encoding, there is an additional guarantee that each Literal Label
|
|
328
|
+
* in the resulting list is guaranteed to have a maximum byte length of 255.
|
|
329
|
+
*
|
|
330
|
+
* @param packet a hex string that encodes a DNSEncodedLiteralName
|
|
331
|
+
* @returns A list of the LiteralLabels contained in packet
|
|
332
|
+
* @throws If the packet is malformed
|
|
333
|
+
* @dev This is just `decodeDNSEncodedName` with semantic input/output
|
|
101
334
|
*/
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Store a value in the cache with the given key.
|
|
105
|
-
*
|
|
106
|
-
* @param key Cache key
|
|
107
|
-
* @param value Value to store
|
|
108
|
-
*/
|
|
109
|
-
set(key: KeyType, value: ValueType): void;
|
|
110
|
-
/**
|
|
111
|
-
* Retrieve a value from the cache with the given key.
|
|
112
|
-
*
|
|
113
|
-
* @param key Cache key
|
|
114
|
-
* @returns The cached value if it exists, otherwise undefined
|
|
115
|
-
*/
|
|
116
|
-
get(key: KeyType): ValueType | undefined;
|
|
117
|
-
/**
|
|
118
|
-
* Clear the cache.
|
|
119
|
-
*/
|
|
120
|
-
clear(): void;
|
|
121
|
-
/**
|
|
122
|
-
* The current number of items in the cache. Always a non-negative integer.
|
|
123
|
-
*/
|
|
124
|
-
get size(): number;
|
|
125
|
-
/**
|
|
126
|
-
* The maximum number of items in the cache. Always a non-negative integer that is >= size().
|
|
127
|
-
*/
|
|
128
|
-
get capacity(): number;
|
|
129
|
-
}
|
|
335
|
+
declare function decodeDNSEncodedLiteralName(packet: DNSEncodedLiteralName): LiteralLabel[];
|
|
130
336
|
/**
|
|
131
|
-
*
|
|
337
|
+
* Decodes a DNS-Encoded Name into an ordered list of string segments.
|
|
132
338
|
*
|
|
133
|
-
*
|
|
339
|
+
* For discussion on DNS-Encoding, see the {@link DNSEncodedName} type.
|
|
134
340
|
*
|
|
135
|
-
*
|
|
341
|
+
* Due to the constraints of DNS-Encoding, there is an additional guarantee that each segment
|
|
342
|
+
* in the resulting list is guaranteed to have a maximum byte length of 255.
|
|
343
|
+
*
|
|
344
|
+
* @param packet a hex string that encodes a DNSEncodedName
|
|
345
|
+
* @returns A UTF-8 string array of the segments contained in packet
|
|
346
|
+
* @throws If the packet is malformed
|
|
347
|
+
* @dev This is the generic implementation of DNS-Encoded Name Decoding
|
|
136
348
|
*/
|
|
137
|
-
declare
|
|
138
|
-
private readonly _cache;
|
|
139
|
-
private readonly _capacity;
|
|
140
|
-
/**
|
|
141
|
-
* Create a new LRU cache with the given capacity.
|
|
142
|
-
*
|
|
143
|
-
* @param capacity The maximum number of items in the cache. If set to 0, the cache is effectively disabled.
|
|
144
|
-
* @throws Error if capacity is not a non-negative integer.
|
|
145
|
-
*/
|
|
146
|
-
constructor(capacity: number);
|
|
147
|
-
set(key: string, value: ValueType): void;
|
|
148
|
-
get(key: string): ValueType | undefined;
|
|
149
|
-
clear(): void;
|
|
150
|
-
get size(): number;
|
|
151
|
-
get capacity(): number;
|
|
152
|
-
}
|
|
349
|
+
declare function decodeDNSEncodedName(packet: DNSEncodedName): string[];
|
|
153
350
|
|
|
154
351
|
/**
|
|
155
|
-
*
|
|
352
|
+
* Formats a LabelHash as an Encoded LabelHash.
|
|
353
|
+
*
|
|
354
|
+
* @see https://ensnode.io/docs/reference/terminology#encoded-labelhash
|
|
355
|
+
*
|
|
356
|
+
* @param labelHash - A 32-byte lowercase hash string starting with '0x'
|
|
357
|
+
* @returns The encoded label hash in format `[hash_without_0x_prefix]`
|
|
156
358
|
*/
|
|
157
|
-
declare const
|
|
359
|
+
declare const encodeLabelHash: (labelHash: LabelHash) => EncodedLabelHash;
|
|
360
|
+
/**
|
|
361
|
+
* Checks if the input value is an {@link EncodedLabelHash}.
|
|
362
|
+
*/
|
|
363
|
+
declare function isEncodedLabelHash(maybeEncodedLabelHash: string): maybeEncodedLabelHash is EncodedLabelHash;
|
|
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
|
+
* Constructs a name hierarchy from a given NormalizedName.
|
|
374
|
+
*
|
|
375
|
+
* @example
|
|
376
|
+
* ```
|
|
377
|
+
* getNameHierarchy("sub.example.eth") -> ["sub.example.eth", "example.eth", "eth"]
|
|
378
|
+
* ```
|
|
379
|
+
*
|
|
380
|
+
* @dev by restricting the input type to NormalizedName we guarantee that we can split and join
|
|
381
|
+
* on '.' and receive NormalizedNames as a result
|
|
382
|
+
*/
|
|
383
|
+
declare const getNameHierarchy: (name: NormalizedName) => NormalizedName[];
|
|
384
|
+
/**
|
|
385
|
+
* Beautifies a name by converting each normalized label in the provided name to
|
|
386
|
+
* its "beautified" form. Labels that are not normalized retain their original value.
|
|
387
|
+
*
|
|
388
|
+
* Invariants:
|
|
389
|
+
* - The number of labels in the returned name is the same as the number of labels in the input name.
|
|
390
|
+
* - The order of the labels in the returned name is the same as the order of the labels in the input name.
|
|
391
|
+
* - If a label in the input is normalized, it is returned in its "beautified" form.
|
|
392
|
+
* - If a label in the input name is not normalized, it is returned without modification.
|
|
393
|
+
* - Therefore, the result of ens_normalize(beautifyName(name)) is the same as the result of ens_normalize(name).
|
|
394
|
+
*
|
|
395
|
+
* The "beautified form" of a normalized label converts special sequences of
|
|
396
|
+
* emojis and other special characters to their "beautified" equivalents. All
|
|
397
|
+
* such conversions transform X -> Y where Y is normalizable and normalizes back to X.
|
|
398
|
+
* Ex: '1⃣2⃣' (normalized) to '1️⃣2️⃣' (normalizable but not normalized).
|
|
399
|
+
* Ex: 'ξethereum' (normalized) to 'Ξethereum' (normalizable, but not normalized).
|
|
400
|
+
* Ex: 'abc' (normalized) to 'abc' (also normalized, no conversion).
|
|
401
|
+
* Ex: 'ABC' (normalizable but not normalized) to 'ABC' (no conversion).
|
|
402
|
+
* Ex: 'invalid|label' (not normalizable) to 'invalid|label' (no conversion).
|
|
403
|
+
* Ex: '' (unnormalized as a label) to '' (no conversion).
|
|
404
|
+
*
|
|
405
|
+
* @param name - The name to beautify.
|
|
406
|
+
* @returns The beautified name.
|
|
407
|
+
*/
|
|
408
|
+
declare const beautifyName: (name: Name) => Name;
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Parse the address and coinType out of an ENSIP-19 reverse name.
|
|
412
|
+
*/
|
|
413
|
+
declare function parseReverseName(name: Name): {
|
|
414
|
+
address: Address;
|
|
415
|
+
coinType: CoinType;
|
|
416
|
+
} | null;
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Gets the Label used for the reverse names of subnames as per ENSIP-11 & ENSIP-19.
|
|
420
|
+
*
|
|
421
|
+
* @see https://docs.ens.domains/ensip/19/#reverse-resolution
|
|
422
|
+
*/
|
|
423
|
+
declare const addrReverseLabel: (address: Address) => LiteralLabel;
|
|
424
|
+
/**
|
|
425
|
+
* Converts `coinType` to prefix-free hex string.
|
|
426
|
+
*
|
|
427
|
+
* @see https://docs.ens.domains/ensip/19
|
|
428
|
+
*/
|
|
429
|
+
declare const coinTypeReverseLabel: (coinType: CoinType) => Label;
|
|
430
|
+
/**
|
|
431
|
+
* Gets the reverse name for an address according to ENSIP-11 & ENSIP-19.
|
|
432
|
+
*
|
|
433
|
+
* @see https://docs.ens.domains/ensip/11#specification
|
|
434
|
+
* @see https://docs.ens.domains/ensip/19#specification
|
|
435
|
+
*
|
|
436
|
+
* @param address - The address to get the reverse name for
|
|
437
|
+
* @param coinType - The coin type to use for the reverse name
|
|
438
|
+
* @returns The reverse name for the address
|
|
439
|
+
*
|
|
440
|
+
* @example
|
|
441
|
+
* ```ts
|
|
442
|
+
* reverseName("0x1234", BigInt(ETH_COIN_TYPE)) // "1234.addr.reverse"
|
|
443
|
+
* reverseName("0x1234", BigInt(0x80000000)) // "1234.default.reverse"
|
|
444
|
+
* reverseName("0x1234", BigInt(0x5678)) // "1234.5678.reverse"
|
|
445
|
+
* ```
|
|
446
|
+
*/
|
|
447
|
+
declare function reverseName(address: Address, coinType: CoinType): Name;
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* Implements one step of the namehash algorithm, combining `labelHash` with `node` to produce
|
|
451
|
+
* the `node` of a given subdomain. Note that the order of the arguments is 'reversed' (as compared to
|
|
452
|
+
* the actual concatenation) in order to improve readability (i.e. read as [labelHash].[node]).
|
|
453
|
+
*/
|
|
454
|
+
declare const makeSubdomainNode: (labelHash: LabelHash, node: Node) => Node;
|
|
455
|
+
/**
|
|
456
|
+
* Encodes a uint256 bigint as hex string sized to 32 bytes.
|
|
457
|
+
* Uses include, in the context of ENS, decoding the uint256-encoded tokenId of NFT-issuing contracts
|
|
458
|
+
* into Node or LabelHash, which is a common behavior in the ENS ecosystem.
|
|
459
|
+
* (see NameWrapper, ETHRegistrarController)
|
|
460
|
+
*/
|
|
461
|
+
declare const uint256ToHex32: (num: bigint) => Hex;
|
|
158
462
|
|
|
159
463
|
/**
|
|
160
464
|
* Chain ID
|
|
@@ -163,6 +467,17 @@ declare const uniq: <T>(arr: T[]) => T[];
|
|
|
163
467
|
* Guaranteed to be a positive integer.
|
|
164
468
|
**/
|
|
165
469
|
type ChainId = number;
|
|
470
|
+
/**
|
|
471
|
+
* Defaultable Chain ID
|
|
472
|
+
*
|
|
473
|
+
* Represents a unique identifier for a chain, or
|
|
474
|
+
* the default chain as defined by ENSIP-19.
|
|
475
|
+
*
|
|
476
|
+
* @see https://docs.ens.domains/ensip/19/#annex-supported-chains
|
|
477
|
+
*
|
|
478
|
+
* Guaranteed to be a non-negative integer.
|
|
479
|
+
**/
|
|
480
|
+
type DefaultableChainId = typeof DEFAULT_EVM_CHAIN_ID | ChainId;
|
|
166
481
|
/**
|
|
167
482
|
* Represents an account (contract or EOA) at `address` on chain `chainId`.
|
|
168
483
|
*
|
|
@@ -185,7 +500,11 @@ type Datetime = Date;
|
|
|
185
500
|
/**
|
|
186
501
|
* Unix timestamp value
|
|
187
502
|
*
|
|
188
|
-
*
|
|
503
|
+
* Represents the number of seconds that have elapsed
|
|
504
|
+
* since January 1, 1970 (midnight UTC/GMT).
|
|
505
|
+
*
|
|
506
|
+
* Guaranteed to be an integer. May be zero or negative to represent a time at or
|
|
507
|
+
* before Jan 1, 1970.
|
|
189
508
|
*/
|
|
190
509
|
type UnixTimestamp = number;
|
|
191
510
|
/**
|
|
@@ -260,189 +579,396 @@ type DeepPartial<T> = {
|
|
|
260
579
|
};
|
|
261
580
|
|
|
262
581
|
/**
|
|
263
|
-
*
|
|
264
|
-
|
|
265
|
-
|
|
582
|
+
* Determines where the provided AccountId values represent the same address on the same chain.
|
|
583
|
+
*/
|
|
584
|
+
declare const accountIdEqual: (a: AccountId, b: AccountId) => boolean;
|
|
585
|
+
|
|
266
586
|
/**
|
|
267
|
-
*
|
|
587
|
+
* Converts an EVM address to its lowercase representation.
|
|
268
588
|
*
|
|
269
|
-
* @
|
|
589
|
+
* @param address - EVM address to convert.
|
|
590
|
+
* @returns The lowercase representation of the EVM address.
|
|
270
591
|
*/
|
|
271
|
-
|
|
592
|
+
declare function asLowerCaseAddress(address: Address): Address;
|
|
593
|
+
|
|
272
594
|
/**
|
|
273
|
-
*
|
|
595
|
+
* Cache that maps from string -> ValueType.
|
|
274
596
|
*/
|
|
275
|
-
|
|
276
|
-
|
|
597
|
+
interface Cache<KeyType extends string, ValueType> {
|
|
598
|
+
/**
|
|
599
|
+
* Store a value in the cache with the given key.
|
|
600
|
+
*
|
|
601
|
+
* @param key Cache key
|
|
602
|
+
* @param value Value to store
|
|
603
|
+
*/
|
|
604
|
+
set(key: KeyType, value: ValueType): void;
|
|
605
|
+
/**
|
|
606
|
+
* Retrieve a value from the cache with the given key.
|
|
607
|
+
*
|
|
608
|
+
* @param key Cache key
|
|
609
|
+
* @returns The cached value if it exists, otherwise undefined
|
|
610
|
+
*/
|
|
611
|
+
get(key: KeyType): ValueType | undefined;
|
|
612
|
+
/**
|
|
613
|
+
* Clear the cache.
|
|
614
|
+
*/
|
|
615
|
+
clear(): void;
|
|
616
|
+
/**
|
|
617
|
+
* The current number of items in the cache. Always a non-negative integer.
|
|
618
|
+
*/
|
|
619
|
+
get size(): number;
|
|
620
|
+
/**
|
|
621
|
+
* The maximum number of items in the cache. Always a non-negative integer that is >= size().
|
|
622
|
+
*/
|
|
623
|
+
get capacity(): number;
|
|
624
|
+
}
|
|
277
625
|
/**
|
|
278
|
-
*
|
|
626
|
+
* Cache that maps from string -> ValueType with a LRU (least recently used) eviction policy.
|
|
627
|
+
*
|
|
628
|
+
* `get` and `set` are O(1) operations.
|
|
629
|
+
*
|
|
630
|
+
* @link https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU
|
|
279
631
|
*/
|
|
280
|
-
declare
|
|
632
|
+
declare class LruCache<KeyType extends string, ValueType> implements Cache<KeyType, ValueType> {
|
|
633
|
+
private readonly _cache;
|
|
634
|
+
private readonly _capacity;
|
|
635
|
+
/**
|
|
636
|
+
* Create a new LRU cache with the given capacity.
|
|
637
|
+
*
|
|
638
|
+
* @param capacity The maximum number of items in the cache. If set to 0, the cache is effectively disabled.
|
|
639
|
+
* @throws Error if capacity is not a non-negative integer.
|
|
640
|
+
*/
|
|
641
|
+
constructor(capacity: number);
|
|
642
|
+
set(key: string, value: ValueType): void;
|
|
643
|
+
get(key: string): ValueType | undefined;
|
|
644
|
+
clear(): void;
|
|
645
|
+
get size(): number;
|
|
646
|
+
get capacity(): number;
|
|
647
|
+
}
|
|
281
648
|
/**
|
|
282
|
-
*
|
|
649
|
+
* Cache that maps from string -> ValueType with TTL (time-to-live) expiration.
|
|
650
|
+
*
|
|
651
|
+
* Items are automatically removed when they expire.
|
|
283
652
|
*/
|
|
284
|
-
declare
|
|
653
|
+
declare class TtlCache<KeyType extends string, ValueType> implements Cache<KeyType, ValueType> {
|
|
654
|
+
private readonly _cache;
|
|
655
|
+
private readonly _ttl;
|
|
656
|
+
/**
|
|
657
|
+
* Create a new TTL cache with the given TTL.
|
|
658
|
+
*
|
|
659
|
+
* @param ttl Time-to-live duration in seconds. Items expire after this duration.
|
|
660
|
+
*/
|
|
661
|
+
constructor(ttl: Duration);
|
|
662
|
+
private _cleanup;
|
|
663
|
+
set(key: string, value: ValueType): void;
|
|
664
|
+
get(key: string): ValueType | undefined;
|
|
665
|
+
clear(): void;
|
|
666
|
+
get size(): number;
|
|
667
|
+
get capacity(): number;
|
|
668
|
+
has(key: string): boolean;
|
|
669
|
+
delete(key: string): boolean;
|
|
670
|
+
}
|
|
671
|
+
interface StaleWhileRevalidateOptions<ValueType> {
|
|
672
|
+
/**
|
|
673
|
+
* The async function to wrap with SWR caching.
|
|
674
|
+
* On success this function returns a value of type `ValueType` to store in the `SWRCache`.
|
|
675
|
+
* On error, this function throws an error and no changes will be made to the `SWRCache`.
|
|
676
|
+
*/
|
|
677
|
+
fn: () => Promise<ValueType>;
|
|
678
|
+
/**
|
|
679
|
+
* Time-to-live duration in seconds. After this duration, data in the `SWRCache` is
|
|
680
|
+
* considered stale but is still retained in the cache until replaced with a new value.
|
|
681
|
+
*/
|
|
682
|
+
ttl: Duration;
|
|
683
|
+
}
|
|
285
684
|
/**
|
|
286
|
-
*
|
|
685
|
+
* Stale-While-Revalidate (SWR) cache wrapper for async functions.
|
|
686
|
+
*
|
|
687
|
+
* This caching strategy serves cached data immediately (even if stale) while
|
|
688
|
+
* asynchronously revalidating the cache in the background. This provides:
|
|
689
|
+
* - Sub-millisecond response times (after first fetch)
|
|
690
|
+
* - Always available data (serves stale data during revalidation)
|
|
691
|
+
* - Automatic background updates (currently only triggered lazily when new requests
|
|
692
|
+
* are made for the cached data after it becomes stale)
|
|
693
|
+
*
|
|
694
|
+
* Error Handling:
|
|
695
|
+
* - If a new invocation of the provided `fn` throws an error and a cached value exists
|
|
696
|
+
* from a previous successfully invocation of the provided `fn`, the stale cached value is returned.
|
|
697
|
+
* - If a new invocation of the provided `fn` throws an error and NO cached value exists,
|
|
698
|
+
* from any prior invocations of the provided `fn`, such that the provided `fn` has never
|
|
699
|
+
* successfully returned a value for the lifetime of the `SWRCache`, then `null` is returned.
|
|
700
|
+
* - Therefore, errors occuring within the provided `fn` are handled internally within
|
|
701
|
+
* `staleWhileRevalidate` and do not propagate to the caller.
|
|
702
|
+
*
|
|
703
|
+
* @example
|
|
704
|
+
* ```typescript
|
|
705
|
+
* const fetchExpensiveData = async () => {
|
|
706
|
+
* const response = await fetch('/api/data');
|
|
707
|
+
* return response.json();
|
|
708
|
+
* };
|
|
709
|
+
*
|
|
710
|
+
* const cachedFetch = staleWhileRevalidate(fetchExpensiveData, 60); // 60 second TTL
|
|
711
|
+
*
|
|
712
|
+
* // First call: fetches data (slow)
|
|
713
|
+
* const data1 = await cachedFetch();
|
|
714
|
+
*
|
|
715
|
+
* // Within TTL: returns cached data (fast)
|
|
716
|
+
* const data2 = await cachedFetch();
|
|
717
|
+
*
|
|
718
|
+
* // After TTL: returns stale data immediately, revalidates asynchronously in the background
|
|
719
|
+
* const data3 = await cachedFetch(); // Still fast!
|
|
720
|
+
* ```
|
|
721
|
+
*
|
|
722
|
+
* @param fn The async function to wrap with SWR caching
|
|
723
|
+
* @param ttl Time-to-live duration in seconds. After this duration, data is considered stale
|
|
724
|
+
* @returns a value of `ValueType` that was most recently successfully returned by `fn`
|
|
725
|
+
* or `null` if `fn` has never successfully returned and has always thrown an error.
|
|
726
|
+
*
|
|
727
|
+
* @link https://web.dev/stale-while-revalidate/
|
|
728
|
+
* @link https://datatracker.ietf.org/doc/html/rfc5861
|
|
287
729
|
*/
|
|
288
|
-
declare function
|
|
730
|
+
declare function staleWhileRevalidate<ValueType>(options: StaleWhileRevalidateOptions<ValueType>): () => Promise<ValueType | null>;
|
|
289
731
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
declare
|
|
294
|
-
declare function deserializeBlockrange(maybeBlockrange: Partial<Blockrange>, valueLabel?: string): {
|
|
295
|
-
startBlock?: number | undefined;
|
|
296
|
-
endBlock?: number | undefined;
|
|
297
|
-
};
|
|
298
|
-
declare function deserializeBlockRef(maybeBlockRef: Partial<BlockRef>, valueLabel?: string): BlockRef;
|
|
299
|
-
declare function deserializeDuration(maybeDuration: string, valueLabel?: string): Duration;
|
|
732
|
+
/**
|
|
733
|
+
* Filter out duplicates.
|
|
734
|
+
*/
|
|
735
|
+
declare const uniq: <T>(arr: T[]) => T[];
|
|
300
736
|
|
|
301
737
|
/**
|
|
302
|
-
*
|
|
738
|
+
* Identifiers for supported currencies.
|
|
303
739
|
*
|
|
304
|
-
*
|
|
305
|
-
* @returns True if the name is normalized according to ENS normalization rules, false otherwise
|
|
740
|
+
* TODO: Add support for WETH
|
|
306
741
|
*/
|
|
307
|
-
declare
|
|
742
|
+
declare const CurrencyIds: {
|
|
743
|
+
readonly ETH: "ETH";
|
|
744
|
+
readonly USDC: "USDC";
|
|
745
|
+
readonly DAI: "DAI";
|
|
746
|
+
};
|
|
747
|
+
type CurrencyId = (typeof CurrencyIds)[keyof typeof CurrencyIds];
|
|
308
748
|
/**
|
|
309
|
-
*
|
|
749
|
+
* The amount of the currency in the smallest unit of the currency
|
|
750
|
+
* (see {@link CurrencyInfo.decimals} for the currency).
|
|
310
751
|
*
|
|
311
|
-
*
|
|
312
|
-
* @returns True if the label is normalized according to ENS normalization rules, false otherwise
|
|
752
|
+
* Guaranteed to be non-negative.
|
|
313
753
|
*/
|
|
314
|
-
|
|
754
|
+
type CurrencyAmount = bigint;
|
|
755
|
+
/**
|
|
756
|
+
* Serialized representation of {@link CurrencyAmount}.
|
|
757
|
+
*/
|
|
758
|
+
type SerializedCurrencyAmount = string;
|
|
759
|
+
interface PriceEth {
|
|
760
|
+
currency: typeof CurrencyIds.ETH;
|
|
761
|
+
amount: CurrencyAmount;
|
|
762
|
+
}
|
|
763
|
+
interface PriceDai {
|
|
764
|
+
currency: typeof CurrencyIds.DAI;
|
|
765
|
+
amount: CurrencyAmount;
|
|
766
|
+
}
|
|
767
|
+
interface PriceUsdc {
|
|
768
|
+
currency: typeof CurrencyIds.USDC;
|
|
769
|
+
amount: CurrencyAmount;
|
|
770
|
+
}
|
|
771
|
+
type Price = PriceEth | PriceDai | PriceUsdc;
|
|
772
|
+
/**
|
|
773
|
+
* Serialized representation of {@link PriceEth}.
|
|
774
|
+
*/
|
|
775
|
+
interface SerializedPriceEth extends Omit<PriceEth, "amount"> {
|
|
776
|
+
amount: SerializedCurrencyAmount;
|
|
777
|
+
}
|
|
778
|
+
/**
|
|
779
|
+
* Serialized representation of {@link PriceDai}.
|
|
780
|
+
*/
|
|
781
|
+
interface SerializedPriceDai extends Omit<PriceDai, "amount"> {
|
|
782
|
+
amount: SerializedCurrencyAmount;
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* Serialized representation of {@link PriceUsdc}.
|
|
786
|
+
*/
|
|
787
|
+
interface SerializedPriceUsdc extends Omit<PriceUsdc, "amount"> {
|
|
788
|
+
amount: SerializedCurrencyAmount;
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* Serialized representation of {@link Price}.
|
|
792
|
+
*/
|
|
793
|
+
type SerializedPrice = SerializedPriceEth | SerializedPriceDai | SerializedPriceUsdc;
|
|
794
|
+
interface CurrencyInfo {
|
|
795
|
+
id: CurrencyId;
|
|
796
|
+
name: string;
|
|
797
|
+
decimals: number;
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* Get currency info for a provided currency.
|
|
801
|
+
*/
|
|
802
|
+
declare function getCurrencyInfo(currencyId: CurrencyId): CurrencyInfo;
|
|
803
|
+
/**
|
|
804
|
+
* Create price in ETH for given amount.
|
|
805
|
+
*/
|
|
806
|
+
declare function priceEth(amount: Price["amount"]): PriceEth;
|
|
807
|
+
/**
|
|
808
|
+
* Create price in USDC for given amount.
|
|
809
|
+
*/
|
|
810
|
+
declare function priceUsdc(amount: Price["amount"]): PriceUsdc;
|
|
811
|
+
/**
|
|
812
|
+
* Create price in DAI for given amount.
|
|
813
|
+
*/
|
|
814
|
+
declare function priceDai(amount: Price["amount"]): PriceDai;
|
|
815
|
+
/**
|
|
816
|
+
* Check if two prices have the same currency.
|
|
817
|
+
*/
|
|
818
|
+
declare function isPriceCurrencyEqual(priceA: Price, priceB: Price): boolean;
|
|
819
|
+
/**
|
|
820
|
+
* Check if two {@link Price} values have the same currency and amount.
|
|
821
|
+
*/
|
|
822
|
+
declare function isPriceEqual(priceA: Price, priceB: Price): boolean;
|
|
823
|
+
/**
|
|
824
|
+
* Add prices
|
|
825
|
+
*
|
|
826
|
+
* @param prices at least two {@link Price} values to be added together.
|
|
827
|
+
* @returns total of all prices.
|
|
828
|
+
* @throws if not all prices have the same currency.
|
|
829
|
+
*/
|
|
830
|
+
declare function addPrices<const PriceType extends Price = Price>(...prices: [PriceType, PriceType, ...PriceType[]]): PriceType;
|
|
315
831
|
|
|
316
832
|
/**
|
|
317
|
-
*
|
|
833
|
+
* Duration between two moments in time.
|
|
318
834
|
*/
|
|
319
|
-
declare
|
|
835
|
+
declare function durationBetween(start: UnixTimestamp, end: UnixTimestamp): Duration;
|
|
836
|
+
/**
|
|
837
|
+
* Add a duration to a timestamp.
|
|
838
|
+
*/
|
|
839
|
+
declare function addDuration(timestamp: UnixTimestamp, duration: Duration): UnixTimestamp;
|
|
320
840
|
|
|
321
841
|
/**
|
|
322
|
-
*
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
842
|
+
* Serialized representation of {@link ChainId}.
|
|
843
|
+
**/
|
|
844
|
+
type ChainIdString = string;
|
|
845
|
+
/**
|
|
846
|
+
* Datetime value following the ISO 8601 standard.
|
|
326
847
|
*
|
|
327
|
-
* @
|
|
328
|
-
* @returns The provided label if it is normalized, else the EncodedLabelHash of the label
|
|
848
|
+
* @see https://www.iso.org/iso-8601-date-and-time-format.html
|
|
329
849
|
*/
|
|
330
|
-
|
|
850
|
+
type DatetimeISO8601 = string;
|
|
331
851
|
/**
|
|
332
|
-
*
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
852
|
+
* Serialized representation of a {@link URL}.
|
|
853
|
+
*/
|
|
854
|
+
type UrlString = string;
|
|
855
|
+
/**
|
|
856
|
+
* Serialized representation of {@link AccountId}.
|
|
336
857
|
*
|
|
337
|
-
*
|
|
338
|
-
* then the empty string labels will be Interpreted. Empty-string is not a normalizable name, so the
|
|
339
|
-
* label will be replaced with its Encoded LabelHash representation (i.e. )
|
|
858
|
+
* Formatted as a fully lowercase CAIP-10 AccountId.
|
|
340
859
|
*
|
|
341
|
-
* @
|
|
342
|
-
* @returns The provided name if it is normalized, else converts each label in name that is not a
|
|
343
|
-
* normalized label into an Interpreted Label
|
|
860
|
+
* @see https://chainagnostic.org/CAIPs/caip-10
|
|
344
861
|
*/
|
|
345
|
-
|
|
862
|
+
type SerializedAccountId = string;
|
|
863
|
+
|
|
864
|
+
declare function deserializeChainId(maybeChainId: ChainIdString, valueLabel?: string): ChainId;
|
|
865
|
+
declare function deserializeDatetime(maybeDatetime: string, valueLabel?: string): Datetime;
|
|
866
|
+
declare function deserializeUnixTimestamp(maybeTimestamp: number, valueLabel?: string): number;
|
|
867
|
+
declare function deserializeUrl(maybeUrl: UrlString, valueLabel?: string): URL;
|
|
868
|
+
declare function deserializeBlockNumber(maybeBlockNumber: number, valueLabel?: string): BlockNumber;
|
|
869
|
+
declare function deserializeBlockrange(maybeBlockrange: Partial<Blockrange>, valueLabel?: string): {
|
|
870
|
+
startBlock?: number | undefined;
|
|
871
|
+
endBlock?: number | undefined;
|
|
872
|
+
};
|
|
873
|
+
declare function deserializeBlockRef(maybeBlockRef: Partial<BlockRef>, valueLabel?: string): BlockRef;
|
|
874
|
+
declare function deserializeDuration(maybeDuration: unknown, valueLabel?: string): Duration;
|
|
875
|
+
declare function deserializeAccountId(maybeAccountId: unknown, valueLabel?: string): AccountId;
|
|
346
876
|
|
|
347
877
|
/**
|
|
348
|
-
*
|
|
878
|
+
* Interprets a Literal Label, producing an Interpreted Label.
|
|
349
879
|
*
|
|
350
|
-
* @see https://
|
|
880
|
+
* @see https://ensnode.io/docs/reference/terminology#literal-label
|
|
881
|
+
* @see https://ensnode.io/docs/reference/terminology#interpreted-label
|
|
882
|
+
*
|
|
883
|
+
* @param label - The Literal Label string to interpret
|
|
884
|
+
* @returns The provided label if it is a normalized label, else the EncodedLabelHash of the label
|
|
351
885
|
*/
|
|
352
|
-
declare
|
|
886
|
+
declare function literalLabelToInterpretedLabel(label: LiteralLabel): InterpretedLabel;
|
|
353
887
|
/**
|
|
354
|
-
*
|
|
355
|
-
* ENSIP-19.
|
|
888
|
+
* Interprets an ordered list of Literal Labels, producing an Interpreted Name.
|
|
356
889
|
*
|
|
357
|
-
*
|
|
890
|
+
* Note that it's important that the Literal Labels are provided as an array, otherwise it's
|
|
891
|
+
* impossible to differentiate between 'a.label.eth' being ['a.label', 'eth'] or ['a', 'label', 'eth'].
|
|
892
|
+
*
|
|
893
|
+
* Note that the input is an ordered list of _Literal_ Labels: in this context, any literal label
|
|
894
|
+
* that is formatted as an Encoded LabelHash will NOT be interpreted as such. Instead it will be
|
|
895
|
+
* interpreted into an Encoded LabelHash that encodes the literal labelhash of the Literal Label.
|
|
896
|
+
*
|
|
897
|
+
* @param labels An ordered list of 0 or more Literal Labels
|
|
898
|
+
* @returns An InterpretedName
|
|
358
899
|
*/
|
|
359
|
-
declare
|
|
900
|
+
declare function literalLabelsToInterpretedName(labels: LiteralLabel[]): InterpretedName;
|
|
360
901
|
/**
|
|
361
|
-
*
|
|
902
|
+
* Joins the list of Interpreted Labels with '.' to form an Interpreted Name.
|
|
362
903
|
*
|
|
363
|
-
* @
|
|
904
|
+
* @param labels An ordered list of 0 or more Interpreted Labels
|
|
905
|
+
* @returns An InterpretedName
|
|
364
906
|
*/
|
|
365
|
-
declare
|
|
907
|
+
declare function interpretedLabelsToInterpretedName(labels: InterpretedLabel[]): InterpretedName;
|
|
366
908
|
/**
|
|
367
|
-
*
|
|
909
|
+
* Joins the list of Literal Labels with '.' to form a Literal Name.
|
|
368
910
|
*
|
|
369
|
-
*
|
|
370
|
-
*
|
|
911
|
+
* Note: LiteralLabel values may contain '.' characters, which will be preserved
|
|
912
|
+
* in the resulting LiteralName. Therefore, the number of labels in the returned
|
|
913
|
+
* LiteralName may be greater than the number of LiteralLabels in the input array.
|
|
371
914
|
*
|
|
372
|
-
* @
|
|
915
|
+
* @param labels An ordered list of 0 or more Literal Labels
|
|
916
|
+
* @returns An LiteralName
|
|
373
917
|
*/
|
|
374
|
-
declare
|
|
918
|
+
declare function literalLabelsToLiteralName(labels: LiteralLabel[]): LiteralName;
|
|
919
|
+
|
|
375
920
|
/**
|
|
376
|
-
*
|
|
921
|
+
* Implements the ENS `labelhash` function for Literal Labels.
|
|
922
|
+
* @see https://docs.ens.domains/ensip/1
|
|
377
923
|
*
|
|
378
|
-
*
|
|
379
|
-
*
|
|
924
|
+
* @param label the Literal Label to hash
|
|
925
|
+
* @returns the hash of the provided label
|
|
926
|
+
* @dev This function is viem/ens#labelhash but without the special-case handling of Encoded LabelHashes.
|
|
380
927
|
*/
|
|
381
|
-
declare const
|
|
928
|
+
declare const labelhashLiteralLabel: (label: LiteralLabel) => LabelHash;
|
|
929
|
+
|
|
930
|
+
declare const hasNullByte: (value: string) => boolean;
|
|
931
|
+
declare const stripNullBytes: (value: string) => string;
|
|
932
|
+
|
|
382
933
|
/**
|
|
383
|
-
* Converts a bigint value
|
|
934
|
+
* Converts a bigint value into a number value.
|
|
384
935
|
*
|
|
385
|
-
*
|
|
386
|
-
*
|
|
387
|
-
*
|
|
388
|
-
* @throws if `value` is too large to fit in Number.MAX_SAFE_INTEGER
|
|
936
|
+
* @throws when value is outside the range of `Number.MIN_SAFE_INTEGER` and
|
|
937
|
+
* `Number.MAX_SAFE_INTEGER`.
|
|
389
938
|
*/
|
|
390
|
-
declare
|
|
939
|
+
declare function bigIntToNumber(n: bigint): number;
|
|
391
940
|
|
|
392
941
|
/**
|
|
393
|
-
*
|
|
394
|
-
* i.e. sub.example.eth -> [sub.example.eth, example.eth, eth]
|
|
942
|
+
* Serializes a {@link ChainId} value into its string representation.
|
|
395
943
|
*/
|
|
396
|
-
declare
|
|
397
|
-
|
|
944
|
+
declare function serializeChainId(chainId: ChainId): ChainIdString;
|
|
398
945
|
/**
|
|
399
|
-
*
|
|
400
|
-
*
|
|
401
|
-
* @see https://docs.ens.domains/ensip/19/#reverse-resolution
|
|
946
|
+
* Serializes a {@link Datetime} value into its string representation.
|
|
402
947
|
*/
|
|
403
|
-
declare
|
|
948
|
+
declare function serializeDatetime(datetime: Datetime): DatetimeISO8601;
|
|
404
949
|
/**
|
|
405
|
-
*
|
|
406
|
-
*
|
|
407
|
-
* @see https://docs.ens.domains/ensip/19
|
|
950
|
+
* Serializes a {@link URL} value into its string representation.
|
|
408
951
|
*/
|
|
409
|
-
declare
|
|
952
|
+
declare function serializeUrl(url: URL): UrlString;
|
|
410
953
|
/**
|
|
411
|
-
*
|
|
412
|
-
*
|
|
413
|
-
* @see https://docs.ens.domains/ensip/11#specification
|
|
414
|
-
* @see https://docs.ens.domains/ensip/19#specification
|
|
415
|
-
*
|
|
416
|
-
* @param address - The address to get the reverse name for
|
|
417
|
-
* @param coinType - The coin type to use for the reverse name
|
|
418
|
-
* @returns The reverse name for the address
|
|
419
|
-
*
|
|
420
|
-
* @example
|
|
421
|
-
* ```ts
|
|
422
|
-
* reverseName("0x1234", BigInt(ETH_COIN_TYPE)) // "1234.addr.reverse"
|
|
423
|
-
* reverseName("0x1234", BigInt(0x80000000)) // "1234.default.reverse"
|
|
424
|
-
* reverseName("0x1234", BigInt(0x5678)) // "1234.5678.reverse"
|
|
425
|
-
* ```
|
|
954
|
+
* Serializes a {@link Price} object.
|
|
426
955
|
*/
|
|
427
|
-
declare function
|
|
428
|
-
|
|
956
|
+
declare function serializePrice(price: Price): SerializedPrice;
|
|
429
957
|
/**
|
|
430
|
-
*
|
|
958
|
+
* Serializes a {@link PriceEth} object.
|
|
431
959
|
*/
|
|
432
|
-
declare function
|
|
433
|
-
address: Address;
|
|
434
|
-
coinType: CoinType;
|
|
435
|
-
} | null;
|
|
436
|
-
|
|
960
|
+
declare function serializePriceEth(price: PriceEth): SerializedPriceEth;
|
|
437
961
|
/**
|
|
438
|
-
*
|
|
962
|
+
* Serializes {@link AccountId} object.
|
|
439
963
|
*
|
|
440
|
-
*
|
|
964
|
+
* Formatted as a fully lowercase CAIP-10 AccountId.
|
|
441
965
|
*
|
|
442
|
-
* @
|
|
443
|
-
* @returns The encoded label hash in format `[hash_without_0x_prefix]`
|
|
966
|
+
* @see https://chainagnostic.org/CAIPs/caip-10
|
|
444
967
|
*/
|
|
445
|
-
declare
|
|
968
|
+
declare function serializeAccountId(accountId: AccountId): SerializedAccountId;
|
|
969
|
+
|
|
970
|
+
declare function isHttpProtocol(url: URL): boolean;
|
|
971
|
+
declare function isWebSocketProtocol(url: URL): boolean;
|
|
446
972
|
|
|
447
973
|
/**
|
|
448
974
|
* A label set ID identifies a set of labels that can be used for deterministic healing.
|
|
@@ -504,22 +1030,56 @@ declare enum PluginName {
|
|
|
504
1030
|
Basenames = "basenames",
|
|
505
1031
|
Lineanames = "lineanames",
|
|
506
1032
|
ThreeDNS = "threedns",
|
|
507
|
-
|
|
508
|
-
|
|
1033
|
+
ProtocolAcceleration = "protocol-acceleration",
|
|
1034
|
+
Registrars = "registrars",
|
|
509
1035
|
TokenScope = "tokenscope"
|
|
510
1036
|
}
|
|
511
1037
|
/**
|
|
512
|
-
*
|
|
1038
|
+
* Version info about ENSIndexer and its dependencies.
|
|
513
1039
|
*/
|
|
514
|
-
interface
|
|
515
|
-
/**
|
|
1040
|
+
interface ENSIndexerVersionInfo {
|
|
1041
|
+
/**
|
|
1042
|
+
* Node.js runtime version
|
|
1043
|
+
*
|
|
1044
|
+
* @see https://nodejs.org/en/about/previous-releases
|
|
1045
|
+
**/
|
|
516
1046
|
nodejs: string;
|
|
517
|
-
/**
|
|
1047
|
+
/**
|
|
1048
|
+
* Ponder framework version
|
|
1049
|
+
*
|
|
1050
|
+
* @see https://www.npmjs.com/package/ponder
|
|
1051
|
+
**/
|
|
518
1052
|
ponder: string;
|
|
519
|
-
/**
|
|
1053
|
+
/**
|
|
1054
|
+
* ENSDb service version
|
|
1055
|
+
*
|
|
1056
|
+
* Guaranteed to be the same as {@link ENSIndexerVersionInfo.ensIndexer}.
|
|
1057
|
+
* */
|
|
1058
|
+
ensDb: string;
|
|
1059
|
+
/**
|
|
1060
|
+
* ENSIndexer service version
|
|
1061
|
+
*
|
|
1062
|
+
* @see https://ghcr.io/namehash/ensnode/ensindexer
|
|
1063
|
+
**/
|
|
1064
|
+
ensIndexer: string;
|
|
1065
|
+
/**
|
|
1066
|
+
* ENSRainbow service version
|
|
1067
|
+
*
|
|
1068
|
+
* @see https://ghcr.io/namehash/ensnode/ensindexer
|
|
1069
|
+
**/
|
|
520
1070
|
ensRainbow: string;
|
|
521
|
-
/**
|
|
1071
|
+
/**
|
|
1072
|
+
* ENSRainbow schema version
|
|
1073
|
+
**/
|
|
522
1074
|
ensRainbowSchema: number;
|
|
1075
|
+
/**
|
|
1076
|
+
* ENS Normalize package version
|
|
1077
|
+
*
|
|
1078
|
+
* Available on NPM as: `@adraffy/ens-normalize`
|
|
1079
|
+
*
|
|
1080
|
+
* @see https://www.npmjs.com/package/@adraffy/ens-normalize
|
|
1081
|
+
**/
|
|
1082
|
+
ensNormalize: string;
|
|
523
1083
|
}
|
|
524
1084
|
/**
|
|
525
1085
|
* Complete public configuration object for ENSIndexer.
|
|
@@ -534,24 +1094,6 @@ interface ENSIndexerPublicConfig {
|
|
|
534
1094
|
* See {@link ENSNamespaceIds} for available namespace identifiers.
|
|
535
1095
|
*/
|
|
536
1096
|
namespace: ENSNamespaceId;
|
|
537
|
-
/**
|
|
538
|
-
* An ENSAdmin URL
|
|
539
|
-
*
|
|
540
|
-
* The ENSNode root api route `/` redirects to {@link ensAdminUrl},
|
|
541
|
-
* configuring ENSAdmin with an entry for this instance of ENSNode,
|
|
542
|
-
* identified by {@link ensNodePublicUrl}.
|
|
543
|
-
*
|
|
544
|
-
* @see https://ensnode.io/ensadmin/overview/what-is-ensadmin
|
|
545
|
-
*/
|
|
546
|
-
ensAdminUrl: URL;
|
|
547
|
-
/**
|
|
548
|
-
* The publicly accessible endpoint of the ENSNode API
|
|
549
|
-
* (ex: http://localhost:42069).
|
|
550
|
-
*
|
|
551
|
-
* ENSAdmin will use this url to connect to the ENSNode api for querying
|
|
552
|
-
* state about the ENSNode instance.
|
|
553
|
-
*/
|
|
554
|
-
ensNodePublicUrl: URL;
|
|
555
1097
|
/**
|
|
556
1098
|
* 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.
|
|
557
1099
|
*/
|
|
@@ -566,234 +1108,100 @@ interface ENSIndexerPublicConfig {
|
|
|
566
1108
|
*/
|
|
567
1109
|
databaseSchemaName: string;
|
|
568
1110
|
/**
|
|
569
|
-
* A set of
|
|
1111
|
+
* A set of strings referring to the names of plugins that are active.
|
|
1112
|
+
*
|
|
1113
|
+
* For future-proofing, this is a list of strings that may or may
|
|
1114
|
+
* not be currently valid {@link PluginName} values.
|
|
570
1115
|
*
|
|
571
1116
|
* Invariants:
|
|
572
|
-
* - A set of
|
|
1117
|
+
* - A set of strings with at least one value.
|
|
573
1118
|
*/
|
|
574
|
-
plugins:
|
|
1119
|
+
plugins: string[];
|
|
575
1120
|
/**
|
|
576
|
-
*
|
|
577
|
-
*
|
|
578
|
-
*
|
|
1121
|
+
* Indexed Chain IDs
|
|
1122
|
+
*
|
|
1123
|
+
* Includes the {@link ChainId} for each chain being indexed.
|
|
579
1124
|
*/
|
|
580
|
-
|
|
1125
|
+
indexedChainIds: Set<ChainId>;
|
|
581
1126
|
/**
|
|
582
|
-
*
|
|
583
|
-
* If this is set to false, ENSIndexer will apply subgraph-backwards
|
|
584
|
-
* compatible logic that only tracks the keys of Resolver records.
|
|
585
|
-
* If this is set to true, ENSIndexer will track both the keys and the values
|
|
586
|
-
* of Resolver records.
|
|
1127
|
+
* A feature flag to enable/disable ENSIndexer's Subgraph Compatible Indexing Behavior.
|
|
587
1128
|
*
|
|
588
|
-
*
|
|
589
|
-
*
|
|
590
|
-
* values are equivalent to the resolver record values that would be returned
|
|
591
|
-
* through dynamic lookups via the ENS protocol. For example, if a resolver
|
|
592
|
-
* implements CCIP-Read, the resolver records may not be discoverable through
|
|
593
|
-
* onchain indexing. This feature is under R&D. At this time we do not
|
|
594
|
-
* recommend anyone directly use indexed resolver record values in their
|
|
595
|
-
* applications. Features are planned in the ENSNode roadmap that will
|
|
596
|
-
* provide safe use of indexed resolver record values (in appropriate
|
|
597
|
-
* contexts).
|
|
1129
|
+
* If {@link isSubgraphCompatible} is true, indexing behavior will match that of the legacy ENS
|
|
1130
|
+
* Subgraph.
|
|
598
1131
|
*
|
|
599
|
-
*
|
|
600
|
-
*
|
|
601
|
-
*
|
|
602
|
-
*/
|
|
603
|
-
indexAdditionalResolverRecords: boolean;
|
|
604
|
-
/**
|
|
605
|
-
* Controls ENSIndexer's handling of Literal Labels and Literal Names
|
|
606
|
-
* This configuration only applies to the Subgraph datamodel and Subgraph Compatible GraphQL API responses.
|
|
1132
|
+
* ENSIndexer will store and return Literal Labels and Literal Names without further interpretation.
|
|
1133
|
+
* @see https://ensnode.io/docs/reference/terminology#literal-label
|
|
1134
|
+
* @see https://ensnode.io/docs/reference/terminology#literal-name
|
|
607
1135
|
*
|
|
608
|
-
*
|
|
609
|
-
*
|
|
610
|
-
*
|
|
1136
|
+
* If {@link isSubgraphCompatible} is true, the following invariants are true for the ENSIndexerConfig:
|
|
1137
|
+
* 1. only the 'subgraph' plugin is enabled, and
|
|
1138
|
+
* 2. the labelSet must be { labelSetId: 'subgraph', labelSetVersion: 0 }
|
|
611
1139
|
*
|
|
612
|
-
*
|
|
613
|
-
* 1) all Labels stored and returned by ENSIndexer will either be normalized or represented as an Encoded
|
|
614
|
-
* LabelHash, and
|
|
615
|
-
* 2) all Names stored and returned by ENSIndexer will either be normalized or consist of Labels that
|
|
616
|
-
* may be represented as an Encoded LabelHash of the Literal Label value found onchain.
|
|
1140
|
+
* If {@link isSubgraphCompatible} is false, ENSIndexer will additionally:
|
|
617
1141
|
*
|
|
618
|
-
*
|
|
619
|
-
* interpretation.
|
|
620
|
-
* - https://ensnode.io/docs/reference/terminology#literal-label
|
|
621
|
-
* - https://ensnode.io/docs/reference/terminology#literal-name
|
|
1142
|
+
* 1. ENSIndexer will heal all subnames of addr.reverse on the ENS Root Chain.
|
|
622
1143
|
*
|
|
623
|
-
*
|
|
624
|
-
*/
|
|
625
|
-
replaceUnnormalized: boolean;
|
|
626
|
-
/**
|
|
627
|
-
* Indexed Chain IDs
|
|
1144
|
+
* 2. ENSIndexer will track both the keys and the values of Resolver records.
|
|
628
1145
|
*
|
|
629
|
-
*
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
*
|
|
634
|
-
* subgraph-compatible way. This flag is true if:
|
|
635
|
-
* a) only the subgraph plugin is activated,
|
|
636
|
-
* b) healReverseAddresess is false, and
|
|
637
|
-
* c) indexRecordValues is false
|
|
1146
|
+
* WARNING: Special care must be taken when interacting with indexed resolver record values. It
|
|
1147
|
+
* is unsafe to naively assume that indexed resolver record values are equivalent to the
|
|
1148
|
+
* resolver record values that would be returned through dynamic lookups via the ENS protocol.
|
|
1149
|
+
* For example, if a resolver implements CCIP-Read, the resolver records may not be
|
|
1150
|
+
* discoverable through onchain indexing.
|
|
638
1151
|
*
|
|
639
|
-
*
|
|
640
|
-
*
|
|
641
|
-
*
|
|
1152
|
+
* 3. Literal Labels and Literal Names encountered by ENSIndexer will be Interpreted.
|
|
1153
|
+
* @see https://ensnode.io/docs/reference/terminology#interpreted-label
|
|
1154
|
+
* @see https://ensnode.io/docs/reference/terminology#interpreted-name
|
|
1155
|
+
*
|
|
1156
|
+
* That is,
|
|
1157
|
+
* a) all Labels stored and returned by ENSIndexer will be Interpreted Labels, which are either:
|
|
1158
|
+
* i. normalized, or
|
|
1159
|
+
* ii. represented as an Encoded LabelHash of the Literal Label value found onchain, and
|
|
1160
|
+
* b) all Names stored and returned by ENSIndexer will be Interpreted Names, which are exclusively
|
|
1161
|
+
* composed of Interpreted Labels.
|
|
642
1162
|
*/
|
|
643
1163
|
isSubgraphCompatible: boolean;
|
|
644
1164
|
/**
|
|
645
|
-
*
|
|
1165
|
+
* Version info about ENSIndexer.
|
|
646
1166
|
*/
|
|
647
|
-
|
|
1167
|
+
versionInfo: ENSIndexerVersionInfo;
|
|
648
1168
|
}
|
|
649
1169
|
|
|
650
1170
|
type SerializedIndexedChainIds = Array<ChainId>;
|
|
651
1171
|
/**
|
|
652
1172
|
* Serialized representation of {@link ENSIndexerPublicConfig}
|
|
653
1173
|
*/
|
|
654
|
-
interface SerializedENSIndexerPublicConfig extends Omit<ENSIndexerPublicConfig, "
|
|
655
|
-
/**
|
|
656
|
-
* String representation of {@link ENSIndexerPublicConfig.ensAdminUrl}.
|
|
657
|
-
*/
|
|
658
|
-
ensAdminUrl: UrlString;
|
|
659
|
-
/**
|
|
660
|
-
* String representation of {@link ENSIndexerPublicConfig.ensNodePublicUrl}.
|
|
661
|
-
*/
|
|
662
|
-
ensNodePublicUrl: UrlString;
|
|
1174
|
+
interface SerializedENSIndexerPublicConfig extends Omit<ENSIndexerPublicConfig, "indexedChainIds"> {
|
|
663
1175
|
/**
|
|
664
1176
|
* Array representation of {@link ENSIndexerPublicConfig.indexedChainIds}.
|
|
665
1177
|
*/
|
|
666
1178
|
indexedChainIds: ChainId[];
|
|
667
1179
|
}
|
|
668
|
-
|
|
669
|
-
/**
|
|
670
|
-
* Serialize a {@link ENSIndexerPublicConfig} object.
|
|
671
|
-
*/
|
|
672
|
-
declare function deserializeENSIndexerPublicConfig(maybeConfig: SerializedENSIndexerPublicConfig, valueLabel?: string): ENSIndexerPublicConfig;
|
|
673
|
-
|
|
674
1180
|
/**
|
|
675
|
-
*
|
|
676
|
-
*
|
|
677
|
-
* @see https://ensnode.io/docs/reference/subgraph-compatibility/
|
|
1181
|
+
* Serialized representation of {@link ENSIndexerVersionInfo}
|
|
678
1182
|
*/
|
|
679
|
-
|
|
1183
|
+
type SerializedENSIndexerVersionInfo = ENSIndexerVersionInfo;
|
|
680
1184
|
|
|
681
|
-
/**
|
|
682
|
-
* Serializes a {@link ChainConfig} object.
|
|
683
|
-
*/
|
|
684
|
-
declare function serializeIndexedChainIds(indexedChainIds: Set<ChainId>): SerializedIndexedChainIds;
|
|
685
1185
|
/**
|
|
686
1186
|
* Serialize a {@link ENSIndexerPublicConfig} object.
|
|
687
1187
|
*/
|
|
688
|
-
declare function
|
|
689
|
-
|
|
690
|
-
/**
|
|
691
|
-
* All zod schemas we define must remain internal implementation details.
|
|
692
|
-
* We want the freedom to move away from zod in the future without impacting
|
|
693
|
-
* any users of the ensnode-sdk package.
|
|
694
|
-
*
|
|
695
|
-
* The only way to share Zod schemas is to re-export them from
|
|
696
|
-
* `./src/internal.ts` file.
|
|
697
|
-
*/
|
|
698
|
-
|
|
699
|
-
/**
|
|
700
|
-
* Zod `.check()` function input.
|
|
701
|
-
*/
|
|
702
|
-
type ZodCheckFnInput<T> = z.core.ParsePayload<T>;
|
|
703
|
-
|
|
704
|
-
/**
|
|
705
|
-
* All zod schemas we define must remain internal implementation details.
|
|
706
|
-
* We want the freedom to move away from zod in the future without impacting
|
|
707
|
-
* any users of the ensnode-sdk package.
|
|
708
|
-
*
|
|
709
|
-
* The only way to share Zod schemas is to re-export them from
|
|
710
|
-
* `./src/internal.ts` file.
|
|
711
|
-
*/
|
|
1188
|
+
declare function deserializeENSIndexerPublicConfig(maybeConfig: SerializedENSIndexerPublicConfig, valueLabel?: string): ENSIndexerPublicConfig;
|
|
712
1189
|
|
|
713
1190
|
/**
|
|
714
|
-
*
|
|
715
|
-
|
|
716
|
-
declare const makeIndexedChainIdsSchema: (valueLabel?: string) => z.ZodPipe<z.ZodArray<z.ZodInt>, z.ZodTransform<Set<number>, number[]>>;
|
|
717
|
-
/**
|
|
718
|
-
* Makes a schema for parsing a list of {@link PluginName} items.
|
|
719
|
-
*
|
|
720
|
-
* The list is guaranteed to include at least one item exists, and no duplicates.
|
|
721
|
-
*/
|
|
722
|
-
declare const makePluginsListSchema: (valueLabel?: string) => z.ZodArray<z.ZodEnum<typeof PluginName>>;
|
|
723
|
-
/**
|
|
724
|
-
* Makes a schema for parsing a name for a database schema.
|
|
1191
|
+
* Determines if the provided `config` results in indexing behavior compatible with the legacy ENS
|
|
1192
|
+
* Subgraph.
|
|
725
1193
|
*
|
|
726
|
-
*
|
|
727
|
-
*/
|
|
728
|
-
declare const makeDatabaseSchemaNameSchema: (valueLabel?: string) => z.ZodString;
|
|
729
|
-
/**
|
|
730
|
-
* Makes a schema for parsing a label set ID.
|
|
731
|
-
*
|
|
732
|
-
* The label set ID is guaranteed to be a string between 1-50 characters
|
|
733
|
-
* containing only lowercase letters (a-z) and hyphens (-).
|
|
734
|
-
*
|
|
735
|
-
* @param valueLabel - The label to use in error messages (e.g., "Label set ID", "LABEL_SET_ID")
|
|
1194
|
+
* @see https://ensnode.io/docs/reference/subgraph-compatibility/
|
|
736
1195
|
*/
|
|
737
|
-
declare
|
|
738
|
-
/**
|
|
739
|
-
* Makes a schema for parsing a label set version.
|
|
740
|
-
*
|
|
741
|
-
* The label set version is guaranteed to be a non-negative integer.
|
|
742
|
-
*
|
|
743
|
-
* @param valueLabel - The label to use in error messages (e.g., "Label set version", "LABEL_SET_VERSION")
|
|
1196
|
+
declare function isSubgraphCompatible(config: Pick<ENSIndexerPublicConfig, "namespace" | "plugins" | "labelSet">): boolean;
|
|
744
1197
|
|
|
745
|
-
*/
|
|
746
|
-
declare const makeLabelSetVersionSchema: (valueLabel: string) => z.ZodPipe<z.coerce.ZodCoercedNumber<unknown>, z.ZodInt>;
|
|
747
|
-
/**
|
|
748
|
-
* Makes a schema for parsing a label set where both label set ID and label set version are required.
|
|
749
|
-
*
|
|
750
|
-
* @param valueLabel - The label to use in error messages (e.g., "Label set", "LABEL_SET")
|
|
751
|
-
*/
|
|
752
|
-
declare const makeFullyPinnedLabelSetSchema: (valueLabel?: string) => z.ZodObject<{
|
|
753
|
-
labelSetId: z.ZodString;
|
|
754
|
-
labelSetVersion: z.ZodPipe<z.coerce.ZodCoercedNumber<unknown>, z.ZodInt>;
|
|
755
|
-
}, z.core.$strip>;
|
|
756
|
-
declare const makeDependencyInfoSchema: (valueLabel?: string) => z.ZodObject<{
|
|
757
|
-
nodejs: z.ZodString;
|
|
758
|
-
ponder: z.ZodString;
|
|
759
|
-
ensRainbow: z.ZodString;
|
|
760
|
-
ensRainbowSchema: z.ZodInt;
|
|
761
|
-
}, z.core.$strict>;
|
|
762
|
-
declare function invariant_reverseResolversPluginNeedsResolverRecords(ctx: ZodCheckFnInput<Pick<ENSIndexerPublicConfig, "plugins" | "indexAdditionalResolverRecords">>): void;
|
|
763
|
-
declare function invariant_isSubgraphCompatibleRequirements(ctx: ZodCheckFnInput<Pick<ENSIndexerPublicConfig, "plugins" | "isSubgraphCompatible" | "healReverseAddresses" | "indexAdditionalResolverRecords" | "replaceUnnormalized" | "labelSet">>): void;
|
|
764
1198
|
/**
|
|
765
|
-
*
|
|
766
|
-
*
|
|
767
|
-
*
|
|
768
|
-
*
|
|
1199
|
+
* Converts a Labelhash to bytes, with validation
|
|
1200
|
+
* @param labelHash The Labelhash to convert
|
|
1201
|
+
* @returns A ByteArray containing the bytes
|
|
1202
|
+
* @throws Error if `labelHash` is not a valid 32-byte hex string
|
|
769
1203
|
*/
|
|
770
|
-
declare
|
|
771
|
-
ensAdminUrl: z.ZodPipe<z.ZodURL, z.ZodTransform<URL, string>>;
|
|
772
|
-
ensNodePublicUrl: z.ZodPipe<z.ZodURL, z.ZodTransform<URL, string>>;
|
|
773
|
-
labelSet: z.ZodObject<{
|
|
774
|
-
labelSetId: z.ZodString;
|
|
775
|
-
labelSetVersion: z.ZodPipe<z.coerce.ZodCoercedNumber<unknown>, z.ZodInt>;
|
|
776
|
-
}, z.core.$strip>;
|
|
777
|
-
healReverseAddresses: z.ZodBoolean;
|
|
778
|
-
indexAdditionalResolverRecords: z.ZodBoolean;
|
|
779
|
-
replaceUnnormalized: z.ZodBoolean;
|
|
780
|
-
indexedChainIds: z.ZodPipe<z.ZodArray<z.ZodInt>, z.ZodTransform<Set<number>, number[]>>;
|
|
781
|
-
isSubgraphCompatible: z.ZodBoolean;
|
|
782
|
-
namespace: z.ZodEnum<{
|
|
783
|
-
readonly Mainnet: "mainnet";
|
|
784
|
-
readonly Sepolia: "sepolia";
|
|
785
|
-
readonly Holesky: "holesky";
|
|
786
|
-
readonly EnsTestEnv: "ens-test-env";
|
|
787
|
-
}>;
|
|
788
|
-
plugins: z.ZodArray<z.ZodEnum<typeof PluginName>>;
|
|
789
|
-
databaseSchemaName: z.ZodString;
|
|
790
|
-
dependencyInfo: z.ZodObject<{
|
|
791
|
-
nodejs: z.ZodString;
|
|
792
|
-
ponder: z.ZodString;
|
|
793
|
-
ensRainbow: z.ZodString;
|
|
794
|
-
ensRainbowSchema: z.ZodInt;
|
|
795
|
-
}, z.core.$strict>;
|
|
796
|
-
}, z.core.$strip>;
|
|
1204
|
+
declare function labelHashToBytes(labelHash: LabelHash): ByteArray;
|
|
797
1205
|
|
|
798
1206
|
/**
|
|
799
1207
|
* Builds a valid LabelSetId from a string.
|
|
@@ -825,14 +1233,6 @@ declare function buildEnsRainbowClientLabelSet(labelSetId?: LabelSetId, labelSet
|
|
|
825
1233
|
*/
|
|
826
1234
|
declare function validateSupportedLabelSetAndVersion(serverSet: EnsRainbowServerLabelSet, clientSet: EnsRainbowClientLabelSet): void;
|
|
827
1235
|
|
|
828
|
-
/**
|
|
829
|
-
* Converts a Labelhash to bytes, with validation
|
|
830
|
-
* @param labelHash The Labelhash to convert
|
|
831
|
-
* @returns A ByteArray containing the bytes
|
|
832
|
-
* @throws Error if `labelHash` is not a valid 32-byte hex string
|
|
833
|
-
*/
|
|
834
|
-
declare function labelHashToBytes(labelHash: LabelHash): ByteArray;
|
|
835
|
-
|
|
836
1236
|
/**
|
|
837
1237
|
* Parses a string into a non-negative integer.
|
|
838
1238
|
* @param input The string to parse
|
|
@@ -841,484 +1241,1516 @@ declare function labelHashToBytes(labelHash: LabelHash): ByteArray;
|
|
|
841
1241
|
*/
|
|
842
1242
|
declare function parseNonNegativeInteger(maybeNumber: string): number;
|
|
843
1243
|
|
|
844
|
-
declare const ChainIndexingStatusIds: {
|
|
845
|
-
readonly Unstarted: "unstarted";
|
|
846
|
-
readonly Backfill: "backfill";
|
|
847
|
-
readonly Following: "following";
|
|
848
|
-
readonly Completed: "completed";
|
|
849
|
-
};
|
|
850
1244
|
/**
|
|
851
|
-
*
|
|
1245
|
+
* Serializes a {@link ChainConfig} object.
|
|
1246
|
+
*/
|
|
1247
|
+
declare function serializeIndexedChainIds(indexedChainIds: Set<ChainId>): SerializedIndexedChainIds;
|
|
1248
|
+
/**
|
|
1249
|
+
* Serialize a {@link ENSIndexerPublicConfig} object.
|
|
852
1250
|
*/
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
readonly Unstarted: "unstarted";
|
|
856
|
-
readonly Backfill: "backfill";
|
|
857
|
-
readonly Following: "following";
|
|
858
|
-
readonly Completed: "completed";
|
|
859
|
-
readonly IndexerError: "indexer-error";
|
|
860
|
-
};
|
|
1251
|
+
declare function serializeENSIndexerPublicConfig(config: ENSIndexerPublicConfig): SerializedENSIndexerPublicConfig;
|
|
1252
|
+
|
|
861
1253
|
/**
|
|
862
|
-
*
|
|
1254
|
+
* The type of indexing configuration for a chain.
|
|
863
1255
|
*/
|
|
864
|
-
|
|
865
|
-
|
|
1256
|
+
declare const ChainIndexingConfigTypeIds: {
|
|
1257
|
+
/**
|
|
1258
|
+
* Represents that indexing of the chain should be performed for an indefinite range.
|
|
1259
|
+
*/
|
|
866
1260
|
readonly Indefinite: "indefinite";
|
|
1261
|
+
/**
|
|
1262
|
+
* Represents that indexing of the chain should be performed for a definite range.
|
|
1263
|
+
*/
|
|
867
1264
|
readonly Definite: "definite";
|
|
868
1265
|
};
|
|
869
1266
|
/**
|
|
870
|
-
*
|
|
1267
|
+
* The derived string union of possible {@link ChainIndexingConfigTypeIds}.
|
|
871
1268
|
*/
|
|
872
|
-
type
|
|
1269
|
+
type ChainIndexingConfigTypeId = (typeof ChainIndexingConfigTypeIds)[keyof typeof ChainIndexingConfigTypeIds];
|
|
873
1270
|
/**
|
|
874
|
-
* Chain
|
|
1271
|
+
* Chain indexing config for a chain whose indexing config `configType` is
|
|
1272
|
+
* {@link ChainIndexingConfigTypeIds.Indefinite}.
|
|
875
1273
|
*
|
|
876
|
-
*
|
|
1274
|
+
* Invariants:
|
|
1275
|
+
* - `configType` is always `ChainIndexingConfigTypeIds.Indefinite`.
|
|
877
1276
|
*/
|
|
878
|
-
interface
|
|
1277
|
+
interface ChainIndexingConfigIndefinite {
|
|
879
1278
|
/**
|
|
880
|
-
*
|
|
1279
|
+
* The type of chain indexing config.
|
|
881
1280
|
*/
|
|
882
|
-
|
|
1281
|
+
configType: typeof ChainIndexingConfigTypeIds.Indefinite;
|
|
883
1282
|
/**
|
|
884
|
-
*
|
|
885
|
-
*
|
|
886
|
-
* An indexed chain always has its `startBlock` defined.
|
|
1283
|
+
* A {@link BlockRef} to the block where indexing of the chain should start.
|
|
887
1284
|
*/
|
|
888
1285
|
startBlock: BlockRef;
|
|
889
|
-
/**
|
|
890
|
-
* Indefinite chain indexing configs always have a null `endBlock`.
|
|
891
|
-
*/
|
|
892
|
-
endBlock?: null;
|
|
893
1286
|
}
|
|
894
1287
|
/**
|
|
895
|
-
* Chain
|
|
896
|
-
*
|
|
897
|
-
* Configures a chain to be indexed for a definite range.
|
|
1288
|
+
* Chain indexing config for a chain whose indexing config `configType` is
|
|
1289
|
+
* {@link ChainIndexingConfigTypeIds.Definite}.
|
|
898
1290
|
*
|
|
899
1291
|
* Invariants:
|
|
900
|
-
* - `
|
|
1292
|
+
* - `configType` is always `ChainIndexingConfigTypeIds.Definite`.
|
|
1293
|
+
* - `startBlock` is always before or the same as `endBlock`.
|
|
901
1294
|
*/
|
|
902
|
-
interface
|
|
1295
|
+
interface ChainIndexingConfigDefinite {
|
|
903
1296
|
/**
|
|
904
|
-
*
|
|
1297
|
+
* The type of chain indexing config.
|
|
905
1298
|
*/
|
|
906
|
-
|
|
1299
|
+
configType: typeof ChainIndexingConfigTypeIds.Definite;
|
|
907
1300
|
/**
|
|
908
|
-
*
|
|
909
|
-
*
|
|
910
|
-
* `startBlock` must always be defined.
|
|
1301
|
+
* A {@link BlockRef} to the block where indexing of the chain should start.
|
|
911
1302
|
*/
|
|
912
1303
|
startBlock: BlockRef;
|
|
913
1304
|
/**
|
|
914
|
-
*
|
|
915
|
-
*
|
|
916
|
-
* Definite chain indexing configs always have a defined `endBlock`.
|
|
1305
|
+
* A {@link BlockRef} to the block where indexing of the chain should end.
|
|
917
1306
|
*/
|
|
918
1307
|
endBlock: BlockRef;
|
|
919
1308
|
}
|
|
920
1309
|
/**
|
|
921
|
-
*
|
|
1310
|
+
* Indexing configuration for a chain.
|
|
922
1311
|
*
|
|
923
|
-
*
|
|
1312
|
+
* Use the `configType` field to determine the specific type interpretation
|
|
1313
|
+
* at runtime.
|
|
1314
|
+
*/
|
|
1315
|
+
type ChainIndexingConfig = ChainIndexingConfigIndefinite | ChainIndexingConfigDefinite;
|
|
1316
|
+
/**
|
|
1317
|
+
* The status of indexing a chain at the time an indexing status snapshot
|
|
1318
|
+
* is captured.
|
|
1319
|
+
*/
|
|
1320
|
+
declare const ChainIndexingStatusIds: {
|
|
1321
|
+
/**
|
|
1322
|
+
* Represents that indexing of the chain is not ready to begin yet because:
|
|
1323
|
+
* - ENSIndexer is in its initialization phase and the data to build a
|
|
1324
|
+
* "true" {@link ChainIndexingSnapshot} for the chain is still being loaded; or
|
|
1325
|
+
* - ENSIndexer is using an omnichain indexing strategy and the
|
|
1326
|
+
* `omnichainIndexingCursor` is <= `config.startBlock.timestamp` for the chain's
|
|
1327
|
+
* {@link ChainIndexingSnapshot}.
|
|
1328
|
+
*/
|
|
1329
|
+
readonly Queued: "chain-queued";
|
|
1330
|
+
/**
|
|
1331
|
+
* Represents that indexing of the chain is in progress and under a special
|
|
1332
|
+
* "backfill" phase that optimizes for accelerated indexing until reaching the
|
|
1333
|
+
* "fixed target" `backfillEndBlock`.
|
|
1334
|
+
*/
|
|
1335
|
+
readonly Backfill: "chain-backfill";
|
|
1336
|
+
/**
|
|
1337
|
+
* Represents that the "backfill" phase of indexing the chain is completed
|
|
1338
|
+
* and that the chain is configured to be indexed for an indefinite range.
|
|
1339
|
+
* Therefore, indexing of the chain remains indefinitely in progress where
|
|
1340
|
+
* ENSIndexer will continuously work to discover and index new blocks as they
|
|
1341
|
+
* are added to the chain across time.
|
|
1342
|
+
*/
|
|
1343
|
+
readonly Following: "chain-following";
|
|
1344
|
+
/**
|
|
1345
|
+
* Represents that indexing of the chain is completed as the chain is configured
|
|
1346
|
+
* to be indexed for a definite range and the indexing of all blocks through
|
|
1347
|
+
* that definite range is completed.
|
|
1348
|
+
*/
|
|
1349
|
+
readonly Completed: "chain-completed";
|
|
1350
|
+
};
|
|
1351
|
+
/**
|
|
1352
|
+
* The derived string union of possible {@link ChainIndexingStatusIds}.
|
|
924
1353
|
*/
|
|
925
|
-
type
|
|
1354
|
+
type ChainIndexingStatusId = (typeof ChainIndexingStatusIds)[keyof typeof ChainIndexingStatusIds];
|
|
926
1355
|
/**
|
|
927
|
-
* Chain
|
|
1356
|
+
* Chain indexing status snapshot for a chain whose `chainStatus` is
|
|
1357
|
+
* {@link ChainIndexingStatusIds.Queued}.
|
|
928
1358
|
*
|
|
929
|
-
*
|
|
930
|
-
* -
|
|
931
|
-
* the omnichainIndexingCursor from the overall indexing status <= config.startBlock.timestamp.
|
|
1359
|
+
* Invariants:
|
|
1360
|
+
* - `chainStatus` is always {@link ChainIndexingStatusIds.Queued}.
|
|
932
1361
|
*/
|
|
933
|
-
interface
|
|
934
|
-
|
|
1362
|
+
interface ChainIndexingStatusSnapshotQueued {
|
|
1363
|
+
/**
|
|
1364
|
+
* The status of indexing the chain at the time the indexing status snapshot
|
|
1365
|
+
* was captured.
|
|
1366
|
+
*/
|
|
1367
|
+
chainStatus: typeof ChainIndexingStatusIds.Queued;
|
|
1368
|
+
/**
|
|
1369
|
+
* The indexing configuration of the chain.
|
|
1370
|
+
*/
|
|
935
1371
|
config: ChainIndexingConfig;
|
|
936
1372
|
}
|
|
937
1373
|
/**
|
|
938
|
-
* Chain
|
|
1374
|
+
* Chain indexing status snapshot for a chain whose `chainStatus` is
|
|
1375
|
+
* {@link ChainIndexingStatusIds.Backfill}.
|
|
939
1376
|
*
|
|
940
1377
|
* During a backfill, special performance optimizations are applied to
|
|
941
|
-
* index all blocks between config.startBlock and backfillEndBlock
|
|
1378
|
+
* index all blocks between `config.startBlock` and `backfillEndBlock`
|
|
942
1379
|
* as fast as possible.
|
|
943
1380
|
*
|
|
944
|
-
*
|
|
945
|
-
*
|
|
946
|
-
*
|
|
947
|
-
*
|
|
948
|
-
* -
|
|
949
|
-
*
|
|
950
|
-
*
|
|
951
|
-
*
|
|
952
|
-
*
|
|
953
|
-
*
|
|
954
|
-
*
|
|
955
|
-
*
|
|
1381
|
+
* Note how `backfillEndBlock` is a "fixed target" that does not change during
|
|
1382
|
+
* the lifetime of an ENSIndexer process instance:
|
|
1383
|
+
* - If the `config` is {@link ChainIndexingConfigDefinite}:
|
|
1384
|
+
* `backfillEndBlock` is always the same as `config.endBlock`.
|
|
1385
|
+
* - If the `config` is {@link ChainIndexingConfigIndefinite}:
|
|
1386
|
+
* `backfillEndBlock` is a {@link BlockRef} to what was the latest block on the
|
|
1387
|
+
* chain when the ENSIndexer process was performing its initialization. Note how
|
|
1388
|
+
* this means that if the backfill process takes X hours to complete, because the
|
|
1389
|
+
* `backfillEndBlock` is a "fixed target", when `chainStatus` transitions to
|
|
1390
|
+
* {@link ChainIndexingStatusIds.Following} the chain will be X hours behind
|
|
1391
|
+
* "realtime" indexing.
|
|
1392
|
+
*
|
|
1393
|
+
* When `latestIndexedBlock` reaches `backfillEndBlock` the backfill is complete.
|
|
1394
|
+
* The moment backfill is complete the `chainStatus` may not immediately transition.
|
|
1395
|
+
* Instead, internal processing is completed for a period of time while
|
|
1396
|
+
* `chainStatus` remains {@link ChainIndexingStatusIds.Backfill}. After this internal
|
|
1397
|
+
* processing is completed `chainStatus` will transition:
|
|
1398
|
+
* - to {@link ChainIndexingStatusIds.Following} if the `config` is
|
|
1399
|
+
* {@link ChainIndexingConfigIndefinite}.
|
|
1400
|
+
* - to {@link ChainIndexingStatusIds.Completed} if the `config` is
|
|
1401
|
+
* {@link ChainIndexingConfigDefinite}.
|
|
956
1402
|
*
|
|
957
1403
|
* Invariants:
|
|
1404
|
+
* - `chainStatus` is always {@link ChainIndexingStatusIds.Backfill}.
|
|
958
1405
|
* - `config.startBlock` is always before or the same as `latestIndexedBlock`
|
|
959
|
-
* - `
|
|
960
|
-
*
|
|
961
|
-
* - `
|
|
962
|
-
* the config is definite.
|
|
1406
|
+
* - `config.endBlock` is always the same as `backfillEndBlock` if and only if
|
|
1407
|
+
* the config is {@link ChainIndexingConfigDefinite}.
|
|
1408
|
+
* - `latestIndexedBlock` is always before or the same as `backfillEndBlock`
|
|
963
1409
|
*/
|
|
964
|
-
interface
|
|
965
|
-
|
|
1410
|
+
interface ChainIndexingStatusSnapshotBackfill {
|
|
1411
|
+
/**
|
|
1412
|
+
* The status of indexing the chain at the time the indexing status snapshot
|
|
1413
|
+
* was captured.
|
|
1414
|
+
*/
|
|
1415
|
+
chainStatus: typeof ChainIndexingStatusIds.Backfill;
|
|
1416
|
+
/**
|
|
1417
|
+
* The indexing configuration of the chain.
|
|
1418
|
+
*/
|
|
966
1419
|
config: ChainIndexingConfig;
|
|
967
1420
|
/**
|
|
968
|
-
*
|
|
1421
|
+
* A {@link BlockRef} to the block that was most recently indexed as of the time the
|
|
1422
|
+
* indexing status snapshot was captured.
|
|
969
1423
|
*/
|
|
970
1424
|
latestIndexedBlock: BlockRef;
|
|
971
1425
|
/**
|
|
972
|
-
*
|
|
973
|
-
|
|
1426
|
+
* A {@link BlockRef} to the block where the backfill will end.
|
|
1427
|
+
*/
|
|
1428
|
+
backfillEndBlock: BlockRef;
|
|
1429
|
+
}
|
|
1430
|
+
/**
|
|
1431
|
+
* Chain indexing status snapshot for a chain whose `chainStatus` is
|
|
1432
|
+
* {@link ChainIndexingStatusIds.Following}.
|
|
1433
|
+
*
|
|
1434
|
+
* Invariants:
|
|
1435
|
+
* - `chainStatus` is always {@link ChainIndexingStatusIds.Following}.
|
|
1436
|
+
* - `config` is always {@link ChainIndexingConfigIndefinite}
|
|
1437
|
+
* - `config.startBlock` is always before or the same as `latestIndexedBlock`
|
|
1438
|
+
* - `latestIndexedBlock` is always before or the same as `latestKnownBlock`
|
|
1439
|
+
*/
|
|
1440
|
+
interface ChainIndexingStatusSnapshotFollowing {
|
|
1441
|
+
/**
|
|
1442
|
+
* The status of indexing the chain at the time the indexing status snapshot
|
|
1443
|
+
* was captured.
|
|
974
1444
|
*/
|
|
975
|
-
|
|
1445
|
+
chainStatus: typeof ChainIndexingStatusIds.Following;
|
|
976
1446
|
/**
|
|
977
|
-
* The
|
|
1447
|
+
* The indexing configuration of the chain.
|
|
978
1448
|
*/
|
|
979
|
-
|
|
1449
|
+
config: ChainIndexingConfigIndefinite;
|
|
1450
|
+
/**
|
|
1451
|
+
* A {@link BlockRef} to the block that was most recently indexed as of the time the
|
|
1452
|
+
* indexing status snapshot was captured.
|
|
1453
|
+
*/
|
|
1454
|
+
latestIndexedBlock: BlockRef;
|
|
1455
|
+
/**
|
|
1456
|
+
* A {@link BlockRef} to the "highest" block that has been discovered by RPCs
|
|
1457
|
+
* and stored in the RPC cache as of the time the indexing status snapshot was
|
|
1458
|
+
* captured.
|
|
1459
|
+
*/
|
|
1460
|
+
latestKnownBlock: BlockRef;
|
|
1461
|
+
}
|
|
1462
|
+
/**
|
|
1463
|
+
* Chain indexing status snapshot for a chain whose `chainStatus` is
|
|
1464
|
+
* {@link ChainIndexingStatusIds.Completed}.
|
|
1465
|
+
*
|
|
1466
|
+
* After the backfill of a chain is completed, if the chain was configured
|
|
1467
|
+
* to be indexed for a definite range, the chain indexing status will transition to
|
|
1468
|
+
* {@link ChainIndexingStatusIds.Completed}.
|
|
1469
|
+
*
|
|
1470
|
+
* Invariants:
|
|
1471
|
+
* - `chainStatus` is always {@link ChainIndexingStatusIds.Completed}.
|
|
1472
|
+
* - `config` is always {@link ChainIndexingConfigDefinite}
|
|
1473
|
+
* - `config.startBlock` is always before or the same as `latestIndexedBlock`
|
|
1474
|
+
* - `latestIndexedBlock` is always the same as `config.endBlock`.
|
|
1475
|
+
*/
|
|
1476
|
+
interface ChainIndexingStatusSnapshotCompleted {
|
|
1477
|
+
/**
|
|
1478
|
+
* The status of indexing the chain at the time the indexing status snapshot
|
|
1479
|
+
* was captured.
|
|
1480
|
+
*/
|
|
1481
|
+
chainStatus: typeof ChainIndexingStatusIds.Completed;
|
|
1482
|
+
/**
|
|
1483
|
+
* The indexing configuration of the chain.
|
|
1484
|
+
*/
|
|
1485
|
+
config: ChainIndexingConfigDefinite;
|
|
1486
|
+
/**
|
|
1487
|
+
* A {@link BlockRef} to the block that was most recently indexed as of the time the
|
|
1488
|
+
* indexing status snapshot was captured.
|
|
1489
|
+
*/
|
|
1490
|
+
latestIndexedBlock: BlockRef;
|
|
1491
|
+
}
|
|
1492
|
+
/**
|
|
1493
|
+
* Indexing status snapshot for a single chain.
|
|
1494
|
+
*
|
|
1495
|
+
* Use the `chainStatus` field to determine the specific type interpretation
|
|
1496
|
+
* at runtime.
|
|
1497
|
+
*/
|
|
1498
|
+
type ChainIndexingStatusSnapshot = ChainIndexingStatusSnapshotQueued | ChainIndexingStatusSnapshotBackfill | ChainIndexingStatusSnapshotFollowing | ChainIndexingStatusSnapshotCompleted;
|
|
1499
|
+
/**
|
|
1500
|
+
* The status of omnichain indexing at the time an omnichain indexing status
|
|
1501
|
+
* snapshot is captured.
|
|
1502
|
+
*/
|
|
1503
|
+
declare const OmnichainIndexingStatusIds: {
|
|
1504
|
+
/**
|
|
1505
|
+
* Represents that omnichain indexing is not ready to begin yet because
|
|
1506
|
+
* ENSIndexer is in its initialization phase and the data to build a "true"
|
|
1507
|
+
* {@link OmnichainIndexingStatusSnapshot} is still being loaded.
|
|
1508
|
+
*/
|
|
1509
|
+
readonly Unstarted: "omnichain-unstarted";
|
|
1510
|
+
/**
|
|
1511
|
+
* Represents that omnichain indexing is in an overall "backfill" status because
|
|
1512
|
+
* - At least one indexed chain has a `chainStatus` of
|
|
1513
|
+
* {@link ChainIndexingStatusIds.Backfill}; and
|
|
1514
|
+
* - No indexed chain has a `chainStatus` of {@link ChainIndexingStatusIds.Following}.
|
|
1515
|
+
*/
|
|
1516
|
+
readonly Backfill: "omnichain-backfill";
|
|
1517
|
+
/**
|
|
1518
|
+
* Represents that omnichain indexing is in an overall "following" status because
|
|
1519
|
+
* at least one indexed chain has a `chainStatus` of
|
|
1520
|
+
* {@link ChainIndexingStatusIds.Following}.
|
|
1521
|
+
*/
|
|
1522
|
+
readonly Following: "omnichain-following";
|
|
1523
|
+
/**
|
|
1524
|
+
* Represents that omnichain indexing has completed because all indexed chains have
|
|
1525
|
+
* a `chainStatus` of {@link ChainIndexingStatusIds.Completed}.
|
|
1526
|
+
*/
|
|
1527
|
+
readonly Completed: "omnichain-completed";
|
|
1528
|
+
};
|
|
1529
|
+
/**
|
|
1530
|
+
* The derived string union of possible {@link OmnichainIndexingStatusIds}.
|
|
1531
|
+
*/
|
|
1532
|
+
type OmnichainIndexingStatusId = (typeof OmnichainIndexingStatusIds)[keyof typeof OmnichainIndexingStatusIds];
|
|
1533
|
+
/**
|
|
1534
|
+
* Omnichain indexing status snapshot when the overall `omnichainStatus` is
|
|
1535
|
+
* {@link OmnichainIndexingStatusIds.Unstarted}.
|
|
1536
|
+
*
|
|
1537
|
+
* Invariants:
|
|
1538
|
+
* - `omnichainStatus` is always {@link OmnichainIndexingStatusIds.Unstarted}.
|
|
1539
|
+
* - `chains` is always a map to {@link ChainIndexingStatusSnapshotQueued} values exclusively.
|
|
1540
|
+
* - `omnichainIndexingCursor` is always < the `config.startBlock.timestamp` for all
|
|
1541
|
+
* chains with `chainStatus` of {@link ChainIndexingStatusIds.Queued}.
|
|
1542
|
+
*/
|
|
1543
|
+
interface OmnichainIndexingStatusSnapshotUnstarted {
|
|
1544
|
+
/**
|
|
1545
|
+
* The status of omnichain indexing.
|
|
1546
|
+
*/
|
|
1547
|
+
omnichainStatus: typeof OmnichainIndexingStatusIds.Unstarted;
|
|
1548
|
+
/**
|
|
1549
|
+
* The indexing status snapshot for each indexed chain.
|
|
1550
|
+
*/
|
|
1551
|
+
chains: Map<ChainId, ChainIndexingStatusSnapshotQueued>;
|
|
1552
|
+
/**
|
|
1553
|
+
* The timestamp of omnichain indexing progress across all indexed chains.
|
|
1554
|
+
*/
|
|
1555
|
+
omnichainIndexingCursor: UnixTimestamp;
|
|
1556
|
+
}
|
|
1557
|
+
/**
|
|
1558
|
+
* The range of {@link ChainIndexingSnapshot} types allowed when the
|
|
1559
|
+
* overall omnichain indexing status is {@link OmnichainIndexingStatusIds.Backfill}.
|
|
1560
|
+
*
|
|
1561
|
+
* Note that this is all of the {@link ChainIndexingSnapshot} types with the exception
|
|
1562
|
+
* of {@link ChainIndexingStatusSnapshotFollowing}.
|
|
1563
|
+
*/
|
|
1564
|
+
type ChainIndexingStatusSnapshotForOmnichainIndexingStatusSnapshotBackfill = ChainIndexingStatusSnapshotQueued | ChainIndexingStatusSnapshotBackfill | ChainIndexingStatusSnapshotCompleted;
|
|
1565
|
+
/**
|
|
1566
|
+
* Omnichain indexing status snapshot when the `omnichainStatus` is
|
|
1567
|
+
* {@link OmnichainIndexingStatusIds.Backfill}.
|
|
1568
|
+
*
|
|
1569
|
+
* Invariants:
|
|
1570
|
+
* - `omnichainStatus` is always {@link OmnichainIndexingStatusIds.Backfill}.
|
|
1571
|
+
* - `chains` is guaranteed to contain at least one chain with a `chainStatus` of
|
|
1572
|
+
* {@link ChainIndexingStatusIds.Backfill}.
|
|
1573
|
+
* - `chains` is guaranteed to not to contain any chain with a `chainStatus` of
|
|
1574
|
+
* {@link ChainIndexingStatusIds.Following}
|
|
1575
|
+
* - `omnichainIndexingCursor` is always < the `config.startBlock.timestamp` for all
|
|
1576
|
+
* chains with `chainStatus` of {@link ChainIndexingStatusIds.Queued}.
|
|
1577
|
+
* - `omnichainIndexingCursor` is always <= the `backfillEndBlock.timestamp` for all
|
|
1578
|
+
* chains with `chainStatus` of {@link ChainIndexingStatusIds.Backfill}.
|
|
1579
|
+
* - `omnichainIndexingCursor` is always >= the `latestIndexedBlock.timestamp` for all
|
|
1580
|
+
* chains with `chainStatus` of {@link ChainIndexingStatusIds.Completed}.
|
|
1581
|
+
* - `omnichainIndexingCursor` is always equal to the timestamp of the highest
|
|
1582
|
+
* `latestIndexedBlock` across all chains that have started indexing
|
|
1583
|
+
* (`chainStatus` is not {@link ChainIndexingStatusIds.Queued}).
|
|
1584
|
+
*/
|
|
1585
|
+
interface OmnichainIndexingStatusSnapshotBackfill {
|
|
1586
|
+
/**
|
|
1587
|
+
* The status of omnichain indexing.
|
|
1588
|
+
*/
|
|
1589
|
+
omnichainStatus: typeof OmnichainIndexingStatusIds.Backfill;
|
|
1590
|
+
/**
|
|
1591
|
+
* The indexing status snapshot for each indexed chain.
|
|
1592
|
+
*/
|
|
1593
|
+
chains: Map<ChainId, ChainIndexingStatusSnapshotForOmnichainIndexingStatusSnapshotBackfill>;
|
|
1594
|
+
/**
|
|
1595
|
+
* The timestamp of omnichain indexing progress across all indexed chains.
|
|
1596
|
+
*/
|
|
1597
|
+
omnichainIndexingCursor: UnixTimestamp;
|
|
1598
|
+
}
|
|
1599
|
+
/**
|
|
1600
|
+
* Omnichain indexing status snapshot when the overall `omnichainStatus` is
|
|
1601
|
+
* {@link OmnichainIndexingStatusIds.Following}.
|
|
1602
|
+
*
|
|
1603
|
+
* Invariants:
|
|
1604
|
+
* - `omnichainStatus` is always {@link OmnichainIndexingStatusIds.Following}.
|
|
1605
|
+
* - `chains` is guaranteed to contain at least one chain with a `status` of
|
|
1606
|
+
* {@link ChainIndexingStatusIds.Following}.
|
|
1607
|
+
* - `omnichainIndexingCursor` is always < the `config.startBlock.timestamp` for all
|
|
1608
|
+
* chains with `chainStatus` of {@link ChainIndexingStatusIds.Queued}.
|
|
1609
|
+
* - `omnichainIndexingCursor` is always <= the `backfillEndBlock.timestamp` for all
|
|
1610
|
+
* chains with `chainStatus` of {@link ChainIndexingStatusIds.Backfill}.
|
|
1611
|
+
* - `omnichainIndexingCursor` is always >= the `latestIndexedBlock.timestamp` for all
|
|
1612
|
+
* chains with `chainStatus` of {@link ChainIndexingStatusIds.Completed}.
|
|
1613
|
+
* - `omnichainIndexingCursor` is always equal to the timestamp of the highest
|
|
1614
|
+
* `latestIndexedBlock` across all chains that have started indexing
|
|
1615
|
+
* (`chainStatus` is not {@link ChainIndexingStatusIds.Queued}).
|
|
1616
|
+
*/
|
|
1617
|
+
interface OmnichainIndexingStatusSnapshotFollowing {
|
|
1618
|
+
/**
|
|
1619
|
+
* The status of omnichain indexing.
|
|
1620
|
+
*/
|
|
1621
|
+
omnichainStatus: typeof OmnichainIndexingStatusIds.Following;
|
|
1622
|
+
/**
|
|
1623
|
+
* The indexing status snapshot for each indexed chain.
|
|
1624
|
+
*/
|
|
1625
|
+
chains: Map<ChainId, ChainIndexingStatusSnapshot>;
|
|
1626
|
+
/**
|
|
1627
|
+
* The timestamp of omnichain indexing progress across all indexed chains.
|
|
1628
|
+
*/
|
|
1629
|
+
omnichainIndexingCursor: UnixTimestamp;
|
|
1630
|
+
}
|
|
1631
|
+
/**
|
|
1632
|
+
* Omnichain indexing status snapshot when the overall `omnichainStatus` is
|
|
1633
|
+
* {@link OmnichainIndexingStatusIds.Completed}.
|
|
1634
|
+
*
|
|
1635
|
+
* Invariants:
|
|
1636
|
+
* - `omnichainStatus` is always {@link OmnichainIndexingStatusIds.Completed}.
|
|
1637
|
+
* - `chains` is always a map to {@link ChainIndexingStatusSnapshotCompleted} values exclusively.
|
|
1638
|
+
* - `omnichainIndexingCursor` is always equal to the highest
|
|
1639
|
+
* `latestIndexedBlock.timestamp` for all chains.
|
|
1640
|
+
*/
|
|
1641
|
+
interface OmnichainIndexingStatusSnapshotCompleted {
|
|
1642
|
+
/**
|
|
1643
|
+
* The status of omnichain indexing.
|
|
1644
|
+
*/
|
|
1645
|
+
omnichainStatus: typeof OmnichainIndexingStatusIds.Completed;
|
|
1646
|
+
/**
|
|
1647
|
+
* The indexing status snapshot for each indexed chain.
|
|
1648
|
+
*/
|
|
1649
|
+
chains: Map<ChainId, ChainIndexingStatusSnapshotCompleted>;
|
|
1650
|
+
/**
|
|
1651
|
+
* The timestamp of omnichain indexing progress across all indexed chains.
|
|
1652
|
+
*/
|
|
1653
|
+
omnichainIndexingCursor: UnixTimestamp;
|
|
980
1654
|
}
|
|
981
1655
|
/**
|
|
982
|
-
*
|
|
1656
|
+
* Omnichain indexing status snapshot for one or more chains.
|
|
1657
|
+
*
|
|
1658
|
+
* Use the `omnichainStatus` field to determine the specific type interpretation
|
|
1659
|
+
* at runtime.
|
|
1660
|
+
*/
|
|
1661
|
+
type OmnichainIndexingStatusSnapshot = OmnichainIndexingStatusSnapshotUnstarted | OmnichainIndexingStatusSnapshotBackfill | OmnichainIndexingStatusSnapshotCompleted | OmnichainIndexingStatusSnapshotFollowing;
|
|
1662
|
+
/**
|
|
1663
|
+
* The strategy used for indexing one or more chains.
|
|
1664
|
+
*
|
|
1665
|
+
* @see https://ponder.sh/docs/api-reference/ponder/config#parameters
|
|
1666
|
+
*/
|
|
1667
|
+
declare const CrossChainIndexingStrategyIds: {
|
|
1668
|
+
/**
|
|
1669
|
+
* Represents that the indexing of events across all indexed chains will
|
|
1670
|
+
* proceed in a deterministic "omnichain" ordering by block timestamp, chain ID,
|
|
1671
|
+
* and block number.
|
|
1672
|
+
*
|
|
1673
|
+
* This strategy is "deterministic" in that the order of processing cross-chain indexed
|
|
1674
|
+
* events and each resulting indexed data state transition recorded in ENSDb is always
|
|
1675
|
+
* the same for each ENSIndexer instance operating with an equivalent
|
|
1676
|
+
* `ENSIndexerConfig` and ENSIndexer version. However it also has the drawbacks of:
|
|
1677
|
+
* - increased indexing latency that must wait for the slowest indexed chain to
|
|
1678
|
+
* add new blocks or to discover new blocks through the configured RPCs.
|
|
1679
|
+
* - if any indexed chain gets "stuck" due to chain or RPC failures, all indexed chains
|
|
1680
|
+
* will be affected.
|
|
1681
|
+
*/
|
|
1682
|
+
readonly Omnichain: "omnichain";
|
|
1683
|
+
};
|
|
1684
|
+
/**
|
|
1685
|
+
* The derived string union of possible {@link CrossChainIndexingStrategyIds}.
|
|
1686
|
+
*/
|
|
1687
|
+
type CrossChainIndexingStrategyId = (typeof CrossChainIndexingStrategyIds)[keyof typeof CrossChainIndexingStrategyIds];
|
|
1688
|
+
/**
|
|
1689
|
+
* Cross-chain indexing status snapshot when the `strategy` is
|
|
1690
|
+
* {@link CrossChainIndexingStrategyId.Omnichain}.
|
|
1691
|
+
*
|
|
1692
|
+
* Invariants:
|
|
1693
|
+
* - `strategy` is always {@link CrossChainIndexingStrategyId.Omnichain}.
|
|
1694
|
+
* - `slowestChainIndexingCursor` is always equal to
|
|
1695
|
+
* `omnichainSnapshot.omnichainIndexingCursor`.
|
|
1696
|
+
* - `snapshotTime` is always >= the "highest known block timestamp", defined as the max of:
|
|
1697
|
+
* - the `slowestChainIndexingCursor`.
|
|
1698
|
+
* - the `config.startBlock.timestamp` for all indexed chains.
|
|
1699
|
+
* - the `config.endBlock.timestamp` for all indexed chains with a `config.configType` of
|
|
1700
|
+
* {@link ChainIndexingConfigTypeIds.Definite}.
|
|
1701
|
+
* - the `backfillEndBlock.timestamp` for all chains with `chainStatus` of
|
|
1702
|
+
* {@link ChainIndexingStatusIds.Backfill}.
|
|
1703
|
+
* - the `latestKnownBlock.timestamp` for all chains with `chainStatus` of
|
|
1704
|
+
* {@link ChainIndexingStatusIds.Following}.
|
|
1705
|
+
*/
|
|
1706
|
+
interface CrossChainIndexingStatusSnapshotOmnichain {
|
|
1707
|
+
/**
|
|
1708
|
+
* The strategy used for indexing one or more chains.
|
|
1709
|
+
*/
|
|
1710
|
+
strategy: typeof CrossChainIndexingStrategyIds.Omnichain;
|
|
1711
|
+
/**
|
|
1712
|
+
* The timestamp of the "slowest" latest indexed block timestamp
|
|
1713
|
+
* across all indexed chains.
|
|
1714
|
+
*/
|
|
1715
|
+
slowestChainIndexingCursor: UnixTimestamp;
|
|
1716
|
+
/**
|
|
1717
|
+
* The timestamp when the cross-chain indexing status snapshot was generated.
|
|
1718
|
+
*
|
|
1719
|
+
* Due to possible clock skew between different systems this value must be set
|
|
1720
|
+
* to the max of each of the following values to ensure all invariants are followed:
|
|
1721
|
+
* - the current system time of the system generating this cross-chain indexing
|
|
1722
|
+
* status snapshot.
|
|
1723
|
+
* - the "highest known block timestamp" (see invariants above for full definition).
|
|
1724
|
+
*/
|
|
1725
|
+
snapshotTime: UnixTimestamp;
|
|
1726
|
+
/**
|
|
1727
|
+
* The omnichain indexing status snapshot for one or more chains.
|
|
1728
|
+
*/
|
|
1729
|
+
omnichainSnapshot: OmnichainIndexingStatusSnapshot;
|
|
1730
|
+
}
|
|
1731
|
+
/**
|
|
1732
|
+
* Cross-chain indexing status snapshot for one or more chains.
|
|
1733
|
+
*
|
|
1734
|
+
* Use the `strategy` field to determine the specific type interpretation
|
|
1735
|
+
* at runtime.
|
|
1736
|
+
*
|
|
1737
|
+
* Currently, only omnichain indexing is supported. This type could theoretically
|
|
1738
|
+
* be extended to support other cross-chain indexing strategies in the future,
|
|
1739
|
+
* such as Ponder's "multichain" indexing strategy that indexes each chain
|
|
1740
|
+
* independently without deterministic ordering.
|
|
1741
|
+
*/
|
|
1742
|
+
type CrossChainIndexingStatusSnapshot = CrossChainIndexingStatusSnapshotOmnichain;
|
|
1743
|
+
/**
|
|
1744
|
+
* A "realtime" indexing status projection based on worst-case assumptions
|
|
1745
|
+
* from the `snapshot`.
|
|
1746
|
+
*
|
|
1747
|
+
* Invariants:
|
|
1748
|
+
* - `projectedAt` is always >= `snapshot.snapshotTime`.
|
|
1749
|
+
* - `worstCaseDistance` is always equal to
|
|
1750
|
+
* `projectedAt - snapshot.slowestChainIndexingCursor`.
|
|
1751
|
+
*/
|
|
1752
|
+
type RealtimeIndexingStatusProjection = {
|
|
1753
|
+
/**
|
|
1754
|
+
* The timestamp representing "now" as of the time this projection was generated.
|
|
1755
|
+
*/
|
|
1756
|
+
projectedAt: UnixTimestamp;
|
|
1757
|
+
/**
|
|
1758
|
+
* The distance between `projectedAt` and `snapshot.slowestChainIndexingCursor`.
|
|
1759
|
+
*
|
|
1760
|
+
* This is "worst-case" because it assumes all of the following:
|
|
1761
|
+
* - the `snapshot` (which may have `snapshot.snapshotTime < projectedAt`) is still the
|
|
1762
|
+
* latest snapshot and no indexing progress has been made since `snapshotTime`.
|
|
1763
|
+
* - each indexed chain has added a new block as of `projectedAt`.
|
|
1764
|
+
*/
|
|
1765
|
+
worstCaseDistance: Duration;
|
|
1766
|
+
/**
|
|
1767
|
+
* The {@link CrossChainIndexingStatusSnapshot} that this projection is based on.
|
|
1768
|
+
*/
|
|
1769
|
+
snapshot: CrossChainIndexingStatusSnapshot;
|
|
1770
|
+
};
|
|
1771
|
+
|
|
1772
|
+
/**
|
|
1773
|
+
* Serialized representation of {@link ChainIndexingStatusSnapshot}
|
|
1774
|
+
*/
|
|
1775
|
+
type SerializedChainIndexingStatusSnapshot = ChainIndexingStatusSnapshot;
|
|
1776
|
+
/**
|
|
1777
|
+
* Serialized representation of {@link ChainIndexingStatusSnapshotQueued}
|
|
1778
|
+
*/
|
|
1779
|
+
type SerializedChainIndexingStatusSnapshotQueued = ChainIndexingStatusSnapshotQueued;
|
|
1780
|
+
/**
|
|
1781
|
+
* Serialized representation of {@link ChainIndexingStatusSnapshotBackfill}
|
|
1782
|
+
*/
|
|
1783
|
+
type SerializedChainIndexingStatusSnapshotBackfill = ChainIndexingStatusSnapshotBackfill;
|
|
1784
|
+
/**
|
|
1785
|
+
* Serialized representation of {@link ChainIndexingStatusSnapshotCompleted}
|
|
1786
|
+
*/
|
|
1787
|
+
type SerializedChainIndexingStatusSnapshotCompleted = ChainIndexingStatusSnapshotCompleted;
|
|
1788
|
+
/**
|
|
1789
|
+
* Serialized representation of {@link ChainIndexingStatusSnapshotFollowing}
|
|
1790
|
+
*/
|
|
1791
|
+
type SerializedChainIndexingStatusSnapshotFollowing = ChainIndexingStatusSnapshotFollowing;
|
|
1792
|
+
/**
|
|
1793
|
+
* Serialized representation of {@link OmnichainIndexingStatusSnapshotUnstarted}
|
|
1794
|
+
*/
|
|
1795
|
+
interface SerializedOmnichainIndexingStatusSnapshotUnstarted extends Omit<OmnichainIndexingStatusSnapshotUnstarted, "chains"> {
|
|
1796
|
+
chains: Record<ChainIdString, ChainIndexingStatusSnapshotQueued>;
|
|
1797
|
+
}
|
|
1798
|
+
/**
|
|
1799
|
+
* Serialized representation of {@link OmnichainIndexingStatusSnapshotBackfill}
|
|
1800
|
+
*/
|
|
1801
|
+
interface SerializedOmnichainIndexingStatusSnapshotBackfill extends Omit<OmnichainIndexingStatusSnapshotBackfill, "chains"> {
|
|
1802
|
+
chains: Record<ChainIdString, ChainIndexingStatusSnapshotForOmnichainIndexingStatusSnapshotBackfill>;
|
|
1803
|
+
}
|
|
1804
|
+
/**
|
|
1805
|
+
* Serialized representation of {@link OmnichainIndexingStatusSnapshotCompleted}
|
|
1806
|
+
*/
|
|
1807
|
+
interface SerializedOmnichainIndexingStatusSnapshotCompleted extends Omit<OmnichainIndexingStatusSnapshotCompleted, "chains"> {
|
|
1808
|
+
chains: Record<ChainIdString, ChainIndexingStatusSnapshotCompleted>;
|
|
1809
|
+
}
|
|
1810
|
+
/**
|
|
1811
|
+
* Serialized representation of {@link OmnichainIndexingStatusSnapshotFollowing}
|
|
1812
|
+
*/
|
|
1813
|
+
interface SerializedOmnichainIndexingStatusSnapshotFollowing extends Omit<OmnichainIndexingStatusSnapshotFollowing, "chains"> {
|
|
1814
|
+
chains: Record<ChainIdString, ChainIndexingStatusSnapshot>;
|
|
1815
|
+
}
|
|
1816
|
+
/**
|
|
1817
|
+
* Serialized representation of {@link OmnichainIndexingStatusSnapshot}
|
|
1818
|
+
*/
|
|
1819
|
+
type SerializedOmnichainIndexingStatusSnapshot = SerializedOmnichainIndexingStatusSnapshotUnstarted | SerializedOmnichainIndexingStatusSnapshotBackfill | SerializedOmnichainIndexingStatusSnapshotCompleted | SerializedOmnichainIndexingStatusSnapshotFollowing;
|
|
1820
|
+
/**
|
|
1821
|
+
* Serialized representation of {@link CrossChainIndexingStatusSnapshotOmnichain}
|
|
1822
|
+
*/
|
|
1823
|
+
interface SerializedCrossChainIndexingStatusSnapshotOmnichain extends Omit<CrossChainIndexingStatusSnapshotOmnichain, "omnichainSnapshot"> {
|
|
1824
|
+
omnichainSnapshot: SerializedOmnichainIndexingStatusSnapshot;
|
|
1825
|
+
}
|
|
1826
|
+
/**
|
|
1827
|
+
* Serialized representation of {@link CrossChainIndexingStatusSnapshot}
|
|
1828
|
+
*/
|
|
1829
|
+
type SerializedCrossChainIndexingStatusSnapshot = SerializedCrossChainIndexingStatusSnapshotOmnichain;
|
|
1830
|
+
/**
|
|
1831
|
+
* Serialized representation of {@link RealtimeIndexingStatusProjection}
|
|
1832
|
+
*/
|
|
1833
|
+
interface SerializedCurrentIndexingProjectionOmnichain extends Omit<RealtimeIndexingStatusProjection, "snapshot"> {
|
|
1834
|
+
snapshot: SerializedOmnichainIndexingStatusSnapshot;
|
|
1835
|
+
}
|
|
1836
|
+
/**
|
|
1837
|
+
* Serialized representation of {@link RealtimeIndexingStatusProjection}
|
|
1838
|
+
*/
|
|
1839
|
+
interface SerializedRealtimeIndexingStatusProjection extends Omit<RealtimeIndexingStatusProjection, "snapshot"> {
|
|
1840
|
+
snapshot: SerializedCrossChainIndexingStatusSnapshot;
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
/**
|
|
1844
|
+
* Deserialize into a {@link ChainIndexingSnapshot} object.
|
|
1845
|
+
*/
|
|
1846
|
+
declare function deserializeChainIndexingStatusSnapshot(maybeSnapshot: SerializedChainIndexingStatusSnapshot, valueLabel?: string): ChainIndexingStatusSnapshot;
|
|
1847
|
+
/**
|
|
1848
|
+
* Deserialize an {@link OmnichainIndexingStatusSnapshot} object.
|
|
1849
|
+
*/
|
|
1850
|
+
declare function deserializeOmnichainIndexingStatusSnapshot(maybeSnapshot: SerializedOmnichainIndexingStatusSnapshot, valueLabel?: string): OmnichainIndexingStatusSnapshot;
|
|
1851
|
+
/**
|
|
1852
|
+
* Deserialize an {@link CrossChainIndexingStatusSnapshot} object.
|
|
1853
|
+
*/
|
|
1854
|
+
declare function deserializeCrossChainIndexingStatusSnapshot(maybeSnapshot: SerializedCrossChainIndexingStatusSnapshot, valueLabel?: string): CrossChainIndexingStatusSnapshot;
|
|
1855
|
+
/**
|
|
1856
|
+
* Deserialize into a {@link RealtimeIndexingStatusProjection} object.
|
|
1857
|
+
*/
|
|
1858
|
+
declare function deserializeRealtimeIndexingStatusProjection(maybeProjection: SerializedRealtimeIndexingStatusProjection, valueLabel?: string): RealtimeIndexingStatusProjection;
|
|
1859
|
+
|
|
1860
|
+
/**
|
|
1861
|
+
* Get {@link OmnichainIndexingStatusId} based on indexed chains' statuses.
|
|
1862
|
+
*
|
|
1863
|
+
* This function decides what is the `OmnichainIndexingStatusId` is,
|
|
1864
|
+
* based on provided chain indexing statuses.
|
|
1865
|
+
*
|
|
1866
|
+
* @throws an error if unable to determine overall indexing status
|
|
1867
|
+
*/
|
|
1868
|
+
declare function getOmnichainIndexingStatus(chains: ChainIndexingStatusSnapshot[]): OmnichainIndexingStatusId;
|
|
1869
|
+
/**
|
|
1870
|
+
* Get the timestamp of the lowest `config.startBlock` across all chains
|
|
1871
|
+
* in the provided array of {@link ChainIndexingStatusSnapshot}.
|
|
1872
|
+
*
|
|
1873
|
+
* Such timestamp is useful when presenting the "lowest" block
|
|
1874
|
+
* to be indexed across all chains.
|
|
1875
|
+
*/
|
|
1876
|
+
declare function getTimestampForLowestOmnichainStartBlock(chains: ChainIndexingStatusSnapshot[]): UnixTimestamp;
|
|
1877
|
+
/**
|
|
1878
|
+
* Get the timestamp of the "highest known block" across all chains
|
|
1879
|
+
* in the provided array of {@link ChainIndexingStatusSnapshot}.
|
|
1880
|
+
*
|
|
1881
|
+
* Such timestamp is useful when presenting the "highest known block"
|
|
1882
|
+
* to be indexed across all chains.
|
|
1883
|
+
*
|
|
1884
|
+
* The "highest known block" for a chain depends on its status:
|
|
1885
|
+
* - `config.endBlock` for a "queued" chain,
|
|
1886
|
+
* - `backfillEndBlock` for a "backfill" chain,
|
|
1887
|
+
* - `latestIndexedBlock` for a "completed" chain,
|
|
1888
|
+
* - `latestKnownBlock` for a "following" chain.
|
|
1889
|
+
*/
|
|
1890
|
+
declare function getTimestampForHighestOmnichainKnownBlock(chains: ChainIndexingStatusSnapshot[]): UnixTimestamp;
|
|
1891
|
+
/**
|
|
1892
|
+
* Get Omnichain Indexing Cursor
|
|
1893
|
+
*
|
|
1894
|
+
* The cursor tracks the "highest" latest indexed block timestamp across
|
|
1895
|
+
* all indexed chains. If all chains are queued, the cursor tracks the moment
|
|
1896
|
+
* just before the earliest start block timestamp across those chains.
|
|
1897
|
+
*
|
|
1898
|
+
* @throws an error if no chains are provided
|
|
1899
|
+
*/
|
|
1900
|
+
declare function getOmnichainIndexingCursor(chains: ChainIndexingStatusSnapshot[]): UnixTimestamp;
|
|
1901
|
+
/**
|
|
1902
|
+
* Create {@link ChainIndexingConfig} for given block refs.
|
|
1903
|
+
*
|
|
1904
|
+
* @param startBlock required block ref
|
|
1905
|
+
* @param endBlock optional block ref
|
|
1906
|
+
*/
|
|
1907
|
+
declare function createIndexingConfig(startBlock: BlockRef, endBlock: BlockRef | null): ChainIndexingConfig;
|
|
1908
|
+
/**
|
|
1909
|
+
* Check if Chain Indexing Status Snapshots fit the 'unstarted' overall status
|
|
1910
|
+
* snapshot requirements:
|
|
1911
|
+
* - All chains are guaranteed to have a status of "queued".
|
|
1912
|
+
*
|
|
1913
|
+
* Note: This function narrows the {@link ChainIndexingStatusSnapshot} type to
|
|
1914
|
+
* {@link ChainIndexingStatusSnapshotQueued}.
|
|
1915
|
+
*/
|
|
1916
|
+
declare function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted(chains: ChainIndexingStatusSnapshot[]): chains is ChainIndexingStatusSnapshotQueued[];
|
|
1917
|
+
/**
|
|
1918
|
+
* Check if Chain Indexing Status Snapshots fit the 'backfill' overall status
|
|
1919
|
+
* snapshot requirements:
|
|
1920
|
+
* - At least one chain is guaranteed to be in the "backfill" status.
|
|
1921
|
+
* - Each chain is guaranteed to have a status of either "queued",
|
|
1922
|
+
* "backfill" or "completed".
|
|
1923
|
+
*
|
|
1924
|
+
* Note: This function narrows the {@link ChainIndexingStatusSnapshot} type to
|
|
1925
|
+
* {@link ChainIndexingStatusSnapshotForOmnichainIndexingStatusSnapshotBackfill}.
|
|
1926
|
+
*/
|
|
1927
|
+
declare function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill(chains: ChainIndexingStatusSnapshot[]): chains is ChainIndexingStatusSnapshotForOmnichainIndexingStatusSnapshotBackfill[];
|
|
1928
|
+
/**
|
|
1929
|
+
* Checks if Chain Indexing Status Snapshots fit the 'completed' overall status
|
|
1930
|
+
* snapshot requirements:
|
|
1931
|
+
* - All chains are guaranteed to have a status of "completed".
|
|
1932
|
+
*
|
|
1933
|
+
* Note: This function narrows the {@link ChainIndexingStatusSnapshot} type to
|
|
1934
|
+
* {@link ChainIndexingStatusSnapshotCompleted}.
|
|
1935
|
+
*/
|
|
1936
|
+
declare function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted(chains: ChainIndexingStatusSnapshot[]): chains is ChainIndexingStatusSnapshotCompleted[];
|
|
1937
|
+
/**
|
|
1938
|
+
* Checks Chain Indexing Status Snapshots fit the 'following' overall status
|
|
1939
|
+
* snapshot requirements:
|
|
1940
|
+
* - At least one chain is guaranteed to be in the "following" status.
|
|
1941
|
+
* - Any other chain can have any status.
|
|
1942
|
+
*/
|
|
1943
|
+
declare function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing(chains: ChainIndexingStatusSnapshot[]): chains is ChainIndexingStatusSnapshot[];
|
|
1944
|
+
/**
|
|
1945
|
+
* Sort a list of [{@link ChainId}, {@link ChainIndexingStatusSnapshot}] tuples
|
|
1946
|
+
* by the omnichain start block timestamp in ascending order.
|
|
1947
|
+
*/
|
|
1948
|
+
declare function sortChainStatusesByStartBlockAsc<ChainStatusType extends ChainIndexingStatusSnapshot>(chains: [ChainId, ChainStatusType][]): [ChainId, ChainStatusType][];
|
|
1949
|
+
|
|
1950
|
+
/**
|
|
1951
|
+
* Create realtime indexing status projection from
|
|
1952
|
+
* a {@link CrossChainIndexingStatusSnapshot}.
|
|
1953
|
+
*/
|
|
1954
|
+
declare function createRealtimeIndexingStatusProjection(snapshot: CrossChainIndexingStatusSnapshot, now: UnixTimestamp): RealtimeIndexingStatusProjection;
|
|
1955
|
+
|
|
1956
|
+
declare function serializeCrossChainIndexingStatusSnapshotOmnichain({ strategy, slowestChainIndexingCursor, snapshotTime, omnichainSnapshot, }: CrossChainIndexingStatusSnapshot): SerializedCrossChainIndexingStatusSnapshot;
|
|
1957
|
+
declare function serializeRealtimeIndexingStatusProjection(indexingProjection: RealtimeIndexingStatusProjection): SerializedRealtimeIndexingStatusProjection;
|
|
1958
|
+
/**
|
|
1959
|
+
* Serialize chain indexing snapshots.
|
|
1960
|
+
*/
|
|
1961
|
+
declare function serializeChainIndexingSnapshots<ChainIndexingStatusSnapshotType extends ChainIndexingStatusSnapshot>(chains: Map<ChainId, ChainIndexingStatusSnapshotType>): Record<ChainIdString, ChainIndexingStatusSnapshotType>;
|
|
1962
|
+
/**
|
|
1963
|
+
* Serialize a {@link OmnichainIndexingStatusSnapshot} object.
|
|
1964
|
+
*/
|
|
1965
|
+
declare function serializeOmnichainIndexingStatusSnapshot(indexingStatus: OmnichainIndexingStatusSnapshot): SerializedOmnichainIndexingStatusSnapshot;
|
|
1966
|
+
|
|
1967
|
+
/**
|
|
1968
|
+
* Gets the SubregistryId (an AccountId) of the Ethnames Subregistry contract (this is the
|
|
1969
|
+
* "BaseRegistrar" contract for direct subnames of .eth) for the provided namespace.
|
|
1970
|
+
*
|
|
1971
|
+
* @param namespace The ENS namespace to get the Ethnames Subregistry ID for
|
|
1972
|
+
* @returns The AccountId for the Ethnames Subregistry contract for the provided namespace.
|
|
1973
|
+
* @throws Error if the contract is not found for the given namespace.
|
|
1974
|
+
*/
|
|
1975
|
+
declare function getEthnamesSubregistryId(namespace: ENSNamespaceId): AccountId;
|
|
1976
|
+
|
|
1977
|
+
/**
|
|
1978
|
+
* Subregistry
|
|
1979
|
+
*/
|
|
1980
|
+
interface Subregistry {
|
|
1981
|
+
/**
|
|
1982
|
+
* Subregistry ID
|
|
1983
|
+
*
|
|
1984
|
+
* The ID of the subregistry the "logical registrar action" was taken on.
|
|
1985
|
+
*
|
|
1986
|
+
* Identifies the chainId and address of the associated subregistry smart
|
|
1987
|
+
* contract.
|
|
1988
|
+
*/
|
|
1989
|
+
subregistryId: AccountId;
|
|
1990
|
+
/**
|
|
1991
|
+
* The node (namehash) of the name the subregistry manages subnames of.
|
|
1992
|
+
* Example subregistry managed names:
|
|
1993
|
+
* - `eth`
|
|
1994
|
+
* - `base.eth`
|
|
1995
|
+
* - `linea.eth`
|
|
1996
|
+
*/
|
|
1997
|
+
node: Node;
|
|
1998
|
+
}
|
|
1999
|
+
/**
|
|
2000
|
+
* Serialized representation of {@link Subregistry}.
|
|
2001
|
+
*/
|
|
2002
|
+
interface SerializedSubregistry extends Omit<Subregistry, "subregistryId"> {
|
|
2003
|
+
subregistryId: SerializedAccountId;
|
|
2004
|
+
}
|
|
2005
|
+
declare function serializeSubregistry(subregistry: Subregistry): SerializedSubregistry;
|
|
2006
|
+
|
|
2007
|
+
/**
|
|
2008
|
+
* Registration Lifecycle Stages
|
|
2009
|
+
*
|
|
2010
|
+
* Important: this definition should not be used anywhere.
|
|
2011
|
+
* It's only here to capture some ideas that were shared in the team.
|
|
2012
|
+
*/
|
|
2013
|
+
declare const RegistrationLifecycleStages: {
|
|
2014
|
+
/**
|
|
2015
|
+
* Active
|
|
2016
|
+
*
|
|
2017
|
+
* Happens when
|
|
2018
|
+
* the current timestamp <= expiry.
|
|
2019
|
+
*/
|
|
2020
|
+
readonly Active: "registrationLifecycle_active";
|
|
2021
|
+
/**
|
|
2022
|
+
* Grace Period
|
|
2023
|
+
*
|
|
2024
|
+
* Happens when
|
|
2025
|
+
* `expiry < the current timestamp <= expiry + 90 days`.
|
|
2026
|
+
*/
|
|
2027
|
+
readonly GracePeriod: "registrationLifecycle_gracePeriod";
|
|
2028
|
+
/**
|
|
2029
|
+
* Released with Temporary Premium Price
|
|
2030
|
+
*
|
|
2031
|
+
* Happens when
|
|
2032
|
+
* `expiry + 90 days < the current timestamp <= expiry + 120 days`.
|
|
2033
|
+
*/
|
|
2034
|
+
readonly ReleasedWithTempPrice: "registrationLifecycle_releasedWithTempPrice";
|
|
2035
|
+
/**
|
|
2036
|
+
* Fully Released (Regular Price)
|
|
2037
|
+
*
|
|
2038
|
+
* Happens when
|
|
2039
|
+
* ` expiry + 120 days < the current timestamp`.
|
|
2040
|
+
*/
|
|
2041
|
+
readonly FullyReleased: "registrationLifecycle_fullyReleased";
|
|
2042
|
+
};
|
|
2043
|
+
type RegistrationLifecycleStage = (typeof RegistrationLifecycleStages)[keyof typeof RegistrationLifecycleStages];
|
|
2044
|
+
/**
|
|
2045
|
+
* Registration Lifecycle
|
|
2046
|
+
*/
|
|
2047
|
+
interface RegistrationLifecycle {
|
|
2048
|
+
/**
|
|
2049
|
+
* Subregistry that manages this Registration Lifecycle.
|
|
2050
|
+
*/
|
|
2051
|
+
subregistry: Subregistry;
|
|
2052
|
+
/**
|
|
2053
|
+
* The node (namehash) of the FQDN of the domain the registration lifecycle
|
|
2054
|
+
* is associated with.
|
|
2055
|
+
*
|
|
2056
|
+
* Guaranteed to be a subname of the node (namehash) of the subregistry
|
|
2057
|
+
* identified by `subregistryId.subregistryId`.
|
|
2058
|
+
*/
|
|
2059
|
+
node: Node;
|
|
2060
|
+
/**
|
|
2061
|
+
* Expires at
|
|
2062
|
+
*
|
|
2063
|
+
* Identifies when the Registration Lifecycle is scheduled to expire.
|
|
2064
|
+
*/
|
|
2065
|
+
expiresAt: UnixTimestamp;
|
|
2066
|
+
}
|
|
2067
|
+
/**
|
|
2068
|
+
* Serialized representation of {@link RegistrationLifecycle}.
|
|
2069
|
+
*/
|
|
2070
|
+
interface SerializedRegistrationLifecycle extends Omit<RegistrationLifecycle, "subregistry"> {
|
|
2071
|
+
subregistry: SerializedSubregistry;
|
|
2072
|
+
}
|
|
2073
|
+
declare function serializeRegistrationLifecycle(registrationLifecycle: RegistrationLifecycle): SerializedRegistrationLifecycle;
|
|
2074
|
+
|
|
2075
|
+
/**
|
|
2076
|
+
* Globally unique, deterministic ID of an indexed onchain event
|
|
2077
|
+
* associated with the "logical registrar action".
|
|
2078
|
+
*/
|
|
2079
|
+
type RegistrarActionEventId = string;
|
|
2080
|
+
/**
|
|
2081
|
+
* Types of "logical registrar action".
|
|
2082
|
+
*/
|
|
2083
|
+
declare const RegistrarActionTypes: {
|
|
2084
|
+
readonly Registration: "registration";
|
|
2085
|
+
readonly Renewal: "renewal";
|
|
2086
|
+
};
|
|
2087
|
+
type RegistrarActionType = (typeof RegistrarActionTypes)[keyof typeof RegistrarActionTypes];
|
|
2088
|
+
/**
|
|
2089
|
+
* Pricing information for a "logical registrar action".
|
|
2090
|
+
*/
|
|
2091
|
+
interface RegistrarActionPricingAvailable {
|
|
2092
|
+
/**
|
|
2093
|
+
* Base cost
|
|
2094
|
+
*
|
|
2095
|
+
* Base cost (before any `premium`) of Ether measured in units of Wei
|
|
2096
|
+
* paid to execute the "logical registrar action".
|
|
2097
|
+
*
|
|
2098
|
+
* May be 0.
|
|
2099
|
+
*/
|
|
2100
|
+
baseCost: PriceEth;
|
|
2101
|
+
/**
|
|
2102
|
+
* Premium
|
|
2103
|
+
*
|
|
2104
|
+
* "premium" cost (in excesses of the `baseCost`) of Ether measured in
|
|
2105
|
+
* units of Wei paid to execute the "logical registrar action".
|
|
2106
|
+
*
|
|
2107
|
+
* May be 0.
|
|
2108
|
+
*/
|
|
2109
|
+
premium: PriceEth;
|
|
2110
|
+
/**
|
|
2111
|
+
* Total
|
|
2112
|
+
*
|
|
2113
|
+
* Total cost of Ether measured in units of Wei paid to execute
|
|
2114
|
+
* the "logical registrar action".
|
|
2115
|
+
*
|
|
2116
|
+
* May be 0.
|
|
2117
|
+
*/
|
|
2118
|
+
total: PriceEth;
|
|
2119
|
+
}
|
|
2120
|
+
/**
|
|
2121
|
+
* Pricing information for a "logical registrar action" when
|
|
2122
|
+
* there is no known pricing data.
|
|
2123
|
+
*/
|
|
2124
|
+
interface RegistrarActionPricingUnknown {
|
|
2125
|
+
/**
|
|
2126
|
+
* Base cost
|
|
2127
|
+
*
|
|
2128
|
+
* Base cost (before any `premium`) of Ether measured in units of Wei
|
|
2129
|
+
* paid to execute the "logical registrar action".
|
|
2130
|
+
*/
|
|
2131
|
+
baseCost: null;
|
|
2132
|
+
/**
|
|
2133
|
+
* Premium
|
|
2134
|
+
*
|
|
2135
|
+
* "premium" cost (in excesses of the `baseCost`) of Ether measured in
|
|
2136
|
+
* units of Wei paid to execute the "logical registrar action".
|
|
2137
|
+
*/
|
|
2138
|
+
premium: null;
|
|
2139
|
+
/**
|
|
2140
|
+
* Total
|
|
2141
|
+
*
|
|
2142
|
+
* Total cost of Ether measured in units of Wei paid to execute
|
|
2143
|
+
* the "logical registrar action".
|
|
2144
|
+
*/
|
|
2145
|
+
total: null;
|
|
2146
|
+
}
|
|
2147
|
+
type RegistrarActionPricing = RegistrarActionPricingAvailable | RegistrarActionPricingUnknown;
|
|
2148
|
+
declare function isRegistrarActionPricingAvailable(registrarActionPricing: RegistrarActionPricing): registrarActionPricing is RegistrarActionPricingAvailable;
|
|
2149
|
+
/**
|
|
2150
|
+
* * Referral information for performing a "logical registrar action".
|
|
2151
|
+
*/
|
|
2152
|
+
interface RegistrarActionReferralAvailable {
|
|
2153
|
+
/**
|
|
2154
|
+
* Encoded Referrer
|
|
2155
|
+
*
|
|
2156
|
+
* Represents the "raw" 32-byte "referrer" value emitted onchain in
|
|
2157
|
+
* association with the registrar action.
|
|
2158
|
+
*/
|
|
2159
|
+
encodedReferrer: EncodedReferrer;
|
|
2160
|
+
/**
|
|
2161
|
+
* Decoded Referrer
|
|
2162
|
+
*
|
|
2163
|
+
* Decoded referrer according to the subjective interpretation of
|
|
2164
|
+
* `encodedReferrer` defined for ENS Holiday Awards.
|
|
2165
|
+
*
|
|
2166
|
+
* Identifies the interpreted address of the referrer.
|
|
2167
|
+
* The "chainId" of this address is the same as is referenced in
|
|
2168
|
+
* `subregistryId`.
|
|
2169
|
+
*
|
|
2170
|
+
* May be the "zero address" to represent that an `encodedReferrer` is
|
|
2171
|
+
* defined but that it is interpreted as no referrer.
|
|
2172
|
+
*/
|
|
2173
|
+
decodedReferrer: Address;
|
|
2174
|
+
}
|
|
2175
|
+
/**
|
|
2176
|
+
* Referral information for performing a "logical registrar action" when
|
|
2177
|
+
* registrar controller does not implement referrals.
|
|
2178
|
+
*/
|
|
2179
|
+
interface RegistrarActionReferralNotApplicable {
|
|
2180
|
+
/**
|
|
2181
|
+
* Encoded Referrer
|
|
2182
|
+
*
|
|
2183
|
+
* Represents the "raw" 32-byte "referrer" value emitted onchain in
|
|
2184
|
+
* association with the registrar action.
|
|
2185
|
+
*/
|
|
2186
|
+
encodedReferrer: null;
|
|
2187
|
+
/**
|
|
2188
|
+
* Decoded Referrer
|
|
2189
|
+
*
|
|
2190
|
+
* Decoded referrer according to the subjective interpretation of
|
|
2191
|
+
* `encodedReferrer` defined for ENS Holiday Awards.
|
|
2192
|
+
*
|
|
2193
|
+
*/
|
|
2194
|
+
decodedReferrer: null;
|
|
2195
|
+
}
|
|
2196
|
+
type RegistrarActionReferral = RegistrarActionReferralAvailable | RegistrarActionReferralNotApplicable;
|
|
2197
|
+
declare function isRegistrarActionReferralAvailable(registrarActionReferral: RegistrarActionReferral): registrarActionReferral is RegistrarActionReferralAvailable;
|
|
2198
|
+
/**
|
|
2199
|
+
* "Logical registrar action"
|
|
2200
|
+
*
|
|
2201
|
+
* Represents a state of "logical registrar action". May be built using data
|
|
2202
|
+
* from multiple events within the same "logical" registration / renewal action.
|
|
2203
|
+
*/
|
|
2204
|
+
interface RegistrarAction {
|
|
2205
|
+
/**
|
|
2206
|
+
* "Logical registrar action" ID
|
|
2207
|
+
*
|
|
2208
|
+
* The `id` value is a deterministic and globally unique identifier for
|
|
2209
|
+
* the "logical registrar action".
|
|
2210
|
+
*
|
|
2211
|
+
* The `id` value represents the *initial* onchain event associated with
|
|
2212
|
+
* the "logical registrar action", but the full state of
|
|
2213
|
+
* the "logical registrar action" is an aggregate across each of
|
|
2214
|
+
* the onchain events referenced in the `eventIds` field.
|
|
2215
|
+
*
|
|
2216
|
+
* Guaranteed to be the very first element in `eventIds` array.
|
|
2217
|
+
*/
|
|
2218
|
+
id: RegistrarActionEventId;
|
|
2219
|
+
/**
|
|
2220
|
+
* The type of the "logical registrar action".
|
|
2221
|
+
*/
|
|
2222
|
+
type: RegistrarActionType;
|
|
2223
|
+
/**
|
|
2224
|
+
*
|
|
2225
|
+
* Incremental Duration
|
|
2226
|
+
*
|
|
2227
|
+
* If `type` is "registration":
|
|
2228
|
+
* - Represents the duration between `block.timestamp` and
|
|
2229
|
+
* the initial `registrationLifecycle.expiresAt` value that the associated
|
|
2230
|
+
* "registration lifecycle" will be initialized with.
|
|
2231
|
+
* If `type` is "renewal":
|
|
2232
|
+
* - Represents the incremental increase in duration made to
|
|
2233
|
+
* the `registrationLifecycle.expiresAt` value in the associated
|
|
2234
|
+
* "registration lifecycle".
|
|
2235
|
+
*
|
|
2236
|
+
* A "registration lifecycle" may be extended via renewal even after it
|
|
2237
|
+
* expires if it is still within its grace period.
|
|
2238
|
+
*
|
|
2239
|
+
* Consider the following scenario:
|
|
2240
|
+
*
|
|
2241
|
+
* The "registration lifecycle" of a direct subname of .eth is scheduled to
|
|
2242
|
+
* expire on Jan 1, midnight UTC. It is currently 30 days after this
|
|
2243
|
+
* expiration time. Therefore, there are currently another 60 days of grace
|
|
2244
|
+
* period remaining for this name. Anyone can still make a renewal to
|
|
2245
|
+
* extend the "registration lifecycle" of this name.
|
|
2246
|
+
*
|
|
2247
|
+
* Given this scenario, consider the following examples:
|
|
2248
|
+
*
|
|
2249
|
+
* 1. If a renewal is made with 10 days incremental duration,
|
|
2250
|
+
* the "registration lifecycle" for this name will remain in
|
|
2251
|
+
* an "expired" state, but it will now have another 70 days of
|
|
2252
|
+
* grace period remaining.
|
|
2253
|
+
*
|
|
2254
|
+
* 2. If a renewal is made with 50 days incremental duration,
|
|
2255
|
+
* the "registration lifecycle" for this name will no longer be
|
|
2256
|
+
* "expired" and will become "active", but the "registration lifecycle"
|
|
2257
|
+
* will now be scheduled to expire again in 20 days.
|
|
2258
|
+
*
|
|
2259
|
+
* After the "registration lifecycle" for a name becomes expired by more
|
|
2260
|
+
* than its grace period, it can no longer be renewed by anyone and is
|
|
2261
|
+
* considered "released". The name must first be registered again, starting
|
|
2262
|
+
* a new "registration lifecycle" of
|
|
2263
|
+
* active / expired / grace period / released.
|
|
2264
|
+
*
|
|
2265
|
+
* May be 0.
|
|
2266
|
+
*
|
|
2267
|
+
* Guaranteed to be a non-negative bigint value.
|
|
2268
|
+
*/
|
|
2269
|
+
incrementalDuration: Duration;
|
|
2270
|
+
/**
|
|
2271
|
+
* Registrant
|
|
2272
|
+
*
|
|
2273
|
+
* Identifies the address that initiated the "logical registrar action" and
|
|
2274
|
+
* is paying the `pricing.total` cost (if applicable).
|
|
2275
|
+
*
|
|
2276
|
+
* It may not be the owner of the name:
|
|
2277
|
+
* 1. When a name is registered, the initial owner of the name may be
|
|
2278
|
+
* distinct from the registrant.
|
|
2279
|
+
* 2. There are no restrictions on who may renew a name.
|
|
2280
|
+
* Therefore the owner of the name may be distinct from the registrant.
|
|
2281
|
+
*
|
|
2282
|
+
* The "chainId" of this address is the same as is referenced in
|
|
2283
|
+
* `registrationLifecycle.subregistry.subregistryId`.
|
|
2284
|
+
*/
|
|
2285
|
+
registrant: Address;
|
|
2286
|
+
/**
|
|
2287
|
+
* Registration Lifecycle associated with this "logical registrar action".
|
|
2288
|
+
*/
|
|
2289
|
+
registrationLifecycle: RegistrationLifecycle;
|
|
2290
|
+
/**
|
|
2291
|
+
* Pricing information associated with this "logical registrar action".
|
|
2292
|
+
*/
|
|
2293
|
+
pricing: RegistrarActionPricing;
|
|
2294
|
+
/**
|
|
2295
|
+
* Referral information associated with this "logical registrar action".
|
|
2296
|
+
*/
|
|
2297
|
+
referral: RegistrarActionReferral;
|
|
2298
|
+
/**
|
|
2299
|
+
* Block ref
|
|
2300
|
+
*
|
|
2301
|
+
* References the block where the "logical registrar action" was executed.
|
|
2302
|
+
*
|
|
2303
|
+
* The "chainId" of this block is the same as is referenced in
|
|
2304
|
+
* `registrationLifecycle.subregistry.subregistryId`.
|
|
2305
|
+
*/
|
|
2306
|
+
block: BlockRef;
|
|
2307
|
+
/**
|
|
2308
|
+
* Transaction hash
|
|
2309
|
+
*
|
|
2310
|
+
* Transaction hash of the transaction associated with
|
|
2311
|
+
* the "logical registrar action".
|
|
2312
|
+
*
|
|
2313
|
+
* The "chainId" of this transaction is the same as is referenced in
|
|
2314
|
+
* `registrationLifecycle.subregistry.subregistryId`.
|
|
2315
|
+
*
|
|
2316
|
+
* Note that a single transaction may be associated with any number of
|
|
2317
|
+
* "logical registrar actions".
|
|
2318
|
+
*/
|
|
2319
|
+
transactionHash: Hash;
|
|
2320
|
+
/**
|
|
2321
|
+
* Event IDs
|
|
2322
|
+
*
|
|
2323
|
+
* Array of the eventIds that have contributed to the state of
|
|
2324
|
+
* the "logical registrar action" record.
|
|
2325
|
+
*
|
|
2326
|
+
* Each eventId is a deterministic and globally unique onchain event
|
|
2327
|
+
* identifier.
|
|
2328
|
+
*
|
|
2329
|
+
* Guarantees:
|
|
2330
|
+
* - Each eventId is of events that occurred within the block
|
|
2331
|
+
* referenced by `block.number`.
|
|
2332
|
+
* - At least 1 eventId.
|
|
2333
|
+
* - Ordered chronologically (ascending) by logIndex within `block.number`.
|
|
2334
|
+
* - The first element in the array is equal to the `id` of
|
|
2335
|
+
* the overall "logical registrar action" record.
|
|
2336
|
+
*
|
|
2337
|
+
* The following ideas are not generalized for ENS overall but happen to
|
|
2338
|
+
* be a characteristic of the scope of our current indexing logic:
|
|
2339
|
+
* 1. These id's always reference events emitted by
|
|
2340
|
+
* a related "BaseRegistrar" contract.
|
|
2341
|
+
* 2. These id's optionally reference events emitted by
|
|
2342
|
+
* a related "Registrar Controller" contract. This is because our
|
|
2343
|
+
* current indexing logic doesn't guarantee to index
|
|
2344
|
+
* all "Registrar Controller" contracts.
|
|
2345
|
+
*/
|
|
2346
|
+
eventIds: [RegistrarActionEventId, ...RegistrarActionEventId[]];
|
|
2347
|
+
}
|
|
2348
|
+
/**
|
|
2349
|
+
* Serialized representation of {@link RegistrarActionPricingUnknown}.
|
|
2350
|
+
*/
|
|
2351
|
+
type SerializedRegistrarActionPricingUnknown = RegistrarActionPricingUnknown;
|
|
2352
|
+
/**
|
|
2353
|
+
* Serialized representation of {@link RegistrarActionPricingAvailable}.
|
|
2354
|
+
*/
|
|
2355
|
+
interface SerializedRegistrarActionPricingAvailable {
|
|
2356
|
+
baseCost: SerializedPriceEth;
|
|
2357
|
+
premium: SerializedPriceEth;
|
|
2358
|
+
total: SerializedPriceEth;
|
|
2359
|
+
}
|
|
2360
|
+
/**
|
|
2361
|
+
* Serialized representation of {@link RegistrarActionPricing}.
|
|
2362
|
+
*/
|
|
2363
|
+
type SerializedRegistrarActionPricing = SerializedRegistrarActionPricingAvailable | SerializedRegistrarActionPricingUnknown;
|
|
2364
|
+
/**
|
|
2365
|
+
* Serialized representation of {@link RegistrarAction}.
|
|
2366
|
+
*/
|
|
2367
|
+
interface SerializedRegistrarAction extends Omit<RegistrarAction, "registrationLifecycle" | "pricing"> {
|
|
2368
|
+
registrationLifecycle: SerializedRegistrationLifecycle;
|
|
2369
|
+
pricing: SerializedRegistrarActionPricing;
|
|
2370
|
+
}
|
|
2371
|
+
declare function serializeRegistrarActionPricing(pricing: RegistrarActionPricing): SerializedRegistrarActionPricing;
|
|
2372
|
+
declare function serializeRegistrarAction(registrarAction: RegistrarAction): SerializedRegistrarAction;
|
|
2373
|
+
|
|
2374
|
+
declare const TheGraphCannotFallbackReasonSchema: z.ZodEnum<{
|
|
2375
|
+
readonly NotSubgraphCompatible: "not-subgraph-compatible";
|
|
2376
|
+
readonly NoApiKey: "no-api-key";
|
|
2377
|
+
readonly NoSubgraphUrl: "no-subgraph-url";
|
|
2378
|
+
}>;
|
|
2379
|
+
declare const TheGraphFallbackSchema: z.ZodObject<{
|
|
2380
|
+
canFallback: z.ZodBoolean;
|
|
2381
|
+
reason: z.ZodNullable<z.ZodEnum<{
|
|
2382
|
+
readonly NotSubgraphCompatible: "not-subgraph-compatible";
|
|
2383
|
+
readonly NoApiKey: "no-api-key";
|
|
2384
|
+
readonly NoSubgraphUrl: "no-subgraph-url";
|
|
2385
|
+
}>>;
|
|
2386
|
+
}, z.core.$strict>;
|
|
2387
|
+
/**
|
|
2388
|
+
* Create a Zod schema for validating a serialized ENSApiPublicConfig.
|
|
983
2389
|
*
|
|
984
|
-
*
|
|
985
|
-
|
|
986
|
-
|
|
2390
|
+
* @param valueLabel - Optional label for the value being validated (used in error messages)
|
|
2391
|
+
*/
|
|
2392
|
+
declare function makeENSApiPublicConfigSchema(valueLabel?: string): z.ZodObject<{
|
|
2393
|
+
version: z.ZodString;
|
|
2394
|
+
theGraphFallback: z.ZodObject<{
|
|
2395
|
+
canFallback: z.ZodBoolean;
|
|
2396
|
+
reason: z.ZodNullable<z.ZodEnum<{
|
|
2397
|
+
readonly NotSubgraphCompatible: "not-subgraph-compatible";
|
|
2398
|
+
readonly NoApiKey: "no-api-key";
|
|
2399
|
+
readonly NoSubgraphUrl: "no-subgraph-url";
|
|
2400
|
+
}>>;
|
|
2401
|
+
}, z.core.$strict>;
|
|
2402
|
+
ensIndexerPublicConfig: z.ZodObject<{
|
|
2403
|
+
labelSet: z.ZodObject<{
|
|
2404
|
+
labelSetId: z.ZodString;
|
|
2405
|
+
labelSetVersion: z.ZodPipe<z.ZodCoercedNumber<unknown>, z.ZodInt>;
|
|
2406
|
+
}, z.core.$strip>;
|
|
2407
|
+
indexedChainIds: z.ZodPipe<z.ZodArray<z.ZodPipe<z.ZodInt, z.ZodTransform<number, number>>>, z.ZodTransform<Set<number>, number[]>>;
|
|
2408
|
+
isSubgraphCompatible: z.ZodBoolean;
|
|
2409
|
+
namespace: z.ZodEnum<{
|
|
2410
|
+
readonly Mainnet: "mainnet";
|
|
2411
|
+
readonly Sepolia: "sepolia";
|
|
2412
|
+
readonly Holesky: "holesky";
|
|
2413
|
+
readonly EnsTestEnv: "ens-test-env";
|
|
2414
|
+
}>;
|
|
2415
|
+
plugins: z.ZodArray<z.ZodString>;
|
|
2416
|
+
databaseSchemaName: z.ZodString;
|
|
2417
|
+
versionInfo: z.ZodObject<{
|
|
2418
|
+
nodejs: z.ZodString;
|
|
2419
|
+
ponder: z.ZodString;
|
|
2420
|
+
ensDb: z.ZodString;
|
|
2421
|
+
ensIndexer: z.ZodString;
|
|
2422
|
+
ensNormalize: z.ZodString;
|
|
2423
|
+
ensRainbow: z.ZodString;
|
|
2424
|
+
ensRainbowSchema: z.ZodInt;
|
|
2425
|
+
}, z.core.$strict>;
|
|
2426
|
+
}, z.core.$strip>;
|
|
2427
|
+
}, z.core.$strict>;
|
|
2428
|
+
|
|
2429
|
+
type TheGraphCannotFallbackReason = z.infer<typeof TheGraphCannotFallbackReasonSchema>;
|
|
2430
|
+
type TheGraphFallback = z.infer<typeof TheGraphFallbackSchema>;
|
|
2431
|
+
/**
|
|
2432
|
+
* Complete public configuration object for ENSApi.
|
|
987
2433
|
*
|
|
988
|
-
*
|
|
989
|
-
*
|
|
990
|
-
* - `latestIndexedBlock` is always before or the same as `latestKnownBlock`
|
|
2434
|
+
* Contains ENSApi-specific configuration at the top level and
|
|
2435
|
+
* embeds the complete ENSIndexer public configuration.
|
|
991
2436
|
*/
|
|
992
|
-
interface
|
|
993
|
-
status: typeof ChainIndexingStatusIds.Following;
|
|
994
|
-
config: ChainIndexingIndefiniteConfig;
|
|
2437
|
+
interface ENSApiPublicConfig {
|
|
995
2438
|
/**
|
|
996
|
-
*
|
|
2439
|
+
* ENSApi service version
|
|
2440
|
+
*
|
|
2441
|
+
* @see https://ghcr.io/namehash/ensnode/ensapi
|
|
997
2442
|
*/
|
|
998
|
-
|
|
2443
|
+
version: string;
|
|
999
2444
|
/**
|
|
1000
|
-
* The
|
|
1001
|
-
* the RPC cache as part of the indexing process.
|
|
2445
|
+
* The Graph Fallback-related info.
|
|
1002
2446
|
*/
|
|
1003
|
-
|
|
2447
|
+
theGraphFallback: TheGraphFallback;
|
|
1004
2448
|
/**
|
|
1005
|
-
*
|
|
1006
|
-
*
|
|
1007
|
-
*
|
|
1008
|
-
*
|
|
1009
|
-
* indexing. The true distance to the latest block on the chain will be less
|
|
1010
|
-
* if the latest block on the chain was not issued at the current second.
|
|
2449
|
+
* Complete ENSIndexer public configuration
|
|
2450
|
+
*
|
|
2451
|
+
* Contains all ENSIndexer public configuration including
|
|
2452
|
+
* namespace, plugins, version info, etc.
|
|
1011
2453
|
*/
|
|
1012
|
-
|
|
2454
|
+
ensIndexerPublicConfig: ENSIndexerPublicConfig;
|
|
1013
2455
|
}
|
|
2456
|
+
|
|
1014
2457
|
/**
|
|
1015
|
-
*
|
|
1016
|
-
*
|
|
1017
|
-
* Indexing of a chain is completed after the backfill when the chain is
|
|
1018
|
-
* not configured to be indefinitely indexed.
|
|
1019
|
-
*
|
|
1020
|
-
* Invariants:
|
|
1021
|
-
* - `config.startBlock` is always before or the same as `latestIndexedBlock`
|
|
1022
|
-
* - `latestIndexedBlock` is always the same as `config.endBlock`.
|
|
2458
|
+
* Serialized representation of {@link ENSApiPublicConfig}
|
|
1023
2459
|
*/
|
|
1024
|
-
interface
|
|
1025
|
-
status: typeof ChainIndexingStatusIds.Completed;
|
|
1026
|
-
config: ChainIndexingDefiniteConfig;
|
|
2460
|
+
interface SerializedENSApiPublicConfig extends Omit<ENSApiPublicConfig, "ensIndexerPublicConfig"> {
|
|
1027
2461
|
/**
|
|
1028
|
-
*
|
|
2462
|
+
* Serialized representation of {@link ENSApiPublicConfig.ensIndexerPublicConfig}.
|
|
1029
2463
|
*/
|
|
1030
|
-
|
|
2464
|
+
ensIndexerPublicConfig: SerializedENSIndexerPublicConfig;
|
|
1031
2465
|
}
|
|
2466
|
+
|
|
1032
2467
|
/**
|
|
1033
|
-
*
|
|
1034
|
-
*
|
|
1035
|
-
* Use the `status` field to determine the correct type interpretation at runtime.
|
|
1036
|
-
*/
|
|
1037
|
-
type ChainIndexingStatus = ChainIndexingUnstartedStatus | ChainIndexingBackfillStatus | ChainIndexingFollowingStatus | ChainIndexingCompletedStatus;
|
|
1038
|
-
/**
|
|
1039
|
-
* Chain Indexing Status: Active
|
|
1040
|
-
*
|
|
1041
|
-
* Represents a chain where indexing is currently active.
|
|
1042
|
-
* The `latestIndexedBlock` field will be available.
|
|
2468
|
+
* Deserialize a {@link ENSApiPublicConfig} object.
|
|
1043
2469
|
*/
|
|
1044
|
-
|
|
2470
|
+
declare function deserializeENSApiPublicConfig(maybeConfig: SerializedENSApiPublicConfig, valueLabel?: string): ENSApiPublicConfig;
|
|
2471
|
+
|
|
1045
2472
|
/**
|
|
1046
|
-
*
|
|
1047
|
-
*
|
|
1048
|
-
* Represents a chain where indexing is currently on standby (not happening).
|
|
1049
|
-
* The `latestIndexedBlock` field will not be available.
|
|
2473
|
+
* Serialize a {@link ENSApiPublicConfig} object.
|
|
1050
2474
|
*/
|
|
1051
|
-
|
|
2475
|
+
declare function serializeENSApiPublicConfig(config: ENSApiPublicConfig): SerializedENSApiPublicConfig;
|
|
2476
|
+
|
|
1052
2477
|
/**
|
|
1053
|
-
*
|
|
1054
|
-
*
|
|
1055
|
-
* Describes the current state of indexing operations across all indexed chains
|
|
1056
|
-
* when the overall indexing status is {@link OverallIndexingStatusIds.Unstarted}.
|
|
2478
|
+
* The resolution status for an `Identity`.
|
|
1057
2479
|
*/
|
|
1058
|
-
|
|
2480
|
+
declare const ResolutionStatusIds: {
|
|
1059
2481
|
/**
|
|
1060
|
-
*
|
|
2482
|
+
* Represents that the `Identity` is not resolved yet.
|
|
1061
2483
|
*/
|
|
1062
|
-
|
|
2484
|
+
readonly Unresolved: "unresolved";
|
|
1063
2485
|
/**
|
|
1064
|
-
*
|
|
1065
|
-
*
|
|
1066
|
-
* Each chain is guaranteed to have the "unstarted" status.
|
|
1067
|
-
* It's impossible for any chain to have status other than "unstarted".
|
|
2486
|
+
* Represents that resolution of the `Identity` resulted in a named identity.
|
|
1068
2487
|
*/
|
|
1069
|
-
|
|
1070
|
-
|
|
2488
|
+
readonly Named: "named";
|
|
2489
|
+
/**
|
|
2490
|
+
* Represents that resolution of the `Identity` resulted in an unnamed identity.
|
|
2491
|
+
*/
|
|
2492
|
+
readonly Unnamed: "unnamed";
|
|
2493
|
+
/**
|
|
2494
|
+
* Represents that attempted resolution of the `Identity` resulted in an error
|
|
2495
|
+
* and therefore it is unknown if the `Identity` resolves to a named or unnamed identity.
|
|
2496
|
+
*/
|
|
2497
|
+
readonly Unknown: "unknown";
|
|
2498
|
+
};
|
|
1071
2499
|
/**
|
|
1072
|
-
*
|
|
2500
|
+
* The derived string union of possible {@link ResolutionStatusIds}.
|
|
1073
2501
|
*/
|
|
1074
|
-
type
|
|
2502
|
+
type ResolutionStatusId = (typeof ResolutionStatusIds)[keyof typeof ResolutionStatusIds];
|
|
1075
2503
|
/**
|
|
1076
|
-
*
|
|
2504
|
+
* Represents an {@link Identity} that has not become a {@link ResolvedIdentity} yet.
|
|
1077
2505
|
*
|
|
1078
|
-
*
|
|
1079
|
-
*
|
|
2506
|
+
* Invariants:
|
|
2507
|
+
* - `resolutionStatus` is always {@link ResolutionStatusIds.Unresolved}.
|
|
1080
2508
|
*/
|
|
1081
|
-
interface
|
|
1082
|
-
|
|
1083
|
-
* Overall Indexing Status
|
|
1084
|
-
*/
|
|
1085
|
-
overallStatus: typeof OverallIndexingStatusIds.Backfill;
|
|
2509
|
+
interface UnresolvedIdentity {
|
|
2510
|
+
resolutionStatus: typeof ResolutionStatusIds.Unresolved;
|
|
1086
2511
|
/**
|
|
1087
|
-
*
|
|
1088
|
-
*
|
|
1089
|
-
* Identifies the timestamp of the progress of omnichain indexing across
|
|
1090
|
-
* all chains in {@link ChainIndexingBackfillStatus} status.
|
|
1091
|
-
*
|
|
1092
|
-
* Invariants:
|
|
1093
|
-
* - the cursor value is guaranteed to be lower than or equal to
|
|
1094
|
-
* the timestamp of the earliest `config.startBlock` across all chains
|
|
1095
|
-
* in {@link ChainIndexingStandbyStatus} status.
|
|
2512
|
+
* The {@link DefaultableChainId} for an ENSIP-19 primary name lookup of the
|
|
2513
|
+
* identity associated with `address`.
|
|
1096
2514
|
*/
|
|
1097
|
-
|
|
2515
|
+
chainId: DefaultableChainId;
|
|
1098
2516
|
/**
|
|
1099
|
-
*
|
|
1100
|
-
*
|
|
1101
|
-
* At least one chain is guaranteed to be in the "backfill" status.
|
|
1102
|
-
* Each chain is guaranteed to have a status of either "unstarted",
|
|
1103
|
-
* "backfill" or "completed". It's impossible for any chain to be
|
|
1104
|
-
* in the "following" status.
|
|
2517
|
+
* The {@link Address} of the identity.
|
|
1105
2518
|
*/
|
|
1106
|
-
|
|
2519
|
+
address: Address;
|
|
1107
2520
|
}
|
|
1108
2521
|
/**
|
|
1109
|
-
*
|
|
2522
|
+
* Represents an `Identity` that resolved to a primary name.
|
|
1110
2523
|
*
|
|
1111
|
-
*
|
|
1112
|
-
*
|
|
1113
|
-
* all indexing of that definite range is completed.
|
|
2524
|
+
* Invariants:
|
|
2525
|
+
* - `resolutionStatus` is always {@link ResolutionStatusIds.Named}.
|
|
1114
2526
|
*/
|
|
1115
|
-
interface
|
|
2527
|
+
interface NamedIdentity {
|
|
2528
|
+
resolutionStatus: typeof ResolutionStatusIds.Named;
|
|
1116
2529
|
/**
|
|
1117
|
-
*
|
|
2530
|
+
* The {@link DefaultableChainId} for an ENSIP-19 primary name lookup of the
|
|
2531
|
+
* identity associated with `address`.
|
|
1118
2532
|
*/
|
|
1119
|
-
|
|
2533
|
+
chainId: DefaultableChainId;
|
|
1120
2534
|
/**
|
|
1121
|
-
*
|
|
1122
|
-
*
|
|
1123
|
-
* Each chain is guaranteed to have the "completed" status.
|
|
1124
|
-
* It's impossible for any chain to have status other than "completed".
|
|
2535
|
+
* The address of the identity.
|
|
1125
2536
|
*/
|
|
1126
|
-
|
|
2537
|
+
address: Address;
|
|
2538
|
+
/**
|
|
2539
|
+
* The ENSIP-19 primary name lookup result of `address` on `chainId`.
|
|
2540
|
+
*/
|
|
2541
|
+
name: Name;
|
|
1127
2542
|
}
|
|
1128
2543
|
/**
|
|
1129
|
-
*
|
|
2544
|
+
* Represents an `Identity` that did not resolve to a primary name.
|
|
1130
2545
|
*
|
|
1131
|
-
*
|
|
1132
|
-
* {@link
|
|
2546
|
+
* Invariants:
|
|
2547
|
+
* - `resolutionStatus` is always {@link ResolutionStatusIds.Unnamed}.
|
|
2548
|
+
* - `name` is always `null`.
|
|
1133
2549
|
*/
|
|
1134
|
-
interface
|
|
1135
|
-
|
|
1136
|
-
* Overall Indexing Status
|
|
1137
|
-
*/
|
|
1138
|
-
overallStatus: typeof OverallIndexingStatusIds.Following;
|
|
2550
|
+
interface UnnamedIdentity {
|
|
2551
|
+
resolutionStatus: typeof ResolutionStatusIds.Unnamed;
|
|
1139
2552
|
/**
|
|
1140
|
-
*
|
|
1141
|
-
*
|
|
1142
|
-
* Identifies the timestamp of the progress of omnichain indexing across
|
|
1143
|
-
* all chains in {@link ChainIndexingActiveStatus} status.
|
|
1144
|
-
*
|
|
1145
|
-
* Invariants:
|
|
1146
|
-
* - the cursor value is guaranteed to be lower than or equal to
|
|
1147
|
-
* the timestamp of the earliest `config.startBlock` across all chains
|
|
1148
|
-
* in {@link ChainIndexingStandbyStatus} status.
|
|
2553
|
+
* The {@link DefaultableChainId} for an ENSIP-19 primary name lookup of the
|
|
2554
|
+
* identity associated with `address`.
|
|
1149
2555
|
*/
|
|
1150
|
-
|
|
2556
|
+
chainId: DefaultableChainId;
|
|
1151
2557
|
/**
|
|
1152
|
-
*
|
|
1153
|
-
*
|
|
1154
|
-
* At least one chain is guaranteed to be in the "following" status.
|
|
1155
|
-
* Each chain is guaranteed to have a status of either "unstarted",
|
|
1156
|
-
* "backfill", "following" or "completed".
|
|
2558
|
+
* The address of the identity.
|
|
1157
2559
|
*/
|
|
1158
|
-
|
|
2560
|
+
address: Address;
|
|
1159
2561
|
/**
|
|
1160
|
-
* The
|
|
1161
|
-
* {@link ChainIndexingFollowingStatus.approxRealtimeDistance} value
|
|
1162
|
-
* across all chains with status: 'following'.
|
|
2562
|
+
* The ENSIP-19 primary name lookup result of `address` on `chainId`.
|
|
1163
2563
|
*/
|
|
1164
|
-
|
|
2564
|
+
name: null;
|
|
1165
2565
|
}
|
|
1166
2566
|
/**
|
|
1167
|
-
*
|
|
1168
|
-
*
|
|
1169
|
-
*
|
|
1170
|
-
* all indexed chains.
|
|
2567
|
+
* Represents an `Identity` that was attempted to be resolved but the resolution attempt
|
|
2568
|
+
* resulted in an error and therefore it is unknown if the `Identity` resolves to a named
|
|
2569
|
+
* or unnamed identity.
|
|
1171
2570
|
*
|
|
1172
|
-
*
|
|
2571
|
+
* Invariants:
|
|
2572
|
+
* - `resolutionStatus` is always {@link ResolutionStatusIds.Unknown}.
|
|
1173
2573
|
*/
|
|
1174
|
-
interface
|
|
2574
|
+
interface UnknownIdentity {
|
|
2575
|
+
resolutionStatus: typeof ResolutionStatusIds.Unknown;
|
|
2576
|
+
/**
|
|
2577
|
+
* The {@link DefaultableChainId} for an ENSIP-19 primary name lookup of the
|
|
2578
|
+
* identity associated with `address`.
|
|
2579
|
+
*/
|
|
2580
|
+
chainId: DefaultableChainId;
|
|
1175
2581
|
/**
|
|
1176
|
-
*
|
|
2582
|
+
* The address of the identity.
|
|
1177
2583
|
*/
|
|
1178
|
-
|
|
2584
|
+
address: Address;
|
|
1179
2585
|
}
|
|
1180
2586
|
/**
|
|
1181
|
-
*
|
|
2587
|
+
* Represents an ENSIP-19 identity resolution result.
|
|
1182
2588
|
*
|
|
1183
|
-
*
|
|
1184
|
-
|
|
1185
|
-
type ENSIndexerOverallIndexingStatus = ENSIndexerOverallIndexingUnstartedStatus | ENSIndexerOverallIndexingBackfillStatus | ENSIndexerOverallIndexingCompletedStatus | ENSIndexerOverallIndexingFollowingStatus | ENSIndexerOverallIndexingErrorStatus;
|
|
1186
|
-
|
|
1187
|
-
/**
|
|
1188
|
-
* Serialized representation of {@link ENSIndexerOverallIndexingUnstartedStatus}
|
|
1189
|
-
*/
|
|
1190
|
-
interface SerializedENSIndexerOverallIndexingUnstartedStatus extends Omit<ENSIndexerOverallIndexingUnstartedStatus, "chains"> {
|
|
1191
|
-
chains: Record<ChainIdString, ChainIndexingUnstartedStatus>;
|
|
1192
|
-
}
|
|
1193
|
-
/**
|
|
1194
|
-
* Serialized representation of {@link ENSIndexerOverallIndexingBackfillStatus}
|
|
1195
|
-
*/
|
|
1196
|
-
interface SerializedENSIndexerOverallIndexingBackfillStatus extends Omit<ENSIndexerOverallIndexingBackfillStatus, "chains"> {
|
|
1197
|
-
chains: Record<ChainIdString, ChainIndexingStatusForBackfillOverallStatus>;
|
|
1198
|
-
}
|
|
1199
|
-
/**
|
|
1200
|
-
* Serialized representation of {@link ENSIndexerOverallIndexingCompletedStatus}
|
|
1201
|
-
*/
|
|
1202
|
-
interface SerializedENSIndexerOverallIndexingCompletedStatus extends Omit<ENSIndexerOverallIndexingCompletedStatus, "chains"> {
|
|
1203
|
-
chains: Record<ChainIdString, ChainIndexingCompletedStatus>;
|
|
1204
|
-
}
|
|
1205
|
-
/**
|
|
1206
|
-
* Serialized representation of {@link ENSIndexerOverallIndexingFollowingStatus}
|
|
1207
|
-
*/
|
|
1208
|
-
interface SerializedENSIndexerOverallIndexingFollowingStatus extends Omit<ENSIndexerOverallIndexingFollowingStatus, "chains"> {
|
|
1209
|
-
chains: Record<ChainIdString, ChainIndexingStatus>;
|
|
1210
|
-
}
|
|
1211
|
-
/**
|
|
1212
|
-
* Serialized representation of {@link ENSIndexerOverallIndexingErrorStatus}
|
|
1213
|
-
*/
|
|
1214
|
-
interface SerializedENSIndexerOverallIndexingErrorStatus extends ENSIndexerOverallIndexingErrorStatus {
|
|
1215
|
-
}
|
|
1216
|
-
/**
|
|
1217
|
-
* Serialized representation of {@link ENSIndexerOverallIndexingStatus}
|
|
2589
|
+
* Use the `resolutionStatus` field to determine the specific type interpretation
|
|
2590
|
+
* at runtime.
|
|
1218
2591
|
*/
|
|
1219
|
-
type
|
|
1220
|
-
|
|
2592
|
+
type ResolvedIdentity = NamedIdentity | UnnamedIdentity | UnknownIdentity;
|
|
1221
2593
|
/**
|
|
1222
|
-
*
|
|
2594
|
+
* Represents an ENSIP-19 identity resolution (which may or not have been
|
|
2595
|
+
* resolved to a result yet).
|
|
2596
|
+
*
|
|
2597
|
+
* Use the `resolutionStatus` field to determine the specific type interpretation
|
|
2598
|
+
* at runtime.
|
|
1223
2599
|
*/
|
|
1224
|
-
|
|
2600
|
+
type Identity = UnresolvedIdentity | ResolvedIdentity;
|
|
1225
2601
|
|
|
1226
2602
|
/**
|
|
1227
|
-
*
|
|
2603
|
+
* Builds an {@link UnresolvedIdentity} for the provided {@link Address},
|
|
2604
|
+
* {@link DefaultableChainId} and {@link ENSNamespaceId}.
|
|
1228
2605
|
*
|
|
1229
|
-
*
|
|
1230
|
-
*
|
|
1231
|
-
* statuses were provided to this function guarantees there was no indexer
|
|
1232
|
-
* error, and that the overall indexing status is never
|
|
1233
|
-
* an {@link OverallIndexingStatusIds.IndexerError}
|
|
2606
|
+
* If no `chainId` is provided, uses the ENS Root Chain Id for the provided
|
|
2607
|
+
* `namespaceId`.
|
|
1234
2608
|
*/
|
|
1235
|
-
declare function
|
|
2609
|
+
declare function buildUnresolvedIdentity(address: Address, namespaceId: ENSNamespaceId, chainId?: DefaultableChainId): UnresolvedIdentity;
|
|
1236
2610
|
/**
|
|
1237
|
-
*
|
|
2611
|
+
* Returns whether the provided {@link Identity} is a {@link ResolvedIdentity}.
|
|
1238
2612
|
*
|
|
1239
|
-
* @
|
|
1240
|
-
|
|
1241
|
-
declare function getOverallApproxRealtimeDistance(chains: ChainIndexingStatus[]): Duration;
|
|
1242
|
-
/**
|
|
1243
|
-
* Get lowest of the highest end block across all chains which status is
|
|
1244
|
-
* {@link ChainIndexingStatus}.
|
|
2613
|
+
* @param identity - The {@link Identity} to check.
|
|
2614
|
+
* @returns Whether the provided {@link Identity} is a {@link ResolvedIdentity}.
|
|
1245
2615
|
*/
|
|
1246
|
-
declare function
|
|
2616
|
+
declare function isResolvedIdentity(identity: Identity): identity is ResolvedIdentity;
|
|
2617
|
+
|
|
1247
2618
|
/**
|
|
1248
|
-
*
|
|
1249
|
-
*
|
|
2619
|
+
* Gets the "chainId param" that should be used for a primary name resolution
|
|
2620
|
+
* request.
|
|
2621
|
+
*
|
|
2622
|
+
* ENSIP-19 defines special rules for the "chainId param" used
|
|
2623
|
+
* in primary name resolutions for the case that the `chainId` is the
|
|
2624
|
+
* ENS Root Chain Id for the provided `namespaceId`.
|
|
2625
|
+
*
|
|
2626
|
+
* Whenever this case happens, ENSIP-19 requires that the
|
|
2627
|
+
* "chainId param" is always set to chainId: 1 (mainnet), even if the
|
|
2628
|
+
* `chainId` where the primary name lookup is actually happening
|
|
2629
|
+
* on a non-mainnet ENS Root Chain, such as on a testnet or
|
|
2630
|
+
* the ens-test-env.
|
|
2631
|
+
*
|
|
2632
|
+
* @param namespaceId The namespace id for the primary name lookup.
|
|
2633
|
+
* @param chainId The chain id where the primary name lookup will actually happen.
|
|
2634
|
+
* @returns The "chainId param" that should be used for the primary name lookup.
|
|
1250
2635
|
*/
|
|
1251
|
-
declare
|
|
2636
|
+
declare const getResolvePrimaryNameChainIdParam: (chainId: DefaultableChainId, namespaceId: ENSNamespaceId) => DefaultableChainId;
|
|
1252
2637
|
/**
|
|
1253
|
-
*
|
|
1254
|
-
*
|
|
2638
|
+
* Translates a `DefaultableChainId` a `ChainId`
|
|
2639
|
+
* such that if the provided `chainId` is `DEFAULT_EVM_CHAIN_ID`,
|
|
2640
|
+
* the `ChainId` of the ENS Root Chain for the provided `namespaceId` is returned.
|
|
2641
|
+
*
|
|
2642
|
+
* @param chainId The `DefaultableChainId` to translate.
|
|
2643
|
+
* @param namespaceId The namespace id for the translation.
|
|
2644
|
+
* @returns the translated `ChainId`.
|
|
1255
2645
|
*/
|
|
1256
|
-
declare
|
|
2646
|
+
declare const translateDefaultableChainIdToChainId: (chainId: DefaultableChainId, namespaceId: ENSNamespaceId) => ChainId;
|
|
2647
|
+
|
|
1257
2648
|
/**
|
|
1258
|
-
*
|
|
2649
|
+
* Encodes a selection of Resolver records in the context of a specific Name.
|
|
1259
2650
|
*/
|
|
1260
|
-
|
|
2651
|
+
interface ResolverRecordsSelection {
|
|
2652
|
+
/**
|
|
2653
|
+
* Whether to fetch the name's `name` record. This value is primarily used in the context of
|
|
2654
|
+
* Reverse Resolution.
|
|
2655
|
+
*
|
|
2656
|
+
* @see https://docs.ens.domains/ensip/19/#reverse-resolution
|
|
2657
|
+
*/
|
|
2658
|
+
name?: boolean;
|
|
2659
|
+
/**
|
|
2660
|
+
* Which coinTypes to fetch address records for.
|
|
2661
|
+
*/
|
|
2662
|
+
addresses?: CoinType[];
|
|
2663
|
+
/**
|
|
2664
|
+
* Which keys to fetch text records for.
|
|
2665
|
+
*/
|
|
2666
|
+
texts?: string[];
|
|
2667
|
+
}
|
|
2668
|
+
declare const isSelectionEmpty: (selection: ResolverRecordsSelection) => boolean;
|
|
2669
|
+
|
|
1261
2670
|
/**
|
|
1262
|
-
*
|
|
2671
|
+
* An internal type representing a non-inferred ResolverRecordsResponse, used in situations where
|
|
2672
|
+
* access to the more specific inferred type (ResolverRecordsResponse<SELECTION>) is difficult or
|
|
2673
|
+
* unnecessary.
|
|
1263
2674
|
*/
|
|
1264
|
-
|
|
2675
|
+
type ResolverRecordsResponseBase = {
|
|
2676
|
+
/**
|
|
2677
|
+
* The name record, relevant in the context of Reverse Resolution.
|
|
2678
|
+
* Null if no name record is set.
|
|
2679
|
+
*/
|
|
2680
|
+
name: Name | null;
|
|
2681
|
+
/**
|
|
2682
|
+
* Address records, keyed by CoinType.
|
|
2683
|
+
* Value is null if no record for the specified CoinType is set.
|
|
2684
|
+
*
|
|
2685
|
+
* NOTE: ENS resolver address records can store arbitrary string values,
|
|
2686
|
+
* including non-EVM addresses — always validate the record value against
|
|
2687
|
+
* the format your application expects.
|
|
2688
|
+
*/
|
|
2689
|
+
addresses: Record<CoinType, string | null>;
|
|
2690
|
+
/**
|
|
2691
|
+
* Text records, keyed by key.
|
|
2692
|
+
* Value is null if no record for the specified key is set.
|
|
2693
|
+
*/
|
|
2694
|
+
texts: Record<string, string | null>;
|
|
2695
|
+
};
|
|
1265
2696
|
/**
|
|
1266
|
-
*
|
|
2697
|
+
* Represents the strongly-typed set of records based on the provided SELECTION
|
|
1267
2698
|
*
|
|
1268
|
-
* @
|
|
1269
|
-
*
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
*
|
|
1274
|
-
*
|
|
1275
|
-
* - All chains are guaranteed to have a status of "unstarted".
|
|
2699
|
+
* @example
|
|
2700
|
+
* ```typescript
|
|
2701
|
+
* const selection = {
|
|
2702
|
+
* name: true,
|
|
2703
|
+
* addresses: [60],
|
|
2704
|
+
* texts: ["com.twitter", "avatar"],
|
|
2705
|
+
* } as const satisfies ResolverRecordsSelection;
|
|
1276
2706
|
*
|
|
1277
|
-
*
|
|
1278
|
-
*
|
|
2707
|
+
* type Response = ResolverRecordsResponse<typeof selection>;
|
|
2708
|
+
*
|
|
2709
|
+
* // results in the following type
|
|
2710
|
+
* type Response = {
|
|
2711
|
+
* readonly name: Name | null;
|
|
2712
|
+
* readonly addresses: Record<"60", string | null>;
|
|
2713
|
+
* readonly texts: Record<"avatar" | "com.twitter", string | null>;
|
|
2714
|
+
* }
|
|
2715
|
+
* ```
|
|
1279
2716
|
*/
|
|
1280
|
-
|
|
2717
|
+
type ResolverRecordsResponse<T extends ResolverRecordsSelection = ResolverRecordsSelection> = {
|
|
2718
|
+
[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];
|
|
2719
|
+
};
|
|
2720
|
+
|
|
1281
2721
|
/**
|
|
1282
|
-
*
|
|
1283
|
-
* requirements:
|
|
1284
|
-
* - At least one chain is guaranteed to be in the "backfill" status.
|
|
1285
|
-
* - Each chain is guaranteed to have a status of either "unstarted",
|
|
1286
|
-
* "backfill" or "completed".
|
|
1287
|
-
*
|
|
1288
|
-
* Note: This function narrows the {@linkChainIndexingStatus} type to
|
|
1289
|
-
* {@link ChainIndexingStatusForBackfillOverallStatus}.
|
|
2722
|
+
* Arguments required to perform Forward Resolution
|
|
1290
2723
|
*/
|
|
1291
|
-
|
|
2724
|
+
interface ForwardResolutionArgs<SELECTION extends ResolverRecordsSelection> {
|
|
2725
|
+
name: Name;
|
|
2726
|
+
selection: SELECTION;
|
|
2727
|
+
}
|
|
1292
2728
|
/**
|
|
1293
|
-
*
|
|
1294
|
-
* requirements:
|
|
1295
|
-
* - All chains are guaranteed to have a status of "completed".
|
|
1296
|
-
*
|
|
1297
|
-
* Note: This function narrows the {@linkChainIndexingStatus} type to
|
|
1298
|
-
* {@link ChainIndexingCompletedStatus}.
|
|
2729
|
+
* The result of performing ForwardResolution
|
|
1299
2730
|
*/
|
|
1300
|
-
|
|
2731
|
+
type ForwardResolutionResult<SELECTION extends ResolverRecordsSelection> = ResolverRecordsResponse<SELECTION>;
|
|
1301
2732
|
/**
|
|
1302
|
-
*
|
|
1303
|
-
* requirements:
|
|
1304
|
-
* - At least one chain is guaranteed to be in the "following" status.
|
|
1305
|
-
* - Any other chain can have any status.
|
|
2733
|
+
* Arguments required to perform Reverse Resolution
|
|
1306
2734
|
*/
|
|
1307
|
-
|
|
2735
|
+
interface ReverseResolutionArgs {
|
|
2736
|
+
address: Address;
|
|
2737
|
+
chainId: ChainId;
|
|
2738
|
+
}
|
|
1308
2739
|
/**
|
|
1309
|
-
*
|
|
1310
|
-
* by the omnichain start block timestamp in ascending order.
|
|
2740
|
+
* The result of performing ReverseResolution
|
|
1311
2741
|
*/
|
|
1312
|
-
|
|
1313
|
-
|
|
2742
|
+
type ReverseResolutionResult = Name | null;
|
|
1314
2743
|
/**
|
|
1315
|
-
*
|
|
2744
|
+
* Arguments required to perform Multichain Primary Name Resolution
|
|
1316
2745
|
*/
|
|
1317
|
-
|
|
2746
|
+
interface MultichainPrimaryNameResolutionArgs {
|
|
2747
|
+
address: Address;
|
|
2748
|
+
chainIds?: ChainId[];
|
|
2749
|
+
}
|
|
1318
2750
|
/**
|
|
1319
|
-
*
|
|
2751
|
+
* The result of performing MultichainPrimaryNameResolution
|
|
1320
2752
|
*/
|
|
1321
|
-
|
|
2753
|
+
type MultichainPrimaryNameResolutionResult = Record<ChainId, Name | null>;
|
|
1322
2754
|
|
|
1323
2755
|
/**
|
|
1324
2756
|
* Identifiers for each traceable ENS protocol.
|
|
@@ -1383,220 +2815,469 @@ interface ProtocolSpan {
|
|
|
1383
2815
|
type ProtocolSpanTreeNode = ProtocolSpan & {
|
|
1384
2816
|
children: ProtocolSpanTreeNode[];
|
|
1385
2817
|
};
|
|
1386
|
-
type ProtocolTrace = ProtocolSpanTreeNode[];
|
|
1387
|
-
|
|
2818
|
+
type ProtocolTrace = ProtocolSpanTreeNode[];
|
|
2819
|
+
|
|
2820
|
+
declare const ErrorResponseSchema: z$1.ZodObject<{
|
|
2821
|
+
message: z$1.ZodString;
|
|
2822
|
+
details: z$1.ZodOptional<z$1.ZodUnknown>;
|
|
2823
|
+
}, z$1.core.$strip>;
|
|
2824
|
+
|
|
2825
|
+
/**
|
|
2826
|
+
* API Error Response Type
|
|
2827
|
+
*/
|
|
2828
|
+
type ErrorResponse = z$1.infer<typeof ErrorResponseSchema>;
|
|
2829
|
+
interface TraceableRequest {
|
|
2830
|
+
trace?: boolean;
|
|
2831
|
+
}
|
|
2832
|
+
interface TraceableResponse {
|
|
2833
|
+
trace?: ProtocolTrace;
|
|
2834
|
+
}
|
|
2835
|
+
interface AcceleratableRequest {
|
|
2836
|
+
accelerate?: boolean;
|
|
2837
|
+
}
|
|
2838
|
+
interface AcceleratableResponse {
|
|
2839
|
+
accelerationRequested: boolean;
|
|
2840
|
+
accelerationAttempted: boolean;
|
|
2841
|
+
}
|
|
2842
|
+
/**
|
|
2843
|
+
* Resolve Records Request Type
|
|
2844
|
+
*/
|
|
2845
|
+
interface ResolveRecordsRequest<SELECTION extends ResolverRecordsSelection> extends ForwardResolutionArgs<SELECTION>, AcceleratableRequest, TraceableRequest {
|
|
2846
|
+
}
|
|
2847
|
+
/**
|
|
2848
|
+
* Resolve Records Response Type
|
|
2849
|
+
*/
|
|
2850
|
+
interface ResolveRecordsResponse<SELECTION extends ResolverRecordsSelection> extends AcceleratableResponse, TraceableResponse {
|
|
2851
|
+
records: ResolverRecordsResponse<SELECTION>;
|
|
2852
|
+
}
|
|
2853
|
+
/**
|
|
2854
|
+
* Resolve Primary Name Request Type
|
|
2855
|
+
*/
|
|
2856
|
+
interface ResolvePrimaryNameRequest extends ReverseResolutionArgs, AcceleratableRequest, TraceableRequest {
|
|
2857
|
+
}
|
|
2858
|
+
/**
|
|
2859
|
+
* Resolve Primary Name Response Type
|
|
2860
|
+
*/
|
|
2861
|
+
interface ResolvePrimaryNameResponse extends AcceleratableResponse, TraceableResponse {
|
|
2862
|
+
name: ReverseResolutionResult;
|
|
2863
|
+
}
|
|
2864
|
+
interface ResolvePrimaryNamesRequest extends MultichainPrimaryNameResolutionArgs, AcceleratableRequest, TraceableRequest {
|
|
2865
|
+
}
|
|
2866
|
+
interface ResolvePrimaryNamesResponse extends AcceleratableResponse, TraceableResponse {
|
|
2867
|
+
names: MultichainPrimaryNameResolutionResult;
|
|
2868
|
+
}
|
|
2869
|
+
/**
|
|
2870
|
+
* ENSIndexer Public Config Response
|
|
2871
|
+
*/
|
|
2872
|
+
type ConfigResponse = ENSApiPublicConfig;
|
|
2873
|
+
/**
|
|
2874
|
+
* Represents a request to Indexing Status API.
|
|
2875
|
+
*/
|
|
2876
|
+
type IndexingStatusRequest = {};
|
|
2877
|
+
/**
|
|
2878
|
+
* A status code for indexing status responses.
|
|
2879
|
+
*/
|
|
2880
|
+
declare const IndexingStatusResponseCodes: {
|
|
2881
|
+
/**
|
|
2882
|
+
* Represents that the indexing status is available.
|
|
2883
|
+
*/
|
|
2884
|
+
readonly Ok: "ok";
|
|
2885
|
+
/**
|
|
2886
|
+
* Represents that the indexing status is unavailable.
|
|
2887
|
+
*/
|
|
2888
|
+
readonly Error: "error";
|
|
2889
|
+
};
|
|
2890
|
+
/**
|
|
2891
|
+
* The derived string union of possible {@link IndexingStatusResponseCodes}.
|
|
2892
|
+
*/
|
|
2893
|
+
type IndexingStatusResponseCode = (typeof IndexingStatusResponseCodes)[keyof typeof IndexingStatusResponseCodes];
|
|
2894
|
+
/**
|
|
2895
|
+
* An indexing status response when the indexing status is available.
|
|
2896
|
+
*/
|
|
2897
|
+
type IndexingStatusResponseOk = {
|
|
2898
|
+
responseCode: typeof IndexingStatusResponseCodes.Ok;
|
|
2899
|
+
realtimeProjection: RealtimeIndexingStatusProjection;
|
|
2900
|
+
};
|
|
1388
2901
|
/**
|
|
1389
|
-
*
|
|
2902
|
+
* An indexing status response when the indexing status is unavailable.
|
|
1390
2903
|
*/
|
|
1391
|
-
|
|
2904
|
+
type IndexingStatusResponseError = {
|
|
2905
|
+
responseCode: typeof IndexingStatusResponseCodes.Error;
|
|
2906
|
+
};
|
|
2907
|
+
/**
|
|
2908
|
+
* Indexing status response.
|
|
2909
|
+
*
|
|
2910
|
+
* Use the `responseCode` field to determine the specific type interpretation
|
|
2911
|
+
* at runtime.
|
|
2912
|
+
*/
|
|
2913
|
+
type IndexingStatusResponse = IndexingStatusResponseOk | IndexingStatusResponseError;
|
|
2914
|
+
/**
|
|
2915
|
+
* Registrar Actions response
|
|
2916
|
+
*/
|
|
2917
|
+
/**
|
|
2918
|
+
* Records Filters: Filter Types
|
|
2919
|
+
*/
|
|
2920
|
+
declare const RegistrarActionsFilterTypes: {
|
|
2921
|
+
readonly BySubregistryNode: "bySubregistryNode";
|
|
2922
|
+
readonly WithEncodedReferral: "withEncodedReferral";
|
|
2923
|
+
};
|
|
2924
|
+
type RegistrarActionsFilterType = (typeof RegistrarActionsFilterTypes)[keyof typeof RegistrarActionsFilterTypes];
|
|
2925
|
+
type RegistrarActionsFilterBySubregistryNode = {
|
|
2926
|
+
filterType: typeof RegistrarActionsFilterTypes.BySubregistryNode;
|
|
2927
|
+
value: Node;
|
|
2928
|
+
};
|
|
2929
|
+
type RegistrarActionsFilterWithEncodedReferral = {
|
|
2930
|
+
filterType: typeof RegistrarActionsFilterTypes.WithEncodedReferral;
|
|
2931
|
+
};
|
|
2932
|
+
type RegistrarActionsFilter = RegistrarActionsFilterBySubregistryNode | RegistrarActionsFilterWithEncodedReferral;
|
|
2933
|
+
/**
|
|
2934
|
+
* Records Orders
|
|
2935
|
+
*/
|
|
2936
|
+
declare const RegistrarActionsOrders: {
|
|
2937
|
+
readonly LatestRegistrarActions: "orderBy[timestamp]=desc";
|
|
2938
|
+
};
|
|
2939
|
+
type RegistrarActionsOrder = (typeof RegistrarActionsOrders)[keyof typeof RegistrarActionsOrders];
|
|
2940
|
+
/**
|
|
2941
|
+
* Represents a request to Registrar Actions API.
|
|
2942
|
+
*/
|
|
2943
|
+
type RegistrarActionsRequest = {
|
|
1392
2944
|
/**
|
|
1393
|
-
*
|
|
1394
|
-
* Reverse Resolution.
|
|
1395
|
-
*
|
|
1396
|
-
* @see https://docs.ens.domains/ensip/19/#reverse-resolution
|
|
2945
|
+
* Filters to be applied while generating results.
|
|
1397
2946
|
*/
|
|
1398
|
-
|
|
2947
|
+
filters?: RegistrarActionsFilter[];
|
|
1399
2948
|
/**
|
|
1400
|
-
*
|
|
2949
|
+
* Order applied while generating results.
|
|
1401
2950
|
*/
|
|
1402
|
-
|
|
2951
|
+
order?: RegistrarActionsOrder;
|
|
1403
2952
|
/**
|
|
1404
|
-
*
|
|
2953
|
+
* Limit the count of items per page to selected count of records.
|
|
2954
|
+
*
|
|
2955
|
+
* Guaranteed to be a positive integer (if defined).
|
|
1405
2956
|
*/
|
|
1406
|
-
|
|
1407
|
-
}
|
|
1408
|
-
declare const isSelectionEmpty: (selection: ResolverRecordsSelection) => boolean;
|
|
1409
|
-
|
|
2957
|
+
itemsPerPage?: number;
|
|
2958
|
+
};
|
|
1410
2959
|
/**
|
|
1411
|
-
*
|
|
1412
|
-
* access to the more specific inferred type (ResolverRecordsResponse<SELECTION>) is difficult or
|
|
1413
|
-
* unnecessary.
|
|
2960
|
+
* A status code for Registrar Actions API responses.
|
|
1414
2961
|
*/
|
|
1415
|
-
|
|
2962
|
+
declare const RegistrarActionsResponseCodes: {
|
|
1416
2963
|
/**
|
|
1417
|
-
*
|
|
1418
|
-
* Null if no name record is set.
|
|
2964
|
+
* Represents that Registrar Actions are available.
|
|
1419
2965
|
*/
|
|
1420
|
-
|
|
2966
|
+
readonly Ok: "ok";
|
|
1421
2967
|
/**
|
|
1422
|
-
*
|
|
1423
|
-
* Value is null if no record for the specified CoinType is set.
|
|
1424
|
-
*
|
|
1425
|
-
* NOTE: ENS resolver address records can store arbitrary string values,
|
|
1426
|
-
* including non-EVM addresses — always validate the record value against
|
|
1427
|
-
* the format your application expects.
|
|
2968
|
+
* Represents that Registrar Actions are unavailable.
|
|
1428
2969
|
*/
|
|
1429
|
-
|
|
2970
|
+
readonly Error: "error";
|
|
2971
|
+
};
|
|
2972
|
+
/**
|
|
2973
|
+
* The derived string union of possible {@link RegistrarActionsResponseCodes}.
|
|
2974
|
+
*/
|
|
2975
|
+
type RegistrarActionsResponseCode = (typeof RegistrarActionsResponseCodes)[keyof typeof RegistrarActionsResponseCodes];
|
|
2976
|
+
/**
|
|
2977
|
+
* "Logical registrar action" with its associated name.
|
|
2978
|
+
*/
|
|
2979
|
+
interface NamedRegistrarAction {
|
|
2980
|
+
action: RegistrarAction;
|
|
1430
2981
|
/**
|
|
1431
|
-
*
|
|
1432
|
-
*
|
|
2982
|
+
* Name
|
|
2983
|
+
*
|
|
2984
|
+
* FQDN of the name associated with `action`.
|
|
2985
|
+
*
|
|
2986
|
+
* Guarantees:
|
|
2987
|
+
* - `namehash(name)` is always `action.registrationLifecycle.node`.
|
|
1433
2988
|
*/
|
|
1434
|
-
|
|
2989
|
+
name: InterpretedName;
|
|
2990
|
+
}
|
|
2991
|
+
/**
|
|
2992
|
+
* A response when Registrar Actions are available.
|
|
2993
|
+
*/
|
|
2994
|
+
type RegistrarActionsResponseOk = {
|
|
2995
|
+
responseCode: typeof RegistrarActionsResponseCodes.Ok;
|
|
2996
|
+
registrarActions: NamedRegistrarAction[];
|
|
1435
2997
|
};
|
|
1436
2998
|
/**
|
|
1437
|
-
*
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
*
|
|
1445
|
-
* } as const satisfies ResolverRecordsSelection;
|
|
1446
|
-
*
|
|
1447
|
-
* type Response = ResolverRecordsResponse<typeof selection>;
|
|
2999
|
+
* A response when Registrar Actions are unavailable.
|
|
3000
|
+
*/
|
|
3001
|
+
interface RegistrarActionsResponseError {
|
|
3002
|
+
responseCode: typeof IndexingStatusResponseCodes.Error;
|
|
3003
|
+
error: ErrorResponse;
|
|
3004
|
+
}
|
|
3005
|
+
/**
|
|
3006
|
+
* Registrar Actions response.
|
|
1448
3007
|
*
|
|
1449
|
-
*
|
|
1450
|
-
*
|
|
1451
|
-
* readonly name: Name | null;
|
|
1452
|
-
* readonly addresses: Record<"60", string | null>;
|
|
1453
|
-
* readonly texts: Record<"avatar" | "com.twitter", string | null>;
|
|
1454
|
-
* }
|
|
1455
|
-
* ```
|
|
3008
|
+
* Use the `responseCode` field to determine the specific type interpretation
|
|
3009
|
+
* at runtime.
|
|
1456
3010
|
*/
|
|
1457
|
-
type
|
|
1458
|
-
[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];
|
|
1459
|
-
};
|
|
3011
|
+
type RegistrarActionsResponse = RegistrarActionsResponseOk | RegistrarActionsResponseError;
|
|
1460
3012
|
|
|
1461
3013
|
/**
|
|
1462
|
-
*
|
|
3014
|
+
* Serialized representation of {@link IndexingStatusResponseError}.
|
|
1463
3015
|
*/
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
3016
|
+
type SerializedIndexingStatusResponseError = IndexingStatusResponseError;
|
|
3017
|
+
/**
|
|
3018
|
+
* Serialized representation of {@link IndexingStatusResponseOk}.
|
|
3019
|
+
*/
|
|
3020
|
+
interface SerializedIndexingStatusResponseOk extends Omit<IndexingStatusResponseOk, "realtimeProjection"> {
|
|
3021
|
+
realtimeProjection: SerializedRealtimeIndexingStatusProjection;
|
|
1467
3022
|
}
|
|
1468
3023
|
/**
|
|
1469
|
-
*
|
|
3024
|
+
* Serialized representation of {@link IndexingStatusResponse}.
|
|
1470
3025
|
*/
|
|
1471
|
-
type
|
|
3026
|
+
type SerializedIndexingStatusResponse = SerializedIndexingStatusResponseOk | SerializedIndexingStatusResponseError;
|
|
1472
3027
|
/**
|
|
1473
|
-
*
|
|
3028
|
+
* Serialized representation of {@link RegistrarActionsResponseError}.
|
|
1474
3029
|
*/
|
|
1475
|
-
|
|
1476
|
-
address: Address;
|
|
1477
|
-
chainId: ChainId;
|
|
1478
|
-
}
|
|
3030
|
+
type SerializedRegistrarActionsResponseError = RegistrarActionsResponseError;
|
|
1479
3031
|
/**
|
|
1480
|
-
*
|
|
3032
|
+
* Serialized representation of {@link NamedRegistrarAction}.
|
|
1481
3033
|
*/
|
|
1482
|
-
|
|
3034
|
+
interface SerializedNamedRegistrarAction extends Omit<NamedRegistrarAction, "action"> {
|
|
3035
|
+
action: SerializedRegistrarAction;
|
|
3036
|
+
}
|
|
1483
3037
|
/**
|
|
1484
|
-
*
|
|
3038
|
+
* Serialized representation of {@link RegistrarActionsResponseOk}.
|
|
1485
3039
|
*/
|
|
1486
|
-
interface
|
|
1487
|
-
|
|
1488
|
-
chainIds?: ChainId[];
|
|
3040
|
+
interface SerializedRegistrarActionsResponseOk extends Omit<RegistrarActionsResponseOk, "registrarActions"> {
|
|
3041
|
+
registrarActions: SerializedNamedRegistrarAction[];
|
|
1489
3042
|
}
|
|
1490
3043
|
/**
|
|
1491
|
-
*
|
|
3044
|
+
* Serialized representation of {@link SerializedRegistrarActionsResponse}.
|
|
1492
3045
|
*/
|
|
1493
|
-
type
|
|
3046
|
+
type SerializedRegistrarActionsResponse = SerializedRegistrarActionsResponseOk | SerializedRegistrarActionsResponseError;
|
|
1494
3047
|
|
|
1495
|
-
declare
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
3048
|
+
declare function deserializeErrorResponse(maybeErrorResponse: unknown): ErrorResponse;
|
|
3049
|
+
declare function deserializeIndexingStatusResponse(maybeResponse: SerializedIndexingStatusResponse): IndexingStatusResponse;
|
|
3050
|
+
declare function deserializeRegistrarActionsResponse(maybeResponse: SerializedRegistrarActionsResponse): RegistrarActionsResponse;
|
|
3051
|
+
|
|
3052
|
+
/**
|
|
3053
|
+
* Build a "parent node" filter object for Registrar Actions query.
|
|
3054
|
+
*/
|
|
3055
|
+
declare function byParentNode(parentNode: Node): RegistrarActionsFilter;
|
|
3056
|
+
declare function byParentNode(parentNode: undefined): undefined;
|
|
3057
|
+
/**
|
|
3058
|
+
* Build a "with referral" filter object for Registrar Actions query.
|
|
3059
|
+
*/
|
|
3060
|
+
declare function withReferral(withReferral: true): RegistrarActionsFilter;
|
|
3061
|
+
declare function withReferral(withReferral: false | undefined): undefined;
|
|
3062
|
+
declare const registrarActionsFilter: {
|
|
3063
|
+
byParentNode: typeof byParentNode;
|
|
3064
|
+
withReferral: typeof withReferral;
|
|
1512
3065
|
};
|
|
1513
3066
|
|
|
3067
|
+
declare const registrarActionsPrerequisites: Readonly<{
|
|
3068
|
+
/**
|
|
3069
|
+
* Required plugins to enable Registrar Actions API routes.
|
|
3070
|
+
*
|
|
3071
|
+
* 1. `registrars` plugin is required so that data in the `registrarActions`
|
|
3072
|
+
* table is populated.
|
|
3073
|
+
* 2. `subgraph`, `basenames`, and `lineanames` are required to get the data
|
|
3074
|
+
* for the name associated with each registrar action.
|
|
3075
|
+
* 3. In theory not all of `subgraph`, `basenames`, and `lineanames` plugins
|
|
3076
|
+
* might be required. Ex: At least one, but the current logic in
|
|
3077
|
+
* the `registrars` plugin always indexes registrar actions across
|
|
3078
|
+
* Ethnames (subgraph), Basenames, and Lineanames and therefore we need to
|
|
3079
|
+
* ensure each value in the registrar actions table has
|
|
3080
|
+
* an associated record in the domains table.
|
|
3081
|
+
*/
|
|
3082
|
+
requiredPlugins: readonly [PluginName.Subgraph, PluginName.Basenames, PluginName.Lineanames, PluginName.Registrars];
|
|
3083
|
+
/**
|
|
3084
|
+
* Check if provided ENSApiPublicConfig supports the Registrar Actions API.
|
|
3085
|
+
*/
|
|
3086
|
+
hasEnsIndexerConfigSupport(config: ENSIndexerPublicConfig): boolean;
|
|
3087
|
+
/**
|
|
3088
|
+
* Required Indexing Status IDs
|
|
3089
|
+
*
|
|
3090
|
+
* Database indexes are created by the time the omnichain indexing status
|
|
3091
|
+
* is either `completed` or `following`.
|
|
3092
|
+
*/
|
|
3093
|
+
supportedIndexingStatusIds: ("omnichain-following" | "omnichain-completed")[];
|
|
3094
|
+
/**
|
|
3095
|
+
* Check if provided indexing status supports the Registrar Actions API.
|
|
3096
|
+
*/
|
|
3097
|
+
hasIndexingStatusSupport(omnichainIndexingStatusId: OmnichainIndexingStatusId): boolean;
|
|
3098
|
+
}>;
|
|
3099
|
+
|
|
3100
|
+
declare function serializeIndexingStatusResponse(response: IndexingStatusResponse): SerializedIndexingStatusResponse;
|
|
3101
|
+
declare function serializeNamedRegistrarAction({ action, name, }: NamedRegistrarAction): SerializedNamedRegistrarAction;
|
|
3102
|
+
declare function serializeRegistrarActionsResponse(response: RegistrarActionsResponse): SerializedRegistrarActionsResponse;
|
|
3103
|
+
|
|
1514
3104
|
/**
|
|
1515
|
-
*
|
|
3105
|
+
* The default number of items per page for paginated aggregated referrer queries.
|
|
1516
3106
|
*/
|
|
1517
|
-
|
|
1518
|
-
message: string;
|
|
1519
|
-
details?: unknown;
|
|
1520
|
-
}
|
|
1521
|
-
interface TraceableRequest {
|
|
1522
|
-
trace?: boolean;
|
|
1523
|
-
}
|
|
1524
|
-
interface TraceableResponse {
|
|
1525
|
-
trace?: ProtocolTrace;
|
|
1526
|
-
}
|
|
1527
|
-
interface AcceleratableRequest {
|
|
1528
|
-
accelerate?: boolean;
|
|
1529
|
-
}
|
|
1530
|
-
interface AcceleratableResponse {
|
|
1531
|
-
accelerationAttempted: boolean;
|
|
1532
|
-
}
|
|
3107
|
+
declare const ITEMS_PER_PAGE_DEFAULT = 25;
|
|
1533
3108
|
/**
|
|
1534
|
-
*
|
|
3109
|
+
* The maximum number of items per page for paginated aggregated referrer queries.
|
|
1535
3110
|
*/
|
|
1536
|
-
|
|
1537
|
-
}
|
|
3111
|
+
declare const ITEMS_PER_PAGE_MAX = 100;
|
|
1538
3112
|
/**
|
|
1539
|
-
*
|
|
3113
|
+
* Represents the aggregated metrics for a single referrer.
|
|
1540
3114
|
*/
|
|
1541
|
-
interface
|
|
1542
|
-
|
|
3115
|
+
interface AggregatedReferrerMetrics {
|
|
3116
|
+
/** The Ethereum address of the referrer */
|
|
3117
|
+
referrer: Address;
|
|
3118
|
+
/**
|
|
3119
|
+
* The total number of qualified referrals made by this referrer
|
|
3120
|
+
* @invariant Guaranteed to be a positive integer (> 0)
|
|
3121
|
+
*/
|
|
3122
|
+
totalReferrals: number;
|
|
3123
|
+
/**
|
|
3124
|
+
* The total incremental duration (in seconds) of all referrals made by this referrer
|
|
3125
|
+
* @invariant Guaranteed to be a non-negative integer (>= 0), measured in seconds
|
|
3126
|
+
*/
|
|
3127
|
+
totalIncrementalDuration: Duration;
|
|
1543
3128
|
}
|
|
1544
3129
|
/**
|
|
1545
|
-
*
|
|
3130
|
+
* Represents the aggregated metrics for a single referrer with contribution percentages.
|
|
3131
|
+
* Extends {@link AggregatedReferrerMetrics} with additional fields that show the referrer's
|
|
3132
|
+
* contribution as a percentage of the grand totals.
|
|
1546
3133
|
*/
|
|
1547
|
-
interface
|
|
3134
|
+
interface AggregatedReferrerMetricsContribution extends AggregatedReferrerMetrics {
|
|
3135
|
+
/**
|
|
3136
|
+
* The referrer's contribution to the grand total referrals as a decimal between 0 and 1 (inclusive).
|
|
3137
|
+
* Calculated as: totalReferrals / grandTotalReferrals
|
|
3138
|
+
* @invariant 0 <= totalReferralsContribution <= 1
|
|
3139
|
+
*/
|
|
3140
|
+
totalReferralsContribution: number;
|
|
3141
|
+
/**
|
|
3142
|
+
* The referrer's contribution to the grand total incremental duration as a decimal between 0 and 1 (inclusive).
|
|
3143
|
+
* Calculated as: totalIncrementalDuration / grandTotalIncrementalDuration
|
|
3144
|
+
* @invariant 0 <= totalIncrementalDurationContribution <= 1
|
|
3145
|
+
*/
|
|
3146
|
+
totalIncrementalDurationContribution: number;
|
|
1548
3147
|
}
|
|
1549
3148
|
/**
|
|
1550
|
-
*
|
|
3149
|
+
* Base pagination parameters for paginated queries.
|
|
1551
3150
|
*/
|
|
1552
|
-
interface
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
3151
|
+
interface PaginationParams {
|
|
3152
|
+
/**
|
|
3153
|
+
* Requested page number (1-indexed)
|
|
3154
|
+
* @invariant Must be a positive integer (>= 1)
|
|
3155
|
+
* @default 1
|
|
3156
|
+
*/
|
|
3157
|
+
page?: number;
|
|
3158
|
+
/**
|
|
3159
|
+
* Maximum number of items per page
|
|
3160
|
+
* @invariant Must be a positive integer (>= 1) and less than or equal to {@link ITEMS_PER_PAGE_MAX}
|
|
3161
|
+
* @default {@link ITEMS_PER_PAGE_DEFAULT}
|
|
3162
|
+
*/
|
|
3163
|
+
itemsPerPage?: number;
|
|
1559
3164
|
}
|
|
1560
3165
|
/**
|
|
1561
|
-
*
|
|
3166
|
+
* Request parameters for paginated aggregated referrers query.
|
|
1562
3167
|
*/
|
|
1563
|
-
|
|
3168
|
+
interface PaginatedAggregatedReferrersRequest extends PaginationParams {
|
|
3169
|
+
}
|
|
1564
3170
|
/**
|
|
1565
|
-
*
|
|
3171
|
+
* Paginated aggregated referrers data with metadata.
|
|
1566
3172
|
*/
|
|
1567
|
-
interface
|
|
3173
|
+
interface PaginatedAggregatedReferrers {
|
|
1568
3174
|
/**
|
|
1569
|
-
*
|
|
1570
|
-
*
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
*
|
|
1575
|
-
*
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
3175
|
+
* Array of aggregated referrers for the current page with contribution percentages
|
|
3176
|
+
* @invariant Array may be empty for the first page if there are no qualified referrers.
|
|
3177
|
+
*/
|
|
3178
|
+
referrers: AggregatedReferrerMetricsContribution[];
|
|
3179
|
+
/**
|
|
3180
|
+
* Total number of aggregated referrers across all pages
|
|
3181
|
+
* @invariant Guaranteed to be a non-negative integer (>= 0)
|
|
3182
|
+
*/
|
|
3183
|
+
total: number;
|
|
3184
|
+
/**
|
|
3185
|
+
* Pagination parameters
|
|
3186
|
+
* @invariant Stores the pagination parameters from the request
|
|
3187
|
+
*/
|
|
3188
|
+
paginationParams: PaginationParams;
|
|
3189
|
+
/**
|
|
3190
|
+
* Indicates whether there is a next page available
|
|
3191
|
+
* @invariant true if and only if (page * itemsPerPage < total)
|
|
3192
|
+
*/
|
|
3193
|
+
hasNext: boolean;
|
|
3194
|
+
/**
|
|
3195
|
+
* Indicates whether there is a previous page available
|
|
3196
|
+
* @invariant true if and only if (page > 1)
|
|
1579
3197
|
*/
|
|
1580
|
-
|
|
3198
|
+
hasPrev: boolean;
|
|
3199
|
+
/** Unix timestamp of when the leaderboard was last updated */
|
|
3200
|
+
updatedAt: UnixTimestamp;
|
|
1581
3201
|
}
|
|
1582
3202
|
/**
|
|
1583
|
-
*
|
|
3203
|
+
* A status code for paginated aggregated referrers API responses.
|
|
1584
3204
|
*/
|
|
1585
|
-
|
|
3205
|
+
declare const PaginatedAggregatedReferrersResponseCodes: {
|
|
3206
|
+
/**
|
|
3207
|
+
* Represents that the aggregated referrers data is available.
|
|
3208
|
+
* @note The response may contain an empty array for the first page if there are no qualified referrers.
|
|
3209
|
+
* When the array is empty, total will be 0, page will be 1, and both hasNext and hasPrev will be false.
|
|
3210
|
+
*/
|
|
3211
|
+
readonly Ok: "ok";
|
|
3212
|
+
/**
|
|
3213
|
+
* Represents that the aggregated referrers data is not available.
|
|
3214
|
+
*/
|
|
3215
|
+
readonly Error: "error";
|
|
3216
|
+
};
|
|
1586
3217
|
/**
|
|
1587
|
-
*
|
|
1588
|
-
*
|
|
1589
|
-
* Define a custom response code for known responses.
|
|
3218
|
+
* The derived string union of possible {@link PaginatedAggregatedReferrersResponseCodes}.
|
|
1590
3219
|
*/
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
3220
|
+
type PaginatedAggregatedReferrersResponseCode = (typeof PaginatedAggregatedReferrersResponseCodes)[keyof typeof PaginatedAggregatedReferrersResponseCodes];
|
|
3221
|
+
/**
|
|
3222
|
+
* A paginated aggregated referrers response when the data is available.
|
|
3223
|
+
*/
|
|
3224
|
+
type PaginatedAggregatedReferrersResponseOk = {
|
|
3225
|
+
responseCode: typeof PaginatedAggregatedReferrersResponseCodes.Ok;
|
|
3226
|
+
data: PaginatedAggregatedReferrers;
|
|
3227
|
+
};
|
|
3228
|
+
/**
|
|
3229
|
+
* A paginated aggregated referrers response when the data is not available.
|
|
3230
|
+
*/
|
|
3231
|
+
type PaginatedAggregatedReferrersResponseError = {
|
|
3232
|
+
responseCode: typeof PaginatedAggregatedReferrersResponseCodes.Error;
|
|
3233
|
+
error: string;
|
|
3234
|
+
errorMessage: string;
|
|
1594
3235
|
};
|
|
3236
|
+
/**
|
|
3237
|
+
* A paginated aggregated referrers API response.
|
|
3238
|
+
*
|
|
3239
|
+
* Use the `responseCode` field to determine the specific type interpretation
|
|
3240
|
+
* at runtime.
|
|
3241
|
+
*/
|
|
3242
|
+
type PaginatedAggregatedReferrersResponse = PaginatedAggregatedReferrersResponseOk | PaginatedAggregatedReferrersResponseError;
|
|
3243
|
+
|
|
3244
|
+
/**
|
|
3245
|
+
* Serialized representation of {@link PaginatedAggregatedReferrersResponseError}.
|
|
3246
|
+
*
|
|
3247
|
+
* Note: All fields are already serializable, so this type is identical to the source type.
|
|
3248
|
+
*/
|
|
3249
|
+
type SerializedPaginatedAggregatedReferrersResponseError = PaginatedAggregatedReferrersResponseError;
|
|
3250
|
+
/**
|
|
3251
|
+
* Serialized representation of {@link PaginatedAggregatedReferrersResponseOk}.
|
|
3252
|
+
*
|
|
3253
|
+
* Note: All fields are already serializable, so this type is identical to the source type.
|
|
3254
|
+
*/
|
|
3255
|
+
type SerializedPaginatedAggregatedReferrersResponseOk = PaginatedAggregatedReferrersResponseOk;
|
|
3256
|
+
/**
|
|
3257
|
+
* Serialized representation of {@link PaginatedAggregatedReferrersResponse}.
|
|
3258
|
+
*/
|
|
3259
|
+
type SerializedPaginatedAggregatedReferrersResponse = SerializedPaginatedAggregatedReferrersResponseOk | SerializedPaginatedAggregatedReferrersResponseError;
|
|
3260
|
+
|
|
3261
|
+
/**
|
|
3262
|
+
* Deserialize a {@link PaginatedAggregatedReferrersResponse} object.
|
|
3263
|
+
*
|
|
3264
|
+
* Note: While the serialized and deserialized types are identical (all fields
|
|
3265
|
+
* are primitives), this function performs critical validation using Zod schemas
|
|
3266
|
+
* to enforce invariants on the data. This ensures data integrity when receiving
|
|
3267
|
+
* responses from the API.
|
|
3268
|
+
*/
|
|
3269
|
+
declare function deserializePaginatedAggregatedReferrersResponse(maybeResponse: SerializedPaginatedAggregatedReferrersResponse, valueLabel?: string): PaginatedAggregatedReferrersResponse;
|
|
1595
3270
|
|
|
1596
3271
|
/**
|
|
1597
|
-
*
|
|
3272
|
+
* Serialize a {@link PaginatedAggregatedReferrersResponse} object.
|
|
3273
|
+
*
|
|
3274
|
+
* Note: Since all fields in PaginatedAggregatedReferrersResponse are already
|
|
3275
|
+
* serializable primitives, this function performs an identity transformation.
|
|
3276
|
+
* It exists to maintain consistency with the serialization pattern used
|
|
3277
|
+
* throughout the codebase.
|
|
1598
3278
|
*/
|
|
1599
|
-
declare
|
|
3279
|
+
declare function serializePaginatedAggregatedReferrersResponse(response: PaginatedAggregatedReferrersResponse): SerializedPaginatedAggregatedReferrersResponse;
|
|
3280
|
+
|
|
1600
3281
|
/**
|
|
1601
3282
|
* Configuration options for ENSNode API client
|
|
1602
3283
|
*/
|
|
@@ -1609,6 +3290,7 @@ interface ClientOptions {
|
|
|
1609
3290
|
*
|
|
1610
3291
|
* Provides access to the following ENSNode APIs:
|
|
1611
3292
|
* - Resolution API
|
|
3293
|
+
* - ENSAnalytics API
|
|
1612
3294
|
* - 🚧 Configuration API
|
|
1613
3295
|
* - 🚧 Indexing Status API
|
|
1614
3296
|
*
|
|
@@ -1674,9 +3356,10 @@ declare class ENSNodeClient {
|
|
|
1674
3356
|
/**
|
|
1675
3357
|
* Resolves the primary name of a specified address (Reverse Resolution) on a specific chain.
|
|
1676
3358
|
*
|
|
1677
|
-
* If the `address` specifies a valid
|
|
1678
|
-
*
|
|
1679
|
-
*
|
|
3359
|
+
* If the chainId-specific Primary Name is not defined, but the `address` specifies a valid
|
|
3360
|
+
* [ENSIP-19 Default Name](https://docs.ens.domains/ensip/19/#default-primary-name), the Default
|
|
3361
|
+
* Name will be returned. You _may_ query the Default EVM Chain Id (`0`) in order to determine the
|
|
3362
|
+
* `address`'s Default Name directly.
|
|
1680
3363
|
*
|
|
1681
3364
|
* The returned Primary Name, if set, is guaranteed to be a [Normalized Name](https://ensnode.io/docs/reference/terminology#normalized-name).
|
|
1682
3365
|
* If the primary name set for the address is not normalized, `null` is returned as if no primary name was set.
|
|
@@ -1708,13 +3391,14 @@ declare class ENSNodeClient {
|
|
|
1708
3391
|
/**
|
|
1709
3392
|
* Resolves the primary names of a specified address across multiple chains.
|
|
1710
3393
|
*
|
|
1711
|
-
*
|
|
1712
|
-
*
|
|
1713
|
-
*
|
|
1714
|
-
* should rely on the aforementioned per-chain defaulting behavior.
|
|
3394
|
+
* For each Primary Name, if the chainId-specific Primary Name is not defined, but the `address`
|
|
3395
|
+
* specifies a valid [ENSIP-19 Default Name](https://docs.ens.domains/ensip/19/#default-primary-name),
|
|
3396
|
+
* the Default Name will be returned. You _may not_ query the Default EVM Chain Id (`0`) directly,
|
|
3397
|
+
* and should rely on the aforementioned per-chain defaulting behavior.
|
|
1715
3398
|
*
|
|
1716
3399
|
* Each returned Primary Name, if set, is guaranteed to be a [Normalized Name](https://ensnode.io/docs/reference/terminology#normalized-name).
|
|
1717
|
-
* If the primary name set for the address on any chain is not normalized, `null` is returned for
|
|
3400
|
+
* If the primary name set for the address on any chain is not normalized, `null` is returned for
|
|
3401
|
+
* that chain as if no primary name was set.
|
|
1718
3402
|
*
|
|
1719
3403
|
* @param address The Address whose Primary Names to resolve
|
|
1720
3404
|
* @param options additional options
|
|
@@ -1732,12 +3416,12 @@ declare class ENSNodeClient {
|
|
|
1732
3416
|
*
|
|
1733
3417
|
* console.log(names);
|
|
1734
3418
|
* // {
|
|
1735
|
-
* // "1": "gregskril.eth",
|
|
1736
|
-
* // "10": "gregskril.eth",
|
|
1737
|
-
* // "8453": "greg.base.eth", //
|
|
1738
|
-
* // "42161": "gregskril.eth",
|
|
1739
|
-
* // "59144": "gregskril.eth",
|
|
1740
|
-
* // "534352": "gregskril.eth"
|
|
3419
|
+
* // "1": "gregskril.eth", // Default Primary Name
|
|
3420
|
+
* // "10": "gregskril.eth", // Default Primary Name
|
|
3421
|
+
* // "8453": "greg.base.eth", // Base-specific Primary Name!
|
|
3422
|
+
* // "42161": "gregskril.eth", // Default Primary Name
|
|
3423
|
+
* // "59144": "gregskril.eth", // Default Primary Name
|
|
3424
|
+
* // "534352": "gregskril.eth" // Default Primary Name
|
|
1741
3425
|
* // }
|
|
1742
3426
|
*
|
|
1743
3427
|
* // Resolve the address' Primary Names on specific chain Ids
|
|
@@ -1766,32 +3450,107 @@ declare class ENSNodeClient {
|
|
|
1766
3450
|
/**
|
|
1767
3451
|
* Fetch ENSNode Indexing Status
|
|
1768
3452
|
*
|
|
1769
|
-
*
|
|
3453
|
+
* @returns {IndexingStatusResponse}
|
|
1770
3454
|
*
|
|
1771
|
-
* @
|
|
1772
|
-
* @
|
|
1773
|
-
*
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
*
|
|
1778
|
-
* within the requested distance from realtime.
|
|
3455
|
+
* @throws if the ENSNode request fails
|
|
3456
|
+
* @throws if the ENSNode API returns an error response
|
|
3457
|
+
* @throws if the ENSNode response breaks required invariants
|
|
3458
|
+
*/
|
|
3459
|
+
indexingStatus(): Promise<IndexingStatusResponse>;
|
|
3460
|
+
/**
|
|
3461
|
+
* Fetch Paginated Aggregated Referrers
|
|
1779
3462
|
*
|
|
1780
|
-
*
|
|
3463
|
+
* Retrieves a paginated list of aggregated referrer metrics with contribution percentages.
|
|
3464
|
+
* Each referrer's contribution is calculated as a percentage of the grand totals across all referrers.
|
|
3465
|
+
*
|
|
3466
|
+
* @param request - Pagination parameters
|
|
3467
|
+
* @param request.page - The page number to retrieve (1-indexed, default: 1)
|
|
3468
|
+
* @param request.itemsPerPage - Number of items per page (default: 25, max: 100)
|
|
3469
|
+
* @returns {PaginatedAggregatedReferrersResponse}
|
|
3470
|
+
*
|
|
3471
|
+
* @throws if the ENSNode request fails
|
|
3472
|
+
* @throws if the ENSNode API returns an error response
|
|
3473
|
+
* @throws if the ENSNode response breaks required invariants
|
|
3474
|
+
*
|
|
3475
|
+
* @example
|
|
3476
|
+
* ```typescript
|
|
3477
|
+
* // Get first page with default page size (25 items)
|
|
3478
|
+
* const response = await client.getAggregatedReferrers();
|
|
3479
|
+
* if (response.responseCode === 'ok') {
|
|
3480
|
+
* console.log(response.data.referrers);
|
|
3481
|
+
* console.log(`Page ${response.data.paginationParams.page} of ${Math.ceil(response.data.total / response.data.paginationParams.itemsPerPage)}`);
|
|
3482
|
+
* }
|
|
3483
|
+
* ```
|
|
3484
|
+
*
|
|
3485
|
+
* @example
|
|
3486
|
+
* ```typescript
|
|
3487
|
+
* // Get second page with 50 items per page
|
|
3488
|
+
* const response = await client.getAggregatedReferrers({ page: 2, itemsPerPage: 50 });
|
|
3489
|
+
* ```
|
|
3490
|
+
*/
|
|
3491
|
+
getAggregatedReferrers(request?: PaginatedAggregatedReferrersRequest): Promise<PaginatedAggregatedReferrersResponse>;
|
|
3492
|
+
/**
|
|
3493
|
+
* Fetch ENSNode Registrar Actions
|
|
3494
|
+
*
|
|
3495
|
+
* @param {RegistrarActionsRequestFilter} request.filter is
|
|
3496
|
+
* an optional request filter configuration.
|
|
3497
|
+
* @param {number} request.limit sets the maximum count of results in the response.
|
|
3498
|
+
* @param {RegistrarActionsRequestOrder} request.order sets the order of
|
|
3499
|
+
* results in the response by field and direction.
|
|
3500
|
+
* @returns {RegistrarActionsResponse}
|
|
1781
3501
|
*
|
|
1782
3502
|
* @throws if the ENSNode request fails
|
|
1783
3503
|
* @throws if the ENSNode API returns an error response
|
|
1784
3504
|
* @throws if the ENSNode response breaks required invariants
|
|
3505
|
+
*
|
|
3506
|
+
* @example
|
|
3507
|
+
* ```ts
|
|
3508
|
+
* import {
|
|
3509
|
+
* registrarActionsFilter,,
|
|
3510
|
+
* ENSNodeClient,
|
|
3511
|
+
* } from "@ensnode/ensnode-sdk";
|
|
3512
|
+
* import { namehash } from "viem/ens";
|
|
3513
|
+
*
|
|
3514
|
+
* const client: ENSNodeClient;
|
|
3515
|
+
*
|
|
3516
|
+
* // get latest registrar action records across all indexed subregistries
|
|
3517
|
+
* // NOTE: when no `limit` value is passed,
|
|
3518
|
+
* // the default RESPONSE_ITEMS_PER_PAGE_DEFAULT applies.
|
|
3519
|
+
* const registrarActions = await client.registrarActions();
|
|
3520
|
+
*
|
|
3521
|
+
* // get latest 5 registrar action records across all indexed subregistries
|
|
3522
|
+
* // NOTE: when a `limit` value is passed, it must be lower than or equal to
|
|
3523
|
+
* // the RESPONSE_ITEMS_PER_PAGE_MAX value.
|
|
3524
|
+
* const registrarActions = await client.registrarActions({
|
|
3525
|
+
* limit: 5,
|
|
3526
|
+
* });
|
|
3527
|
+
*
|
|
3528
|
+
* // get latest registrar action records associated with
|
|
3529
|
+
* // subregistry managing `eth` name
|
|
3530
|
+
* await client.registrarActions({
|
|
3531
|
+
* filters: [registrarActionsFilter.byParentNode(namehash('eth'))],
|
|
3532
|
+
* });
|
|
3533
|
+
*
|
|
3534
|
+
* // get latest registrar action records which include referral info
|
|
3535
|
+
* await client.registrarActions({
|
|
3536
|
+
* filters: [registrarActionsFilter.withReferral(true)],
|
|
3537
|
+
* });
|
|
3538
|
+
*
|
|
3539
|
+
* // get latest 10 registrar action records associated with
|
|
3540
|
+
* // subregistry managing `base.eth` name
|
|
3541
|
+
* await client.registrarActions({
|
|
3542
|
+
* filters: [registrarActionsFilter.byParentNode(namehash('base.eth'))],
|
|
3543
|
+
* limit: 10
|
|
3544
|
+
* });
|
|
3545
|
+
* ```
|
|
1785
3546
|
*/
|
|
1786
|
-
|
|
3547
|
+
registrarActions(request?: RegistrarActionsRequest): Promise<RegistrarActionsResponse>;
|
|
1787
3548
|
}
|
|
1788
3549
|
|
|
1789
|
-
declare function deserializeErrorResponse(maybeErrorResponse: unknown): ErrorResponse;
|
|
1790
|
-
|
|
1791
3550
|
declare class ClientError extends Error {
|
|
1792
3551
|
details?: unknown;
|
|
1793
3552
|
constructor(message: string, details?: unknown);
|
|
1794
3553
|
static fromErrorResponse({ message, details }: ErrorResponse): ClientError;
|
|
1795
3554
|
}
|
|
1796
3555
|
|
|
1797
|
-
export { ATTR_PROTOCOL_NAME, ATTR_PROTOCOL_STEP, ATTR_PROTOCOL_STEP_RESULT, type AcceleratableRequest, type AcceleratableResponse, type AccountId, BASENAMES_NODE, type BlockNumber, type BlockRef, type Blockrange, type Cache, type ChainId, type ChainIdString, type
|
|
3556
|
+
export { ADDR_REVERSE_NODE, ATTR_PROTOCOL_NAME, ATTR_PROTOCOL_STEP, ATTR_PROTOCOL_STEP_RESULT, type AcceleratableRequest, type AcceleratableResponse, type AccountId, type AggregatedReferrerMetrics, type AggregatedReferrerMetricsContribution, 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 Duration, type ENSApiPublicConfig, type ENSIndexerPublicConfig, type ENSIndexerVersionInfo, ENSNodeClient, ETH_COIN_TYPE, ETH_NODE, type EncodedLabelHash, type EnsRainbowClientLabelSet, type EnsRainbowServerLabelSet, type ErrorResponse, type ForwardResolutionArgs, ForwardResolutionProtocolStep, type ForwardResolutionResult, ITEMS_PER_PAGE_DEFAULT, ITEMS_PER_PAGE_MAX, 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 Name, type NamedIdentity, type NamedRegistrarAction, type Node, type NormalizedName, type OmnichainIndexingStatusId, OmnichainIndexingStatusIds, type OmnichainIndexingStatusSnapshot, type OmnichainIndexingStatusSnapshotBackfill, type OmnichainIndexingStatusSnapshotCompleted, type OmnichainIndexingStatusSnapshotFollowing, type OmnichainIndexingStatusSnapshotUnstarted, PROTOCOL_ATTRIBUTE_PREFIX, type PaginatedAggregatedReferrers, type PaginatedAggregatedReferrersRequest, type PaginatedAggregatedReferrersResponse, type PaginatedAggregatedReferrersResponseCode, PaginatedAggregatedReferrersResponseCodes, type PaginatedAggregatedReferrersResponseError, type PaginatedAggregatedReferrersResponseOk, type PaginationParams, PluginName, type Price, type PriceDai, type PriceEth, type PriceUsdc, type ProtocolSpan, type ProtocolSpanTreeNode, type ProtocolTrace, ROOT_NODE, type RealtimeIndexingStatusProjection, type RegistrarAction, type RegistrarActionEventId, type RegistrarActionPricing, type RegistrarActionPricingAvailable, type RegistrarActionPricingUnknown, type RegistrarActionReferral, type RegistrarActionReferralAvailable, type RegistrarActionReferralNotApplicable, type RegistrarActionType, RegistrarActionTypes, type RegistrarActionsFilter, type RegistrarActionsFilterBySubregistryNode, type RegistrarActionsFilterType, RegistrarActionsFilterTypes, type RegistrarActionsFilterWithEncodedReferral, type RegistrarActionsOrder, RegistrarActionsOrders, type RegistrarActionsRequest, type RegistrarActionsResponse, type RegistrarActionsResponseCode, RegistrarActionsResponseCodes, type RegistrarActionsResponseError, type RegistrarActionsResponseOk, type RegistrationLifecycle, type RegistrationLifecycleStage, type ResolutionStatusId, ResolutionStatusIds, type ResolvePrimaryNameRequest, type ResolvePrimaryNameResponse, type ResolvePrimaryNamesRequest, type ResolvePrimaryNamesResponse, type ResolveRecordsRequest, type ResolveRecordsResponse, type ResolvedIdentity, type ResolverRecordsResponse, type ResolverRecordsResponseBase, type ResolverRecordsSelection, type ReverseResolutionArgs, ReverseResolutionProtocolStep, type ReverseResolutionResult, type RpcUrl, type SerializedAccountId, type SerializedChainIndexingStatusSnapshot, type SerializedChainIndexingStatusSnapshotBackfill, type SerializedChainIndexingStatusSnapshotCompleted, type SerializedChainIndexingStatusSnapshotFollowing, type SerializedChainIndexingStatusSnapshotQueued, type SerializedCrossChainIndexingStatusSnapshot, type SerializedCrossChainIndexingStatusSnapshotOmnichain, type SerializedCurrencyAmount, type SerializedCurrentIndexingProjectionOmnichain, type SerializedENSApiPublicConfig, type SerializedENSIndexerPublicConfig, type SerializedENSIndexerVersionInfo, type SerializedIndexedChainIds, type SerializedIndexingStatusResponse, type SerializedIndexingStatusResponseError, type SerializedIndexingStatusResponseOk, type SerializedNamedRegistrarAction, type SerializedOmnichainIndexingStatusSnapshot, type SerializedOmnichainIndexingStatusSnapshotBackfill, type SerializedOmnichainIndexingStatusSnapshotCompleted, type SerializedOmnichainIndexingStatusSnapshotFollowing, type SerializedOmnichainIndexingStatusSnapshotUnstarted, type SerializedPaginatedAggregatedReferrersResponse, type SerializedPaginatedAggregatedReferrersResponseError, type SerializedPaginatedAggregatedReferrersResponseOk, type SerializedPrice, type SerializedPriceDai, type SerializedPriceEth, type SerializedPriceUsdc, type SerializedRealtimeIndexingStatusProjection, type SerializedRegistrarAction, type SerializedRegistrarActionPricing, type SerializedRegistrarActionPricingAvailable, type SerializedRegistrarActionPricingUnknown, type SerializedRegistrarActionsResponse, type SerializedRegistrarActionsResponseError, type SerializedRegistrarActionsResponseOk, type SerializedRegistrationLifecycle, type SerializedSubregistry, type SubgraphInterpretedLabel, type SubgraphInterpretedName, type Subregistry, type TheGraphCannotFallbackReason, TheGraphCannotFallbackReasonSchema, type TheGraphFallback, TheGraphFallbackSchema, TraceableENSProtocol, type TraceableRequest, type TraceableResponse, TtlCache, type UnixTimestamp, type UnknownIdentity, type UnnamedIdentity, type UnresolvedIdentity, type UrlString, accountIdEqual, addDuration, addPrices, addrReverseLabel, asLowerCaseAddress, beautifyName, bigIntToNumber, bigintToCoinType, buildEnsRainbowClientLabelSet, buildLabelSetId, buildLabelSetVersion, buildUnresolvedIdentity, checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill, checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted, checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing, checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted, coinTypeReverseLabel, coinTypeToEvmChainId, createIndexingConfig, createRealtimeIndexingStatusProjection, decodeDNSEncodedLiteralName, decodeDNSEncodedName, deserializeAccountId, deserializeBlockNumber, deserializeBlockRef, deserializeBlockrange, deserializeChainId, deserializeChainIndexingStatusSnapshot, deserializeCrossChainIndexingStatusSnapshot, deserializeDatetime, deserializeDuration, deserializeENSApiPublicConfig, deserializeENSIndexerPublicConfig, deserializeErrorResponse, deserializeIndexingStatusResponse, deserializeOmnichainIndexingStatusSnapshot, deserializePaginatedAggregatedReferrersResponse, deserializeRealtimeIndexingStatusProjection, deserializeRegistrarActionsResponse, deserializeUnixTimestamp, deserializeUrl, durationBetween, encodeLabelHash, evmChainIdToCoinType, getCurrencyInfo, getEthnamesSubregistryId, getNameHierarchy, getOmnichainIndexingCursor, getOmnichainIndexingStatus, 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, parseNonNegativeInteger, parseReverseName, priceDai, priceEth, priceUsdc, registrarActionsFilter, registrarActionsPrerequisites, reverseName, serializeAccountId, serializeChainId, serializeChainIndexingSnapshots, serializeCrossChainIndexingStatusSnapshotOmnichain, serializeDatetime, serializeENSApiPublicConfig, serializeENSIndexerPublicConfig, serializeIndexedChainIds, serializeIndexingStatusResponse, serializeNamedRegistrarAction, serializeOmnichainIndexingStatusSnapshot, serializePaginatedAggregatedReferrersResponse, serializePrice, serializePriceEth, serializeRealtimeIndexingStatusProjection, serializeRegistrarAction, serializeRegistrarActionPricing, serializeRegistrarActionsResponse, serializeRegistrationLifecycle, serializeSubregistry, serializeUrl, sortChainStatusesByStartBlockAsc, staleWhileRevalidate, stripNullBytes, translateDefaultableChainIdToChainId, uint256ToHex32, uniq, validateSupportedLabelSetAndVersion };
|