enssdk 0.0.1 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +50 -2
- package/dist/core/index.d.ts +20 -0
- package/dist/core/index.js +23 -0
- package/dist/core/index.js.map +1 -0
- package/dist/evm-2UZlELOe.d.ts +474 -0
- package/dist/index.d.ts +619 -0
- package/dist/index.js +527 -0
- package/dist/index.js.map +1 -0
- package/dist/omnigraph/index.d.ts +5074 -0
- package/dist/omnigraph/index.js +5787 -0
- package/dist/omnigraph/index.js.map +1 -0
- package/package.json +63 -6
- package/src/omnigraph/generated/schema.graphql +1172 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 NameHash
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,5 +1,53 @@
|
|
|
1
1
|
# enssdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The foundational ENS developer library. Isomorphic, tree-shakable, with composable modules via subpath exports.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Learn more about [ENSNode](https://ensnode.io/) from [the ENSNode docs](https://ensnode.io/docs).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install enssdk
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
### Core Client
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { createEnsNodeClient } from "enssdk/core";
|
|
19
|
+
|
|
20
|
+
const client = createEnsNodeClient({ url: "https://api.alpha.ensnode.io" });
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Omnigraph (Typed GraphQL)
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { createEnsNodeClient } from "enssdk/core";
|
|
27
|
+
import { omnigraph, graphql } from "enssdk/omnigraph";
|
|
28
|
+
|
|
29
|
+
const client = createEnsNodeClient({ url: "https://api.alpha.ensnode.io" })
|
|
30
|
+
.extend(omnigraph);
|
|
31
|
+
|
|
32
|
+
const MyQuery = graphql(`
|
|
33
|
+
query MyQuery($name: Name!) {
|
|
34
|
+
domain(by: { name: $name }) {
|
|
35
|
+
name
|
|
36
|
+
registration { expiry }
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
`);
|
|
40
|
+
|
|
41
|
+
const result = await client.omnigraph.query({
|
|
42
|
+
query: MyQuery,
|
|
43
|
+
variables: { name: "nick.eth" },
|
|
44
|
+
});
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Modules are composable via `extend()` — only import what you use.
|
|
48
|
+
|
|
49
|
+
## License
|
|
50
|
+
|
|
51
|
+
Licensed under the MIT License, Copyright © 2025-present [NameHash Labs](https://namehashlabs.org).
|
|
52
|
+
|
|
53
|
+
See [LICENSE](./LICENSE) for more information.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
interface EnsNodeClientConfig {
|
|
2
|
+
/**
|
|
3
|
+
* ENSNode instance URL (e.g. "https://api.alpha.ensnode.io")
|
|
4
|
+
*/
|
|
5
|
+
url: string;
|
|
6
|
+
/**
|
|
7
|
+
* Optional fetch implementation (for Node/edge runtimes)
|
|
8
|
+
*/
|
|
9
|
+
fetch?: typeof globalThis.fetch;
|
|
10
|
+
}
|
|
11
|
+
type EnsNodeClient<TExtended extends object = {}> = TExtended & {
|
|
12
|
+
readonly config: Readonly<EnsNodeClientConfig>;
|
|
13
|
+
extend<const T extends object & {
|
|
14
|
+
config?: never;
|
|
15
|
+
extend?: never;
|
|
16
|
+
}>(fn: (client: EnsNodeClient<TExtended>) => T): EnsNodeClient<TExtended & T>;
|
|
17
|
+
};
|
|
18
|
+
declare function createEnsNodeClient(config: EnsNodeClientConfig): EnsNodeClient;
|
|
19
|
+
|
|
20
|
+
export { type EnsNodeClient, type EnsNodeClientConfig, createEnsNodeClient };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// src/core/index.ts
|
|
2
|
+
function createEnsNodeClient(config) {
|
|
3
|
+
const frozenConfig = Object.freeze({ ...config });
|
|
4
|
+
function makeClient(base) {
|
|
5
|
+
const client = {
|
|
6
|
+
...base,
|
|
7
|
+
config: frozenConfig,
|
|
8
|
+
extend(fn) {
|
|
9
|
+
const extension = fn(client);
|
|
10
|
+
return makeClient({
|
|
11
|
+
...base,
|
|
12
|
+
...extension
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
return client;
|
|
17
|
+
}
|
|
18
|
+
return makeClient({});
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
createEnsNodeClient
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/index.ts"],"sourcesContent":["export interface EnsNodeClientConfig {\n /**\n * ENSNode instance URL (e.g. \"https://api.alpha.ensnode.io\")\n */\n url: string;\n\n /**\n * Optional fetch implementation (for Node/edge runtimes)\n */\n fetch?: typeof globalThis.fetch;\n}\n\nexport type EnsNodeClient<TExtended extends object = {}> = TExtended & {\n readonly config: Readonly<EnsNodeClientConfig>;\n extend<const T extends object & { config?: never; extend?: never }>(\n fn: (client: EnsNodeClient<TExtended>) => T,\n ): EnsNodeClient<TExtended & T>;\n};\n\nexport function createEnsNodeClient(config: EnsNodeClientConfig): EnsNodeClient {\n const frozenConfig = Object.freeze({ ...config });\n\n function makeClient(base: Record<string, unknown>): EnsNodeClient<Record<string, unknown>> {\n const client = {\n ...base,\n config: frozenConfig,\n extend(fn: (client: any) => object) {\n const extension = fn(client);\n return makeClient({\n ...base,\n ...(extension as Record<string, unknown>),\n });\n },\n };\n return client as EnsNodeClient<Record<string, unknown>>;\n }\n\n return makeClient({}) as EnsNodeClient;\n}\n"],"mappings":";AAmBO,SAAS,oBAAoB,QAA4C;AAC9E,QAAM,eAAe,OAAO,OAAO,EAAE,GAAG,OAAO,CAAC;AAEhD,WAAS,WAAW,MAAuE;AACzF,UAAM,SAAS;AAAA,MACb,GAAG;AAAA,MACH,QAAQ;AAAA,MACR,OAAO,IAA6B;AAClC,cAAM,YAAY,GAAG,MAAM;AAC3B,eAAO,WAAW;AAAA,UAChB,GAAG;AAAA,UACH,GAAI;AAAA,QACN,CAAC;AAAA,MACH;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAEA,SAAO,WAAW,CAAC,CAAC;AACtB;","names":[]}
|
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
import { Hex as Hex$1, Address as Address$1 } from 'viem';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A hash value that uniquely identifies a single ENS name.
|
|
5
|
+
* Result of `namehash` function as specified in ENSIP-1.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```
|
|
9
|
+
* namehash("vitalik.eth") === "0xee6c4522aab0003e8d14cd40a6af439055fd2577951148c14b6cea9a53475835"
|
|
10
|
+
* ```
|
|
11
|
+
* @see https://docs.ens.domains/ensip/1#namehash-algorithm
|
|
12
|
+
* @see https://ensnode.io/docs/reference/terminology#name-node-namehash
|
|
13
|
+
*/
|
|
14
|
+
type Node = Hex$1;
|
|
15
|
+
/**
|
|
16
|
+
* An ENS Name that may or may not be normalized.
|
|
17
|
+
*
|
|
18
|
+
* @example vitalik.eth
|
|
19
|
+
* @see https://ensnode.io/docs/reference/terminology#name-node-namehash
|
|
20
|
+
* @see https://docs.ens.domains/ensip/15
|
|
21
|
+
*/
|
|
22
|
+
type Name = string;
|
|
23
|
+
/**
|
|
24
|
+
* A LabelHash is the result of the labelhash function (which is just keccak256) on a Label.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```
|
|
28
|
+
* labelhash('vitalik') === '0xaf2caa1c2ca1d027f1ac823b529d0a67cd144264b2789fa2ea4d63a67c7103cc'
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @see https://docs.ens.domains/terminology#labelhash
|
|
32
|
+
* @see https://ensnode.io/docs/reference/terminology#labels-labelhashes-labelhash-function
|
|
33
|
+
* @see https://ensnode.io/ensrainbow/concepts/glossary#labelhash
|
|
34
|
+
*/
|
|
35
|
+
type LabelHash = Hex$1;
|
|
36
|
+
/**
|
|
37
|
+
* A LabelHashPath is an ordered list of LabelHashes that uniquely identify an ENS Name.
|
|
38
|
+
* It is ordered in namegraph TRAVERSAL order (i.e. the opposite order of an ENS Name's labels).
|
|
39
|
+
*
|
|
40
|
+
* ex: example.eth's LabelHashPath is
|
|
41
|
+
* [
|
|
42
|
+
* '0x4f5b812789fc606be1b3b16908db13fc7a9adf7ca72641f84d75b47069d3d7f0', // 'eth'
|
|
43
|
+
* '0x6fd43e7cffc31bb581d7421c8698e29aa2bd8e7186a394b85299908b4eb9b175', // 'example'
|
|
44
|
+
* ]
|
|
45
|
+
*/
|
|
46
|
+
type LabelHashPath = LabelHash[];
|
|
47
|
+
/**
|
|
48
|
+
* A Label is a single part of an ENS Name.
|
|
49
|
+
*
|
|
50
|
+
* @example vitalik
|
|
51
|
+
*
|
|
52
|
+
* @see https://docs.ens.domains/terminology#label
|
|
53
|
+
* @see https://ensnode.io/docs/reference/terminology#labels-labelhashes-labelhash-function
|
|
54
|
+
*/
|
|
55
|
+
type Label = string;
|
|
56
|
+
/**
|
|
57
|
+
* An EncodedLabelHash is a specially formatted (unnormalized) Label formatted
|
|
58
|
+
* as a non-0x prefixed 32-byte hex string enclosed in square brackets.
|
|
59
|
+
*
|
|
60
|
+
* Care should be taken to distinguish Label values formatted as an
|
|
61
|
+
* EncodedLabelHash as either a LiteralLabel or an InterpretedLabel:
|
|
62
|
+
* - If a LiteralLabel is formatted as an EncodedLabelHash it does NOT
|
|
63
|
+
* symbolically represent the encoding of a LabelHash literal.
|
|
64
|
+
* - If an InterpretedLabel is formatted as an EncodedLabelHash it should be
|
|
65
|
+
* interpreted as encoding a LabelHash literal.
|
|
66
|
+
*
|
|
67
|
+
* An InterpretedLabel may be formatted as an EncodedLabelHash if the related
|
|
68
|
+
* LiteralLabel is:
|
|
69
|
+
* - not a normalized label
|
|
70
|
+
* - is an unknown value that could not be healed.
|
|
71
|
+
* - is too long for DNS-Encoding in contexts where DNS-Encoding was required.
|
|
72
|
+
*
|
|
73
|
+
* @example [af2caa1c2ca1d027f1ac823b529d0a67cd144264b2789fa2ea4d63a67c7103cc]
|
|
74
|
+
*
|
|
75
|
+
* @see https://ensnode.io/docs/reference/terminology#encoded-labelhash
|
|
76
|
+
*/
|
|
77
|
+
type EncodedLabelHash = `[${string}]`;
|
|
78
|
+
/**
|
|
79
|
+
* A Literal Label is a Label as it literally appears onchain, without any interpretation
|
|
80
|
+
* or normalization processing. It may be an unnormalized label for reasons including:
|
|
81
|
+
* - being an empty label,
|
|
82
|
+
* - containing '.' characters,
|
|
83
|
+
* - being formatted as an EncodedLabelHash (which are not normalizable). Note that
|
|
84
|
+
* when LiteralLabel are formatted as an EncodedLabelHash they do NOT symbolically
|
|
85
|
+
* represent the encoding of a LabelHash literal, or
|
|
86
|
+
* - containing other unnormalized characters such as null bytes or other characters
|
|
87
|
+
* not suitable for display.
|
|
88
|
+
*
|
|
89
|
+
* @see https://ensnode.io/docs/reference/terminology#literal-label
|
|
90
|
+
* @dev nominally typed to enforce usage & enhance codebase clarity
|
|
91
|
+
*/
|
|
92
|
+
type LiteralLabel = Label & {
|
|
93
|
+
__brand: "LiteralLabel";
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* An Interpreted Label is a Label that is either:
|
|
97
|
+
* a) a Normalized Label, or
|
|
98
|
+
* b) an Unnormalizable Label exclusively for the reason that it is formatted
|
|
99
|
+
* as an Encoded LabelHash that should be interpreted as encoding a
|
|
100
|
+
* LabelHash literal, where the encoded LabelHash literal is the `labelhash`
|
|
101
|
+
* of the related LiteralLabel.
|
|
102
|
+
*
|
|
103
|
+
* @see https://ensnode.io/docs/reference/terminology#interpreted-label
|
|
104
|
+
* @dev nominally typed to enforce usage & enhance codebase clarity
|
|
105
|
+
*/
|
|
106
|
+
type InterpretedLabel = Label & {
|
|
107
|
+
__brand: "InterpretedLabel";
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* A Literal Name is a Name as it literally appears onchain, composed of 0 or more Literal Labels
|
|
111
|
+
* joined by dots. It may be an unnormalized name for reasons including:
|
|
112
|
+
* - containing empty labels,
|
|
113
|
+
* - containing LiteralLabel values formatted as an EncodedLabelHash (which are
|
|
114
|
+
* not normalizable)). Note that when LiteralLabel values are formatted as an
|
|
115
|
+
* EncodedLabelHash they do NOT symbolically represent the encoding of a
|
|
116
|
+
* LabelHash literal, or
|
|
117
|
+
* - containing other unnormalized characters such as null bytes or other characters
|
|
118
|
+
* not suitable for display.
|
|
119
|
+
*
|
|
120
|
+
* @see https://ensnode.io/docs/reference/terminology#literal-name
|
|
121
|
+
* @dev nominally typed to enforce usage & enhance codebase clarity
|
|
122
|
+
*/
|
|
123
|
+
type LiteralName = Name & {
|
|
124
|
+
__brand: "LiteralName";
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* An Interpreted Name is a Name that is entirely composed of 0 or more Interpreted Labels.
|
|
128
|
+
*
|
|
129
|
+
* That is, it is either:
|
|
130
|
+
* a) a Normalized Name, or
|
|
131
|
+
* b) an Unnormalizable Name exclusively for the reason that it contains 1 or
|
|
132
|
+
* more labels formatted as Encoded LabelHashes that should be interpreted
|
|
133
|
+
* as encoding a LabelHash literal, where the encoded LabelHash literal is
|
|
134
|
+
* the `labelhash` of the related LiteralLabel.
|
|
135
|
+
*
|
|
136
|
+
* @see https://ensnode.io/docs/reference/terminology#interpreted-name
|
|
137
|
+
* @dev nominally typed to enforce usage & enhance codebase clarity
|
|
138
|
+
*/
|
|
139
|
+
type InterpretedName = Name & {
|
|
140
|
+
__brand: "InterpretedName";
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* A Subgraph Interpreted Label is a Literal Label that is either:
|
|
144
|
+
* a) (if subgraph-indexable): a Literal Label, of unknown normalization status, guaranteed to not
|
|
145
|
+
* contain any of the subgraph-unindexable UTF-8 characters (and therefore guaranteed not to be
|
|
146
|
+
* an Encoded LabelHash), or
|
|
147
|
+
* b) (if subgraph-unindexable): an Encoded LabelHash.
|
|
148
|
+
*
|
|
149
|
+
* @see https://ensnode.io/docs/reference/terminology#subgraph-interpreted-label
|
|
150
|
+
* @dev nominally typed to enforce usage & enhance codebase clarity
|
|
151
|
+
*/
|
|
152
|
+
type SubgraphInterpretedLabel = Label & {
|
|
153
|
+
__brand: "SubgraphInterpretedLabel";
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* A Subgraph Interpreted Name is a name exclusively composed of 0 or more Subgraph Interpreted Labels.
|
|
157
|
+
*
|
|
158
|
+
* @see https://ensnode.io/docs/reference/terminology#subgraph-interpreted-name
|
|
159
|
+
* @dev nominally typed to enforce usage & enhance codebase clarity
|
|
160
|
+
*/
|
|
161
|
+
type SubgraphInterpretedName = Name & {
|
|
162
|
+
__brand: "SubgraphInterpretedName";
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* A DNS-Encoded Name as a hex string, representing the binary DNS wire format encoding
|
|
166
|
+
* of a domain name. Used in ENS contracts for efficient name storage and transmission.
|
|
167
|
+
* Each label is prefixed with a length byte, and the entire sequence is null-terminated.
|
|
168
|
+
*
|
|
169
|
+
* @example "0x076578616d706c650365746800" represents "example.eth"
|
|
170
|
+
*
|
|
171
|
+
* @see https://docs.ens.domains/resolution/names/#dns-encoding
|
|
172
|
+
* @see https://github.com/ensdomains/ens-contracts/blob/staging/contracts/utils/NameCoder.sol
|
|
173
|
+
*
|
|
174
|
+
* DNS Packet Format for Domain Names:
|
|
175
|
+
* - Domain names are encoded as a sequence of 0 or more labels
|
|
176
|
+
* - Each label begins with a length byte (1 byte) indicating how many bytes follow for that label
|
|
177
|
+
* Note how this constrains each label in DNS encoded names to a max byte length of 255 bytes.
|
|
178
|
+
* - The bytes after the length byte represent the label, as a UTF-8 byte array
|
|
179
|
+
* - Labels are concatenated with no separators
|
|
180
|
+
* - The sequence ends with a null byte (0x00)
|
|
181
|
+
*
|
|
182
|
+
* Example: "example.eth" is encoded as:
|
|
183
|
+
* [0x07, 'e', 'x', 'a', 'm', 'p', 'l', 'e', 0x03, 'e', 't', 'h', 0x00]
|
|
184
|
+
* Where 0x07 is the length of "example", 0x03 is the length of "eth", and 0x00 marks the end
|
|
185
|
+
*
|
|
186
|
+
* Example: "" (empty string, i.e. root node) is encoded as:
|
|
187
|
+
* [0x00]
|
|
188
|
+
*
|
|
189
|
+
* Example: "👩🏼❤💋👨🏼.eth" (multi-byte unicode character) is encoded as:
|
|
190
|
+
* [0x20, 240, 159, 145, 169, 240, 159, 143, 188, 226, 128, 141, 226, 157, 164, 226,
|
|
191
|
+
* 128, 141, 240, 159, 146, 139, 226, 128, 141, 240, 159, 145, 168, 240, 159, 143,
|
|
192
|
+
* 188, 3, 'e', 't', 'h', 0x00]
|
|
193
|
+
*
|
|
194
|
+
* A DNS-Encoded Name Packet may be malformed if it does not exactly follow that specification.
|
|
195
|
+
* Possible reasons a DNS-Encoded Name may be malfomed include:
|
|
196
|
+
* - 'empty' packet
|
|
197
|
+
* - e.g. []
|
|
198
|
+
* ^-- that's empty!
|
|
199
|
+
* - 'length' byte overflowing packet byte length
|
|
200
|
+
* - e.g. [0x06, 'e', 't', 'h', 0x00]
|
|
201
|
+
* ^-- length overflows available bytes!
|
|
202
|
+
* - 'junk' at the end of the dns-encoded
|
|
203
|
+
* - e.g. [0x03, 'e', 't', 'h', 0x00, 0x01]
|
|
204
|
+
* ^-- junk!
|
|
205
|
+
*
|
|
206
|
+
* @dev This type is _structurally_ typed to aid Event Argument Typing — consumers should further
|
|
207
|
+
* cast the type of the event argument to a _nominally_ typed DNSEncodedName like {@link DNSEncodedLiteralName}
|
|
208
|
+
* or {@link DNSEncodedPartiallyInterpretedName} depending on the context.
|
|
209
|
+
*/
|
|
210
|
+
type DNSEncodedName = Hex$1;
|
|
211
|
+
/**
|
|
212
|
+
* A DNSEncodedName that encodes a name containing 0 or more {@link LiteralLabel}s.
|
|
213
|
+
*
|
|
214
|
+
* In a DNSEncodedLiteralName, all labels are Literal Labels, including any Encoded-LabelHash-looking
|
|
215
|
+
* labels. Any Encoded-LabelHash-looking Literal Label values, when interpreted, will be formatted as
|
|
216
|
+
* the `labelhash` of the Literal Label value.
|
|
217
|
+
*
|
|
218
|
+
* The NameWrapper contract emits DNSEncodedLiteralNames:
|
|
219
|
+
* @see https://github.com/ensdomains/ens-contracts/blob/staging/contracts/utils/BytesUtils_LEGACY.sol
|
|
220
|
+
*
|
|
221
|
+
* The ThreeDNSToken contract emits DNSEncodedLiteralNames:
|
|
222
|
+
* @see https://github.com/3dns-xyz/contracts/blob/44937318ae26cc036982e8c6a496cd82ebdc2b12/src/regcontrol/libraries/BytesUtils.sol
|
|
223
|
+
*
|
|
224
|
+
* @dev nominally typed to enforce usage & enhance codebase clarity
|
|
225
|
+
*/
|
|
226
|
+
type DNSEncodedLiteralName = DNSEncodedName & {
|
|
227
|
+
__brand: "DNSEncodedLiteralName";
|
|
228
|
+
};
|
|
229
|
+
/**
|
|
230
|
+
* A DNSEncodedName that encodes a name consisting of 0 or more labels that are either:
|
|
231
|
+
* a) Literal Labels, or
|
|
232
|
+
* b) Encoded LabelHashes, which are already an Interpreted Label.
|
|
233
|
+
*
|
|
234
|
+
* In a DNSEncodedPartiallyInterpretedName, any Encoded-LabelHash-looking decoded Labels (i.e. ones
|
|
235
|
+
* that match the regex /^\[[\da-f]{64}\]$/) represent an Encoded LabelHash. When decoding a
|
|
236
|
+
* DNSEncodedPartiallyInterpretedName, these labels are already considered Interpreted.
|
|
237
|
+
*
|
|
238
|
+
* NOTE: This type is unused in ENSv1, but its usage is anticipated in ENSv2 due to Encoded
|
|
239
|
+
* LabelHash support in the ENSv2 implementation of the NameCoder contract.
|
|
240
|
+
*
|
|
241
|
+
* @see https://github.com/ensdomains/ens-contracts/blob/staging/contracts/utils/NameCoder.sol
|
|
242
|
+
*
|
|
243
|
+
* @dev nominally typed to enforce usage & enhance codebase clarity
|
|
244
|
+
*/
|
|
245
|
+
type DNSEncodedPartiallyInterpretedName = DNSEncodedName & {
|
|
246
|
+
__brand: "DNSEncodedPartiallyInterpretedName";
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Unix timestamp value
|
|
251
|
+
*
|
|
252
|
+
* Represents the number of seconds that have elapsed
|
|
253
|
+
* since January 1, 1970 (midnight UTC/GMT).
|
|
254
|
+
*
|
|
255
|
+
* Guaranteed to be an integer. May be zero or negative to represent a time at or
|
|
256
|
+
* before Jan 1, 1970.
|
|
257
|
+
*/
|
|
258
|
+
type UnixTimestamp = number;
|
|
259
|
+
/**
|
|
260
|
+
* Duration
|
|
261
|
+
*
|
|
262
|
+
* Representing a duration in seconds.
|
|
263
|
+
*
|
|
264
|
+
* Guaranteed to be a non-negative integer.
|
|
265
|
+
*/
|
|
266
|
+
type Duration = number;
|
|
267
|
+
/**
|
|
268
|
+
* Serialized representation of {@link ChainId}.
|
|
269
|
+
**/
|
|
270
|
+
type ChainIdString = string;
|
|
271
|
+
/**
|
|
272
|
+
* Datetime value following the ISO 8601 standard.
|
|
273
|
+
*
|
|
274
|
+
* @see https://www.iso.org/iso-8601-date-and-time-format.html
|
|
275
|
+
*/
|
|
276
|
+
type DatetimeISO8601 = string;
|
|
277
|
+
/**
|
|
278
|
+
* Serialized representation of a {@link URL}.
|
|
279
|
+
*/
|
|
280
|
+
type UrlString = string;
|
|
281
|
+
/**
|
|
282
|
+
* String representation of {@link AccountId}.
|
|
283
|
+
*
|
|
284
|
+
* Formatted as a fully lowercase CAIP-10 AccountId.
|
|
285
|
+
*
|
|
286
|
+
* @see https://chainagnostic.org/CAIPs/caip-10
|
|
287
|
+
*/
|
|
288
|
+
type AccountIdString = string;
|
|
289
|
+
/**
|
|
290
|
+
* String representation of {@link AssetId}.
|
|
291
|
+
*
|
|
292
|
+
* Formatted as a fully lowercase CAIP-19 AssetId.
|
|
293
|
+
*
|
|
294
|
+
* @see https://chainagnostic.org/CAIPs/caip-19
|
|
295
|
+
* @example "eip155:1/erc721:0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85/0xaf2caa1c2ca1d027f1ac823b529d0a67cd144264b2789fa2ea4d63a67c7103cc"
|
|
296
|
+
* for vitalik.eth in the eth base registrar on mainnet.
|
|
297
|
+
*/
|
|
298
|
+
type AssetIdString = string;
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Serialized CAIP-10 Asset ID that uniquely identifies a Registry contract.
|
|
302
|
+
*/
|
|
303
|
+
type RegistryId = string & {
|
|
304
|
+
__brand: "RegistryContractId";
|
|
305
|
+
};
|
|
306
|
+
/**
|
|
307
|
+
* A Label's Storage Id is uint256(labelHash) with lower (right-most) 32 bits zero'd.
|
|
308
|
+
*
|
|
309
|
+
* In ENSv2, the rightmost 32 bits of a TokenId is used for version management, and it is the leftmost
|
|
310
|
+
* 224 bits that are a stable identifier for a Label within a Registry.
|
|
311
|
+
*/
|
|
312
|
+
type StorageId = bigint & {
|
|
313
|
+
__brand: "StorageId";
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
* The node that uniquely identifies an ENSv1 name.
|
|
317
|
+
*/
|
|
318
|
+
type ENSv1DomainId = Node & {
|
|
319
|
+
__brand: "ENSv1DomainId";
|
|
320
|
+
};
|
|
321
|
+
/**
|
|
322
|
+
* The Serialized CAIP-19 Asset ID (using Storage Id instead of TokenId) that uniquely identifies
|
|
323
|
+
* an ENSv2 name.
|
|
324
|
+
*/
|
|
325
|
+
type ENSv2DomainId = string & {
|
|
326
|
+
__brand: "ENSv2DomainId";
|
|
327
|
+
};
|
|
328
|
+
/**
|
|
329
|
+
* A DomainId is one of ENSv1DomainId or ENSv2DomainId.
|
|
330
|
+
*/
|
|
331
|
+
type DomainId = ENSv1DomainId | ENSv2DomainId;
|
|
332
|
+
/**
|
|
333
|
+
* Uniquely identifies a Permissions entity.
|
|
334
|
+
*/
|
|
335
|
+
type PermissionsId = AccountIdString & {
|
|
336
|
+
__brand: "PermissionsId";
|
|
337
|
+
};
|
|
338
|
+
/**
|
|
339
|
+
* Uniquely identifies a PermissionsResource entity.
|
|
340
|
+
*/
|
|
341
|
+
type PermissionsResourceId = string & {
|
|
342
|
+
__brand: "PermissionsResourceId";
|
|
343
|
+
};
|
|
344
|
+
/**
|
|
345
|
+
* Uniquely identifies a PermissionsUser entity.
|
|
346
|
+
*/
|
|
347
|
+
type PermissionsUserId = string & {
|
|
348
|
+
__brand: "PermissionsUserId";
|
|
349
|
+
};
|
|
350
|
+
/**
|
|
351
|
+
* Uniquely identifies a Resolver entity.
|
|
352
|
+
*/
|
|
353
|
+
type ResolverId = AccountIdString & {
|
|
354
|
+
__brand: "ResolverId";
|
|
355
|
+
};
|
|
356
|
+
/**
|
|
357
|
+
* Uniquely identifies a ResolverRecords entity.
|
|
358
|
+
*/
|
|
359
|
+
type ResolverRecordsId = string & {
|
|
360
|
+
__brand: "ResolverRecordsId";
|
|
361
|
+
};
|
|
362
|
+
/**
|
|
363
|
+
* Uniquely identifies a Registration entity.
|
|
364
|
+
*/
|
|
365
|
+
type RegistrationId = string & {
|
|
366
|
+
__brand: "RegistrationId";
|
|
367
|
+
};
|
|
368
|
+
/**
|
|
369
|
+
* Uniquely identifies a Renewal entity.
|
|
370
|
+
*/
|
|
371
|
+
type RenewalId = string & {
|
|
372
|
+
__brand: "RenewalId";
|
|
373
|
+
};
|
|
374
|
+
/**
|
|
375
|
+
* CanonicalPath is an ordered list of DomainIds describing the canonical path to a Domain.
|
|
376
|
+
* It is ordered in namegraph TRAVERSAL order (i.e. the opposite order of an ENS Name's labels).
|
|
377
|
+
*/
|
|
378
|
+
type CanonicalPath = DomainId[];
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Represents a Hex string, in the format `0x{string}`.
|
|
382
|
+
*/
|
|
383
|
+
type Hex = Hex$1;
|
|
384
|
+
/**
|
|
385
|
+
* Represents an EVM Address, in the format `0x{string}`, which may or may not be checksummed.
|
|
386
|
+
*/
|
|
387
|
+
type Address = Address$1;
|
|
388
|
+
/**
|
|
389
|
+
* Represents a normalized (non-checksummed) EVM Address, in the format `0x{string}`, where all
|
|
390
|
+
* characters are lowercase and length is exactly 42.
|
|
391
|
+
*
|
|
392
|
+
* @dev because the Address type is so widely used, nominally typing it would involve a _ton_ of
|
|
393
|
+
* asNormalizedAddress() casts across the codebase. By avoiding the __brand, we can easily use
|
|
394
|
+
* EventWithArgs<{ address: NormalizedAddress }> in all of the Ponder event handler args to
|
|
395
|
+
* declare that the incoming event.args.address is a NormalizedAddress.
|
|
396
|
+
*/
|
|
397
|
+
type NormalizedAddress = Address;
|
|
398
|
+
/**
|
|
399
|
+
* Unix timestamp value as bigint.
|
|
400
|
+
*
|
|
401
|
+
* Represents the number of seconds that have elapsed
|
|
402
|
+
* since January 1, 1970 (midnight UTC/GMT).
|
|
403
|
+
*
|
|
404
|
+
* Guaranteed to be an integer. May be zero or negative to represent a time at or
|
|
405
|
+
* before Jan 1, 1970.
|
|
406
|
+
*/
|
|
407
|
+
type UnixTimestampBigInt = bigint;
|
|
408
|
+
/**
|
|
409
|
+
* Duration value as bigint.
|
|
410
|
+
*
|
|
411
|
+
* Representing a duration in seconds.
|
|
412
|
+
*
|
|
413
|
+
* Guaranteed to be a non-negative integer.
|
|
414
|
+
*/
|
|
415
|
+
type DurationBigInt = bigint;
|
|
416
|
+
/**
|
|
417
|
+
* A value denominated in wei, the smallest unit of Ether (1 ETH = 10^18 wei).
|
|
418
|
+
*/
|
|
419
|
+
type Wei = bigint;
|
|
420
|
+
/**
|
|
421
|
+
* Chain ID
|
|
422
|
+
*
|
|
423
|
+
* Represents a unique identifier for a chain.
|
|
424
|
+
* Guaranteed to be a positive integer.
|
|
425
|
+
*
|
|
426
|
+
* Chain id standards are organized by the Ethereum Community @ https://github.com/ethereum-lists/chains
|
|
427
|
+
**/
|
|
428
|
+
type ChainId = number;
|
|
429
|
+
/**
|
|
430
|
+
* Defaultable Chain ID
|
|
431
|
+
*
|
|
432
|
+
* Represents a unique identifier for a chain, or
|
|
433
|
+
* the default chain as defined by ENSIP-19.
|
|
434
|
+
*
|
|
435
|
+
* @see https://docs.ens.domains/ensip/19/#annex-supported-chains
|
|
436
|
+
*
|
|
437
|
+
* Guaranteed to be a non-negative integer.
|
|
438
|
+
**/
|
|
439
|
+
type DefaultableChainId = 0 | ChainId;
|
|
440
|
+
/**
|
|
441
|
+
* Represents an account (contract or EOA) at `address` on chain `chainId`.
|
|
442
|
+
*
|
|
443
|
+
* @see https://chainagnostic.org/CAIPs/caip-10
|
|
444
|
+
*/
|
|
445
|
+
interface AccountId {
|
|
446
|
+
chainId: ChainId;
|
|
447
|
+
address: NormalizedAddress;
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* An enum representing the possible CAIP-19 Asset Namespace values.
|
|
451
|
+
*
|
|
452
|
+
* @see https://chainagnostic.org/CAIPs/caip-19
|
|
453
|
+
*/
|
|
454
|
+
declare const AssetNamespaces: {
|
|
455
|
+
readonly ERC721: "erc721";
|
|
456
|
+
readonly ERC1155: "erc1155";
|
|
457
|
+
};
|
|
458
|
+
type AssetNamespace = (typeof AssetNamespaces)[keyof typeof AssetNamespaces];
|
|
459
|
+
/**
|
|
460
|
+
* A uint256 value that identifies a specific NFT within a NFT contract.
|
|
461
|
+
*/
|
|
462
|
+
type TokenId = bigint;
|
|
463
|
+
/**
|
|
464
|
+
* Represents an Asset in `assetNamespace` by `tokenId` in `contract`.
|
|
465
|
+
*
|
|
466
|
+
* @see https://chainagnostic.org/CAIPs/caip-19
|
|
467
|
+
*/
|
|
468
|
+
interface AssetId {
|
|
469
|
+
assetNamespace: AssetNamespace;
|
|
470
|
+
contract: AccountId;
|
|
471
|
+
tokenId: TokenId;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
export { type Address as A, type DatetimeISO8601 as B, type ChainId as C, type DNSEncodedLiteralName as D, type ENSv1DomainId as E, type DefaultableChainId as F, type Duration as G, type Hex as H, type InterpretedName as I, type DurationBigInt as J, type SubgraphInterpretedLabel as K, type LiteralLabel as L, type SubgraphInterpretedName as M, type NormalizedAddress as N, type UnixTimestampBigInt as O, type PermissionsId as P, type UrlString as Q, type RegistrationId as R, type StorageId as S, type TokenId as T, type UnixTimestamp as U, type Wei as W, type AccountId as a, type AccountIdString as b, type AssetId as c, type AssetIdString as d, type Node as e, type DNSEncodedName as f, type ENSv2DomainId as g, type PermissionsResourceId as h, type PermissionsUserId as i, type DomainId as j, type RegistryId as k, type RenewalId as l, type ResolverId as m, type ResolverRecordsId as n, type LabelHash as o, type Label as p, type InterpretedLabel as q, type Name as r, type LiteralName as s, type LabelHashPath as t, type EncodedLabelHash as u, type AssetNamespace as v, AssetNamespaces as w, type CanonicalPath as x, type ChainIdString as y, type DNSEncodedPartiallyInterpretedName as z };
|