@ensnode/ensdb-sdk 0.0.0-next-20260316192200

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 ADDED
@@ -0,0 +1,1936 @@
1
+ // src/schemas/ensnode-metadata.schema.ts
2
+ import { onchainTable } from "ponder";
3
+ var ensNodeMetadata = onchainTable("ensnode_metadata", (t) => ({
4
+ /**
5
+ * Key
6
+ *
7
+ * Allowed keys:
8
+ * - `EnsNodeMetadataEnsDbVersion['key']`
9
+ * - `EnsNodeMetadataEnsIndexerPublicConfig['key']`
10
+ * - `EnsNodeMetadataEnsIndexerIndexingStatus['key']`
11
+ */
12
+ key: t.text().primaryKey(),
13
+ /**
14
+ * Value
15
+ *
16
+ * Allowed values:
17
+ * - `EnsNodeMetadataEnsDbVersion['value']`
18
+ * - `EnsNodeMetadataEnsIndexerPublicConfig['value']`
19
+ * - `EnsNodeMetadataEnsIndexerIndexingStatus['value']`
20
+ *
21
+ * Guaranteed to be a serialized representation of JSON object.
22
+ */
23
+ value: t.jsonb().notNull()
24
+ }));
25
+
26
+ // src/schemas/ensv2.schema.ts
27
+ import { index, onchainEnum, onchainTable as onchainTable2, primaryKey, relations, sql, uniqueIndex } from "ponder";
28
+ var event = onchainTable2(
29
+ "events",
30
+ (t) => ({
31
+ // Ponder's event.id
32
+ id: t.text().primaryKey(),
33
+ // Event Log Metadata
34
+ // chain
35
+ chainId: t.integer().notNull().$type(),
36
+ // block
37
+ blockNumber: t.bigint().notNull().$type(),
38
+ blockHash: t.hex().notNull().$type(),
39
+ timestamp: t.bigint().notNull(),
40
+ // transaction
41
+ transactionHash: t.hex().notNull().$type(),
42
+ transactionIndex: t.integer().notNull(),
43
+ from: t.hex().notNull().$type(),
44
+ to: t.hex().$type(),
45
+ // NOTE: a null `to` means this was a tx that deployed a contract
46
+ // log
47
+ address: t.hex().notNull().$type(),
48
+ logIndex: t.integer().notNull().$type(),
49
+ selector: t.hex().notNull().$type(),
50
+ topics: t.hex().array().notNull().$type(),
51
+ data: t.hex().notNull()
52
+ }),
53
+ (t) => ({
54
+ bySelector: index().on(t.selector),
55
+ byFrom: index().on(t.from),
56
+ byTimestamp: index().on(t.timestamp)
57
+ })
58
+ );
59
+ var domainEvent = onchainTable2(
60
+ "domain_events",
61
+ (t) => ({
62
+ domainId: t.text().notNull().$type(),
63
+ eventId: t.text().notNull()
64
+ }),
65
+ (t) => ({ pk: primaryKey({ columns: [t.domainId, t.eventId] }) })
66
+ );
67
+ var resolverEvent = onchainTable2(
68
+ "resolver_events",
69
+ (t) => ({
70
+ resolverId: t.text().notNull().$type(),
71
+ eventId: t.text().notNull()
72
+ }),
73
+ (t) => ({ pk: primaryKey({ columns: [t.resolverId, t.eventId] }) })
74
+ );
75
+ var permissionsEvent = onchainTable2(
76
+ "permissions_events",
77
+ (t) => ({
78
+ permissionsId: t.text().notNull().$type(),
79
+ eventId: t.text().notNull()
80
+ }),
81
+ (t) => ({ pk: primaryKey({ columns: [t.permissionsId, t.eventId] }) })
82
+ );
83
+ var account = onchainTable2("accounts", (t) => ({
84
+ id: t.hex().primaryKey().$type()
85
+ }));
86
+ var account_relations = relations(account, ({ many }) => ({
87
+ registrations: many(registration, { relationName: "registrant" }),
88
+ domains: many(v2Domain),
89
+ permissions: many(permissionsUser)
90
+ }));
91
+ var registry = onchainTable2(
92
+ "registries",
93
+ (t) => ({
94
+ // see RegistryId for guarantees
95
+ id: t.text().primaryKey().$type(),
96
+ chainId: t.integer().notNull().$type(),
97
+ address: t.hex().notNull().$type()
98
+ }),
99
+ (t) => ({
100
+ byId: uniqueIndex().on(t.chainId, t.address)
101
+ })
102
+ );
103
+ var relations_registry = relations(registry, ({ one, many }) => ({
104
+ domain: one(v2Domain, {
105
+ relationName: "subregistry",
106
+ fields: [registry.id],
107
+ references: [v2Domain.registryId]
108
+ }),
109
+ domains: many(v2Domain, { relationName: "registry" }),
110
+ permissions: one(permissions, {
111
+ relationName: "permissions",
112
+ fields: [registry.chainId, registry.address],
113
+ references: [permissions.chainId, permissions.address]
114
+ })
115
+ }));
116
+ var v1Domain = onchainTable2(
117
+ "v1_domains",
118
+ (t) => ({
119
+ // keyed by node, see ENSv1DomainId for guarantees.
120
+ id: t.text().primaryKey().$type(),
121
+ // must have a parent v1Domain (note: root node does not exist in index)
122
+ parentId: t.text().notNull().$type(),
123
+ // may have an owner
124
+ ownerId: t.hex().$type(),
125
+ // represents a labelHash
126
+ labelHash: t.hex().notNull().$type(),
127
+ // may have a `rootRegistryOwner` (ENSv1Registry's owner()), zeroAddress interpreted as null
128
+ rootRegistryOwnerId: t.hex().$type()
129
+ // NOTE: Domain-Resolver Relations tracked via Protocol Acceleration plugin
130
+ }),
131
+ (t) => ({
132
+ byParent: index().on(t.parentId),
133
+ byOwner: index().on(t.ownerId),
134
+ byLabelHash: index().on(t.labelHash)
135
+ })
136
+ );
137
+ var relations_v1Domain = relations(v1Domain, ({ one, many }) => ({
138
+ // v1Domain
139
+ parent: one(v1Domain, {
140
+ fields: [v1Domain.parentId],
141
+ references: [v1Domain.id]
142
+ }),
143
+ children: many(v1Domain, { relationName: "parent" }),
144
+ rootRegistryOwner: one(account, {
145
+ relationName: "rootRegistryOwner",
146
+ fields: [v1Domain.rootRegistryOwnerId],
147
+ references: [account.id]
148
+ }),
149
+ // shared
150
+ owner: one(account, {
151
+ relationName: "owner",
152
+ fields: [v1Domain.ownerId],
153
+ references: [account.id]
154
+ }),
155
+ label: one(label, {
156
+ relationName: "label",
157
+ fields: [v1Domain.labelHash],
158
+ references: [label.labelHash]
159
+ }),
160
+ registrations: many(registration)
161
+ }));
162
+ var v2Domain = onchainTable2(
163
+ "v2_domains",
164
+ (t) => ({
165
+ // see ENSv2DomainId for guarantees
166
+ id: t.text().primaryKey().$type(),
167
+ // has a tokenId
168
+ tokenId: t.bigint().notNull(),
169
+ // belongs to registry
170
+ registryId: t.text().notNull().$type(),
171
+ // may have one subregistry
172
+ subregistryId: t.text().$type(),
173
+ // may have an owner
174
+ ownerId: t.hex().$type(),
175
+ // represents a labelHash
176
+ labelHash: t.hex().notNull().$type()
177
+ // NOTE: Domain-Resolver Relations tracked via Protocol Acceleration plugin
178
+ }),
179
+ (t) => ({
180
+ byRegistry: index().on(t.registryId),
181
+ bySubregistry: index().on(t.subregistryId).where(sql`${t.subregistryId} IS NOT NULL`),
182
+ byOwner: index().on(t.ownerId),
183
+ byLabelHash: index().on(t.labelHash)
184
+ })
185
+ );
186
+ var relations_v2Domain = relations(v2Domain, ({ one, many }) => ({
187
+ // v2Domain
188
+ registry: one(registry, {
189
+ relationName: "registry",
190
+ fields: [v2Domain.registryId],
191
+ references: [registry.id]
192
+ }),
193
+ subregistry: one(registry, {
194
+ relationName: "subregistry",
195
+ fields: [v2Domain.subregistryId],
196
+ references: [registry.id]
197
+ }),
198
+ // shared
199
+ owner: one(account, {
200
+ relationName: "owner",
201
+ fields: [v2Domain.ownerId],
202
+ references: [account.id]
203
+ }),
204
+ label: one(label, {
205
+ relationName: "label",
206
+ fields: [v2Domain.labelHash],
207
+ references: [label.labelHash]
208
+ }),
209
+ registrations: many(registration)
210
+ }));
211
+ var registrationType = onchainEnum("RegistrationType", [
212
+ // TODO: prefix these with ENSv1, maybe excluding ThreeDNS
213
+ "NameWrapper",
214
+ "BaseRegistrar",
215
+ "ThreeDNS",
216
+ "ENSv2Registry"
217
+ ]);
218
+ var registration = onchainTable2(
219
+ "registrations",
220
+ (t) => ({
221
+ // keyed by (domainId, index)
222
+ id: t.text().primaryKey().$type(),
223
+ domainId: t.text().notNull().$type(),
224
+ index: t.integer().notNull(),
225
+ // has a type
226
+ type: registrationType().notNull(),
227
+ // has a start
228
+ start: t.bigint().notNull(),
229
+ // may have an expiry
230
+ expiry: t.bigint(),
231
+ // maybe have a grace period (BaseRegistrar)
232
+ gracePeriod: t.bigint(),
233
+ // registrar AccountId
234
+ registrarChainId: t.integer().notNull().$type(),
235
+ registrarAddress: t.hex().notNull().$type(),
236
+ // references registrant
237
+ registrantId: t.hex().$type(),
238
+ // may have a referrer
239
+ referrer: t.hex().$type(),
240
+ // may have fuses (NameWrapper, Wrapped BaseRegistrar)
241
+ fuses: t.integer(),
242
+ // TODO(paymentToken): add payment token tracking here
243
+ // may have base cost (BaseRegistrar, ENSv2Registrar)
244
+ base: t.bigint(),
245
+ // may have a premium (BaseRegistrar)
246
+ premium: t.bigint(),
247
+ // may be Wrapped (BaseRegistrar)
248
+ wrapped: t.boolean().default(false),
249
+ // has an event
250
+ eventId: t.text().notNull()
251
+ }),
252
+ (t) => ({
253
+ byId: uniqueIndex().on(t.domainId, t.index)
254
+ })
255
+ );
256
+ var latestRegistrationIndex = onchainTable2("latest_registration_indexes", (t) => ({
257
+ domainId: t.text().primaryKey().$type(),
258
+ index: t.integer().notNull()
259
+ }));
260
+ var registration_relations = relations(registration, ({ one, many }) => ({
261
+ // belongs to either v1Domain or v2Domain
262
+ v1Domain: one(v1Domain, {
263
+ fields: [registration.domainId],
264
+ references: [v1Domain.id]
265
+ }),
266
+ v2Domain: one(v2Domain, {
267
+ fields: [registration.domainId],
268
+ references: [v2Domain.id]
269
+ }),
270
+ // has one registrant
271
+ registrant: one(account, {
272
+ fields: [registration.registrantId],
273
+ references: [account.id],
274
+ relationName: "registrant"
275
+ }),
276
+ // has many renewals
277
+ renewals: many(renewal),
278
+ // has an event
279
+ event: one(event, {
280
+ fields: [registration.eventId],
281
+ references: [event.id]
282
+ })
283
+ }));
284
+ var renewal = onchainTable2(
285
+ "renewals",
286
+ (t) => ({
287
+ // keyed by (registrationId, index)
288
+ id: t.text().primaryKey().$type(),
289
+ domainId: t.text().notNull().$type(),
290
+ registrationIndex: t.integer().notNull(),
291
+ index: t.integer().notNull(),
292
+ // all renewals have a duration
293
+ duration: t.bigint().notNull(),
294
+ // may have a referrer
295
+ referrer: t.hex().$type(),
296
+ // TODO(paymentToken): add payment token tracking here
297
+ // may have base cost
298
+ base: t.bigint(),
299
+ // may have a premium (ENSv1 RegistrarControllers)
300
+ premium: t.bigint(),
301
+ // has an event
302
+ eventId: t.text().notNull()
303
+ }),
304
+ (t) => ({
305
+ byId: uniqueIndex().on(t.domainId, t.registrationIndex, t.index)
306
+ })
307
+ );
308
+ var renewal_relations = relations(renewal, ({ one }) => ({
309
+ // belongs to registration
310
+ registration: one(registration, {
311
+ fields: [renewal.domainId, renewal.registrationIndex],
312
+ references: [registration.domainId, registration.index]
313
+ }),
314
+ // has an event
315
+ event: one(event, {
316
+ fields: [renewal.eventId],
317
+ references: [event.id]
318
+ })
319
+ }));
320
+ var latestRenewalIndex = onchainTable2(
321
+ "latest_renewal_indexes",
322
+ (t) => ({
323
+ domainId: t.text().notNull().$type(),
324
+ registrationIndex: t.integer().notNull(),
325
+ index: t.integer().notNull()
326
+ }),
327
+ (t) => ({ pk: primaryKey({ columns: [t.domainId, t.registrationIndex] }) })
328
+ );
329
+ var permissions = onchainTable2(
330
+ "permissions",
331
+ (t) => ({
332
+ id: t.text().primaryKey().$type(),
333
+ chainId: t.integer().notNull().$type(),
334
+ address: t.hex().notNull().$type()
335
+ }),
336
+ (t) => ({
337
+ byId: uniqueIndex().on(t.chainId, t.address)
338
+ })
339
+ );
340
+ var relations_permissions = relations(permissions, ({ many }) => ({
341
+ resources: many(permissionsResource),
342
+ users: many(permissionsUser)
343
+ }));
344
+ var permissionsResource = onchainTable2(
345
+ "permissions_resources",
346
+ (t) => ({
347
+ id: t.text().primaryKey().$type(),
348
+ chainId: t.integer().notNull().$type(),
349
+ address: t.hex().notNull().$type(),
350
+ resource: t.bigint().notNull()
351
+ }),
352
+ (t) => ({
353
+ byId: uniqueIndex().on(t.chainId, t.address, t.resource)
354
+ })
355
+ );
356
+ var relations_permissionsResource = relations(permissionsResource, ({ one }) => ({
357
+ permissions: one(permissions, {
358
+ fields: [permissionsResource.chainId, permissionsResource.address],
359
+ references: [permissions.chainId, permissions.address]
360
+ })
361
+ }));
362
+ var permissionsUser = onchainTable2(
363
+ "permissions_users",
364
+ (t) => ({
365
+ id: t.text().primaryKey().$type(),
366
+ chainId: t.integer().notNull().$type(),
367
+ address: t.hex().notNull().$type(),
368
+ resource: t.bigint().notNull(),
369
+ user: t.hex().notNull().$type(),
370
+ // has one roles bitmap
371
+ roles: t.bigint().notNull()
372
+ }),
373
+ (t) => ({
374
+ byId: uniqueIndex().on(t.chainId, t.address, t.resource, t.user)
375
+ })
376
+ );
377
+ var relations_permissionsUser = relations(permissionsUser, ({ one }) => ({
378
+ account: one(account, {
379
+ fields: [permissionsUser.user],
380
+ references: [account.id]
381
+ }),
382
+ permissions: one(permissions, {
383
+ fields: [permissionsUser.chainId, permissionsUser.address],
384
+ references: [permissions.chainId, permissions.address]
385
+ }),
386
+ resource: one(permissionsResource, {
387
+ fields: [permissionsUser.chainId, permissionsUser.address, permissionsUser.resource],
388
+ references: [
389
+ permissionsResource.chainId,
390
+ permissionsResource.address,
391
+ permissionsResource.resource
392
+ ]
393
+ })
394
+ }));
395
+ var label = onchainTable2(
396
+ "labels",
397
+ (t) => ({
398
+ labelHash: t.hex().primaryKey().$type(),
399
+ interpreted: t.text().notNull().$type()
400
+ }),
401
+ (t) => ({
402
+ byInterpreted: index().on(t.interpreted)
403
+ })
404
+ );
405
+ var label_relations = relations(label, ({ many }) => ({
406
+ domains: many(v2Domain)
407
+ }));
408
+ var registryCanonicalDomain = onchainTable2("registry_canonical_domains", (t) => ({
409
+ registryId: t.text().primaryKey().$type(),
410
+ domainId: t.text().notNull().$type()
411
+ }));
412
+
413
+ // src/schemas/protocol-acceleration.schema.ts
414
+ import { onchainTable as onchainTable3, primaryKey as primaryKey2, relations as relations2, uniqueIndex as uniqueIndex2 } from "ponder";
415
+ var reverseNameRecord = onchainTable3(
416
+ "reverse_name_records",
417
+ (t) => ({
418
+ // keyed by (address, coinType)
419
+ address: t.hex().notNull().$type(),
420
+ coinType: t.bigint().notNull(),
421
+ /**
422
+ * Represents the ENSIP-19 Reverse Name Record for a given (address, coinType).
423
+ *
424
+ * The value of this field is guaranteed to be a non-empty-string normalized ENS name (see
425
+ * `interpretNameRecordValue` for additional context and specific guarantees). Unnormalized
426
+ * names and empty string values are interpreted as a deletion of the associated Reverse Name
427
+ * Record entity (represented in the schema as the _absence_ of a relevant Reverse Name Record
428
+ * entity).
429
+ */
430
+ value: t.text().notNull()
431
+ }),
432
+ (t) => ({
433
+ pk: primaryKey2({ columns: [t.address, t.coinType] })
434
+ })
435
+ );
436
+ var domainResolverRelation = onchainTable3(
437
+ "domain_resolver_relations",
438
+ (t) => ({
439
+ // keyed by (chainId, registry, node)
440
+ chainId: t.integer().notNull().$type(),
441
+ // The Registry (ENSv1Registry or ENSv2Registry)'s AccountId.
442
+ address: t.hex().notNull().$type(),
443
+ domainId: t.hex().notNull().$type(),
444
+ // The Domain's assigned Resolver's address (NOTE: always scoped to chainId)
445
+ resolver: t.hex().notNull().$type()
446
+ }),
447
+ (t) => ({
448
+ pk: primaryKey2({ columns: [t.chainId, t.address, t.domainId] })
449
+ })
450
+ );
451
+ var domainResolverRelation_relations = relations2(domainResolverRelation, ({ one }) => ({
452
+ resolver: one(resolver, {
453
+ fields: [domainResolverRelation.chainId, domainResolverRelation.resolver],
454
+ references: [resolver.chainId, resolver.address]
455
+ })
456
+ }));
457
+ var resolver = onchainTable3(
458
+ "resolvers",
459
+ (t) => ({
460
+ // keyed by (chainId, address)
461
+ id: t.text().primaryKey().$type(),
462
+ chainId: t.integer().notNull().$type(),
463
+ address: t.hex().notNull().$type()
464
+ }),
465
+ (t) => ({
466
+ byId: uniqueIndex2().on(t.chainId, t.address)
467
+ })
468
+ );
469
+ var resolver_relations = relations2(resolver, ({ many }) => ({
470
+ records: many(resolverRecords)
471
+ }));
472
+ var resolverRecords = onchainTable3(
473
+ "resolver_records",
474
+ (t) => ({
475
+ // keyed by (chainId, resolver, node)
476
+ id: t.text().primaryKey().$type(),
477
+ chainId: t.integer().notNull().$type(),
478
+ address: t.hex().notNull().$type(),
479
+ node: t.hex().notNull().$type(),
480
+ /**
481
+ * Represents the value of the reverse-resolution (ENSIP-3) name() record, used for Reverse Resolution.
482
+ *
483
+ * The emitted record values are interpreted according to `interpretNameRecordValue` — unnormalized
484
+ * names and empty string values are interpreted as a deletion of the associated record (represented
485
+ * here as `null`).
486
+ *
487
+ * If set, the value of this field is guaranteed to be a non-empty-string normalized ENS name
488
+ * (see `interpretNameRecordValue` for additional context and specific guarantees).
489
+ */
490
+ name: t.text()
491
+ }),
492
+ (t) => ({
493
+ byId: uniqueIndex2().on(t.chainId, t.address, t.node)
494
+ })
495
+ );
496
+ var resolverRecords_relations = relations2(resolverRecords, ({ one, many }) => ({
497
+ // belongs to resolver
498
+ resolver: one(resolver, {
499
+ fields: [resolverRecords.chainId, resolverRecords.address],
500
+ references: [resolver.chainId, resolver.address]
501
+ }),
502
+ // resolverRecord has many address records
503
+ addressRecords: many(resolverAddressRecord),
504
+ // resolverRecord has many text records
505
+ textRecords: many(resolverTextRecord)
506
+ }));
507
+ var resolverAddressRecord = onchainTable3(
508
+ "resolver_address_records",
509
+ (t) => ({
510
+ // keyed by ((chainId, resolver, node), coinType)
511
+ chainId: t.integer().notNull().$type(),
512
+ address: t.hex().notNull().$type(),
513
+ node: t.hex().notNull().$type(),
514
+ // NOTE: all well-known CoinTypes fit into javascript number but NOT postgres .integer, must be
515
+ // stored as BigInt
516
+ coinType: t.bigint().notNull(),
517
+ /**
518
+ * Represents the value of the Addresss Record specified by ((chainId, resolver, node), coinType).
519
+ *
520
+ * The value of this field is interpreted by `interpretAddressRecordValue` — see its implementation
521
+ * for additional context and specific guarantees.
522
+ */
523
+ value: t.text().notNull()
524
+ }),
525
+ (t) => ({
526
+ pk: primaryKey2({ columns: [t.chainId, t.address, t.node, t.coinType] })
527
+ })
528
+ );
529
+ var resolverAddressRecordRelations = relations2(resolverAddressRecord, ({ one }) => ({
530
+ // belongs to resolverRecord
531
+ resolver: one(resolverRecords, {
532
+ fields: [
533
+ resolverAddressRecord.chainId,
534
+ resolverAddressRecord.address,
535
+ resolverAddressRecord.node
536
+ ],
537
+ references: [resolverRecords.chainId, resolverRecords.address, resolverRecords.node]
538
+ })
539
+ }));
540
+ var resolverTextRecord = onchainTable3(
541
+ "resolver_text_records",
542
+ (t) => ({
543
+ // keyed by ((chainId, resolver, node), key)
544
+ chainId: t.integer().notNull().$type(),
545
+ address: t.hex().notNull().$type(),
546
+ node: t.hex().notNull().$type(),
547
+ key: t.text().notNull(),
548
+ /**
549
+ * Represents the value of the Text Record specified by ((chainId, resolver, node), key).
550
+ *
551
+ * The value of this field is interpreted by `interpretTextRecordValue` — see its implementation
552
+ * for additional context and specific guarantees.
553
+ */
554
+ value: t.text().notNull()
555
+ }),
556
+ (t) => ({
557
+ pk: primaryKey2({ columns: [t.chainId, t.address, t.node, t.key] })
558
+ })
559
+ );
560
+ var resolverTextRecordRelations = relations2(resolverTextRecord, ({ one }) => ({
561
+ // belongs to resolverRecord
562
+ resolver: one(resolverRecords, {
563
+ fields: [resolverTextRecord.chainId, resolverTextRecord.address, resolverTextRecord.node],
564
+ references: [resolverRecords.chainId, resolverRecords.address, resolverRecords.node]
565
+ })
566
+ }));
567
+ var migratedNode = onchainTable3("migrated_nodes", (t) => ({
568
+ node: t.hex().primaryKey()
569
+ }));
570
+
571
+ // src/schemas/registrars.schema.ts
572
+ import { index as index2, onchainEnum as onchainEnum2, onchainTable as onchainTable4, relations as relations3, uniqueIndex as uniqueIndex3 } from "ponder";
573
+ var subregistries = onchainTable4(
574
+ "subregistries",
575
+ (t) => ({
576
+ /**
577
+ * Subregistry ID
578
+ *
579
+ * Identifies the chainId and address of the smart contract associated
580
+ * with the subregistry.
581
+ *
582
+ * Guaranteed to be a fully lowercase string formatted according to
583
+ * the CAIP-10 standard.
584
+ *
585
+ * @see https://chainagnostic.org/CAIPs/caip-10
586
+ */
587
+ subregistryId: t.text().primaryKey(),
588
+ /**
589
+ * The node (namehash) of the name the subregistry manages subnames of.
590
+ * Example subregistry managed names:
591
+ * - `eth`
592
+ * - `base.eth`
593
+ * - `linea.eth`
594
+ *
595
+ * Guaranteed to be a fully lowercase hex string representation of 32-bytes.
596
+ */
597
+ node: t.hex().notNull()
598
+ }),
599
+ (t) => ({
600
+ uniqueNode: uniqueIndex3().on(t.node)
601
+ })
602
+ );
603
+ var registrationLifecycles = onchainTable4(
604
+ "registration_lifecycles",
605
+ (t) => ({
606
+ /**
607
+ * The node (namehash) of the FQDN of the domain the registration lifecycle
608
+ * is associated with.
609
+ *
610
+ * Guaranteed to be a subname of the node (namehash) of the subregistry
611
+ * identified by `subregistryId`.
612
+ *
613
+ * Guaranteed to be a fully lowercase hex string representation of 32-bytes.
614
+ */
615
+ node: t.hex().primaryKey(),
616
+ /**
617
+ * Subregistry ID
618
+ *
619
+ * Identifies the chainId and address of the subregistry smart contract
620
+ * that manages the registration lifecycle.
621
+ *
622
+ * Guaranteed to be a fully lowercase string formatted according to
623
+ * the CAIP-10 standard.
624
+ *
625
+ * @see https://chainagnostic.org/CAIPs/caip-10
626
+ */
627
+ subregistryId: t.text().notNull(),
628
+ /**
629
+ * Expires at
630
+ *
631
+ * Unix timestamp when the Registration Lifecycle is scheduled to expire.
632
+ */
633
+ expiresAt: t.bigint().notNull()
634
+ }),
635
+ (t) => ({
636
+ bySubregistry: index2().on(t.subregistryId)
637
+ })
638
+ );
639
+ var registrarActionType = onchainEnum2("registrar_action_type", [
640
+ "registration",
641
+ "renewal"
642
+ ]);
643
+ var registrarActions = onchainTable4(
644
+ "registrar_actions",
645
+ (t) => ({
646
+ /**
647
+ * "Logical registrar action" ID
648
+ *
649
+ * The `id` value is a deterministic and globally unique identifier for
650
+ * the "logical registrar action".
651
+ *
652
+ * The `id` value represents the *initial* onchain event associated with
653
+ * the "logical registrar action", but the full state of
654
+ * the "logical registrar action" is an aggregate across each of
655
+ * the onchain events referenced in the `eventIds` field.
656
+ *
657
+ * Guaranteed to be the very first element in `eventIds` array.
658
+ *
659
+ * Implementation details: The `id` value is a Ponder checkpoint string — a fixed-length
660
+ * decimal string encoding the following fields (left to right, most to least significant):
661
+ *
662
+ * | Field | Width (digits) | Description |
663
+ * |--------------------|----------------|-------------------------------------------|
664
+ * | `blockTimestamp` | 10 | Unix seconds timestamp of the block |
665
+ * | `chainId` | 16 | EIP-155 chain ID |
666
+ * | `blockNumber` | 16 | Block number |
667
+ * | `transactionIndex` | 16 | Index of the transaction within the block |
668
+ * | `eventType` | 1 | Internal Ponder event type (always 5) |
669
+ * | `eventIndex` | 16 | Index of the event within the transaction |
670
+ *
671
+ * All fields are zero-padded to their fixed widths, so the string has constant
672
+ * length and lexicographic order equals chronological order.
673
+ *
674
+ * Because all registrar actions originate from Ponder log (smart-contract event)
675
+ * handlers, every `id` shares the same `eventType` digit (5), making direct
676
+ * lexicographic or bigint comparison safe for establishing total chronological order.
677
+ */
678
+ id: t.text().primaryKey(),
679
+ /**
680
+ * The type of the "logical registrar action".
681
+ */
682
+ type: registrarActionType().notNull(),
683
+ /**
684
+ * Subregistry ID
685
+ *
686
+ * The ID of the subregistry the "logical registrar action" was taken on.
687
+ *
688
+ * Identifies the chainId and address of the associated subregistry smart
689
+ * contract.
690
+ *
691
+ * Guaranteed to be a fully lowercase string formatted according to
692
+ * the CAIP-10 standard.
693
+ *
694
+ * @see https://chainagnostic.org/CAIPs/caip-10
695
+ */
696
+ subregistryId: t.text().notNull(),
697
+ /**
698
+ * The node (namehash) of the FQDN of the domain associated with
699
+ * the "logical registrar action".
700
+ *
701
+ * Guaranteed to be a fully lowercase hex string representation of 32-bytes.
702
+ */
703
+ node: t.hex().notNull(),
704
+ /**
705
+ * Incremental Duration
706
+ *
707
+ * If `type` is "registration":
708
+ * - Represents the duration between `blockTimestamp` and
709
+ * the initial `expiresAt` value that the associated
710
+ * "registration lifecycle" will be initialized with.
711
+ * If `type` is "renewal":
712
+ * - Represents the incremental increase in duration made to
713
+ * the `expiresAt` value in the associated "registration lifecycle".
714
+ *
715
+ * A "registration lifecycle" may be extended via renewal even after it
716
+ * expires if it is still within its grace period.
717
+ *
718
+ * Consider the following scenario:
719
+ *
720
+ * The "registration lifecycle" of a direct subname of .eth is scheduled to
721
+ * expire on Jan 1, midnight UTC. It is currently 30 days after this
722
+ * expiration time. Therefore, there are currently another 60 days of grace
723
+ * period remaining for this name. Anyone can still make a renewal to
724
+ * extend the "registration lifecycle" of this name.
725
+ *
726
+ * Given this scenario, consider the following examples:
727
+ *
728
+ * 1. If a renewal is made with 10 days incremental duration,
729
+ * the "registration lifecycle" for this name will remain in
730
+ * an "expired" state, but it will now have another 70 days of
731
+ * grace period remaining.
732
+ *
733
+ * 2. If a renewal is made with 50 days incremental duration,
734
+ * the "registration lifecycle" for this name will no longer be
735
+ * "expired" and will become "active", but the "registration lifecycle"
736
+ * will now be scheduled to expire again in 20 days.
737
+ *
738
+ * After the "registration lifecycle" for a name becomes expired by more
739
+ * than its grace period, it can no longer be renewed by anyone and is
740
+ * considered "released". The name must first be registered again, starting
741
+ * a new "registration lifecycle" of
742
+ * active / expired / grace period / released.
743
+ *
744
+ * May be 0.
745
+ *
746
+ * Guaranteed to be a non-negative bigint value.
747
+ */
748
+ incrementalDuration: t.bigint().notNull(),
749
+ /**
750
+ * Base cost
751
+ *
752
+ * Base cost (before any `premium`) of Ether measured in units of Wei
753
+ * paid to execute the "logical registrar action".
754
+ *
755
+ * May be 0.
756
+ *
757
+ * Guaranteed to be:
758
+ * 1) null if and only if `total` is null.
759
+ * 2) Otherwise, a non-negative bigint value.
760
+ */
761
+ baseCost: t.bigint(),
762
+ /**
763
+ * Premium
764
+ *
765
+ * "premium" cost (in excesses of the `baseCost`) of Ether measured in
766
+ * units of Wei paid to execute the "logical registrar action".
767
+ *
768
+ * May be 0.
769
+ *
770
+ * Guaranteed to be:
771
+ * 1) null if and only if `total` is null.
772
+ * 2) Otherwise, zero when `type` is `renewal`.
773
+ * 3) Otherwise, a non-negative bigint value.
774
+ */
775
+ premium: t.bigint(),
776
+ /**
777
+ * Total
778
+ *
779
+ * Total cost of Ether measured in units of Wei paid to execute
780
+ * the "logical registrar action".
781
+ *
782
+ * May be 0.
783
+ *
784
+ * Guaranteed to be:
785
+ * 1) null if and only if both `baseCost` and `premium` are null.
786
+ * 2) Otherwise, a non-negative bigint value, equal to the sum of
787
+ * `baseCost` and `premium`.
788
+ */
789
+ total: t.bigint(),
790
+ /**
791
+ * Registrant
792
+ *
793
+ * Identifies the address that initiated the "logical registrar action" and
794
+ * is paying the `total` cost (if applicable).
795
+ *
796
+ * It may not be the owner of the name:
797
+ * 1. When a name is registered, the initial owner of the name may be
798
+ * distinct from the registrant.
799
+ * 2. There are no restrictions on who may renew a name.
800
+ * Therefore the owner of the name may be distinct from the registrant.
801
+ *
802
+ *
803
+ * The "chainId" of this address is the same as is referenced in `subregistryId`.
804
+ *
805
+ * Guaranteed to be a fully lowercase address
806
+ */
807
+ registrant: t.hex().notNull(),
808
+ /**
809
+ * Encoded Referrer
810
+ *
811
+ * Represents the "raw" 32-byte "referrer" value emitted onchain in
812
+ * association with the registrar action.
813
+ *
814
+ * Guaranteed to be:
815
+ * 1) null if the emitted `eventIds` contain no information about a referrer.
816
+ * 2) Otherwise, a fully lowercase hex string representation of 32-bytes.
817
+ */
818
+ encodedReferrer: t.hex(),
819
+ /**
820
+ * Decoded referrer
821
+ *
822
+ * The referrer address decoded from `encodedReferrer` using strict
823
+ * left-zero-padding validation.
824
+ *
825
+ * Identifies the interpreted address of the referrer.
826
+ * The "chainId" of this address is the same as is referenced in
827
+ * `subregistryId`.
828
+ *
829
+ * Guaranteed to be:
830
+ * 1) null if `encodedReferrer` is null.
831
+ * 2) Otherwise, a fully lowercase address.
832
+ * 3) May be the "zero address" to represent that an `encodedReferrer` is
833
+ * defined but that it is interpreted as no referrer.
834
+ */
835
+ decodedReferrer: t.hex(),
836
+ /**
837
+ * Number of the block that includes the "logical registrar action".
838
+ *
839
+ * The "chainId" of this block is the same as is referenced in
840
+ * `subregistryId`.
841
+ *
842
+ * Guaranteed to be a non-negative bigint value.
843
+ */
844
+ blockNumber: t.bigint().notNull(),
845
+ /**
846
+ * Unix timestamp of the block referenced by `blockNumber` that includes
847
+ * the "logical registrar action".
848
+ */
849
+ timestamp: t.bigint().notNull(),
850
+ /**
851
+ * Transaction hash of the transaction associated with
852
+ * the "logical registrar action".
853
+ *
854
+ * The "chainId" of this transaction is the same as is referenced in
855
+ * `subregistryId`.
856
+ *
857
+ * Note that a single transaction may be associated with any number of
858
+ * "logical registrar actions".
859
+ *
860
+ * Guaranteed to be a fully lowercase hex string representation of 32-bytes.
861
+ */
862
+ transactionHash: t.hex().notNull(),
863
+ /**
864
+ * Event IDs
865
+ *
866
+ * Array of the eventIds that have contributed to the state of
867
+ * the "logical registrar action" record.
868
+ *
869
+ * Each eventId is a deterministic and globally unique onchain event
870
+ * identifier.
871
+ *
872
+ * Guarantees:
873
+ * - Each eventId is of events that occurred within the block
874
+ * referenced by `blockNumber`.
875
+ * - At least 1 eventId.
876
+ * - Ordered chronologically (ascending) by logIndex within `blockNumber`.
877
+ * - The first element in the array is equal to the `id` of
878
+ * the overall "logical registrar action" record.
879
+ *
880
+ * The following ideas are not generalized for ENS overall but happen to
881
+ * be a characteristic of the scope of our current indexing logic:
882
+ * 1. These id's always reference events emitted by
883
+ * a related "BaseRegistrar" contract.
884
+ * 2. These id's optionally reference events emitted by
885
+ * a related "Registrar Controller" contract. This is because our
886
+ * current indexing logic doesn't guarantee to index
887
+ * all "Registrar Controller" contracts.
888
+ */
889
+ eventIds: t.text().array().notNull()
890
+ }),
891
+ (t) => ({
892
+ byDecodedReferrer: index2().on(t.decodedReferrer),
893
+ byTimestamp: index2().on(t.timestamp)
894
+ })
895
+ );
896
+ var internal_registrarActionMetadataType = onchainEnum2(
897
+ "_ensindexer_registrar_action_metadata_type",
898
+ ["CURRENT_LOGICAL_REGISTRAR_ACTION"]
899
+ );
900
+ var internal_registrarActionMetadata = onchainTable4(
901
+ "_ensindexer_registrar_action_metadata",
902
+ (t) => ({
903
+ /**
904
+ * Registrar Action Metadata Type
905
+ *
906
+ * The type of internal registrar action metadata being stored.
907
+ */
908
+ metadataType: internal_registrarActionMetadataType().primaryKey(),
909
+ /**
910
+ * Logical Event Key
911
+ *
912
+ * A fully lowercase string formatted as:
913
+ * `{domainId}:{transactionHash}`
914
+ */
915
+ logicalEventKey: t.text().notNull(),
916
+ /**
917
+ * Logical Event ID
918
+ *
919
+ * A string holding the `id` value of the existing "logical registrar action"
920
+ * record that is currently being built as an aggregation of onchain events.
921
+ *
922
+ * May be used by subsequent event handlers to identify which
923
+ * "logical registrar action" to aggregate additional indexed state into.
924
+ */
925
+ logicalEventId: t.text().notNull()
926
+ })
927
+ );
928
+ var subregistryRelations = relations3(subregistries, ({ many }) => ({
929
+ registrationLifecycle: many(registrationLifecycles)
930
+ }));
931
+ var registrationLifecycleRelations = relations3(
932
+ registrationLifecycles,
933
+ ({ one, many }) => ({
934
+ subregistry: one(subregistries, {
935
+ fields: [registrationLifecycles.subregistryId],
936
+ references: [subregistries.subregistryId]
937
+ }),
938
+ registrarAction: many(registrarActions)
939
+ })
940
+ );
941
+ var registrarActionRelations = relations3(registrarActions, ({ one }) => ({
942
+ registrationLifecycle: one(registrationLifecycles, {
943
+ fields: [registrarActions.node],
944
+ references: [registrationLifecycles.node]
945
+ })
946
+ }));
947
+
948
+ // src/schemas/subgraph.schema.ts
949
+ import { index as index3, onchainTable as onchainTable5, relations as relations4 } from "ponder";
950
+
951
+ // src/lib/collate.ts
952
+ function monkeypatchCollate(col, collation) {
953
+ col.getSQLType = function() {
954
+ return `${Object.getPrototypeOf(this).getSQLType.call(this)} COLLATE ${collation}`;
955
+ };
956
+ return col;
957
+ }
958
+
959
+ // src/schemas/subgraph.schema.ts
960
+ var subgraph_domain = onchainTable5(
961
+ "subgraph_domains",
962
+ (t) => ({
963
+ // The namehash of the name
964
+ id: t.hex().primaryKey(),
965
+ /**
966
+ * The ENS Name that this Domain represents.
967
+ *
968
+ * If {@link ENSIndexerConfig#isSubgraphCompatible}, this value is guaranteed to be either:
969
+ * a) null (in the case of the root node), or
970
+ * b) a Subgraph Interpreted Name.
971
+ *
972
+ * @see https://ensnode.io/docs/reference/terminology#subgraph-indexability--labelname-interpretation
973
+ *
974
+ * Otherwise, this value is guaranteed to be an Interpreted Name, which is either:
975
+ * a) a normalized Name, or
976
+ * b) a Name entirely consisting of Interpreted Labels.
977
+ *
978
+ * Note that the type of the column will remain string | null, for legacy subgraph compatibility,
979
+ * but in practice will never be null. The Root node's name will be '' (empty string).
980
+ *
981
+ * @see https://ensnode.io/docs/reference/terminology#interpreted-name
982
+ */
983
+ name: t.text(),
984
+ /**
985
+ * The Label associated with the Domain.
986
+ *
987
+ * If {@link ENSIndexerConfig#isSubgraphCompatible}, this value is guaranteed to be either:
988
+ * a) null, in the case of the root Node or a name whose childmost label is subgraph-unindexable, or
989
+ * b) a subgraph-indexable Subgraph Interpreted Label (i.e. a Literal Label of undefined normalization).
990
+ *
991
+ * @see https://ensnode.io/docs/reference/terminology#subgraph-indexability--labelname-interpretation
992
+ *
993
+ * Otherwise, this value is guaranteed to be an Interpreted Label which is either:
994
+ * a) null, exclusively in the case of the root Node,
995
+ * b) a normalized Label, or
996
+ * c) an Encoded LabelHash, which encodes either
997
+ * i. in the case of an Unknown Label, the LabelHash emitted onchain, or
998
+ * ii. in the case of an Unnormalized Label, the LabelHash of the Literal Label value found onchain.
999
+ *
1000
+ * @see https://ensnode.io/docs/reference/terminology#interpreted-label
1001
+ */
1002
+ labelName: t.text(),
1003
+ // keccak256(labelName)
1004
+ labelhash: t.hex(),
1005
+ // The namehash (id) of the parent name
1006
+ parentId: t.hex(),
1007
+ // The number of subdomains
1008
+ subdomainCount: t.integer().notNull().default(0),
1009
+ // Address logged from current resolver, if any
1010
+ resolvedAddressId: t.hex(),
1011
+ // The resolver that controls the domain's settings
1012
+ resolverId: t.text(),
1013
+ // The time-to-live (TTL) value of the domain's records
1014
+ ttl: t.bigint(),
1015
+ // Indicates whether the domain has been migrated to a new registrar
1016
+ isMigrated: t.boolean().notNull().default(false),
1017
+ // The time when the domain was created
1018
+ createdAt: t.bigint().notNull(),
1019
+ // The account that owns the domain
1020
+ ownerId: t.hex().notNull(),
1021
+ // The account that owns the ERC721 NFT for the domain
1022
+ registrantId: t.hex(),
1023
+ // The account that owns the wrapped domain
1024
+ wrappedOwnerId: t.hex(),
1025
+ // The expiry date for the domain, from either the registration, or the wrapped domain if PCC is burned
1026
+ expiryDate: t.bigint()
1027
+ }),
1028
+ (t) => ({
1029
+ byName: index3().on(t.name),
1030
+ byLabelhash: index3().on(t.labelhash),
1031
+ byParentId: index3().on(t.parentId),
1032
+ byOwnerId: index3().on(t.ownerId),
1033
+ byRegistrantId: index3().on(t.registrantId),
1034
+ byWrappedOwnerId: index3().on(t.wrappedOwnerId),
1035
+ byResolvedAddressId: index3().on(t.resolvedAddressId)
1036
+ })
1037
+ );
1038
+ monkeypatchCollate(subgraph_domain.name, '"C"');
1039
+ monkeypatchCollate(subgraph_domain.labelName, '"C"');
1040
+ var subgraph_domainRelations = relations4(subgraph_domain, ({ one, many }) => ({
1041
+ resolvedAddress: one(subgraph_account, {
1042
+ fields: [subgraph_domain.resolvedAddressId],
1043
+ references: [subgraph_account.id]
1044
+ }),
1045
+ owner: one(subgraph_account, {
1046
+ fields: [subgraph_domain.ownerId],
1047
+ references: [subgraph_account.id]
1048
+ }),
1049
+ parent: one(subgraph_domain, {
1050
+ fields: [subgraph_domain.parentId],
1051
+ references: [subgraph_domain.id]
1052
+ }),
1053
+ resolver: one(subgraph_resolver, {
1054
+ fields: [subgraph_domain.resolverId],
1055
+ references: [subgraph_resolver.id]
1056
+ }),
1057
+ subdomains: many(subgraph_domain, { relationName: "parent" }),
1058
+ registrant: one(subgraph_account, {
1059
+ fields: [subgraph_domain.registrantId],
1060
+ references: [subgraph_account.id]
1061
+ }),
1062
+ wrappedOwner: one(subgraph_account, {
1063
+ fields: [subgraph_domain.wrappedOwnerId],
1064
+ references: [subgraph_account.id]
1065
+ }),
1066
+ wrappedDomain: one(subgraph_wrappedDomain, {
1067
+ fields: [subgraph_domain.id],
1068
+ references: [subgraph_wrappedDomain.domainId]
1069
+ }),
1070
+ registration: one(subgraph_registration, {
1071
+ fields: [subgraph_domain.id],
1072
+ references: [subgraph_registration.domainId]
1073
+ }),
1074
+ // event relations
1075
+ transfers: many(subgraph_transfer),
1076
+ newOwners: many(subgraph_newOwner),
1077
+ newResolvers: many(subgraph_newResolver),
1078
+ newTTLs: many(subgraph_newTTL),
1079
+ wrappedTransfers: many(subgraph_wrappedTransfer),
1080
+ nameWrappeds: many(subgraph_nameWrapped),
1081
+ nameUnwrappeds: many(subgraph_nameUnwrapped),
1082
+ fusesSets: many(subgraph_fusesSet),
1083
+ expiryExtendeds: many(subgraph_expiryExtended)
1084
+ }));
1085
+ var subgraph_account = onchainTable5("subgraph_accounts", (t) => ({
1086
+ id: t.hex().primaryKey()
1087
+ }));
1088
+ var subgraph_accountRelations = relations4(subgraph_account, ({ many }) => ({
1089
+ domains: many(subgraph_domain),
1090
+ wrappedDomains: many(subgraph_wrappedDomain),
1091
+ registrations: many(subgraph_registration)
1092
+ }));
1093
+ var subgraph_resolver = onchainTable5(
1094
+ "subgraph_resolvers",
1095
+ (t) => ({
1096
+ // The unique identifier for this resolver, which is a concatenation of the domain namehash and the resolver address
1097
+ id: t.text().primaryKey(),
1098
+ // The domain that this resolver is associated with
1099
+ domainId: t.hex().notNull(),
1100
+ // The address of the resolver contract
1101
+ address: t.hex().notNull().$type(),
1102
+ // The current value of the 'addr' record for this resolver, as determined by the associated events
1103
+ addrId: t.hex(),
1104
+ // The content hash for this resolver, in binary format
1105
+ contentHash: t.text(),
1106
+ // The set of observed text record keys for this resolver
1107
+ // NOTE: we avoid .notNull.default([]) to match subgraph behavior
1108
+ texts: t.text().array(),
1109
+ // The set of observed SLIP-44 coin types for this resolver
1110
+ // NOTE: we avoid .notNull.default([]) to match subgraph behavior
1111
+ coinTypes: t.bigint().array()
1112
+ }),
1113
+ (t) => ({
1114
+ byDomainId: index3().on(t.domainId)
1115
+ })
1116
+ );
1117
+ var subgraph_resolverRelations = relations4(subgraph_resolver, ({ one, many }) => ({
1118
+ addr: one(subgraph_account, {
1119
+ fields: [subgraph_resolver.addrId],
1120
+ references: [subgraph_account.id]
1121
+ }),
1122
+ domain: one(subgraph_domain, {
1123
+ fields: [subgraph_resolver.domainId],
1124
+ references: [subgraph_domain.id]
1125
+ }),
1126
+ // event relations
1127
+ addrChangeds: many(subgraph_addrChanged),
1128
+ multicoinAddrChangeds: many(subgraph_multicoinAddrChanged),
1129
+ nameChangeds: many(subgraph_nameChanged),
1130
+ abiChangeds: many(subgraph_abiChanged),
1131
+ pubkeyChangeds: many(subgraph_pubkeyChanged),
1132
+ textChangeds: many(subgraph_textChanged),
1133
+ contenthashChangeds: many(subgraph_contenthashChanged),
1134
+ interfaceChangeds: many(subgraph_interfaceChanged),
1135
+ authorisationChangeds: many(subgraph_authorisationChanged),
1136
+ versionChangeds: many(subgraph_versionChanged)
1137
+ }));
1138
+ var subgraph_registration = onchainTable5(
1139
+ "subgraph_registrations",
1140
+ (t) => ({
1141
+ // The unique identifier of the registration
1142
+ id: t.hex().primaryKey(),
1143
+ // The domain name associated with the registration
1144
+ domainId: t.hex().notNull(),
1145
+ // The registration date of the domain
1146
+ registrationDate: t.bigint().notNull(),
1147
+ // The expiry date of the domain
1148
+ expiryDate: t.bigint().notNull(),
1149
+ // The cost associated with the domain registration
1150
+ cost: t.bigint(),
1151
+ // The account that registered the domain
1152
+ registrantId: t.hex().notNull(),
1153
+ /**
1154
+ * The Label associated with the domain registration.
1155
+ *
1156
+ * If {@link ENSIndexerConfig#isSubgraphCompatible}, this value is guaranteed to be either:
1157
+ * a) null, in the case of the root Node or a Domain whose label is subgraph-unindexable, or
1158
+ * b) a subgraph-indexable Subgraph Interpreted Label (i.e. a Literal Label of undefined normalization).
1159
+ *
1160
+ * @see https://ensnode.io/docs/reference/terminology#subgraph-indexability--labelname-interpretation
1161
+ *
1162
+ * Otherwise, this value is guaranteed to be an Interpreted Label which is either:
1163
+ * a) a normalized Label, or
1164
+ * b) in the case of an Unnormalized Label, an Encoded LabelHash of the Literal Label value found onchain.
1165
+ *
1166
+ * Note that the type of the column will remain string | null, for legacy subgraph compatibility.
1167
+ * In practice however, because there is no Registration entity for the root Node (the only Node
1168
+ * with a null labelName) this field will never be null.
1169
+ *
1170
+ * @see https://ensnode.io/docs/reference/terminology#interpreted-label
1171
+ */
1172
+ labelName: t.text()
1173
+ }),
1174
+ (t) => ({
1175
+ byDomainId: index3().on(t.domainId),
1176
+ byRegistrationDate: index3().on(t.registrationDate),
1177
+ byExpiryDate: index3().on(t.expiryDate)
1178
+ })
1179
+ );
1180
+ var subgraph_registrationRelations = relations4(subgraph_registration, ({ one, many }) => ({
1181
+ domain: one(subgraph_domain, {
1182
+ fields: [subgraph_registration.domainId],
1183
+ references: [subgraph_domain.id]
1184
+ }),
1185
+ registrant: one(subgraph_account, {
1186
+ fields: [subgraph_registration.registrantId],
1187
+ references: [subgraph_account.id]
1188
+ }),
1189
+ // event relations
1190
+ nameRegistereds: many(subgraph_nameRegistered),
1191
+ nameReneweds: many(subgraph_nameRenewed),
1192
+ nameTransferreds: many(subgraph_nameTransferred)
1193
+ }));
1194
+ var subgraph_wrappedDomain = onchainTable5(
1195
+ "subgraph_wrapped_domains",
1196
+ (t) => ({
1197
+ // The unique identifier for each instance of the WrappedDomain entity
1198
+ id: t.hex().primaryKey(),
1199
+ // The domain that is wrapped by this WrappedDomain
1200
+ domainId: t.hex().notNull(),
1201
+ // The expiry date of the wrapped domain
1202
+ expiryDate: t.bigint().notNull(),
1203
+ // The number of fuses remaining on the wrapped domain
1204
+ fuses: t.integer().notNull(),
1205
+ // The account that owns this WrappedDomain
1206
+ ownerId: t.hex().notNull(),
1207
+ /**
1208
+ * The Name that this WrappedDomain represents. Names are emitted by the NameWrapper contract as
1209
+ * DNS-Encoded Names which may be malformed, which will result in this field being `null`.
1210
+ *
1211
+ * If {@link ENSIndexerConfig#isSubgraphCompatible}, this value is guaranteed to be either:
1212
+ * a) null (in the case of a DNS-Encoded Name that is malformed or contains subgraph-unindexable labels), or
1213
+ * b) a subgraph-indexable Subgraph Interpreted Label (i.e. a Literal Label of undefined normalization).
1214
+ *
1215
+ * @see https://ensnode.io/docs/reference/terminology#subgraph-indexability--labelname-interpretation
1216
+ *
1217
+ * Otherwise, this value is guaranteed to be either:
1218
+ * a) null (in the case of a malformed DNS-Encoded Name),
1219
+ * b) an Interpreted Name.
1220
+ *
1221
+ * @see https://ensnode.io/docs/reference/terminology#interpreted-name
1222
+ */
1223
+ name: t.text()
1224
+ }),
1225
+ (t) => ({
1226
+ byDomainId: index3().on(t.domainId)
1227
+ })
1228
+ );
1229
+ var subgraph_wrappedDomainRelations = relations4(subgraph_wrappedDomain, ({ one }) => ({
1230
+ domain: one(subgraph_domain, {
1231
+ fields: [subgraph_wrappedDomain.domainId],
1232
+ references: [subgraph_domain.id]
1233
+ }),
1234
+ owner: one(subgraph_account, {
1235
+ fields: [subgraph_wrappedDomain.ownerId],
1236
+ references: [subgraph_account.id]
1237
+ })
1238
+ }));
1239
+ var sharedEventColumns = (t) => ({
1240
+ id: t.text().primaryKey(),
1241
+ blockNumber: t.integer().notNull(),
1242
+ transactionID: t.hex().notNull()
1243
+ });
1244
+ var domainEvent2 = (t) => ({
1245
+ ...sharedEventColumns(t),
1246
+ domainId: t.hex().notNull()
1247
+ });
1248
+ var domainEventIndex = (t) => ({
1249
+ // primary reverse lookup
1250
+ idx: index3().on(t.domainId),
1251
+ // sorting index
1252
+ idx_compound: index3().on(t.domainId, t.id)
1253
+ });
1254
+ var subgraph_transfer = onchainTable5(
1255
+ "subgraph_transfers",
1256
+ (t) => ({
1257
+ ...domainEvent2(t),
1258
+ ownerId: t.hex().notNull()
1259
+ }),
1260
+ domainEventIndex
1261
+ );
1262
+ var subgraph_newOwner = onchainTable5(
1263
+ "subgraph_new_owners",
1264
+ (t) => ({
1265
+ ...domainEvent2(t),
1266
+ ownerId: t.hex().notNull(),
1267
+ parentDomainId: t.hex().notNull()
1268
+ }),
1269
+ domainEventIndex
1270
+ );
1271
+ var subgraph_newResolver = onchainTable5(
1272
+ "subgraph_new_resolvers",
1273
+ (t) => ({
1274
+ ...domainEvent2(t),
1275
+ resolverId: t.text().notNull()
1276
+ }),
1277
+ domainEventIndex
1278
+ );
1279
+ var subgraph_newTTL = onchainTable5(
1280
+ "subgraph_new_ttls",
1281
+ (t) => ({
1282
+ ...domainEvent2(t),
1283
+ ttl: t.bigint().notNull()
1284
+ }),
1285
+ domainEventIndex
1286
+ );
1287
+ var subgraph_wrappedTransfer = onchainTable5(
1288
+ "subgraph_wrapped_transfers",
1289
+ (t) => ({
1290
+ ...domainEvent2(t),
1291
+ ownerId: t.hex().notNull()
1292
+ }),
1293
+ domainEventIndex
1294
+ );
1295
+ var subgraph_nameWrapped = onchainTable5(
1296
+ "subgraph_name_wrapped",
1297
+ (t) => ({
1298
+ ...domainEvent2(t),
1299
+ name: t.text(),
1300
+ fuses: t.integer().notNull(),
1301
+ ownerId: t.hex().notNull(),
1302
+ expiryDate: t.bigint().notNull()
1303
+ }),
1304
+ domainEventIndex
1305
+ );
1306
+ var subgraph_nameUnwrapped = onchainTable5(
1307
+ "subgraph_name_unwrapped",
1308
+ (t) => ({
1309
+ ...domainEvent2(t),
1310
+ ownerId: t.hex().notNull()
1311
+ }),
1312
+ domainEventIndex
1313
+ );
1314
+ var subgraph_fusesSet = onchainTable5(
1315
+ "subgraph_fuses_set",
1316
+ (t) => ({
1317
+ ...domainEvent2(t),
1318
+ fuses: t.integer().notNull()
1319
+ }),
1320
+ domainEventIndex
1321
+ );
1322
+ var subgraph_expiryExtended = onchainTable5(
1323
+ "subgraph_expiry_extended",
1324
+ (t) => ({
1325
+ ...domainEvent2(t),
1326
+ expiryDate: t.bigint().notNull()
1327
+ }),
1328
+ domainEventIndex
1329
+ );
1330
+ var registrationEvent = (t) => ({
1331
+ ...sharedEventColumns(t),
1332
+ registrationId: t.hex().notNull()
1333
+ });
1334
+ var registrationEventIndex = (t) => ({
1335
+ // primary reverse lookup
1336
+ idx: index3().on(t.registrationId),
1337
+ // sorting index
1338
+ idx_compound: index3().on(t.registrationId, t.id)
1339
+ });
1340
+ var subgraph_nameRegistered = onchainTable5(
1341
+ "subgraph_name_registered",
1342
+ (t) => ({
1343
+ ...registrationEvent(t),
1344
+ registrantId: t.hex().notNull(),
1345
+ expiryDate: t.bigint().notNull()
1346
+ }),
1347
+ registrationEventIndex
1348
+ );
1349
+ var subgraph_nameRenewed = onchainTable5(
1350
+ "subgraph_name_renewed",
1351
+ (t) => ({
1352
+ ...registrationEvent(t),
1353
+ expiryDate: t.bigint().notNull()
1354
+ }),
1355
+ registrationEventIndex
1356
+ );
1357
+ var subgraph_nameTransferred = onchainTable5(
1358
+ "subgraph_name_transferred",
1359
+ (t) => ({
1360
+ ...registrationEvent(t),
1361
+ newOwnerId: t.hex().notNull()
1362
+ }),
1363
+ registrationEventIndex
1364
+ );
1365
+ var resolverEvent2 = (t) => ({
1366
+ ...sharedEventColumns(t),
1367
+ resolverId: t.text().notNull()
1368
+ });
1369
+ var resolverEventIndex = (t) => ({
1370
+ // primary reverse lookup
1371
+ idx: index3().on(t.resolverId),
1372
+ // sorting index
1373
+ idx_compound: index3().on(t.resolverId, t.id)
1374
+ });
1375
+ var subgraph_addrChanged = onchainTable5(
1376
+ "subgraph_addr_changed",
1377
+ (t) => ({
1378
+ ...resolverEvent2(t),
1379
+ addrId: t.hex().notNull()
1380
+ }),
1381
+ resolverEventIndex
1382
+ );
1383
+ var subgraph_multicoinAddrChanged = onchainTable5(
1384
+ "subgraph_multicoin_addr_changed",
1385
+ (t) => ({
1386
+ ...resolverEvent2(t),
1387
+ coinType: t.bigint().notNull(),
1388
+ addr: t.hex().notNull()
1389
+ }),
1390
+ resolverEventIndex
1391
+ );
1392
+ var subgraph_nameChanged = onchainTable5(
1393
+ "subgraph_name_changed",
1394
+ (t) => ({
1395
+ ...resolverEvent2(t),
1396
+ name: t.text().notNull()
1397
+ }),
1398
+ resolverEventIndex
1399
+ );
1400
+ var subgraph_abiChanged = onchainTable5(
1401
+ "subgraph_abi_changed",
1402
+ (t) => ({
1403
+ ...resolverEvent2(t),
1404
+ contentType: t.bigint().notNull()
1405
+ }),
1406
+ resolverEventIndex
1407
+ );
1408
+ var subgraph_pubkeyChanged = onchainTable5(
1409
+ "subgraph_pubkey_changed",
1410
+ (t) => ({
1411
+ ...resolverEvent2(t),
1412
+ x: t.hex().notNull(),
1413
+ y: t.hex().notNull()
1414
+ }),
1415
+ resolverEventIndex
1416
+ );
1417
+ var subgraph_textChanged = onchainTable5(
1418
+ "subgraph_text_changed",
1419
+ (t) => ({
1420
+ ...resolverEvent2(t),
1421
+ key: t.text().notNull(),
1422
+ value: t.text()
1423
+ }),
1424
+ resolverEventIndex
1425
+ );
1426
+ var subgraph_contenthashChanged = onchainTable5(
1427
+ "subgraph_contenthash_changed",
1428
+ (t) => ({
1429
+ ...resolverEvent2(t),
1430
+ hash: t.hex().notNull()
1431
+ }),
1432
+ resolverEventIndex
1433
+ );
1434
+ var subgraph_interfaceChanged = onchainTable5(
1435
+ "subgraph_interface_changed",
1436
+ (t) => ({
1437
+ ...resolverEvent2(t),
1438
+ interfaceID: t.hex().notNull(),
1439
+ implementer: t.hex().notNull()
1440
+ }),
1441
+ resolverEventIndex
1442
+ );
1443
+ var subgraph_authorisationChanged = onchainTable5(
1444
+ "subgraph_authorisation_changed",
1445
+ (t) => ({
1446
+ ...resolverEvent2(t),
1447
+ owner: t.hex().notNull(),
1448
+ target: t.hex().notNull(),
1449
+ isAuthorized: t.boolean().notNull()
1450
+ }),
1451
+ resolverEventIndex
1452
+ );
1453
+ var subgraph_versionChanged = onchainTable5(
1454
+ "subgraph_version_changed",
1455
+ (t) => ({
1456
+ ...resolverEvent2(t),
1457
+ version: t.bigint().notNull()
1458
+ }),
1459
+ resolverEventIndex
1460
+ );
1461
+ var subgraph_transferRelations = relations4(subgraph_transfer, ({ one }) => ({
1462
+ domain: one(subgraph_domain, {
1463
+ fields: [subgraph_transfer.domainId],
1464
+ references: [subgraph_domain.id]
1465
+ }),
1466
+ owner: one(subgraph_account, {
1467
+ fields: [subgraph_transfer.ownerId],
1468
+ references: [subgraph_account.id]
1469
+ })
1470
+ }));
1471
+ var subgraph_newOwnerRelations = relations4(subgraph_newOwner, ({ one }) => ({
1472
+ domain: one(subgraph_domain, {
1473
+ fields: [subgraph_newOwner.domainId],
1474
+ references: [subgraph_domain.id]
1475
+ }),
1476
+ owner: one(subgraph_account, {
1477
+ fields: [subgraph_newOwner.ownerId],
1478
+ references: [subgraph_account.id]
1479
+ }),
1480
+ parentDomain: one(subgraph_domain, {
1481
+ fields: [subgraph_newOwner.parentDomainId],
1482
+ references: [subgraph_domain.id]
1483
+ })
1484
+ }));
1485
+ var subgraph_newResolverRelations = relations4(subgraph_newResolver, ({ one }) => ({
1486
+ domain: one(subgraph_domain, {
1487
+ fields: [subgraph_newResolver.domainId],
1488
+ references: [subgraph_domain.id]
1489
+ }),
1490
+ resolver: one(subgraph_resolver, {
1491
+ fields: [subgraph_newResolver.resolverId],
1492
+ references: [subgraph_resolver.id]
1493
+ })
1494
+ }));
1495
+ var subgraph_newTTLRelations = relations4(subgraph_newTTL, ({ one }) => ({
1496
+ domain: one(subgraph_domain, {
1497
+ fields: [subgraph_newTTL.domainId],
1498
+ references: [subgraph_domain.id]
1499
+ })
1500
+ }));
1501
+ var subgraph_wrappedTransferRelations = relations4(subgraph_wrappedTransfer, ({ one }) => ({
1502
+ domain: one(subgraph_domain, {
1503
+ fields: [subgraph_wrappedTransfer.domainId],
1504
+ references: [subgraph_domain.id]
1505
+ }),
1506
+ owner: one(subgraph_account, {
1507
+ fields: [subgraph_wrappedTransfer.ownerId],
1508
+ references: [subgraph_account.id]
1509
+ })
1510
+ }));
1511
+ var subgraph_nameWrappedRelations = relations4(subgraph_nameWrapped, ({ one }) => ({
1512
+ domain: one(subgraph_domain, {
1513
+ fields: [subgraph_nameWrapped.domainId],
1514
+ references: [subgraph_domain.id]
1515
+ }),
1516
+ owner: one(subgraph_account, {
1517
+ fields: [subgraph_nameWrapped.ownerId],
1518
+ references: [subgraph_account.id]
1519
+ })
1520
+ }));
1521
+ var subgraph_nameUnwrappedRelations = relations4(subgraph_nameUnwrapped, ({ one }) => ({
1522
+ domain: one(subgraph_domain, {
1523
+ fields: [subgraph_nameUnwrapped.domainId],
1524
+ references: [subgraph_domain.id]
1525
+ }),
1526
+ owner: one(subgraph_account, {
1527
+ fields: [subgraph_nameUnwrapped.ownerId],
1528
+ references: [subgraph_account.id]
1529
+ })
1530
+ }));
1531
+ var subgraph_fusesSetRelations = relations4(subgraph_fusesSet, ({ one }) => ({
1532
+ domain: one(subgraph_domain, {
1533
+ fields: [subgraph_fusesSet.domainId],
1534
+ references: [subgraph_domain.id]
1535
+ })
1536
+ }));
1537
+ var subgraph_expiryExtendedRelations = relations4(subgraph_expiryExtended, ({ one }) => ({
1538
+ domain: one(subgraph_domain, {
1539
+ fields: [subgraph_expiryExtended.domainId],
1540
+ references: [subgraph_domain.id]
1541
+ })
1542
+ }));
1543
+ var subgraph_nameRegisteredRelations = relations4(subgraph_nameRegistered, ({ one }) => ({
1544
+ registration: one(subgraph_registration, {
1545
+ fields: [subgraph_nameRegistered.registrationId],
1546
+ references: [subgraph_registration.id]
1547
+ }),
1548
+ registrant: one(subgraph_account, {
1549
+ fields: [subgraph_nameRegistered.registrantId],
1550
+ references: [subgraph_account.id]
1551
+ })
1552
+ }));
1553
+ var subgraph_nameRenewedRelations = relations4(subgraph_nameRenewed, ({ one }) => ({
1554
+ registration: one(subgraph_registration, {
1555
+ fields: [subgraph_nameRenewed.registrationId],
1556
+ references: [subgraph_registration.id]
1557
+ })
1558
+ }));
1559
+ var subgraph_nameTransferredRelations = relations4(subgraph_nameTransferred, ({ one }) => ({
1560
+ registration: one(subgraph_registration, {
1561
+ fields: [subgraph_nameTransferred.registrationId],
1562
+ references: [subgraph_registration.id]
1563
+ }),
1564
+ newOwner: one(subgraph_account, {
1565
+ fields: [subgraph_nameTransferred.newOwnerId],
1566
+ references: [subgraph_account.id]
1567
+ })
1568
+ }));
1569
+ var subgraph_addrChangedRelations = relations4(subgraph_addrChanged, ({ one }) => ({
1570
+ resolver: one(subgraph_resolver, {
1571
+ fields: [subgraph_addrChanged.resolverId],
1572
+ references: [subgraph_resolver.id]
1573
+ }),
1574
+ addr: one(subgraph_account, {
1575
+ fields: [subgraph_addrChanged.addrId],
1576
+ references: [subgraph_account.id]
1577
+ })
1578
+ }));
1579
+ var subgraph_multicoinAddrChangedRelations = relations4(
1580
+ subgraph_multicoinAddrChanged,
1581
+ ({ one }) => ({
1582
+ resolver: one(subgraph_resolver, {
1583
+ fields: [subgraph_multicoinAddrChanged.resolverId],
1584
+ references: [subgraph_resolver.id]
1585
+ })
1586
+ })
1587
+ );
1588
+ var subgraph_nameChangedRelations = relations4(subgraph_nameChanged, ({ one }) => ({
1589
+ resolver: one(subgraph_resolver, {
1590
+ fields: [subgraph_nameChanged.resolverId],
1591
+ references: [subgraph_resolver.id]
1592
+ })
1593
+ }));
1594
+ var subgraph_abiChangedRelations = relations4(subgraph_abiChanged, ({ one }) => ({
1595
+ resolver: one(subgraph_resolver, {
1596
+ fields: [subgraph_abiChanged.resolverId],
1597
+ references: [subgraph_resolver.id]
1598
+ })
1599
+ }));
1600
+ var subgraph_pubkeyChangedRelations = relations4(subgraph_pubkeyChanged, ({ one }) => ({
1601
+ resolver: one(subgraph_resolver, {
1602
+ fields: [subgraph_pubkeyChanged.resolverId],
1603
+ references: [subgraph_resolver.id]
1604
+ })
1605
+ }));
1606
+ var subgraph_textChangedRelations = relations4(subgraph_textChanged, ({ one }) => ({
1607
+ resolver: one(subgraph_resolver, {
1608
+ fields: [subgraph_textChanged.resolverId],
1609
+ references: [subgraph_resolver.id]
1610
+ })
1611
+ }));
1612
+ var subgraph_contenthashChangedRelations = relations4(
1613
+ subgraph_contenthashChanged,
1614
+ ({ one }) => ({
1615
+ resolver: one(subgraph_resolver, {
1616
+ fields: [subgraph_contenthashChanged.resolverId],
1617
+ references: [subgraph_resolver.id]
1618
+ })
1619
+ })
1620
+ );
1621
+ var subgraph_interfaceChangedRelations = relations4(
1622
+ subgraph_interfaceChanged,
1623
+ ({ one }) => ({
1624
+ resolver: one(subgraph_resolver, {
1625
+ fields: [subgraph_interfaceChanged.resolverId],
1626
+ references: [subgraph_resolver.id]
1627
+ })
1628
+ })
1629
+ );
1630
+ var subgraph_authorisationChangedRelations = relations4(
1631
+ subgraph_authorisationChanged,
1632
+ ({ one }) => ({
1633
+ resolver: one(subgraph_resolver, {
1634
+ fields: [subgraph_authorisationChanged.resolverId],
1635
+ references: [subgraph_resolver.id]
1636
+ })
1637
+ })
1638
+ );
1639
+ var subgraph_versionChangedRelations = relations4(subgraph_versionChanged, ({ one }) => ({
1640
+ resolver: one(subgraph_resolver, {
1641
+ fields: [subgraph_versionChanged.resolverId],
1642
+ references: [subgraph_resolver.id]
1643
+ })
1644
+ }));
1645
+
1646
+ // src/schemas/tokenscope.schema.ts
1647
+ import { index as index4, onchainTable as onchainTable6 } from "ponder";
1648
+ var nameSales = onchainTable6(
1649
+ "name_sales",
1650
+ (t) => ({
1651
+ /**
1652
+ * Unique and deterministic identifier of the onchain event associated with the sale.
1653
+ *
1654
+ * Composite key format: "{chainId}-{blockNumber}-{logIndex}" (e.g., "1-1234567-5")
1655
+ */
1656
+ id: t.text().primaryKey(),
1657
+ /**
1658
+ * The chain where the sale occurred.
1659
+ */
1660
+ chainId: t.integer().notNull(),
1661
+ /**
1662
+ * The block number on chainId where the sale occurred.
1663
+ */
1664
+ blockNumber: t.bigint().notNull(),
1665
+ /**
1666
+ * The log index position of the sale event within blockNumber.
1667
+ */
1668
+ logIndex: t.integer().notNull(),
1669
+ /**
1670
+ * The EVM transaction hash on chainId associated with the sale.
1671
+ */
1672
+ transactionHash: t.hex().notNull(),
1673
+ /**
1674
+ * The Seaport order hash.
1675
+ */
1676
+ orderHash: t.hex().notNull(),
1677
+ /**
1678
+ * The address of the contract on chainId that manages tokenId.
1679
+ */
1680
+ contractAddress: t.hex().notNull(),
1681
+ /**
1682
+ * The tokenId managed by contractAddress that was sold.
1683
+ *
1684
+ * In a general context (outside of TokenScope) ERC1155 NFTs may have
1685
+ * multiple copies, however TokenScope guarantees that all indexed NFTs
1686
+ * never have an amount / balance > 1.
1687
+ */
1688
+ tokenId: t.bigint().notNull(),
1689
+ /**
1690
+ * The CAIP-19 Asset Namespace of the token that was sold. Either `erc721` or `erc1155`.
1691
+ *
1692
+ * @see https://chainagnostic.org/CAIPs/caip-19
1693
+ */
1694
+ assetNamespace: t.text().notNull(),
1695
+ /**
1696
+ * The CAIP-19 Asset ID of token that was sold. This is a globally unique reference to the
1697
+ * specific asset in question.
1698
+ *
1699
+ * @see https://chainagnostic.org/CAIPs/caip-19
1700
+ */
1701
+ assetId: t.text().notNull(),
1702
+ /**
1703
+ * The namehash (Node) of the ENS domain that was sold.
1704
+ */
1705
+ domainId: t.hex().notNull(),
1706
+ /**
1707
+ * The account that bought the token controlling ownership of domainId from
1708
+ * the seller for the amount of currency associated with the sale.
1709
+ */
1710
+ buyer: t.hex().notNull(),
1711
+ /**
1712
+ * The account that sold the token controlling ownership of domainId to
1713
+ * buyer for the amount of currency associated with the sale.
1714
+ */
1715
+ seller: t.hex().notNull(),
1716
+ /**
1717
+ * Currency of the payment (ETH, USDC or DAI) from buyer to seller in exchange for tokenId.
1718
+ */
1719
+ currency: t.text().notNull(),
1720
+ /**
1721
+ * The amount of currency paid from buyer to seller in exchange for tokenId.
1722
+ *
1723
+ * Denominated in the smallest unit of currency.
1724
+ *
1725
+ * Amount interpretation depends on currency:
1726
+ * - ETH/WETH: Amount in wei (1 ETH = 10^18 wei)
1727
+ * - USDC: Amount in micro-units (1 USDC = 10^6 units)
1728
+ * - DAI: Amount in wei-equivalent (1 DAI = 10^18 units)
1729
+ */
1730
+ amount: t.bigint().notNull(),
1731
+ /**
1732
+ * Unix timestamp of the block timestamp when the sale occurred.
1733
+ */
1734
+ timestamp: t.bigint().notNull()
1735
+ }),
1736
+ (t) => ({
1737
+ idx_domainId: index4().on(t.domainId),
1738
+ idx_assetId: index4().on(t.assetId),
1739
+ idx_buyer: index4().on(t.buyer),
1740
+ idx_seller: index4().on(t.seller),
1741
+ idx_timestamp: index4().on(t.timestamp)
1742
+ })
1743
+ );
1744
+ var nameTokens = onchainTable6(
1745
+ "name_tokens",
1746
+ (t) => ({
1747
+ /**
1748
+ * The CAIP-19 Asset ID of the token.
1749
+ *
1750
+ * This is a globally unique reference to the token.
1751
+ *
1752
+ * @see https://chainagnostic.org/CAIPs/caip-19
1753
+ */
1754
+ id: t.text().primaryKey(),
1755
+ /**
1756
+ * The namehash (Node) of the ENS name associated with the token.
1757
+ *
1758
+ * Note: An ENS name may have more than one distinct token across time. It is
1759
+ * also possible for multiple distinct tokens for an ENS name to have
1760
+ * a mintStatus of `minted` at the same time. For example:
1761
+ * - When a direct subname of .eth is wrapped by the NameWrapper. This state
1762
+ * has one minted token for the name managed by the BaseRegistrar (this
1763
+ * token will be owned by the NameWrapper) and another minted token for
1764
+ * the name managed by the NameWrapper (owned by the effective owner of
1765
+ * the name).
1766
+ * - When a direct subname of .eth is wrapped by the NameWrapper and then
1767
+ * unwrapped. This state has one minted token (managed by the BaseRegistrar)
1768
+ * and another burned token (managed by the NameWrapper).
1769
+ */
1770
+ domainId: t.hex().notNull(),
1771
+ /**
1772
+ * The chain that manages the token.
1773
+ */
1774
+ chainId: t.integer().notNull(),
1775
+ /**
1776
+ * The address of the contract on chainId that manages the token.
1777
+ */
1778
+ contractAddress: t.hex().notNull(),
1779
+ /**
1780
+ * The tokenId of the token managed by contractAddress.
1781
+ *
1782
+ * In a general context (outside of TokenScope) ERC1155 NFTs may have
1783
+ * multiple copies, however TokenScope guarantees that all indexed NFTs
1784
+ * never have an amount / balance > 1.
1785
+ */
1786
+ tokenId: t.bigint().notNull(),
1787
+ /**
1788
+ * The CAIP-19 Asset Namespace of the token. Either `erc721` or `erc1155`.
1789
+ *
1790
+ * @see https://chainagnostic.org/CAIPs/caip-19
1791
+ */
1792
+ assetNamespace: t.text().notNull(),
1793
+ /**
1794
+ * The account that owns the token.
1795
+ *
1796
+ * Value is zeroAddress if and only if mintStatus is `burned`.
1797
+ *
1798
+ * Note: The owner of the token for a given domainId may differ from the
1799
+ * owner of the associated node in the registry. For example:
1800
+ * - Consider the case where address X owns the ENS name `foo.eth` in
1801
+ * both the BaseRegistrar and the Registry. If X sends a request directly
1802
+ * to the Registry to transfer ownership to Y, ownership of `foo.eth` will
1803
+ * be transferred to Y in the Registry but not in the BaseRegistrar.
1804
+ * - ... for the case above, the BaseRegistrar implements a `reclaim`
1805
+ * allowing the owner of the name in the BaseRegistrar to reclaim ownership
1806
+ * of the name in the Registry.
1807
+ *
1808
+ * Note: When a name is wrapped by the NameWrapper, the owner of the token
1809
+ * in the BaseRegistrar is the NameWrapper, while a new token for the name is
1810
+ * minted by the NameWrapper and owned by the effective owner of the name.
1811
+ */
1812
+ owner: t.hex().notNull(),
1813
+ /**
1814
+ * The mint status of the token. Either `minted` or `burned`.
1815
+ *
1816
+ * After we index a NFT we never delete it from our index. Instead, when an
1817
+ * indexed NFT is burned onchain we retain its record and update its mint
1818
+ * status as `burned`. If a NFT is minted again after it is burned its mint
1819
+ * status is updated to `minted`.
1820
+ */
1821
+ mintStatus: t.text().notNull()
1822
+ }),
1823
+ (t) => ({
1824
+ idx_domainId: index4().on(t.domainId),
1825
+ idx_owner: index4().on(t.owner)
1826
+ })
1827
+ );
1828
+ export {
1829
+ account,
1830
+ account_relations,
1831
+ domainEvent,
1832
+ domainResolverRelation,
1833
+ domainResolverRelation_relations,
1834
+ ensNodeMetadata,
1835
+ event,
1836
+ internal_registrarActionMetadata,
1837
+ internal_registrarActionMetadataType,
1838
+ label,
1839
+ label_relations,
1840
+ latestRegistrationIndex,
1841
+ latestRenewalIndex,
1842
+ migratedNode,
1843
+ nameSales,
1844
+ nameTokens,
1845
+ permissions,
1846
+ permissionsEvent,
1847
+ permissionsResource,
1848
+ permissionsUser,
1849
+ registrarActionRelations,
1850
+ registrarActionType,
1851
+ registrarActions,
1852
+ registration,
1853
+ registrationLifecycleRelations,
1854
+ registrationLifecycles,
1855
+ registrationType,
1856
+ registration_relations,
1857
+ registry,
1858
+ registryCanonicalDomain,
1859
+ relations_permissions,
1860
+ relations_permissionsResource,
1861
+ relations_permissionsUser,
1862
+ relations_registry,
1863
+ relations_v1Domain,
1864
+ relations_v2Domain,
1865
+ renewal,
1866
+ renewal_relations,
1867
+ resolver,
1868
+ resolverAddressRecord,
1869
+ resolverAddressRecordRelations,
1870
+ resolverEvent,
1871
+ resolverRecords,
1872
+ resolverRecords_relations,
1873
+ resolverTextRecord,
1874
+ resolverTextRecordRelations,
1875
+ resolver_relations,
1876
+ reverseNameRecord,
1877
+ subgraph_abiChanged,
1878
+ subgraph_abiChangedRelations,
1879
+ subgraph_account,
1880
+ subgraph_accountRelations,
1881
+ subgraph_addrChanged,
1882
+ subgraph_addrChangedRelations,
1883
+ subgraph_authorisationChanged,
1884
+ subgraph_authorisationChangedRelations,
1885
+ subgraph_contenthashChanged,
1886
+ subgraph_contenthashChangedRelations,
1887
+ subgraph_domain,
1888
+ subgraph_domainRelations,
1889
+ subgraph_expiryExtended,
1890
+ subgraph_expiryExtendedRelations,
1891
+ subgraph_fusesSet,
1892
+ subgraph_fusesSetRelations,
1893
+ subgraph_interfaceChanged,
1894
+ subgraph_interfaceChangedRelations,
1895
+ subgraph_multicoinAddrChanged,
1896
+ subgraph_multicoinAddrChangedRelations,
1897
+ subgraph_nameChanged,
1898
+ subgraph_nameChangedRelations,
1899
+ subgraph_nameRegistered,
1900
+ subgraph_nameRegisteredRelations,
1901
+ subgraph_nameRenewed,
1902
+ subgraph_nameRenewedRelations,
1903
+ subgraph_nameTransferred,
1904
+ subgraph_nameTransferredRelations,
1905
+ subgraph_nameUnwrapped,
1906
+ subgraph_nameUnwrappedRelations,
1907
+ subgraph_nameWrapped,
1908
+ subgraph_nameWrappedRelations,
1909
+ subgraph_newOwner,
1910
+ subgraph_newOwnerRelations,
1911
+ subgraph_newResolver,
1912
+ subgraph_newResolverRelations,
1913
+ subgraph_newTTL,
1914
+ subgraph_newTTLRelations,
1915
+ subgraph_pubkeyChanged,
1916
+ subgraph_pubkeyChangedRelations,
1917
+ subgraph_registration,
1918
+ subgraph_registrationRelations,
1919
+ subgraph_resolver,
1920
+ subgraph_resolverRelations,
1921
+ subgraph_textChanged,
1922
+ subgraph_textChangedRelations,
1923
+ subgraph_transfer,
1924
+ subgraph_transferRelations,
1925
+ subgraph_versionChanged,
1926
+ subgraph_versionChangedRelations,
1927
+ subgraph_wrappedDomain,
1928
+ subgraph_wrappedDomainRelations,
1929
+ subgraph_wrappedTransfer,
1930
+ subgraph_wrappedTransferRelations,
1931
+ subregistries,
1932
+ subregistryRelations,
1933
+ v1Domain,
1934
+ v2Domain
1935
+ };
1936
+ //# sourceMappingURL=index.js.map