@ensnode/ensnode-schema 0.0.0-next-20260102143513

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.
@@ -0,0 +1,1432 @@
1
+ // src/schemas/protocol-acceleration.schema.ts
2
+ import { onchainTable, primaryKey, relations } from "ponder";
3
+ var reverseNameRecord = onchainTable(
4
+ "reverse_name_records",
5
+ (t) => ({
6
+ // keyed by (address, coinType)
7
+ address: t.hex().notNull(),
8
+ coinType: t.bigint().notNull(),
9
+ /**
10
+ * Represents the ENSIP-19 Reverse Name Record for a given (address, coinType).
11
+ *
12
+ * The value of this field is guaranteed to be a non-empty-string normalized ENS name (see
13
+ * `interpretNameRecordValue` for additional context and specific guarantees). Unnormalized
14
+ * names and empty string values are interpreted as a deletion of the associated Reverse Name
15
+ * Record entity (represented in the schema as the _absence_ of a relevant Reverse Name Record
16
+ * entity).
17
+ */
18
+ value: t.text().notNull()
19
+ }),
20
+ (t) => ({
21
+ pk: primaryKey({ columns: [t.address, t.coinType] })
22
+ })
23
+ );
24
+ var nodeResolverRelation = onchainTable(
25
+ "node_resolver_relations",
26
+ (t) => ({
27
+ // keyed by (chainId, registry, node)
28
+ chainId: t.integer().notNull(),
29
+ registry: t.hex().notNull(),
30
+ node: t.hex().notNull(),
31
+ /**
32
+ * The Address of the Resolver contract this `node` has set (via Registry#NewResolver) within
33
+ * the Registry on `chainId`.
34
+ */
35
+ resolver: t.hex().notNull()
36
+ }),
37
+ (t) => ({
38
+ pk: primaryKey({ columns: [t.chainId, t.registry, t.node] })
39
+ })
40
+ );
41
+ var resolverRecords = onchainTable(
42
+ "resolver_records",
43
+ (t) => ({
44
+ // keyed by (chainId, resolver, node)
45
+ chainId: t.integer().notNull(),
46
+ resolver: t.hex().notNull(),
47
+ node: t.hex().notNull(),
48
+ /**
49
+ * Represents the value of the reverse-resolution (ENSIP-3) name() record, used for Reverse Resolution.
50
+ *
51
+ * The emitted record values are interpreted according to `interpretNameRecordValue` — unnormalized
52
+ * names and empty string values are interpreted as a deletion of the associated record (represented
53
+ * here as `null`).
54
+ *
55
+ * If set, the value of this field is guaranteed to be a non-empty-string normalized ENS name
56
+ * (see `interpretNameRecordValue` for additional context and specific guarantees).
57
+ */
58
+ name: t.text()
59
+ }),
60
+ (t) => ({
61
+ pk: primaryKey({ columns: [t.chainId, t.resolver, t.node] })
62
+ })
63
+ );
64
+ var resolverRecords_relations = relations(resolverRecords, ({ many }) => ({
65
+ // resolverRecord has many address records
66
+ addressRecords: many(resolverAddressRecord),
67
+ // resolverRecord has many text records
68
+ textRecords: many(resolverTextRecord)
69
+ }));
70
+ var resolverAddressRecord = onchainTable(
71
+ "resolver_address_records",
72
+ (t) => ({
73
+ // keyed by ((chainId, resolver, node), coinType)
74
+ chainId: t.integer().notNull(),
75
+ resolver: t.hex().notNull(),
76
+ node: t.hex().notNull(),
77
+ coinType: t.bigint().notNull(),
78
+ /**
79
+ * Represents the value of the Addresss Record specified by ((chainId, resolver, node), coinType).
80
+ *
81
+ * The value of this field is interpreted by `interpretAddressRecordValue` — see its implementation
82
+ * for additional context and specific guarantees.
83
+ */
84
+ address: t.text().notNull()
85
+ }),
86
+ (t) => ({
87
+ pk: primaryKey({ columns: [t.chainId, t.resolver, t.node, t.coinType] })
88
+ })
89
+ );
90
+ var resolverAddressRecordRelations = relations(resolverAddressRecord, ({ one }) => ({
91
+ // belongs to resolverRecord
92
+ resolver: one(resolverRecords, {
93
+ fields: [
94
+ resolverAddressRecord.chainId,
95
+ resolverAddressRecord.resolver,
96
+ resolverAddressRecord.node
97
+ ],
98
+ references: [resolverRecords.chainId, resolverRecords.resolver, resolverRecords.node]
99
+ })
100
+ }));
101
+ var resolverTextRecord = onchainTable(
102
+ "resolver_trecords",
103
+ (t) => ({
104
+ // keyed by ((chainId, resolver, node), key)
105
+ chainId: t.integer().notNull(),
106
+ resolver: t.hex().notNull(),
107
+ node: t.hex().notNull(),
108
+ key: t.text().notNull(),
109
+ /**
110
+ * Represents the value of the Text Record specified by ((chainId, resolver, node), key).
111
+ *
112
+ * The value of this field is interpreted by `interpretTextRecordValue` — see its implementation
113
+ * for additional context and specific guarantees.
114
+ */
115
+ value: t.text().notNull()
116
+ }),
117
+ (t) => ({
118
+ pk: primaryKey({ columns: [t.chainId, t.resolver, t.node, t.key] })
119
+ })
120
+ );
121
+ var resolverTextRecordRelations = relations(resolverTextRecord, ({ one }) => ({
122
+ // belongs to resolverRecord
123
+ resolver: one(resolverRecords, {
124
+ fields: [resolverTextRecord.chainId, resolverTextRecord.resolver, resolverTextRecord.node],
125
+ references: [resolverRecords.chainId, resolverRecords.resolver, resolverRecords.node]
126
+ })
127
+ }));
128
+ var migratedNode = onchainTable("migrated_nodes", (t) => ({
129
+ node: t.hex().primaryKey()
130
+ }));
131
+
132
+ // src/schemas/registrars.schema.ts
133
+ import { index, onchainEnum, onchainTable as onchainTable2, relations as relations2, uniqueIndex } from "ponder";
134
+ var subregistries = onchainTable2(
135
+ "subregistries",
136
+ (t) => ({
137
+ /**
138
+ * Subregistry ID
139
+ *
140
+ * Identifies the chainId and address of the smart contract associated
141
+ * with the subregistry.
142
+ *
143
+ * Guaranteed to be a fully lowercase string formatted according to
144
+ * the CAIP-10 standard.
145
+ *
146
+ * @see https://chainagnostic.org/CAIPs/caip-10
147
+ */
148
+ subregistryId: t.text().primaryKey(),
149
+ /**
150
+ * The node (namehash) of the name the subregistry manages subnames of.
151
+ * Example subregistry managed names:
152
+ * - `eth`
153
+ * - `base.eth`
154
+ * - `linea.eth`
155
+ *
156
+ * Guaranteed to be a fully lowercase hex string representation of 32-bytes.
157
+ */
158
+ node: t.hex().notNull()
159
+ }),
160
+ (t) => ({
161
+ uniqueNode: uniqueIndex().on(t.node)
162
+ })
163
+ );
164
+ var registrationLifecycles = onchainTable2(
165
+ "registration_lifecycles",
166
+ (t) => ({
167
+ /**
168
+ * The node (namehash) of the FQDN of the domain the registration lifecycle
169
+ * is associated with.
170
+ *
171
+ * Guaranteed to be a subname of the node (namehash) of the subregistry
172
+ * identified by `subregistryId`.
173
+ *
174
+ * Guaranteed to be a fully lowercase hex string representation of 32-bytes.
175
+ */
176
+ node: t.hex().primaryKey(),
177
+ /**
178
+ * Subregistry ID
179
+ *
180
+ * Identifies the chainId and address of the subregistry smart contract
181
+ * that manages the registration lifecycle.
182
+ *
183
+ * Guaranteed to be a fully lowercase string formatted according to
184
+ * the CAIP-10 standard.
185
+ *
186
+ * @see https://chainagnostic.org/CAIPs/caip-10
187
+ */
188
+ subregistryId: t.text().notNull(),
189
+ /**
190
+ * Expires at
191
+ *
192
+ * Unix timestamp when the Registration Lifecycle is scheduled to expire.
193
+ */
194
+ expiresAt: t.bigint().notNull()
195
+ }),
196
+ (t) => ({
197
+ bySubregistry: index().on(t.subregistryId)
198
+ })
199
+ );
200
+ var registrarActionType = onchainEnum("registrar_action_type", [
201
+ "registration",
202
+ "renewal"
203
+ ]);
204
+ var registrarActions = onchainTable2(
205
+ "registrar_actions",
206
+ (t) => ({
207
+ /**
208
+ * "Logical registrar action" ID
209
+ *
210
+ * The `id` value is a deterministic and globally unique identifier for
211
+ * the "logical registrar action".
212
+ *
213
+ * The `id` value represents the *initial* onchain event associated with
214
+ * the "logical registrar action", but the full state of
215
+ * the "logical registrar action" is an aggregate across each of
216
+ * the onchain events referenced in the `eventIds` field.
217
+ *
218
+ * Guaranteed to be the very first element in `eventIds` array.
219
+ */
220
+ id: t.text().primaryKey(),
221
+ /**
222
+ * The type of the "logical registrar action".
223
+ */
224
+ type: registrarActionType().notNull(),
225
+ /**
226
+ * Subregistry ID
227
+ *
228
+ * The ID of the subregistry the "logical registrar action" was taken on.
229
+ *
230
+ * Identifies the chainId and address of the associated subregistry smart
231
+ * contract.
232
+ *
233
+ * Guaranteed to be a fully lowercase string formatted according to
234
+ * the CAIP-10 standard.
235
+ *
236
+ * @see https://chainagnostic.org/CAIPs/caip-10
237
+ */
238
+ subregistryId: t.text().notNull(),
239
+ /**
240
+ * The node (namehash) of the FQDN of the domain associated with
241
+ * the "logical registrar action".
242
+ *
243
+ * Guaranteed to be a fully lowercase hex string representation of 32-bytes.
244
+ */
245
+ node: t.hex().notNull(),
246
+ /**
247
+ * Incremental Duration
248
+ *
249
+ * If `type` is "registration":
250
+ * - Represents the duration between `blockTimestamp` and
251
+ * the initial `expiresAt` value that the associated
252
+ * "registration lifecycle" will be initialized with.
253
+ * If `type` is "renewal":
254
+ * - Represents the incremental increase in duration made to
255
+ * the `expiresAt` value in the associated "registration lifecycle".
256
+ *
257
+ * A "registration lifecycle" may be extended via renewal even after it
258
+ * expires if it is still within its grace period.
259
+ *
260
+ * Consider the following scenario:
261
+ *
262
+ * The "registration lifecycle" of a direct subname of .eth is scheduled to
263
+ * expire on Jan 1, midnight UTC. It is currently 30 days after this
264
+ * expiration time. Therefore, there are currently another 60 days of grace
265
+ * period remaining for this name. Anyone can still make a renewal to
266
+ * extend the "registration lifecycle" of this name.
267
+ *
268
+ * Given this scenario, consider the following examples:
269
+ *
270
+ * 1. If a renewal is made with 10 days incremental duration,
271
+ * the "registration lifecycle" for this name will remain in
272
+ * an "expired" state, but it will now have another 70 days of
273
+ * grace period remaining.
274
+ *
275
+ * 2. If a renewal is made with 50 days incremental duration,
276
+ * the "registration lifecycle" for this name will no longer be
277
+ * "expired" and will become "active", but the "registration lifecycle"
278
+ * will now be scheduled to expire again in 20 days.
279
+ *
280
+ * After the "registration lifecycle" for a name becomes expired by more
281
+ * than its grace period, it can no longer be renewed by anyone and is
282
+ * considered "released". The name must first be registered again, starting
283
+ * a new "registration lifecycle" of
284
+ * active / expired / grace period / released.
285
+ *
286
+ * May be 0.
287
+ *
288
+ * Guaranteed to be a non-negative bigint value.
289
+ */
290
+ incrementalDuration: t.bigint().notNull(),
291
+ /**
292
+ * Base cost
293
+ *
294
+ * Base cost (before any `premium`) of Ether measured in units of Wei
295
+ * paid to execute the "logical registrar action".
296
+ *
297
+ * May be 0.
298
+ *
299
+ * Guaranteed to be:
300
+ * 1) null if and only if `total` is null.
301
+ * 2) Otherwise, a non-negative bigint value.
302
+ */
303
+ baseCost: t.bigint(),
304
+ /**
305
+ * Premium
306
+ *
307
+ * "premium" cost (in excesses of the `baseCost`) of Ether measured in
308
+ * units of Wei paid to execute the "logical registrar action".
309
+ *
310
+ * May be 0.
311
+ *
312
+ * Guaranteed to be:
313
+ * 1) null if and only if `total` is null.
314
+ * 2) Otherwise, zero when `type` is `renewal`.
315
+ * 3) Otherwise, a non-negative bigint value.
316
+ */
317
+ premium: t.bigint(),
318
+ /**
319
+ * Total
320
+ *
321
+ * Total cost of Ether measured in units of Wei paid to execute
322
+ * the "logical registrar action".
323
+ *
324
+ * May be 0.
325
+ *
326
+ * Guaranteed to be:
327
+ * 1) null if and only if both `baseCost` and `premium` are null.
328
+ * 2) Otherwise, a non-negative bigint value, equal to the sum of
329
+ * `baseCost` and `premium`.
330
+ */
331
+ total: t.bigint(),
332
+ /**
333
+ * Registrant
334
+ *
335
+ * Identifies the address that initiated the "logical registrar action" and
336
+ * is paying the `total` cost (if applicable).
337
+ *
338
+ * It may not be the owner of the name:
339
+ * 1. When a name is registered, the initial owner of the name may be
340
+ * distinct from the registrant.
341
+ * 2. There are no restrictions on who may renew a name.
342
+ * Therefore the owner of the name may be distinct from the registrant.
343
+ *
344
+ *
345
+ * The "chainId" of this address is the same as is referenced in `subregistryId`.
346
+ *
347
+ * Guaranteed to be a fully lowercase address
348
+ */
349
+ registrant: t.hex().notNull(),
350
+ /**
351
+ * Encoded Referrer
352
+ *
353
+ * Represents the "raw" 32-byte "referrer" value emitted onchain in
354
+ * association with the registrar action.
355
+ *
356
+ * Guaranteed to be:
357
+ * 1) null if the emitted `eventIds` contain no information about a referrer.
358
+ * 2) Otherwise, a fully lowercase hex string representation of 32-bytes.
359
+ */
360
+ encodedReferrer: t.hex(),
361
+ /**
362
+ * Decoded referrer
363
+ *
364
+ * Decoded referrer according to the subjective interpretation of
365
+ * `encodedReferrer` defined for ENS Holiday Awards.
366
+ *
367
+ * Identifies the interpreted address of the referrer.
368
+ * The "chainId" of this address is the same as is referenced in
369
+ * `subregistryId`.
370
+ *
371
+ * Guaranteed to be:
372
+ * 1) null if `encodedReferrer` is null.
373
+ * 2) Otherwise, a fully lowercase address.
374
+ * 3) May be the "zero address" to represent that an `encodedReferrer` is
375
+ * defined but that it is interpreted as no referrer.
376
+ */
377
+ decodedReferrer: t.hex(),
378
+ /**
379
+ * Number of the block that includes the "logical registrar action".
380
+ *
381
+ * The "chainId" of this block is the same as is referenced in
382
+ * `subregistryId`.
383
+ *
384
+ * Guaranteed to be a non-negative bigint value.
385
+ */
386
+ blockNumber: t.bigint().notNull(),
387
+ /**
388
+ * Unix timestamp of the block referenced by `blockNumber` that includes
389
+ * the "logical registrar action".
390
+ */
391
+ timestamp: t.bigint().notNull(),
392
+ /**
393
+ * Transaction hash of the transaction associated with
394
+ * the "logical registrar action".
395
+ *
396
+ * The "chainId" of this transaction is the same as is referenced in
397
+ * `subregistryId`.
398
+ *
399
+ * Note that a single transaction may be associated with any number of
400
+ * "logical registrar actions".
401
+ *
402
+ * Guaranteed to be a fully lowercase hex string representation of 32-bytes.
403
+ */
404
+ transactionHash: t.hex().notNull(),
405
+ /**
406
+ * Event IDs
407
+ *
408
+ * Array of the eventIds that have contributed to the state of
409
+ * the "logical registrar action" record.
410
+ *
411
+ * Each eventId is a deterministic and globally unique onchain event
412
+ * identifier.
413
+ *
414
+ * Guarantees:
415
+ * - Each eventId is of events that occurred within the block
416
+ * referenced by `blockNumber`.
417
+ * - At least 1 eventId.
418
+ * - Ordered chronologically (ascending) by logIndex within `blockNumber`.
419
+ * - The first element in the array is equal to the `id` of
420
+ * the overall "logical registrar action" record.
421
+ *
422
+ * The following ideas are not generalized for ENS overall but happen to
423
+ * be a characteristic of the scope of our current indexing logic:
424
+ * 1. These id's always reference events emitted by
425
+ * a related "BaseRegistrar" contract.
426
+ * 2. These id's optionally reference events emitted by
427
+ * a related "Registrar Controller" contract. This is because our
428
+ * current indexing logic doesn't guarantee to index
429
+ * all "Registrar Controller" contracts.
430
+ */
431
+ eventIds: t.text().array().notNull()
432
+ }),
433
+ (t) => ({
434
+ byDecodedReferrer: index().on(t.decodedReferrer),
435
+ byTimestamp: index().on(t.timestamp)
436
+ })
437
+ );
438
+ var internal_registrarActionMetadata = onchainTable2(
439
+ "_ensindexer_registrar_action_metadata",
440
+ (t) => ({
441
+ /**
442
+ * Logical Event Key
443
+ *
444
+ * A fully lowercase string formatted as:
445
+ * `{chainId}:{subregistryAddress}:{node}:{transactionHash}`
446
+ */
447
+ logicalEventKey: t.text().primaryKey(),
448
+ /**
449
+ * Logical Event ID
450
+ *
451
+ * A string holding the `id` value of the existing "logical registrar action"
452
+ * record that is currently being built as an aggregation of onchain events.
453
+ *
454
+ * May be used by subsequent event handlers to identify which
455
+ * "logical registrar action" to aggregate additional indexed state into.
456
+ */
457
+ logicalEventId: t.text().notNull()
458
+ })
459
+ );
460
+ var subregistryRelations = relations2(subregistries, ({ many }) => ({
461
+ registrationLifecycle: many(registrationLifecycles)
462
+ }));
463
+ var registrationLifecycleRelations = relations2(
464
+ registrationLifecycles,
465
+ ({ one, many }) => ({
466
+ subregistry: one(subregistries, {
467
+ fields: [registrationLifecycles.subregistryId],
468
+ references: [subregistries.subregistryId]
469
+ }),
470
+ registrarAction: many(registrarActions)
471
+ })
472
+ );
473
+ var registrarActionRelations = relations2(registrarActions, ({ one }) => ({
474
+ registrationLifecycle: one(registrationLifecycles, {
475
+ fields: [registrarActions.node],
476
+ references: [registrationLifecycles.node]
477
+ })
478
+ }));
479
+
480
+ // src/schemas/subgraph.schema.ts
481
+ import { index as index2, onchainTable as onchainTable3, relations as relations3 } from "ponder";
482
+
483
+ // src/lib/collate.ts
484
+ function monkeypatchCollate(col, collation) {
485
+ col.getSQLType = function() {
486
+ return `${Object.getPrototypeOf(this).getSQLType.call(this)} COLLATE ${collation}`;
487
+ };
488
+ return col;
489
+ }
490
+
491
+ // src/schemas/subgraph.schema.ts
492
+ var subgraph_domain = onchainTable3(
493
+ "subgraph_domains",
494
+ (t) => ({
495
+ // The namehash of the name
496
+ id: t.hex().primaryKey(),
497
+ /**
498
+ * The ENS Name that this Domain represents.
499
+ *
500
+ * If {@link ENSIndexerConfig#isSubgraphCompatible}, this value is guaranteed to be either:
501
+ * a) null (in the case of the root node), or
502
+ * b) a Subgraph Interpreted Name.
503
+ *
504
+ * @see https://ensnode.io/docs/reference/terminology#subgraph-indexability--labelname-interpretation
505
+ *
506
+ * Otherwise, this value is guaranteed to be an Interpreted Name, which is either:
507
+ * a) a normalized Name, or
508
+ * b) a Name entirely consisting of Interpreted Labels.
509
+ *
510
+ * Note that the type of the column will remain string | null, for legacy subgraph compatibility,
511
+ * but in practice will never be null. The Root node's name will be '' (empty string).
512
+ *
513
+ * @see https://ensnode.io/docs/reference/terminology#interpreted-name
514
+ */
515
+ name: t.text(),
516
+ /**
517
+ * The Label associated with the Domain.
518
+ *
519
+ * If {@link ENSIndexerConfig#isSubgraphCompatible}, this value is guaranteed to be either:
520
+ * a) null, in the case of the root Node or a name whose childmost label is subgraph-unindexable, or
521
+ * b) a subgraph-indexable Subgraph Interpreted Label (i.e. a Literal Label of undefined normalization).
522
+ *
523
+ * @see https://ensnode.io/docs/reference/terminology#subgraph-indexability--labelname-interpretation
524
+ *
525
+ * Otherwise, this value is guaranteed to be an Interpreted Label which is either:
526
+ * a) null, exclusively in the case of the root Node,
527
+ * b) a normalized Label, or
528
+ * c) an Encoded LabelHash, which encodes either
529
+ * i. in the case of an Unknown Label, the LabelHash emitted onchain, or
530
+ * ii. in the case of an Unnormalized Label, the LabelHash of the Literal Label value found onchain.
531
+ *
532
+ * @see https://ensnode.io/docs/reference/terminology#interpreted-label
533
+ */
534
+ labelName: t.text(),
535
+ // keccak256(labelName)
536
+ labelhash: t.hex(),
537
+ // The namehash (id) of the parent name
538
+ parentId: t.hex(),
539
+ // The number of subdomains
540
+ subdomainCount: t.integer().notNull().default(0),
541
+ // Address logged from current resolver, if any
542
+ resolvedAddressId: t.hex(),
543
+ // The resolver that controls the domain's settings
544
+ resolverId: t.text(),
545
+ // The time-to-live (TTL) value of the domain's records
546
+ ttl: t.bigint(),
547
+ // Indicates whether the domain has been migrated to a new registrar
548
+ isMigrated: t.boolean().notNull().default(false),
549
+ // The time when the domain was created
550
+ createdAt: t.bigint().notNull(),
551
+ // The account that owns the domain
552
+ ownerId: t.hex().notNull(),
553
+ // The account that owns the ERC721 NFT for the domain
554
+ registrantId: t.hex(),
555
+ // The account that owns the wrapped domain
556
+ wrappedOwnerId: t.hex(),
557
+ // The expiry date for the domain, from either the registration, or the wrapped domain if PCC is burned
558
+ expiryDate: t.bigint()
559
+ }),
560
+ (t) => ({
561
+ byLabelhash: index2().on(t.labelhash),
562
+ byParentId: index2().on(t.parentId),
563
+ byOwnerId: index2().on(t.ownerId),
564
+ byRegistrantId: index2().on(t.registrantId),
565
+ byWrappedOwnerId: index2().on(t.wrappedOwnerId)
566
+ })
567
+ );
568
+ monkeypatchCollate(subgraph_domain.name, '"C"');
569
+ monkeypatchCollate(subgraph_domain.labelName, '"C"');
570
+ var subgraph_domainRelations = relations3(subgraph_domain, ({ one, many }) => ({
571
+ resolvedAddress: one(subgraph_account, {
572
+ fields: [subgraph_domain.resolvedAddressId],
573
+ references: [subgraph_account.id]
574
+ }),
575
+ owner: one(subgraph_account, {
576
+ fields: [subgraph_domain.ownerId],
577
+ references: [subgraph_account.id]
578
+ }),
579
+ parent: one(subgraph_domain, {
580
+ fields: [subgraph_domain.parentId],
581
+ references: [subgraph_domain.id]
582
+ }),
583
+ resolver: one(subgraph_resolver, {
584
+ fields: [subgraph_domain.resolverId],
585
+ references: [subgraph_resolver.id]
586
+ }),
587
+ subdomains: many(subgraph_domain, { relationName: "parent" }),
588
+ registrant: one(subgraph_account, {
589
+ fields: [subgraph_domain.registrantId],
590
+ references: [subgraph_account.id]
591
+ }),
592
+ wrappedOwner: one(subgraph_account, {
593
+ fields: [subgraph_domain.wrappedOwnerId],
594
+ references: [subgraph_account.id]
595
+ }),
596
+ wrappedDomain: one(subgraph_wrappedDomain, {
597
+ fields: [subgraph_domain.id],
598
+ references: [subgraph_wrappedDomain.domainId]
599
+ }),
600
+ registration: one(subgraph_registration, {
601
+ fields: [subgraph_domain.id],
602
+ references: [subgraph_registration.domainId]
603
+ }),
604
+ // event relations
605
+ transfers: many(subgraph_transfer),
606
+ newOwners: many(subgraph_newOwner),
607
+ newResolvers: many(subgraph_newResolver),
608
+ newTTLs: many(subgraph_newTTL),
609
+ wrappedTransfers: many(subgraph_wrappedTransfer),
610
+ nameWrappeds: many(subgraph_nameWrapped),
611
+ nameUnwrappeds: many(subgraph_nameUnwrapped),
612
+ fusesSets: many(subgraph_fusesSet),
613
+ expiryExtendeds: many(subgraph_expiryExtended)
614
+ }));
615
+ var subgraph_account = onchainTable3("subgraph_accounts", (t) => ({
616
+ id: t.hex().primaryKey()
617
+ }));
618
+ var subgraph_accountRelations = relations3(subgraph_account, ({ many }) => ({
619
+ domains: many(subgraph_domain),
620
+ wrappedDomains: many(subgraph_wrappedDomain),
621
+ registrations: many(subgraph_registration)
622
+ }));
623
+ var subgraph_resolver = onchainTable3(
624
+ "subgraph_resolvers",
625
+ (t) => ({
626
+ // The unique identifier for this resolver, which is a concatenation of the domain namehash and the resolver address
627
+ id: t.text().primaryKey(),
628
+ // The domain that this resolver is associated with
629
+ domainId: t.hex().notNull(),
630
+ // The address of the resolver contract
631
+ address: t.hex().notNull().$type(),
632
+ // The current value of the 'addr' record for this resolver, as determined by the associated events
633
+ addrId: t.hex(),
634
+ // The content hash for this resolver, in binary format
635
+ contentHash: t.text(),
636
+ // The set of observed text record keys for this resolver
637
+ // NOTE: we avoid .notNull.default([]) to match subgraph behavior
638
+ texts: t.text().array(),
639
+ // The set of observed SLIP-44 coin types for this resolver
640
+ // NOTE: we avoid .notNull.default([]) to match subgraph behavior
641
+ coinTypes: t.bigint().array()
642
+ }),
643
+ (t) => ({
644
+ byDomainId: index2().on(t.domainId)
645
+ })
646
+ );
647
+ var subgraph_resolverRelations = relations3(subgraph_resolver, ({ one, many }) => ({
648
+ addr: one(subgraph_account, {
649
+ fields: [subgraph_resolver.addrId],
650
+ references: [subgraph_account.id]
651
+ }),
652
+ domain: one(subgraph_domain, {
653
+ fields: [subgraph_resolver.domainId],
654
+ references: [subgraph_domain.id]
655
+ }),
656
+ // event relations
657
+ addrChangeds: many(subgraph_addrChanged),
658
+ multicoinAddrChangeds: many(subgraph_multicoinAddrChanged),
659
+ nameChangeds: many(subgraph_nameChanged),
660
+ abiChangeds: many(subgraph_abiChanged),
661
+ pubkeyChangeds: many(subgraph_pubkeyChanged),
662
+ textChangeds: many(subgraph_textChanged),
663
+ contenthashChangeds: many(subgraph_contenthashChanged),
664
+ interfaceChangeds: many(subgraph_interfaceChanged),
665
+ authorisationChangeds: many(subgraph_authorisationChanged),
666
+ versionChangeds: many(subgraph_versionChanged)
667
+ }));
668
+ var subgraph_registration = onchainTable3(
669
+ "subgraph_registrations",
670
+ (t) => ({
671
+ // The unique identifier of the registration
672
+ id: t.hex().primaryKey(),
673
+ // The domain name associated with the registration
674
+ domainId: t.hex().notNull(),
675
+ // The registration date of the domain
676
+ registrationDate: t.bigint().notNull(),
677
+ // The expiry date of the domain
678
+ expiryDate: t.bigint().notNull(),
679
+ // The cost associated with the domain registration
680
+ cost: t.bigint(),
681
+ // The account that registered the domain
682
+ registrantId: t.hex().notNull(),
683
+ /**
684
+ * The Label associated with the domain registration.
685
+ *
686
+ * If {@link ENSIndexerConfig#isSubgraphCompatible}, this value is guaranteed to be either:
687
+ * a) null, in the case of the root Node or a Domain whose label is subgraph-unindexable, or
688
+ * b) a subgraph-indexable Subgraph Interpreted Label (i.e. a Literal Label of undefined normalization).
689
+ *
690
+ * @see https://ensnode.io/docs/reference/terminology#subgraph-indexability--labelname-interpretation
691
+ *
692
+ * Otherwise, this value is guaranteed to be an Interpreted Label which is either:
693
+ * a) a normalized Label, or
694
+ * b) in the case of an Unnormalized Label, an Encoded LabelHash of the Literal Label value found onchain.
695
+ *
696
+ * Note that the type of the column will remain string | null, for legacy subgraph compatibility.
697
+ * In practice however, because there is no Registration entity for the root Node (the only Node
698
+ * with a null labelName) this field will never be null.
699
+ *
700
+ * @see https://ensnode.io/docs/reference/terminology#interpreted-label
701
+ */
702
+ labelName: t.text()
703
+ }),
704
+ (t) => ({
705
+ byDomainId: index2().on(t.domainId),
706
+ byRegistrationDate: index2().on(t.registrationDate)
707
+ })
708
+ );
709
+ var subgraph_registrationRelations = relations3(subgraph_registration, ({ one, many }) => ({
710
+ domain: one(subgraph_domain, {
711
+ fields: [subgraph_registration.domainId],
712
+ references: [subgraph_domain.id]
713
+ }),
714
+ registrant: one(subgraph_account, {
715
+ fields: [subgraph_registration.registrantId],
716
+ references: [subgraph_account.id]
717
+ }),
718
+ // event relations
719
+ nameRegistereds: many(subgraph_nameRegistered),
720
+ nameReneweds: many(subgraph_nameRenewed),
721
+ nameTransferreds: many(subgraph_nameTransferred)
722
+ }));
723
+ var subgraph_wrappedDomain = onchainTable3(
724
+ "subgraph_wrapped_domains",
725
+ (t) => ({
726
+ // The unique identifier for each instance of the WrappedDomain entity
727
+ id: t.hex().primaryKey(),
728
+ // The domain that is wrapped by this WrappedDomain
729
+ domainId: t.hex().notNull(),
730
+ // The expiry date of the wrapped domain
731
+ expiryDate: t.bigint().notNull(),
732
+ // The number of fuses remaining on the wrapped domain
733
+ fuses: t.integer().notNull(),
734
+ // The account that owns this WrappedDomain
735
+ ownerId: t.hex().notNull(),
736
+ /**
737
+ * The Name that this WrappedDomain represents. Names are emitted by the NameWrapper contract as
738
+ * DNS-Encoded Names which may be malformed, which will result in this field being `null`.
739
+ *
740
+ * If {@link ENSIndexerConfig#isSubgraphCompatible}, this value is guaranteed to be either:
741
+ * a) null (in the case of a DNS-Encoded Name that is malformed or contains subgraph-unindexable labels), or
742
+ * b) a subgraph-indexable Subgraph Interpreted Label (i.e. a Literal Label of undefined normalization).
743
+ *
744
+ * @see https://ensnode.io/docs/reference/terminology#subgraph-indexability--labelname-interpretation
745
+ *
746
+ * Otherwise, this value is guaranteed to be either:
747
+ * a) null (in the case of a malformed DNS-Encoded Name),
748
+ * b) an Interpreted Name.
749
+ *
750
+ * @see https://ensnode.io/docs/reference/terminology#interpreted-name
751
+ */
752
+ name: t.text()
753
+ }),
754
+ (t) => ({
755
+ byDomainId: index2().on(t.domainId)
756
+ })
757
+ );
758
+ var subgraph_wrappedDomainRelations = relations3(subgraph_wrappedDomain, ({ one }) => ({
759
+ domain: one(subgraph_domain, {
760
+ fields: [subgraph_wrappedDomain.domainId],
761
+ references: [subgraph_domain.id]
762
+ }),
763
+ owner: one(subgraph_account, {
764
+ fields: [subgraph_wrappedDomain.ownerId],
765
+ references: [subgraph_account.id]
766
+ })
767
+ }));
768
+ var sharedEventColumns = (t) => ({
769
+ id: t.text().primaryKey(),
770
+ blockNumber: t.integer().notNull(),
771
+ transactionID: t.hex().notNull()
772
+ });
773
+ var domainEvent = (t) => ({
774
+ ...sharedEventColumns(t),
775
+ domainId: t.hex().notNull()
776
+ });
777
+ var domainEventIndex = (t) => ({
778
+ // primary reverse lookup
779
+ idx: index2().on(t.domainId),
780
+ // sorting index
781
+ idx_compound: index2().on(t.domainId, t.id)
782
+ });
783
+ var subgraph_transfer = onchainTable3(
784
+ "subgraph_transfers",
785
+ (t) => ({
786
+ ...domainEvent(t),
787
+ ownerId: t.hex().notNull()
788
+ }),
789
+ domainEventIndex
790
+ );
791
+ var subgraph_newOwner = onchainTable3(
792
+ "subgraph_new_owners",
793
+ (t) => ({
794
+ ...domainEvent(t),
795
+ ownerId: t.hex().notNull(),
796
+ parentDomainId: t.hex().notNull()
797
+ }),
798
+ domainEventIndex
799
+ );
800
+ var subgraph_newResolver = onchainTable3(
801
+ "subgraph_new_resolvers",
802
+ (t) => ({
803
+ ...domainEvent(t),
804
+ resolverId: t.text().notNull()
805
+ }),
806
+ domainEventIndex
807
+ );
808
+ var subgraph_newTTL = onchainTable3(
809
+ "subgraph_new_ttls",
810
+ (t) => ({
811
+ ...domainEvent(t),
812
+ ttl: t.bigint().notNull()
813
+ }),
814
+ domainEventIndex
815
+ );
816
+ var subgraph_wrappedTransfer = onchainTable3(
817
+ "subgraph_wrapped_transfers",
818
+ (t) => ({
819
+ ...domainEvent(t),
820
+ ownerId: t.hex().notNull()
821
+ }),
822
+ domainEventIndex
823
+ );
824
+ var subgraph_nameWrapped = onchainTable3(
825
+ "subgraph_name_wrapped",
826
+ (t) => ({
827
+ ...domainEvent(t),
828
+ name: t.text(),
829
+ fuses: t.integer().notNull(),
830
+ ownerId: t.hex().notNull(),
831
+ expiryDate: t.bigint().notNull()
832
+ }),
833
+ domainEventIndex
834
+ );
835
+ var subgraph_nameUnwrapped = onchainTable3(
836
+ "subgraph_name_unwrapped",
837
+ (t) => ({
838
+ ...domainEvent(t),
839
+ ownerId: t.hex().notNull()
840
+ }),
841
+ domainEventIndex
842
+ );
843
+ var subgraph_fusesSet = onchainTable3(
844
+ "subgraph_fuses_set",
845
+ (t) => ({
846
+ ...domainEvent(t),
847
+ fuses: t.integer().notNull()
848
+ }),
849
+ domainEventIndex
850
+ );
851
+ var subgraph_expiryExtended = onchainTable3(
852
+ "subgraph_expiry_extended",
853
+ (t) => ({
854
+ ...domainEvent(t),
855
+ expiryDate: t.bigint().notNull()
856
+ }),
857
+ domainEventIndex
858
+ );
859
+ var registrationEvent = (t) => ({
860
+ ...sharedEventColumns(t),
861
+ registrationId: t.hex().notNull()
862
+ });
863
+ var registrationEventIndex = (t) => ({
864
+ // primary reverse lookup
865
+ idx: index2().on(t.registrationId),
866
+ // sorting index
867
+ idx_compound: index2().on(t.registrationId, t.id)
868
+ });
869
+ var subgraph_nameRegistered = onchainTable3(
870
+ "subgraph_name_registered",
871
+ (t) => ({
872
+ ...registrationEvent(t),
873
+ registrantId: t.hex().notNull(),
874
+ expiryDate: t.bigint().notNull()
875
+ }),
876
+ registrationEventIndex
877
+ );
878
+ var subgraph_nameRenewed = onchainTable3(
879
+ "subgraph_name_renewed",
880
+ (t) => ({
881
+ ...registrationEvent(t),
882
+ expiryDate: t.bigint().notNull()
883
+ }),
884
+ registrationEventIndex
885
+ );
886
+ var subgraph_nameTransferred = onchainTable3(
887
+ "subgraph_name_transferred",
888
+ (t) => ({
889
+ ...registrationEvent(t),
890
+ newOwnerId: t.hex().notNull()
891
+ }),
892
+ registrationEventIndex
893
+ );
894
+ var resolverEvent = (t) => ({
895
+ ...sharedEventColumns(t),
896
+ resolverId: t.text().notNull()
897
+ });
898
+ var resolverEventIndex = (t) => ({
899
+ // primary reverse lookup
900
+ idx: index2().on(t.resolverId),
901
+ // sorting index
902
+ idx_compound: index2().on(t.resolverId, t.id)
903
+ });
904
+ var subgraph_addrChanged = onchainTable3(
905
+ "subgraph_addr_changed",
906
+ (t) => ({
907
+ ...resolverEvent(t),
908
+ addrId: t.hex().notNull()
909
+ }),
910
+ resolverEventIndex
911
+ );
912
+ var subgraph_multicoinAddrChanged = onchainTable3(
913
+ "subgraph_multicoin_addr_changed",
914
+ (t) => ({
915
+ ...resolverEvent(t),
916
+ coinType: t.bigint().notNull(),
917
+ addr: t.hex().notNull()
918
+ }),
919
+ resolverEventIndex
920
+ );
921
+ var subgraph_nameChanged = onchainTable3(
922
+ "subgraph_name_changed",
923
+ (t) => ({
924
+ ...resolverEvent(t),
925
+ name: t.text().notNull()
926
+ }),
927
+ resolverEventIndex
928
+ );
929
+ var subgraph_abiChanged = onchainTable3(
930
+ "subgraph_abi_changed",
931
+ (t) => ({
932
+ ...resolverEvent(t),
933
+ contentType: t.bigint().notNull()
934
+ }),
935
+ resolverEventIndex
936
+ );
937
+ var subgraph_pubkeyChanged = onchainTable3(
938
+ "subgraph_pubkey_changed",
939
+ (t) => ({
940
+ ...resolverEvent(t),
941
+ x: t.hex().notNull(),
942
+ y: t.hex().notNull()
943
+ }),
944
+ resolverEventIndex
945
+ );
946
+ var subgraph_textChanged = onchainTable3(
947
+ "subgraph_text_changed",
948
+ (t) => ({
949
+ ...resolverEvent(t),
950
+ key: t.text().notNull(),
951
+ value: t.text()
952
+ }),
953
+ resolverEventIndex
954
+ );
955
+ var subgraph_contenthashChanged = onchainTable3(
956
+ "subgraph_contenthash_changed",
957
+ (t) => ({
958
+ ...resolverEvent(t),
959
+ hash: t.hex().notNull()
960
+ }),
961
+ resolverEventIndex
962
+ );
963
+ var subgraph_interfaceChanged = onchainTable3(
964
+ "subgraph_interface_changed",
965
+ (t) => ({
966
+ ...resolverEvent(t),
967
+ interfaceID: t.hex().notNull(),
968
+ implementer: t.hex().notNull()
969
+ }),
970
+ resolverEventIndex
971
+ );
972
+ var subgraph_authorisationChanged = onchainTable3(
973
+ "subgraph_authorisation_changed",
974
+ (t) => ({
975
+ ...resolverEvent(t),
976
+ owner: t.hex().notNull(),
977
+ target: t.hex().notNull(),
978
+ isAuthorized: t.boolean().notNull()
979
+ }),
980
+ resolverEventIndex
981
+ );
982
+ var subgraph_versionChanged = onchainTable3(
983
+ "subgraph_version_changed",
984
+ (t) => ({
985
+ ...resolverEvent(t),
986
+ version: t.bigint().notNull()
987
+ }),
988
+ resolverEventIndex
989
+ );
990
+ var subgraph_transferRelations = relations3(subgraph_transfer, ({ one }) => ({
991
+ domain: one(subgraph_domain, {
992
+ fields: [subgraph_transfer.domainId],
993
+ references: [subgraph_domain.id]
994
+ }),
995
+ owner: one(subgraph_account, {
996
+ fields: [subgraph_transfer.ownerId],
997
+ references: [subgraph_account.id]
998
+ })
999
+ }));
1000
+ var subgraph_newOwnerRelations = relations3(subgraph_newOwner, ({ one }) => ({
1001
+ domain: one(subgraph_domain, {
1002
+ fields: [subgraph_newOwner.domainId],
1003
+ references: [subgraph_domain.id]
1004
+ }),
1005
+ owner: one(subgraph_account, {
1006
+ fields: [subgraph_newOwner.ownerId],
1007
+ references: [subgraph_account.id]
1008
+ }),
1009
+ parentDomain: one(subgraph_domain, {
1010
+ fields: [subgraph_newOwner.parentDomainId],
1011
+ references: [subgraph_domain.id]
1012
+ })
1013
+ }));
1014
+ var subgraph_newResolverRelations = relations3(subgraph_newResolver, ({ one }) => ({
1015
+ domain: one(subgraph_domain, {
1016
+ fields: [subgraph_newResolver.domainId],
1017
+ references: [subgraph_domain.id]
1018
+ }),
1019
+ resolver: one(subgraph_resolver, {
1020
+ fields: [subgraph_newResolver.resolverId],
1021
+ references: [subgraph_resolver.id]
1022
+ })
1023
+ }));
1024
+ var subgraph_newTTLRelations = relations3(subgraph_newTTL, ({ one }) => ({
1025
+ domain: one(subgraph_domain, {
1026
+ fields: [subgraph_newTTL.domainId],
1027
+ references: [subgraph_domain.id]
1028
+ })
1029
+ }));
1030
+ var subgraph_wrappedTransferRelations = relations3(subgraph_wrappedTransfer, ({ one }) => ({
1031
+ domain: one(subgraph_domain, {
1032
+ fields: [subgraph_wrappedTransfer.domainId],
1033
+ references: [subgraph_domain.id]
1034
+ }),
1035
+ owner: one(subgraph_account, {
1036
+ fields: [subgraph_wrappedTransfer.ownerId],
1037
+ references: [subgraph_account.id]
1038
+ })
1039
+ }));
1040
+ var subgraph_nameWrappedRelations = relations3(subgraph_nameWrapped, ({ one }) => ({
1041
+ domain: one(subgraph_domain, {
1042
+ fields: [subgraph_nameWrapped.domainId],
1043
+ references: [subgraph_domain.id]
1044
+ }),
1045
+ owner: one(subgraph_account, {
1046
+ fields: [subgraph_nameWrapped.ownerId],
1047
+ references: [subgraph_account.id]
1048
+ })
1049
+ }));
1050
+ var subgraph_nameUnwrappedRelations = relations3(subgraph_nameUnwrapped, ({ one }) => ({
1051
+ domain: one(subgraph_domain, {
1052
+ fields: [subgraph_nameUnwrapped.domainId],
1053
+ references: [subgraph_domain.id]
1054
+ }),
1055
+ owner: one(subgraph_account, {
1056
+ fields: [subgraph_nameUnwrapped.ownerId],
1057
+ references: [subgraph_account.id]
1058
+ })
1059
+ }));
1060
+ var subgraph_fusesSetRelations = relations3(subgraph_fusesSet, ({ one }) => ({
1061
+ domain: one(subgraph_domain, {
1062
+ fields: [subgraph_fusesSet.domainId],
1063
+ references: [subgraph_domain.id]
1064
+ })
1065
+ }));
1066
+ var subgraph_expiryExtendedRelations = relations3(subgraph_expiryExtended, ({ one }) => ({
1067
+ domain: one(subgraph_domain, {
1068
+ fields: [subgraph_expiryExtended.domainId],
1069
+ references: [subgraph_domain.id]
1070
+ })
1071
+ }));
1072
+ var subgraph_nameRegisteredRelations = relations3(subgraph_nameRegistered, ({ one }) => ({
1073
+ registration: one(subgraph_registration, {
1074
+ fields: [subgraph_nameRegistered.registrationId],
1075
+ references: [subgraph_registration.id]
1076
+ }),
1077
+ registrant: one(subgraph_account, {
1078
+ fields: [subgraph_nameRegistered.registrantId],
1079
+ references: [subgraph_account.id]
1080
+ })
1081
+ }));
1082
+ var subgraph_nameRenewedRelations = relations3(subgraph_nameRenewed, ({ one }) => ({
1083
+ registration: one(subgraph_registration, {
1084
+ fields: [subgraph_nameRenewed.registrationId],
1085
+ references: [subgraph_registration.id]
1086
+ })
1087
+ }));
1088
+ var subgraph_nameTransferredRelations = relations3(subgraph_nameTransferred, ({ one }) => ({
1089
+ registration: one(subgraph_registration, {
1090
+ fields: [subgraph_nameTransferred.registrationId],
1091
+ references: [subgraph_registration.id]
1092
+ }),
1093
+ newOwner: one(subgraph_account, {
1094
+ fields: [subgraph_nameTransferred.newOwnerId],
1095
+ references: [subgraph_account.id]
1096
+ })
1097
+ }));
1098
+ var subgraph_addrChangedRelations = relations3(subgraph_addrChanged, ({ one }) => ({
1099
+ resolver: one(subgraph_resolver, {
1100
+ fields: [subgraph_addrChanged.resolverId],
1101
+ references: [subgraph_resolver.id]
1102
+ }),
1103
+ addr: one(subgraph_account, {
1104
+ fields: [subgraph_addrChanged.addrId],
1105
+ references: [subgraph_account.id]
1106
+ })
1107
+ }));
1108
+ var subgraph_multicoinAddrChangedRelations = relations3(
1109
+ subgraph_multicoinAddrChanged,
1110
+ ({ one }) => ({
1111
+ resolver: one(subgraph_resolver, {
1112
+ fields: [subgraph_multicoinAddrChanged.resolverId],
1113
+ references: [subgraph_resolver.id]
1114
+ })
1115
+ })
1116
+ );
1117
+ var subgraph_nameChangedRelations = relations3(subgraph_nameChanged, ({ one }) => ({
1118
+ resolver: one(subgraph_resolver, {
1119
+ fields: [subgraph_nameChanged.resolverId],
1120
+ references: [subgraph_resolver.id]
1121
+ })
1122
+ }));
1123
+ var subgraph_abiChangedRelations = relations3(subgraph_abiChanged, ({ one }) => ({
1124
+ resolver: one(subgraph_resolver, {
1125
+ fields: [subgraph_abiChanged.resolverId],
1126
+ references: [subgraph_resolver.id]
1127
+ })
1128
+ }));
1129
+ var subgraph_pubkeyChangedRelations = relations3(subgraph_pubkeyChanged, ({ one }) => ({
1130
+ resolver: one(subgraph_resolver, {
1131
+ fields: [subgraph_pubkeyChanged.resolverId],
1132
+ references: [subgraph_resolver.id]
1133
+ })
1134
+ }));
1135
+ var subgraph_textChangedRelations = relations3(subgraph_textChanged, ({ one }) => ({
1136
+ resolver: one(subgraph_resolver, {
1137
+ fields: [subgraph_textChanged.resolverId],
1138
+ references: [subgraph_resolver.id]
1139
+ })
1140
+ }));
1141
+ var subgraph_contenthashChangedRelations = relations3(
1142
+ subgraph_contenthashChanged,
1143
+ ({ one }) => ({
1144
+ resolver: one(subgraph_resolver, {
1145
+ fields: [subgraph_contenthashChanged.resolverId],
1146
+ references: [subgraph_resolver.id]
1147
+ })
1148
+ })
1149
+ );
1150
+ var subgraph_interfaceChangedRelations = relations3(
1151
+ subgraph_interfaceChanged,
1152
+ ({ one }) => ({
1153
+ resolver: one(subgraph_resolver, {
1154
+ fields: [subgraph_interfaceChanged.resolverId],
1155
+ references: [subgraph_resolver.id]
1156
+ })
1157
+ })
1158
+ );
1159
+ var subgraph_authorisationChangedRelations = relations3(
1160
+ subgraph_authorisationChanged,
1161
+ ({ one }) => ({
1162
+ resolver: one(subgraph_resolver, {
1163
+ fields: [subgraph_authorisationChanged.resolverId],
1164
+ references: [subgraph_resolver.id]
1165
+ })
1166
+ })
1167
+ );
1168
+ var subgraph_versionChangedRelations = relations3(subgraph_versionChanged, ({ one }) => ({
1169
+ resolver: one(subgraph_resolver, {
1170
+ fields: [subgraph_versionChanged.resolverId],
1171
+ references: [subgraph_resolver.id]
1172
+ })
1173
+ }));
1174
+
1175
+ // src/schemas/tokenscope.schema.ts
1176
+ import { index as index3, onchainTable as onchainTable4 } from "ponder";
1177
+ var nameSales = onchainTable4(
1178
+ "name_sales",
1179
+ (t) => ({
1180
+ /**
1181
+ * Unique and deterministic identifier of the onchain event associated with the sale.
1182
+ *
1183
+ * Composite key format: "{chainId}-{blockNumber}-{logIndex}" (e.g., "1-1234567-5")
1184
+ */
1185
+ id: t.text().primaryKey(),
1186
+ /**
1187
+ * The chain where the sale occurred.
1188
+ */
1189
+ chainId: t.integer().notNull(),
1190
+ /**
1191
+ * The block number on chainId where the sale occurred.
1192
+ */
1193
+ blockNumber: t.bigint().notNull(),
1194
+ /**
1195
+ * The log index position of the sale event within blockNumber.
1196
+ */
1197
+ logIndex: t.integer().notNull(),
1198
+ /**
1199
+ * The EVM transaction hash on chainId associated with the sale.
1200
+ */
1201
+ transactionHash: t.hex().notNull(),
1202
+ /**
1203
+ * The Seaport order hash.
1204
+ */
1205
+ orderHash: t.hex().notNull(),
1206
+ /**
1207
+ * The address of the contract on chainId that manages tokenId.
1208
+ */
1209
+ contractAddress: t.hex().notNull(),
1210
+ /**
1211
+ * The tokenId managed by contractAddress that was sold.
1212
+ *
1213
+ * In a general context (outside of TokenScope) ERC1155 NFTs may have
1214
+ * multiple copies, however TokenScope guarantees that all indexed NFTs
1215
+ * never have an amount / balance > 1.
1216
+ */
1217
+ tokenId: t.bigint().notNull(),
1218
+ /**
1219
+ * The CAIP-19 Asset Namespace of the token that was sold. Either `erc721` or `erc1155`.
1220
+ *
1221
+ * @see https://chainagnostic.org/CAIPs/caip-19
1222
+ */
1223
+ assetNamespace: t.text().notNull(),
1224
+ /**
1225
+ * The CAIP-19 Asset ID of token that was sold. This is a globally unique reference to the
1226
+ * specific asset in question.
1227
+ *
1228
+ * @see https://chainagnostic.org/CAIPs/caip-19
1229
+ */
1230
+ assetId: t.text().notNull(),
1231
+ /**
1232
+ * The namehash (Node) of the ENS domain that was sold.
1233
+ */
1234
+ domainId: t.hex().notNull(),
1235
+ /**
1236
+ * The account that bought the token controlling ownership of domainId from
1237
+ * the seller for the amount of currency associated with the sale.
1238
+ */
1239
+ buyer: t.hex().notNull(),
1240
+ /**
1241
+ * The account that sold the token controlling ownership of domainId to
1242
+ * buyer for the amount of currency associated with the sale.
1243
+ */
1244
+ seller: t.hex().notNull(),
1245
+ /**
1246
+ * Currency of the payment (ETH, USDC or DAI) from buyer to seller in exchange for tokenId.
1247
+ */
1248
+ currency: t.text().notNull(),
1249
+ /**
1250
+ * The amount of currency paid from buyer to seller in exchange for tokenId.
1251
+ *
1252
+ * Denominated in the smallest unit of currency.
1253
+ *
1254
+ * Amount interpretation depends on currency:
1255
+ * - ETH/WETH: Amount in wei (1 ETH = 10^18 wei)
1256
+ * - USDC: Amount in micro-units (1 USDC = 10^6 units)
1257
+ * - DAI: Amount in wei-equivalent (1 DAI = 10^18 units)
1258
+ */
1259
+ amount: t.bigint().notNull(),
1260
+ /**
1261
+ * Unix timestamp of the block timestamp when the sale occurred.
1262
+ */
1263
+ timestamp: t.bigint().notNull()
1264
+ }),
1265
+ (t) => ({
1266
+ idx_domainId: index3().on(t.domainId),
1267
+ idx_assetId: index3().on(t.assetId),
1268
+ idx_buyer: index3().on(t.buyer),
1269
+ idx_seller: index3().on(t.seller),
1270
+ idx_timestamp: index3().on(t.timestamp)
1271
+ })
1272
+ );
1273
+ var nameTokens = onchainTable4(
1274
+ "name_tokens",
1275
+ (t) => ({
1276
+ /**
1277
+ * The CAIP-19 Asset ID of the token.
1278
+ *
1279
+ * This is a globally unique reference to the token.
1280
+ *
1281
+ * @see https://chainagnostic.org/CAIPs/caip-19
1282
+ */
1283
+ id: t.text().primaryKey(),
1284
+ /**
1285
+ * The namehash (Node) of the ENS name associated with the token.
1286
+ *
1287
+ * Note: An ENS name may have more than one distinct token across time. It is
1288
+ * also possible for multiple distinct tokens for an ENS name to have
1289
+ * a mintStatus of `minted` at the same time. For example:
1290
+ * - When a direct subname of .eth is wrapped by the NameWrapper. This state
1291
+ * has one minted token for the name managed by the BaseRegistrar (this
1292
+ * token will be owned by the NameWrapper) and another minted token for
1293
+ * the name managed by the NameWrapper (owned by the effective owner of
1294
+ * the name).
1295
+ * - When a direct subname of .eth is wrapped by the NameWrapper and then
1296
+ * unwrapped. This state has one minted token (managed by the BaseRegistrar)
1297
+ * and another burned token (managed by the NameWrapper).
1298
+ */
1299
+ domainId: t.hex().notNull(),
1300
+ /**
1301
+ * The chain that manages the token.
1302
+ */
1303
+ chainId: t.integer().notNull(),
1304
+ /**
1305
+ * The address of the contract on chainId that manages the token.
1306
+ */
1307
+ contractAddress: t.hex().notNull(),
1308
+ /**
1309
+ * The tokenId of the token managed by contractAddress.
1310
+ *
1311
+ * In a general context (outside of TokenScope) ERC1155 NFTs may have
1312
+ * multiple copies, however TokenScope guarantees that all indexed NFTs
1313
+ * never have an amount / balance > 1.
1314
+ */
1315
+ tokenId: t.bigint().notNull(),
1316
+ /**
1317
+ * The CAIP-19 Asset Namespace of the token. Either `erc721` or `erc1155`.
1318
+ *
1319
+ * @see https://chainagnostic.org/CAIPs/caip-19
1320
+ */
1321
+ assetNamespace: t.text().notNull(),
1322
+ /**
1323
+ * The account that owns the token.
1324
+ *
1325
+ * Value is zeroAddress if and only if mintStatus is `burned`.
1326
+ *
1327
+ * Note: The owner of the token for a given domainId may differ from the
1328
+ * owner of the associated node in the registry. For example:
1329
+ * - Consider the case where address X owns the ENS name `foo.eth` in
1330
+ * both the BaseRegistrar and the Registry. If X sends a request directly
1331
+ * to the Registry to transfer ownership to Y, ownership of `foo.eth` will
1332
+ * be transferred to Y in the Registry but not in the BaseRegistrar.
1333
+ * - ... for the case above, the BaseRegistrar implements a `reclaim`
1334
+ * allowing the owner of the name in the BaseRegistrar to reclaim ownership
1335
+ * of the name in the Registry.
1336
+ *
1337
+ * Note: When a name is wrapped by the NameWrapper, the owner of the token
1338
+ * in the BaseRegistrar is the NameWrapper, while a new token for the name is
1339
+ * minted by the NameWrapper and owned by the effective owner of the name.
1340
+ */
1341
+ owner: t.hex().notNull(),
1342
+ /**
1343
+ * The mint status of the token. Either `minted` or `burned`.
1344
+ *
1345
+ * After we index a NFT we never delete it from our index. Instead, when an
1346
+ * indexed NFT is burned onchain we retain its record and update its mint
1347
+ * status as `burned`. If a NFT is minted again after it is burned its mint
1348
+ * status is updated to `minted`.
1349
+ */
1350
+ mintStatus: t.text().notNull()
1351
+ }),
1352
+ (t) => ({
1353
+ idx_domainId: index3().on(t.domainId),
1354
+ idx_owner: index3().on(t.owner)
1355
+ })
1356
+ );
1357
+ export {
1358
+ internal_registrarActionMetadata,
1359
+ migratedNode,
1360
+ nameSales,
1361
+ nameTokens,
1362
+ nodeResolverRelation,
1363
+ registrarActionRelations,
1364
+ registrarActionType,
1365
+ registrarActions,
1366
+ registrationLifecycleRelations,
1367
+ registrationLifecycles,
1368
+ resolverAddressRecord,
1369
+ resolverAddressRecordRelations,
1370
+ resolverRecords,
1371
+ resolverRecords_relations,
1372
+ resolverTextRecord,
1373
+ resolverTextRecordRelations,
1374
+ reverseNameRecord,
1375
+ subgraph_abiChanged,
1376
+ subgraph_abiChangedRelations,
1377
+ subgraph_account,
1378
+ subgraph_accountRelations,
1379
+ subgraph_addrChanged,
1380
+ subgraph_addrChangedRelations,
1381
+ subgraph_authorisationChanged,
1382
+ subgraph_authorisationChangedRelations,
1383
+ subgraph_contenthashChanged,
1384
+ subgraph_contenthashChangedRelations,
1385
+ subgraph_domain,
1386
+ subgraph_domainRelations,
1387
+ subgraph_expiryExtended,
1388
+ subgraph_expiryExtendedRelations,
1389
+ subgraph_fusesSet,
1390
+ subgraph_fusesSetRelations,
1391
+ subgraph_interfaceChanged,
1392
+ subgraph_interfaceChangedRelations,
1393
+ subgraph_multicoinAddrChanged,
1394
+ subgraph_multicoinAddrChangedRelations,
1395
+ subgraph_nameChanged,
1396
+ subgraph_nameChangedRelations,
1397
+ subgraph_nameRegistered,
1398
+ subgraph_nameRegisteredRelations,
1399
+ subgraph_nameRenewed,
1400
+ subgraph_nameRenewedRelations,
1401
+ subgraph_nameTransferred,
1402
+ subgraph_nameTransferredRelations,
1403
+ subgraph_nameUnwrapped,
1404
+ subgraph_nameUnwrappedRelations,
1405
+ subgraph_nameWrapped,
1406
+ subgraph_nameWrappedRelations,
1407
+ subgraph_newOwner,
1408
+ subgraph_newOwnerRelations,
1409
+ subgraph_newResolver,
1410
+ subgraph_newResolverRelations,
1411
+ subgraph_newTTL,
1412
+ subgraph_newTTLRelations,
1413
+ subgraph_pubkeyChanged,
1414
+ subgraph_pubkeyChangedRelations,
1415
+ subgraph_registration,
1416
+ subgraph_registrationRelations,
1417
+ subgraph_resolver,
1418
+ subgraph_resolverRelations,
1419
+ subgraph_textChanged,
1420
+ subgraph_textChangedRelations,
1421
+ subgraph_transfer,
1422
+ subgraph_transferRelations,
1423
+ subgraph_versionChanged,
1424
+ subgraph_versionChangedRelations,
1425
+ subgraph_wrappedDomain,
1426
+ subgraph_wrappedDomainRelations,
1427
+ subgraph_wrappedTransfer,
1428
+ subgraph_wrappedTransferRelations,
1429
+ subregistries,
1430
+ subregistryRelations
1431
+ };
1432
+ //# sourceMappingURL=ponder.schema.js.map