@ensnode/ensdb-sdk 1.14.0 → 1.15.1

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