@ensnode/ensdb-sdk 1.13.1 → 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 +1197 -1129
- package/dist/ensindexer-abstract/index.js.map +1 -1
- package/dist/{index-CVAtPcO6.d.ts → index-1D8_3_7g.d.ts} +3974 -3816
- package/dist/index.d.ts +7 -3
- package/dist/index.js +1208 -1134
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ __export(ensindexer_abstract_exports, {
|
|
|
10
10
|
account: () => account,
|
|
11
11
|
account_relations: () => account_relations,
|
|
12
12
|
domain: () => domain,
|
|
13
|
-
domainEvent: () =>
|
|
13
|
+
domainEvent: () => domainEvent2,
|
|
14
14
|
domainResolverRelation: () => domainResolverRelation,
|
|
15
15
|
domainResolverRelation_relations: () => domainResolverRelation_relations,
|
|
16
16
|
domainType: () => domainType,
|
|
@@ -52,7 +52,7 @@ __export(ensindexer_abstract_exports, {
|
|
|
52
52
|
resolver: () => resolver,
|
|
53
53
|
resolverAddressRecord: () => resolverAddressRecord,
|
|
54
54
|
resolverAddressRecordRelations: () => resolverAddressRecordRelations,
|
|
55
|
-
resolverEvent: () =>
|
|
55
|
+
resolverEvent: () => resolverEvent2,
|
|
56
56
|
resolverRecords: () => resolverRecords,
|
|
57
57
|
resolverRecords_relations: () => resolverRecords_relations,
|
|
58
58
|
resolverTextRecord: () => resolverTextRecord,
|
|
@@ -117,633 +117,224 @@ __export(ensindexer_abstract_exports, {
|
|
|
117
117
|
subregistryRelations: () => subregistryRelations
|
|
118
118
|
});
|
|
119
119
|
|
|
120
|
-
// src/ensindexer-abstract/
|
|
121
|
-
import {
|
|
122
|
-
var
|
|
123
|
-
"
|
|
120
|
+
// src/ensindexer-abstract/migrated-nodes.schema.ts
|
|
121
|
+
import { onchainTable, primaryKey } from "ponder";
|
|
122
|
+
var migratedNodeByParent = onchainTable(
|
|
123
|
+
"migrated_nodes_by_parent",
|
|
124
124
|
(t) => ({
|
|
125
|
-
//
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
// NOTE: a null `to` means this was a tx that deployed a contract
|
|
144
|
-
// log
|
|
125
|
+
// keyed by (parentNode, labelHash)
|
|
126
|
+
parentNode: t.hex().notNull().$type(),
|
|
127
|
+
labelHash: t.hex().notNull().$type()
|
|
128
|
+
}),
|
|
129
|
+
(t) => ({
|
|
130
|
+
pk: primaryKey({ columns: [t.parentNode, t.labelHash] })
|
|
131
|
+
})
|
|
132
|
+
);
|
|
133
|
+
var migratedNodeByNode = onchainTable("migrated_nodes_by_node", (t) => ({
|
|
134
|
+
node: t.hex().primaryKey().$type()
|
|
135
|
+
}));
|
|
136
|
+
|
|
137
|
+
// src/ensindexer-abstract/protocol-acceleration.schema.ts
|
|
138
|
+
import { index, onchainTable as onchainTable2, primaryKey as primaryKey2, relations, uniqueIndex } from "ponder";
|
|
139
|
+
var reverseNameRecord = onchainTable2(
|
|
140
|
+
"reverse_name_records",
|
|
141
|
+
(t) => ({
|
|
142
|
+
// keyed by (address, coinType)
|
|
145
143
|
address: t.hex().notNull().$type(),
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
144
|
+
coinType: t.bigint().notNull(),
|
|
145
|
+
/**
|
|
146
|
+
* Represents the ENSIP-19 Reverse Name Record for a given (address, coinType).
|
|
147
|
+
*
|
|
148
|
+
* The value of this field is guaranteed to be a non-empty {@link InterpretedName}.
|
|
149
|
+
*/
|
|
150
|
+
value: t.text().notNull().$type()
|
|
150
151
|
}),
|
|
151
152
|
(t) => ({
|
|
152
|
-
|
|
153
|
-
byFrom: index().on(t.from),
|
|
154
|
-
bySender: index().on(t.sender),
|
|
155
|
-
byTimestamp: index().on(t.timestamp)
|
|
153
|
+
pk: primaryKey2({ columns: [t.address, t.coinType] })
|
|
156
154
|
})
|
|
157
155
|
);
|
|
158
|
-
var
|
|
159
|
-
"
|
|
156
|
+
var domainResolverRelation = onchainTable2(
|
|
157
|
+
"domain_resolver_relations",
|
|
160
158
|
(t) => ({
|
|
159
|
+
// keyed by (chainId, address, node)
|
|
160
|
+
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
161
|
+
// The Registry (ENSv1Registry or ENSv2Registry)'s AccountId.
|
|
162
|
+
address: t.hex().notNull().$type(),
|
|
161
163
|
domainId: t.text().notNull().$type(),
|
|
162
|
-
|
|
164
|
+
// The Domain's assigned Resolver's address (NOTE: always scoped to chainId)
|
|
165
|
+
resolver: t.hex().notNull().$type()
|
|
163
166
|
}),
|
|
164
|
-
(t) => ({
|
|
167
|
+
(t) => ({
|
|
168
|
+
pk: primaryKey2({ columns: [t.chainId, t.address, t.domainId] }),
|
|
169
|
+
byDomain: index().on(t.domainId)
|
|
170
|
+
})
|
|
165
171
|
);
|
|
166
|
-
var
|
|
167
|
-
|
|
172
|
+
var domainResolverRelation_relations = relations(domainResolverRelation, ({ one }) => ({
|
|
173
|
+
resolver: one(resolver, {
|
|
174
|
+
fields: [domainResolverRelation.chainId, domainResolverRelation.resolver],
|
|
175
|
+
references: [resolver.chainId, resolver.address]
|
|
176
|
+
})
|
|
177
|
+
}));
|
|
178
|
+
var resolver = onchainTable2(
|
|
179
|
+
"resolvers",
|
|
168
180
|
(t) => ({
|
|
169
|
-
|
|
170
|
-
|
|
181
|
+
// keyed by (chainId, address)
|
|
182
|
+
id: t.text().primaryKey().$type(),
|
|
183
|
+
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
184
|
+
address: t.hex().notNull().$type()
|
|
171
185
|
}),
|
|
172
|
-
(t) => ({
|
|
186
|
+
(t) => ({
|
|
187
|
+
byId: uniqueIndex().on(t.chainId, t.address)
|
|
188
|
+
})
|
|
173
189
|
);
|
|
174
|
-
var
|
|
175
|
-
|
|
190
|
+
var resolver_relations = relations(resolver, ({ many }) => ({
|
|
191
|
+
records: many(resolverRecords)
|
|
192
|
+
}));
|
|
193
|
+
var resolverRecords = onchainTable2(
|
|
194
|
+
"resolver_records",
|
|
176
195
|
(t) => ({
|
|
177
|
-
|
|
178
|
-
|
|
196
|
+
// keyed by (chainId, resolver, node)
|
|
197
|
+
id: t.text().primaryKey().$type(),
|
|
198
|
+
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
199
|
+
address: t.hex().notNull().$type(),
|
|
200
|
+
node: t.hex().notNull().$type(),
|
|
201
|
+
/**
|
|
202
|
+
* Represents the value of the reverse-resolution (ENSIP-3) name() record, used for Reverse Resolution.
|
|
203
|
+
*
|
|
204
|
+
* If present, the value of this field is guaranteed to be a non-empty {@link InterpretedName}.
|
|
205
|
+
*/
|
|
206
|
+
name: t.text().$type(),
|
|
207
|
+
/**
|
|
208
|
+
* ENSIP-7 contenthash raw bytes or null if not set.
|
|
209
|
+
*/
|
|
210
|
+
contenthash: t.hex(),
|
|
211
|
+
/**
|
|
212
|
+
* PubkeyResolver (x, y) pair, or null if not set.
|
|
213
|
+
*
|
|
214
|
+
* Invariant: both null together, or both set together.
|
|
215
|
+
*/
|
|
216
|
+
pubkeyX: t.hex(),
|
|
217
|
+
pubkeyY: t.hex(),
|
|
218
|
+
/**
|
|
219
|
+
* IDNSZoneResolver zonehash or null if not set.
|
|
220
|
+
*/
|
|
221
|
+
dnszonehash: t.hex(),
|
|
222
|
+
/**
|
|
223
|
+
* IVersionableResolver version. Null when no `VersionChanged` event has been seen for this
|
|
224
|
+
* (chainId, address, node) — the resolver may not implement `IVersionableResolver`, or simply
|
|
225
|
+
* may never have been version-bumped. Consumers should treat null as "unknown" rather than 0.
|
|
226
|
+
*/
|
|
227
|
+
version: t.bigint().$type()
|
|
179
228
|
}),
|
|
180
|
-
(t) => ({
|
|
229
|
+
(t) => ({
|
|
230
|
+
byId: uniqueIndex().on(t.chainId, t.address, t.node)
|
|
231
|
+
})
|
|
181
232
|
);
|
|
182
|
-
var
|
|
183
|
-
|
|
233
|
+
var resolverRecords_relations = relations(resolverRecords, ({ one, many }) => ({
|
|
234
|
+
// belongs to resolver
|
|
235
|
+
resolver: one(resolver, {
|
|
236
|
+
fields: [resolverRecords.chainId, resolverRecords.address],
|
|
237
|
+
references: [resolver.chainId, resolver.address]
|
|
238
|
+
}),
|
|
239
|
+
// resolverRecord has many address records
|
|
240
|
+
addressRecords: many(resolverAddressRecord),
|
|
241
|
+
// resolverRecord has many text records
|
|
242
|
+
textRecords: many(resolverTextRecord)
|
|
243
|
+
}));
|
|
244
|
+
var resolverAddressRecord = onchainTable2(
|
|
245
|
+
"resolver_address_records",
|
|
184
246
|
(t) => ({
|
|
185
|
-
|
|
186
|
-
|
|
247
|
+
// keyed by ((chainId, resolver, node), coinType)
|
|
248
|
+
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
249
|
+
address: t.hex().notNull().$type(),
|
|
250
|
+
node: t.hex().notNull().$type(),
|
|
251
|
+
// NOTE: all well-known CoinTypes fit into javascript number but NOT postgres .integer, must be
|
|
252
|
+
// stored as BigInt
|
|
253
|
+
coinType: t.bigint().notNull(),
|
|
254
|
+
/**
|
|
255
|
+
* Represents the value of the Addresss Record specified by ((chainId, resolver, node), coinType).
|
|
256
|
+
*
|
|
257
|
+
* The value of this field is interpreted by `interpretAddressRecordValue` — see its implementation
|
|
258
|
+
* for additional context and specific guarantees.
|
|
259
|
+
*/
|
|
260
|
+
value: t.text().notNull()
|
|
187
261
|
}),
|
|
188
|
-
(t) => ({
|
|
262
|
+
(t) => ({
|
|
263
|
+
pk: primaryKey2({ columns: [t.chainId, t.address, t.node, t.coinType] })
|
|
264
|
+
})
|
|
189
265
|
);
|
|
190
|
-
var
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
266
|
+
var resolverAddressRecordRelations = relations(resolverAddressRecord, ({ one }) => ({
|
|
267
|
+
// belongs to resolverRecord
|
|
268
|
+
resolver: one(resolverRecords, {
|
|
269
|
+
fields: [
|
|
270
|
+
resolverAddressRecord.chainId,
|
|
271
|
+
resolverAddressRecord.address,
|
|
272
|
+
resolverAddressRecord.node
|
|
273
|
+
],
|
|
274
|
+
references: [resolverRecords.chainId, resolverRecords.address, resolverRecords.node]
|
|
275
|
+
})
|
|
197
276
|
}));
|
|
198
|
-
var
|
|
199
|
-
"
|
|
200
|
-
"ENSv1VirtualRegistry",
|
|
201
|
-
"ENSv2Registry"
|
|
202
|
-
]);
|
|
203
|
-
var registry = onchainTable(
|
|
204
|
-
"registries",
|
|
277
|
+
var resolverTextRecord = onchainTable2(
|
|
278
|
+
"resolver_text_records",
|
|
205
279
|
(t) => ({
|
|
206
|
-
//
|
|
207
|
-
id: t.text().primaryKey().$type(),
|
|
208
|
-
// has a type
|
|
209
|
-
type: registryType().notNull(),
|
|
280
|
+
// keyed by ((chainId, resolver, node), key)
|
|
210
281
|
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
211
282
|
address: t.hex().notNull().$type(),
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
// the raw-SQL recursive-CTE walk (and its associated Ponder cache flush) when the start
|
|
222
|
-
// registry provably has no descendants — the dominant case for fresh ENSv1 virtual
|
|
223
|
-
// registries on first wire-up. Double-underscore prefix marks it as an internal-only
|
|
224
|
-
// bookkeeping field, not part of the on-chain protocol surface.
|
|
225
|
-
__hasChildren: t.boolean().notNull().default(false)
|
|
283
|
+
node: t.hex().notNull().$type(),
|
|
284
|
+
key: t.text().notNull(),
|
|
285
|
+
/**
|
|
286
|
+
* Represents the value of the Text Record specified by ((chainId, resolver, node), key).
|
|
287
|
+
*
|
|
288
|
+
* The value of this field is interpreted by `interpretTextRecordValue` — see its implementation
|
|
289
|
+
* for additional context and specific guarantees.
|
|
290
|
+
*/
|
|
291
|
+
value: t.text().notNull()
|
|
226
292
|
}),
|
|
227
293
|
(t) => ({
|
|
228
|
-
|
|
229
|
-
byChainAddress: index().on(t.chainId, t.address)
|
|
294
|
+
pk: primaryKey2({ columns: [t.chainId, t.address, t.node, t.key] })
|
|
230
295
|
})
|
|
231
296
|
);
|
|
232
|
-
var
|
|
233
|
-
//
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
permissions: one(permissions, {
|
|
238
|
-
relationName: "permissions",
|
|
239
|
-
fields: [registry.chainId, registry.address],
|
|
240
|
-
references: [permissions.chainId, permissions.address]
|
|
297
|
+
var resolverTextRecordRelations = relations(resolverTextRecord, ({ one }) => ({
|
|
298
|
+
// belongs to resolverRecord
|
|
299
|
+
resolver: one(resolverRecords, {
|
|
300
|
+
fields: [resolverTextRecord.chainId, resolverTextRecord.address, resolverTextRecord.node],
|
|
301
|
+
references: [resolverRecords.chainId, resolverRecords.address, resolverRecords.node]
|
|
241
302
|
})
|
|
242
303
|
}));
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
304
|
+
|
|
305
|
+
// src/ensindexer-abstract/registrars.schema.ts
|
|
306
|
+
import { index as index2, onchainEnum, onchainTable as onchainTable3, relations as relations2, uniqueIndex as uniqueIndex2 } from "ponder";
|
|
307
|
+
var subregistries = onchainTable3(
|
|
308
|
+
"subregistries",
|
|
246
309
|
(t) => ({
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
310
|
+
/**
|
|
311
|
+
* Subregistry ID
|
|
312
|
+
*
|
|
313
|
+
* Identifies the chainId and address of the smart contract associated
|
|
314
|
+
* with the subregistry.
|
|
315
|
+
*
|
|
316
|
+
* Guaranteed to be a fully lowercase string formatted according to
|
|
317
|
+
* the CAIP-10 standard.
|
|
318
|
+
*
|
|
319
|
+
* @see https://chainagnostic.org/CAIPs/caip-10
|
|
320
|
+
*/
|
|
321
|
+
subregistryId: t.text().primaryKey(),
|
|
322
|
+
/**
|
|
323
|
+
* The node (namehash) of the name the subregistry manages subnames of.
|
|
324
|
+
* Example subregistry managed names:
|
|
325
|
+
* - `eth`
|
|
326
|
+
* - `base.eth`
|
|
327
|
+
* - `linea.eth`
|
|
328
|
+
*
|
|
329
|
+
* Guaranteed to be a fully lowercase hex string representation of 32-bytes.
|
|
330
|
+
*/
|
|
331
|
+
node: t.hex().notNull()
|
|
269
332
|
}),
|
|
270
333
|
(t) => ({
|
|
271
|
-
|
|
272
|
-
byRegistry: index().on(t.registryId),
|
|
273
|
-
bySubregistry: index().on(t.subregistryId).where(sql`${t.subregistryId} IS NOT NULL`),
|
|
274
|
-
byOwner: index().on(t.ownerId),
|
|
275
|
-
byLabelHash: index().on(t.labelHash)
|
|
334
|
+
uniqueNode: uniqueIndex2().on(t.node)
|
|
276
335
|
})
|
|
277
336
|
);
|
|
278
|
-
var
|
|
279
|
-
registry: one(registry, {
|
|
280
|
-
relationName: "registry",
|
|
281
|
-
fields: [domain.registryId],
|
|
282
|
-
references: [registry.id]
|
|
283
|
-
}),
|
|
284
|
-
subregistry: one(registry, {
|
|
285
|
-
relationName: "subregistry",
|
|
286
|
-
fields: [domain.subregistryId],
|
|
287
|
-
references: [registry.id]
|
|
288
|
-
}),
|
|
289
|
-
owner: one(account, {
|
|
290
|
-
relationName: "owner",
|
|
291
|
-
fields: [domain.ownerId],
|
|
292
|
-
references: [account.id]
|
|
293
|
-
}),
|
|
294
|
-
rootRegistryOwner: one(account, {
|
|
295
|
-
relationName: "rootRegistryOwner",
|
|
296
|
-
fields: [domain.rootRegistryOwnerId],
|
|
297
|
-
references: [account.id]
|
|
298
|
-
}),
|
|
299
|
-
label: one(label, {
|
|
300
|
-
relationName: "label",
|
|
301
|
-
fields: [domain.labelHash],
|
|
302
|
-
references: [label.labelHash]
|
|
303
|
-
}),
|
|
304
|
-
registrations: many(registration)
|
|
305
|
-
}));
|
|
306
|
-
var registrationType = onchainEnum("RegistrationType", [
|
|
307
|
-
// TODO: prefix these with ENSv1, maybe excluding ThreeDNS
|
|
308
|
-
"NameWrapper",
|
|
309
|
-
"BaseRegistrar",
|
|
310
|
-
"ThreeDNS",
|
|
311
|
-
"ENSv2RegistryRegistration",
|
|
312
|
-
"ENSv2RegistryReservation"
|
|
313
|
-
]);
|
|
314
|
-
var registration = onchainTable(
|
|
315
|
-
"registrations",
|
|
316
|
-
(t) => ({
|
|
317
|
-
// keyed by (domainId, registrationIndex)
|
|
318
|
-
id: t.text().primaryKey().$type(),
|
|
319
|
-
domainId: t.text().notNull().$type(),
|
|
320
|
-
registrationIndex: t.integer().notNull(),
|
|
321
|
-
// has a type
|
|
322
|
-
type: registrationType().notNull(),
|
|
323
|
-
// has a start
|
|
324
|
-
start: t.bigint().notNull(),
|
|
325
|
-
// may have an expiry
|
|
326
|
-
expiry: t.bigint(),
|
|
327
|
-
// maybe have a grace period (BaseRegistrar)
|
|
328
|
-
gracePeriod: t.bigint(),
|
|
329
|
-
// registrar AccountId
|
|
330
|
-
registrarChainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
331
|
-
registrarAddress: t.hex().notNull().$type(),
|
|
332
|
-
// may reference a registrant. If this is an ENSv2 Registration, the protocol-emitted
|
|
333
|
-
// registrant address (the HCA account address if used).
|
|
334
|
-
registrantId: t.hex().$type(),
|
|
335
|
-
// may reference an unregistrant. If this is an ENSv2 Registration, the protocol-emitted
|
|
336
|
-
// unregistrant address (the HCA account address if used).
|
|
337
|
-
unregistrantId: t.hex().$type(),
|
|
338
|
-
// may have referrer data
|
|
339
|
-
referrer: t.hex().$type(),
|
|
340
|
-
// may have fuses (NameWrapper, Wrapped BaseRegistrar)
|
|
341
|
-
fuses: t.integer(),
|
|
342
|
-
// TODO(paymentToken): add payment token tracking here
|
|
343
|
-
// may have base cost (BaseRegistrar, ENSv2Registrar)
|
|
344
|
-
base: t.bigint(),
|
|
345
|
-
// may have a premium (BaseRegistrar)
|
|
346
|
-
premium: t.bigint(),
|
|
347
|
-
// may be Wrapped (BaseRegistrar)
|
|
348
|
-
wrapped: t.boolean().default(false),
|
|
349
|
-
// has an event
|
|
350
|
-
eventId: t.text().notNull()
|
|
351
|
-
}),
|
|
352
|
-
(t) => ({
|
|
353
|
-
byId: uniqueIndex().on(t.domainId, t.registrationIndex)
|
|
354
|
-
})
|
|
355
|
-
);
|
|
356
|
-
var registration_relations = relations(registration, ({ one, many }) => ({
|
|
357
|
-
// belongs to a domain
|
|
358
|
-
domain: one(domain, {
|
|
359
|
-
fields: [registration.domainId],
|
|
360
|
-
references: [domain.id]
|
|
361
|
-
}),
|
|
362
|
-
// has one registrant
|
|
363
|
-
registrant: one(account, {
|
|
364
|
-
fields: [registration.registrantId],
|
|
365
|
-
references: [account.id],
|
|
366
|
-
relationName: "registrant"
|
|
367
|
-
}),
|
|
368
|
-
// has a latest registration index
|
|
369
|
-
latestRegistrationIndex: one(latestRegistrationIndex),
|
|
370
|
-
// has a latest renewal index
|
|
371
|
-
latestRenewalIndex: one(latestRenewalIndex),
|
|
372
|
-
// has one unregistrant
|
|
373
|
-
unregistrant: one(account, {
|
|
374
|
-
fields: [registration.unregistrantId],
|
|
375
|
-
references: [account.id],
|
|
376
|
-
relationName: "unregistrant"
|
|
377
|
-
}),
|
|
378
|
-
// has many renewals
|
|
379
|
-
renewals: many(renewal),
|
|
380
|
-
// has an event
|
|
381
|
-
event: one(event, {
|
|
382
|
-
fields: [registration.eventId],
|
|
383
|
-
references: [event.id]
|
|
384
|
-
})
|
|
385
|
-
}));
|
|
386
|
-
var latestRegistrationIndex = onchainTable("latest_registration_indexes", (t) => ({
|
|
387
|
-
domainId: t.text().primaryKey().$type(),
|
|
388
|
-
registrationIndex: t.integer().notNull()
|
|
389
|
-
}));
|
|
390
|
-
var latestRegistrationIndex_relations = relations(latestRegistrationIndex, ({ one }) => ({
|
|
391
|
-
// references domain
|
|
392
|
-
domain: one(domain, {
|
|
393
|
-
fields: [latestRegistrationIndex.domainId],
|
|
394
|
-
references: [domain.id]
|
|
395
|
-
})
|
|
396
|
-
}));
|
|
397
|
-
var renewal = onchainTable(
|
|
398
|
-
"renewals",
|
|
399
|
-
(t) => ({
|
|
400
|
-
// keyed by (registrationId, index)
|
|
401
|
-
id: t.text().primaryKey().$type(),
|
|
402
|
-
domainId: t.text().notNull().$type(),
|
|
403
|
-
registrationIndex: t.integer().notNull(),
|
|
404
|
-
renewalIndex: t.integer().notNull(),
|
|
405
|
-
// all renewals have a duration
|
|
406
|
-
duration: t.bigint().notNull(),
|
|
407
|
-
// may have a referrer
|
|
408
|
-
referrer: t.hex().$type(),
|
|
409
|
-
// TODO(paymentToken): add payment token tracking here
|
|
410
|
-
// may have base cost
|
|
411
|
-
base: t.bigint(),
|
|
412
|
-
// may have a premium (ENSv1 RegistrarControllers)
|
|
413
|
-
premium: t.bigint(),
|
|
414
|
-
// has an event
|
|
415
|
-
eventId: t.text().notNull()
|
|
416
|
-
}),
|
|
417
|
-
(t) => ({
|
|
418
|
-
byId: uniqueIndex().on(t.domainId, t.registrationIndex, t.renewalIndex)
|
|
419
|
-
})
|
|
420
|
-
);
|
|
421
|
-
var renewal_relations = relations(renewal, ({ one }) => ({
|
|
422
|
-
// belongs to registration
|
|
423
|
-
registration: one(registration, {
|
|
424
|
-
fields: [renewal.domainId, renewal.registrationIndex],
|
|
425
|
-
references: [registration.domainId, registration.registrationIndex]
|
|
426
|
-
}),
|
|
427
|
-
// has an event
|
|
428
|
-
event: one(event, {
|
|
429
|
-
fields: [renewal.eventId],
|
|
430
|
-
references: [event.id]
|
|
431
|
-
})
|
|
432
|
-
}));
|
|
433
|
-
var latestRenewalIndex = onchainTable(
|
|
434
|
-
"latest_renewal_indexes",
|
|
435
|
-
(t) => ({
|
|
436
|
-
domainId: t.text().notNull().$type(),
|
|
437
|
-
registrationIndex: t.integer().notNull(),
|
|
438
|
-
renewalIndex: t.integer().notNull()
|
|
439
|
-
}),
|
|
440
|
-
(t) => ({ pk: primaryKey({ columns: [t.domainId, t.registrationIndex] }) })
|
|
441
|
-
);
|
|
442
|
-
var latestRenewalIndex_relations = relations(latestRenewalIndex, ({ one }) => ({
|
|
443
|
-
// references domain
|
|
444
|
-
domain: one(domain, {
|
|
445
|
-
fields: [latestRenewalIndex.domainId],
|
|
446
|
-
references: [domain.id]
|
|
447
|
-
})
|
|
448
|
-
}));
|
|
449
|
-
var permissions = onchainTable(
|
|
450
|
-
"permissions",
|
|
451
|
-
(t) => ({
|
|
452
|
-
id: t.text().primaryKey().$type(),
|
|
453
|
-
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
454
|
-
address: t.hex().notNull().$type()
|
|
455
|
-
}),
|
|
456
|
-
(t) => ({
|
|
457
|
-
byId: uniqueIndex().on(t.chainId, t.address)
|
|
458
|
-
})
|
|
459
|
-
);
|
|
460
|
-
var relations_permissions = relations(permissions, ({ many }) => ({
|
|
461
|
-
resources: many(permissionsResource),
|
|
462
|
-
users: many(permissionsUser)
|
|
463
|
-
}));
|
|
464
|
-
var permissionsResource = onchainTable(
|
|
465
|
-
"permissions_resources",
|
|
466
|
-
(t) => ({
|
|
467
|
-
id: t.text().primaryKey().$type(),
|
|
468
|
-
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
469
|
-
address: t.hex().notNull().$type(),
|
|
470
|
-
resource: t.bigint().notNull()
|
|
471
|
-
}),
|
|
472
|
-
(t) => ({
|
|
473
|
-
byId: uniqueIndex().on(t.chainId, t.address, t.resource)
|
|
474
|
-
})
|
|
475
|
-
);
|
|
476
|
-
var relations_permissionsResource = relations(permissionsResource, ({ one }) => ({
|
|
477
|
-
permissions: one(permissions, {
|
|
478
|
-
fields: [permissionsResource.chainId, permissionsResource.address],
|
|
479
|
-
references: [permissions.chainId, permissions.address]
|
|
480
|
-
})
|
|
481
|
-
}));
|
|
482
|
-
var permissionsUser = onchainTable(
|
|
483
|
-
"permissions_users",
|
|
484
|
-
(t) => ({
|
|
485
|
-
id: t.text().primaryKey().$type(),
|
|
486
|
-
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
487
|
-
address: t.hex().notNull().$type(),
|
|
488
|
-
resource: t.bigint().notNull(),
|
|
489
|
-
// The user/grantee address this Permission is granted to (the HCA account address if used).
|
|
490
|
-
user: t.hex().notNull().$type(),
|
|
491
|
-
// has one roles bitmap
|
|
492
|
-
roles: t.bigint().notNull()
|
|
493
|
-
}),
|
|
494
|
-
(t) => ({
|
|
495
|
-
byId: uniqueIndex().on(t.chainId, t.address, t.resource, t.user)
|
|
496
|
-
})
|
|
497
|
-
);
|
|
498
|
-
var relations_permissionsUser = relations(permissionsUser, ({ one }) => ({
|
|
499
|
-
account: one(account, {
|
|
500
|
-
fields: [permissionsUser.user],
|
|
501
|
-
references: [account.id]
|
|
502
|
-
}),
|
|
503
|
-
permissions: one(permissions, {
|
|
504
|
-
fields: [permissionsUser.chainId, permissionsUser.address],
|
|
505
|
-
references: [permissions.chainId, permissions.address]
|
|
506
|
-
}),
|
|
507
|
-
resource: one(permissionsResource, {
|
|
508
|
-
fields: [permissionsUser.chainId, permissionsUser.address, permissionsUser.resource],
|
|
509
|
-
references: [
|
|
510
|
-
permissionsResource.chainId,
|
|
511
|
-
permissionsResource.address,
|
|
512
|
-
permissionsResource.resource
|
|
513
|
-
]
|
|
514
|
-
})
|
|
515
|
-
}));
|
|
516
|
-
var label = onchainTable(
|
|
517
|
-
"labels",
|
|
518
|
-
(t) => ({
|
|
519
|
-
labelHash: t.hex().primaryKey().$type(),
|
|
520
|
-
interpreted: t.text().notNull().$type()
|
|
521
|
-
}),
|
|
522
|
-
(t) => ({
|
|
523
|
-
byInterpreted: index().on(t.interpreted)
|
|
524
|
-
})
|
|
525
|
-
);
|
|
526
|
-
var label_relations = relations(label, ({ many }) => ({
|
|
527
|
-
domains: many(domain)
|
|
528
|
-
}));
|
|
529
|
-
|
|
530
|
-
// src/ensindexer-abstract/migrated-nodes.schema.ts
|
|
531
|
-
import { onchainTable as onchainTable2, primaryKey as primaryKey2 } from "ponder";
|
|
532
|
-
var migratedNodeByParent = onchainTable2(
|
|
533
|
-
"migrated_nodes_by_parent",
|
|
534
|
-
(t) => ({
|
|
535
|
-
// keyed by (parentNode, labelHash)
|
|
536
|
-
parentNode: t.hex().notNull().$type(),
|
|
537
|
-
labelHash: t.hex().notNull().$type()
|
|
538
|
-
}),
|
|
539
|
-
(t) => ({
|
|
540
|
-
pk: primaryKey2({ columns: [t.parentNode, t.labelHash] })
|
|
541
|
-
})
|
|
542
|
-
);
|
|
543
|
-
var migratedNodeByNode = onchainTable2("migrated_nodes_by_node", (t) => ({
|
|
544
|
-
node: t.hex().primaryKey().$type()
|
|
545
|
-
}));
|
|
546
|
-
|
|
547
|
-
// src/ensindexer-abstract/protocol-acceleration.schema.ts
|
|
548
|
-
import { onchainTable as onchainTable3, primaryKey as primaryKey3, relations as relations2, uniqueIndex as uniqueIndex2 } from "ponder";
|
|
549
|
-
var reverseNameRecord = onchainTable3(
|
|
550
|
-
"reverse_name_records",
|
|
551
|
-
(t) => ({
|
|
552
|
-
// keyed by (address, coinType)
|
|
553
|
-
address: t.hex().notNull().$type(),
|
|
554
|
-
coinType: t.bigint().notNull(),
|
|
555
|
-
/**
|
|
556
|
-
* Represents the ENSIP-19 Reverse Name Record for a given (address, coinType).
|
|
557
|
-
*
|
|
558
|
-
* The value of this field is guaranteed to be a non-empty {@link InterpretedName}.
|
|
559
|
-
*/
|
|
560
|
-
value: t.text().notNull().$type()
|
|
561
|
-
}),
|
|
562
|
-
(t) => ({
|
|
563
|
-
pk: primaryKey3({ columns: [t.address, t.coinType] })
|
|
564
|
-
})
|
|
565
|
-
);
|
|
566
|
-
var domainResolverRelation = onchainTable3(
|
|
567
|
-
"domain_resolver_relations",
|
|
568
|
-
(t) => ({
|
|
569
|
-
// keyed by (chainId, address, node)
|
|
570
|
-
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
571
|
-
// The Registry (ENSv1Registry or ENSv2Registry)'s AccountId.
|
|
572
|
-
address: t.hex().notNull().$type(),
|
|
573
|
-
domainId: t.text().notNull().$type(),
|
|
574
|
-
// The Domain's assigned Resolver's address (NOTE: always scoped to chainId)
|
|
575
|
-
resolver: t.hex().notNull().$type()
|
|
576
|
-
}),
|
|
577
|
-
(t) => ({
|
|
578
|
-
pk: primaryKey3({ columns: [t.chainId, t.address, t.domainId] })
|
|
579
|
-
})
|
|
580
|
-
);
|
|
581
|
-
var domainResolverRelation_relations = relations2(domainResolverRelation, ({ one }) => ({
|
|
582
|
-
resolver: one(resolver, {
|
|
583
|
-
fields: [domainResolverRelation.chainId, domainResolverRelation.resolver],
|
|
584
|
-
references: [resolver.chainId, resolver.address]
|
|
585
|
-
})
|
|
586
|
-
}));
|
|
587
|
-
var resolver = onchainTable3(
|
|
588
|
-
"resolvers",
|
|
589
|
-
(t) => ({
|
|
590
|
-
// keyed by (chainId, address)
|
|
591
|
-
id: t.text().primaryKey().$type(),
|
|
592
|
-
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
593
|
-
address: t.hex().notNull().$type()
|
|
594
|
-
}),
|
|
595
|
-
(t) => ({
|
|
596
|
-
byId: uniqueIndex2().on(t.chainId, t.address)
|
|
597
|
-
})
|
|
598
|
-
);
|
|
599
|
-
var resolver_relations = relations2(resolver, ({ many }) => ({
|
|
600
|
-
records: many(resolverRecords)
|
|
601
|
-
}));
|
|
602
|
-
var resolverRecords = onchainTable3(
|
|
603
|
-
"resolver_records",
|
|
604
|
-
(t) => ({
|
|
605
|
-
// keyed by (chainId, resolver, node)
|
|
606
|
-
id: t.text().primaryKey().$type(),
|
|
607
|
-
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
608
|
-
address: t.hex().notNull().$type(),
|
|
609
|
-
node: t.hex().notNull().$type(),
|
|
610
|
-
/**
|
|
611
|
-
* Represents the value of the reverse-resolution (ENSIP-3) name() record, used for Reverse Resolution.
|
|
612
|
-
*
|
|
613
|
-
* If present, the value of this field is guaranteed to be a non-empty {@link InterpretedName}.
|
|
614
|
-
*/
|
|
615
|
-
name: t.text().$type(),
|
|
616
|
-
/**
|
|
617
|
-
* ENSIP-7 contenthash raw bytes or null if not set.
|
|
618
|
-
*/
|
|
619
|
-
contenthash: t.hex(),
|
|
620
|
-
/**
|
|
621
|
-
* PubkeyResolver (x, y) pair, or null if not set.
|
|
622
|
-
*
|
|
623
|
-
* Invariant: both null together, or both set together.
|
|
624
|
-
*/
|
|
625
|
-
pubkeyX: t.hex(),
|
|
626
|
-
pubkeyY: t.hex(),
|
|
627
|
-
/**
|
|
628
|
-
* IDNSZoneResolver zonehash or null if not set.
|
|
629
|
-
*/
|
|
630
|
-
dnszonehash: t.hex(),
|
|
631
|
-
/**
|
|
632
|
-
* IVersionableResolver version. Null when no `VersionChanged` event has been seen for this
|
|
633
|
-
* (chainId, address, node) — the resolver may not implement `IVersionableResolver`, or simply
|
|
634
|
-
* may never have been version-bumped. Consumers should treat null as "unknown" rather than 0.
|
|
635
|
-
*/
|
|
636
|
-
version: t.bigint().$type()
|
|
637
|
-
}),
|
|
638
|
-
(t) => ({
|
|
639
|
-
byId: uniqueIndex2().on(t.chainId, t.address, t.node)
|
|
640
|
-
})
|
|
641
|
-
);
|
|
642
|
-
var resolverRecords_relations = relations2(resolverRecords, ({ one, many }) => ({
|
|
643
|
-
// belongs to resolver
|
|
644
|
-
resolver: one(resolver, {
|
|
645
|
-
fields: [resolverRecords.chainId, resolverRecords.address],
|
|
646
|
-
references: [resolver.chainId, resolver.address]
|
|
647
|
-
}),
|
|
648
|
-
// resolverRecord has many address records
|
|
649
|
-
addressRecords: many(resolverAddressRecord),
|
|
650
|
-
// resolverRecord has many text records
|
|
651
|
-
textRecords: many(resolverTextRecord)
|
|
652
|
-
}));
|
|
653
|
-
var resolverAddressRecord = onchainTable3(
|
|
654
|
-
"resolver_address_records",
|
|
655
|
-
(t) => ({
|
|
656
|
-
// keyed by ((chainId, resolver, node), coinType)
|
|
657
|
-
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
658
|
-
address: t.hex().notNull().$type(),
|
|
659
|
-
node: t.hex().notNull().$type(),
|
|
660
|
-
// NOTE: all well-known CoinTypes fit into javascript number but NOT postgres .integer, must be
|
|
661
|
-
// stored as BigInt
|
|
662
|
-
coinType: t.bigint().notNull(),
|
|
663
|
-
/**
|
|
664
|
-
* Represents the value of the Addresss Record specified by ((chainId, resolver, node), coinType).
|
|
665
|
-
*
|
|
666
|
-
* The value of this field is interpreted by `interpretAddressRecordValue` — see its implementation
|
|
667
|
-
* for additional context and specific guarantees.
|
|
668
|
-
*/
|
|
669
|
-
value: t.text().notNull()
|
|
670
|
-
}),
|
|
671
|
-
(t) => ({
|
|
672
|
-
pk: primaryKey3({ columns: [t.chainId, t.address, t.node, t.coinType] })
|
|
673
|
-
})
|
|
674
|
-
);
|
|
675
|
-
var resolverAddressRecordRelations = relations2(resolverAddressRecord, ({ one }) => ({
|
|
676
|
-
// belongs to resolverRecord
|
|
677
|
-
resolver: one(resolverRecords, {
|
|
678
|
-
fields: [
|
|
679
|
-
resolverAddressRecord.chainId,
|
|
680
|
-
resolverAddressRecord.address,
|
|
681
|
-
resolverAddressRecord.node
|
|
682
|
-
],
|
|
683
|
-
references: [resolverRecords.chainId, resolverRecords.address, resolverRecords.node]
|
|
684
|
-
})
|
|
685
|
-
}));
|
|
686
|
-
var resolverTextRecord = onchainTable3(
|
|
687
|
-
"resolver_text_records",
|
|
688
|
-
(t) => ({
|
|
689
|
-
// keyed by ((chainId, resolver, node), key)
|
|
690
|
-
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
691
|
-
address: t.hex().notNull().$type(),
|
|
692
|
-
node: t.hex().notNull().$type(),
|
|
693
|
-
key: t.text().notNull(),
|
|
694
|
-
/**
|
|
695
|
-
* Represents the value of the Text Record specified by ((chainId, resolver, node), key).
|
|
696
|
-
*
|
|
697
|
-
* The value of this field is interpreted by `interpretTextRecordValue` — see its implementation
|
|
698
|
-
* for additional context and specific guarantees.
|
|
699
|
-
*/
|
|
700
|
-
value: t.text().notNull()
|
|
701
|
-
}),
|
|
702
|
-
(t) => ({
|
|
703
|
-
pk: primaryKey3({ columns: [t.chainId, t.address, t.node, t.key] })
|
|
704
|
-
})
|
|
705
|
-
);
|
|
706
|
-
var resolverTextRecordRelations = relations2(resolverTextRecord, ({ one }) => ({
|
|
707
|
-
// belongs to resolverRecord
|
|
708
|
-
resolver: one(resolverRecords, {
|
|
709
|
-
fields: [resolverTextRecord.chainId, resolverTextRecord.address, resolverTextRecord.node],
|
|
710
|
-
references: [resolverRecords.chainId, resolverRecords.address, resolverRecords.node]
|
|
711
|
-
})
|
|
712
|
-
}));
|
|
713
|
-
|
|
714
|
-
// src/ensindexer-abstract/registrars.schema.ts
|
|
715
|
-
import { index as index2, onchainEnum as onchainEnum2, onchainTable as onchainTable4, relations as relations3, uniqueIndex as uniqueIndex3 } from "ponder";
|
|
716
|
-
var subregistries = onchainTable4(
|
|
717
|
-
"subregistries",
|
|
718
|
-
(t) => ({
|
|
719
|
-
/**
|
|
720
|
-
* Subregistry ID
|
|
721
|
-
*
|
|
722
|
-
* Identifies the chainId and address of the smart contract associated
|
|
723
|
-
* with the subregistry.
|
|
724
|
-
*
|
|
725
|
-
* Guaranteed to be a fully lowercase string formatted according to
|
|
726
|
-
* the CAIP-10 standard.
|
|
727
|
-
*
|
|
728
|
-
* @see https://chainagnostic.org/CAIPs/caip-10
|
|
729
|
-
*/
|
|
730
|
-
subregistryId: t.text().primaryKey(),
|
|
731
|
-
/**
|
|
732
|
-
* The node (namehash) of the name the subregistry manages subnames of.
|
|
733
|
-
* Example subregistry managed names:
|
|
734
|
-
* - `eth`
|
|
735
|
-
* - `base.eth`
|
|
736
|
-
* - `linea.eth`
|
|
737
|
-
*
|
|
738
|
-
* Guaranteed to be a fully lowercase hex string representation of 32-bytes.
|
|
739
|
-
*/
|
|
740
|
-
node: t.hex().notNull()
|
|
741
|
-
}),
|
|
742
|
-
(t) => ({
|
|
743
|
-
uniqueNode: uniqueIndex3().on(t.node)
|
|
744
|
-
})
|
|
745
|
-
);
|
|
746
|
-
var registrationLifecycles = onchainTable4(
|
|
337
|
+
var registrationLifecycles = onchainTable3(
|
|
747
338
|
"registration_lifecycles",
|
|
748
339
|
(t) => ({
|
|
749
340
|
/**
|
|
@@ -779,11 +370,11 @@ var registrationLifecycles = onchainTable4(
|
|
|
779
370
|
bySubregistry: index2().on(t.subregistryId)
|
|
780
371
|
})
|
|
781
372
|
);
|
|
782
|
-
var registrarActionType =
|
|
373
|
+
var registrarActionType = onchainEnum("registrar_action_type", [
|
|
783
374
|
"registration",
|
|
784
375
|
"renewal"
|
|
785
376
|
]);
|
|
786
|
-
var registrarActions =
|
|
377
|
+
var registrarActions = onchainTable3(
|
|
787
378
|
"registrar_actions",
|
|
788
379
|
(t) => ({
|
|
789
380
|
/**
|
|
@@ -1036,11 +627,11 @@ var registrarActions = onchainTable4(
|
|
|
1036
627
|
byTimestamp: index2().on(t.timestamp)
|
|
1037
628
|
})
|
|
1038
629
|
);
|
|
1039
|
-
var internal_registrarActionMetadataType =
|
|
630
|
+
var internal_registrarActionMetadataType = onchainEnum(
|
|
1040
631
|
"_ensindexer_registrar_action_metadata_type",
|
|
1041
632
|
["CURRENT_LOGICAL_REGISTRAR_ACTION"]
|
|
1042
633
|
);
|
|
1043
|
-
var internal_registrarActionMetadata =
|
|
634
|
+
var internal_registrarActionMetadata = onchainTable3(
|
|
1044
635
|
"_ensindexer_registrar_action_metadata",
|
|
1045
636
|
(t) => ({
|
|
1046
637
|
/**
|
|
@@ -1068,10 +659,10 @@ var internal_registrarActionMetadata = onchainTable4(
|
|
|
1068
659
|
logicalEventId: t.text().notNull()
|
|
1069
660
|
})
|
|
1070
661
|
);
|
|
1071
|
-
var subregistryRelations =
|
|
662
|
+
var subregistryRelations = relations2(subregistries, ({ many }) => ({
|
|
1072
663
|
registrationLifecycle: many(registrationLifecycles)
|
|
1073
664
|
}));
|
|
1074
|
-
var registrationLifecycleRelations =
|
|
665
|
+
var registrationLifecycleRelations = relations2(
|
|
1075
666
|
registrationLifecycles,
|
|
1076
667
|
({ one, many }) => ({
|
|
1077
668
|
subregistry: one(subregistries, {
|
|
@@ -1081,7 +672,7 @@ var registrationLifecycleRelations = relations3(
|
|
|
1081
672
|
registrarAction: many(registrarActions)
|
|
1082
673
|
})
|
|
1083
674
|
);
|
|
1084
|
-
var registrarActionRelations =
|
|
675
|
+
var registrarActionRelations = relations2(registrarActions, ({ one }) => ({
|
|
1085
676
|
registrationLifecycle: one(registrationLifecycles, {
|
|
1086
677
|
fields: [registrarActions.node],
|
|
1087
678
|
references: [registrationLifecycles.node]
|
|
@@ -1089,7 +680,7 @@ var registrarActionRelations = relations3(registrarActions, ({ one }) => ({
|
|
|
1089
680
|
}));
|
|
1090
681
|
|
|
1091
682
|
// src/ensindexer-abstract/subgraph.schema.ts
|
|
1092
|
-
import { index as index3, onchainTable as
|
|
683
|
+
import { index as index3, onchainTable as onchainTable4, relations as relations3, sql } from "ponder";
|
|
1093
684
|
|
|
1094
685
|
// src/lib/collate.ts
|
|
1095
686
|
function monkeypatchCollate(col, collation) {
|
|
@@ -1100,7 +691,7 @@ function monkeypatchCollate(col, collation) {
|
|
|
1100
691
|
}
|
|
1101
692
|
|
|
1102
693
|
// src/ensindexer-abstract/subgraph.schema.ts
|
|
1103
|
-
var subgraph_domain =
|
|
694
|
+
var subgraph_domain = onchainTable4(
|
|
1104
695
|
"subgraph_domains",
|
|
1105
696
|
(t) => ({
|
|
1106
697
|
// The namehash of the name
|
|
@@ -1174,7 +765,7 @@ var subgraph_domain = onchainTable5(
|
|
|
1174
765
|
// GIN trigram index for partial-match filters (_contains, _starts_with, _ends_with).
|
|
1175
766
|
// (inline `gin_trgm_ops` via `sql` because passing it through `.op()` gets dropped by Ponder,
|
|
1176
767
|
// producing `USING gin (name)` with no opclass)
|
|
1177
|
-
byFuzzyName: index3().using("gin",
|
|
768
|
+
byFuzzyName: index3().using("gin", sql`${t.name} gin_trgm_ops`),
|
|
1178
769
|
byLabelhash: index3().on(t.labelhash),
|
|
1179
770
|
byParentId: index3().on(t.parentId),
|
|
1180
771
|
byOwnerId: index3().on(t.ownerId),
|
|
@@ -1185,7 +776,7 @@ var subgraph_domain = onchainTable5(
|
|
|
1185
776
|
);
|
|
1186
777
|
monkeypatchCollate(subgraph_domain.name, '"C"');
|
|
1187
778
|
monkeypatchCollate(subgraph_domain.labelName, '"C"');
|
|
1188
|
-
var subgraph_domainRelations =
|
|
779
|
+
var subgraph_domainRelations = relations3(subgraph_domain, ({ one, many }) => ({
|
|
1189
780
|
resolvedAddress: one(subgraph_account, {
|
|
1190
781
|
fields: [subgraph_domain.resolvedAddressId],
|
|
1191
782
|
references: [subgraph_account.id]
|
|
@@ -1230,15 +821,15 @@ var subgraph_domainRelations = relations4(subgraph_domain, ({ one, many }) => ({
|
|
|
1230
821
|
fusesSets: many(subgraph_fusesSet),
|
|
1231
822
|
expiryExtendeds: many(subgraph_expiryExtended)
|
|
1232
823
|
}));
|
|
1233
|
-
var subgraph_account =
|
|
824
|
+
var subgraph_account = onchainTable4("subgraph_accounts", (t) => ({
|
|
1234
825
|
id: t.hex().primaryKey()
|
|
1235
826
|
}));
|
|
1236
|
-
var subgraph_accountRelations =
|
|
827
|
+
var subgraph_accountRelations = relations3(subgraph_account, ({ many }) => ({
|
|
1237
828
|
domains: many(subgraph_domain),
|
|
1238
829
|
wrappedDomains: many(subgraph_wrappedDomain),
|
|
1239
830
|
registrations: many(subgraph_registration)
|
|
1240
831
|
}));
|
|
1241
|
-
var subgraph_resolver =
|
|
832
|
+
var subgraph_resolver = onchainTable4(
|
|
1242
833
|
"subgraph_resolvers",
|
|
1243
834
|
(t) => ({
|
|
1244
835
|
// The unique identifier for this resolver, which is a concatenation of the domain namehash and the resolver address
|
|
@@ -1262,7 +853,7 @@ var subgraph_resolver = onchainTable5(
|
|
|
1262
853
|
byDomainId: index3().on(t.domainId)
|
|
1263
854
|
})
|
|
1264
855
|
);
|
|
1265
|
-
var subgraph_resolverRelations =
|
|
856
|
+
var subgraph_resolverRelations = relations3(subgraph_resolver, ({ one, many }) => ({
|
|
1266
857
|
addr: one(subgraph_account, {
|
|
1267
858
|
fields: [subgraph_resolver.addrId],
|
|
1268
859
|
references: [subgraph_account.id]
|
|
@@ -1283,7 +874,7 @@ var subgraph_resolverRelations = relations4(subgraph_resolver, ({ one, many }) =
|
|
|
1283
874
|
authorisationChangeds: many(subgraph_authorisationChanged),
|
|
1284
875
|
versionChangeds: many(subgraph_versionChanged)
|
|
1285
876
|
}));
|
|
1286
|
-
var subgraph_registration =
|
|
877
|
+
var subgraph_registration = onchainTable4(
|
|
1287
878
|
"subgraph_registrations",
|
|
1288
879
|
(t) => ({
|
|
1289
880
|
// The unique identifier of the registration
|
|
@@ -1325,7 +916,7 @@ var subgraph_registration = onchainTable5(
|
|
|
1325
916
|
byExpiryDate: index3().on(t.expiryDate)
|
|
1326
917
|
})
|
|
1327
918
|
);
|
|
1328
|
-
var subgraph_registrationRelations =
|
|
919
|
+
var subgraph_registrationRelations = relations3(subgraph_registration, ({ one, many }) => ({
|
|
1329
920
|
domain: one(subgraph_domain, {
|
|
1330
921
|
fields: [subgraph_registration.domainId],
|
|
1331
922
|
references: [subgraph_domain.id]
|
|
@@ -1339,7 +930,7 @@ var subgraph_registrationRelations = relations4(subgraph_registration, ({ one, m
|
|
|
1339
930
|
nameReneweds: many(subgraph_nameRenewed),
|
|
1340
931
|
nameTransferreds: many(subgraph_nameTransferred)
|
|
1341
932
|
}));
|
|
1342
|
-
var subgraph_wrappedDomain =
|
|
933
|
+
var subgraph_wrappedDomain = onchainTable4(
|
|
1343
934
|
"subgraph_wrapped_domains",
|
|
1344
935
|
(t) => ({
|
|
1345
936
|
// The unique identifier for each instance of the WrappedDomain entity
|
|
@@ -1374,605 +965,1082 @@ var subgraph_wrappedDomain = onchainTable5(
|
|
|
1374
965
|
byDomainId: index3().on(t.domainId)
|
|
1375
966
|
})
|
|
1376
967
|
);
|
|
1377
|
-
var subgraph_wrappedDomainRelations =
|
|
968
|
+
var subgraph_wrappedDomainRelations = relations3(subgraph_wrappedDomain, ({ one }) => ({
|
|
969
|
+
domain: one(subgraph_domain, {
|
|
970
|
+
fields: [subgraph_wrappedDomain.domainId],
|
|
971
|
+
references: [subgraph_domain.id]
|
|
972
|
+
}),
|
|
973
|
+
owner: one(subgraph_account, {
|
|
974
|
+
fields: [subgraph_wrappedDomain.ownerId],
|
|
975
|
+
references: [subgraph_account.id]
|
|
976
|
+
})
|
|
977
|
+
}));
|
|
978
|
+
var sharedEventColumns = (t) => ({
|
|
979
|
+
id: t.text().primaryKey(),
|
|
980
|
+
blockNumber: t.integer().notNull(),
|
|
981
|
+
transactionID: t.hex().notNull()
|
|
982
|
+
});
|
|
983
|
+
var domainEvent = (t) => ({
|
|
984
|
+
...sharedEventColumns(t),
|
|
985
|
+
domainId: t.hex().notNull()
|
|
986
|
+
});
|
|
987
|
+
var domainEventIndex = (t) => ({
|
|
988
|
+
// primary reverse lookup
|
|
989
|
+
idx: index3().on(t.domainId),
|
|
990
|
+
// sorting index
|
|
991
|
+
idx_compound: index3().on(t.domainId, t.id)
|
|
992
|
+
});
|
|
993
|
+
var subgraph_transfer = onchainTable4(
|
|
994
|
+
"subgraph_transfers",
|
|
995
|
+
(t) => ({
|
|
996
|
+
...domainEvent(t),
|
|
997
|
+
ownerId: t.hex().notNull()
|
|
998
|
+
}),
|
|
999
|
+
domainEventIndex
|
|
1000
|
+
);
|
|
1001
|
+
var subgraph_newOwner = onchainTable4(
|
|
1002
|
+
"subgraph_new_owners",
|
|
1003
|
+
(t) => ({
|
|
1004
|
+
...domainEvent(t),
|
|
1005
|
+
ownerId: t.hex().notNull(),
|
|
1006
|
+
parentDomainId: t.hex().notNull()
|
|
1007
|
+
}),
|
|
1008
|
+
domainEventIndex
|
|
1009
|
+
);
|
|
1010
|
+
var subgraph_newResolver = onchainTable4(
|
|
1011
|
+
"subgraph_new_resolvers",
|
|
1012
|
+
(t) => ({
|
|
1013
|
+
...domainEvent(t),
|
|
1014
|
+
resolverId: t.text().notNull()
|
|
1015
|
+
}),
|
|
1016
|
+
domainEventIndex
|
|
1017
|
+
);
|
|
1018
|
+
var subgraph_newTTL = onchainTable4(
|
|
1019
|
+
"subgraph_new_ttls",
|
|
1020
|
+
(t) => ({
|
|
1021
|
+
...domainEvent(t),
|
|
1022
|
+
ttl: t.bigint().notNull()
|
|
1023
|
+
}),
|
|
1024
|
+
domainEventIndex
|
|
1025
|
+
);
|
|
1026
|
+
var subgraph_wrappedTransfer = onchainTable4(
|
|
1027
|
+
"subgraph_wrapped_transfers",
|
|
1028
|
+
(t) => ({
|
|
1029
|
+
...domainEvent(t),
|
|
1030
|
+
ownerId: t.hex().notNull()
|
|
1031
|
+
}),
|
|
1032
|
+
domainEventIndex
|
|
1033
|
+
);
|
|
1034
|
+
var subgraph_nameWrapped = onchainTable4(
|
|
1035
|
+
"subgraph_name_wrapped",
|
|
1036
|
+
(t) => ({
|
|
1037
|
+
...domainEvent(t),
|
|
1038
|
+
name: t.text(),
|
|
1039
|
+
fuses: t.integer().notNull(),
|
|
1040
|
+
ownerId: t.hex().notNull(),
|
|
1041
|
+
expiryDate: t.bigint().notNull()
|
|
1042
|
+
}),
|
|
1043
|
+
domainEventIndex
|
|
1044
|
+
);
|
|
1045
|
+
var subgraph_nameUnwrapped = onchainTable4(
|
|
1046
|
+
"subgraph_name_unwrapped",
|
|
1047
|
+
(t) => ({
|
|
1048
|
+
...domainEvent(t),
|
|
1049
|
+
ownerId: t.hex().notNull()
|
|
1050
|
+
}),
|
|
1051
|
+
domainEventIndex
|
|
1052
|
+
);
|
|
1053
|
+
var subgraph_fusesSet = onchainTable4(
|
|
1054
|
+
"subgraph_fuses_set",
|
|
1055
|
+
(t) => ({
|
|
1056
|
+
...domainEvent(t),
|
|
1057
|
+
fuses: t.integer().notNull()
|
|
1058
|
+
}),
|
|
1059
|
+
domainEventIndex
|
|
1060
|
+
);
|
|
1061
|
+
var subgraph_expiryExtended = onchainTable4(
|
|
1062
|
+
"subgraph_expiry_extended",
|
|
1063
|
+
(t) => ({
|
|
1064
|
+
...domainEvent(t),
|
|
1065
|
+
expiryDate: t.bigint().notNull()
|
|
1066
|
+
}),
|
|
1067
|
+
domainEventIndex
|
|
1068
|
+
);
|
|
1069
|
+
var registrationEvent = (t) => ({
|
|
1070
|
+
...sharedEventColumns(t),
|
|
1071
|
+
registrationId: t.hex().notNull()
|
|
1072
|
+
});
|
|
1073
|
+
var registrationEventIndex = (t) => ({
|
|
1074
|
+
// primary reverse lookup
|
|
1075
|
+
idx: index3().on(t.registrationId),
|
|
1076
|
+
// sorting index
|
|
1077
|
+
idx_compound: index3().on(t.registrationId, t.id)
|
|
1078
|
+
});
|
|
1079
|
+
var subgraph_nameRegistered = onchainTable4(
|
|
1080
|
+
"subgraph_name_registered",
|
|
1081
|
+
(t) => ({
|
|
1082
|
+
...registrationEvent(t),
|
|
1083
|
+
registrantId: t.hex().notNull(),
|
|
1084
|
+
expiryDate: t.bigint().notNull()
|
|
1085
|
+
}),
|
|
1086
|
+
registrationEventIndex
|
|
1087
|
+
);
|
|
1088
|
+
var subgraph_nameRenewed = onchainTable4(
|
|
1089
|
+
"subgraph_name_renewed",
|
|
1090
|
+
(t) => ({
|
|
1091
|
+
...registrationEvent(t),
|
|
1092
|
+
expiryDate: t.bigint().notNull()
|
|
1093
|
+
}),
|
|
1094
|
+
registrationEventIndex
|
|
1095
|
+
);
|
|
1096
|
+
var subgraph_nameTransferred = onchainTable4(
|
|
1097
|
+
"subgraph_name_transferred",
|
|
1098
|
+
(t) => ({
|
|
1099
|
+
...registrationEvent(t),
|
|
1100
|
+
newOwnerId: t.hex().notNull()
|
|
1101
|
+
}),
|
|
1102
|
+
registrationEventIndex
|
|
1103
|
+
);
|
|
1104
|
+
var resolverEvent = (t) => ({
|
|
1105
|
+
...sharedEventColumns(t),
|
|
1106
|
+
resolverId: t.text().notNull()
|
|
1107
|
+
});
|
|
1108
|
+
var resolverEventIndex = (t) => ({
|
|
1109
|
+
// primary reverse lookup
|
|
1110
|
+
idx: index3().on(t.resolverId),
|
|
1111
|
+
// sorting index
|
|
1112
|
+
idx_compound: index3().on(t.resolverId, t.id)
|
|
1113
|
+
});
|
|
1114
|
+
var subgraph_addrChanged = onchainTable4(
|
|
1115
|
+
"subgraph_addr_changed",
|
|
1116
|
+
(t) => ({
|
|
1117
|
+
...resolverEvent(t),
|
|
1118
|
+
addrId: t.hex().notNull()
|
|
1119
|
+
}),
|
|
1120
|
+
resolverEventIndex
|
|
1121
|
+
);
|
|
1122
|
+
var subgraph_multicoinAddrChanged = onchainTable4(
|
|
1123
|
+
"subgraph_multicoin_addr_changed",
|
|
1124
|
+
(t) => ({
|
|
1125
|
+
...resolverEvent(t),
|
|
1126
|
+
coinType: t.bigint().notNull(),
|
|
1127
|
+
addr: t.hex().notNull()
|
|
1128
|
+
}),
|
|
1129
|
+
resolverEventIndex
|
|
1130
|
+
);
|
|
1131
|
+
var subgraph_nameChanged = onchainTable4(
|
|
1132
|
+
"subgraph_name_changed",
|
|
1133
|
+
(t) => ({
|
|
1134
|
+
...resolverEvent(t),
|
|
1135
|
+
name: t.text().notNull()
|
|
1136
|
+
}),
|
|
1137
|
+
resolverEventIndex
|
|
1138
|
+
);
|
|
1139
|
+
var subgraph_abiChanged = onchainTable4(
|
|
1140
|
+
"subgraph_abi_changed",
|
|
1141
|
+
(t) => ({
|
|
1142
|
+
...resolverEvent(t),
|
|
1143
|
+
contentType: t.bigint().notNull()
|
|
1144
|
+
}),
|
|
1145
|
+
resolverEventIndex
|
|
1146
|
+
);
|
|
1147
|
+
var subgraph_pubkeyChanged = onchainTable4(
|
|
1148
|
+
"subgraph_pubkey_changed",
|
|
1149
|
+
(t) => ({
|
|
1150
|
+
...resolverEvent(t),
|
|
1151
|
+
x: t.hex().notNull(),
|
|
1152
|
+
y: t.hex().notNull()
|
|
1153
|
+
}),
|
|
1154
|
+
resolverEventIndex
|
|
1155
|
+
);
|
|
1156
|
+
var subgraph_textChanged = onchainTable4(
|
|
1157
|
+
"subgraph_text_changed",
|
|
1158
|
+
(t) => ({
|
|
1159
|
+
...resolverEvent(t),
|
|
1160
|
+
key: t.text().notNull(),
|
|
1161
|
+
value: t.text()
|
|
1162
|
+
}),
|
|
1163
|
+
resolverEventIndex
|
|
1164
|
+
);
|
|
1165
|
+
var subgraph_contenthashChanged = onchainTable4(
|
|
1166
|
+
"subgraph_contenthash_changed",
|
|
1167
|
+
(t) => ({
|
|
1168
|
+
...resolverEvent(t),
|
|
1169
|
+
hash: t.hex().notNull()
|
|
1170
|
+
}),
|
|
1171
|
+
resolverEventIndex
|
|
1172
|
+
);
|
|
1173
|
+
var subgraph_interfaceChanged = onchainTable4(
|
|
1174
|
+
"subgraph_interface_changed",
|
|
1175
|
+
(t) => ({
|
|
1176
|
+
...resolverEvent(t),
|
|
1177
|
+
interfaceID: t.hex().notNull(),
|
|
1178
|
+
implementer: t.hex().notNull()
|
|
1179
|
+
}),
|
|
1180
|
+
resolverEventIndex
|
|
1181
|
+
);
|
|
1182
|
+
var subgraph_authorisationChanged = onchainTable4(
|
|
1183
|
+
"subgraph_authorisation_changed",
|
|
1184
|
+
(t) => ({
|
|
1185
|
+
...resolverEvent(t),
|
|
1186
|
+
owner: t.hex().notNull(),
|
|
1187
|
+
target: t.hex().notNull(),
|
|
1188
|
+
isAuthorized: t.boolean().notNull()
|
|
1189
|
+
}),
|
|
1190
|
+
resolverEventIndex
|
|
1191
|
+
);
|
|
1192
|
+
var subgraph_versionChanged = onchainTable4(
|
|
1193
|
+
"subgraph_version_changed",
|
|
1194
|
+
(t) => ({
|
|
1195
|
+
...resolverEvent(t),
|
|
1196
|
+
version: t.bigint().notNull()
|
|
1197
|
+
}),
|
|
1198
|
+
resolverEventIndex
|
|
1199
|
+
);
|
|
1200
|
+
var subgraph_transferRelations = relations3(subgraph_transfer, ({ one }) => ({
|
|
1201
|
+
domain: one(subgraph_domain, {
|
|
1202
|
+
fields: [subgraph_transfer.domainId],
|
|
1203
|
+
references: [subgraph_domain.id]
|
|
1204
|
+
}),
|
|
1205
|
+
owner: one(subgraph_account, {
|
|
1206
|
+
fields: [subgraph_transfer.ownerId],
|
|
1207
|
+
references: [subgraph_account.id]
|
|
1208
|
+
})
|
|
1209
|
+
}));
|
|
1210
|
+
var subgraph_newOwnerRelations = relations3(subgraph_newOwner, ({ one }) => ({
|
|
1211
|
+
domain: one(subgraph_domain, {
|
|
1212
|
+
fields: [subgraph_newOwner.domainId],
|
|
1213
|
+
references: [subgraph_domain.id]
|
|
1214
|
+
}),
|
|
1215
|
+
owner: one(subgraph_account, {
|
|
1216
|
+
fields: [subgraph_newOwner.ownerId],
|
|
1217
|
+
references: [subgraph_account.id]
|
|
1218
|
+
}),
|
|
1219
|
+
parentDomain: one(subgraph_domain, {
|
|
1220
|
+
fields: [subgraph_newOwner.parentDomainId],
|
|
1221
|
+
references: [subgraph_domain.id]
|
|
1222
|
+
})
|
|
1223
|
+
}));
|
|
1224
|
+
var subgraph_newResolverRelations = relations3(subgraph_newResolver, ({ one }) => ({
|
|
1225
|
+
domain: one(subgraph_domain, {
|
|
1226
|
+
fields: [subgraph_newResolver.domainId],
|
|
1227
|
+
references: [subgraph_domain.id]
|
|
1228
|
+
}),
|
|
1229
|
+
resolver: one(subgraph_resolver, {
|
|
1230
|
+
fields: [subgraph_newResolver.resolverId],
|
|
1231
|
+
references: [subgraph_resolver.id]
|
|
1232
|
+
})
|
|
1233
|
+
}));
|
|
1234
|
+
var subgraph_newTTLRelations = relations3(subgraph_newTTL, ({ one }) => ({
|
|
1235
|
+
domain: one(subgraph_domain, {
|
|
1236
|
+
fields: [subgraph_newTTL.domainId],
|
|
1237
|
+
references: [subgraph_domain.id]
|
|
1238
|
+
})
|
|
1239
|
+
}));
|
|
1240
|
+
var subgraph_wrappedTransferRelations = relations3(subgraph_wrappedTransfer, ({ one }) => ({
|
|
1241
|
+
domain: one(subgraph_domain, {
|
|
1242
|
+
fields: [subgraph_wrappedTransfer.domainId],
|
|
1243
|
+
references: [subgraph_domain.id]
|
|
1244
|
+
}),
|
|
1245
|
+
owner: one(subgraph_account, {
|
|
1246
|
+
fields: [subgraph_wrappedTransfer.ownerId],
|
|
1247
|
+
references: [subgraph_account.id]
|
|
1248
|
+
})
|
|
1249
|
+
}));
|
|
1250
|
+
var subgraph_nameWrappedRelations = relations3(subgraph_nameWrapped, ({ one }) => ({
|
|
1251
|
+
domain: one(subgraph_domain, {
|
|
1252
|
+
fields: [subgraph_nameWrapped.domainId],
|
|
1253
|
+
references: [subgraph_domain.id]
|
|
1254
|
+
}),
|
|
1255
|
+
owner: one(subgraph_account, {
|
|
1256
|
+
fields: [subgraph_nameWrapped.ownerId],
|
|
1257
|
+
references: [subgraph_account.id]
|
|
1258
|
+
})
|
|
1259
|
+
}));
|
|
1260
|
+
var subgraph_nameUnwrappedRelations = relations3(subgraph_nameUnwrapped, ({ one }) => ({
|
|
1261
|
+
domain: one(subgraph_domain, {
|
|
1262
|
+
fields: [subgraph_nameUnwrapped.domainId],
|
|
1263
|
+
references: [subgraph_domain.id]
|
|
1264
|
+
}),
|
|
1265
|
+
owner: one(subgraph_account, {
|
|
1266
|
+
fields: [subgraph_nameUnwrapped.ownerId],
|
|
1267
|
+
references: [subgraph_account.id]
|
|
1268
|
+
})
|
|
1269
|
+
}));
|
|
1270
|
+
var subgraph_fusesSetRelations = relations3(subgraph_fusesSet, ({ one }) => ({
|
|
1271
|
+
domain: one(subgraph_domain, {
|
|
1272
|
+
fields: [subgraph_fusesSet.domainId],
|
|
1273
|
+
references: [subgraph_domain.id]
|
|
1274
|
+
})
|
|
1275
|
+
}));
|
|
1276
|
+
var subgraph_expiryExtendedRelations = relations3(subgraph_expiryExtended, ({ one }) => ({
|
|
1378
1277
|
domain: one(subgraph_domain, {
|
|
1379
|
-
fields: [
|
|
1278
|
+
fields: [subgraph_expiryExtended.domainId],
|
|
1380
1279
|
references: [subgraph_domain.id]
|
|
1280
|
+
})
|
|
1281
|
+
}));
|
|
1282
|
+
var subgraph_nameRegisteredRelations = relations3(subgraph_nameRegistered, ({ one }) => ({
|
|
1283
|
+
registration: one(subgraph_registration, {
|
|
1284
|
+
fields: [subgraph_nameRegistered.registrationId],
|
|
1285
|
+
references: [subgraph_registration.id]
|
|
1381
1286
|
}),
|
|
1382
|
-
|
|
1383
|
-
fields: [
|
|
1287
|
+
registrant: one(subgraph_account, {
|
|
1288
|
+
fields: [subgraph_nameRegistered.registrantId],
|
|
1384
1289
|
references: [subgraph_account.id]
|
|
1385
1290
|
})
|
|
1386
1291
|
}));
|
|
1387
|
-
var
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
})
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
// primary reverse lookup
|
|
1398
|
-
idx: index3().on(t.domainId),
|
|
1399
|
-
// sorting index
|
|
1400
|
-
idx_compound: index3().on(t.domainId, t.id)
|
|
1401
|
-
});
|
|
1402
|
-
var subgraph_transfer = onchainTable5(
|
|
1403
|
-
"subgraph_transfers",
|
|
1404
|
-
(t) => ({
|
|
1405
|
-
...domainEvent2(t),
|
|
1406
|
-
ownerId: t.hex().notNull()
|
|
1407
|
-
}),
|
|
1408
|
-
domainEventIndex
|
|
1409
|
-
);
|
|
1410
|
-
var subgraph_newOwner = onchainTable5(
|
|
1411
|
-
"subgraph_new_owners",
|
|
1412
|
-
(t) => ({
|
|
1413
|
-
...domainEvent2(t),
|
|
1414
|
-
ownerId: t.hex().notNull(),
|
|
1415
|
-
parentDomainId: t.hex().notNull()
|
|
1416
|
-
}),
|
|
1417
|
-
domainEventIndex
|
|
1418
|
-
);
|
|
1419
|
-
var subgraph_newResolver = onchainTable5(
|
|
1420
|
-
"subgraph_new_resolvers",
|
|
1421
|
-
(t) => ({
|
|
1422
|
-
...domainEvent2(t),
|
|
1423
|
-
resolverId: t.text().notNull()
|
|
1424
|
-
}),
|
|
1425
|
-
domainEventIndex
|
|
1426
|
-
);
|
|
1427
|
-
var subgraph_newTTL = onchainTable5(
|
|
1428
|
-
"subgraph_new_ttls",
|
|
1429
|
-
(t) => ({
|
|
1430
|
-
...domainEvent2(t),
|
|
1431
|
-
ttl: t.bigint().notNull()
|
|
1432
|
-
}),
|
|
1433
|
-
domainEventIndex
|
|
1434
|
-
);
|
|
1435
|
-
var subgraph_wrappedTransfer = onchainTable5(
|
|
1436
|
-
"subgraph_wrapped_transfers",
|
|
1437
|
-
(t) => ({
|
|
1438
|
-
...domainEvent2(t),
|
|
1439
|
-
ownerId: t.hex().notNull()
|
|
1440
|
-
}),
|
|
1441
|
-
domainEventIndex
|
|
1442
|
-
);
|
|
1443
|
-
var subgraph_nameWrapped = onchainTable5(
|
|
1444
|
-
"subgraph_name_wrapped",
|
|
1445
|
-
(t) => ({
|
|
1446
|
-
...domainEvent2(t),
|
|
1447
|
-
name: t.text(),
|
|
1448
|
-
fuses: t.integer().notNull(),
|
|
1449
|
-
ownerId: t.hex().notNull(),
|
|
1450
|
-
expiryDate: t.bigint().notNull()
|
|
1292
|
+
var subgraph_nameRenewedRelations = relations3(subgraph_nameRenewed, ({ one }) => ({
|
|
1293
|
+
registration: one(subgraph_registration, {
|
|
1294
|
+
fields: [subgraph_nameRenewed.registrationId],
|
|
1295
|
+
references: [subgraph_registration.id]
|
|
1296
|
+
})
|
|
1297
|
+
}));
|
|
1298
|
+
var subgraph_nameTransferredRelations = relations3(subgraph_nameTransferred, ({ one }) => ({
|
|
1299
|
+
registration: one(subgraph_registration, {
|
|
1300
|
+
fields: [subgraph_nameTransferred.registrationId],
|
|
1301
|
+
references: [subgraph_registration.id]
|
|
1451
1302
|
}),
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1303
|
+
newOwner: one(subgraph_account, {
|
|
1304
|
+
fields: [subgraph_nameTransferred.newOwnerId],
|
|
1305
|
+
references: [subgraph_account.id]
|
|
1306
|
+
})
|
|
1307
|
+
}));
|
|
1308
|
+
var subgraph_addrChangedRelations = relations3(subgraph_addrChanged, ({ one }) => ({
|
|
1309
|
+
resolver: one(subgraph_resolver, {
|
|
1310
|
+
fields: [subgraph_addrChanged.resolverId],
|
|
1311
|
+
references: [subgraph_resolver.id]
|
|
1459
1312
|
}),
|
|
1460
|
-
|
|
1313
|
+
addr: one(subgraph_account, {
|
|
1314
|
+
fields: [subgraph_addrChanged.addrId],
|
|
1315
|
+
references: [subgraph_account.id]
|
|
1316
|
+
})
|
|
1317
|
+
}));
|
|
1318
|
+
var subgraph_multicoinAddrChangedRelations = relations3(
|
|
1319
|
+
subgraph_multicoinAddrChanged,
|
|
1320
|
+
({ one }) => ({
|
|
1321
|
+
resolver: one(subgraph_resolver, {
|
|
1322
|
+
fields: [subgraph_multicoinAddrChanged.resolverId],
|
|
1323
|
+
references: [subgraph_resolver.id]
|
|
1324
|
+
})
|
|
1325
|
+
})
|
|
1461
1326
|
);
|
|
1462
|
-
var
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1327
|
+
var subgraph_nameChangedRelations = relations3(subgraph_nameChanged, ({ one }) => ({
|
|
1328
|
+
resolver: one(subgraph_resolver, {
|
|
1329
|
+
fields: [subgraph_nameChanged.resolverId],
|
|
1330
|
+
references: [subgraph_resolver.id]
|
|
1331
|
+
})
|
|
1332
|
+
}));
|
|
1333
|
+
var subgraph_abiChangedRelations = relations3(subgraph_abiChanged, ({ one }) => ({
|
|
1334
|
+
resolver: one(subgraph_resolver, {
|
|
1335
|
+
fields: [subgraph_abiChanged.resolverId],
|
|
1336
|
+
references: [subgraph_resolver.id]
|
|
1337
|
+
})
|
|
1338
|
+
}));
|
|
1339
|
+
var subgraph_pubkeyChangedRelations = relations3(subgraph_pubkeyChanged, ({ one }) => ({
|
|
1340
|
+
resolver: one(subgraph_resolver, {
|
|
1341
|
+
fields: [subgraph_pubkeyChanged.resolverId],
|
|
1342
|
+
references: [subgraph_resolver.id]
|
|
1343
|
+
})
|
|
1344
|
+
}));
|
|
1345
|
+
var subgraph_textChangedRelations = relations3(subgraph_textChanged, ({ one }) => ({
|
|
1346
|
+
resolver: one(subgraph_resolver, {
|
|
1347
|
+
fields: [subgraph_textChanged.resolverId],
|
|
1348
|
+
references: [subgraph_resolver.id]
|
|
1349
|
+
})
|
|
1350
|
+
}));
|
|
1351
|
+
var subgraph_contenthashChangedRelations = relations3(
|
|
1352
|
+
subgraph_contenthashChanged,
|
|
1353
|
+
({ one }) => ({
|
|
1354
|
+
resolver: one(subgraph_resolver, {
|
|
1355
|
+
fields: [subgraph_contenthashChanged.resolverId],
|
|
1356
|
+
references: [subgraph_resolver.id]
|
|
1357
|
+
})
|
|
1358
|
+
})
|
|
1469
1359
|
);
|
|
1470
|
-
var
|
|
1471
|
-
|
|
1472
|
-
(
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1360
|
+
var subgraph_interfaceChangedRelations = relations3(
|
|
1361
|
+
subgraph_interfaceChanged,
|
|
1362
|
+
({ one }) => ({
|
|
1363
|
+
resolver: one(subgraph_resolver, {
|
|
1364
|
+
fields: [subgraph_interfaceChanged.resolverId],
|
|
1365
|
+
references: [subgraph_resolver.id]
|
|
1366
|
+
})
|
|
1367
|
+
})
|
|
1477
1368
|
);
|
|
1478
|
-
var
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
idx_compound: index3().on(t.registrationId, t.id)
|
|
1487
|
-
});
|
|
1488
|
-
var subgraph_nameRegistered = onchainTable5(
|
|
1489
|
-
"subgraph_name_registered",
|
|
1490
|
-
(t) => ({
|
|
1491
|
-
...registrationEvent(t),
|
|
1492
|
-
registrantId: t.hex().notNull(),
|
|
1493
|
-
expiryDate: t.bigint().notNull()
|
|
1494
|
-
}),
|
|
1495
|
-
registrationEventIndex
|
|
1369
|
+
var subgraph_authorisationChangedRelations = relations3(
|
|
1370
|
+
subgraph_authorisationChanged,
|
|
1371
|
+
({ one }) => ({
|
|
1372
|
+
resolver: one(subgraph_resolver, {
|
|
1373
|
+
fields: [subgraph_authorisationChanged.resolverId],
|
|
1374
|
+
references: [subgraph_resolver.id]
|
|
1375
|
+
})
|
|
1376
|
+
})
|
|
1496
1377
|
);
|
|
1497
|
-
var
|
|
1498
|
-
|
|
1378
|
+
var subgraph_versionChangedRelations = relations3(subgraph_versionChanged, ({ one }) => ({
|
|
1379
|
+
resolver: one(subgraph_resolver, {
|
|
1380
|
+
fields: [subgraph_versionChanged.resolverId],
|
|
1381
|
+
references: [subgraph_resolver.id]
|
|
1382
|
+
})
|
|
1383
|
+
}));
|
|
1384
|
+
|
|
1385
|
+
// src/ensindexer-abstract/tokenscope.schema.ts
|
|
1386
|
+
import { index as index4, onchainTable as onchainTable5 } from "ponder";
|
|
1387
|
+
var nameSales = onchainTable5(
|
|
1388
|
+
"name_sales",
|
|
1499
1389
|
(t) => ({
|
|
1500
|
-
|
|
1501
|
-
|
|
1390
|
+
/**
|
|
1391
|
+
* Unique and deterministic identifier of the onchain event associated with the sale.
|
|
1392
|
+
*
|
|
1393
|
+
* Composite key format: "{chainId}-{blockNumber}-{logIndex}" (e.g., "1-1234567-5")
|
|
1394
|
+
*/
|
|
1395
|
+
id: t.text().primaryKey(),
|
|
1396
|
+
/**
|
|
1397
|
+
* The chain where the sale occurred.
|
|
1398
|
+
*/
|
|
1399
|
+
chainId: t.int8({ mode: "number" }).notNull(),
|
|
1400
|
+
/**
|
|
1401
|
+
* The block number on chainId where the sale occurred.
|
|
1402
|
+
*/
|
|
1403
|
+
blockNumber: t.bigint().notNull(),
|
|
1404
|
+
/**
|
|
1405
|
+
* The log index position of the sale event within blockNumber.
|
|
1406
|
+
*/
|
|
1407
|
+
logIndex: t.integer().notNull(),
|
|
1408
|
+
/**
|
|
1409
|
+
* The EVM transaction hash on chainId associated with the sale.
|
|
1410
|
+
*/
|
|
1411
|
+
transactionHash: t.hex().notNull(),
|
|
1412
|
+
/**
|
|
1413
|
+
* The Seaport order hash.
|
|
1414
|
+
*/
|
|
1415
|
+
orderHash: t.hex().notNull(),
|
|
1416
|
+
/**
|
|
1417
|
+
* The address of the contract on chainId that manages tokenId.
|
|
1418
|
+
*/
|
|
1419
|
+
contractAddress: t.hex().notNull(),
|
|
1420
|
+
/**
|
|
1421
|
+
* The tokenId managed by contractAddress that was sold.
|
|
1422
|
+
*
|
|
1423
|
+
* In a general context (outside of TokenScope) ERC1155 NFTs may have
|
|
1424
|
+
* multiple copies, however TokenScope guarantees that all indexed NFTs
|
|
1425
|
+
* never have an amount / balance > 1.
|
|
1426
|
+
*/
|
|
1427
|
+
tokenId: t.bigint().notNull(),
|
|
1428
|
+
/**
|
|
1429
|
+
* The CAIP-19 Asset Namespace of the token that was sold. Either `erc721` or `erc1155`.
|
|
1430
|
+
*
|
|
1431
|
+
* @see https://chainagnostic.org/CAIPs/caip-19
|
|
1432
|
+
*/
|
|
1433
|
+
assetNamespace: t.text().notNull(),
|
|
1434
|
+
/**
|
|
1435
|
+
* The CAIP-19 Asset ID of token that was sold. This is a globally unique reference to the
|
|
1436
|
+
* specific asset in question.
|
|
1437
|
+
*
|
|
1438
|
+
* @see https://chainagnostic.org/CAIPs/caip-19
|
|
1439
|
+
*/
|
|
1440
|
+
assetId: t.text().notNull(),
|
|
1441
|
+
/**
|
|
1442
|
+
* The namehash (Node) of the ENS domain that was sold.
|
|
1443
|
+
*/
|
|
1444
|
+
domainId: t.hex().notNull(),
|
|
1445
|
+
/**
|
|
1446
|
+
* The account that bought the token controlling ownership of domainId from
|
|
1447
|
+
* the seller for the amount of currency associated with the sale.
|
|
1448
|
+
*/
|
|
1449
|
+
buyer: t.hex().notNull(),
|
|
1450
|
+
/**
|
|
1451
|
+
* The account that sold the token controlling ownership of domainId to
|
|
1452
|
+
* buyer for the amount of currency associated with the sale.
|
|
1453
|
+
*/
|
|
1454
|
+
seller: t.hex().notNull(),
|
|
1455
|
+
/**
|
|
1456
|
+
* Currency of the payment (ETH, USDC or DAI) from buyer to seller in exchange for tokenId.
|
|
1457
|
+
*/
|
|
1458
|
+
currency: t.text().notNull(),
|
|
1459
|
+
/**
|
|
1460
|
+
* The amount of currency paid from buyer to seller in exchange for tokenId.
|
|
1461
|
+
*
|
|
1462
|
+
* Denominated in the smallest unit of currency.
|
|
1463
|
+
*
|
|
1464
|
+
* Amount interpretation depends on currency:
|
|
1465
|
+
* - ETH/WETH: Amount in wei (1 ETH = 10^18 wei)
|
|
1466
|
+
* - USDC: Amount in micro-units (1 USDC = 10^6 units)
|
|
1467
|
+
* - DAI: Amount in wei-equivalent (1 DAI = 10^18 units)
|
|
1468
|
+
*/
|
|
1469
|
+
amount: t.bigint().notNull(),
|
|
1470
|
+
/**
|
|
1471
|
+
* Unix timestamp of the block timestamp when the sale occurred.
|
|
1472
|
+
*/
|
|
1473
|
+
timestamp: t.bigint().notNull()
|
|
1502
1474
|
}),
|
|
1503
|
-
registrationEventIndex
|
|
1504
|
-
);
|
|
1505
|
-
var subgraph_nameTransferred = onchainTable5(
|
|
1506
|
-
"subgraph_name_transferred",
|
|
1507
1475
|
(t) => ({
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1476
|
+
idx_domainId: index4().on(t.domainId),
|
|
1477
|
+
idx_assetId: index4().on(t.assetId),
|
|
1478
|
+
idx_buyer: index4().on(t.buyer),
|
|
1479
|
+
idx_seller: index4().on(t.seller),
|
|
1480
|
+
idx_timestamp: index4().on(t.timestamp)
|
|
1481
|
+
})
|
|
1512
1482
|
);
|
|
1513
|
-
var
|
|
1514
|
-
|
|
1515
|
-
resolverId: t.text().notNull()
|
|
1516
|
-
});
|
|
1517
|
-
var resolverEventIndex = (t) => ({
|
|
1518
|
-
// primary reverse lookup
|
|
1519
|
-
idx: index3().on(t.resolverId),
|
|
1520
|
-
// sorting index
|
|
1521
|
-
idx_compound: index3().on(t.resolverId, t.id)
|
|
1522
|
-
});
|
|
1523
|
-
var subgraph_addrChanged = onchainTable5(
|
|
1524
|
-
"subgraph_addr_changed",
|
|
1483
|
+
var nameTokens = onchainTable5(
|
|
1484
|
+
"name_tokens",
|
|
1525
1485
|
(t) => ({
|
|
1526
|
-
|
|
1527
|
-
|
|
1486
|
+
/**
|
|
1487
|
+
* The CAIP-19 Asset ID of the token.
|
|
1488
|
+
*
|
|
1489
|
+
* This is a globally unique reference to the token.
|
|
1490
|
+
*
|
|
1491
|
+
* @see https://chainagnostic.org/CAIPs/caip-19
|
|
1492
|
+
*/
|
|
1493
|
+
id: t.text().primaryKey(),
|
|
1494
|
+
/**
|
|
1495
|
+
* The namehash (Node) of the ENS name associated with the token.
|
|
1496
|
+
*
|
|
1497
|
+
* Note: An ENS name may have more than one distinct token across time. It is
|
|
1498
|
+
* also possible for multiple distinct tokens for an ENS name to have
|
|
1499
|
+
* a mintStatus of `minted` at the same time. For example:
|
|
1500
|
+
* - When a direct subname of .eth is wrapped by the NameWrapper. This state
|
|
1501
|
+
* has one minted token for the name managed by the BaseRegistrar (this
|
|
1502
|
+
* token will be owned by the NameWrapper) and another minted token for
|
|
1503
|
+
* the name managed by the NameWrapper (owned by the effective owner of
|
|
1504
|
+
* the name).
|
|
1505
|
+
* - When a direct subname of .eth is wrapped by the NameWrapper and then
|
|
1506
|
+
* unwrapped. This state has one minted token (managed by the BaseRegistrar)
|
|
1507
|
+
* and another burned token (managed by the NameWrapper).
|
|
1508
|
+
*/
|
|
1509
|
+
domainId: t.hex().notNull(),
|
|
1510
|
+
/**
|
|
1511
|
+
* The chain that manages the token.
|
|
1512
|
+
*/
|
|
1513
|
+
chainId: t.int8({ mode: "number" }).notNull(),
|
|
1514
|
+
/**
|
|
1515
|
+
* The address of the contract on chainId that manages the token.
|
|
1516
|
+
*/
|
|
1517
|
+
contractAddress: t.hex().notNull(),
|
|
1518
|
+
/**
|
|
1519
|
+
* The tokenId of the token managed by contractAddress.
|
|
1520
|
+
*
|
|
1521
|
+
* In a general context (outside of TokenScope) ERC1155 NFTs may have
|
|
1522
|
+
* multiple copies, however TokenScope guarantees that all indexed NFTs
|
|
1523
|
+
* never have an amount / balance > 1.
|
|
1524
|
+
*/
|
|
1525
|
+
tokenId: t.bigint().notNull(),
|
|
1526
|
+
/**
|
|
1527
|
+
* The CAIP-19 Asset Namespace of the token. Either `erc721` or `erc1155`.
|
|
1528
|
+
*
|
|
1529
|
+
* @see https://chainagnostic.org/CAIPs/caip-19
|
|
1530
|
+
*/
|
|
1531
|
+
assetNamespace: t.text().notNull(),
|
|
1532
|
+
/**
|
|
1533
|
+
* The account that owns the token.
|
|
1534
|
+
*
|
|
1535
|
+
* Value is zeroAddress if and only if mintStatus is `burned`.
|
|
1536
|
+
*
|
|
1537
|
+
* Note: The owner of the token for a given domainId may differ from the
|
|
1538
|
+
* owner of the associated node in the registry. For example:
|
|
1539
|
+
* - Consider the case where address X owns the ENS name `foo.eth` in
|
|
1540
|
+
* both the BaseRegistrar and the Registry. If X sends a request directly
|
|
1541
|
+
* to the Registry to transfer ownership to Y, ownership of `foo.eth` will
|
|
1542
|
+
* be transferred to Y in the Registry but not in the BaseRegistrar.
|
|
1543
|
+
* - ... for the case above, the BaseRegistrar implements a `reclaim`
|
|
1544
|
+
* allowing the owner of the name in the BaseRegistrar to reclaim ownership
|
|
1545
|
+
* of the name in the Registry.
|
|
1546
|
+
*
|
|
1547
|
+
* Note: When a name is wrapped by the NameWrapper, the owner of the token
|
|
1548
|
+
* in the BaseRegistrar is the NameWrapper, while a new token for the name is
|
|
1549
|
+
* minted by the NameWrapper and owned by the effective owner of the name.
|
|
1550
|
+
*/
|
|
1551
|
+
owner: t.hex().notNull(),
|
|
1552
|
+
/**
|
|
1553
|
+
* The mint status of the token. Either `minted` or `burned`.
|
|
1554
|
+
*
|
|
1555
|
+
* After we index a NFT we never delete it from our index. Instead, when an
|
|
1556
|
+
* indexed NFT is burned onchain we retain its record and update its mint
|
|
1557
|
+
* status as `burned`. If a NFT is minted again after it is burned its mint
|
|
1558
|
+
* status is updated to `minted`.
|
|
1559
|
+
*/
|
|
1560
|
+
mintStatus: t.text().notNull()
|
|
1528
1561
|
}),
|
|
1529
|
-
|
|
1562
|
+
(t) => ({
|
|
1563
|
+
idx_domainId: index4().on(t.domainId),
|
|
1564
|
+
idx_owner: index4().on(t.owner)
|
|
1565
|
+
})
|
|
1530
1566
|
);
|
|
1531
|
-
|
|
1532
|
-
|
|
1567
|
+
|
|
1568
|
+
// src/ensindexer-abstract/unigraph.schema.ts
|
|
1569
|
+
import { index as index5, onchainEnum as onchainEnum2, onchainTable as onchainTable6, primaryKey as primaryKey3, relations as relations4, sql as sql2, uniqueIndex as uniqueIndex3 } from "ponder";
|
|
1570
|
+
var event = onchainTable6(
|
|
1571
|
+
"events",
|
|
1533
1572
|
(t) => ({
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1573
|
+
// Ponder's event.id
|
|
1574
|
+
id: t.text().primaryKey(),
|
|
1575
|
+
// The HCA account address if used, otherwise Transaction.from.
|
|
1576
|
+
sender: t.hex().notNull().$type(),
|
|
1577
|
+
// Event Log Metadata
|
|
1578
|
+
// chain
|
|
1579
|
+
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
1580
|
+
// block
|
|
1581
|
+
blockNumber: t.bigint().notNull().$type(),
|
|
1582
|
+
blockHash: t.hex().notNull().$type(),
|
|
1583
|
+
timestamp: t.bigint().notNull(),
|
|
1584
|
+
// transaction
|
|
1585
|
+
transactionHash: t.hex().notNull().$type(),
|
|
1586
|
+
transactionIndex: t.integer().notNull(),
|
|
1587
|
+
// `tx.from` — never HCA-aware. Always the EOA/relayer that submitted the transaction.
|
|
1588
|
+
// Use `event.sender` for the HCA-aware actor.
|
|
1589
|
+
from: t.hex().notNull().$type(),
|
|
1590
|
+
to: t.hex().$type(),
|
|
1591
|
+
// NOTE: a null `to` means this was a tx that deployed a contract
|
|
1592
|
+
// log
|
|
1593
|
+
address: t.hex().notNull().$type(),
|
|
1594
|
+
logIndex: t.integer().notNull().$type(),
|
|
1595
|
+
selector: t.hex().notNull().$type(),
|
|
1596
|
+
topics: t.hex().array().notNull().$type(),
|
|
1597
|
+
data: t.hex().notNull()
|
|
1537
1598
|
}),
|
|
1538
|
-
|
|
1599
|
+
(t) => ({
|
|
1600
|
+
bySelector: index5().on(t.selector),
|
|
1601
|
+
byFrom: index5().on(t.from),
|
|
1602
|
+
bySender: index5().on(t.sender),
|
|
1603
|
+
byTimestamp: index5().on(t.timestamp)
|
|
1604
|
+
})
|
|
1539
1605
|
);
|
|
1540
|
-
var
|
|
1541
|
-
"
|
|
1606
|
+
var domainEvent2 = onchainTable6(
|
|
1607
|
+
"domain_events",
|
|
1542
1608
|
(t) => ({
|
|
1543
|
-
|
|
1544
|
-
|
|
1609
|
+
domainId: t.text().notNull().$type(),
|
|
1610
|
+
eventId: t.text().notNull()
|
|
1545
1611
|
}),
|
|
1546
|
-
|
|
1612
|
+
(t) => ({ pk: primaryKey3({ columns: [t.domainId, t.eventId] }) })
|
|
1547
1613
|
);
|
|
1548
|
-
var
|
|
1549
|
-
"
|
|
1614
|
+
var resolverEvent2 = onchainTable6(
|
|
1615
|
+
"resolver_events",
|
|
1550
1616
|
(t) => ({
|
|
1551
|
-
|
|
1552
|
-
|
|
1617
|
+
resolverId: t.text().notNull().$type(),
|
|
1618
|
+
eventId: t.text().notNull()
|
|
1553
1619
|
}),
|
|
1554
|
-
|
|
1620
|
+
(t) => ({ pk: primaryKey3({ columns: [t.resolverId, t.eventId] }) })
|
|
1555
1621
|
);
|
|
1556
|
-
var
|
|
1557
|
-
"
|
|
1622
|
+
var permissionsEvent = onchainTable6(
|
|
1623
|
+
"permissions_events",
|
|
1558
1624
|
(t) => ({
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
y: t.hex().notNull()
|
|
1625
|
+
permissionsId: t.text().notNull().$type(),
|
|
1626
|
+
eventId: t.text().notNull()
|
|
1562
1627
|
}),
|
|
1563
|
-
|
|
1628
|
+
(t) => ({ pk: primaryKey3({ columns: [t.permissionsId, t.eventId] }) })
|
|
1564
1629
|
);
|
|
1565
|
-
var
|
|
1566
|
-
"
|
|
1630
|
+
var permissionsUserEvent = onchainTable6(
|
|
1631
|
+
"permissions_user_events",
|
|
1567
1632
|
(t) => ({
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
value: t.text()
|
|
1633
|
+
permissionsUserId: t.text().notNull().$type(),
|
|
1634
|
+
eventId: t.text().notNull()
|
|
1571
1635
|
}),
|
|
1572
|
-
|
|
1636
|
+
(t) => ({ pk: primaryKey3({ columns: [t.permissionsUserId, t.eventId] }) })
|
|
1573
1637
|
);
|
|
1574
|
-
var
|
|
1575
|
-
|
|
1638
|
+
var account = onchainTable6("accounts", (t) => ({
|
|
1639
|
+
id: t.hex().primaryKey().$type()
|
|
1640
|
+
}));
|
|
1641
|
+
var account_relations = relations4(account, ({ many }) => ({
|
|
1642
|
+
registrations: many(registration, { relationName: "registrant" }),
|
|
1643
|
+
domains: many(domain),
|
|
1644
|
+
permissions: many(permissionsUser)
|
|
1645
|
+
}));
|
|
1646
|
+
var registryType = onchainEnum2("RegistryType", [
|
|
1647
|
+
"ENSv1Registry",
|
|
1648
|
+
"ENSv1VirtualRegistry",
|
|
1649
|
+
"ENSv2Registry"
|
|
1650
|
+
]);
|
|
1651
|
+
var registry = onchainTable6(
|
|
1652
|
+
"registries",
|
|
1576
1653
|
(t) => ({
|
|
1577
|
-
|
|
1578
|
-
|
|
1654
|
+
// see RegistryId for guarantees
|
|
1655
|
+
id: t.text().primaryKey().$type(),
|
|
1656
|
+
// has a type
|
|
1657
|
+
type: registryType().notNull(),
|
|
1658
|
+
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
1659
|
+
address: t.hex().notNull().$type(),
|
|
1660
|
+
// If this is an ENSv1VirtualRegistry, `node` is the namehash of the parent ENSv1 domain that
|
|
1661
|
+
// owns it, otherwise null.
|
|
1662
|
+
node: t.hex().$type(),
|
|
1663
|
+
// the Registry's declared Canonical Domain (uni-directional)
|
|
1664
|
+
canonicalDomainId: t.text().$type(),
|
|
1665
|
+
// Whether this Registry is part of the canonical nametree. See canonicality-db-helpers.ts.
|
|
1666
|
+
canonical: t.boolean().notNull().default(false),
|
|
1667
|
+
// Synthetic monotonic sentinel: flipped to true the first time a child Domain is registered
|
|
1668
|
+
// under this Registry (see `ensureDomainInRegistry`). Read by `cascadeCanonicality` to skip
|
|
1669
|
+
// the raw-SQL recursive-CTE walk (and its associated Ponder cache flush) when the start
|
|
1670
|
+
// registry provably has no descendants — the dominant case for fresh ENSv1 virtual
|
|
1671
|
+
// registries on first wire-up. Double-underscore prefix marks it as an internal-only
|
|
1672
|
+
// bookkeeping field, not part of the on-chain protocol surface.
|
|
1673
|
+
__hasChildren: t.boolean().notNull().default(false)
|
|
1579
1674
|
}),
|
|
1580
|
-
|
|
1675
|
+
(t) => ({
|
|
1676
|
+
// NOTE: non-unique index because multiple rows can share (chainId, address) across virtual registries
|
|
1677
|
+
byChainAddress: index5().on(t.chainId, t.address)
|
|
1678
|
+
})
|
|
1581
1679
|
);
|
|
1582
|
-
var
|
|
1583
|
-
|
|
1680
|
+
var relations_registry = relations4(registry, ({ one, many }) => ({
|
|
1681
|
+
// domains that declare this registry as their parent registry
|
|
1682
|
+
domains: many(domain, { relationName: "registry" }),
|
|
1683
|
+
// domains that declare this registry as their subregistry
|
|
1684
|
+
domainsAsSubregistry: many(domain, { relationName: "subregistry" }),
|
|
1685
|
+
permissions: one(permissions, {
|
|
1686
|
+
relationName: "permissions",
|
|
1687
|
+
fields: [registry.chainId, registry.address],
|
|
1688
|
+
references: [permissions.chainId, permissions.address]
|
|
1689
|
+
})
|
|
1690
|
+
}));
|
|
1691
|
+
var domainType = onchainEnum2("DomainType", ["ENSv1Domain", "ENSv2Domain"]);
|
|
1692
|
+
var domain = onchainTable6(
|
|
1693
|
+
"domains",
|
|
1584
1694
|
(t) => ({
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1695
|
+
// see DomainId for guarantees (ENSv1DomainId: `${ENSv1RegistryId}/${node}`, ENSv2DomainId: CAIP-19)
|
|
1696
|
+
id: t.text().primaryKey().$type(),
|
|
1697
|
+
// has a type
|
|
1698
|
+
type: domainType().notNull(),
|
|
1699
|
+
// belongs to a registry
|
|
1700
|
+
registryId: t.text().notNull().$type(),
|
|
1701
|
+
// the Domain's declared Subregistry (uni-directional)
|
|
1702
|
+
subregistryId: t.text().$type(),
|
|
1703
|
+
// If this is an ENSv2Domain, the TokenId within the ENSv2Registry, otherwise null.
|
|
1704
|
+
tokenId: t.bigint().$type(),
|
|
1705
|
+
// If this is an ENSv1Domain, The Domain's namehash, otherwise null.
|
|
1706
|
+
node: t.hex().$type(),
|
|
1707
|
+
// represents a labelHash
|
|
1708
|
+
labelHash: t.hex().notNull().$type(),
|
|
1709
|
+
// If this is an ENSv1Domain, this is the effective owner of the Domain.
|
|
1710
|
+
// If this is an ENSv2Domain, this is the on-chain owner address (the HCA account address if used).
|
|
1711
|
+
ownerId: t.hex().$type(),
|
|
1712
|
+
// If this is an ENSv1Domain, may have a `rootRegistryOwner`, otherwise null.
|
|
1713
|
+
rootRegistryOwnerId: t.hex().$type(),
|
|
1714
|
+
// Whether this Domain is part of the canonical nametree. Mirrors the parent Registry's flag.
|
|
1715
|
+
canonical: t.boolean().notNull().default(false),
|
|
1716
|
+
/**
|
|
1717
|
+
* Materialized Canonical Name, NULL iff `canonical = false`.
|
|
1718
|
+
* Maintained by `canonicality-db-helpers.ts`.
|
|
1719
|
+
*
|
|
1720
|
+
* @example "vitalik.eth"
|
|
1721
|
+
*/
|
|
1722
|
+
canonicalName: t.text().$type(),
|
|
1723
|
+
/**
|
|
1724
|
+
* Materialized Canonical LabelHashPath, NULL iff `canonical = false`.
|
|
1725
|
+
* Maintained by `canonicality-db-helpers.ts`.
|
|
1726
|
+
*
|
|
1727
|
+
* @dev Note that LabelHashPaths are in traversal-order (i.e. [labelhash("eth"), labelhash("vitalik")]).
|
|
1728
|
+
*/
|
|
1729
|
+
canonicalLabelHashPath: t.hex().array().$type(),
|
|
1730
|
+
/**
|
|
1731
|
+
* Materialized Canonical Domain Path, NULL iff `canonical = false`.
|
|
1732
|
+
* Maintained by `canonicality-db-helpers.ts`.
|
|
1733
|
+
*
|
|
1734
|
+
* @dev Note that canonicalPath is in traversal-order (i.e. ["eth"'s DomainId, "vitalik"'s DomainId]).
|
|
1735
|
+
*/
|
|
1736
|
+
canonicalPath: t.text().array().$type(),
|
|
1737
|
+
/**
|
|
1738
|
+
* Materialized Canonical Depth, NULL iff `canonical = false`.
|
|
1739
|
+
* Maintained by `canonicality-db-helpers.ts`.
|
|
1740
|
+
*
|
|
1741
|
+
* @dev The depth of this Domain in the Canonical Nametree i.e. the number of Labels in its Canonical Name.
|
|
1742
|
+
* @example "eth" depth 1, "vitalik.eth" depth 2, etc
|
|
1743
|
+
*/
|
|
1744
|
+
canonicalDepth: t.integer(),
|
|
1745
|
+
/**
|
|
1746
|
+
* Materialized Canonical Node, NULL iff `canonical = false`.
|
|
1747
|
+
* Maintained by `canonicality-db-helpers.ts`.
|
|
1748
|
+
*
|
|
1749
|
+
* @dev the computed Node (via `namehash`) of this Domain's Canonical Name.
|
|
1750
|
+
*/
|
|
1751
|
+
canonicalNode: t.hex().$type()
|
|
1752
|
+
// NOTE: Domain-Resolver Relations tracked via Protocol Acceleration plugin
|
|
1588
1753
|
}),
|
|
1589
|
-
resolverEventIndex
|
|
1590
|
-
);
|
|
1591
|
-
var subgraph_authorisationChanged = onchainTable5(
|
|
1592
|
-
"subgraph_authorisation_changed",
|
|
1593
1754
|
(t) => ({
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1755
|
+
byType: index5().on(t.type),
|
|
1756
|
+
bySubregistry: index5().on(t.subregistryId).where(sql2`${t.subregistryId} IS NOT NULL`),
|
|
1757
|
+
byOwner: index5().on(t.ownerId),
|
|
1758
|
+
byLabelHash: index5().on(t.labelHash),
|
|
1759
|
+
// Composite for `(registry_id, label_hash)` lookups (namegraph walk in
|
|
1760
|
+
// get-domain-by-interpreted-name.ts). The leading `registry_id` column also serves
|
|
1761
|
+
// `WHERE registry_id = X` lookups via prefix scan.
|
|
1762
|
+
byRegistryAndLabelHash: index5().on(t.registryId, t.labelHash),
|
|
1763
|
+
// composite for `WHERE registry_id = X ORDER BY canonical_name LIMIT N` (Domain.subdomains
|
|
1764
|
+
// and other find-domains queries when ordering by NAME). Uses `left(canonical_name, 256)`
|
|
1765
|
+
// to bound the index tuple under btree's per-tuple max (~2712 bytes): 256 chars × max 4-byte
|
|
1766
|
+
// UTF-8 = 1024 bytes, leaving ample room for the registry_id and id columns. Names beyond
|
|
1767
|
+
// 256 chars (currently <0.0001% of mainnet) collide on the truncated prefix and tie-break by
|
|
1768
|
+
// id; this is acceptable since such names are invariably spam. Callers MUST sort by the same
|
|
1769
|
+
// expression for the planner to use this index for ordered scan.
|
|
1770
|
+
byRegistryAndCanonicalNameLeft: index5().on(
|
|
1771
|
+
t.registryId,
|
|
1772
|
+
sql2`left(${t.canonicalName}, 256)`,
|
|
1773
|
+
t.id
|
|
1774
|
+
),
|
|
1775
|
+
// hash index avoids the btree 8191-byte row-size hazard for spam names
|
|
1776
|
+
byCanonicalNameExact: index5().using("hash", t.canonicalName),
|
|
1777
|
+
// GIN trigram index for substring / similarity queries (inline `gin_trgm_ops` via `sql`
|
|
1778
|
+
// because passing it through `.op()` gets dropped by Ponder)
|
|
1779
|
+
byCanonicalNameFuzzy: index5().using("gin", sql2`${t.canonicalName} gin_trgm_ops`),
|
|
1780
|
+
// GIN containment for `cascadeLabelHeal`'s `canonical_label_hash_path @> ARRAY[lh]` lookup
|
|
1781
|
+
byCanonicalLabelHashPath: index5().using("gin", t.canonicalLabelHashPath),
|
|
1782
|
+
// hash index for resolver-record → canonical-domain joins
|
|
1783
|
+
byCanonicalNode: index5().using("hash", t.canonicalNode),
|
|
1784
|
+
// btree for ORDER BY canonical_depth (typeahead and DEPTH-ordered browse)
|
|
1785
|
+
byCanonicalDepth: index5().on(t.canonicalDepth)
|
|
1786
|
+
})
|
|
1600
1787
|
);
|
|
1601
|
-
var
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1788
|
+
var relations_domain = relations4(domain, ({ one, many }) => ({
|
|
1789
|
+
registry: one(registry, {
|
|
1790
|
+
relationName: "registry",
|
|
1791
|
+
fields: [domain.registryId],
|
|
1792
|
+
references: [registry.id]
|
|
1606
1793
|
}),
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
fields: [subgraph_transfer.domainId],
|
|
1612
|
-
references: [subgraph_domain.id]
|
|
1794
|
+
subregistry: one(registry, {
|
|
1795
|
+
relationName: "subregistry",
|
|
1796
|
+
fields: [domain.subregistryId],
|
|
1797
|
+
references: [registry.id]
|
|
1613
1798
|
}),
|
|
1614
|
-
owner: one(
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
}));
|
|
1619
|
-
var subgraph_newOwnerRelations = relations4(subgraph_newOwner, ({ one }) => ({
|
|
1620
|
-
domain: one(subgraph_domain, {
|
|
1621
|
-
fields: [subgraph_newOwner.domainId],
|
|
1622
|
-
references: [subgraph_domain.id]
|
|
1799
|
+
owner: one(account, {
|
|
1800
|
+
relationName: "owner",
|
|
1801
|
+
fields: [domain.ownerId],
|
|
1802
|
+
references: [account.id]
|
|
1623
1803
|
}),
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1804
|
+
rootRegistryOwner: one(account, {
|
|
1805
|
+
relationName: "rootRegistryOwner",
|
|
1806
|
+
fields: [domain.rootRegistryOwnerId],
|
|
1807
|
+
references: [account.id]
|
|
1627
1808
|
}),
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
}));
|
|
1633
|
-
var subgraph_newResolverRelations = relations4(subgraph_newResolver, ({ one }) => ({
|
|
1634
|
-
domain: one(subgraph_domain, {
|
|
1635
|
-
fields: [subgraph_newResolver.domainId],
|
|
1636
|
-
references: [subgraph_domain.id]
|
|
1809
|
+
label: one(label, {
|
|
1810
|
+
relationName: "label",
|
|
1811
|
+
fields: [domain.labelHash],
|
|
1812
|
+
references: [label.labelHash]
|
|
1637
1813
|
}),
|
|
1638
|
-
|
|
1639
|
-
fields: [subgraph_newResolver.resolverId],
|
|
1640
|
-
references: [subgraph_resolver.id]
|
|
1641
|
-
})
|
|
1642
|
-
}));
|
|
1643
|
-
var subgraph_newTTLRelations = relations4(subgraph_newTTL, ({ one }) => ({
|
|
1644
|
-
domain: one(subgraph_domain, {
|
|
1645
|
-
fields: [subgraph_newTTL.domainId],
|
|
1646
|
-
references: [subgraph_domain.id]
|
|
1647
|
-
})
|
|
1814
|
+
registrations: many(registration)
|
|
1648
1815
|
}));
|
|
1649
|
-
var
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1816
|
+
var registrationType = onchainEnum2("RegistrationType", [
|
|
1817
|
+
// TODO: prefix these with ENSv1, maybe excluding ThreeDNS
|
|
1818
|
+
"NameWrapper",
|
|
1819
|
+
"BaseRegistrar",
|
|
1820
|
+
"ThreeDNS",
|
|
1821
|
+
"ENSv2RegistryRegistration",
|
|
1822
|
+
"ENSv2RegistryReservation"
|
|
1823
|
+
]);
|
|
1824
|
+
var registration = onchainTable6(
|
|
1825
|
+
"registrations",
|
|
1826
|
+
(t) => ({
|
|
1827
|
+
// keyed by (domainId, registrationIndex)
|
|
1828
|
+
id: t.text().primaryKey().$type(),
|
|
1829
|
+
domainId: t.text().notNull().$type(),
|
|
1830
|
+
registrationIndex: t.integer().notNull(),
|
|
1831
|
+
// has a type
|
|
1832
|
+
type: registrationType().notNull(),
|
|
1833
|
+
// has a start
|
|
1834
|
+
start: t.bigint().notNull(),
|
|
1835
|
+
// may have an expiry
|
|
1836
|
+
expiry: t.bigint(),
|
|
1837
|
+
// maybe have a grace period (BaseRegistrar)
|
|
1838
|
+
gracePeriod: t.bigint(),
|
|
1839
|
+
// registrar AccountId
|
|
1840
|
+
registrarChainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
1841
|
+
registrarAddress: t.hex().notNull().$type(),
|
|
1842
|
+
// may reference a registrant. If this is an ENSv2 Registration, the protocol-emitted
|
|
1843
|
+
// registrant address (the HCA account address if used).
|
|
1844
|
+
registrantId: t.hex().$type(),
|
|
1845
|
+
// may reference an unregistrant. If this is an ENSv2 Registration, the protocol-emitted
|
|
1846
|
+
// unregistrant address (the HCA account address if used).
|
|
1847
|
+
unregistrantId: t.hex().$type(),
|
|
1848
|
+
// may have referrer data
|
|
1849
|
+
referrer: t.hex().$type(),
|
|
1850
|
+
// may have fuses (NameWrapper, Wrapped BaseRegistrar)
|
|
1851
|
+
fuses: t.integer(),
|
|
1852
|
+
// TODO(paymentToken): add payment token tracking here
|
|
1853
|
+
// may have base cost (BaseRegistrar, ENSv2Registrar)
|
|
1854
|
+
base: t.bigint(),
|
|
1855
|
+
// may have a premium (BaseRegistrar)
|
|
1856
|
+
premium: t.bigint(),
|
|
1857
|
+
// may be Wrapped (BaseRegistrar)
|
|
1858
|
+
wrapped: t.boolean().default(false),
|
|
1859
|
+
// has an event
|
|
1860
|
+
eventId: t.text().notNull()
|
|
1653
1861
|
}),
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
references: [subgraph_account.id]
|
|
1862
|
+
(t) => ({
|
|
1863
|
+
byId: uniqueIndex3().on(t.domainId, t.registrationIndex)
|
|
1657
1864
|
})
|
|
1658
|
-
|
|
1659
|
-
var
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1865
|
+
);
|
|
1866
|
+
var registration_relations = relations4(registration, ({ one, many }) => ({
|
|
1867
|
+
// belongs to a domain
|
|
1868
|
+
domain: one(domain, {
|
|
1869
|
+
fields: [registration.domainId],
|
|
1870
|
+
references: [domain.id]
|
|
1663
1871
|
}),
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
var subgraph_nameUnwrappedRelations = relations4(subgraph_nameUnwrapped, ({ one }) => ({
|
|
1670
|
-
domain: one(subgraph_domain, {
|
|
1671
|
-
fields: [subgraph_nameUnwrapped.domainId],
|
|
1672
|
-
references: [subgraph_domain.id]
|
|
1872
|
+
// has one registrant
|
|
1873
|
+
registrant: one(account, {
|
|
1874
|
+
fields: [registration.registrantId],
|
|
1875
|
+
references: [account.id],
|
|
1876
|
+
relationName: "registrant"
|
|
1673
1877
|
}),
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
})
|
|
1684
|
-
}));
|
|
1685
|
-
var subgraph_expiryExtendedRelations = relations4(subgraph_expiryExtended, ({ one }) => ({
|
|
1686
|
-
domain: one(subgraph_domain, {
|
|
1687
|
-
fields: [subgraph_expiryExtended.domainId],
|
|
1688
|
-
references: [subgraph_domain.id]
|
|
1689
|
-
})
|
|
1690
|
-
}));
|
|
1691
|
-
var subgraph_nameRegisteredRelations = relations4(subgraph_nameRegistered, ({ one }) => ({
|
|
1692
|
-
registration: one(subgraph_registration, {
|
|
1693
|
-
fields: [subgraph_nameRegistered.registrationId],
|
|
1694
|
-
references: [subgraph_registration.id]
|
|
1878
|
+
// has a latest registration index
|
|
1879
|
+
latestRegistrationIndex: one(latestRegistrationIndex),
|
|
1880
|
+
// has a latest renewal index
|
|
1881
|
+
latestRenewalIndex: one(latestRenewalIndex),
|
|
1882
|
+
// has one unregistrant
|
|
1883
|
+
unregistrant: one(account, {
|
|
1884
|
+
fields: [registration.unregistrantId],
|
|
1885
|
+
references: [account.id],
|
|
1886
|
+
relationName: "unregistrant"
|
|
1695
1887
|
}),
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1888
|
+
// has many renewals
|
|
1889
|
+
renewals: many(renewal),
|
|
1890
|
+
// has an event
|
|
1891
|
+
event: one(event, {
|
|
1892
|
+
fields: [registration.eventId],
|
|
1893
|
+
references: [event.id]
|
|
1699
1894
|
})
|
|
1700
1895
|
}));
|
|
1701
|
-
var
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
references: [subgraph_registration.id]
|
|
1705
|
-
})
|
|
1896
|
+
var latestRegistrationIndex = onchainTable6("latest_registration_indexes", (t) => ({
|
|
1897
|
+
domainId: t.text().primaryKey().$type(),
|
|
1898
|
+
registrationIndex: t.integer().notNull()
|
|
1706
1899
|
}));
|
|
1707
|
-
var
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
newOwner: one(subgraph_account, {
|
|
1713
|
-
fields: [subgraph_nameTransferred.newOwnerId],
|
|
1714
|
-
references: [subgraph_account.id]
|
|
1900
|
+
var latestRegistrationIndex_relations = relations4(latestRegistrationIndex, ({ one }) => ({
|
|
1901
|
+
// references domain
|
|
1902
|
+
domain: one(domain, {
|
|
1903
|
+
fields: [latestRegistrationIndex.domainId],
|
|
1904
|
+
references: [domain.id]
|
|
1715
1905
|
})
|
|
1716
1906
|
}));
|
|
1717
|
-
var
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1907
|
+
var renewal = onchainTable6(
|
|
1908
|
+
"renewals",
|
|
1909
|
+
(t) => ({
|
|
1910
|
+
// keyed by (registrationId, index)
|
|
1911
|
+
id: t.text().primaryKey().$type(),
|
|
1912
|
+
domainId: t.text().notNull().$type(),
|
|
1913
|
+
registrationIndex: t.integer().notNull(),
|
|
1914
|
+
renewalIndex: t.integer().notNull(),
|
|
1915
|
+
// all renewals have a duration
|
|
1916
|
+
duration: t.bigint().notNull(),
|
|
1917
|
+
// may have a referrer
|
|
1918
|
+
referrer: t.hex().$type(),
|
|
1919
|
+
// TODO(paymentToken): add payment token tracking here
|
|
1920
|
+
// may have base cost
|
|
1921
|
+
base: t.bigint(),
|
|
1922
|
+
// may have a premium (ENSv1 RegistrarControllers)
|
|
1923
|
+
premium: t.bigint(),
|
|
1924
|
+
// has an event
|
|
1925
|
+
eventId: t.text().notNull()
|
|
1721
1926
|
}),
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
references: [subgraph_account.id]
|
|
1725
|
-
})
|
|
1726
|
-
}));
|
|
1727
|
-
var subgraph_multicoinAddrChangedRelations = relations4(
|
|
1728
|
-
subgraph_multicoinAddrChanged,
|
|
1729
|
-
({ one }) => ({
|
|
1730
|
-
resolver: one(subgraph_resolver, {
|
|
1731
|
-
fields: [subgraph_multicoinAddrChanged.resolverId],
|
|
1732
|
-
references: [subgraph_resolver.id]
|
|
1733
|
-
})
|
|
1927
|
+
(t) => ({
|
|
1928
|
+
byId: uniqueIndex3().on(t.domainId, t.registrationIndex, t.renewalIndex)
|
|
1734
1929
|
})
|
|
1735
1930
|
);
|
|
1736
|
-
var
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
})
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
fields: [
|
|
1745
|
-
references: [
|
|
1746
|
-
})
|
|
1747
|
-
}));
|
|
1748
|
-
var subgraph_pubkeyChangedRelations = relations4(subgraph_pubkeyChanged, ({ one }) => ({
|
|
1749
|
-
resolver: one(subgraph_resolver, {
|
|
1750
|
-
fields: [subgraph_pubkeyChanged.resolverId],
|
|
1751
|
-
references: [subgraph_resolver.id]
|
|
1752
|
-
})
|
|
1753
|
-
}));
|
|
1754
|
-
var subgraph_textChangedRelations = relations4(subgraph_textChanged, ({ one }) => ({
|
|
1755
|
-
resolver: one(subgraph_resolver, {
|
|
1756
|
-
fields: [subgraph_textChanged.resolverId],
|
|
1757
|
-
references: [subgraph_resolver.id]
|
|
1758
|
-
})
|
|
1759
|
-
}));
|
|
1760
|
-
var subgraph_contenthashChangedRelations = relations4(
|
|
1761
|
-
subgraph_contenthashChanged,
|
|
1762
|
-
({ one }) => ({
|
|
1763
|
-
resolver: one(subgraph_resolver, {
|
|
1764
|
-
fields: [subgraph_contenthashChanged.resolverId],
|
|
1765
|
-
references: [subgraph_resolver.id]
|
|
1766
|
-
})
|
|
1931
|
+
var renewal_relations = relations4(renewal, ({ one }) => ({
|
|
1932
|
+
// belongs to registration
|
|
1933
|
+
registration: one(registration, {
|
|
1934
|
+
fields: [renewal.domainId, renewal.registrationIndex],
|
|
1935
|
+
references: [registration.domainId, registration.registrationIndex]
|
|
1936
|
+
}),
|
|
1937
|
+
// has an event
|
|
1938
|
+
event: one(event, {
|
|
1939
|
+
fields: [renewal.eventId],
|
|
1940
|
+
references: [event.id]
|
|
1767
1941
|
})
|
|
1942
|
+
}));
|
|
1943
|
+
var latestRenewalIndex = onchainTable6(
|
|
1944
|
+
"latest_renewal_indexes",
|
|
1945
|
+
(t) => ({
|
|
1946
|
+
domainId: t.text().notNull().$type(),
|
|
1947
|
+
registrationIndex: t.integer().notNull(),
|
|
1948
|
+
renewalIndex: t.integer().notNull()
|
|
1949
|
+
}),
|
|
1950
|
+
(t) => ({ pk: primaryKey3({ columns: [t.domainId, t.registrationIndex] }) })
|
|
1768
1951
|
);
|
|
1769
|
-
var
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1952
|
+
var latestRenewalIndex_relations = relations4(latestRenewalIndex, ({ one }) => ({
|
|
1953
|
+
// references domain
|
|
1954
|
+
domain: one(domain, {
|
|
1955
|
+
fields: [latestRenewalIndex.domainId],
|
|
1956
|
+
references: [domain.id]
|
|
1957
|
+
})
|
|
1958
|
+
}));
|
|
1959
|
+
var permissions = onchainTable6(
|
|
1960
|
+
"permissions",
|
|
1961
|
+
(t) => ({
|
|
1962
|
+
id: t.text().primaryKey().$type(),
|
|
1963
|
+
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
1964
|
+
address: t.hex().notNull().$type()
|
|
1965
|
+
}),
|
|
1966
|
+
(t) => ({
|
|
1967
|
+
byId: uniqueIndex3().on(t.chainId, t.address)
|
|
1776
1968
|
})
|
|
1777
1969
|
);
|
|
1778
|
-
var
|
|
1779
|
-
|
|
1780
|
-
(
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1970
|
+
var relations_permissions = relations4(permissions, ({ many }) => ({
|
|
1971
|
+
resources: many(permissionsResource),
|
|
1972
|
+
users: many(permissionsUser)
|
|
1973
|
+
}));
|
|
1974
|
+
var permissionsResource = onchainTable6(
|
|
1975
|
+
"permissions_resources",
|
|
1976
|
+
(t) => ({
|
|
1977
|
+
id: t.text().primaryKey().$type(),
|
|
1978
|
+
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
1979
|
+
address: t.hex().notNull().$type(),
|
|
1980
|
+
resource: t.bigint().notNull()
|
|
1981
|
+
}),
|
|
1982
|
+
(t) => ({
|
|
1983
|
+
byId: uniqueIndex3().on(t.chainId, t.address, t.resource)
|
|
1785
1984
|
})
|
|
1786
1985
|
);
|
|
1787
|
-
var
|
|
1788
|
-
|
|
1789
|
-
fields: [
|
|
1790
|
-
references: [
|
|
1986
|
+
var relations_permissionsResource = relations4(permissionsResource, ({ one }) => ({
|
|
1987
|
+
permissions: one(permissions, {
|
|
1988
|
+
fields: [permissionsResource.chainId, permissionsResource.address],
|
|
1989
|
+
references: [permissions.chainId, permissions.address]
|
|
1791
1990
|
})
|
|
1792
1991
|
}));
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
import { index as index4, onchainTable as onchainTable6 } from "ponder";
|
|
1796
|
-
var nameSales = onchainTable6(
|
|
1797
|
-
"name_sales",
|
|
1992
|
+
var permissionsUser = onchainTable6(
|
|
1993
|
+
"permissions_users",
|
|
1798
1994
|
(t) => ({
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
*/
|
|
1808
|
-
chainId: t.int8({ mode: "number" }).notNull(),
|
|
1809
|
-
/**
|
|
1810
|
-
* The block number on chainId where the sale occurred.
|
|
1811
|
-
*/
|
|
1812
|
-
blockNumber: t.bigint().notNull(),
|
|
1813
|
-
/**
|
|
1814
|
-
* The log index position of the sale event within blockNumber.
|
|
1815
|
-
*/
|
|
1816
|
-
logIndex: t.integer().notNull(),
|
|
1817
|
-
/**
|
|
1818
|
-
* The EVM transaction hash on chainId associated with the sale.
|
|
1819
|
-
*/
|
|
1820
|
-
transactionHash: t.hex().notNull(),
|
|
1821
|
-
/**
|
|
1822
|
-
* The Seaport order hash.
|
|
1823
|
-
*/
|
|
1824
|
-
orderHash: t.hex().notNull(),
|
|
1825
|
-
/**
|
|
1826
|
-
* The address of the contract on chainId that manages tokenId.
|
|
1827
|
-
*/
|
|
1828
|
-
contractAddress: t.hex().notNull(),
|
|
1829
|
-
/**
|
|
1830
|
-
* The tokenId managed by contractAddress that was sold.
|
|
1831
|
-
*
|
|
1832
|
-
* In a general context (outside of TokenScope) ERC1155 NFTs may have
|
|
1833
|
-
* multiple copies, however TokenScope guarantees that all indexed NFTs
|
|
1834
|
-
* never have an amount / balance > 1.
|
|
1835
|
-
*/
|
|
1836
|
-
tokenId: t.bigint().notNull(),
|
|
1837
|
-
/**
|
|
1838
|
-
* The CAIP-19 Asset Namespace of the token that was sold. Either `erc721` or `erc1155`.
|
|
1839
|
-
*
|
|
1840
|
-
* @see https://chainagnostic.org/CAIPs/caip-19
|
|
1841
|
-
*/
|
|
1842
|
-
assetNamespace: t.text().notNull(),
|
|
1843
|
-
/**
|
|
1844
|
-
* The CAIP-19 Asset ID of token that was sold. This is a globally unique reference to the
|
|
1845
|
-
* specific asset in question.
|
|
1846
|
-
*
|
|
1847
|
-
* @see https://chainagnostic.org/CAIPs/caip-19
|
|
1848
|
-
*/
|
|
1849
|
-
assetId: t.text().notNull(),
|
|
1850
|
-
/**
|
|
1851
|
-
* The namehash (Node) of the ENS domain that was sold.
|
|
1852
|
-
*/
|
|
1853
|
-
domainId: t.hex().notNull(),
|
|
1854
|
-
/**
|
|
1855
|
-
* The account that bought the token controlling ownership of domainId from
|
|
1856
|
-
* the seller for the amount of currency associated with the sale.
|
|
1857
|
-
*/
|
|
1858
|
-
buyer: t.hex().notNull(),
|
|
1859
|
-
/**
|
|
1860
|
-
* The account that sold the token controlling ownership of domainId to
|
|
1861
|
-
* buyer for the amount of currency associated with the sale.
|
|
1862
|
-
*/
|
|
1863
|
-
seller: t.hex().notNull(),
|
|
1864
|
-
/**
|
|
1865
|
-
* Currency of the payment (ETH, USDC or DAI) from buyer to seller in exchange for tokenId.
|
|
1866
|
-
*/
|
|
1867
|
-
currency: t.text().notNull(),
|
|
1868
|
-
/**
|
|
1869
|
-
* The amount of currency paid from buyer to seller in exchange for tokenId.
|
|
1870
|
-
*
|
|
1871
|
-
* Denominated in the smallest unit of currency.
|
|
1872
|
-
*
|
|
1873
|
-
* Amount interpretation depends on currency:
|
|
1874
|
-
* - ETH/WETH: Amount in wei (1 ETH = 10^18 wei)
|
|
1875
|
-
* - USDC: Amount in micro-units (1 USDC = 10^6 units)
|
|
1876
|
-
* - DAI: Amount in wei-equivalent (1 DAI = 10^18 units)
|
|
1877
|
-
*/
|
|
1878
|
-
amount: t.bigint().notNull(),
|
|
1879
|
-
/**
|
|
1880
|
-
* Unix timestamp of the block timestamp when the sale occurred.
|
|
1881
|
-
*/
|
|
1882
|
-
timestamp: t.bigint().notNull()
|
|
1995
|
+
id: t.text().primaryKey().$type(),
|
|
1996
|
+
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
1997
|
+
address: t.hex().notNull().$type(),
|
|
1998
|
+
resource: t.bigint().notNull(),
|
|
1999
|
+
// The user/grantee address this Permission is granted to (the HCA account address if used).
|
|
2000
|
+
user: t.hex().notNull().$type(),
|
|
2001
|
+
// has one roles bitmap
|
|
2002
|
+
roles: t.bigint().notNull()
|
|
1883
2003
|
}),
|
|
1884
2004
|
(t) => ({
|
|
1885
|
-
|
|
1886
|
-
idx_assetId: index4().on(t.assetId),
|
|
1887
|
-
idx_buyer: index4().on(t.buyer),
|
|
1888
|
-
idx_seller: index4().on(t.seller),
|
|
1889
|
-
idx_timestamp: index4().on(t.timestamp)
|
|
2005
|
+
byId: uniqueIndex3().on(t.chainId, t.address, t.resource, t.user)
|
|
1890
2006
|
})
|
|
1891
2007
|
);
|
|
1892
|
-
var
|
|
1893
|
-
|
|
2008
|
+
var relations_permissionsUser = relations4(permissionsUser, ({ one }) => ({
|
|
2009
|
+
account: one(account, {
|
|
2010
|
+
fields: [permissionsUser.user],
|
|
2011
|
+
references: [account.id]
|
|
2012
|
+
}),
|
|
2013
|
+
permissions: one(permissions, {
|
|
2014
|
+
fields: [permissionsUser.chainId, permissionsUser.address],
|
|
2015
|
+
references: [permissions.chainId, permissions.address]
|
|
2016
|
+
}),
|
|
2017
|
+
resource: one(permissionsResource, {
|
|
2018
|
+
fields: [permissionsUser.chainId, permissionsUser.address, permissionsUser.resource],
|
|
2019
|
+
references: [
|
|
2020
|
+
permissionsResource.chainId,
|
|
2021
|
+
permissionsResource.address,
|
|
2022
|
+
permissionsResource.resource
|
|
2023
|
+
]
|
|
2024
|
+
})
|
|
2025
|
+
}));
|
|
2026
|
+
var label = onchainTable6(
|
|
2027
|
+
"labels",
|
|
1894
2028
|
(t) => ({
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
*
|
|
1898
|
-
* This is a globally unique reference to the token.
|
|
1899
|
-
*
|
|
1900
|
-
* @see https://chainagnostic.org/CAIPs/caip-19
|
|
1901
|
-
*/
|
|
1902
|
-
id: t.text().primaryKey(),
|
|
1903
|
-
/**
|
|
1904
|
-
* The namehash (Node) of the ENS name associated with the token.
|
|
1905
|
-
*
|
|
1906
|
-
* Note: An ENS name may have more than one distinct token across time. It is
|
|
1907
|
-
* also possible for multiple distinct tokens for an ENS name to have
|
|
1908
|
-
* a mintStatus of `minted` at the same time. For example:
|
|
1909
|
-
* - When a direct subname of .eth is wrapped by the NameWrapper. This state
|
|
1910
|
-
* has one minted token for the name managed by the BaseRegistrar (this
|
|
1911
|
-
* token will be owned by the NameWrapper) and another minted token for
|
|
1912
|
-
* the name managed by the NameWrapper (owned by the effective owner of
|
|
1913
|
-
* the name).
|
|
1914
|
-
* - When a direct subname of .eth is wrapped by the NameWrapper and then
|
|
1915
|
-
* unwrapped. This state has one minted token (managed by the BaseRegistrar)
|
|
1916
|
-
* and another burned token (managed by the NameWrapper).
|
|
1917
|
-
*/
|
|
1918
|
-
domainId: t.hex().notNull(),
|
|
1919
|
-
/**
|
|
1920
|
-
* The chain that manages the token.
|
|
1921
|
-
*/
|
|
1922
|
-
chainId: t.int8({ mode: "number" }).notNull(),
|
|
1923
|
-
/**
|
|
1924
|
-
* The address of the contract on chainId that manages the token.
|
|
1925
|
-
*/
|
|
1926
|
-
contractAddress: t.hex().notNull(),
|
|
1927
|
-
/**
|
|
1928
|
-
* The tokenId of the token managed by contractAddress.
|
|
1929
|
-
*
|
|
1930
|
-
* In a general context (outside of TokenScope) ERC1155 NFTs may have
|
|
1931
|
-
* multiple copies, however TokenScope guarantees that all indexed NFTs
|
|
1932
|
-
* never have an amount / balance > 1.
|
|
1933
|
-
*/
|
|
1934
|
-
tokenId: t.bigint().notNull(),
|
|
1935
|
-
/**
|
|
1936
|
-
* The CAIP-19 Asset Namespace of the token. Either `erc721` or `erc1155`.
|
|
1937
|
-
*
|
|
1938
|
-
* @see https://chainagnostic.org/CAIPs/caip-19
|
|
1939
|
-
*/
|
|
1940
|
-
assetNamespace: t.text().notNull(),
|
|
1941
|
-
/**
|
|
1942
|
-
* The account that owns the token.
|
|
1943
|
-
*
|
|
1944
|
-
* Value is zeroAddress if and only if mintStatus is `burned`.
|
|
1945
|
-
*
|
|
1946
|
-
* Note: The owner of the token for a given domainId may differ from the
|
|
1947
|
-
* owner of the associated node in the registry. For example:
|
|
1948
|
-
* - Consider the case where address X owns the ENS name `foo.eth` in
|
|
1949
|
-
* both the BaseRegistrar and the Registry. If X sends a request directly
|
|
1950
|
-
* to the Registry to transfer ownership to Y, ownership of `foo.eth` will
|
|
1951
|
-
* be transferred to Y in the Registry but not in the BaseRegistrar.
|
|
1952
|
-
* - ... for the case above, the BaseRegistrar implements a `reclaim`
|
|
1953
|
-
* allowing the owner of the name in the BaseRegistrar to reclaim ownership
|
|
1954
|
-
* of the name in the Registry.
|
|
1955
|
-
*
|
|
1956
|
-
* Note: When a name is wrapped by the NameWrapper, the owner of the token
|
|
1957
|
-
* in the BaseRegistrar is the NameWrapper, while a new token for the name is
|
|
1958
|
-
* minted by the NameWrapper and owned by the effective owner of the name.
|
|
1959
|
-
*/
|
|
1960
|
-
owner: t.hex().notNull(),
|
|
1961
|
-
/**
|
|
1962
|
-
* The mint status of the token. Either `minted` or `burned`.
|
|
1963
|
-
*
|
|
1964
|
-
* After we index a NFT we never delete it from our index. Instead, when an
|
|
1965
|
-
* indexed NFT is burned onchain we retain its record and update its mint
|
|
1966
|
-
* status as `burned`. If a NFT is minted again after it is burned its mint
|
|
1967
|
-
* status is updated to `minted`.
|
|
1968
|
-
*/
|
|
1969
|
-
mintStatus: t.text().notNull()
|
|
2029
|
+
labelHash: t.hex().primaryKey().$type(),
|
|
2030
|
+
interpreted: t.text().notNull().$type()
|
|
1970
2031
|
}),
|
|
1971
2032
|
(t) => ({
|
|
1972
|
-
|
|
1973
|
-
|
|
2033
|
+
// hash index avoids the btree 8191-byte row-size hazard for spam labels (a single label can
|
|
2034
|
+
// exceed btree's leaf-size limit)
|
|
2035
|
+
byInterpretedExact: index5().using("hash", t.interpreted),
|
|
2036
|
+
// GIN trigram index for substring / similarity queries (inline `gin_trgm_ops` via `sql`
|
|
2037
|
+
// because passing it through `.op()` gets dropped by Ponder)
|
|
2038
|
+
byInterpretedFuzzy: index5().using("gin", sql2`${t.interpreted} gin_trgm_ops`)
|
|
1974
2039
|
})
|
|
1975
2040
|
);
|
|
2041
|
+
var label_relations = relations4(label, ({ many }) => ({
|
|
2042
|
+
domains: many(domain)
|
|
2043
|
+
}));
|
|
1976
2044
|
|
|
1977
2045
|
// src/ensnode/index.ts
|
|
1978
2046
|
var ensnode_exports = {};
|
|
@@ -2255,6 +2323,12 @@ var EnsDbReader = class {
|
|
|
2255
2323
|
}
|
|
2256
2324
|
return deserializeIndexingMetadataContext(record);
|
|
2257
2325
|
}
|
|
2326
|
+
/**
|
|
2327
|
+
* Destroy the ENSDbReader instance by closing the ENSDb connection pool.
|
|
2328
|
+
*/
|
|
2329
|
+
async destroy() {
|
|
2330
|
+
await this.ensDb.$client.end();
|
|
2331
|
+
}
|
|
2258
2332
|
/**
|
|
2259
2333
|
* Get ENSNode Metadata record
|
|
2260
2334
|
*
|