@ensnode/ensdb-sdk 1.14.0 → 1.15.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/dist/ensindexer-abstract/index.d.ts +3 -3
- package/dist/ensindexer-abstract/index.js +745 -729
- package/dist/ensindexer-abstract/index.js.map +1 -1
- package/dist/{index-DdrIzPaZ.d.ts → index-1D8_3_7g.d.ts} +3984 -3981
- package/dist/index.d.ts +7 -3
- package/dist/index.js +944 -922
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,722 +1,261 @@
|
|
|
1
|
-
// src/ensindexer-abstract/
|
|
2
|
-
import {
|
|
3
|
-
var
|
|
4
|
-
"
|
|
1
|
+
// src/ensindexer-abstract/migrated-nodes.schema.ts
|
|
2
|
+
import { onchainTable, primaryKey } from "ponder";
|
|
3
|
+
var migratedNodeByParent = onchainTable(
|
|
4
|
+
"migrated_nodes_by_parent",
|
|
5
5
|
(t) => ({
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
sender: t.hex().notNull().$type(),
|
|
10
|
-
// Event Log Metadata
|
|
11
|
-
// chain
|
|
12
|
-
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
13
|
-
// block
|
|
14
|
-
blockNumber: t.bigint().notNull().$type(),
|
|
15
|
-
blockHash: t.hex().notNull().$type(),
|
|
16
|
-
timestamp: t.bigint().notNull(),
|
|
17
|
-
// transaction
|
|
18
|
-
transactionHash: t.hex().notNull().$type(),
|
|
19
|
-
transactionIndex: t.integer().notNull(),
|
|
20
|
-
// `tx.from` — never HCA-aware. Always the EOA/relayer that submitted the transaction.
|
|
21
|
-
// Use `event.sender` for the HCA-aware actor.
|
|
22
|
-
from: t.hex().notNull().$type(),
|
|
23
|
-
to: t.hex().$type(),
|
|
24
|
-
// NOTE: a null `to` means this was a tx that deployed a contract
|
|
25
|
-
// log
|
|
26
|
-
address: t.hex().notNull().$type(),
|
|
27
|
-
logIndex: t.integer().notNull().$type(),
|
|
28
|
-
selector: t.hex().notNull().$type(),
|
|
29
|
-
topics: t.hex().array().notNull().$type(),
|
|
30
|
-
data: t.hex().notNull()
|
|
6
|
+
// keyed by (parentNode, labelHash)
|
|
7
|
+
parentNode: t.hex().notNull().$type(),
|
|
8
|
+
labelHash: t.hex().notNull().$type()
|
|
31
9
|
}),
|
|
32
10
|
(t) => ({
|
|
33
|
-
|
|
34
|
-
byFrom: index().on(t.from),
|
|
35
|
-
bySender: index().on(t.sender),
|
|
36
|
-
byTimestamp: index().on(t.timestamp)
|
|
11
|
+
pk: primaryKey({ columns: [t.parentNode, t.labelHash] })
|
|
37
12
|
})
|
|
38
13
|
);
|
|
39
|
-
var
|
|
40
|
-
|
|
14
|
+
var migratedNodeByNode = onchainTable("migrated_nodes_by_node", (t) => ({
|
|
15
|
+
node: t.hex().primaryKey().$type()
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
// src/ensindexer-abstract/protocol-acceleration.schema.ts
|
|
19
|
+
import { index, onchainTable as onchainTable2, primaryKey as primaryKey2, relations, uniqueIndex } from "ponder";
|
|
20
|
+
var reverseNameRecord = onchainTable2(
|
|
21
|
+
"reverse_name_records",
|
|
41
22
|
(t) => ({
|
|
42
|
-
|
|
43
|
-
|
|
23
|
+
// keyed by (address, coinType)
|
|
24
|
+
address: t.hex().notNull().$type(),
|
|
25
|
+
coinType: t.bigint().notNull(),
|
|
26
|
+
/**
|
|
27
|
+
* Represents the ENSIP-19 Reverse Name Record for a given (address, coinType).
|
|
28
|
+
*
|
|
29
|
+
* The value of this field is guaranteed to be a non-empty {@link InterpretedName}.
|
|
30
|
+
*/
|
|
31
|
+
value: t.text().notNull().$type()
|
|
44
32
|
}),
|
|
45
|
-
(t) => ({ pk: primaryKey({ columns: [t.domainId, t.eventId] }) })
|
|
46
|
-
);
|
|
47
|
-
var resolverEvent = onchainTable(
|
|
48
|
-
"resolver_events",
|
|
49
33
|
(t) => ({
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}),
|
|
53
|
-
(t) => ({ pk: primaryKey({ columns: [t.resolverId, t.eventId] }) })
|
|
34
|
+
pk: primaryKey2({ columns: [t.address, t.coinType] })
|
|
35
|
+
})
|
|
54
36
|
);
|
|
55
|
-
var
|
|
56
|
-
"
|
|
37
|
+
var domainResolverRelation = onchainTable2(
|
|
38
|
+
"domain_resolver_relations",
|
|
57
39
|
(t) => ({
|
|
58
|
-
|
|
59
|
-
|
|
40
|
+
// keyed by (chainId, address, node)
|
|
41
|
+
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
42
|
+
// The Registry (ENSv1Registry or ENSv2Registry)'s AccountId.
|
|
43
|
+
address: t.hex().notNull().$type(),
|
|
44
|
+
domainId: t.text().notNull().$type(),
|
|
45
|
+
// The Domain's assigned Resolver's address (NOTE: always scoped to chainId)
|
|
46
|
+
resolver: t.hex().notNull().$type()
|
|
60
47
|
}),
|
|
61
|
-
(t) => ({ pk: primaryKey({ columns: [t.permissionsId, t.eventId] }) })
|
|
62
|
-
);
|
|
63
|
-
var permissionsUserEvent = onchainTable(
|
|
64
|
-
"permissions_user_events",
|
|
65
48
|
(t) => ({
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
})
|
|
69
|
-
(t) => ({ pk: primaryKey({ columns: [t.permissionsUserId, t.eventId] }) })
|
|
49
|
+
pk: primaryKey2({ columns: [t.chainId, t.address, t.domainId] }),
|
|
50
|
+
byDomain: index().on(t.domainId)
|
|
51
|
+
})
|
|
70
52
|
);
|
|
71
|
-
var
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
domains: many(domain),
|
|
77
|
-
permissions: many(permissionsUser)
|
|
53
|
+
var domainResolverRelation_relations = relations(domainResolverRelation, ({ one }) => ({
|
|
54
|
+
resolver: one(resolver, {
|
|
55
|
+
fields: [domainResolverRelation.chainId, domainResolverRelation.resolver],
|
|
56
|
+
references: [resolver.chainId, resolver.address]
|
|
57
|
+
})
|
|
78
58
|
}));
|
|
79
|
-
var
|
|
80
|
-
"
|
|
81
|
-
"ENSv1VirtualRegistry",
|
|
82
|
-
"ENSv2Registry"
|
|
83
|
-
]);
|
|
84
|
-
var registry = onchainTable(
|
|
85
|
-
"registries",
|
|
59
|
+
var resolver = onchainTable2(
|
|
60
|
+
"resolvers",
|
|
86
61
|
(t) => ({
|
|
87
|
-
//
|
|
62
|
+
// keyed by (chainId, address)
|
|
88
63
|
id: t.text().primaryKey().$type(),
|
|
89
|
-
// has a type
|
|
90
|
-
type: registryType().notNull(),
|
|
91
64
|
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
92
|
-
address: t.hex().notNull().$type()
|
|
93
|
-
// If this is an ENSv1VirtualRegistry, `node` is the namehash of the parent ENSv1 domain that
|
|
94
|
-
// owns it, otherwise null.
|
|
95
|
-
node: t.hex().$type(),
|
|
96
|
-
// the Registry's declared Canonical Domain (uni-directional)
|
|
97
|
-
canonicalDomainId: t.text().$type(),
|
|
98
|
-
// Whether this Registry is part of the canonical nametree. See canonicality-db-helpers.ts.
|
|
99
|
-
canonical: t.boolean().notNull().default(false),
|
|
100
|
-
// Synthetic monotonic sentinel: flipped to true the first time a child Domain is registered
|
|
101
|
-
// under this Registry (see `ensureDomainInRegistry`). Read by `cascadeCanonicality` to skip
|
|
102
|
-
// the raw-SQL recursive-CTE walk (and its associated Ponder cache flush) when the start
|
|
103
|
-
// registry provably has no descendants — the dominant case for fresh ENSv1 virtual
|
|
104
|
-
// registries on first wire-up. Double-underscore prefix marks it as an internal-only
|
|
105
|
-
// bookkeeping field, not part of the on-chain protocol surface.
|
|
106
|
-
__hasChildren: t.boolean().notNull().default(false)
|
|
65
|
+
address: t.hex().notNull().$type()
|
|
107
66
|
}),
|
|
108
67
|
(t) => ({
|
|
109
|
-
|
|
110
|
-
byChainAddress: index().on(t.chainId, t.address)
|
|
68
|
+
byId: uniqueIndex().on(t.chainId, t.address)
|
|
111
69
|
})
|
|
112
70
|
);
|
|
113
|
-
var
|
|
114
|
-
|
|
115
|
-
domains: many(domain, { relationName: "registry" }),
|
|
116
|
-
// domains that declare this registry as their subregistry
|
|
117
|
-
domainsAsSubregistry: many(domain, { relationName: "subregistry" }),
|
|
118
|
-
permissions: one(permissions, {
|
|
119
|
-
relationName: "permissions",
|
|
120
|
-
fields: [registry.chainId, registry.address],
|
|
121
|
-
references: [permissions.chainId, permissions.address]
|
|
122
|
-
})
|
|
71
|
+
var resolver_relations = relations(resolver, ({ many }) => ({
|
|
72
|
+
records: many(resolverRecords)
|
|
123
73
|
}));
|
|
124
|
-
var
|
|
125
|
-
|
|
126
|
-
"domains",
|
|
74
|
+
var resolverRecords = onchainTable2(
|
|
75
|
+
"resolver_records",
|
|
127
76
|
(t) => ({
|
|
128
|
-
//
|
|
77
|
+
// keyed by (chainId, resolver, node)
|
|
129
78
|
id: t.text().primaryKey().$type(),
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
registryId: t.text().notNull().$type(),
|
|
134
|
-
// the Domain's declared Subregistry (uni-directional)
|
|
135
|
-
subregistryId: t.text().$type(),
|
|
136
|
-
// If this is an ENSv2Domain, the TokenId within the ENSv2Registry, otherwise null.
|
|
137
|
-
tokenId: t.bigint().$type(),
|
|
138
|
-
// If this is an ENSv1Domain, The Domain's namehash, otherwise null.
|
|
139
|
-
node: t.hex().$type(),
|
|
140
|
-
// represents a labelHash
|
|
141
|
-
labelHash: t.hex().notNull().$type(),
|
|
142
|
-
// If this is an ENSv1Domain, this is the effective owner of the Domain.
|
|
143
|
-
// If this is an ENSv2Domain, this is the on-chain owner address (the HCA account address if used).
|
|
144
|
-
ownerId: t.hex().$type(),
|
|
145
|
-
// If this is an ENSv1Domain, may have a `rootRegistryOwner`, otherwise null.
|
|
146
|
-
rootRegistryOwnerId: t.hex().$type(),
|
|
147
|
-
// Whether this Domain is part of the canonical nametree. Mirrors the parent Registry's flag.
|
|
148
|
-
canonical: t.boolean().notNull().default(false),
|
|
79
|
+
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
80
|
+
address: t.hex().notNull().$type(),
|
|
81
|
+
node: t.hex().notNull().$type(),
|
|
149
82
|
/**
|
|
150
|
-
*
|
|
151
|
-
* Maintained by `canonicality-db-helpers.ts`.
|
|
83
|
+
* Represents the value of the reverse-resolution (ENSIP-3) name() record, used for Reverse Resolution.
|
|
152
84
|
*
|
|
153
|
-
* @
|
|
85
|
+
* If present, the value of this field is guaranteed to be a non-empty {@link InterpretedName}.
|
|
154
86
|
*/
|
|
155
|
-
|
|
87
|
+
name: t.text().$type(),
|
|
156
88
|
/**
|
|
157
|
-
*
|
|
158
|
-
* Maintained by `canonicality-db-helpers.ts`.
|
|
159
|
-
*
|
|
160
|
-
* @dev Note that LabelHashPaths are in traversal-order (i.e. [labelhash("eth"), labelhash("vitalik")]).
|
|
89
|
+
* ENSIP-7 contenthash raw bytes or null if not set.
|
|
161
90
|
*/
|
|
162
|
-
|
|
91
|
+
contenthash: t.hex(),
|
|
163
92
|
/**
|
|
164
|
-
*
|
|
165
|
-
* Maintained by `canonicality-db-helpers.ts`.
|
|
93
|
+
* PubkeyResolver (x, y) pair, or null if not set.
|
|
166
94
|
*
|
|
167
|
-
*
|
|
95
|
+
* Invariant: both null together, or both set together.
|
|
168
96
|
*/
|
|
169
|
-
|
|
97
|
+
pubkeyX: t.hex(),
|
|
98
|
+
pubkeyY: t.hex(),
|
|
170
99
|
/**
|
|
171
|
-
*
|
|
172
|
-
* Maintained by `canonicality-db-helpers.ts`.
|
|
173
|
-
*
|
|
174
|
-
* @dev The depth of this Domain in the Canonical Nametree i.e. the number of Labels in its Canonical Name.
|
|
175
|
-
* @example "eth" depth 1, "vitalik.eth" depth 2, etc
|
|
100
|
+
* IDNSZoneResolver zonehash or null if not set.
|
|
176
101
|
*/
|
|
177
|
-
|
|
102
|
+
dnszonehash: t.hex(),
|
|
178
103
|
/**
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
* @dev the computed Node (via `namehash`) of this Domain's Canonical Name.
|
|
104
|
+
* IVersionableResolver version. Null when no `VersionChanged` event has been seen for this
|
|
105
|
+
* (chainId, address, node) — the resolver may not implement `IVersionableResolver`, or simply
|
|
106
|
+
* may never have been version-bumped. Consumers should treat null as "unknown" rather than 0.
|
|
183
107
|
*/
|
|
184
|
-
|
|
185
|
-
// NOTE: Domain-Resolver Relations tracked via Protocol Acceleration plugin
|
|
108
|
+
version: t.bigint().$type()
|
|
186
109
|
}),
|
|
187
110
|
(t) => ({
|
|
188
|
-
|
|
189
|
-
byRegistry: index().on(t.registryId),
|
|
190
|
-
bySubregistry: index().on(t.subregistryId).where(sql`${t.subregistryId} IS NOT NULL`),
|
|
191
|
-
byOwner: index().on(t.ownerId),
|
|
192
|
-
byLabelHash: index().on(t.labelHash),
|
|
193
|
-
// hash index avoids the btree 8191-byte row-size hazard for spam names
|
|
194
|
-
byCanonicalNameExact: index().using("hash", t.canonicalName),
|
|
195
|
-
// GIN trigram index for substring / similarity queries (inline `gin_trgm_ops` via `sql`
|
|
196
|
-
// because passing it through `.op()` gets dropped by Ponder)
|
|
197
|
-
byCanonicalNameFuzzy: index().using("gin", sql`${t.canonicalName} gin_trgm_ops`),
|
|
198
|
-
// GIN containment for `cascadeLabelHeal`'s `canonical_label_hash_path @> ARRAY[lh]` lookup
|
|
199
|
-
byCanonicalLabelHashPath: index().using("gin", t.canonicalLabelHashPath),
|
|
200
|
-
// hash index for resolver-record → canonical-domain joins
|
|
201
|
-
byCanonicalNode: index().using("hash", t.canonicalNode),
|
|
202
|
-
// btree for ORDER BY canonical_depth (typeahead and DEPTH-ordered browse)
|
|
203
|
-
byCanonicalDepth: index().on(t.canonicalDepth)
|
|
111
|
+
byId: uniqueIndex().on(t.chainId, t.address, t.node)
|
|
204
112
|
})
|
|
205
113
|
);
|
|
206
|
-
var
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
fields: [
|
|
210
|
-
references: [
|
|
211
|
-
}),
|
|
212
|
-
subregistry: one(registry, {
|
|
213
|
-
relationName: "subregistry",
|
|
214
|
-
fields: [domain.subregistryId],
|
|
215
|
-
references: [registry.id]
|
|
216
|
-
}),
|
|
217
|
-
owner: one(account, {
|
|
218
|
-
relationName: "owner",
|
|
219
|
-
fields: [domain.ownerId],
|
|
220
|
-
references: [account.id]
|
|
221
|
-
}),
|
|
222
|
-
rootRegistryOwner: one(account, {
|
|
223
|
-
relationName: "rootRegistryOwner",
|
|
224
|
-
fields: [domain.rootRegistryOwnerId],
|
|
225
|
-
references: [account.id]
|
|
226
|
-
}),
|
|
227
|
-
label: one(label, {
|
|
228
|
-
relationName: "label",
|
|
229
|
-
fields: [domain.labelHash],
|
|
230
|
-
references: [label.labelHash]
|
|
114
|
+
var resolverRecords_relations = relations(resolverRecords, ({ one, many }) => ({
|
|
115
|
+
// belongs to resolver
|
|
116
|
+
resolver: one(resolver, {
|
|
117
|
+
fields: [resolverRecords.chainId, resolverRecords.address],
|
|
118
|
+
references: [resolver.chainId, resolver.address]
|
|
231
119
|
}),
|
|
232
|
-
|
|
120
|
+
// resolverRecord has many address records
|
|
121
|
+
addressRecords: many(resolverAddressRecord),
|
|
122
|
+
// resolverRecord has many text records
|
|
123
|
+
textRecords: many(resolverTextRecord)
|
|
233
124
|
}));
|
|
234
|
-
var
|
|
235
|
-
|
|
236
|
-
"NameWrapper",
|
|
237
|
-
"BaseRegistrar",
|
|
238
|
-
"ThreeDNS",
|
|
239
|
-
"ENSv2RegistryRegistration",
|
|
240
|
-
"ENSv2RegistryReservation"
|
|
241
|
-
]);
|
|
242
|
-
var registration = onchainTable(
|
|
243
|
-
"registrations",
|
|
125
|
+
var resolverAddressRecord = onchainTable2(
|
|
126
|
+
"resolver_address_records",
|
|
244
127
|
(t) => ({
|
|
245
|
-
// keyed by (
|
|
246
|
-
id: t.text().primaryKey().$type(),
|
|
247
|
-
domainId: t.text().notNull().$type(),
|
|
248
|
-
registrationIndex: t.integer().notNull(),
|
|
249
|
-
// has a type
|
|
250
|
-
type: registrationType().notNull(),
|
|
251
|
-
// has a start
|
|
252
|
-
start: t.bigint().notNull(),
|
|
253
|
-
// may have an expiry
|
|
254
|
-
expiry: t.bigint(),
|
|
255
|
-
// maybe have a grace period (BaseRegistrar)
|
|
256
|
-
gracePeriod: t.bigint(),
|
|
257
|
-
// registrar AccountId
|
|
258
|
-
registrarChainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
259
|
-
registrarAddress: t.hex().notNull().$type(),
|
|
260
|
-
// may reference a registrant. If this is an ENSv2 Registration, the protocol-emitted
|
|
261
|
-
// registrant address (the HCA account address if used).
|
|
262
|
-
registrantId: t.hex().$type(),
|
|
263
|
-
// may reference an unregistrant. If this is an ENSv2 Registration, the protocol-emitted
|
|
264
|
-
// unregistrant address (the HCA account address if used).
|
|
265
|
-
unregistrantId: t.hex().$type(),
|
|
266
|
-
// may have referrer data
|
|
267
|
-
referrer: t.hex().$type(),
|
|
268
|
-
// may have fuses (NameWrapper, Wrapped BaseRegistrar)
|
|
269
|
-
fuses: t.integer(),
|
|
270
|
-
// TODO(paymentToken): add payment token tracking here
|
|
271
|
-
// may have base cost (BaseRegistrar, ENSv2Registrar)
|
|
272
|
-
base: t.bigint(),
|
|
273
|
-
// may have a premium (BaseRegistrar)
|
|
274
|
-
premium: t.bigint(),
|
|
275
|
-
// may be Wrapped (BaseRegistrar)
|
|
276
|
-
wrapped: t.boolean().default(false),
|
|
277
|
-
// has an event
|
|
278
|
-
eventId: t.text().notNull()
|
|
279
|
-
}),
|
|
280
|
-
(t) => ({
|
|
281
|
-
byId: uniqueIndex().on(t.domainId, t.registrationIndex)
|
|
282
|
-
})
|
|
283
|
-
);
|
|
284
|
-
var registration_relations = relations(registration, ({ one, many }) => ({
|
|
285
|
-
// belongs to a domain
|
|
286
|
-
domain: one(domain, {
|
|
287
|
-
fields: [registration.domainId],
|
|
288
|
-
references: [domain.id]
|
|
289
|
-
}),
|
|
290
|
-
// has one registrant
|
|
291
|
-
registrant: one(account, {
|
|
292
|
-
fields: [registration.registrantId],
|
|
293
|
-
references: [account.id],
|
|
294
|
-
relationName: "registrant"
|
|
295
|
-
}),
|
|
296
|
-
// has a latest registration index
|
|
297
|
-
latestRegistrationIndex: one(latestRegistrationIndex),
|
|
298
|
-
// has a latest renewal index
|
|
299
|
-
latestRenewalIndex: one(latestRenewalIndex),
|
|
300
|
-
// has one unregistrant
|
|
301
|
-
unregistrant: one(account, {
|
|
302
|
-
fields: [registration.unregistrantId],
|
|
303
|
-
references: [account.id],
|
|
304
|
-
relationName: "unregistrant"
|
|
305
|
-
}),
|
|
306
|
-
// has many renewals
|
|
307
|
-
renewals: many(renewal),
|
|
308
|
-
// has an event
|
|
309
|
-
event: one(event, {
|
|
310
|
-
fields: [registration.eventId],
|
|
311
|
-
references: [event.id]
|
|
312
|
-
})
|
|
313
|
-
}));
|
|
314
|
-
var latestRegistrationIndex = onchainTable("latest_registration_indexes", (t) => ({
|
|
315
|
-
domainId: t.text().primaryKey().$type(),
|
|
316
|
-
registrationIndex: t.integer().notNull()
|
|
317
|
-
}));
|
|
318
|
-
var latestRegistrationIndex_relations = relations(latestRegistrationIndex, ({ one }) => ({
|
|
319
|
-
// references domain
|
|
320
|
-
domain: one(domain, {
|
|
321
|
-
fields: [latestRegistrationIndex.domainId],
|
|
322
|
-
references: [domain.id]
|
|
323
|
-
})
|
|
324
|
-
}));
|
|
325
|
-
var renewal = onchainTable(
|
|
326
|
-
"renewals",
|
|
327
|
-
(t) => ({
|
|
328
|
-
// keyed by (registrationId, index)
|
|
329
|
-
id: t.text().primaryKey().$type(),
|
|
330
|
-
domainId: t.text().notNull().$type(),
|
|
331
|
-
registrationIndex: t.integer().notNull(),
|
|
332
|
-
renewalIndex: t.integer().notNull(),
|
|
333
|
-
// all renewals have a duration
|
|
334
|
-
duration: t.bigint().notNull(),
|
|
335
|
-
// may have a referrer
|
|
336
|
-
referrer: t.hex().$type(),
|
|
337
|
-
// TODO(paymentToken): add payment token tracking here
|
|
338
|
-
// may have base cost
|
|
339
|
-
base: t.bigint(),
|
|
340
|
-
// may have a premium (ENSv1 RegistrarControllers)
|
|
341
|
-
premium: t.bigint(),
|
|
342
|
-
// has an event
|
|
343
|
-
eventId: t.text().notNull()
|
|
344
|
-
}),
|
|
345
|
-
(t) => ({
|
|
346
|
-
byId: uniqueIndex().on(t.domainId, t.registrationIndex, t.renewalIndex)
|
|
347
|
-
})
|
|
348
|
-
);
|
|
349
|
-
var renewal_relations = relations(renewal, ({ one }) => ({
|
|
350
|
-
// belongs to registration
|
|
351
|
-
registration: one(registration, {
|
|
352
|
-
fields: [renewal.domainId, renewal.registrationIndex],
|
|
353
|
-
references: [registration.domainId, registration.registrationIndex]
|
|
354
|
-
}),
|
|
355
|
-
// has an event
|
|
356
|
-
event: one(event, {
|
|
357
|
-
fields: [renewal.eventId],
|
|
358
|
-
references: [event.id]
|
|
359
|
-
})
|
|
360
|
-
}));
|
|
361
|
-
var latestRenewalIndex = onchainTable(
|
|
362
|
-
"latest_renewal_indexes",
|
|
363
|
-
(t) => ({
|
|
364
|
-
domainId: t.text().notNull().$type(),
|
|
365
|
-
registrationIndex: t.integer().notNull(),
|
|
366
|
-
renewalIndex: t.integer().notNull()
|
|
367
|
-
}),
|
|
368
|
-
(t) => ({ pk: primaryKey({ columns: [t.domainId, t.registrationIndex] }) })
|
|
369
|
-
);
|
|
370
|
-
var latestRenewalIndex_relations = relations(latestRenewalIndex, ({ one }) => ({
|
|
371
|
-
// references domain
|
|
372
|
-
domain: one(domain, {
|
|
373
|
-
fields: [latestRenewalIndex.domainId],
|
|
374
|
-
references: [domain.id]
|
|
375
|
-
})
|
|
376
|
-
}));
|
|
377
|
-
var permissions = onchainTable(
|
|
378
|
-
"permissions",
|
|
379
|
-
(t) => ({
|
|
380
|
-
id: t.text().primaryKey().$type(),
|
|
381
|
-
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
382
|
-
address: t.hex().notNull().$type()
|
|
383
|
-
}),
|
|
384
|
-
(t) => ({
|
|
385
|
-
byId: uniqueIndex().on(t.chainId, t.address)
|
|
386
|
-
})
|
|
387
|
-
);
|
|
388
|
-
var relations_permissions = relations(permissions, ({ many }) => ({
|
|
389
|
-
resources: many(permissionsResource),
|
|
390
|
-
users: many(permissionsUser)
|
|
391
|
-
}));
|
|
392
|
-
var permissionsResource = onchainTable(
|
|
393
|
-
"permissions_resources",
|
|
394
|
-
(t) => ({
|
|
395
|
-
id: t.text().primaryKey().$type(),
|
|
128
|
+
// keyed by ((chainId, resolver, node), coinType)
|
|
396
129
|
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
397
130
|
address: t.hex().notNull().$type(),
|
|
398
|
-
|
|
131
|
+
node: t.hex().notNull().$type(),
|
|
132
|
+
// NOTE: all well-known CoinTypes fit into javascript number but NOT postgres .integer, must be
|
|
133
|
+
// stored as BigInt
|
|
134
|
+
coinType: t.bigint().notNull(),
|
|
135
|
+
/**
|
|
136
|
+
* Represents the value of the Addresss Record specified by ((chainId, resolver, node), coinType).
|
|
137
|
+
*
|
|
138
|
+
* The value of this field is interpreted by `interpretAddressRecordValue` — see its implementation
|
|
139
|
+
* for additional context and specific guarantees.
|
|
140
|
+
*/
|
|
141
|
+
value: t.text().notNull()
|
|
399
142
|
}),
|
|
400
143
|
(t) => ({
|
|
401
|
-
|
|
144
|
+
pk: primaryKey2({ columns: [t.chainId, t.address, t.node, t.coinType] })
|
|
402
145
|
})
|
|
403
146
|
);
|
|
404
|
-
var
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
147
|
+
var resolverAddressRecordRelations = relations(resolverAddressRecord, ({ one }) => ({
|
|
148
|
+
// belongs to resolverRecord
|
|
149
|
+
resolver: one(resolverRecords, {
|
|
150
|
+
fields: [
|
|
151
|
+
resolverAddressRecord.chainId,
|
|
152
|
+
resolverAddressRecord.address,
|
|
153
|
+
resolverAddressRecord.node
|
|
154
|
+
],
|
|
155
|
+
references: [resolverRecords.chainId, resolverRecords.address, resolverRecords.node]
|
|
408
156
|
})
|
|
409
157
|
}));
|
|
410
|
-
var
|
|
411
|
-
"
|
|
158
|
+
var resolverTextRecord = onchainTable2(
|
|
159
|
+
"resolver_text_records",
|
|
412
160
|
(t) => ({
|
|
413
|
-
|
|
161
|
+
// keyed by ((chainId, resolver, node), key)
|
|
414
162
|
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
415
163
|
address: t.hex().notNull().$type(),
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
164
|
+
node: t.hex().notNull().$type(),
|
|
165
|
+
key: t.text().notNull(),
|
|
166
|
+
/**
|
|
167
|
+
* Represents the value of the Text Record specified by ((chainId, resolver, node), key).
|
|
168
|
+
*
|
|
169
|
+
* The value of this field is interpreted by `interpretTextRecordValue` — see its implementation
|
|
170
|
+
* for additional context and specific guarantees.
|
|
171
|
+
*/
|
|
172
|
+
value: t.text().notNull()
|
|
421
173
|
}),
|
|
422
174
|
(t) => ({
|
|
423
|
-
|
|
175
|
+
pk: primaryKey2({ columns: [t.chainId, t.address, t.node, t.key] })
|
|
424
176
|
})
|
|
425
177
|
);
|
|
426
|
-
var
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
permissions: one(permissions, {
|
|
432
|
-
fields: [permissionsUser.chainId, permissionsUser.address],
|
|
433
|
-
references: [permissions.chainId, permissions.address]
|
|
434
|
-
}),
|
|
435
|
-
resource: one(permissionsResource, {
|
|
436
|
-
fields: [permissionsUser.chainId, permissionsUser.address, permissionsUser.resource],
|
|
437
|
-
references: [
|
|
438
|
-
permissionsResource.chainId,
|
|
439
|
-
permissionsResource.address,
|
|
440
|
-
permissionsResource.resource
|
|
441
|
-
]
|
|
442
|
-
})
|
|
443
|
-
}));
|
|
444
|
-
var label = onchainTable(
|
|
445
|
-
"labels",
|
|
446
|
-
(t) => ({
|
|
447
|
-
labelHash: t.hex().primaryKey().$type(),
|
|
448
|
-
interpreted: t.text().notNull().$type()
|
|
449
|
-
}),
|
|
450
|
-
(t) => ({
|
|
451
|
-
// hash index avoids the btree 8191-byte row-size hazard for spam labels (a single label can
|
|
452
|
-
// exceed btree's leaf-size limit)
|
|
453
|
-
byInterpretedExact: index().using("hash", t.interpreted),
|
|
454
|
-
// GIN trigram index for substring / similarity queries (inline `gin_trgm_ops` via `sql`
|
|
455
|
-
// because passing it through `.op()` gets dropped by Ponder)
|
|
456
|
-
byInterpretedFuzzy: index().using("gin", sql`${t.interpreted} gin_trgm_ops`)
|
|
178
|
+
var resolverTextRecordRelations = relations(resolverTextRecord, ({ one }) => ({
|
|
179
|
+
// belongs to resolverRecord
|
|
180
|
+
resolver: one(resolverRecords, {
|
|
181
|
+
fields: [resolverTextRecord.chainId, resolverTextRecord.address, resolverTextRecord.node],
|
|
182
|
+
references: [resolverRecords.chainId, resolverRecords.address, resolverRecords.node]
|
|
457
183
|
})
|
|
458
|
-
);
|
|
459
|
-
var label_relations = relations(label, ({ many }) => ({
|
|
460
|
-
domains: many(domain)
|
|
461
184
|
}));
|
|
462
185
|
|
|
463
|
-
// src/ensindexer-abstract/
|
|
464
|
-
import { onchainTable as
|
|
465
|
-
var
|
|
466
|
-
"
|
|
186
|
+
// src/ensindexer-abstract/registrars.schema.ts
|
|
187
|
+
import { index as index2, onchainEnum, onchainTable as onchainTable3, relations as relations2, uniqueIndex as uniqueIndex2 } from "ponder";
|
|
188
|
+
var subregistries = onchainTable3(
|
|
189
|
+
"subregistries",
|
|
467
190
|
(t) => ({
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
191
|
+
/**
|
|
192
|
+
* Subregistry ID
|
|
193
|
+
*
|
|
194
|
+
* Identifies the chainId and address of the smart contract associated
|
|
195
|
+
* with the subregistry.
|
|
196
|
+
*
|
|
197
|
+
* Guaranteed to be a fully lowercase string formatted according to
|
|
198
|
+
* the CAIP-10 standard.
|
|
199
|
+
*
|
|
200
|
+
* @see https://chainagnostic.org/CAIPs/caip-10
|
|
201
|
+
*/
|
|
202
|
+
subregistryId: t.text().primaryKey(),
|
|
203
|
+
/**
|
|
204
|
+
* The node (namehash) of the name the subregistry manages subnames of.
|
|
205
|
+
* Example subregistry managed names:
|
|
206
|
+
* - `eth`
|
|
207
|
+
* - `base.eth`
|
|
208
|
+
* - `linea.eth`
|
|
209
|
+
*
|
|
210
|
+
* Guaranteed to be a fully lowercase hex string representation of 32-bytes.
|
|
211
|
+
*/
|
|
212
|
+
node: t.hex().notNull()
|
|
471
213
|
}),
|
|
472
214
|
(t) => ({
|
|
473
|
-
|
|
215
|
+
uniqueNode: uniqueIndex2().on(t.node)
|
|
474
216
|
})
|
|
475
217
|
);
|
|
476
|
-
var
|
|
477
|
-
|
|
478
|
-
}));
|
|
479
|
-
|
|
480
|
-
// src/ensindexer-abstract/protocol-acceleration.schema.ts
|
|
481
|
-
import { onchainTable as onchainTable3, primaryKey as primaryKey3, relations as relations2, uniqueIndex as uniqueIndex2 } from "ponder";
|
|
482
|
-
var reverseNameRecord = onchainTable3(
|
|
483
|
-
"reverse_name_records",
|
|
218
|
+
var registrationLifecycles = onchainTable3(
|
|
219
|
+
"registration_lifecycles",
|
|
484
220
|
(t) => ({
|
|
485
|
-
// keyed by (address, coinType)
|
|
486
|
-
address: t.hex().notNull().$type(),
|
|
487
|
-
coinType: t.bigint().notNull(),
|
|
488
221
|
/**
|
|
489
|
-
*
|
|
222
|
+
* The node (namehash) of the FQDN of the domain the registration lifecycle
|
|
223
|
+
* is associated with.
|
|
490
224
|
*
|
|
491
|
-
*
|
|
225
|
+
* Guaranteed to be a subname of the node (namehash) of the subregistry
|
|
226
|
+
* identified by `subregistryId`.
|
|
227
|
+
*
|
|
228
|
+
* Guaranteed to be a fully lowercase hex string representation of 32-bytes.
|
|
492
229
|
*/
|
|
493
|
-
|
|
230
|
+
node: t.hex().primaryKey(),
|
|
231
|
+
/**
|
|
232
|
+
* Subregistry ID
|
|
233
|
+
*
|
|
234
|
+
* Identifies the chainId and address of the subregistry smart contract
|
|
235
|
+
* that manages the registration lifecycle.
|
|
236
|
+
*
|
|
237
|
+
* Guaranteed to be a fully lowercase string formatted according to
|
|
238
|
+
* the CAIP-10 standard.
|
|
239
|
+
*
|
|
240
|
+
* @see https://chainagnostic.org/CAIPs/caip-10
|
|
241
|
+
*/
|
|
242
|
+
subregistryId: t.text().notNull(),
|
|
243
|
+
/**
|
|
244
|
+
* Expires at
|
|
245
|
+
*
|
|
246
|
+
* Unix timestamp when the Registration Lifecycle is scheduled to expire.
|
|
247
|
+
*/
|
|
248
|
+
expiresAt: t.bigint().notNull()
|
|
494
249
|
}),
|
|
495
250
|
(t) => ({
|
|
496
|
-
|
|
251
|
+
bySubregistry: index2().on(t.subregistryId)
|
|
497
252
|
})
|
|
498
253
|
);
|
|
499
|
-
var
|
|
500
|
-
"domain_resolver_relations",
|
|
501
|
-
(t) => ({
|
|
502
|
-
// keyed by (chainId, address, node)
|
|
503
|
-
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
504
|
-
// The Registry (ENSv1Registry or ENSv2Registry)'s AccountId.
|
|
505
|
-
address: t.hex().notNull().$type(),
|
|
506
|
-
domainId: t.text().notNull().$type(),
|
|
507
|
-
// The Domain's assigned Resolver's address (NOTE: always scoped to chainId)
|
|
508
|
-
resolver: t.hex().notNull().$type()
|
|
509
|
-
}),
|
|
510
|
-
(t) => ({
|
|
511
|
-
pk: primaryKey3({ columns: [t.chainId, t.address, t.domainId] })
|
|
512
|
-
})
|
|
513
|
-
);
|
|
514
|
-
var domainResolverRelation_relations = relations2(domainResolverRelation, ({ one }) => ({
|
|
515
|
-
resolver: one(resolver, {
|
|
516
|
-
fields: [domainResolverRelation.chainId, domainResolverRelation.resolver],
|
|
517
|
-
references: [resolver.chainId, resolver.address]
|
|
518
|
-
})
|
|
519
|
-
}));
|
|
520
|
-
var resolver = onchainTable3(
|
|
521
|
-
"resolvers",
|
|
522
|
-
(t) => ({
|
|
523
|
-
// keyed by (chainId, address)
|
|
524
|
-
id: t.text().primaryKey().$type(),
|
|
525
|
-
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
526
|
-
address: t.hex().notNull().$type()
|
|
527
|
-
}),
|
|
528
|
-
(t) => ({
|
|
529
|
-
byId: uniqueIndex2().on(t.chainId, t.address)
|
|
530
|
-
})
|
|
531
|
-
);
|
|
532
|
-
var resolver_relations = relations2(resolver, ({ many }) => ({
|
|
533
|
-
records: many(resolverRecords)
|
|
534
|
-
}));
|
|
535
|
-
var resolverRecords = onchainTable3(
|
|
536
|
-
"resolver_records",
|
|
537
|
-
(t) => ({
|
|
538
|
-
// keyed by (chainId, resolver, node)
|
|
539
|
-
id: t.text().primaryKey().$type(),
|
|
540
|
-
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
541
|
-
address: t.hex().notNull().$type(),
|
|
542
|
-
node: t.hex().notNull().$type(),
|
|
543
|
-
/**
|
|
544
|
-
* Represents the value of the reverse-resolution (ENSIP-3) name() record, used for Reverse Resolution.
|
|
545
|
-
*
|
|
546
|
-
* If present, the value of this field is guaranteed to be a non-empty {@link InterpretedName}.
|
|
547
|
-
*/
|
|
548
|
-
name: t.text().$type(),
|
|
549
|
-
/**
|
|
550
|
-
* ENSIP-7 contenthash raw bytes or null if not set.
|
|
551
|
-
*/
|
|
552
|
-
contenthash: t.hex(),
|
|
553
|
-
/**
|
|
554
|
-
* PubkeyResolver (x, y) pair, or null if not set.
|
|
555
|
-
*
|
|
556
|
-
* Invariant: both null together, or both set together.
|
|
557
|
-
*/
|
|
558
|
-
pubkeyX: t.hex(),
|
|
559
|
-
pubkeyY: t.hex(),
|
|
560
|
-
/**
|
|
561
|
-
* IDNSZoneResolver zonehash or null if not set.
|
|
562
|
-
*/
|
|
563
|
-
dnszonehash: t.hex(),
|
|
564
|
-
/**
|
|
565
|
-
* IVersionableResolver version. Null when no `VersionChanged` event has been seen for this
|
|
566
|
-
* (chainId, address, node) — the resolver may not implement `IVersionableResolver`, or simply
|
|
567
|
-
* may never have been version-bumped. Consumers should treat null as "unknown" rather than 0.
|
|
568
|
-
*/
|
|
569
|
-
version: t.bigint().$type()
|
|
570
|
-
}),
|
|
571
|
-
(t) => ({
|
|
572
|
-
byId: uniqueIndex2().on(t.chainId, t.address, t.node)
|
|
573
|
-
})
|
|
574
|
-
);
|
|
575
|
-
var resolverRecords_relations = relations2(resolverRecords, ({ one, many }) => ({
|
|
576
|
-
// belongs to resolver
|
|
577
|
-
resolver: one(resolver, {
|
|
578
|
-
fields: [resolverRecords.chainId, resolverRecords.address],
|
|
579
|
-
references: [resolver.chainId, resolver.address]
|
|
580
|
-
}),
|
|
581
|
-
// resolverRecord has many address records
|
|
582
|
-
addressRecords: many(resolverAddressRecord),
|
|
583
|
-
// resolverRecord has many text records
|
|
584
|
-
textRecords: many(resolverTextRecord)
|
|
585
|
-
}));
|
|
586
|
-
var resolverAddressRecord = onchainTable3(
|
|
587
|
-
"resolver_address_records",
|
|
588
|
-
(t) => ({
|
|
589
|
-
// keyed by ((chainId, resolver, node), coinType)
|
|
590
|
-
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
591
|
-
address: t.hex().notNull().$type(),
|
|
592
|
-
node: t.hex().notNull().$type(),
|
|
593
|
-
// NOTE: all well-known CoinTypes fit into javascript number but NOT postgres .integer, must be
|
|
594
|
-
// stored as BigInt
|
|
595
|
-
coinType: t.bigint().notNull(),
|
|
596
|
-
/**
|
|
597
|
-
* Represents the value of the Addresss Record specified by ((chainId, resolver, node), coinType).
|
|
598
|
-
*
|
|
599
|
-
* The value of this field is interpreted by `interpretAddressRecordValue` — see its implementation
|
|
600
|
-
* for additional context and specific guarantees.
|
|
601
|
-
*/
|
|
602
|
-
value: t.text().notNull()
|
|
603
|
-
}),
|
|
604
|
-
(t) => ({
|
|
605
|
-
pk: primaryKey3({ columns: [t.chainId, t.address, t.node, t.coinType] })
|
|
606
|
-
})
|
|
607
|
-
);
|
|
608
|
-
var resolverAddressRecordRelations = relations2(resolverAddressRecord, ({ one }) => ({
|
|
609
|
-
// belongs to resolverRecord
|
|
610
|
-
resolver: one(resolverRecords, {
|
|
611
|
-
fields: [
|
|
612
|
-
resolverAddressRecord.chainId,
|
|
613
|
-
resolverAddressRecord.address,
|
|
614
|
-
resolverAddressRecord.node
|
|
615
|
-
],
|
|
616
|
-
references: [resolverRecords.chainId, resolverRecords.address, resolverRecords.node]
|
|
617
|
-
})
|
|
618
|
-
}));
|
|
619
|
-
var resolverTextRecord = onchainTable3(
|
|
620
|
-
"resolver_text_records",
|
|
621
|
-
(t) => ({
|
|
622
|
-
// keyed by ((chainId, resolver, node), key)
|
|
623
|
-
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
624
|
-
address: t.hex().notNull().$type(),
|
|
625
|
-
node: t.hex().notNull().$type(),
|
|
626
|
-
key: t.text().notNull(),
|
|
627
|
-
/**
|
|
628
|
-
* Represents the value of the Text Record specified by ((chainId, resolver, node), key).
|
|
629
|
-
*
|
|
630
|
-
* The value of this field is interpreted by `interpretTextRecordValue` — see its implementation
|
|
631
|
-
* for additional context and specific guarantees.
|
|
632
|
-
*/
|
|
633
|
-
value: t.text().notNull()
|
|
634
|
-
}),
|
|
635
|
-
(t) => ({
|
|
636
|
-
pk: primaryKey3({ columns: [t.chainId, t.address, t.node, t.key] })
|
|
637
|
-
})
|
|
638
|
-
);
|
|
639
|
-
var resolverTextRecordRelations = relations2(resolverTextRecord, ({ one }) => ({
|
|
640
|
-
// belongs to resolverRecord
|
|
641
|
-
resolver: one(resolverRecords, {
|
|
642
|
-
fields: [resolverTextRecord.chainId, resolverTextRecord.address, resolverTextRecord.node],
|
|
643
|
-
references: [resolverRecords.chainId, resolverRecords.address, resolverRecords.node]
|
|
644
|
-
})
|
|
645
|
-
}));
|
|
646
|
-
|
|
647
|
-
// src/ensindexer-abstract/registrars.schema.ts
|
|
648
|
-
import { index as index2, onchainEnum as onchainEnum2, onchainTable as onchainTable4, relations as relations3, uniqueIndex as uniqueIndex3 } from "ponder";
|
|
649
|
-
var subregistries = onchainTable4(
|
|
650
|
-
"subregistries",
|
|
651
|
-
(t) => ({
|
|
652
|
-
/**
|
|
653
|
-
* Subregistry ID
|
|
654
|
-
*
|
|
655
|
-
* Identifies the chainId and address of the smart contract associated
|
|
656
|
-
* with the subregistry.
|
|
657
|
-
*
|
|
658
|
-
* Guaranteed to be a fully lowercase string formatted according to
|
|
659
|
-
* the CAIP-10 standard.
|
|
660
|
-
*
|
|
661
|
-
* @see https://chainagnostic.org/CAIPs/caip-10
|
|
662
|
-
*/
|
|
663
|
-
subregistryId: t.text().primaryKey(),
|
|
664
|
-
/**
|
|
665
|
-
* The node (namehash) of the name the subregistry manages subnames of.
|
|
666
|
-
* Example subregistry managed names:
|
|
667
|
-
* - `eth`
|
|
668
|
-
* - `base.eth`
|
|
669
|
-
* - `linea.eth`
|
|
670
|
-
*
|
|
671
|
-
* Guaranteed to be a fully lowercase hex string representation of 32-bytes.
|
|
672
|
-
*/
|
|
673
|
-
node: t.hex().notNull()
|
|
674
|
-
}),
|
|
675
|
-
(t) => ({
|
|
676
|
-
uniqueNode: uniqueIndex3().on(t.node)
|
|
677
|
-
})
|
|
678
|
-
);
|
|
679
|
-
var registrationLifecycles = onchainTable4(
|
|
680
|
-
"registration_lifecycles",
|
|
681
|
-
(t) => ({
|
|
682
|
-
/**
|
|
683
|
-
* The node (namehash) of the FQDN of the domain the registration lifecycle
|
|
684
|
-
* is associated with.
|
|
685
|
-
*
|
|
686
|
-
* Guaranteed to be a subname of the node (namehash) of the subregistry
|
|
687
|
-
* identified by `subregistryId`.
|
|
688
|
-
*
|
|
689
|
-
* Guaranteed to be a fully lowercase hex string representation of 32-bytes.
|
|
690
|
-
*/
|
|
691
|
-
node: t.hex().primaryKey(),
|
|
692
|
-
/**
|
|
693
|
-
* Subregistry ID
|
|
694
|
-
*
|
|
695
|
-
* Identifies the chainId and address of the subregistry smart contract
|
|
696
|
-
* that manages the registration lifecycle.
|
|
697
|
-
*
|
|
698
|
-
* Guaranteed to be a fully lowercase string formatted according to
|
|
699
|
-
* the CAIP-10 standard.
|
|
700
|
-
*
|
|
701
|
-
* @see https://chainagnostic.org/CAIPs/caip-10
|
|
702
|
-
*/
|
|
703
|
-
subregistryId: t.text().notNull(),
|
|
704
|
-
/**
|
|
705
|
-
* Expires at
|
|
706
|
-
*
|
|
707
|
-
* Unix timestamp when the Registration Lifecycle is scheduled to expire.
|
|
708
|
-
*/
|
|
709
|
-
expiresAt: t.bigint().notNull()
|
|
710
|
-
}),
|
|
711
|
-
(t) => ({
|
|
712
|
-
bySubregistry: index2().on(t.subregistryId)
|
|
713
|
-
})
|
|
714
|
-
);
|
|
715
|
-
var registrarActionType = onchainEnum2("registrar_action_type", [
|
|
254
|
+
var registrarActionType = onchainEnum("registrar_action_type", [
|
|
716
255
|
"registration",
|
|
717
256
|
"renewal"
|
|
718
257
|
]);
|
|
719
|
-
var registrarActions =
|
|
258
|
+
var registrarActions = onchainTable3(
|
|
720
259
|
"registrar_actions",
|
|
721
260
|
(t) => ({
|
|
722
261
|
/**
|
|
@@ -969,11 +508,11 @@ var registrarActions = onchainTable4(
|
|
|
969
508
|
byTimestamp: index2().on(t.timestamp)
|
|
970
509
|
})
|
|
971
510
|
);
|
|
972
|
-
var internal_registrarActionMetadataType =
|
|
511
|
+
var internal_registrarActionMetadataType = onchainEnum(
|
|
973
512
|
"_ensindexer_registrar_action_metadata_type",
|
|
974
513
|
["CURRENT_LOGICAL_REGISTRAR_ACTION"]
|
|
975
514
|
);
|
|
976
|
-
var internal_registrarActionMetadata =
|
|
515
|
+
var internal_registrarActionMetadata = onchainTable3(
|
|
977
516
|
"_ensindexer_registrar_action_metadata",
|
|
978
517
|
(t) => ({
|
|
979
518
|
/**
|
|
@@ -1001,10 +540,10 @@ var internal_registrarActionMetadata = onchainTable4(
|
|
|
1001
540
|
logicalEventId: t.text().notNull()
|
|
1002
541
|
})
|
|
1003
542
|
);
|
|
1004
|
-
var subregistryRelations =
|
|
543
|
+
var subregistryRelations = relations2(subregistries, ({ many }) => ({
|
|
1005
544
|
registrationLifecycle: many(registrationLifecycles)
|
|
1006
545
|
}));
|
|
1007
|
-
var registrationLifecycleRelations =
|
|
546
|
+
var registrationLifecycleRelations = relations2(
|
|
1008
547
|
registrationLifecycles,
|
|
1009
548
|
({ one, many }) => ({
|
|
1010
549
|
subregistry: one(subregistries, {
|
|
@@ -1014,7 +553,7 @@ var registrationLifecycleRelations = relations3(
|
|
|
1014
553
|
registrarAction: many(registrarActions)
|
|
1015
554
|
})
|
|
1016
555
|
);
|
|
1017
|
-
var registrarActionRelations =
|
|
556
|
+
var registrarActionRelations = relations2(registrarActions, ({ one }) => ({
|
|
1018
557
|
registrationLifecycle: one(registrationLifecycles, {
|
|
1019
558
|
fields: [registrarActions.node],
|
|
1020
559
|
references: [registrationLifecycles.node]
|
|
@@ -1022,7 +561,7 @@ var registrarActionRelations = relations3(registrarActions, ({ one }) => ({
|
|
|
1022
561
|
}));
|
|
1023
562
|
|
|
1024
563
|
// src/ensindexer-abstract/subgraph.schema.ts
|
|
1025
|
-
import { index as index3, onchainTable as
|
|
564
|
+
import { index as index3, onchainTable as onchainTable4, relations as relations3, sql } from "ponder";
|
|
1026
565
|
|
|
1027
566
|
// src/lib/collate.ts
|
|
1028
567
|
function monkeypatchCollate(col, collation) {
|
|
@@ -1033,7 +572,7 @@ function monkeypatchCollate(col, collation) {
|
|
|
1033
572
|
}
|
|
1034
573
|
|
|
1035
574
|
// src/ensindexer-abstract/subgraph.schema.ts
|
|
1036
|
-
var subgraph_domain =
|
|
575
|
+
var subgraph_domain = onchainTable4(
|
|
1037
576
|
"subgraph_domains",
|
|
1038
577
|
(t) => ({
|
|
1039
578
|
// The namehash of the name
|
|
@@ -1107,7 +646,7 @@ var subgraph_domain = onchainTable5(
|
|
|
1107
646
|
// GIN trigram index for partial-match filters (_contains, _starts_with, _ends_with).
|
|
1108
647
|
// (inline `gin_trgm_ops` via `sql` because passing it through `.op()` gets dropped by Ponder,
|
|
1109
648
|
// producing `USING gin (name)` with no opclass)
|
|
1110
|
-
byFuzzyName: index3().using("gin",
|
|
649
|
+
byFuzzyName: index3().using("gin", sql`${t.name} gin_trgm_ops`),
|
|
1111
650
|
byLabelhash: index3().on(t.labelhash),
|
|
1112
651
|
byParentId: index3().on(t.parentId),
|
|
1113
652
|
byOwnerId: index3().on(t.ownerId),
|
|
@@ -1118,7 +657,7 @@ var subgraph_domain = onchainTable5(
|
|
|
1118
657
|
);
|
|
1119
658
|
monkeypatchCollate(subgraph_domain.name, '"C"');
|
|
1120
659
|
monkeypatchCollate(subgraph_domain.labelName, '"C"');
|
|
1121
|
-
var subgraph_domainRelations =
|
|
660
|
+
var subgraph_domainRelations = relations3(subgraph_domain, ({ one, many }) => ({
|
|
1122
661
|
resolvedAddress: one(subgraph_account, {
|
|
1123
662
|
fields: [subgraph_domain.resolvedAddressId],
|
|
1124
663
|
references: [subgraph_account.id]
|
|
@@ -1163,15 +702,15 @@ var subgraph_domainRelations = relations4(subgraph_domain, ({ one, many }) => ({
|
|
|
1163
702
|
fusesSets: many(subgraph_fusesSet),
|
|
1164
703
|
expiryExtendeds: many(subgraph_expiryExtended)
|
|
1165
704
|
}));
|
|
1166
|
-
var subgraph_account =
|
|
705
|
+
var subgraph_account = onchainTable4("subgraph_accounts", (t) => ({
|
|
1167
706
|
id: t.hex().primaryKey()
|
|
1168
707
|
}));
|
|
1169
|
-
var subgraph_accountRelations =
|
|
708
|
+
var subgraph_accountRelations = relations3(subgraph_account, ({ many }) => ({
|
|
1170
709
|
domains: many(subgraph_domain),
|
|
1171
710
|
wrappedDomains: many(subgraph_wrappedDomain),
|
|
1172
711
|
registrations: many(subgraph_registration)
|
|
1173
712
|
}));
|
|
1174
|
-
var subgraph_resolver =
|
|
713
|
+
var subgraph_resolver = onchainTable4(
|
|
1175
714
|
"subgraph_resolvers",
|
|
1176
715
|
(t) => ({
|
|
1177
716
|
// The unique identifier for this resolver, which is a concatenation of the domain namehash and the resolver address
|
|
@@ -1195,7 +734,7 @@ var subgraph_resolver = onchainTable5(
|
|
|
1195
734
|
byDomainId: index3().on(t.domainId)
|
|
1196
735
|
})
|
|
1197
736
|
);
|
|
1198
|
-
var subgraph_resolverRelations =
|
|
737
|
+
var subgraph_resolverRelations = relations3(subgraph_resolver, ({ one, many }) => ({
|
|
1199
738
|
addr: one(subgraph_account, {
|
|
1200
739
|
fields: [subgraph_resolver.addrId],
|
|
1201
740
|
references: [subgraph_account.id]
|
|
@@ -1216,7 +755,7 @@ var subgraph_resolverRelations = relations4(subgraph_resolver, ({ one, many }) =
|
|
|
1216
755
|
authorisationChangeds: many(subgraph_authorisationChanged),
|
|
1217
756
|
versionChangeds: many(subgraph_versionChanged)
|
|
1218
757
|
}));
|
|
1219
|
-
var subgraph_registration =
|
|
758
|
+
var subgraph_registration = onchainTable4(
|
|
1220
759
|
"subgraph_registrations",
|
|
1221
760
|
(t) => ({
|
|
1222
761
|
// The unique identifier of the registration
|
|
@@ -1258,7 +797,7 @@ var subgraph_registration = onchainTable5(
|
|
|
1258
797
|
byExpiryDate: index3().on(t.expiryDate)
|
|
1259
798
|
})
|
|
1260
799
|
);
|
|
1261
|
-
var subgraph_registrationRelations =
|
|
800
|
+
var subgraph_registrationRelations = relations3(subgraph_registration, ({ one, many }) => ({
|
|
1262
801
|
domain: one(subgraph_domain, {
|
|
1263
802
|
fields: [subgraph_registration.domainId],
|
|
1264
803
|
references: [subgraph_domain.id]
|
|
@@ -1272,7 +811,7 @@ var subgraph_registrationRelations = relations4(subgraph_registration, ({ one, m
|
|
|
1272
811
|
nameReneweds: many(subgraph_nameRenewed),
|
|
1273
812
|
nameTransferreds: many(subgraph_nameTransferred)
|
|
1274
813
|
}));
|
|
1275
|
-
var subgraph_wrappedDomain =
|
|
814
|
+
var subgraph_wrappedDomain = onchainTable4(
|
|
1276
815
|
"subgraph_wrapped_domains",
|
|
1277
816
|
(t) => ({
|
|
1278
817
|
// The unique identifier for each instance of the WrappedDomain entity
|
|
@@ -1307,7 +846,7 @@ var subgraph_wrappedDomain = onchainTable5(
|
|
|
1307
846
|
byDomainId: index3().on(t.domainId)
|
|
1308
847
|
})
|
|
1309
848
|
);
|
|
1310
|
-
var subgraph_wrappedDomainRelations =
|
|
849
|
+
var subgraph_wrappedDomainRelations = relations3(subgraph_wrappedDomain, ({ one }) => ({
|
|
1311
850
|
domain: one(subgraph_domain, {
|
|
1312
851
|
fields: [subgraph_wrappedDomain.domainId],
|
|
1313
852
|
references: [subgraph_domain.id]
|
|
@@ -1322,7 +861,7 @@ var sharedEventColumns = (t) => ({
|
|
|
1322
861
|
blockNumber: t.integer().notNull(),
|
|
1323
862
|
transactionID: t.hex().notNull()
|
|
1324
863
|
});
|
|
1325
|
-
var
|
|
864
|
+
var domainEvent = (t) => ({
|
|
1326
865
|
...sharedEventColumns(t),
|
|
1327
866
|
domainId: t.hex().notNull()
|
|
1328
867
|
});
|
|
@@ -1332,51 +871,51 @@ var domainEventIndex = (t) => ({
|
|
|
1332
871
|
// sorting index
|
|
1333
872
|
idx_compound: index3().on(t.domainId, t.id)
|
|
1334
873
|
});
|
|
1335
|
-
var subgraph_transfer =
|
|
874
|
+
var subgraph_transfer = onchainTable4(
|
|
1336
875
|
"subgraph_transfers",
|
|
1337
876
|
(t) => ({
|
|
1338
|
-
...
|
|
877
|
+
...domainEvent(t),
|
|
1339
878
|
ownerId: t.hex().notNull()
|
|
1340
879
|
}),
|
|
1341
880
|
domainEventIndex
|
|
1342
881
|
);
|
|
1343
|
-
var subgraph_newOwner =
|
|
882
|
+
var subgraph_newOwner = onchainTable4(
|
|
1344
883
|
"subgraph_new_owners",
|
|
1345
884
|
(t) => ({
|
|
1346
|
-
...
|
|
885
|
+
...domainEvent(t),
|
|
1347
886
|
ownerId: t.hex().notNull(),
|
|
1348
887
|
parentDomainId: t.hex().notNull()
|
|
1349
888
|
}),
|
|
1350
889
|
domainEventIndex
|
|
1351
890
|
);
|
|
1352
|
-
var subgraph_newResolver =
|
|
891
|
+
var subgraph_newResolver = onchainTable4(
|
|
1353
892
|
"subgraph_new_resolvers",
|
|
1354
893
|
(t) => ({
|
|
1355
|
-
...
|
|
894
|
+
...domainEvent(t),
|
|
1356
895
|
resolverId: t.text().notNull()
|
|
1357
896
|
}),
|
|
1358
897
|
domainEventIndex
|
|
1359
898
|
);
|
|
1360
|
-
var subgraph_newTTL =
|
|
899
|
+
var subgraph_newTTL = onchainTable4(
|
|
1361
900
|
"subgraph_new_ttls",
|
|
1362
901
|
(t) => ({
|
|
1363
|
-
...
|
|
902
|
+
...domainEvent(t),
|
|
1364
903
|
ttl: t.bigint().notNull()
|
|
1365
904
|
}),
|
|
1366
905
|
domainEventIndex
|
|
1367
906
|
);
|
|
1368
|
-
var subgraph_wrappedTransfer =
|
|
907
|
+
var subgraph_wrappedTransfer = onchainTable4(
|
|
1369
908
|
"subgraph_wrapped_transfers",
|
|
1370
909
|
(t) => ({
|
|
1371
|
-
...
|
|
910
|
+
...domainEvent(t),
|
|
1372
911
|
ownerId: t.hex().notNull()
|
|
1373
912
|
}),
|
|
1374
913
|
domainEventIndex
|
|
1375
914
|
);
|
|
1376
|
-
var subgraph_nameWrapped =
|
|
915
|
+
var subgraph_nameWrapped = onchainTable4(
|
|
1377
916
|
"subgraph_name_wrapped",
|
|
1378
917
|
(t) => ({
|
|
1379
|
-
...
|
|
918
|
+
...domainEvent(t),
|
|
1380
919
|
name: t.text(),
|
|
1381
920
|
fuses: t.integer().notNull(),
|
|
1382
921
|
ownerId: t.hex().notNull(),
|
|
@@ -1384,26 +923,26 @@ var subgraph_nameWrapped = onchainTable5(
|
|
|
1384
923
|
}),
|
|
1385
924
|
domainEventIndex
|
|
1386
925
|
);
|
|
1387
|
-
var subgraph_nameUnwrapped =
|
|
926
|
+
var subgraph_nameUnwrapped = onchainTable4(
|
|
1388
927
|
"subgraph_name_unwrapped",
|
|
1389
928
|
(t) => ({
|
|
1390
|
-
...
|
|
929
|
+
...domainEvent(t),
|
|
1391
930
|
ownerId: t.hex().notNull()
|
|
1392
931
|
}),
|
|
1393
932
|
domainEventIndex
|
|
1394
933
|
);
|
|
1395
|
-
var subgraph_fusesSet =
|
|
934
|
+
var subgraph_fusesSet = onchainTable4(
|
|
1396
935
|
"subgraph_fuses_set",
|
|
1397
936
|
(t) => ({
|
|
1398
|
-
...
|
|
937
|
+
...domainEvent(t),
|
|
1399
938
|
fuses: t.integer().notNull()
|
|
1400
939
|
}),
|
|
1401
940
|
domainEventIndex
|
|
1402
941
|
);
|
|
1403
|
-
var subgraph_expiryExtended =
|
|
942
|
+
var subgraph_expiryExtended = onchainTable4(
|
|
1404
943
|
"subgraph_expiry_extended",
|
|
1405
944
|
(t) => ({
|
|
1406
|
-
...
|
|
945
|
+
...domainEvent(t),
|
|
1407
946
|
expiryDate: t.bigint().notNull()
|
|
1408
947
|
}),
|
|
1409
948
|
domainEventIndex
|
|
@@ -1418,7 +957,7 @@ var registrationEventIndex = (t) => ({
|
|
|
1418
957
|
// sorting index
|
|
1419
958
|
idx_compound: index3().on(t.registrationId, t.id)
|
|
1420
959
|
});
|
|
1421
|
-
var subgraph_nameRegistered =
|
|
960
|
+
var subgraph_nameRegistered = onchainTable4(
|
|
1422
961
|
"subgraph_name_registered",
|
|
1423
962
|
(t) => ({
|
|
1424
963
|
...registrationEvent(t),
|
|
@@ -1427,7 +966,7 @@ var subgraph_nameRegistered = onchainTable5(
|
|
|
1427
966
|
}),
|
|
1428
967
|
registrationEventIndex
|
|
1429
968
|
);
|
|
1430
|
-
var subgraph_nameRenewed =
|
|
969
|
+
var subgraph_nameRenewed = onchainTable4(
|
|
1431
970
|
"subgraph_name_renewed",
|
|
1432
971
|
(t) => ({
|
|
1433
972
|
...registrationEvent(t),
|
|
@@ -1435,7 +974,7 @@ var subgraph_nameRenewed = onchainTable5(
|
|
|
1435
974
|
}),
|
|
1436
975
|
registrationEventIndex
|
|
1437
976
|
);
|
|
1438
|
-
var subgraph_nameTransferred =
|
|
977
|
+
var subgraph_nameTransferred = onchainTable4(
|
|
1439
978
|
"subgraph_name_transferred",
|
|
1440
979
|
(t) => ({
|
|
1441
980
|
...registrationEvent(t),
|
|
@@ -1443,7 +982,7 @@ var subgraph_nameTransferred = onchainTable5(
|
|
|
1443
982
|
}),
|
|
1444
983
|
registrationEventIndex
|
|
1445
984
|
);
|
|
1446
|
-
var
|
|
985
|
+
var resolverEvent = (t) => ({
|
|
1447
986
|
...sharedEventColumns(t),
|
|
1448
987
|
resolverId: t.text().notNull()
|
|
1449
988
|
});
|
|
@@ -1453,93 +992,93 @@ var resolverEventIndex = (t) => ({
|
|
|
1453
992
|
// sorting index
|
|
1454
993
|
idx_compound: index3().on(t.resolverId, t.id)
|
|
1455
994
|
});
|
|
1456
|
-
var subgraph_addrChanged =
|
|
995
|
+
var subgraph_addrChanged = onchainTable4(
|
|
1457
996
|
"subgraph_addr_changed",
|
|
1458
997
|
(t) => ({
|
|
1459
|
-
...
|
|
998
|
+
...resolverEvent(t),
|
|
1460
999
|
addrId: t.hex().notNull()
|
|
1461
1000
|
}),
|
|
1462
1001
|
resolverEventIndex
|
|
1463
1002
|
);
|
|
1464
|
-
var subgraph_multicoinAddrChanged =
|
|
1003
|
+
var subgraph_multicoinAddrChanged = onchainTable4(
|
|
1465
1004
|
"subgraph_multicoin_addr_changed",
|
|
1466
1005
|
(t) => ({
|
|
1467
|
-
...
|
|
1006
|
+
...resolverEvent(t),
|
|
1468
1007
|
coinType: t.bigint().notNull(),
|
|
1469
1008
|
addr: t.hex().notNull()
|
|
1470
1009
|
}),
|
|
1471
1010
|
resolverEventIndex
|
|
1472
1011
|
);
|
|
1473
|
-
var subgraph_nameChanged =
|
|
1012
|
+
var subgraph_nameChanged = onchainTable4(
|
|
1474
1013
|
"subgraph_name_changed",
|
|
1475
1014
|
(t) => ({
|
|
1476
|
-
...
|
|
1015
|
+
...resolverEvent(t),
|
|
1477
1016
|
name: t.text().notNull()
|
|
1478
1017
|
}),
|
|
1479
1018
|
resolverEventIndex
|
|
1480
1019
|
);
|
|
1481
|
-
var subgraph_abiChanged =
|
|
1020
|
+
var subgraph_abiChanged = onchainTable4(
|
|
1482
1021
|
"subgraph_abi_changed",
|
|
1483
1022
|
(t) => ({
|
|
1484
|
-
...
|
|
1023
|
+
...resolverEvent(t),
|
|
1485
1024
|
contentType: t.bigint().notNull()
|
|
1486
1025
|
}),
|
|
1487
1026
|
resolverEventIndex
|
|
1488
1027
|
);
|
|
1489
|
-
var subgraph_pubkeyChanged =
|
|
1028
|
+
var subgraph_pubkeyChanged = onchainTable4(
|
|
1490
1029
|
"subgraph_pubkey_changed",
|
|
1491
1030
|
(t) => ({
|
|
1492
|
-
...
|
|
1031
|
+
...resolverEvent(t),
|
|
1493
1032
|
x: t.hex().notNull(),
|
|
1494
1033
|
y: t.hex().notNull()
|
|
1495
1034
|
}),
|
|
1496
1035
|
resolverEventIndex
|
|
1497
1036
|
);
|
|
1498
|
-
var subgraph_textChanged =
|
|
1037
|
+
var subgraph_textChanged = onchainTable4(
|
|
1499
1038
|
"subgraph_text_changed",
|
|
1500
1039
|
(t) => ({
|
|
1501
|
-
...
|
|
1040
|
+
...resolverEvent(t),
|
|
1502
1041
|
key: t.text().notNull(),
|
|
1503
1042
|
value: t.text()
|
|
1504
1043
|
}),
|
|
1505
1044
|
resolverEventIndex
|
|
1506
1045
|
);
|
|
1507
|
-
var subgraph_contenthashChanged =
|
|
1046
|
+
var subgraph_contenthashChanged = onchainTable4(
|
|
1508
1047
|
"subgraph_contenthash_changed",
|
|
1509
1048
|
(t) => ({
|
|
1510
|
-
...
|
|
1049
|
+
...resolverEvent(t),
|
|
1511
1050
|
hash: t.hex().notNull()
|
|
1512
1051
|
}),
|
|
1513
1052
|
resolverEventIndex
|
|
1514
1053
|
);
|
|
1515
|
-
var subgraph_interfaceChanged =
|
|
1054
|
+
var subgraph_interfaceChanged = onchainTable4(
|
|
1516
1055
|
"subgraph_interface_changed",
|
|
1517
1056
|
(t) => ({
|
|
1518
|
-
...
|
|
1057
|
+
...resolverEvent(t),
|
|
1519
1058
|
interfaceID: t.hex().notNull(),
|
|
1520
1059
|
implementer: t.hex().notNull()
|
|
1521
1060
|
}),
|
|
1522
1061
|
resolverEventIndex
|
|
1523
1062
|
);
|
|
1524
|
-
var subgraph_authorisationChanged =
|
|
1063
|
+
var subgraph_authorisationChanged = onchainTable4(
|
|
1525
1064
|
"subgraph_authorisation_changed",
|
|
1526
1065
|
(t) => ({
|
|
1527
|
-
...
|
|
1066
|
+
...resolverEvent(t),
|
|
1528
1067
|
owner: t.hex().notNull(),
|
|
1529
1068
|
target: t.hex().notNull(),
|
|
1530
1069
|
isAuthorized: t.boolean().notNull()
|
|
1531
1070
|
}),
|
|
1532
1071
|
resolverEventIndex
|
|
1533
1072
|
);
|
|
1534
|
-
var subgraph_versionChanged =
|
|
1073
|
+
var subgraph_versionChanged = onchainTable4(
|
|
1535
1074
|
"subgraph_version_changed",
|
|
1536
1075
|
(t) => ({
|
|
1537
|
-
...
|
|
1076
|
+
...resolverEvent(t),
|
|
1538
1077
|
version: t.bigint().notNull()
|
|
1539
1078
|
}),
|
|
1540
1079
|
resolverEventIndex
|
|
1541
1080
|
);
|
|
1542
|
-
var subgraph_transferRelations =
|
|
1081
|
+
var subgraph_transferRelations = relations3(subgraph_transfer, ({ one }) => ({
|
|
1543
1082
|
domain: one(subgraph_domain, {
|
|
1544
1083
|
fields: [subgraph_transfer.domainId],
|
|
1545
1084
|
references: [subgraph_domain.id]
|
|
@@ -1549,7 +1088,7 @@ var subgraph_transferRelations = relations4(subgraph_transfer, ({ one }) => ({
|
|
|
1549
1088
|
references: [subgraph_account.id]
|
|
1550
1089
|
})
|
|
1551
1090
|
}));
|
|
1552
|
-
var subgraph_newOwnerRelations =
|
|
1091
|
+
var subgraph_newOwnerRelations = relations3(subgraph_newOwner, ({ one }) => ({
|
|
1553
1092
|
domain: one(subgraph_domain, {
|
|
1554
1093
|
fields: [subgraph_newOwner.domainId],
|
|
1555
1094
|
references: [subgraph_domain.id]
|
|
@@ -1563,7 +1102,7 @@ var subgraph_newOwnerRelations = relations4(subgraph_newOwner, ({ one }) => ({
|
|
|
1563
1102
|
references: [subgraph_domain.id]
|
|
1564
1103
|
})
|
|
1565
1104
|
}));
|
|
1566
|
-
var subgraph_newResolverRelations =
|
|
1105
|
+
var subgraph_newResolverRelations = relations3(subgraph_newResolver, ({ one }) => ({
|
|
1567
1106
|
domain: one(subgraph_domain, {
|
|
1568
1107
|
fields: [subgraph_newResolver.domainId],
|
|
1569
1108
|
references: [subgraph_domain.id]
|
|
@@ -1573,13 +1112,13 @@ var subgraph_newResolverRelations = relations4(subgraph_newResolver, ({ one }) =
|
|
|
1573
1112
|
references: [subgraph_resolver.id]
|
|
1574
1113
|
})
|
|
1575
1114
|
}));
|
|
1576
|
-
var subgraph_newTTLRelations =
|
|
1115
|
+
var subgraph_newTTLRelations = relations3(subgraph_newTTL, ({ one }) => ({
|
|
1577
1116
|
domain: one(subgraph_domain, {
|
|
1578
1117
|
fields: [subgraph_newTTL.domainId],
|
|
1579
1118
|
references: [subgraph_domain.id]
|
|
1580
1119
|
})
|
|
1581
1120
|
}));
|
|
1582
|
-
var subgraph_wrappedTransferRelations =
|
|
1121
|
+
var subgraph_wrappedTransferRelations = relations3(subgraph_wrappedTransfer, ({ one }) => ({
|
|
1583
1122
|
domain: one(subgraph_domain, {
|
|
1584
1123
|
fields: [subgraph_wrappedTransfer.domainId],
|
|
1585
1124
|
references: [subgraph_domain.id]
|
|
@@ -1589,7 +1128,7 @@ var subgraph_wrappedTransferRelations = relations4(subgraph_wrappedTransfer, ({
|
|
|
1589
1128
|
references: [subgraph_account.id]
|
|
1590
1129
|
})
|
|
1591
1130
|
}));
|
|
1592
|
-
var subgraph_nameWrappedRelations =
|
|
1131
|
+
var subgraph_nameWrappedRelations = relations3(subgraph_nameWrapped, ({ one }) => ({
|
|
1593
1132
|
domain: one(subgraph_domain, {
|
|
1594
1133
|
fields: [subgraph_nameWrapped.domainId],
|
|
1595
1134
|
references: [subgraph_domain.id]
|
|
@@ -1599,7 +1138,7 @@ var subgraph_nameWrappedRelations = relations4(subgraph_nameWrapped, ({ one }) =
|
|
|
1599
1138
|
references: [subgraph_account.id]
|
|
1600
1139
|
})
|
|
1601
1140
|
}));
|
|
1602
|
-
var subgraph_nameUnwrappedRelations =
|
|
1141
|
+
var subgraph_nameUnwrappedRelations = relations3(subgraph_nameUnwrapped, ({ one }) => ({
|
|
1603
1142
|
domain: one(subgraph_domain, {
|
|
1604
1143
|
fields: [subgraph_nameUnwrapped.domainId],
|
|
1605
1144
|
references: [subgraph_domain.id]
|
|
@@ -1609,19 +1148,19 @@ var subgraph_nameUnwrappedRelations = relations4(subgraph_nameUnwrapped, ({ one
|
|
|
1609
1148
|
references: [subgraph_account.id]
|
|
1610
1149
|
})
|
|
1611
1150
|
}));
|
|
1612
|
-
var subgraph_fusesSetRelations =
|
|
1151
|
+
var subgraph_fusesSetRelations = relations3(subgraph_fusesSet, ({ one }) => ({
|
|
1613
1152
|
domain: one(subgraph_domain, {
|
|
1614
1153
|
fields: [subgraph_fusesSet.domainId],
|
|
1615
1154
|
references: [subgraph_domain.id]
|
|
1616
1155
|
})
|
|
1617
1156
|
}));
|
|
1618
|
-
var subgraph_expiryExtendedRelations =
|
|
1157
|
+
var subgraph_expiryExtendedRelations = relations3(subgraph_expiryExtended, ({ one }) => ({
|
|
1619
1158
|
domain: one(subgraph_domain, {
|
|
1620
1159
|
fields: [subgraph_expiryExtended.domainId],
|
|
1621
1160
|
references: [subgraph_domain.id]
|
|
1622
1161
|
})
|
|
1623
1162
|
}));
|
|
1624
|
-
var subgraph_nameRegisteredRelations =
|
|
1163
|
+
var subgraph_nameRegisteredRelations = relations3(subgraph_nameRegistered, ({ one }) => ({
|
|
1625
1164
|
registration: one(subgraph_registration, {
|
|
1626
1165
|
fields: [subgraph_nameRegistered.registrationId],
|
|
1627
1166
|
references: [subgraph_registration.id]
|
|
@@ -1631,13 +1170,13 @@ var subgraph_nameRegisteredRelations = relations4(subgraph_nameRegistered, ({ on
|
|
|
1631
1170
|
references: [subgraph_account.id]
|
|
1632
1171
|
})
|
|
1633
1172
|
}));
|
|
1634
|
-
var subgraph_nameRenewedRelations =
|
|
1173
|
+
var subgraph_nameRenewedRelations = relations3(subgraph_nameRenewed, ({ one }) => ({
|
|
1635
1174
|
registration: one(subgraph_registration, {
|
|
1636
1175
|
fields: [subgraph_nameRenewed.registrationId],
|
|
1637
1176
|
references: [subgraph_registration.id]
|
|
1638
1177
|
})
|
|
1639
1178
|
}));
|
|
1640
|
-
var subgraph_nameTransferredRelations =
|
|
1179
|
+
var subgraph_nameTransferredRelations = relations3(subgraph_nameTransferred, ({ one }) => ({
|
|
1641
1180
|
registration: one(subgraph_registration, {
|
|
1642
1181
|
fields: [subgraph_nameTransferred.registrationId],
|
|
1643
1182
|
references: [subgraph_registration.id]
|
|
@@ -1647,7 +1186,7 @@ var subgraph_nameTransferredRelations = relations4(subgraph_nameTransferred, ({
|
|
|
1647
1186
|
references: [subgraph_account.id]
|
|
1648
1187
|
})
|
|
1649
1188
|
}));
|
|
1650
|
-
var subgraph_addrChangedRelations =
|
|
1189
|
+
var subgraph_addrChangedRelations = relations3(subgraph_addrChanged, ({ one }) => ({
|
|
1651
1190
|
resolver: one(subgraph_resolver, {
|
|
1652
1191
|
fields: [subgraph_addrChanged.resolverId],
|
|
1653
1192
|
references: [subgraph_resolver.id]
|
|
@@ -1657,7 +1196,7 @@ var subgraph_addrChangedRelations = relations4(subgraph_addrChanged, ({ one }) =
|
|
|
1657
1196
|
references: [subgraph_account.id]
|
|
1658
1197
|
})
|
|
1659
1198
|
}));
|
|
1660
|
-
var subgraph_multicoinAddrChangedRelations =
|
|
1199
|
+
var subgraph_multicoinAddrChangedRelations = relations3(
|
|
1661
1200
|
subgraph_multicoinAddrChanged,
|
|
1662
1201
|
({ one }) => ({
|
|
1663
1202
|
resolver: one(subgraph_resolver, {
|
|
@@ -1666,31 +1205,31 @@ var subgraph_multicoinAddrChangedRelations = relations4(
|
|
|
1666
1205
|
})
|
|
1667
1206
|
})
|
|
1668
1207
|
);
|
|
1669
|
-
var subgraph_nameChangedRelations =
|
|
1208
|
+
var subgraph_nameChangedRelations = relations3(subgraph_nameChanged, ({ one }) => ({
|
|
1670
1209
|
resolver: one(subgraph_resolver, {
|
|
1671
1210
|
fields: [subgraph_nameChanged.resolverId],
|
|
1672
1211
|
references: [subgraph_resolver.id]
|
|
1673
1212
|
})
|
|
1674
1213
|
}));
|
|
1675
|
-
var subgraph_abiChangedRelations =
|
|
1214
|
+
var subgraph_abiChangedRelations = relations3(subgraph_abiChanged, ({ one }) => ({
|
|
1676
1215
|
resolver: one(subgraph_resolver, {
|
|
1677
1216
|
fields: [subgraph_abiChanged.resolverId],
|
|
1678
1217
|
references: [subgraph_resolver.id]
|
|
1679
1218
|
})
|
|
1680
1219
|
}));
|
|
1681
|
-
var subgraph_pubkeyChangedRelations =
|
|
1220
|
+
var subgraph_pubkeyChangedRelations = relations3(subgraph_pubkeyChanged, ({ one }) => ({
|
|
1682
1221
|
resolver: one(subgraph_resolver, {
|
|
1683
1222
|
fields: [subgraph_pubkeyChanged.resolverId],
|
|
1684
1223
|
references: [subgraph_resolver.id]
|
|
1685
1224
|
})
|
|
1686
1225
|
}));
|
|
1687
|
-
var subgraph_textChangedRelations =
|
|
1226
|
+
var subgraph_textChangedRelations = relations3(subgraph_textChanged, ({ one }) => ({
|
|
1688
1227
|
resolver: one(subgraph_resolver, {
|
|
1689
1228
|
fields: [subgraph_textChanged.resolverId],
|
|
1690
1229
|
references: [subgraph_resolver.id]
|
|
1691
1230
|
})
|
|
1692
1231
|
}));
|
|
1693
|
-
var subgraph_contenthashChangedRelations =
|
|
1232
|
+
var subgraph_contenthashChangedRelations = relations3(
|
|
1694
1233
|
subgraph_contenthashChanged,
|
|
1695
1234
|
({ one }) => ({
|
|
1696
1235
|
resolver: one(subgraph_resolver, {
|
|
@@ -1699,7 +1238,7 @@ var subgraph_contenthashChangedRelations = relations4(
|
|
|
1699
1238
|
})
|
|
1700
1239
|
})
|
|
1701
1240
|
);
|
|
1702
|
-
var subgraph_interfaceChangedRelations =
|
|
1241
|
+
var subgraph_interfaceChangedRelations = relations3(
|
|
1703
1242
|
subgraph_interfaceChanged,
|
|
1704
1243
|
({ one }) => ({
|
|
1705
1244
|
resolver: one(subgraph_resolver, {
|
|
@@ -1708,7 +1247,7 @@ var subgraph_interfaceChangedRelations = relations4(
|
|
|
1708
1247
|
})
|
|
1709
1248
|
})
|
|
1710
1249
|
);
|
|
1711
|
-
var subgraph_authorisationChangedRelations =
|
|
1250
|
+
var subgraph_authorisationChangedRelations = relations3(
|
|
1712
1251
|
subgraph_authorisationChanged,
|
|
1713
1252
|
({ one }) => ({
|
|
1714
1253
|
resolver: one(subgraph_resolver, {
|
|
@@ -1717,7 +1256,7 @@ var subgraph_authorisationChangedRelations = relations4(
|
|
|
1717
1256
|
})
|
|
1718
1257
|
})
|
|
1719
1258
|
);
|
|
1720
|
-
var subgraph_versionChangedRelations =
|
|
1259
|
+
var subgraph_versionChangedRelations = relations3(subgraph_versionChanged, ({ one }) => ({
|
|
1721
1260
|
resolver: one(subgraph_resolver, {
|
|
1722
1261
|
fields: [subgraph_versionChanged.resolverId],
|
|
1723
1262
|
references: [subgraph_resolver.id]
|
|
@@ -1725,8 +1264,8 @@ var subgraph_versionChangedRelations = relations4(subgraph_versionChanged, ({ on
|
|
|
1725
1264
|
}));
|
|
1726
1265
|
|
|
1727
1266
|
// src/ensindexer-abstract/tokenscope.schema.ts
|
|
1728
|
-
import { index as index4, onchainTable as
|
|
1729
|
-
var nameSales =
|
|
1267
|
+
import { index as index4, onchainTable as onchainTable5 } from "ponder";
|
|
1268
|
+
var nameSales = onchainTable5(
|
|
1730
1269
|
"name_sales",
|
|
1731
1270
|
(t) => ({
|
|
1732
1271
|
/**
|
|
@@ -1822,7 +1361,7 @@ var nameSales = onchainTable6(
|
|
|
1822
1361
|
idx_timestamp: index4().on(t.timestamp)
|
|
1823
1362
|
})
|
|
1824
1363
|
);
|
|
1825
|
-
var nameTokens =
|
|
1364
|
+
var nameTokens = onchainTable5(
|
|
1826
1365
|
"name_tokens",
|
|
1827
1366
|
(t) => ({
|
|
1828
1367
|
/**
|
|
@@ -1906,11 +1445,488 @@ var nameTokens = onchainTable6(
|
|
|
1906
1445
|
idx_owner: index4().on(t.owner)
|
|
1907
1446
|
})
|
|
1908
1447
|
);
|
|
1448
|
+
|
|
1449
|
+
// src/ensindexer-abstract/unigraph.schema.ts
|
|
1450
|
+
import { index as index5, onchainEnum as onchainEnum2, onchainTable as onchainTable6, primaryKey as primaryKey3, relations as relations4, sql as sql2, uniqueIndex as uniqueIndex3 } from "ponder";
|
|
1451
|
+
var event = onchainTable6(
|
|
1452
|
+
"events",
|
|
1453
|
+
(t) => ({
|
|
1454
|
+
// Ponder's event.id
|
|
1455
|
+
id: t.text().primaryKey(),
|
|
1456
|
+
// The HCA account address if used, otherwise Transaction.from.
|
|
1457
|
+
sender: t.hex().notNull().$type(),
|
|
1458
|
+
// Event Log Metadata
|
|
1459
|
+
// chain
|
|
1460
|
+
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
1461
|
+
// block
|
|
1462
|
+
blockNumber: t.bigint().notNull().$type(),
|
|
1463
|
+
blockHash: t.hex().notNull().$type(),
|
|
1464
|
+
timestamp: t.bigint().notNull(),
|
|
1465
|
+
// transaction
|
|
1466
|
+
transactionHash: t.hex().notNull().$type(),
|
|
1467
|
+
transactionIndex: t.integer().notNull(),
|
|
1468
|
+
// `tx.from` — never HCA-aware. Always the EOA/relayer that submitted the transaction.
|
|
1469
|
+
// Use `event.sender` for the HCA-aware actor.
|
|
1470
|
+
from: t.hex().notNull().$type(),
|
|
1471
|
+
to: t.hex().$type(),
|
|
1472
|
+
// NOTE: a null `to` means this was a tx that deployed a contract
|
|
1473
|
+
// log
|
|
1474
|
+
address: t.hex().notNull().$type(),
|
|
1475
|
+
logIndex: t.integer().notNull().$type(),
|
|
1476
|
+
selector: t.hex().notNull().$type(),
|
|
1477
|
+
topics: t.hex().array().notNull().$type(),
|
|
1478
|
+
data: t.hex().notNull()
|
|
1479
|
+
}),
|
|
1480
|
+
(t) => ({
|
|
1481
|
+
bySelector: index5().on(t.selector),
|
|
1482
|
+
byFrom: index5().on(t.from),
|
|
1483
|
+
bySender: index5().on(t.sender),
|
|
1484
|
+
byTimestamp: index5().on(t.timestamp)
|
|
1485
|
+
})
|
|
1486
|
+
);
|
|
1487
|
+
var domainEvent2 = onchainTable6(
|
|
1488
|
+
"domain_events",
|
|
1489
|
+
(t) => ({
|
|
1490
|
+
domainId: t.text().notNull().$type(),
|
|
1491
|
+
eventId: t.text().notNull()
|
|
1492
|
+
}),
|
|
1493
|
+
(t) => ({ pk: primaryKey3({ columns: [t.domainId, t.eventId] }) })
|
|
1494
|
+
);
|
|
1495
|
+
var resolverEvent2 = onchainTable6(
|
|
1496
|
+
"resolver_events",
|
|
1497
|
+
(t) => ({
|
|
1498
|
+
resolverId: t.text().notNull().$type(),
|
|
1499
|
+
eventId: t.text().notNull()
|
|
1500
|
+
}),
|
|
1501
|
+
(t) => ({ pk: primaryKey3({ columns: [t.resolverId, t.eventId] }) })
|
|
1502
|
+
);
|
|
1503
|
+
var permissionsEvent = onchainTable6(
|
|
1504
|
+
"permissions_events",
|
|
1505
|
+
(t) => ({
|
|
1506
|
+
permissionsId: t.text().notNull().$type(),
|
|
1507
|
+
eventId: t.text().notNull()
|
|
1508
|
+
}),
|
|
1509
|
+
(t) => ({ pk: primaryKey3({ columns: [t.permissionsId, t.eventId] }) })
|
|
1510
|
+
);
|
|
1511
|
+
var permissionsUserEvent = onchainTable6(
|
|
1512
|
+
"permissions_user_events",
|
|
1513
|
+
(t) => ({
|
|
1514
|
+
permissionsUserId: t.text().notNull().$type(),
|
|
1515
|
+
eventId: t.text().notNull()
|
|
1516
|
+
}),
|
|
1517
|
+
(t) => ({ pk: primaryKey3({ columns: [t.permissionsUserId, t.eventId] }) })
|
|
1518
|
+
);
|
|
1519
|
+
var account = onchainTable6("accounts", (t) => ({
|
|
1520
|
+
id: t.hex().primaryKey().$type()
|
|
1521
|
+
}));
|
|
1522
|
+
var account_relations = relations4(account, ({ many }) => ({
|
|
1523
|
+
registrations: many(registration, { relationName: "registrant" }),
|
|
1524
|
+
domains: many(domain),
|
|
1525
|
+
permissions: many(permissionsUser)
|
|
1526
|
+
}));
|
|
1527
|
+
var registryType = onchainEnum2("RegistryType", [
|
|
1528
|
+
"ENSv1Registry",
|
|
1529
|
+
"ENSv1VirtualRegistry",
|
|
1530
|
+
"ENSv2Registry"
|
|
1531
|
+
]);
|
|
1532
|
+
var registry = onchainTable6(
|
|
1533
|
+
"registries",
|
|
1534
|
+
(t) => ({
|
|
1535
|
+
// see RegistryId for guarantees
|
|
1536
|
+
id: t.text().primaryKey().$type(),
|
|
1537
|
+
// has a type
|
|
1538
|
+
type: registryType().notNull(),
|
|
1539
|
+
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
1540
|
+
address: t.hex().notNull().$type(),
|
|
1541
|
+
// If this is an ENSv1VirtualRegistry, `node` is the namehash of the parent ENSv1 domain that
|
|
1542
|
+
// owns it, otherwise null.
|
|
1543
|
+
node: t.hex().$type(),
|
|
1544
|
+
// the Registry's declared Canonical Domain (uni-directional)
|
|
1545
|
+
canonicalDomainId: t.text().$type(),
|
|
1546
|
+
// Whether this Registry is part of the canonical nametree. See canonicality-db-helpers.ts.
|
|
1547
|
+
canonical: t.boolean().notNull().default(false),
|
|
1548
|
+
// Synthetic monotonic sentinel: flipped to true the first time a child Domain is registered
|
|
1549
|
+
// under this Registry (see `ensureDomainInRegistry`). Read by `cascadeCanonicality` to skip
|
|
1550
|
+
// the raw-SQL recursive-CTE walk (and its associated Ponder cache flush) when the start
|
|
1551
|
+
// registry provably has no descendants — the dominant case for fresh ENSv1 virtual
|
|
1552
|
+
// registries on first wire-up. Double-underscore prefix marks it as an internal-only
|
|
1553
|
+
// bookkeeping field, not part of the on-chain protocol surface.
|
|
1554
|
+
__hasChildren: t.boolean().notNull().default(false)
|
|
1555
|
+
}),
|
|
1556
|
+
(t) => ({
|
|
1557
|
+
// NOTE: non-unique index because multiple rows can share (chainId, address) across virtual registries
|
|
1558
|
+
byChainAddress: index5().on(t.chainId, t.address)
|
|
1559
|
+
})
|
|
1560
|
+
);
|
|
1561
|
+
var relations_registry = relations4(registry, ({ one, many }) => ({
|
|
1562
|
+
// domains that declare this registry as their parent registry
|
|
1563
|
+
domains: many(domain, { relationName: "registry" }),
|
|
1564
|
+
// domains that declare this registry as their subregistry
|
|
1565
|
+
domainsAsSubregistry: many(domain, { relationName: "subregistry" }),
|
|
1566
|
+
permissions: one(permissions, {
|
|
1567
|
+
relationName: "permissions",
|
|
1568
|
+
fields: [registry.chainId, registry.address],
|
|
1569
|
+
references: [permissions.chainId, permissions.address]
|
|
1570
|
+
})
|
|
1571
|
+
}));
|
|
1572
|
+
var domainType = onchainEnum2("DomainType", ["ENSv1Domain", "ENSv2Domain"]);
|
|
1573
|
+
var domain = onchainTable6(
|
|
1574
|
+
"domains",
|
|
1575
|
+
(t) => ({
|
|
1576
|
+
// see DomainId for guarantees (ENSv1DomainId: `${ENSv1RegistryId}/${node}`, ENSv2DomainId: CAIP-19)
|
|
1577
|
+
id: t.text().primaryKey().$type(),
|
|
1578
|
+
// has a type
|
|
1579
|
+
type: domainType().notNull(),
|
|
1580
|
+
// belongs to a registry
|
|
1581
|
+
registryId: t.text().notNull().$type(),
|
|
1582
|
+
// the Domain's declared Subregistry (uni-directional)
|
|
1583
|
+
subregistryId: t.text().$type(),
|
|
1584
|
+
// If this is an ENSv2Domain, the TokenId within the ENSv2Registry, otherwise null.
|
|
1585
|
+
tokenId: t.bigint().$type(),
|
|
1586
|
+
// If this is an ENSv1Domain, The Domain's namehash, otherwise null.
|
|
1587
|
+
node: t.hex().$type(),
|
|
1588
|
+
// represents a labelHash
|
|
1589
|
+
labelHash: t.hex().notNull().$type(),
|
|
1590
|
+
// If this is an ENSv1Domain, this is the effective owner of the Domain.
|
|
1591
|
+
// If this is an ENSv2Domain, this is the on-chain owner address (the HCA account address if used).
|
|
1592
|
+
ownerId: t.hex().$type(),
|
|
1593
|
+
// If this is an ENSv1Domain, may have a `rootRegistryOwner`, otherwise null.
|
|
1594
|
+
rootRegistryOwnerId: t.hex().$type(),
|
|
1595
|
+
// Whether this Domain is part of the canonical nametree. Mirrors the parent Registry's flag.
|
|
1596
|
+
canonical: t.boolean().notNull().default(false),
|
|
1597
|
+
/**
|
|
1598
|
+
* Materialized Canonical Name, NULL iff `canonical = false`.
|
|
1599
|
+
* Maintained by `canonicality-db-helpers.ts`.
|
|
1600
|
+
*
|
|
1601
|
+
* @example "vitalik.eth"
|
|
1602
|
+
*/
|
|
1603
|
+
canonicalName: t.text().$type(),
|
|
1604
|
+
/**
|
|
1605
|
+
* Materialized Canonical LabelHashPath, NULL iff `canonical = false`.
|
|
1606
|
+
* Maintained by `canonicality-db-helpers.ts`.
|
|
1607
|
+
*
|
|
1608
|
+
* @dev Note that LabelHashPaths are in traversal-order (i.e. [labelhash("eth"), labelhash("vitalik")]).
|
|
1609
|
+
*/
|
|
1610
|
+
canonicalLabelHashPath: t.hex().array().$type(),
|
|
1611
|
+
/**
|
|
1612
|
+
* Materialized Canonical Domain Path, NULL iff `canonical = false`.
|
|
1613
|
+
* Maintained by `canonicality-db-helpers.ts`.
|
|
1614
|
+
*
|
|
1615
|
+
* @dev Note that canonicalPath is in traversal-order (i.e. ["eth"'s DomainId, "vitalik"'s DomainId]).
|
|
1616
|
+
*/
|
|
1617
|
+
canonicalPath: t.text().array().$type(),
|
|
1618
|
+
/**
|
|
1619
|
+
* Materialized Canonical Depth, NULL iff `canonical = false`.
|
|
1620
|
+
* Maintained by `canonicality-db-helpers.ts`.
|
|
1621
|
+
*
|
|
1622
|
+
* @dev The depth of this Domain in the Canonical Nametree i.e. the number of Labels in its Canonical Name.
|
|
1623
|
+
* @example "eth" depth 1, "vitalik.eth" depth 2, etc
|
|
1624
|
+
*/
|
|
1625
|
+
canonicalDepth: t.integer(),
|
|
1626
|
+
/**
|
|
1627
|
+
* Materialized Canonical Node, NULL iff `canonical = false`.
|
|
1628
|
+
* Maintained by `canonicality-db-helpers.ts`.
|
|
1629
|
+
*
|
|
1630
|
+
* @dev the computed Node (via `namehash`) of this Domain's Canonical Name.
|
|
1631
|
+
*/
|
|
1632
|
+
canonicalNode: t.hex().$type()
|
|
1633
|
+
// NOTE: Domain-Resolver Relations tracked via Protocol Acceleration plugin
|
|
1634
|
+
}),
|
|
1635
|
+
(t) => ({
|
|
1636
|
+
byType: index5().on(t.type),
|
|
1637
|
+
bySubregistry: index5().on(t.subregistryId).where(sql2`${t.subregistryId} IS NOT NULL`),
|
|
1638
|
+
byOwner: index5().on(t.ownerId),
|
|
1639
|
+
byLabelHash: index5().on(t.labelHash),
|
|
1640
|
+
// Composite for `(registry_id, label_hash)` lookups (namegraph walk in
|
|
1641
|
+
// get-domain-by-interpreted-name.ts). The leading `registry_id` column also serves
|
|
1642
|
+
// `WHERE registry_id = X` lookups via prefix scan.
|
|
1643
|
+
byRegistryAndLabelHash: index5().on(t.registryId, t.labelHash),
|
|
1644
|
+
// composite for `WHERE registry_id = X ORDER BY canonical_name LIMIT N` (Domain.subdomains
|
|
1645
|
+
// and other find-domains queries when ordering by NAME). Uses `left(canonical_name, 256)`
|
|
1646
|
+
// to bound the index tuple under btree's per-tuple max (~2712 bytes): 256 chars × max 4-byte
|
|
1647
|
+
// UTF-8 = 1024 bytes, leaving ample room for the registry_id and id columns. Names beyond
|
|
1648
|
+
// 256 chars (currently <0.0001% of mainnet) collide on the truncated prefix and tie-break by
|
|
1649
|
+
// id; this is acceptable since such names are invariably spam. Callers MUST sort by the same
|
|
1650
|
+
// expression for the planner to use this index for ordered scan.
|
|
1651
|
+
byRegistryAndCanonicalNameLeft: index5().on(
|
|
1652
|
+
t.registryId,
|
|
1653
|
+
sql2`left(${t.canonicalName}, 256)`,
|
|
1654
|
+
t.id
|
|
1655
|
+
),
|
|
1656
|
+
// hash index avoids the btree 8191-byte row-size hazard for spam names
|
|
1657
|
+
byCanonicalNameExact: index5().using("hash", t.canonicalName),
|
|
1658
|
+
// GIN trigram index for substring / similarity queries (inline `gin_trgm_ops` via `sql`
|
|
1659
|
+
// because passing it through `.op()` gets dropped by Ponder)
|
|
1660
|
+
byCanonicalNameFuzzy: index5().using("gin", sql2`${t.canonicalName} gin_trgm_ops`),
|
|
1661
|
+
// GIN containment for `cascadeLabelHeal`'s `canonical_label_hash_path @> ARRAY[lh]` lookup
|
|
1662
|
+
byCanonicalLabelHashPath: index5().using("gin", t.canonicalLabelHashPath),
|
|
1663
|
+
// hash index for resolver-record → canonical-domain joins
|
|
1664
|
+
byCanonicalNode: index5().using("hash", t.canonicalNode),
|
|
1665
|
+
// btree for ORDER BY canonical_depth (typeahead and DEPTH-ordered browse)
|
|
1666
|
+
byCanonicalDepth: index5().on(t.canonicalDepth)
|
|
1667
|
+
})
|
|
1668
|
+
);
|
|
1669
|
+
var relations_domain = relations4(domain, ({ one, many }) => ({
|
|
1670
|
+
registry: one(registry, {
|
|
1671
|
+
relationName: "registry",
|
|
1672
|
+
fields: [domain.registryId],
|
|
1673
|
+
references: [registry.id]
|
|
1674
|
+
}),
|
|
1675
|
+
subregistry: one(registry, {
|
|
1676
|
+
relationName: "subregistry",
|
|
1677
|
+
fields: [domain.subregistryId],
|
|
1678
|
+
references: [registry.id]
|
|
1679
|
+
}),
|
|
1680
|
+
owner: one(account, {
|
|
1681
|
+
relationName: "owner",
|
|
1682
|
+
fields: [domain.ownerId],
|
|
1683
|
+
references: [account.id]
|
|
1684
|
+
}),
|
|
1685
|
+
rootRegistryOwner: one(account, {
|
|
1686
|
+
relationName: "rootRegistryOwner",
|
|
1687
|
+
fields: [domain.rootRegistryOwnerId],
|
|
1688
|
+
references: [account.id]
|
|
1689
|
+
}),
|
|
1690
|
+
label: one(label, {
|
|
1691
|
+
relationName: "label",
|
|
1692
|
+
fields: [domain.labelHash],
|
|
1693
|
+
references: [label.labelHash]
|
|
1694
|
+
}),
|
|
1695
|
+
registrations: many(registration)
|
|
1696
|
+
}));
|
|
1697
|
+
var registrationType = onchainEnum2("RegistrationType", [
|
|
1698
|
+
// TODO: prefix these with ENSv1, maybe excluding ThreeDNS
|
|
1699
|
+
"NameWrapper",
|
|
1700
|
+
"BaseRegistrar",
|
|
1701
|
+
"ThreeDNS",
|
|
1702
|
+
"ENSv2RegistryRegistration",
|
|
1703
|
+
"ENSv2RegistryReservation"
|
|
1704
|
+
]);
|
|
1705
|
+
var registration = onchainTable6(
|
|
1706
|
+
"registrations",
|
|
1707
|
+
(t) => ({
|
|
1708
|
+
// keyed by (domainId, registrationIndex)
|
|
1709
|
+
id: t.text().primaryKey().$type(),
|
|
1710
|
+
domainId: t.text().notNull().$type(),
|
|
1711
|
+
registrationIndex: t.integer().notNull(),
|
|
1712
|
+
// has a type
|
|
1713
|
+
type: registrationType().notNull(),
|
|
1714
|
+
// has a start
|
|
1715
|
+
start: t.bigint().notNull(),
|
|
1716
|
+
// may have an expiry
|
|
1717
|
+
expiry: t.bigint(),
|
|
1718
|
+
// maybe have a grace period (BaseRegistrar)
|
|
1719
|
+
gracePeriod: t.bigint(),
|
|
1720
|
+
// registrar AccountId
|
|
1721
|
+
registrarChainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
1722
|
+
registrarAddress: t.hex().notNull().$type(),
|
|
1723
|
+
// may reference a registrant. If this is an ENSv2 Registration, the protocol-emitted
|
|
1724
|
+
// registrant address (the HCA account address if used).
|
|
1725
|
+
registrantId: t.hex().$type(),
|
|
1726
|
+
// may reference an unregistrant. If this is an ENSv2 Registration, the protocol-emitted
|
|
1727
|
+
// unregistrant address (the HCA account address if used).
|
|
1728
|
+
unregistrantId: t.hex().$type(),
|
|
1729
|
+
// may have referrer data
|
|
1730
|
+
referrer: t.hex().$type(),
|
|
1731
|
+
// may have fuses (NameWrapper, Wrapped BaseRegistrar)
|
|
1732
|
+
fuses: t.integer(),
|
|
1733
|
+
// TODO(paymentToken): add payment token tracking here
|
|
1734
|
+
// may have base cost (BaseRegistrar, ENSv2Registrar)
|
|
1735
|
+
base: t.bigint(),
|
|
1736
|
+
// may have a premium (BaseRegistrar)
|
|
1737
|
+
premium: t.bigint(),
|
|
1738
|
+
// may be Wrapped (BaseRegistrar)
|
|
1739
|
+
wrapped: t.boolean().default(false),
|
|
1740
|
+
// has an event
|
|
1741
|
+
eventId: t.text().notNull()
|
|
1742
|
+
}),
|
|
1743
|
+
(t) => ({
|
|
1744
|
+
byId: uniqueIndex3().on(t.domainId, t.registrationIndex)
|
|
1745
|
+
})
|
|
1746
|
+
);
|
|
1747
|
+
var registration_relations = relations4(registration, ({ one, many }) => ({
|
|
1748
|
+
// belongs to a domain
|
|
1749
|
+
domain: one(domain, {
|
|
1750
|
+
fields: [registration.domainId],
|
|
1751
|
+
references: [domain.id]
|
|
1752
|
+
}),
|
|
1753
|
+
// has one registrant
|
|
1754
|
+
registrant: one(account, {
|
|
1755
|
+
fields: [registration.registrantId],
|
|
1756
|
+
references: [account.id],
|
|
1757
|
+
relationName: "registrant"
|
|
1758
|
+
}),
|
|
1759
|
+
// has a latest registration index
|
|
1760
|
+
latestRegistrationIndex: one(latestRegistrationIndex),
|
|
1761
|
+
// has a latest renewal index
|
|
1762
|
+
latestRenewalIndex: one(latestRenewalIndex),
|
|
1763
|
+
// has one unregistrant
|
|
1764
|
+
unregistrant: one(account, {
|
|
1765
|
+
fields: [registration.unregistrantId],
|
|
1766
|
+
references: [account.id],
|
|
1767
|
+
relationName: "unregistrant"
|
|
1768
|
+
}),
|
|
1769
|
+
// has many renewals
|
|
1770
|
+
renewals: many(renewal),
|
|
1771
|
+
// has an event
|
|
1772
|
+
event: one(event, {
|
|
1773
|
+
fields: [registration.eventId],
|
|
1774
|
+
references: [event.id]
|
|
1775
|
+
})
|
|
1776
|
+
}));
|
|
1777
|
+
var latestRegistrationIndex = onchainTable6("latest_registration_indexes", (t) => ({
|
|
1778
|
+
domainId: t.text().primaryKey().$type(),
|
|
1779
|
+
registrationIndex: t.integer().notNull()
|
|
1780
|
+
}));
|
|
1781
|
+
var latestRegistrationIndex_relations = relations4(latestRegistrationIndex, ({ one }) => ({
|
|
1782
|
+
// references domain
|
|
1783
|
+
domain: one(domain, {
|
|
1784
|
+
fields: [latestRegistrationIndex.domainId],
|
|
1785
|
+
references: [domain.id]
|
|
1786
|
+
})
|
|
1787
|
+
}));
|
|
1788
|
+
var renewal = onchainTable6(
|
|
1789
|
+
"renewals",
|
|
1790
|
+
(t) => ({
|
|
1791
|
+
// keyed by (registrationId, index)
|
|
1792
|
+
id: t.text().primaryKey().$type(),
|
|
1793
|
+
domainId: t.text().notNull().$type(),
|
|
1794
|
+
registrationIndex: t.integer().notNull(),
|
|
1795
|
+
renewalIndex: t.integer().notNull(),
|
|
1796
|
+
// all renewals have a duration
|
|
1797
|
+
duration: t.bigint().notNull(),
|
|
1798
|
+
// may have a referrer
|
|
1799
|
+
referrer: t.hex().$type(),
|
|
1800
|
+
// TODO(paymentToken): add payment token tracking here
|
|
1801
|
+
// may have base cost
|
|
1802
|
+
base: t.bigint(),
|
|
1803
|
+
// may have a premium (ENSv1 RegistrarControllers)
|
|
1804
|
+
premium: t.bigint(),
|
|
1805
|
+
// has an event
|
|
1806
|
+
eventId: t.text().notNull()
|
|
1807
|
+
}),
|
|
1808
|
+
(t) => ({
|
|
1809
|
+
byId: uniqueIndex3().on(t.domainId, t.registrationIndex, t.renewalIndex)
|
|
1810
|
+
})
|
|
1811
|
+
);
|
|
1812
|
+
var renewal_relations = relations4(renewal, ({ one }) => ({
|
|
1813
|
+
// belongs to registration
|
|
1814
|
+
registration: one(registration, {
|
|
1815
|
+
fields: [renewal.domainId, renewal.registrationIndex],
|
|
1816
|
+
references: [registration.domainId, registration.registrationIndex]
|
|
1817
|
+
}),
|
|
1818
|
+
// has an event
|
|
1819
|
+
event: one(event, {
|
|
1820
|
+
fields: [renewal.eventId],
|
|
1821
|
+
references: [event.id]
|
|
1822
|
+
})
|
|
1823
|
+
}));
|
|
1824
|
+
var latestRenewalIndex = onchainTable6(
|
|
1825
|
+
"latest_renewal_indexes",
|
|
1826
|
+
(t) => ({
|
|
1827
|
+
domainId: t.text().notNull().$type(),
|
|
1828
|
+
registrationIndex: t.integer().notNull(),
|
|
1829
|
+
renewalIndex: t.integer().notNull()
|
|
1830
|
+
}),
|
|
1831
|
+
(t) => ({ pk: primaryKey3({ columns: [t.domainId, t.registrationIndex] }) })
|
|
1832
|
+
);
|
|
1833
|
+
var latestRenewalIndex_relations = relations4(latestRenewalIndex, ({ one }) => ({
|
|
1834
|
+
// references domain
|
|
1835
|
+
domain: one(domain, {
|
|
1836
|
+
fields: [latestRenewalIndex.domainId],
|
|
1837
|
+
references: [domain.id]
|
|
1838
|
+
})
|
|
1839
|
+
}));
|
|
1840
|
+
var permissions = onchainTable6(
|
|
1841
|
+
"permissions",
|
|
1842
|
+
(t) => ({
|
|
1843
|
+
id: t.text().primaryKey().$type(),
|
|
1844
|
+
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
1845
|
+
address: t.hex().notNull().$type()
|
|
1846
|
+
}),
|
|
1847
|
+
(t) => ({
|
|
1848
|
+
byId: uniqueIndex3().on(t.chainId, t.address)
|
|
1849
|
+
})
|
|
1850
|
+
);
|
|
1851
|
+
var relations_permissions = relations4(permissions, ({ many }) => ({
|
|
1852
|
+
resources: many(permissionsResource),
|
|
1853
|
+
users: many(permissionsUser)
|
|
1854
|
+
}));
|
|
1855
|
+
var permissionsResource = onchainTable6(
|
|
1856
|
+
"permissions_resources",
|
|
1857
|
+
(t) => ({
|
|
1858
|
+
id: t.text().primaryKey().$type(),
|
|
1859
|
+
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
1860
|
+
address: t.hex().notNull().$type(),
|
|
1861
|
+
resource: t.bigint().notNull()
|
|
1862
|
+
}),
|
|
1863
|
+
(t) => ({
|
|
1864
|
+
byId: uniqueIndex3().on(t.chainId, t.address, t.resource)
|
|
1865
|
+
})
|
|
1866
|
+
);
|
|
1867
|
+
var relations_permissionsResource = relations4(permissionsResource, ({ one }) => ({
|
|
1868
|
+
permissions: one(permissions, {
|
|
1869
|
+
fields: [permissionsResource.chainId, permissionsResource.address],
|
|
1870
|
+
references: [permissions.chainId, permissions.address]
|
|
1871
|
+
})
|
|
1872
|
+
}));
|
|
1873
|
+
var permissionsUser = onchainTable6(
|
|
1874
|
+
"permissions_users",
|
|
1875
|
+
(t) => ({
|
|
1876
|
+
id: t.text().primaryKey().$type(),
|
|
1877
|
+
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
1878
|
+
address: t.hex().notNull().$type(),
|
|
1879
|
+
resource: t.bigint().notNull(),
|
|
1880
|
+
// The user/grantee address this Permission is granted to (the HCA account address if used).
|
|
1881
|
+
user: t.hex().notNull().$type(),
|
|
1882
|
+
// has one roles bitmap
|
|
1883
|
+
roles: t.bigint().notNull()
|
|
1884
|
+
}),
|
|
1885
|
+
(t) => ({
|
|
1886
|
+
byId: uniqueIndex3().on(t.chainId, t.address, t.resource, t.user)
|
|
1887
|
+
})
|
|
1888
|
+
);
|
|
1889
|
+
var relations_permissionsUser = relations4(permissionsUser, ({ one }) => ({
|
|
1890
|
+
account: one(account, {
|
|
1891
|
+
fields: [permissionsUser.user],
|
|
1892
|
+
references: [account.id]
|
|
1893
|
+
}),
|
|
1894
|
+
permissions: one(permissions, {
|
|
1895
|
+
fields: [permissionsUser.chainId, permissionsUser.address],
|
|
1896
|
+
references: [permissions.chainId, permissions.address]
|
|
1897
|
+
}),
|
|
1898
|
+
resource: one(permissionsResource, {
|
|
1899
|
+
fields: [permissionsUser.chainId, permissionsUser.address, permissionsUser.resource],
|
|
1900
|
+
references: [
|
|
1901
|
+
permissionsResource.chainId,
|
|
1902
|
+
permissionsResource.address,
|
|
1903
|
+
permissionsResource.resource
|
|
1904
|
+
]
|
|
1905
|
+
})
|
|
1906
|
+
}));
|
|
1907
|
+
var label = onchainTable6(
|
|
1908
|
+
"labels",
|
|
1909
|
+
(t) => ({
|
|
1910
|
+
labelHash: t.hex().primaryKey().$type(),
|
|
1911
|
+
interpreted: t.text().notNull().$type()
|
|
1912
|
+
}),
|
|
1913
|
+
(t) => ({
|
|
1914
|
+
// hash index avoids the btree 8191-byte row-size hazard for spam labels (a single label can
|
|
1915
|
+
// exceed btree's leaf-size limit)
|
|
1916
|
+
byInterpretedExact: index5().using("hash", t.interpreted),
|
|
1917
|
+
// GIN trigram index for substring / similarity queries (inline `gin_trgm_ops` via `sql`
|
|
1918
|
+
// because passing it through `.op()` gets dropped by Ponder)
|
|
1919
|
+
byInterpretedFuzzy: index5().using("gin", sql2`${t.interpreted} gin_trgm_ops`)
|
|
1920
|
+
})
|
|
1921
|
+
);
|
|
1922
|
+
var label_relations = relations4(label, ({ many }) => ({
|
|
1923
|
+
domains: many(domain)
|
|
1924
|
+
}));
|
|
1909
1925
|
export {
|
|
1910
1926
|
account,
|
|
1911
1927
|
account_relations,
|
|
1912
1928
|
domain,
|
|
1913
|
-
domainEvent,
|
|
1929
|
+
domainEvent2 as domainEvent,
|
|
1914
1930
|
domainResolverRelation,
|
|
1915
1931
|
domainResolverRelation_relations,
|
|
1916
1932
|
domainType,
|
|
@@ -1952,7 +1968,7 @@ export {
|
|
|
1952
1968
|
resolver,
|
|
1953
1969
|
resolverAddressRecord,
|
|
1954
1970
|
resolverAddressRecordRelations,
|
|
1955
|
-
resolverEvent,
|
|
1971
|
+
resolverEvent2 as resolverEvent,
|
|
1956
1972
|
resolverRecords,
|
|
1957
1973
|
resolverRecords_relations,
|
|
1958
1974
|
resolverTextRecord,
|