-
Notifications
You must be signed in to change notification settings - Fork 17
Optimise docs for Unigraph examples #2202
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a83d810
Update docs for Unigraph examples
tk-o 5ab3e68
Apply AI PR feedback
tk-o 3d9881c
Apply AI PR feedback
tk-o 22012e2
Merge remote-tracking branch 'origin/main' into docs/improve-unigraph…
tk-o 7ec98c5
Apply AI PR feedback
tk-o 2571cf2
Merge branch 'main' into docs/improve-unigraph-examples-content
lightwalker-eth a54d9e6
apply suggestion
lightwalker-eth d0d729d
Merge remote-tracking branch 'origin/main' into docs/improve-unigraph…
tk-o 3b4987b
Apply PR feedback
tk-o 1267a7f
Merge branch 'docs/improve-unigraph-examples-content' of github.com:n…
tk-o File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
docs/ensnode.io/src/components/molecules/EnsDbReaderIntro.astro
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| --- | ||
| import { Aside } from "@astrojs/starlight/components"; | ||
| --- | ||
|
|
||
| <Aside type="note" title="Using ENSDb Reader"> | ||
| See how to connect to ENSDb and get access to the <code>ensDb</code> query builder and <code | ||
| >ensIndexerSchema</code | ||
| > | ||
| schema definition in the <a href="/docs/integrate/unigraph/examples">Connect</a> section if you haven't | ||
| already. | ||
| </Aside> | ||
22 changes: 22 additions & 0 deletions
22
docs/ensnode.io/src/components/molecules/EnsIndexerSchemaIntro.astro
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| --- | ||
| import { Aside } from "@astrojs/starlight/components"; | ||
|
|
||
| const { ensIndexerSchemaName = "ensindexer_0" } = Astro.props; | ||
| --- | ||
|
|
||
| <Aside type="note" title="What is ENSIndexer Schema?"> | ||
|
tk-o marked this conversation as resolved.
Outdated
|
||
| <p> | ||
| The <a href="/docs/services/ensdb/concepts/glossary#ensindexer-schema">ENSIndexer Schema</a> is a | ||
|
tk-o marked this conversation as resolved.
Outdated
|
||
| database schema within an <a href="/docs/services/ensdb/concepts/glossary#ensdb-instance" | ||
| >ENSDb instance</a | ||
| >, used to store indexed ENS data from a given <a | ||
| href="/docs/services/ensdb/concepts/glossary#ensindexer-instance">ENSIndexer instance</a | ||
| >. We use <code>{ensIndexerSchemaName}</code> as the <a | ||
| href="/docs/services/ensdb/concepts/glossary#ensindexer-schema-name">ENSIndexer Schema Name</a | ||
| > in examples on this page, but your <a | ||
| href="/docs/services/ensdb/concepts/glossary#ensindexer-instance">ENSIndexer instance</a | ||
| > may be configured to use a different schema name. Make sure to replace <code | ||
|
tk-o marked this conversation as resolved.
Outdated
|
||
| >{ensIndexerSchemaName}</code | ||
| > with the actual schema name used by your ENSIndexer instance when querying the ENSDb instance directly. | ||
| </p> | ||
| </Aside> | ||
14 changes: 14 additions & 0 deletions
14
docs/ensnode.io/src/components/molecules/EnsNodeSchemaIntro.astro
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| --- | ||
| import { Aside } from "@astrojs/starlight/components"; | ||
|
|
||
| const ensNodeSchemaName = "ensnode"; | ||
| --- | ||
|
|
||
| <Aside type="note" title="What is ENSNode Schema?"> | ||
| The <a href="/docs/services/ensdb/concepts/glossary#ensnode-schema">ENSNode Schema</a> is a database | ||
| schema within an <a href="/docs/services/ensdb/concepts/glossary#ensdb-instance">ENSDb instance</a | ||
| >, used to store metadata about <a | ||
| href="/docs/services/ensdb/concepts/glossary#ensindexer-instance">ENSIndexer instances</a | ||
| > that have ever connected to the ENSDb instance. There can be only one ENSNode Schema per ENSDb instance, | ||
| and its name is always <code>{ensNodeSchemaName}</code>. | ||
| </Aside> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| const { value, title = "Result" } = Astro.props; | ||
|
tk-o marked this conversation as resolved.
Outdated
|
||
| --- | ||
|
|
||
| <details> | ||
| <summary>{title}</summary> | ||
| <pre class="overflow-x-auto"><code>{JSON.stringify(value, null, 2)}</code></pre> | ||
| </details> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,16 @@ sidebar: | |
| --- | ||
|
|
||
| import { Tabs, TabItem } from "@astrojs/starlight/components"; | ||
| import ResultDetails from "@components/molecules/ResultDetails.astro"; | ||
| import EnsIndexerSchemaIntro from "@components/molecules/EnsIndexerSchemaIntro.astro"; | ||
| import EnsDbReaderIntro from "@components/molecules/EnsDbReaderIntro.astro"; | ||
|
|
||
| export const resultJson = [ | ||
|
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. This example result is not interesting and doesn't communicate the big idea of the whole example. A proper example needs to include a count of ENSv2 domains too! |
||
| { | ||
| type: "ENSv1Domain", | ||
| count: 454, | ||
| }, | ||
| ]; | ||
|
|
||
| :::caution[`unigraph` plugin required] | ||
| Using the Unigraph SQL requires that you have the `unigraph` plugin activated in your ENSNode instance. [Learn more](/docs/services/ensindexer/usage/configuration) | ||
|
|
@@ -15,24 +25,32 @@ Count the Domains owned by an address, grouped by Domain `type` (`ENSv1Domain` v | |
|
|
||
| <Tabs syncKey="unigraph-client"> | ||
| <TabItem label="SQL"> | ||
| ```sql | ||
| SELECT type, count(*) FROM ensindexer_0.domains | ||
| WHERE owner_id = '0xd8da6bf26964af9d7eed9e03e53415d37aa96045' | ||
| GROUP BY type; | ||
| ``` | ||
| <EnsIndexerSchemaIntro ensIndexerSchemaName="ensindexer_0" /> | ||
|
|
||
| ```sql | ||
| SELECT type, count(*) FROM ensindexer_0.domains | ||
| WHERE owner_id = '0xd8da6bf26964af9d7eed9e03e53415d37aa96045' | ||
| GROUP BY type; | ||
| ``` | ||
|
|
||
| <ResultDetails value={resultJson} /> | ||
|
|
||
| </TabItem> | ||
|
tk-o marked this conversation as resolved.
|
||
|
|
||
| <TabItem label="ensdb-sdk (TypeScript)"> | ||
| ```typescript | ||
| import { count, eq } from 'drizzle-orm'; | ||
| <EnsDbReaderIntro /> | ||
|
|
||
| ```typescript | ||
| import { count, eq } from "drizzle-orm"; | ||
|
|
||
| const counts = await ensDb | ||
| .select({ type: ensIndexerSchema.domain.type, count: count() }) | ||
| .from(ensIndexerSchema.domain) | ||
| .where(eq(ensIndexerSchema.domain.ownerId, "0xd8da6bf26964af9d7eed9e03e53415d37aa96045")) | ||
| .groupBy(ensIndexerSchema.domain.type); | ||
| const counts = await ensDb | ||
| .select({ type: ensIndexerSchema.domain.type, count: count() }) | ||
| .from(ensIndexerSchema.domain) | ||
| .where(eq(ensIndexerSchema.domain.ownerId, "0xd8da6bf26964af9d7eed9e03e53415d37aa96045")) | ||
| .groupBy(ensIndexerSchema.domain.type); | ||
| ``` | ||
|
|
||
| ``` | ||
| <ResultDetails value={resultJson} /> | ||
|
|
||
| </TabItem> | ||
| </Tabs> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.