-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathsubgraph.schema.ts
More file actions
812 lines (721 loc) · 23.6 KB
/
subgraph.schema.ts
File metadata and controls
812 lines (721 loc) · 23.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
import { index, onchainTable, relations } from "ponder";
import type { Address } from "viem";
import { monkeypatchCollate } from "../lib/collate";
/**
* This file specifies an Legacy-ENS-Subgraph-Compatible Ponder Schema.
*
* When the subgraph_prefix is stripped and the resulting schema is paired with @ensnode/ponder-subgraph,
* the resulting GraphQL API is fully compatible with the legacy ENS Subgraph.
*/
/**
* Domain
*/
export const subgraph_domain = onchainTable(
"subgraph_domains",
(t) => ({
// The namehash of the name
id: t.hex().primaryKey(),
/**
* The ENS Name that this Domain represents.
*
* If {@link ENSIndexerConfig#isSubgraphCompatible}, this value is guaranteed to be either:
* a) null (in the case of the root node), or
* b) a Subgraph Interpreted Name.
*
* @see https://ensnode.io/docs/reference/terminology#subgraph-indexability--labelname-interpretation
*
* Otherwise, this value is guaranteed to be an Interpreted Name, which is either:
* a) a normalized Name, or
* b) a Name entirely consisting of Interpreted Labels.
*
* Note that the type of the column will remain string | null, for legacy subgraph compatibility,
* but in practice will never be null. The Root node's name will be '' (empty string).
*
* @see https://ensnode.io/docs/reference/terminology#interpreted-name
*/
name: t.text(),
/**
* The Label associated with the Domain.
*
* If {@link ENSIndexerConfig#isSubgraphCompatible}, this value is guaranteed to be either:
* a) null, in the case of the root Node or a name whose childmost label is subgraph-unindexable, or
* b) a subgraph-indexable Subgraph Interpreted Label (i.e. a Literal Label of undefined normalization).
*
* @see https://ensnode.io/docs/reference/terminology#subgraph-indexability--labelname-interpretation
*
* Otherwise, this value is guaranteed to be an Interpreted Label which is either:
* a) null, exclusively in the case of the root Node,
* b) a normalized Label, or
* c) an Encoded LabelHash, which encodes either
* i. in the case of an Unknown Label, the LabelHash emitted onchain, or
* ii. in the case of an Unnormalized Label, the LabelHash of the Literal Label value found onchain.
*
* @see https://ensnode.io/docs/reference/terminology#interpreted-label
*/
labelName: t.text(),
// keccak256(labelName)
labelhash: t.hex(),
// The namehash (id) of the parent name
parentId: t.hex(),
// The number of subdomains
subdomainCount: t.integer().notNull().default(0),
// Address logged from current resolver, if any
resolvedAddressId: t.hex(),
// The resolver that controls the domain's settings
resolverId: t.text(),
// The time-to-live (TTL) value of the domain's records
ttl: t.bigint(),
// Indicates whether the domain has been migrated to a new registrar
isMigrated: t.boolean().notNull().default(false),
// The time when the domain was created
createdAt: t.bigint().notNull(),
// The account that owns the domain
ownerId: t.hex().notNull(),
// The account that owns the ERC721 NFT for the domain
registrantId: t.hex(),
// The account that owns the wrapped domain
wrappedOwnerId: t.hex(),
// The expiry date for the domain, from either the registration, or the wrapped domain if PCC is burned
expiryDate: t.bigint(),
}),
(t) => ({
byName: index().on(t.name),
byLabelhash: index().on(t.labelhash),
byParentId: index().on(t.parentId),
byOwnerId: index().on(t.ownerId),
byRegistrantId: index().on(t.registrantId),
byWrappedOwnerId: index().on(t.wrappedOwnerId),
}),
);
// monkeypatch drizzle's column (necessary to match graph-node default collation "C")
// https://github.com/drizzle-team/drizzle-orm/issues/638
monkeypatchCollate(subgraph_domain.name, '"C"');
monkeypatchCollate(subgraph_domain.labelName, '"C"');
export const subgraph_domainRelations = relations(subgraph_domain, ({ one, many }) => ({
resolvedAddress: one(subgraph_account, {
fields: [subgraph_domain.resolvedAddressId],
references: [subgraph_account.id],
}),
owner: one(subgraph_account, {
fields: [subgraph_domain.ownerId],
references: [subgraph_account.id],
}),
parent: one(subgraph_domain, {
fields: [subgraph_domain.parentId],
references: [subgraph_domain.id],
}),
resolver: one(subgraph_resolver, {
fields: [subgraph_domain.resolverId],
references: [subgraph_resolver.id],
}),
subdomains: many(subgraph_domain, { relationName: "parent" }),
registrant: one(subgraph_account, {
fields: [subgraph_domain.registrantId],
references: [subgraph_account.id],
}),
wrappedOwner: one(subgraph_account, {
fields: [subgraph_domain.wrappedOwnerId],
references: [subgraph_account.id],
}),
wrappedDomain: one(subgraph_wrappedDomain, {
fields: [subgraph_domain.id],
references: [subgraph_wrappedDomain.domainId],
}),
registration: one(subgraph_registration, {
fields: [subgraph_domain.id],
references: [subgraph_registration.domainId],
}),
// event relations
transfers: many(subgraph_transfer),
newOwners: many(subgraph_newOwner),
newResolvers: many(subgraph_newResolver),
newTTLs: many(subgraph_newTTL),
wrappedTransfers: many(subgraph_wrappedTransfer),
nameWrappeds: many(subgraph_nameWrapped),
nameUnwrappeds: many(subgraph_nameUnwrapped),
fusesSets: many(subgraph_fusesSet),
expiryExtendeds: many(subgraph_expiryExtended),
}));
/**
* Account
*/
export const subgraph_account = onchainTable("subgraph_accounts", (t) => ({
id: t.hex().primaryKey(),
}));
export const subgraph_accountRelations = relations(subgraph_account, ({ many }) => ({
domains: many(subgraph_domain),
wrappedDomains: many(subgraph_wrappedDomain),
registrations: many(subgraph_registration),
}));
/**
* Resolver
*/
export const subgraph_resolver = onchainTable(
"subgraph_resolvers",
(t) => ({
// The unique identifier for this resolver, which is a concatenation of the domain namehash and the resolver address
id: t.text().primaryKey(),
// The domain that this resolver is associated with
domainId: t.hex().notNull(),
// The address of the resolver contract
address: t.hex().notNull().$type<Address>(),
// The current value of the 'addr' record for this resolver, as determined by the associated events
addrId: t.hex(),
// The content hash for this resolver, in binary format
contentHash: t.text(),
// The set of observed text record keys for this resolver
// NOTE: we avoid .notNull.default([]) to match subgraph behavior
texts: t.text().array(),
// The set of observed SLIP-44 coin types for this resolver
// NOTE: we avoid .notNull.default([]) to match subgraph behavior
coinTypes: t.bigint().array(),
}),
(t) => ({
byDomainId: index().on(t.domainId),
}),
);
export const subgraph_resolverRelations = relations(subgraph_resolver, ({ one, many }) => ({
addr: one(subgraph_account, {
fields: [subgraph_resolver.addrId],
references: [subgraph_account.id],
}),
domain: one(subgraph_domain, {
fields: [subgraph_resolver.domainId],
references: [subgraph_domain.id],
}),
// event relations
addrChangeds: many(subgraph_addrChanged),
multicoinAddrChangeds: many(subgraph_multicoinAddrChanged),
nameChangeds: many(subgraph_nameChanged),
abiChangeds: many(subgraph_abiChanged),
pubkeyChangeds: many(subgraph_pubkeyChanged),
textChangeds: many(subgraph_textChanged),
contenthashChangeds: many(subgraph_contenthashChanged),
interfaceChangeds: many(subgraph_interfaceChanged),
authorisationChangeds: many(subgraph_authorisationChanged),
versionChangeds: many(subgraph_versionChanged),
}));
/**
* Registration
*/
export const subgraph_registration = onchainTable(
"subgraph_registrations",
(t) => ({
// The unique identifier of the registration
id: t.hex().primaryKey(),
// The domain name associated with the registration
domainId: t.hex().notNull(),
// The registration date of the domain
registrationDate: t.bigint().notNull(),
// The expiry date of the domain
expiryDate: t.bigint().notNull(),
// The cost associated with the domain registration
cost: t.bigint(),
// The account that registered the domain
registrantId: t.hex().notNull(),
/**
* The Label associated with the domain registration.
*
* If {@link ENSIndexerConfig#isSubgraphCompatible}, this value is guaranteed to be either:
* a) null, in the case of the root Node or a Domain whose label is subgraph-unindexable, or
* b) a subgraph-indexable Subgraph Interpreted Label (i.e. a Literal Label of undefined normalization).
*
* @see https://ensnode.io/docs/reference/terminology#subgraph-indexability--labelname-interpretation
*
* Otherwise, this value is guaranteed to be an Interpreted Label which is either:
* a) a normalized Label, or
* b) in the case of an Unnormalized Label, an Encoded LabelHash of the Literal Label value found onchain.
*
* Note that the type of the column will remain string | null, for legacy subgraph compatibility.
* In practice however, because there is no Registration entity for the root Node (the only Node
* with a null labelName) this field will never be null.
*
* @see https://ensnode.io/docs/reference/terminology#interpreted-label
*/
labelName: t.text(),
}),
(t) => ({
byDomainId: index().on(t.domainId),
byRegistrationDate: index().on(t.registrationDate),
}),
);
export const subgraph_registrationRelations = relations(subgraph_registration, ({ one, many }) => ({
domain: one(subgraph_domain, {
fields: [subgraph_registration.domainId],
references: [subgraph_domain.id],
}),
registrant: one(subgraph_account, {
fields: [subgraph_registration.registrantId],
references: [subgraph_account.id],
}),
// event relations
nameRegistereds: many(subgraph_nameRegistered),
nameReneweds: many(subgraph_nameRenewed),
nameTransferreds: many(subgraph_nameTransferred),
}));
/**
* Wrapped Domain
*/
export const subgraph_wrappedDomain = onchainTable(
"subgraph_wrapped_domains",
(t) => ({
// The unique identifier for each instance of the WrappedDomain entity
id: t.hex().primaryKey(),
// The domain that is wrapped by this WrappedDomain
domainId: t.hex().notNull(),
// The expiry date of the wrapped domain
expiryDate: t.bigint().notNull(),
// The number of fuses remaining on the wrapped domain
fuses: t.integer().notNull(),
// The account that owns this WrappedDomain
ownerId: t.hex().notNull(),
/**
* The Name that this WrappedDomain represents. Names are emitted by the NameWrapper contract as
* DNS-Encoded Names which may be malformed, which will result in this field being `null`.
*
* If {@link ENSIndexerConfig#isSubgraphCompatible}, this value is guaranteed to be either:
* a) null (in the case of a DNS-Encoded Name that is malformed or contains subgraph-unindexable labels), or
* b) a subgraph-indexable Subgraph Interpreted Label (i.e. a Literal Label of undefined normalization).
*
* @see https://ensnode.io/docs/reference/terminology#subgraph-indexability--labelname-interpretation
*
* Otherwise, this value is guaranteed to be either:
* a) null (in the case of a malformed DNS-Encoded Name),
* b) an Interpreted Name.
*
* @see https://ensnode.io/docs/reference/terminology#interpreted-name
*/
name: t.text(),
}),
(t) => ({
byDomainId: index().on(t.domainId),
}),
);
export const subgraph_wrappedDomainRelations = relations(subgraph_wrappedDomain, ({ one }) => ({
domain: one(subgraph_domain, {
fields: [subgraph_wrappedDomain.domainId],
references: [subgraph_domain.id],
}),
owner: one(subgraph_account, {
fields: [subgraph_wrappedDomain.ownerId],
references: [subgraph_account.id],
}),
}));
/**
* Events
*/
const sharedEventColumns = (t: any) => ({
id: t.text().primaryKey(),
blockNumber: t.integer().notNull(),
transactionID: t.hex().notNull(),
});
const domainEvent = (t: any) => ({
...sharedEventColumns(t),
domainId: t.hex().notNull(),
});
const domainEventIndex = (t: any) => ({
// primary reverse lookup
idx: index().on(t.domainId),
// sorting index
idx_compound: index().on(t.domainId, t.id),
});
// Domain Event Entities
export const subgraph_transfer = onchainTable(
"subgraph_transfers",
(t) => ({
...domainEvent(t),
ownerId: t.hex().notNull(),
}),
domainEventIndex,
);
export const subgraph_newOwner = onchainTable(
"subgraph_new_owners",
(t) => ({
...domainEvent(t),
ownerId: t.hex().notNull(),
parentDomainId: t.hex().notNull(),
}),
domainEventIndex,
);
export const subgraph_newResolver = onchainTable(
"subgraph_new_resolvers",
(t) => ({
...domainEvent(t),
resolverId: t.text().notNull(),
}),
domainEventIndex,
);
export const subgraph_newTTL = onchainTable(
"subgraph_new_ttls",
(t) => ({
...domainEvent(t),
ttl: t.bigint().notNull(),
}),
domainEventIndex,
);
export const subgraph_wrappedTransfer = onchainTable(
"subgraph_wrapped_transfers",
(t) => ({
...domainEvent(t),
ownerId: t.hex().notNull(),
}),
domainEventIndex,
);
export const subgraph_nameWrapped = onchainTable(
"subgraph_name_wrapped",
(t) => ({
...domainEvent(t),
name: t.text(),
fuses: t.integer().notNull(),
ownerId: t.hex().notNull(),
expiryDate: t.bigint().notNull(),
}),
domainEventIndex,
);
export const subgraph_nameUnwrapped = onchainTable(
"subgraph_name_unwrapped",
(t) => ({
...domainEvent(t),
ownerId: t.hex().notNull(),
}),
domainEventIndex,
);
export const subgraph_fusesSet = onchainTable(
"subgraph_fuses_set",
(t) => ({
...domainEvent(t),
fuses: t.integer().notNull(),
}),
domainEventIndex,
);
export const subgraph_expiryExtended = onchainTable(
"subgraph_expiry_extended",
(t) => ({
...domainEvent(t),
expiryDate: t.bigint().notNull(),
}),
domainEventIndex,
);
// Registration Event Entities
const registrationEvent = (t: any) => ({
...sharedEventColumns(t),
registrationId: t.hex().notNull(),
});
const registrationEventIndex = (t: any) => ({
// primary reverse lookup
idx: index().on(t.registrationId),
// sorting index
idx_compound: index().on(t.registrationId, t.id),
});
export const subgraph_nameRegistered = onchainTable(
"subgraph_name_registered",
(t) => ({
...registrationEvent(t),
registrantId: t.hex().notNull(),
expiryDate: t.bigint().notNull(),
}),
registrationEventIndex,
);
export const subgraph_nameRenewed = onchainTable(
"subgraph_name_renewed",
(t) => ({
...registrationEvent(t),
expiryDate: t.bigint().notNull(),
}),
registrationEventIndex,
);
export const subgraph_nameTransferred = onchainTable(
"subgraph_name_transferred",
(t) => ({
...registrationEvent(t),
newOwnerId: t.hex().notNull(),
}),
registrationEventIndex,
);
// Resolver Event Entities
const resolverEvent = (t: any) => ({
...sharedEventColumns(t),
resolverId: t.text().notNull(),
});
const resolverEventIndex = (t: any) => ({
// primary reverse lookup
idx: index().on(t.resolverId),
// sorting index
idx_compound: index().on(t.resolverId, t.id),
});
export const subgraph_addrChanged = onchainTable(
"subgraph_addr_changed",
(t) => ({
...resolverEvent(t),
addrId: t.hex().notNull(),
}),
resolverEventIndex,
);
export const subgraph_multicoinAddrChanged = onchainTable(
"subgraph_multicoin_addr_changed",
(t) => ({
...resolverEvent(t),
coinType: t.bigint().notNull(),
addr: t.hex().notNull(),
}),
resolverEventIndex,
);
export const subgraph_nameChanged = onchainTable(
"subgraph_name_changed",
(t) => ({
...resolverEvent(t),
name: t.text().notNull(),
}),
resolverEventIndex,
);
export const subgraph_abiChanged = onchainTable(
"subgraph_abi_changed",
(t) => ({
...resolverEvent(t),
contentType: t.bigint().notNull(),
}),
resolverEventIndex,
);
export const subgraph_pubkeyChanged = onchainTable(
"subgraph_pubkey_changed",
(t) => ({
...resolverEvent(t),
x: t.hex().notNull(),
y: t.hex().notNull(),
}),
resolverEventIndex,
);
export const subgraph_textChanged = onchainTable(
"subgraph_text_changed",
(t) => ({
...resolverEvent(t),
key: t.text().notNull(),
value: t.text(),
}),
resolverEventIndex,
);
export const subgraph_contenthashChanged = onchainTable(
"subgraph_contenthash_changed",
(t) => ({
...resolverEvent(t),
hash: t.hex().notNull(),
}),
resolverEventIndex,
);
export const subgraph_interfaceChanged = onchainTable(
"subgraph_interface_changed",
(t) => ({
...resolverEvent(t),
interfaceID: t.hex().notNull(),
implementer: t.hex().notNull(),
}),
resolverEventIndex,
);
export const subgraph_authorisationChanged = onchainTable(
"subgraph_authorisation_changed",
(t) => ({
...resolverEvent(t),
owner: t.hex().notNull(),
target: t.hex().notNull(),
isAuthorized: t.boolean().notNull(),
}),
resolverEventIndex,
);
export const subgraph_versionChanged = onchainTable(
"subgraph_version_changed",
(t) => ({
...resolverEvent(t),
version: t.bigint().notNull(),
}),
resolverEventIndex,
);
/**
* Event Relations
*/
// Domain Event Relations
export const subgraph_transferRelations = relations(subgraph_transfer, ({ one }) => ({
domain: one(subgraph_domain, {
fields: [subgraph_transfer.domainId],
references: [subgraph_domain.id],
}),
owner: one(subgraph_account, {
fields: [subgraph_transfer.ownerId],
references: [subgraph_account.id],
}),
}));
export const subgraph_newOwnerRelations = relations(subgraph_newOwner, ({ one }) => ({
domain: one(subgraph_domain, {
fields: [subgraph_newOwner.domainId],
references: [subgraph_domain.id],
}),
owner: one(subgraph_account, {
fields: [subgraph_newOwner.ownerId],
references: [subgraph_account.id],
}),
parentDomain: one(subgraph_domain, {
fields: [subgraph_newOwner.parentDomainId],
references: [subgraph_domain.id],
}),
}));
export const subgraph_newResolverRelations = relations(subgraph_newResolver, ({ one }) => ({
domain: one(subgraph_domain, {
fields: [subgraph_newResolver.domainId],
references: [subgraph_domain.id],
}),
resolver: one(subgraph_resolver, {
fields: [subgraph_newResolver.resolverId],
references: [subgraph_resolver.id],
}),
}));
export const subgraph_newTTLRelations = relations(subgraph_newTTL, ({ one }) => ({
domain: one(subgraph_domain, {
fields: [subgraph_newTTL.domainId],
references: [subgraph_domain.id],
}),
}));
export const subgraph_wrappedTransferRelations = relations(subgraph_wrappedTransfer, ({ one }) => ({
domain: one(subgraph_domain, {
fields: [subgraph_wrappedTransfer.domainId],
references: [subgraph_domain.id],
}),
owner: one(subgraph_account, {
fields: [subgraph_wrappedTransfer.ownerId],
references: [subgraph_account.id],
}),
}));
export const subgraph_nameWrappedRelations = relations(subgraph_nameWrapped, ({ one }) => ({
domain: one(subgraph_domain, {
fields: [subgraph_nameWrapped.domainId],
references: [subgraph_domain.id],
}),
owner: one(subgraph_account, {
fields: [subgraph_nameWrapped.ownerId],
references: [subgraph_account.id],
}),
}));
export const subgraph_nameUnwrappedRelations = relations(subgraph_nameUnwrapped, ({ one }) => ({
domain: one(subgraph_domain, {
fields: [subgraph_nameUnwrapped.domainId],
references: [subgraph_domain.id],
}),
owner: one(subgraph_account, {
fields: [subgraph_nameUnwrapped.ownerId],
references: [subgraph_account.id],
}),
}));
export const subgraph_fusesSetRelations = relations(subgraph_fusesSet, ({ one }) => ({
domain: one(subgraph_domain, {
fields: [subgraph_fusesSet.domainId],
references: [subgraph_domain.id],
}),
}));
export const subgraph_expiryExtendedRelations = relations(subgraph_expiryExtended, ({ one }) => ({
domain: one(subgraph_domain, {
fields: [subgraph_expiryExtended.domainId],
references: [subgraph_domain.id],
}),
}));
// Registration Event Relations
export const subgraph_nameRegisteredRelations = relations(subgraph_nameRegistered, ({ one }) => ({
registration: one(subgraph_registration, {
fields: [subgraph_nameRegistered.registrationId],
references: [subgraph_registration.id],
}),
registrant: one(subgraph_account, {
fields: [subgraph_nameRegistered.registrantId],
references: [subgraph_account.id],
}),
}));
export const subgraph_nameRenewedRelations = relations(subgraph_nameRenewed, ({ one }) => ({
registration: one(subgraph_registration, {
fields: [subgraph_nameRenewed.registrationId],
references: [subgraph_registration.id],
}),
}));
export const subgraph_nameTransferredRelations = relations(subgraph_nameTransferred, ({ one }) => ({
registration: one(subgraph_registration, {
fields: [subgraph_nameTransferred.registrationId],
references: [subgraph_registration.id],
}),
newOwner: one(subgraph_account, {
fields: [subgraph_nameTransferred.newOwnerId],
references: [subgraph_account.id],
}),
}));
// Resolver Event Relations
export const subgraph_addrChangedRelations = relations(subgraph_addrChanged, ({ one }) => ({
resolver: one(subgraph_resolver, {
fields: [subgraph_addrChanged.resolverId],
references: [subgraph_resolver.id],
}),
addr: one(subgraph_account, {
fields: [subgraph_addrChanged.addrId],
references: [subgraph_account.id],
}),
}));
export const subgraph_multicoinAddrChangedRelations = relations(
subgraph_multicoinAddrChanged,
({ one }) => ({
resolver: one(subgraph_resolver, {
fields: [subgraph_multicoinAddrChanged.resolverId],
references: [subgraph_resolver.id],
}),
}),
);
export const subgraph_nameChangedRelations = relations(subgraph_nameChanged, ({ one }) => ({
resolver: one(subgraph_resolver, {
fields: [subgraph_nameChanged.resolverId],
references: [subgraph_resolver.id],
}),
}));
export const subgraph_abiChangedRelations = relations(subgraph_abiChanged, ({ one }) => ({
resolver: one(subgraph_resolver, {
fields: [subgraph_abiChanged.resolverId],
references: [subgraph_resolver.id],
}),
}));
export const subgraph_pubkeyChangedRelations = relations(subgraph_pubkeyChanged, ({ one }) => ({
resolver: one(subgraph_resolver, {
fields: [subgraph_pubkeyChanged.resolverId],
references: [subgraph_resolver.id],
}),
}));
export const subgraph_textChangedRelations = relations(subgraph_textChanged, ({ one }) => ({
resolver: one(subgraph_resolver, {
fields: [subgraph_textChanged.resolverId],
references: [subgraph_resolver.id],
}),
}));
export const subgraph_contenthashChangedRelations = relations(
subgraph_contenthashChanged,
({ one }) => ({
resolver: one(subgraph_resolver, {
fields: [subgraph_contenthashChanged.resolverId],
references: [subgraph_resolver.id],
}),
}),
);
export const subgraph_interfaceChangedRelations = relations(
subgraph_interfaceChanged,
({ one }) => ({
resolver: one(subgraph_resolver, {
fields: [subgraph_interfaceChanged.resolverId],
references: [subgraph_resolver.id],
}),
}),
);
export const subgraph_authorisationChangedRelations = relations(
subgraph_authorisationChanged,
({ one }) => ({
resolver: one(subgraph_resolver, {
fields: [subgraph_authorisationChanged.resolverId],
references: [subgraph_resolver.id],
}),
}),
);
export const subgraph_versionChangedRelations = relations(subgraph_versionChanged, ({ one }) => ({
resolver: one(subgraph_resolver, {
fields: [subgraph_versionChanged.resolverId],
references: [subgraph_resolver.id],
}),
}));