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