-
Notifications
You must be signed in to change notification settings - Fork 16
Integrate ENSDb SDK into ENSIndexer #1798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
2e5c6a6
d3329fd
a844af0
316fe67
90ff103
72e1f9b
2df0ab2
8357285
b66c443
187a3b5
bcc1784
6c82714
8edabdd
24f2d1b
45eea13
4b20c50
4e216f4
3b3882b
83cf6cf
f03192e
f0c7f1f
54301fc
a3dbb6b
9eeb935
0534ef3
132eca8
e527292
121efd5
6145e50
d5f7c3f
c5397bc
5ac0060
593cbb8
ba48daa
0adcd14
219b7bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,10 @@ | ||
| // export database schema definition for ENSIndexer | ||
| /** | ||
| * Export database schema definition for ENSIndexer | ||
| * Note: Ponder uses `globalThis.PONDER_NAMESPACE_BUILD.schema` value to | ||
| * dynamically build the "concrete" ENSIndexer Schema definition | ||
| * from the "abstract" ENSIndexer Schema definition for Ponder app to use. | ||
|
tk-o marked this conversation as resolved.
Outdated
|
||
| * | ||
| * @see https://github.com/ponder-sh/ponder/blob/c8f6935fb65176c01b40cae9056be704c0e5318e/packages/core/src/build/index.ts#L380-L424 | ||
| * @see https://github.com/ponder-sh/ponder/blob/6fcc15d4234e43862cb6e21c05f3c57f4c2f7464/packages/core/src/drizzle/onchain.ts#L280-L281 | ||
| **/ | ||
| export * from "@ensnode/ensdb-sdk/ensindexer"; | ||
|
tk-o marked this conversation as resolved.
Outdated
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,13 +10,13 @@ import { | |
| serializeIndexingStatusResponse, | ||
| } from "@ensnode/ensnode-sdk"; | ||
|
|
||
| import { ensDbClient } from "@/lib/ensdb/singleton"; | ||
| import { ensDbWriter } from "@/lib/ensdb/singleton"; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i realize that the writer inherits reader, but it still reads oddly to see
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried Alternative approach would be for the writer class to use the reader class for internal reads. So it'd be composition over inheritance. In that case, we'd have two objects:
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @shrugs Agreed with your feedback here. @tk-o I'm trying to remember what the motivation was for us to split the reader / writer into different classes? Was it because of something related to how only the writer needs to do database migrations? But I think the database migrations is already extracted out of the class now? If there's a nice way to merge the reader / writer into the same class then I'm happy to do it.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lightwalker-eth the original motivation was described in this slack message.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we could just update the const name that is exported from
How does that sound?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That sounds good 👍 |
||
|
|
||
| const app = new Hono(); | ||
|
|
||
| // include ENSIndexer Public Config endpoint | ||
| app.get("/config", async (c) => { | ||
| const publicConfig = await ensDbClient.getEnsIndexerPublicConfig(); | ||
| const publicConfig = await ensDbWriter.getEnsIndexerPublicConfig(); | ||
|
|
||
| // Invariant: the public config is guaranteed to be available in ENSDb after | ||
| // application startup. | ||
|
|
@@ -30,7 +30,7 @@ app.get("/config", async (c) => { | |
|
|
||
| app.get("/indexing-status", async (c) => { | ||
| try { | ||
| const crossChainSnapshot = await ensDbClient.getIndexingStatusSnapshot(); | ||
| const crossChainSnapshot = await ensDbWriter.getIndexingStatusSnapshot(); | ||
|
|
||
| // Invariant: the Indexing Status Snapshot is expected to be available in | ||
| // ENSDb shortly after application startup. There is a possibility that | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.