@ensnode/ensdb-sdk 1.15.2 → 1.17.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 +2 -2
- package/dist/ensindexer-abstract/index.js +260 -114
- package/dist/ensindexer-abstract/index.js.map +1 -1
- package/dist/{index-DH9e7wPl.d.ts → index-BLniLyqz.d.ts} +938 -7
- package/dist/index.d.ts +64 -36
- package/dist/index.js +300 -124
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -16,6 +16,11 @@ __export(ensindexer_abstract_exports, {
|
|
|
16
16
|
domainResolverRelation: () => domainResolverRelation,
|
|
17
17
|
domainResolverRelation_relations: () => domainResolverRelation_relations,
|
|
18
18
|
domainType: () => domainType,
|
|
19
|
+
efpAccountMetadata: () => efpAccountMetadata,
|
|
20
|
+
efpListMetadata: () => efpListMetadata,
|
|
21
|
+
efpListRecords: () => efpListRecords,
|
|
22
|
+
efpListStorageLocations: () => efpListStorageLocations,
|
|
23
|
+
efpLists: () => efpLists,
|
|
19
24
|
event: () => event,
|
|
20
25
|
internal_registrarActionMetadata: () => internal_registrarActionMetadata,
|
|
21
26
|
internal_registrarActionMetadataType: () => internal_registrarActionMetadataType,
|
|
@@ -120,9 +125,141 @@ __export(ensindexer_abstract_exports, {
|
|
|
120
125
|
truncateCanonicalNamePrefix: () => truncateCanonicalNamePrefix
|
|
121
126
|
});
|
|
122
127
|
|
|
128
|
+
// src/ensindexer-abstract/efp.schema.ts
|
|
129
|
+
import { index, onchainTable } from "ponder";
|
|
130
|
+
var efpLists = onchainTable(
|
|
131
|
+
"efp_lists",
|
|
132
|
+
(t) => ({
|
|
133
|
+
/** ERC-721 token id of the list NFT (a uint256), the list's primary key. */
|
|
134
|
+
id: t.bigint().primaryKey().$type(),
|
|
135
|
+
/** Current ERC-721 owner of the list NFT. */
|
|
136
|
+
owner: t.hex().notNull().$type(),
|
|
137
|
+
/** Chain id of the `ListRegistry` NFT (Base / 8453 on mainnet; the active namespace's EFP deployment chain otherwise). */
|
|
138
|
+
nftChainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
139
|
+
/** `ListRegistry` contract address on `nftChainId`. */
|
|
140
|
+
nftContractAddress: t.hex().notNull().$type(),
|
|
141
|
+
/** Raw `UpdateListStorageLocation` payload. */
|
|
142
|
+
listStorageLocation: t.hex(),
|
|
143
|
+
/** Decoded list storage location: target chain id. */
|
|
144
|
+
listStorageLocationChainId: t.int8({ mode: "number" }).$type(),
|
|
145
|
+
/** Decoded list storage location: target contract address. */
|
|
146
|
+
listStorageLocationContractAddress: t.hex().$type(),
|
|
147
|
+
/** Decoded list storage location: target slot (bytes32). */
|
|
148
|
+
listStorageLocationSlot: t.hex(),
|
|
149
|
+
/** Address allowed to post records to this list (the EFP "user"). */
|
|
150
|
+
user: t.hex().$type(),
|
|
151
|
+
/** Address allowed to administer this list (the EFP "manager"). */
|
|
152
|
+
manager: t.hex().$type(),
|
|
153
|
+
createdAt: t.bigint().notNull().$type(),
|
|
154
|
+
updatedAt: t.bigint().notNull().$type()
|
|
155
|
+
}),
|
|
156
|
+
(t) => ({
|
|
157
|
+
idx_owner: index().on(t.owner),
|
|
158
|
+
idx_user: index().on(t.user),
|
|
159
|
+
idx_manager: index().on(t.manager),
|
|
160
|
+
idx_storageLocation: index().on(
|
|
161
|
+
t.listStorageLocationChainId,
|
|
162
|
+
t.listStorageLocationContractAddress,
|
|
163
|
+
t.listStorageLocationSlot
|
|
164
|
+
)
|
|
165
|
+
// `id` is a `bigint` (Postgres `numeric`) primary key, so its implicit unique index already
|
|
166
|
+
// orders numerically — `efp.lists` / `Account.efp.lists` pagination needs no extra index.
|
|
167
|
+
})
|
|
168
|
+
);
|
|
169
|
+
var efpListStorageLocations = onchainTable("efp_list_storage_locations", (t) => ({
|
|
170
|
+
/** Composite key "chainId-contractAddress-slot". */
|
|
171
|
+
id: t.text().primaryKey(),
|
|
172
|
+
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
173
|
+
contractAddress: t.hex().notNull().$type(),
|
|
174
|
+
slot: t.hex().notNull(),
|
|
175
|
+
/**
|
|
176
|
+
* Token id of the list NFT that owns this storage location's reverse mapping. The slot is
|
|
177
|
+
* arbitrary, attacker-settable bytes, so multiple list NFTs can point at the same
|
|
178
|
+
* `(chainId, contract, slot)`; this records the FIRST list to claim it (first writer wins), and
|
|
179
|
+
* the `UpdateListStorageLocation` handler gates every write/delete of this row on that ownership.
|
|
180
|
+
* A consequence: when lists share a slot, only the owner's `EfpListRecord.list` back-ref and
|
|
181
|
+
* `user`/`manager` role routing track that slot.
|
|
182
|
+
*/
|
|
183
|
+
tokenId: t.bigint().notNull().$type(),
|
|
184
|
+
updatedAt: t.bigint().notNull().$type()
|
|
185
|
+
}));
|
|
186
|
+
var efpListRecords = onchainTable(
|
|
187
|
+
"efp_list_records",
|
|
188
|
+
(t) => ({
|
|
189
|
+
/** Composite key "chainId-contractAddress-slot-record". */
|
|
190
|
+
id: t.text().primaryKey(),
|
|
191
|
+
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
192
|
+
contractAddress: t.hex().notNull().$type(),
|
|
193
|
+
slot: t.hex().notNull(),
|
|
194
|
+
/** Canonical record prefix `version | type | address` (22 bytes). */
|
|
195
|
+
record: t.hex().notNull(),
|
|
196
|
+
/** Decoded record header — version byte. */
|
|
197
|
+
recordVersion: t.integer().notNull(),
|
|
198
|
+
/** Decoded record header — type byte. */
|
|
199
|
+
recordType: t.integer().notNull(),
|
|
200
|
+
/** Decoded record data. Only address records (type 1) are indexed, so exactly a 20-byte address. */
|
|
201
|
+
recordData: t.hex().notNull().$type(),
|
|
202
|
+
/** UTF-8 tags attached to this record (a set; NULL bytes stripped). */
|
|
203
|
+
tags: t.text().array().notNull().default([]),
|
|
204
|
+
createdAt: t.bigint().notNull().$type()
|
|
205
|
+
}),
|
|
206
|
+
(t) => ({
|
|
207
|
+
idx_slot: index().on(t.chainId, t.contractAddress, t.slot),
|
|
208
|
+
idx_recordData: index().on(t.recordData)
|
|
209
|
+
})
|
|
210
|
+
);
|
|
211
|
+
var efpAccountMetadata = onchainTable(
|
|
212
|
+
"efp_account_metadata",
|
|
213
|
+
(t) => ({
|
|
214
|
+
/** Composite key "chainId-address-key". */
|
|
215
|
+
id: t.text().primaryKey(),
|
|
216
|
+
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
217
|
+
contractAddress: t.hex().notNull().$type(),
|
|
218
|
+
/** Account whose metadata this is. */
|
|
219
|
+
address: t.hex().notNull().$type(),
|
|
220
|
+
/** Metadata key (UTF-8 string). */
|
|
221
|
+
key: t.text().notNull(),
|
|
222
|
+
/** Metadata value (raw bytes). */
|
|
223
|
+
value: t.hex().notNull(),
|
|
224
|
+
/**
|
|
225
|
+
* For the `primary-list` key only: the decoded token id of the account's primary list (the
|
|
226
|
+
* `value` is `abi.encodePacked(uint256)`, which Postgres can't compare to the numeric
|
|
227
|
+
* `efp_lists.id`). Decoding it at index time makes the validated follower/following social graph
|
|
228
|
+
* a pure SQL join. `null` for any other key, or a malformed `primary-list` value.
|
|
229
|
+
*/
|
|
230
|
+
primaryListTokenId: t.bigint().$type(),
|
|
231
|
+
createdAt: t.bigint().notNull().$type(),
|
|
232
|
+
updatedAt: t.bigint().notNull().$type()
|
|
233
|
+
}),
|
|
234
|
+
(t) => ({
|
|
235
|
+
idx_address: index().on(t.address),
|
|
236
|
+
// Account-metadata lookups (primary-list validation, `metadata(key:)`) filter by `(address, key)`;
|
|
237
|
+
// a composite index makes that a point lookup rather than an address-partition scan.
|
|
238
|
+
idx_address_key: index().on(t.address, t.key),
|
|
239
|
+
// The followers join filters lists by `(user, primaryListTokenId)`; index it for the social graph.
|
|
240
|
+
idx_primaryListTokenId: index().on(t.primaryListTokenId)
|
|
241
|
+
})
|
|
242
|
+
);
|
|
243
|
+
var efpListMetadata = onchainTable(
|
|
244
|
+
"efp_list_metadata",
|
|
245
|
+
(t) => ({
|
|
246
|
+
/** Composite key "chainId-contractAddress-slot-key". */
|
|
247
|
+
id: t.text().primaryKey(),
|
|
248
|
+
chainId: t.int8({ mode: "number" }).notNull().$type(),
|
|
249
|
+
contractAddress: t.hex().notNull().$type(),
|
|
250
|
+
slot: t.hex().notNull(),
|
|
251
|
+
key: t.text().notNull(),
|
|
252
|
+
value: t.hex().notNull(),
|
|
253
|
+
createdAt: t.bigint().notNull().$type()
|
|
254
|
+
}),
|
|
255
|
+
(t) => ({
|
|
256
|
+
idx_slot: index().on(t.chainId, t.contractAddress, t.slot)
|
|
257
|
+
})
|
|
258
|
+
);
|
|
259
|
+
|
|
123
260
|
// src/ensindexer-abstract/migrated-nodes.schema.ts
|
|
124
|
-
import { onchainTable, primaryKey } from "ponder";
|
|
125
|
-
var migratedNodeByParent =
|
|
261
|
+
import { onchainTable as onchainTable2, primaryKey } from "ponder";
|
|
262
|
+
var migratedNodeByParent = onchainTable2(
|
|
126
263
|
"migrated_nodes_by_parent",
|
|
127
264
|
(t) => ({
|
|
128
265
|
// keyed by (parentNode, labelHash)
|
|
@@ -133,17 +270,19 @@ var migratedNodeByParent = onchainTable(
|
|
|
133
270
|
pk: primaryKey({ columns: [t.parentNode, t.labelHash] })
|
|
134
271
|
})
|
|
135
272
|
);
|
|
136
|
-
var migratedNodeByNode =
|
|
273
|
+
var migratedNodeByNode = onchainTable2("migrated_nodes_by_node", (t) => ({
|
|
137
274
|
node: t.hex().primaryKey().$type()
|
|
138
275
|
}));
|
|
139
276
|
|
|
140
277
|
// src/ensindexer-abstract/protocol-acceleration.schema.ts
|
|
141
|
-
import { index, onchainTable as
|
|
142
|
-
var reverseNameRecord =
|
|
278
|
+
import { index as index2, onchainTable as onchainTable3, primaryKey as primaryKey2, relations, uniqueIndex } from "ponder";
|
|
279
|
+
var reverseNameRecord = onchainTable3(
|
|
143
280
|
"reverse_name_records",
|
|
144
281
|
(t) => ({
|
|
145
282
|
// keyed by (address, coinType)
|
|
146
283
|
address: t.hex().notNull().$type(),
|
|
284
|
+
// @TODO(cointype-bigint): store as `t.int8({ mode: "number" }).$type<CoinType>()` (like chainId
|
|
285
|
+
// elsewhere) so reads/writes use CoinType directly without bigint round-trips. See #2293.
|
|
147
286
|
coinType: t.bigint().notNull(),
|
|
148
287
|
/**
|
|
149
288
|
* Represents the ENSIP-19 Reverse Name Record for a given (address, coinType).
|
|
@@ -156,7 +295,7 @@ var reverseNameRecord = onchainTable2(
|
|
|
156
295
|
pk: primaryKey2({ columns: [t.address, t.coinType] })
|
|
157
296
|
})
|
|
158
297
|
);
|
|
159
|
-
var domainResolverRelation =
|
|
298
|
+
var domainResolverRelation = onchainTable3(
|
|
160
299
|
"domain_resolver_relations",
|
|
161
300
|
(t) => ({
|
|
162
301
|
// keyed by (chainId, address, node)
|
|
@@ -169,7 +308,7 @@ var domainResolverRelation = onchainTable2(
|
|
|
169
308
|
}),
|
|
170
309
|
(t) => ({
|
|
171
310
|
pk: primaryKey2({ columns: [t.chainId, t.address, t.domainId] }),
|
|
172
|
-
byDomain:
|
|
311
|
+
byDomain: index2().on(t.domainId)
|
|
173
312
|
})
|
|
174
313
|
);
|
|
175
314
|
var domainResolverRelation_relations = relations(domainResolverRelation, ({ one }) => ({
|
|
@@ -178,7 +317,7 @@ var domainResolverRelation_relations = relations(domainResolverRelation, ({ one
|
|
|
178
317
|
references: [resolver.chainId, resolver.address]
|
|
179
318
|
})
|
|
180
319
|
}));
|
|
181
|
-
var resolver =
|
|
320
|
+
var resolver = onchainTable3(
|
|
182
321
|
"resolvers",
|
|
183
322
|
(t) => ({
|
|
184
323
|
// keyed by (chainId, address)
|
|
@@ -199,7 +338,7 @@ var resolver = onchainTable2(
|
|
|
199
338
|
var resolver_relations = relations(resolver, ({ many }) => ({
|
|
200
339
|
records: many(resolverRecords)
|
|
201
340
|
}));
|
|
202
|
-
var resolverRecords =
|
|
341
|
+
var resolverRecords = onchainTable3(
|
|
203
342
|
"resolver_records",
|
|
204
343
|
(t) => ({
|
|
205
344
|
// keyed by (chainId, resolver, node)
|
|
@@ -250,7 +389,7 @@ var resolverRecords_relations = relations(resolverRecords, ({ one, many }) => ({
|
|
|
250
389
|
// resolverRecord has many text records
|
|
251
390
|
textRecords: many(resolverTextRecord)
|
|
252
391
|
}));
|
|
253
|
-
var resolverAddressRecord =
|
|
392
|
+
var resolverAddressRecord = onchainTable3(
|
|
254
393
|
"resolver_address_records",
|
|
255
394
|
(t) => ({
|
|
256
395
|
// keyed by ((chainId, resolver, node), coinType)
|
|
@@ -259,6 +398,8 @@ var resolverAddressRecord = onchainTable2(
|
|
|
259
398
|
node: t.hex().notNull().$type(),
|
|
260
399
|
// NOTE: all well-known CoinTypes fit into javascript number but NOT postgres .integer, must be
|
|
261
400
|
// stored as BigInt
|
|
401
|
+
// @TODO(cointype-bigint): use `t.int8({ mode: "number" }).$type<CoinType>()` like `chainId` above
|
|
402
|
+
// to drop bigint round-trips at every read/write boundary. See #2293.
|
|
262
403
|
coinType: t.bigint().notNull(),
|
|
263
404
|
/**
|
|
264
405
|
* Represents the value of the Address Record specified by ((chainId, resolver, node), coinType).
|
|
@@ -269,7 +410,12 @@ var resolverAddressRecord = onchainTable2(
|
|
|
269
410
|
value: t.hex().notNull()
|
|
270
411
|
}),
|
|
271
412
|
(t) => ({
|
|
272
|
-
pk: primaryKey2({ columns: [t.chainId, t.address, t.node, t.coinType] })
|
|
413
|
+
pk: primaryKey2({ columns: [t.chainId, t.address, t.node, t.coinType] }),
|
|
414
|
+
// supports the reverse lookup powering `Account.nameReferences`:
|
|
415
|
+
// `WHERE value = <address> [AND coin_type = <coinType>] ORDER BY (node, coinType, chainId, address)`.
|
|
416
|
+
// The `value` prefix seeks the filter; the remaining columns match the keyset ORDER BY tuple so
|
|
417
|
+
// rows are yielded already sorted, letting pagination range-scan to the cursor instead of sorting.
|
|
418
|
+
byValueKeyset: index2().on(t.value, t.node, t.coinType, t.chainId, t.address)
|
|
273
419
|
})
|
|
274
420
|
);
|
|
275
421
|
var resolverAddressRecordRelations = relations(resolverAddressRecord, ({ one }) => ({
|
|
@@ -283,7 +429,7 @@ var resolverAddressRecordRelations = relations(resolverAddressRecord, ({ one })
|
|
|
283
429
|
references: [resolverRecords.chainId, resolverRecords.address, resolverRecords.node]
|
|
284
430
|
})
|
|
285
431
|
}));
|
|
286
|
-
var resolverTextRecord =
|
|
432
|
+
var resolverTextRecord = onchainTable3(
|
|
287
433
|
"resolver_text_records",
|
|
288
434
|
(t) => ({
|
|
289
435
|
// keyed by ((chainId, resolver, node), key)
|
|
@@ -312,8 +458,8 @@ var resolverTextRecordRelations = relations(resolverTextRecord, ({ one }) => ({
|
|
|
312
458
|
}));
|
|
313
459
|
|
|
314
460
|
// src/ensindexer-abstract/registrars.schema.ts
|
|
315
|
-
import { index as
|
|
316
|
-
var subregistries =
|
|
461
|
+
import { index as index3, onchainEnum, onchainTable as onchainTable4, relations as relations2, uniqueIndex as uniqueIndex2 } from "ponder";
|
|
462
|
+
var subregistries = onchainTable4(
|
|
317
463
|
"subregistries",
|
|
318
464
|
(t) => ({
|
|
319
465
|
/**
|
|
@@ -343,7 +489,7 @@ var subregistries = onchainTable3(
|
|
|
343
489
|
uniqueNode: uniqueIndex2().on(t.node)
|
|
344
490
|
})
|
|
345
491
|
);
|
|
346
|
-
var registrationLifecycles =
|
|
492
|
+
var registrationLifecycles = onchainTable4(
|
|
347
493
|
"registration_lifecycles",
|
|
348
494
|
(t) => ({
|
|
349
495
|
/**
|
|
@@ -376,14 +522,14 @@ var registrationLifecycles = onchainTable3(
|
|
|
376
522
|
expiresAt: t.bigint().notNull()
|
|
377
523
|
}),
|
|
378
524
|
(t) => ({
|
|
379
|
-
bySubregistry:
|
|
525
|
+
bySubregistry: index3().on(t.subregistryId)
|
|
380
526
|
})
|
|
381
527
|
);
|
|
382
528
|
var registrarActionType = onchainEnum("registrar_action_type", [
|
|
383
529
|
"registration",
|
|
384
530
|
"renewal"
|
|
385
531
|
]);
|
|
386
|
-
var registrarActions =
|
|
532
|
+
var registrarActions = onchainTable4(
|
|
387
533
|
"registrar_actions",
|
|
388
534
|
(t) => ({
|
|
389
535
|
/**
|
|
@@ -632,15 +778,15 @@ var registrarActions = onchainTable3(
|
|
|
632
778
|
eventIds: t.text().array().notNull()
|
|
633
779
|
}),
|
|
634
780
|
(t) => ({
|
|
635
|
-
byDecodedReferrer:
|
|
636
|
-
byTimestamp:
|
|
781
|
+
byDecodedReferrer: index3().on(t.decodedReferrer),
|
|
782
|
+
byTimestamp: index3().on(t.timestamp)
|
|
637
783
|
})
|
|
638
784
|
);
|
|
639
785
|
var internal_registrarActionMetadataType = onchainEnum(
|
|
640
786
|
"_ensindexer_registrar_action_metadata_type",
|
|
641
787
|
["CURRENT_LOGICAL_REGISTRAR_ACTION"]
|
|
642
788
|
);
|
|
643
|
-
var internal_registrarActionMetadata =
|
|
789
|
+
var internal_registrarActionMetadata = onchainTable4(
|
|
644
790
|
"_ensindexer_registrar_action_metadata",
|
|
645
791
|
(t) => ({
|
|
646
792
|
/**
|
|
@@ -689,7 +835,7 @@ var registrarActionRelations = relations2(registrarActions, ({ one }) => ({
|
|
|
689
835
|
}));
|
|
690
836
|
|
|
691
837
|
// src/ensindexer-abstract/subgraph.schema.ts
|
|
692
|
-
import { index as
|
|
838
|
+
import { index as index4, onchainTable as onchainTable5, relations as relations3, sql } from "ponder";
|
|
693
839
|
|
|
694
840
|
// src/lib/collate.ts
|
|
695
841
|
function monkeypatchCollate(col, collation) {
|
|
@@ -700,7 +846,7 @@ function monkeypatchCollate(col, collation) {
|
|
|
700
846
|
}
|
|
701
847
|
|
|
702
848
|
// src/ensindexer-abstract/subgraph.schema.ts
|
|
703
|
-
var subgraph_domain =
|
|
849
|
+
var subgraph_domain = onchainTable5(
|
|
704
850
|
"subgraph_domains",
|
|
705
851
|
(t) => ({
|
|
706
852
|
// The namehash of the name
|
|
@@ -770,17 +916,17 @@ var subgraph_domain = onchainTable4(
|
|
|
770
916
|
}),
|
|
771
917
|
(t) => ({
|
|
772
918
|
// uses a hash index because some name values exceed the btree max row size (8191 bytes)
|
|
773
|
-
byExactName:
|
|
919
|
+
byExactName: index4().using("hash", t.name),
|
|
774
920
|
// GIN trigram index for partial-match filters (_contains, _starts_with, _ends_with).
|
|
775
921
|
// (inline `gin_trgm_ops` via `sql` because passing it through `.op()` gets dropped by Ponder,
|
|
776
922
|
// producing `USING gin (name)` with no opclass)
|
|
777
|
-
byFuzzyName:
|
|
778
|
-
byLabelhash:
|
|
779
|
-
byParentId:
|
|
780
|
-
byOwnerId:
|
|
781
|
-
byRegistrantId:
|
|
782
|
-
byWrappedOwnerId:
|
|
783
|
-
byResolvedAddressId:
|
|
923
|
+
byFuzzyName: index4().using("gin", sql`${t.name} gin_trgm_ops`),
|
|
924
|
+
byLabelhash: index4().on(t.labelhash),
|
|
925
|
+
byParentId: index4().on(t.parentId),
|
|
926
|
+
byOwnerId: index4().on(t.ownerId),
|
|
927
|
+
byRegistrantId: index4().on(t.registrantId),
|
|
928
|
+
byWrappedOwnerId: index4().on(t.wrappedOwnerId),
|
|
929
|
+
byResolvedAddressId: index4().on(t.resolvedAddressId)
|
|
784
930
|
})
|
|
785
931
|
);
|
|
786
932
|
monkeypatchCollate(subgraph_domain.name, '"C"');
|
|
@@ -830,7 +976,7 @@ var subgraph_domainRelations = relations3(subgraph_domain, ({ one, many }) => ({
|
|
|
830
976
|
fusesSets: many(subgraph_fusesSet),
|
|
831
977
|
expiryExtendeds: many(subgraph_expiryExtended)
|
|
832
978
|
}));
|
|
833
|
-
var subgraph_account =
|
|
979
|
+
var subgraph_account = onchainTable5("subgraph_accounts", (t) => ({
|
|
834
980
|
id: t.hex().primaryKey()
|
|
835
981
|
}));
|
|
836
982
|
var subgraph_accountRelations = relations3(subgraph_account, ({ many }) => ({
|
|
@@ -838,7 +984,7 @@ var subgraph_accountRelations = relations3(subgraph_account, ({ many }) => ({
|
|
|
838
984
|
wrappedDomains: many(subgraph_wrappedDomain),
|
|
839
985
|
registrations: many(subgraph_registration)
|
|
840
986
|
}));
|
|
841
|
-
var subgraph_resolver =
|
|
987
|
+
var subgraph_resolver = onchainTable5(
|
|
842
988
|
"subgraph_resolvers",
|
|
843
989
|
(t) => ({
|
|
844
990
|
// The unique identifier for this resolver, which is a concatenation of the domain namehash and the resolver address
|
|
@@ -859,7 +1005,7 @@ var subgraph_resolver = onchainTable4(
|
|
|
859
1005
|
coinTypes: t.bigint().array()
|
|
860
1006
|
}),
|
|
861
1007
|
(t) => ({
|
|
862
|
-
byDomainId:
|
|
1008
|
+
byDomainId: index4().on(t.domainId)
|
|
863
1009
|
})
|
|
864
1010
|
);
|
|
865
1011
|
var subgraph_resolverRelations = relations3(subgraph_resolver, ({ one, many }) => ({
|
|
@@ -883,7 +1029,7 @@ var subgraph_resolverRelations = relations3(subgraph_resolver, ({ one, many }) =
|
|
|
883
1029
|
authorisationChangeds: many(subgraph_authorisationChanged),
|
|
884
1030
|
versionChangeds: many(subgraph_versionChanged)
|
|
885
1031
|
}));
|
|
886
|
-
var subgraph_registration =
|
|
1032
|
+
var subgraph_registration = onchainTable5(
|
|
887
1033
|
"subgraph_registrations",
|
|
888
1034
|
(t) => ({
|
|
889
1035
|
// The unique identifier of the registration
|
|
@@ -920,9 +1066,9 @@ var subgraph_registration = onchainTable4(
|
|
|
920
1066
|
labelName: t.text()
|
|
921
1067
|
}),
|
|
922
1068
|
(t) => ({
|
|
923
|
-
byDomainId:
|
|
924
|
-
byRegistrationDate:
|
|
925
|
-
byExpiryDate:
|
|
1069
|
+
byDomainId: index4().on(t.domainId),
|
|
1070
|
+
byRegistrationDate: index4().on(t.registrationDate),
|
|
1071
|
+
byExpiryDate: index4().on(t.expiryDate)
|
|
926
1072
|
})
|
|
927
1073
|
);
|
|
928
1074
|
var subgraph_registrationRelations = relations3(subgraph_registration, ({ one, many }) => ({
|
|
@@ -939,7 +1085,7 @@ var subgraph_registrationRelations = relations3(subgraph_registration, ({ one, m
|
|
|
939
1085
|
nameReneweds: many(subgraph_nameRenewed),
|
|
940
1086
|
nameTransferreds: many(subgraph_nameTransferred)
|
|
941
1087
|
}));
|
|
942
|
-
var subgraph_wrappedDomain =
|
|
1088
|
+
var subgraph_wrappedDomain = onchainTable5(
|
|
943
1089
|
"subgraph_wrapped_domains",
|
|
944
1090
|
(t) => ({
|
|
945
1091
|
// The unique identifier for each instance of the WrappedDomain entity
|
|
@@ -971,7 +1117,7 @@ var subgraph_wrappedDomain = onchainTable4(
|
|
|
971
1117
|
name: t.text()
|
|
972
1118
|
}),
|
|
973
1119
|
(t) => ({
|
|
974
|
-
byDomainId:
|
|
1120
|
+
byDomainId: index4().on(t.domainId)
|
|
975
1121
|
})
|
|
976
1122
|
);
|
|
977
1123
|
var subgraph_wrappedDomainRelations = relations3(subgraph_wrappedDomain, ({ one }) => ({
|
|
@@ -995,11 +1141,11 @@ var domainEvent = (t) => ({
|
|
|
995
1141
|
});
|
|
996
1142
|
var domainEventIndex = (t) => ({
|
|
997
1143
|
// primary reverse lookup
|
|
998
|
-
idx:
|
|
1144
|
+
idx: index4().on(t.domainId),
|
|
999
1145
|
// sorting index
|
|
1000
|
-
idx_compound:
|
|
1146
|
+
idx_compound: index4().on(t.domainId, t.id)
|
|
1001
1147
|
});
|
|
1002
|
-
var subgraph_transfer =
|
|
1148
|
+
var subgraph_transfer = onchainTable5(
|
|
1003
1149
|
"subgraph_transfers",
|
|
1004
1150
|
(t) => ({
|
|
1005
1151
|
...domainEvent(t),
|
|
@@ -1007,7 +1153,7 @@ var subgraph_transfer = onchainTable4(
|
|
|
1007
1153
|
}),
|
|
1008
1154
|
domainEventIndex
|
|
1009
1155
|
);
|
|
1010
|
-
var subgraph_newOwner =
|
|
1156
|
+
var subgraph_newOwner = onchainTable5(
|
|
1011
1157
|
"subgraph_new_owners",
|
|
1012
1158
|
(t) => ({
|
|
1013
1159
|
...domainEvent(t),
|
|
@@ -1016,7 +1162,7 @@ var subgraph_newOwner = onchainTable4(
|
|
|
1016
1162
|
}),
|
|
1017
1163
|
domainEventIndex
|
|
1018
1164
|
);
|
|
1019
|
-
var subgraph_newResolver =
|
|
1165
|
+
var subgraph_newResolver = onchainTable5(
|
|
1020
1166
|
"subgraph_new_resolvers",
|
|
1021
1167
|
(t) => ({
|
|
1022
1168
|
...domainEvent(t),
|
|
@@ -1024,7 +1170,7 @@ var subgraph_newResolver = onchainTable4(
|
|
|
1024
1170
|
}),
|
|
1025
1171
|
domainEventIndex
|
|
1026
1172
|
);
|
|
1027
|
-
var subgraph_newTTL =
|
|
1173
|
+
var subgraph_newTTL = onchainTable5(
|
|
1028
1174
|
"subgraph_new_ttls",
|
|
1029
1175
|
(t) => ({
|
|
1030
1176
|
...domainEvent(t),
|
|
@@ -1032,7 +1178,7 @@ var subgraph_newTTL = onchainTable4(
|
|
|
1032
1178
|
}),
|
|
1033
1179
|
domainEventIndex
|
|
1034
1180
|
);
|
|
1035
|
-
var subgraph_wrappedTransfer =
|
|
1181
|
+
var subgraph_wrappedTransfer = onchainTable5(
|
|
1036
1182
|
"subgraph_wrapped_transfers",
|
|
1037
1183
|
(t) => ({
|
|
1038
1184
|
...domainEvent(t),
|
|
@@ -1040,7 +1186,7 @@ var subgraph_wrappedTransfer = onchainTable4(
|
|
|
1040
1186
|
}),
|
|
1041
1187
|
domainEventIndex
|
|
1042
1188
|
);
|
|
1043
|
-
var subgraph_nameWrapped =
|
|
1189
|
+
var subgraph_nameWrapped = onchainTable5(
|
|
1044
1190
|
"subgraph_name_wrapped",
|
|
1045
1191
|
(t) => ({
|
|
1046
1192
|
...domainEvent(t),
|
|
@@ -1051,7 +1197,7 @@ var subgraph_nameWrapped = onchainTable4(
|
|
|
1051
1197
|
}),
|
|
1052
1198
|
domainEventIndex
|
|
1053
1199
|
);
|
|
1054
|
-
var subgraph_nameUnwrapped =
|
|
1200
|
+
var subgraph_nameUnwrapped = onchainTable5(
|
|
1055
1201
|
"subgraph_name_unwrapped",
|
|
1056
1202
|
(t) => ({
|
|
1057
1203
|
...domainEvent(t),
|
|
@@ -1059,7 +1205,7 @@ var subgraph_nameUnwrapped = onchainTable4(
|
|
|
1059
1205
|
}),
|
|
1060
1206
|
domainEventIndex
|
|
1061
1207
|
);
|
|
1062
|
-
var subgraph_fusesSet =
|
|
1208
|
+
var subgraph_fusesSet = onchainTable5(
|
|
1063
1209
|
"subgraph_fuses_set",
|
|
1064
1210
|
(t) => ({
|
|
1065
1211
|
...domainEvent(t),
|
|
@@ -1067,7 +1213,7 @@ var subgraph_fusesSet = onchainTable4(
|
|
|
1067
1213
|
}),
|
|
1068
1214
|
domainEventIndex
|
|
1069
1215
|
);
|
|
1070
|
-
var subgraph_expiryExtended =
|
|
1216
|
+
var subgraph_expiryExtended = onchainTable5(
|
|
1071
1217
|
"subgraph_expiry_extended",
|
|
1072
1218
|
(t) => ({
|
|
1073
1219
|
...domainEvent(t),
|
|
@@ -1081,11 +1227,11 @@ var registrationEvent = (t) => ({
|
|
|
1081
1227
|
});
|
|
1082
1228
|
var registrationEventIndex = (t) => ({
|
|
1083
1229
|
// primary reverse lookup
|
|
1084
|
-
idx:
|
|
1230
|
+
idx: index4().on(t.registrationId),
|
|
1085
1231
|
// sorting index
|
|
1086
|
-
idx_compound:
|
|
1232
|
+
idx_compound: index4().on(t.registrationId, t.id)
|
|
1087
1233
|
});
|
|
1088
|
-
var subgraph_nameRegistered =
|
|
1234
|
+
var subgraph_nameRegistered = onchainTable5(
|
|
1089
1235
|
"subgraph_name_registered",
|
|
1090
1236
|
(t) => ({
|
|
1091
1237
|
...registrationEvent(t),
|
|
@@ -1094,7 +1240,7 @@ var subgraph_nameRegistered = onchainTable4(
|
|
|
1094
1240
|
}),
|
|
1095
1241
|
registrationEventIndex
|
|
1096
1242
|
);
|
|
1097
|
-
var subgraph_nameRenewed =
|
|
1243
|
+
var subgraph_nameRenewed = onchainTable5(
|
|
1098
1244
|
"subgraph_name_renewed",
|
|
1099
1245
|
(t) => ({
|
|
1100
1246
|
...registrationEvent(t),
|
|
@@ -1102,7 +1248,7 @@ var subgraph_nameRenewed = onchainTable4(
|
|
|
1102
1248
|
}),
|
|
1103
1249
|
registrationEventIndex
|
|
1104
1250
|
);
|
|
1105
|
-
var subgraph_nameTransferred =
|
|
1251
|
+
var subgraph_nameTransferred = onchainTable5(
|
|
1106
1252
|
"subgraph_name_transferred",
|
|
1107
1253
|
(t) => ({
|
|
1108
1254
|
...registrationEvent(t),
|
|
@@ -1116,11 +1262,11 @@ var resolverEvent = (t) => ({
|
|
|
1116
1262
|
});
|
|
1117
1263
|
var resolverEventIndex = (t) => ({
|
|
1118
1264
|
// primary reverse lookup
|
|
1119
|
-
idx:
|
|
1265
|
+
idx: index4().on(t.resolverId),
|
|
1120
1266
|
// sorting index
|
|
1121
|
-
idx_compound:
|
|
1267
|
+
idx_compound: index4().on(t.resolverId, t.id)
|
|
1122
1268
|
});
|
|
1123
|
-
var subgraph_addrChanged =
|
|
1269
|
+
var subgraph_addrChanged = onchainTable5(
|
|
1124
1270
|
"subgraph_addr_changed",
|
|
1125
1271
|
(t) => ({
|
|
1126
1272
|
...resolverEvent(t),
|
|
@@ -1128,7 +1274,7 @@ var subgraph_addrChanged = onchainTable4(
|
|
|
1128
1274
|
}),
|
|
1129
1275
|
resolverEventIndex
|
|
1130
1276
|
);
|
|
1131
|
-
var subgraph_multicoinAddrChanged =
|
|
1277
|
+
var subgraph_multicoinAddrChanged = onchainTable5(
|
|
1132
1278
|
"subgraph_multicoin_addr_changed",
|
|
1133
1279
|
(t) => ({
|
|
1134
1280
|
...resolverEvent(t),
|
|
@@ -1137,7 +1283,7 @@ var subgraph_multicoinAddrChanged = onchainTable4(
|
|
|
1137
1283
|
}),
|
|
1138
1284
|
resolverEventIndex
|
|
1139
1285
|
);
|
|
1140
|
-
var subgraph_nameChanged =
|
|
1286
|
+
var subgraph_nameChanged = onchainTable5(
|
|
1141
1287
|
"subgraph_name_changed",
|
|
1142
1288
|
(t) => ({
|
|
1143
1289
|
...resolverEvent(t),
|
|
@@ -1145,7 +1291,7 @@ var subgraph_nameChanged = onchainTable4(
|
|
|
1145
1291
|
}),
|
|
1146
1292
|
resolverEventIndex
|
|
1147
1293
|
);
|
|
1148
|
-
var subgraph_abiChanged =
|
|
1294
|
+
var subgraph_abiChanged = onchainTable5(
|
|
1149
1295
|
"subgraph_abi_changed",
|
|
1150
1296
|
(t) => ({
|
|
1151
1297
|
...resolverEvent(t),
|
|
@@ -1153,7 +1299,7 @@ var subgraph_abiChanged = onchainTable4(
|
|
|
1153
1299
|
}),
|
|
1154
1300
|
resolverEventIndex
|
|
1155
1301
|
);
|
|
1156
|
-
var subgraph_pubkeyChanged =
|
|
1302
|
+
var subgraph_pubkeyChanged = onchainTable5(
|
|
1157
1303
|
"subgraph_pubkey_changed",
|
|
1158
1304
|
(t) => ({
|
|
1159
1305
|
...resolverEvent(t),
|
|
@@ -1162,7 +1308,7 @@ var subgraph_pubkeyChanged = onchainTable4(
|
|
|
1162
1308
|
}),
|
|
1163
1309
|
resolverEventIndex
|
|
1164
1310
|
);
|
|
1165
|
-
var subgraph_textChanged =
|
|
1311
|
+
var subgraph_textChanged = onchainTable5(
|
|
1166
1312
|
"subgraph_text_changed",
|
|
1167
1313
|
(t) => ({
|
|
1168
1314
|
...resolverEvent(t),
|
|
@@ -1171,7 +1317,7 @@ var subgraph_textChanged = onchainTable4(
|
|
|
1171
1317
|
}),
|
|
1172
1318
|
resolverEventIndex
|
|
1173
1319
|
);
|
|
1174
|
-
var subgraph_contenthashChanged =
|
|
1320
|
+
var subgraph_contenthashChanged = onchainTable5(
|
|
1175
1321
|
"subgraph_contenthash_changed",
|
|
1176
1322
|
(t) => ({
|
|
1177
1323
|
...resolverEvent(t),
|
|
@@ -1179,7 +1325,7 @@ var subgraph_contenthashChanged = onchainTable4(
|
|
|
1179
1325
|
}),
|
|
1180
1326
|
resolverEventIndex
|
|
1181
1327
|
);
|
|
1182
|
-
var subgraph_interfaceChanged =
|
|
1328
|
+
var subgraph_interfaceChanged = onchainTable5(
|
|
1183
1329
|
"subgraph_interface_changed",
|
|
1184
1330
|
(t) => ({
|
|
1185
1331
|
...resolverEvent(t),
|
|
@@ -1188,7 +1334,7 @@ var subgraph_interfaceChanged = onchainTable4(
|
|
|
1188
1334
|
}),
|
|
1189
1335
|
resolverEventIndex
|
|
1190
1336
|
);
|
|
1191
|
-
var subgraph_authorisationChanged =
|
|
1337
|
+
var subgraph_authorisationChanged = onchainTable5(
|
|
1192
1338
|
"subgraph_authorisation_changed",
|
|
1193
1339
|
(t) => ({
|
|
1194
1340
|
...resolverEvent(t),
|
|
@@ -1198,7 +1344,7 @@ var subgraph_authorisationChanged = onchainTable4(
|
|
|
1198
1344
|
}),
|
|
1199
1345
|
resolverEventIndex
|
|
1200
1346
|
);
|
|
1201
|
-
var subgraph_versionChanged =
|
|
1347
|
+
var subgraph_versionChanged = onchainTable5(
|
|
1202
1348
|
"subgraph_version_changed",
|
|
1203
1349
|
(t) => ({
|
|
1204
1350
|
...resolverEvent(t),
|
|
@@ -1392,8 +1538,8 @@ var subgraph_versionChangedRelations = relations3(subgraph_versionChanged, ({ on
|
|
|
1392
1538
|
}));
|
|
1393
1539
|
|
|
1394
1540
|
// src/ensindexer-abstract/tokenscope.schema.ts
|
|
1395
|
-
import { index as
|
|
1396
|
-
var nameSales =
|
|
1541
|
+
import { index as index5, onchainTable as onchainTable6 } from "ponder";
|
|
1542
|
+
var nameSales = onchainTable6(
|
|
1397
1543
|
"name_sales",
|
|
1398
1544
|
(t) => ({
|
|
1399
1545
|
/**
|
|
@@ -1482,14 +1628,14 @@ var nameSales = onchainTable5(
|
|
|
1482
1628
|
timestamp: t.bigint().notNull()
|
|
1483
1629
|
}),
|
|
1484
1630
|
(t) => ({
|
|
1485
|
-
idx_domainId:
|
|
1486
|
-
idx_assetId:
|
|
1487
|
-
idx_buyer:
|
|
1488
|
-
idx_seller:
|
|
1489
|
-
idx_timestamp:
|
|
1631
|
+
idx_domainId: index5().on(t.domainId),
|
|
1632
|
+
idx_assetId: index5().on(t.assetId),
|
|
1633
|
+
idx_buyer: index5().on(t.buyer),
|
|
1634
|
+
idx_seller: index5().on(t.seller),
|
|
1635
|
+
idx_timestamp: index5().on(t.timestamp)
|
|
1490
1636
|
})
|
|
1491
1637
|
);
|
|
1492
|
-
var nameTokens =
|
|
1638
|
+
var nameTokens = onchainTable6(
|
|
1493
1639
|
"name_tokens",
|
|
1494
1640
|
(t) => ({
|
|
1495
1641
|
/**
|
|
@@ -1569,14 +1715,14 @@ var nameTokens = onchainTable5(
|
|
|
1569
1715
|
mintStatus: t.text().notNull()
|
|
1570
1716
|
}),
|
|
1571
1717
|
(t) => ({
|
|
1572
|
-
idx_domainId:
|
|
1573
|
-
idx_owner:
|
|
1718
|
+
idx_domainId: index5().on(t.domainId),
|
|
1719
|
+
idx_owner: index5().on(t.owner)
|
|
1574
1720
|
})
|
|
1575
1721
|
);
|
|
1576
1722
|
|
|
1577
1723
|
// src/ensindexer-abstract/unigraph.schema.ts
|
|
1578
|
-
import { index as
|
|
1579
|
-
var event =
|
|
1724
|
+
import { index as index6, onchainEnum as onchainEnum2, onchainTable as onchainTable7, primaryKey as primaryKey3, relations as relations4, sql as sql2, uniqueIndex as uniqueIndex3 } from "ponder";
|
|
1725
|
+
var event = onchainTable7(
|
|
1580
1726
|
"events",
|
|
1581
1727
|
(t) => ({
|
|
1582
1728
|
// Ponder's event.id
|
|
@@ -1606,13 +1752,13 @@ var event = onchainTable6(
|
|
|
1606
1752
|
data: t.hex().notNull()
|
|
1607
1753
|
}),
|
|
1608
1754
|
(t) => ({
|
|
1609
|
-
bySelector:
|
|
1610
|
-
byFrom:
|
|
1611
|
-
bySender:
|
|
1612
|
-
byTimestamp:
|
|
1755
|
+
bySelector: index6().on(t.selector),
|
|
1756
|
+
byFrom: index6().on(t.from),
|
|
1757
|
+
bySender: index6().on(t.sender),
|
|
1758
|
+
byTimestamp: index6().on(t.timestamp)
|
|
1613
1759
|
})
|
|
1614
1760
|
);
|
|
1615
|
-
var domainEvent2 =
|
|
1761
|
+
var domainEvent2 = onchainTable7(
|
|
1616
1762
|
"domain_events",
|
|
1617
1763
|
(t) => ({
|
|
1618
1764
|
domainId: t.text().notNull().$type(),
|
|
@@ -1620,7 +1766,7 @@ var domainEvent2 = onchainTable6(
|
|
|
1620
1766
|
}),
|
|
1621
1767
|
(t) => ({ pk: primaryKey3({ columns: [t.domainId, t.eventId] }) })
|
|
1622
1768
|
);
|
|
1623
|
-
var resolverEvent2 =
|
|
1769
|
+
var resolverEvent2 = onchainTable7(
|
|
1624
1770
|
"resolver_events",
|
|
1625
1771
|
(t) => ({
|
|
1626
1772
|
resolverId: t.text().notNull().$type(),
|
|
@@ -1628,7 +1774,7 @@ var resolverEvent2 = onchainTable6(
|
|
|
1628
1774
|
}),
|
|
1629
1775
|
(t) => ({ pk: primaryKey3({ columns: [t.resolverId, t.eventId] }) })
|
|
1630
1776
|
);
|
|
1631
|
-
var permissionsEvent =
|
|
1777
|
+
var permissionsEvent = onchainTable7(
|
|
1632
1778
|
"permissions_events",
|
|
1633
1779
|
(t) => ({
|
|
1634
1780
|
permissionsId: t.text().notNull().$type(),
|
|
@@ -1636,7 +1782,7 @@ var permissionsEvent = onchainTable6(
|
|
|
1636
1782
|
}),
|
|
1637
1783
|
(t) => ({ pk: primaryKey3({ columns: [t.permissionsId, t.eventId] }) })
|
|
1638
1784
|
);
|
|
1639
|
-
var permissionsUserEvent =
|
|
1785
|
+
var permissionsUserEvent = onchainTable7(
|
|
1640
1786
|
"permissions_user_events",
|
|
1641
1787
|
(t) => ({
|
|
1642
1788
|
permissionsUserId: t.text().notNull().$type(),
|
|
@@ -1644,7 +1790,7 @@ var permissionsUserEvent = onchainTable6(
|
|
|
1644
1790
|
}),
|
|
1645
1791
|
(t) => ({ pk: primaryKey3({ columns: [t.permissionsUserId, t.eventId] }) })
|
|
1646
1792
|
);
|
|
1647
|
-
var account =
|
|
1793
|
+
var account = onchainTable7("accounts", (t) => ({
|
|
1648
1794
|
id: t.hex().primaryKey().$type()
|
|
1649
1795
|
}));
|
|
1650
1796
|
var account_relations = relations4(account, ({ many }) => ({
|
|
@@ -1657,7 +1803,7 @@ var registryType = onchainEnum2("RegistryType", [
|
|
|
1657
1803
|
"ENSv1VirtualRegistry",
|
|
1658
1804
|
"ENSv2Registry"
|
|
1659
1805
|
]);
|
|
1660
|
-
var registry =
|
|
1806
|
+
var registry = onchainTable7(
|
|
1661
1807
|
"registries",
|
|
1662
1808
|
(t) => ({
|
|
1663
1809
|
// see RegistryId for guarantees
|
|
@@ -1683,7 +1829,7 @@ var registry = onchainTable6(
|
|
|
1683
1829
|
}),
|
|
1684
1830
|
(t) => ({
|
|
1685
1831
|
// NOTE: non-unique index because multiple rows can share (chainId, address) across virtual registries
|
|
1686
|
-
byChainAddress:
|
|
1832
|
+
byChainAddress: index6().on(t.chainId, t.address)
|
|
1687
1833
|
})
|
|
1688
1834
|
);
|
|
1689
1835
|
var relations_registry = relations4(registry, ({ one, many }) => ({
|
|
@@ -1710,7 +1856,7 @@ function truncateCanonicalNamePrefix(name) {
|
|
|
1710
1856
|
}
|
|
1711
1857
|
return prefix;
|
|
1712
1858
|
}
|
|
1713
|
-
var domain =
|
|
1859
|
+
var domain = onchainTable7(
|
|
1714
1860
|
"domains",
|
|
1715
1861
|
(t) => ({
|
|
1716
1862
|
// see DomainId for guarantees (ENSv1DomainId: `${ENSv1RegistryId}/${node}`, ENSv2DomainId: CAIP-19)
|
|
@@ -1807,31 +1953,31 @@ var domain = onchainTable6(
|
|
|
1807
1953
|
// NOTE: Domain-Resolver Relations tracked via Protocol Acceleration plugin
|
|
1808
1954
|
}),
|
|
1809
1955
|
(t) => ({
|
|
1810
|
-
byType:
|
|
1811
|
-
bySubregistry:
|
|
1812
|
-
byOwner:
|
|
1813
|
-
byLabelHash:
|
|
1956
|
+
byType: index6().on(t.type),
|
|
1957
|
+
bySubregistry: index6().on(t.subregistryId).where(sql2`${t.subregistryId} IS NOT NULL`),
|
|
1958
|
+
byOwner: index6().on(t.ownerId),
|
|
1959
|
+
byLabelHash: index6().on(t.labelHash),
|
|
1814
1960
|
// Composite for `(registry_id, label_hash)` lookups (namegraph walk in
|
|
1815
1961
|
// get-domain-by-interpreted-name.ts). The leading `registry_id` column also serves
|
|
1816
1962
|
// `WHERE registry_id = X` lookups via prefix scan.
|
|
1817
|
-
byRegistryAndLabelHash:
|
|
1963
|
+
byRegistryAndLabelHash: index6().on(t.registryId, t.labelHash),
|
|
1818
1964
|
// composite for `WHERE registry_id = X ORDER BY __canonical_name_prefix LIMIT N` (Domain.subdomains
|
|
1819
1965
|
// and other find-domains queries when ordering by NAME). The length-capped prefix keeps the
|
|
1820
1966
|
// index tuple under btree's per-tuple max (~2712 bytes); 64 code points × max 4-byte UTF-8 =
|
|
1821
1967
|
// 256 bytes, leaving ample room for the registry_id and id columns.
|
|
1822
|
-
byRegistryAndCanonicalNamePrefix:
|
|
1968
|
+
byRegistryAndCanonicalNamePrefix: index6().on(t.registryId, t.__canonicalNamePrefix, t.id),
|
|
1823
1969
|
// hash index avoids the btree 8191-byte row-size hazard for spam names
|
|
1824
|
-
byCanonicalNameExact:
|
|
1970
|
+
byCanonicalNameExact: index6().using("hash", t.canonicalName),
|
|
1825
1971
|
// GIN trigram on the length-capped prefix for left-anchored (`LIKE 'vit%'`) and substring
|
|
1826
1972
|
// search (inline `gin_trgm_ops` via `sql` because passing it through `.op()` gets dropped by
|
|
1827
1973
|
// Ponder)
|
|
1828
|
-
byCanonicalNamePrefixFuzzy:
|
|
1974
|
+
byCanonicalNamePrefixFuzzy: index6().using("gin", sql2`${t.__canonicalNamePrefix} gin_trgm_ops`),
|
|
1829
1975
|
// GIN containment for `cascadeLabelHeal`'s `canonical_label_hash_path @> ARRAY[lh]` lookup
|
|
1830
|
-
byCanonicalLabelHashPath:
|
|
1976
|
+
byCanonicalLabelHashPath: index6().using("gin", t.canonicalLabelHashPath),
|
|
1831
1977
|
// hash index for resolver-record → canonical-domain joins
|
|
1832
|
-
byCanonicalNode:
|
|
1978
|
+
byCanonicalNode: index6().using("hash", t.canonicalNode),
|
|
1833
1979
|
// btree for ORDER BY canonical_depth (typeahead and DEPTH-ordered browse)
|
|
1834
|
-
byCanonicalDepth:
|
|
1980
|
+
byCanonicalDepth: index6().on(t.canonicalDepth),
|
|
1835
1981
|
// Composites for `WHERE registry_id = X ORDER BY <latest registration value> LIMIT N`
|
|
1836
1982
|
// (REGISTRATION_TIMESTAMP / REGISTRATION_EXPIRY ordering in find-domains queries). The latest
|
|
1837
1983
|
// registration's start/expiry is mirrored onto the Domain row (see `__latestRegistration*`) so
|
|
@@ -1839,12 +1985,12 @@ var domain = onchainTable6(
|
|
|
1839
1985
|
// `registrations` followed by a sort. The columns are NOT NULL (absent → `REGISTRATION_SORT_SENTINEL`),
|
|
1840
1986
|
// so a single plain composite per column serves both ASC and DESC (forward / backward scan) with
|
|
1841
1987
|
// a plain keyset tuple — see find-domains-resolver-helpers.ts.
|
|
1842
|
-
byRegistryAndLatestRegistrationStart:
|
|
1988
|
+
byRegistryAndLatestRegistrationStart: index6().on(
|
|
1843
1989
|
t.registryId,
|
|
1844
1990
|
t.__latestRegistrationStart,
|
|
1845
1991
|
t.id
|
|
1846
1992
|
),
|
|
1847
|
-
byRegistryAndLatestRegistrationExpiry:
|
|
1993
|
+
byRegistryAndLatestRegistrationExpiry: index6().on(
|
|
1848
1994
|
t.registryId,
|
|
1849
1995
|
t.__latestRegistrationExpiry,
|
|
1850
1996
|
t.id
|
|
@@ -1887,7 +2033,7 @@ var registrationType = onchainEnum2("RegistrationType", [
|
|
|
1887
2033
|
"ENSv2RegistryRegistration",
|
|
1888
2034
|
"ENSv2RegistryReservation"
|
|
1889
2035
|
]);
|
|
1890
|
-
var registration =
|
|
2036
|
+
var registration = onchainTable7(
|
|
1891
2037
|
"registrations",
|
|
1892
2038
|
(t) => ({
|
|
1893
2039
|
// keyed by (domainId, registrationIndex)
|
|
@@ -1959,7 +2105,7 @@ var registration_relations = relations4(registration, ({ one, many }) => ({
|
|
|
1959
2105
|
references: [event.id]
|
|
1960
2106
|
})
|
|
1961
2107
|
}));
|
|
1962
|
-
var latestRegistrationIndex =
|
|
2108
|
+
var latestRegistrationIndex = onchainTable7("latest_registration_indexes", (t) => ({
|
|
1963
2109
|
domainId: t.text().primaryKey().$type(),
|
|
1964
2110
|
registrationIndex: t.integer().notNull()
|
|
1965
2111
|
}));
|
|
@@ -1970,7 +2116,7 @@ var latestRegistrationIndex_relations = relations4(latestRegistrationIndex, ({ o
|
|
|
1970
2116
|
references: [domain.id]
|
|
1971
2117
|
})
|
|
1972
2118
|
}));
|
|
1973
|
-
var renewal =
|
|
2119
|
+
var renewal = onchainTable7(
|
|
1974
2120
|
"renewals",
|
|
1975
2121
|
(t) => ({
|
|
1976
2122
|
// keyed by (registrationId, index)
|
|
@@ -2006,7 +2152,7 @@ var renewal_relations = relations4(renewal, ({ one }) => ({
|
|
|
2006
2152
|
references: [event.id]
|
|
2007
2153
|
})
|
|
2008
2154
|
}));
|
|
2009
|
-
var latestRenewalIndex =
|
|
2155
|
+
var latestRenewalIndex = onchainTable7(
|
|
2010
2156
|
"latest_renewal_indexes",
|
|
2011
2157
|
(t) => ({
|
|
2012
2158
|
domainId: t.text().notNull().$type(),
|
|
@@ -2022,7 +2168,7 @@ var latestRenewalIndex_relations = relations4(latestRenewalIndex, ({ one }) => (
|
|
|
2022
2168
|
references: [domain.id]
|
|
2023
2169
|
})
|
|
2024
2170
|
}));
|
|
2025
|
-
var permissions =
|
|
2171
|
+
var permissions = onchainTable7(
|
|
2026
2172
|
"permissions",
|
|
2027
2173
|
(t) => ({
|
|
2028
2174
|
id: t.text().primaryKey().$type(),
|
|
@@ -2037,7 +2183,7 @@ var relations_permissions = relations4(permissions, ({ many }) => ({
|
|
|
2037
2183
|
resources: many(permissionsResource),
|
|
2038
2184
|
users: many(permissionsUser)
|
|
2039
2185
|
}));
|
|
2040
|
-
var permissionsResource =
|
|
2186
|
+
var permissionsResource = onchainTable7(
|
|
2041
2187
|
"permissions_resources",
|
|
2042
2188
|
(t) => ({
|
|
2043
2189
|
id: t.text().primaryKey().$type(),
|
|
@@ -2055,7 +2201,7 @@ var relations_permissionsResource = relations4(permissionsResource, ({ one }) =>
|
|
|
2055
2201
|
references: [permissions.chainId, permissions.address]
|
|
2056
2202
|
})
|
|
2057
2203
|
}));
|
|
2058
|
-
var permissionsUser =
|
|
2204
|
+
var permissionsUser = onchainTable7(
|
|
2059
2205
|
"permissions_users",
|
|
2060
2206
|
(t) => ({
|
|
2061
2207
|
id: t.text().primaryKey().$type(),
|
|
@@ -2089,7 +2235,7 @@ var relations_permissionsUser = relations4(permissionsUser, ({ one }) => ({
|
|
|
2089
2235
|
]
|
|
2090
2236
|
})
|
|
2091
2237
|
}));
|
|
2092
|
-
var label =
|
|
2238
|
+
var label = onchainTable7(
|
|
2093
2239
|
"labels",
|
|
2094
2240
|
(t) => ({
|
|
2095
2241
|
labelHash: t.hex().primaryKey().$type(),
|
|
@@ -2098,10 +2244,10 @@ var label = onchainTable6(
|
|
|
2098
2244
|
(t) => ({
|
|
2099
2245
|
// hash index avoids the btree 8191-byte row-size hazard for spam labels (a single label can
|
|
2100
2246
|
// exceed btree's leaf-size limit)
|
|
2101
|
-
byInterpretedExact:
|
|
2247
|
+
byInterpretedExact: index6().using("hash", t.interpreted),
|
|
2102
2248
|
// GIN trigram index for substring / similarity queries (inline `gin_trgm_ops` via `sql`
|
|
2103
2249
|
// because passing it through `.op()` gets dropped by Ponder)
|
|
2104
|
-
byInterpretedFuzzy:
|
|
2250
|
+
byInterpretedFuzzy: index6().using("gin", sql2`${t.interpreted} gin_trgm_ops`)
|
|
2105
2251
|
})
|
|
2106
2252
|
);
|
|
2107
2253
|
var label_relations = relations4(label, ({ many }) => ({
|
|
@@ -2235,7 +2381,7 @@ var ENSDB_SCHEMA_CHECKSUM = getDrizzleSchemaChecksum({
|
|
|
2235
2381
|
});
|
|
2236
2382
|
|
|
2237
2383
|
// src/client/ensdb-reader.ts
|
|
2238
|
-
import { and, eq } from "drizzle-orm/sql";
|
|
2384
|
+
import { and, eq, sql as sql3 } from "drizzle-orm/sql";
|
|
2239
2385
|
import {
|
|
2240
2386
|
buildIndexingMetadataContextUninitialized,
|
|
2241
2387
|
deserializeIndexingMetadataContext,
|
|
@@ -2375,6 +2521,15 @@ var EnsDbReader = class {
|
|
|
2375
2521
|
versionInfo
|
|
2376
2522
|
};
|
|
2377
2523
|
}
|
|
2524
|
+
/**
|
|
2525
|
+
* Check whether a Postgres schema with the given name exists in the ENSDb instance.
|
|
2526
|
+
*/
|
|
2527
|
+
async schemaExists(schemaName) {
|
|
2528
|
+
const result = await this.ensDb.execute(
|
|
2529
|
+
sql3`select 1 as exists from information_schema.schemata where schema_name = ${schemaName} limit 1`
|
|
2530
|
+
);
|
|
2531
|
+
return result.rows.length > 0;
|
|
2532
|
+
}
|
|
2378
2533
|
/**
|
|
2379
2534
|
* Get Indexing Metadata Context
|
|
2380
2535
|
*
|
|
@@ -2387,7 +2542,7 @@ var EnsDbReader = class {
|
|
|
2387
2542
|
if (!record) {
|
|
2388
2543
|
return buildIndexingMetadataContextUninitialized();
|
|
2389
2544
|
}
|
|
2390
|
-
return deserializeIndexingMetadataContext(record);
|
|
2545
|
+
return deserializeIndexingMetadataContext(record.value);
|
|
2391
2546
|
}
|
|
2392
2547
|
/**
|
|
2393
2548
|
* Destroy the ENSDbReader instance by closing the ENSDb connection pool.
|
|
@@ -2398,7 +2553,8 @@ var EnsDbReader = class {
|
|
|
2398
2553
|
/**
|
|
2399
2554
|
* Get ENSNode Metadata record
|
|
2400
2555
|
*
|
|
2401
|
-
* @returns
|
|
2556
|
+
* @returns the full `{ key, value }` record for the given key under this instance's
|
|
2557
|
+
* ENSIndexer Schema, or undefined if no such record exists.
|
|
2402
2558
|
* @throws when more than one matching metadata record is found
|
|
2403
2559
|
* (should be impossible given the composite PK constraint on
|
|
2404
2560
|
* 'ensIndexerSchemaName' and 'key')
|
|
@@ -2414,7 +2570,7 @@ var EnsDbReader = class {
|
|
|
2414
2570
|
return void 0;
|
|
2415
2571
|
}
|
|
2416
2572
|
if (result.length === 1 && result[0]) {
|
|
2417
|
-
return result[0].value;
|
|
2573
|
+
return { key: result[0].key, value: result[0].value };
|
|
2418
2574
|
}
|
|
2419
2575
|
throw new Error(
|
|
2420
2576
|
`There must be exactly one ENSNodeMetadata record for ('${this.ensIndexerSchemaName}', '${metadata2.key}') composite key`
|
|
@@ -2450,8 +2606,8 @@ var EnsDbReader = class {
|
|
|
2450
2606
|
};
|
|
2451
2607
|
|
|
2452
2608
|
// src/client/ensdb-writer.ts
|
|
2453
|
-
import { sql as sql3 } from "drizzle-orm";
|
|
2454
2609
|
import { migrate } from "drizzle-orm/node-postgres/migrator";
|
|
2610
|
+
import { sql as sql4 } from "drizzle-orm/sql";
|
|
2455
2611
|
import {
|
|
2456
2612
|
serializeIndexingMetadataContext
|
|
2457
2613
|
} from "@ensnode/ensnode-sdk";
|
|
@@ -2487,30 +2643,50 @@ var EnsDbWriter = class _EnsDbWriter extends EnsDbReader {
|
|
|
2487
2643
|
*/
|
|
2488
2644
|
async migrateEnsNodeSchema(migrationsDirPath) {
|
|
2489
2645
|
await this.drizzleClient.transaction(async (tx) => {
|
|
2490
|
-
await tx.execute(
|
|
2646
|
+
await tx.execute(sql4`SELECT pg_advisory_xact_lock(${_EnsDbWriter.MIGRATION_LOCK_ID})`);
|
|
2491
2647
|
await migrate(tx, {
|
|
2492
2648
|
migrationsFolder: migrationsDirPath,
|
|
2493
2649
|
migrationsSchema: "ensnode"
|
|
2494
2650
|
});
|
|
2495
2651
|
});
|
|
2496
2652
|
}
|
|
2653
|
+
/**
|
|
2654
|
+
* Drop a Postgres schema (and everything in it) from the ENSDb instance, if it exists.
|
|
2655
|
+
*/
|
|
2656
|
+
async dropSchema(schemaName) {
|
|
2657
|
+
await this.ensDb.execute(sql4`drop schema if exists ${sql4.identifier(schemaName)} cascade`);
|
|
2658
|
+
}
|
|
2659
|
+
/**
|
|
2660
|
+
* Rename a Postgres schema within the ENSDb instance.
|
|
2661
|
+
*
|
|
2662
|
+
* The Postgres schema name does not affect Ponder's build_id, so renaming a restored ENSIndexer
|
|
2663
|
+
* schema is safe for resume.
|
|
2664
|
+
*/
|
|
2665
|
+
async renameSchema(fromSchemaName, toSchemaName) {
|
|
2666
|
+
await this.ensDb.execute(
|
|
2667
|
+
sql4`alter schema ${sql4.identifier(fromSchemaName)} rename to ${sql4.identifier(toSchemaName)}`
|
|
2668
|
+
);
|
|
2669
|
+
}
|
|
2497
2670
|
/**
|
|
2498
2671
|
* Upsert Indexing Metadata Context Initialized
|
|
2499
2672
|
*
|
|
2500
2673
|
* @throws when upsert operation failed.
|
|
2501
2674
|
*/
|
|
2502
2675
|
async upsertIndexingMetadataContext(indexingMetadataContext) {
|
|
2503
|
-
await this.
|
|
2676
|
+
await this.writeEnsNodeMetadata({
|
|
2504
2677
|
key: EnsNodeMetadataKeys.IndexingMetadataContext,
|
|
2505
2678
|
value: serializeIndexingMetadataContext(indexingMetadataContext)
|
|
2506
2679
|
});
|
|
2507
2680
|
}
|
|
2508
2681
|
/**
|
|
2509
|
-
*
|
|
2682
|
+
* Write (upsert) an ENSNode metadata record under this instance's ENSIndexer Schema.
|
|
2510
2683
|
*
|
|
2511
|
-
* @
|
|
2684
|
+
* Re-keys the record to this writer's {@link ensIndexerSchemaName}, so metadata read from one
|
|
2685
|
+
* ENSIndexer Schema can be written under a different (e.g. renamed) one.
|
|
2686
|
+
*
|
|
2687
|
+
* @throws when the upsert operation failed.
|
|
2512
2688
|
*/
|
|
2513
|
-
async
|
|
2689
|
+
async writeEnsNodeMetadata(metadata2) {
|
|
2514
2690
|
await this.ensDb.insert(this.ensNodeSchema.metadata).values({
|
|
2515
2691
|
ensIndexerSchemaName: this.ensIndexerSchemaName,
|
|
2516
2692
|
key: metadata2.key,
|