Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
369353c
Setup database dependencies
tk-o Mar 1, 2026
90ebd28
Create `EnsDbClient` for ENSIndexer
tk-o Mar 1, 2026
3548040
Add unit tests for `EnsDbClient`
tk-o Mar 1, 2026
df97f7e
Apply singleton file imports
tk-o Mar 1, 2026
b0a189d
Create `EnsDbWriterWorker`
tk-o Mar 1, 2026
ef35eeb
Cover `EnsDbWriterWorker` with unit tests`
tk-o Mar 1, 2026
4233232
Integrate `EnsDbWriterWorker` with ENSIndexer runtime
tk-o Mar 1, 2026
a96ee07
Merge remote-tracking branch 'origin/main' into feat/ensdb-writer-wor…
tk-o Mar 2, 2026
09d4cfe
Improve ENSDb Writer Worker lifecycle management
tk-o Mar 2, 2026
e8e5d01
docs(changeset): Introduced `EnsDbClient` and `EnsDbWriterWorker` to …
tk-o Mar 2, 2026
bdb9da3
Apply AI PR feedback
tk-o Mar 2, 2026
cfd0508
Update code docs as per PR feedback
tk-o Mar 3, 2026
e1aa937
Create a separate entrypoint file for ENSDb Writer Worker
tk-o Mar 3, 2026
8ebe95f
Simplify ENSDb Writer Worker
tk-o Mar 3, 2026
abe2d6c
Update tests for ENSDb Writer Worker to follow simplified implementation
tk-o Mar 3, 2026
cfbb6d0
Include `p-retry` tooling in ENSIndexer
tk-o Mar 3, 2026
5d720c3
Apply retries mechanism directly on the ENSIndexer Public Config fetc…
tk-o Mar 3, 2026
548b0f7
Update tests for ENSDb Writer Worker to follow simplified implementation
tk-o Mar 3, 2026
5a81673
Update code docs as per PR feedback
tk-o Mar 3, 2026
9dced07
Apply AI PR feedback
tk-o Mar 3, 2026
fef06d7
Apply AI PR feedback
tk-o Mar 3, 2026
cacea45
Apply AI PR feedback
tk-o Mar 3, 2026
09d2b8e
Simplify startEnsDbWriterWorker
tk-o Mar 3, 2026
cb70797
Update apps/ensindexer/src/lib/ensdb-writer-worker/singleton.ts
tk-o Mar 3, 2026
f608c31
Apply PR feedback
tk-o Mar 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changeset/afraid-ducks-strive.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"ensindexer": minor
---

Introduced `EnsDbClient` and `EnsDbWriterWorker` to enable storing ENSNode metadata in ENSDb.
Introduced `EnsDbClient` and `EnsDbWriterWorker` to enable storing metadata in ENSDb.
2 changes: 1 addition & 1 deletion apps/ensapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"graphql-yoga": "^5.16.0",
"hono": "catalog:",
"p-memoize": "^8.0.0",
"p-retry": "^7.1.0",
"p-retry": "catalog:",
"pg-connection-string": "catalog:",
"pino": "catalog:",
"ponder-enrich-gql-docs-middleware": "^0.1.3",
Expand Down
1 change: 1 addition & 0 deletions apps/ensindexer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"dns-packet": "^5.6.1",
"drizzle-orm": "catalog:",
"pg-connection-string": "catalog:",
"p-retry": "catalog:",
"hono": "catalog:",
"ponder": "catalog:",
"viem": "catalog:",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// This file is the entry point for the ENSDb Writer Worker.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest to move all the ideas here (including this nice comment) into apps/ensindexer/ponder/src/api/index.ts

Goal: Not a fan of the import "./ensdb-writer-worker-entrypoint"; in that index.ts file because it's not so explicit what importing it does.

The call to startEnsDbWriterWorker can be in index.ts too which feels natural.

// It must be placed inside the `api` directory of the Ponder app to avoid
// the following build issue:
// Error: Invalid dependency graph. Config, schema, and indexing function files
// cannot import objects from the API function file "src/api/index.ts".

import { startEnsDbWriterWorker } from "@/lib/ensdb-writer-worker/singleton";

startEnsDbWriterWorker();
Comment thread
tk-o marked this conversation as resolved.
Outdated
Comment thread
tk-o marked this conversation as resolved.
Outdated
3 changes: 0 additions & 3 deletions apps/ensindexer/ponder/src/api/handlers/ensnode-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,10 @@ import {
} from "@ensnode/ensnode-sdk";

import { buildENSIndexerPublicConfig } from "@/config/public";
import { startEnsDbWriterWorker } from "@/lib/ensdb-writer-worker/singleton";
import { indexingStatusBuilder } from "@/lib/indexing-status-builder/singleton";

const app = new Hono();

startEnsDbWriterWorker();

// include ENSIndexer Public Config endpoint
app.get("/config", async (c) => {
// prepare the public config object, including dependency info
Expand Down
1 change: 1 addition & 0 deletions apps/ensindexer/ponder/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { cors } from "hono/cors";
import type { ErrorResponse } from "@ensnode/ensnode-sdk";

import ensNodeApi from "./handlers/ensnode-api";
import "./ensdb-writer-worker-entrypoint";

const app = new Hono();

Expand Down
6 changes: 4 additions & 2 deletions apps/ensindexer/src/lib/ensdb-client/drizzle.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// This file was copied 1-to-1 from ENSApi.

// This file is based on `packages/ponder-subgraph/src/drizzle.ts` file.
// We currently duplicate the makeDrizzle function, as we don't have
// a shared package for backend code yet. When we do, we can move
// this function to the shared package and import it in both places.
import { setDatabaseSchema } from "@ponder/client";
import { drizzle } from "drizzle-orm/node-postgres";

Expand Down
5 changes: 3 additions & 2 deletions apps/ensindexer/src/lib/ensdb-client/ensdb-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ interface DrizzleDb extends NodePgDatabase<typeof schema> {}
*
* This client exists to provide an abstraction layer for interacting with ENSDb.
* It enables ENSIndexer and ENSApi to decouple from each other, and use
* the ENSDb Client as the integration point between the two.
* ENSDb as the integration point between the two (via ENSDb Client).
*
* Enables querying and mutating ENSDb data, such as:
* - ENSDb version
Expand Down Expand Up @@ -146,7 +146,8 @@ export class EnsDbClient implements EnsDbClientQuery, EnsDbClientMutation {
* Get ENSNode metadata record
*
* @returns selected record in ENSDb.
Comment thread
tk-o marked this conversation as resolved.
* @throws when exactly one matching metadata record was not found
* @throws when more than one matching metadata record is found
* (should be impossible given the PK constraint on 'key')
*/
Comment thread
tk-o marked this conversation as resolved.
private async getEnsNodeMetadata<EnsNodeMetadataType extends SerializedEnsNodeMetadata>(
metadata: Pick<EnsNodeMetadataType, "key">,
Expand Down
Loading