From 0e445fe3510d7ba07877aea01bd4886ce6f45388 Mon Sep 17 00:00:00 2001 From: sevenzing Date: Thu, 4 Jun 2026 17:35:52 +0300 Subject: [PATCH 01/11] add domain profile and domain raw records --- .../starlight/sidebar-topics/integrate.ts | 12 + .../fetch-omnigraph-example-responses.mts | 30 +- .../GraphqlStaticQueryExample.astro | 8 +- .../SdkStaticCodeExample.astro | 7 +- .../StaticExampleActionBar.astro | 8 +- .../StaticExamplePlaygroundHint.astro | 7 +- .../organisms/OmnigraphStaticExampleSet.astro | 6 +- .../src/content/docs/docs/integrate/index.mdx | 29 +- .../omnigraph/examples/account-events.mdx | 2 +- .../examples/account-primary-name.mdx | 9 + .../examples/account-resolver-permissions.mdx | 2 +- .../omnigraph/examples/domain-events.mdx | 2 +- .../omnigraph/examples/domain-profile.mdx | 9 + .../omnigraph/examples/domain-records.mdx | 9 + .../omnigraph/examples/domain-resolver.mdx | 2 +- .../omnigraph/examples/domain-subdomains.mdx | 2 +- .../omnigraph/examples/domains-by-address.mdx | 2 +- .../omnigraph/examples/find-domains.mdx | 2 +- .../omnigraph/examples/namegraph.mdx | 2 +- .../examples/permissions-by-contract.mdx | 2 +- .../examples/permissions-by-user.mdx | 2 +- .../omnigraph/examples/registry-domains.mdx | 2 +- .../omnigraph/protocol-acceleration.mdx | 4 - .../src/data/omnigraph-examples/examples.json | 66 +- .../src/data/omnigraph-examples/meta.ts | 23 +- .../data/omnigraph-examples/responses.json | 6928 ++++++++++++++--- .../data/omnigraph-examples/schema.graphql | 564 +- .../src/data/omnigraph-examples/snapshot.json | 6 +- .../src/lib/examples/omnigraph/constants.ts | 11 +- .../omnigraph/resolve-static-example.ts | 8 +- .../stackblitz/static/resolveProject.test.ts | 10 +- .../src/omnigraph-api/example-queries.ts | 161 +- packages/ensskills/skills/omnigraph/SKILL.md | 178 +- 33 files changed, 6687 insertions(+), 1428 deletions(-) create mode 100644 docs/ensnode.io/src/content/docs/docs/integrate/omnigraph/examples/account-primary-name.mdx create mode 100644 docs/ensnode.io/src/content/docs/docs/integrate/omnigraph/examples/domain-profile.mdx create mode 100644 docs/ensnode.io/src/content/docs/docs/integrate/omnigraph/examples/domain-records.mdx diff --git a/docs/ensnode.io/config/integrations/starlight/sidebar-topics/integrate.ts b/docs/ensnode.io/config/integrations/starlight/sidebar-topics/integrate.ts index 3ddf73517..e9bea5e1a 100644 --- a/docs/ensnode.io/config/integrations/starlight/sidebar-topics/integrate.ts +++ b/docs/ensnode.io/config/integrations/starlight/sidebar-topics/integrate.ts @@ -106,6 +106,14 @@ export const integrateSidebarTopic = { label: "Domain By Name", link: "/docs/integrate/omnigraph/examples/domain-by-name", }, + { + label: "Domain Profile", + link: "/docs/integrate/omnigraph/examples/domain-profile", + }, + { + label: "Domain Raw Records", + link: "/docs/integrate/omnigraph/examples/domain-records", + }, { label: "Find Domains", link: "/docs/integrate/omnigraph/examples/find-domains", @@ -118,6 +126,10 @@ export const integrateSidebarTopic = { label: "Domain Events", link: "/docs/integrate/omnigraph/examples/domain-events", }, + { + label: "Account Primary Name", + link: "/docs/integrate/omnigraph/examples/account-primary-name", + }, { label: "Account Domains", link: "/docs/integrate/omnigraph/examples/domains-by-address", diff --git a/docs/ensnode.io/scripts/fetch-omnigraph-example-responses.mts b/docs/ensnode.io/scripts/fetch-omnigraph-example-responses.mts index 5cb4de449..30646bc5e 100644 --- a/docs/ensnode.io/scripts/fetch-omnigraph-example-responses.mts +++ b/docs/ensnode.io/scripts/fetch-omnigraph-example-responses.mts @@ -10,10 +10,17 @@ function logStep(message: string, id?: string) { console.log(`[omnigraph-examples] ${message} ${id ? `for '${id}'` : ""}`); } +function logWarn(message: string, id?: string) { + console.warn(`[omnigraph-examples] WARN: ${message} ${id ? `for example '${id}'` : ""}`); +} + function logError(message: string, id?: string) { console.error(`[omnigraph-examples] ERROR: ${message} ${id ? `for example '${id}'` : ""}`); } +const TIMEOUT_MS = 120_000; +const WARN_THRESHOLD_MS = 5_000; + const dataDir = join(dirname(fileURLToPath(import.meta.url)), "../src/data/omnigraph-examples"); const examplesPath = join(dataDir, "examples.json"); const outputPath = join(dataDir, "responses.json"); @@ -72,11 +79,12 @@ for (const id of exampleIds) { const query = example.query.trim(); const variables = example.variables; + const started = performance.now(); const response = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ query, variables }), - signal: AbortSignal.timeout(120_000), + signal: AbortSignal.timeout(TIMEOUT_MS), }); if (!response.ok) { @@ -85,21 +93,23 @@ for (const id of exampleIds) { process.exit(1); } - const body = await response.json(); + const body = (await response.json()) as Record; + const durationMs = Math.round(performance.now() - started); - if ( - typeof body === "object" && - body !== null && - "errors" in body && - Array.isArray((body as { errors: unknown }).errors) && - (body as { errors: unknown[] }).errors.length > 0 - ) { + if ("errors" in body && Array.isArray(body.errors) && body.errors.length > 0) { logError(`GraphQL errors: ${JSON.stringify(body, null, 2)}`, id); process.exit(1); } + if (durationMs > WARN_THRESHOLD_MS) { + logWarn( + `Took ${durationMs}ms (threshold ${WARN_THRESHOLD_MS}ms). Omnigraph examples should stay fast. Consider changing input variables or simplifying the example query.`, + id, + ); + } + out[id] = body; - logStep("Success", id); + logStep(`Success in ${durationMs}ms`, id); } logStep(`Writing responses to ${outputPath}`); diff --git a/docs/ensnode.io/src/components/molecules/omnigraph-static-example/GraphqlStaticQueryExample.astro b/docs/ensnode.io/src/components/molecules/omnigraph-static-example/GraphqlStaticQueryExample.astro index eb2dc2ab2..7b67162bb 100644 --- a/docs/ensnode.io/src/components/molecules/omnigraph-static-example/GraphqlStaticQueryExample.astro +++ b/docs/ensnode.io/src/components/molecules/omnigraph-static-example/GraphqlStaticQueryExample.astro @@ -2,8 +2,6 @@ /** * Omnigraph panel: GraphQL request is query + variables; result is a separate output section. */ -import type { ENSNamespaceId } from "@ensnode/ensnode-sdk"; - import StaticExampleActionBar from "./StaticExampleActionBar.astro"; import StaticExampleCodeSection from "./StaticExampleCodeSection.astro"; import StaticExampleOutputSection from "./StaticExampleOutputSection.astro"; @@ -15,7 +13,7 @@ interface Props { responseJson: string | null; adminUrl: string; hostedInstanceDocUrl: string; - hostedInstanceNamespace: ENSNamespaceId; + hostedInstanceLabel: string; } const { @@ -25,7 +23,7 @@ const { responseJson, adminUrl, hostedInstanceDocUrl, - hostedInstanceNamespace, + hostedInstanceLabel, } = Astro.props; --- @@ -33,7 +31,7 @@ const { variant="ensadmin" adminUrl={adminUrl} hostedInstanceDocUrl={hostedInstanceDocUrl} - hostedInstanceNamespace={hostedInstanceNamespace} + hostedInstanceLabel={hostedInstanceLabel} /> ; responseJson: string | null; hostedInstanceDocUrl: string; - hostedInstanceNamespace: ENSNamespaceId; + hostedInstanceLabel: string; } const { @@ -57,7 +56,7 @@ const { setupSnippets, responseJson, hostedInstanceDocUrl, - hostedInstanceNamespace, + hostedInstanceLabel, } = Astro.props; const config = SDK_PANEL_CONFIG[integration]; @@ -74,7 +73,7 @@ const docsLinkClass = "underline underline-offset-2 hover:text-[var(--sl-color-t diff --git a/docs/ensnode.io/src/components/molecules/omnigraph-static-example/StaticExampleActionBar.astro b/docs/ensnode.io/src/components/molecules/omnigraph-static-example/StaticExampleActionBar.astro index b074cc0b1..4c9c27205 100644 --- a/docs/ensnode.io/src/components/molecules/omnigraph-static-example/StaticExampleActionBar.astro +++ b/docs/ensnode.io/src/components/molecules/omnigraph-static-example/StaticExampleActionBar.astro @@ -1,6 +1,4 @@ --- -import type { ENSNamespaceId } from "@ensnode/ensnode-sdk"; - import ENSAdminCTAButton from "@components/atoms/ENSAdminCTAButton.astro"; import StackBlitzLogo from "@components/atoms/logos/astro/StackBlitzLogo.astro"; @@ -10,11 +8,11 @@ interface Props { variant: "ensadmin" | "stackblitz"; adminUrl?: string; hostedInstanceDocUrl: string; - hostedInstanceNamespace: ENSNamespaceId; + hostedInstanceLabel: string; staticExampleId?: string; } -const { variant, adminUrl, hostedInstanceDocUrl, hostedInstanceNamespace, staticExampleId } = +const { variant, adminUrl, hostedInstanceDocUrl, hostedInstanceLabel, staticExampleId } = Astro.props; const actionBarClass = @@ -37,6 +35,6 @@ const actionButtonClass = diff --git a/docs/ensnode.io/src/components/molecules/omnigraph-static-example/StaticExamplePlaygroundHint.astro b/docs/ensnode.io/src/components/molecules/omnigraph-static-example/StaticExamplePlaygroundHint.astro index 17d8908e7..102a80e01 100644 --- a/docs/ensnode.io/src/components/molecules/omnigraph-static-example/StaticExamplePlaygroundHint.astro +++ b/docs/ensnode.io/src/components/molecules/omnigraph-static-example/StaticExamplePlaygroundHint.astro @@ -1,13 +1,12 @@ --- -import type { ENSNamespaceId } from "@ensnode/ensnode-sdk"; interface Props { variant: "ensadmin" | "stackblitz"; hostedInstanceDocUrl: string; - hostedInstanceNamespace: ENSNamespaceId; + hostedInstanceLabel: string; } -const { variant, hostedInstanceDocUrl, hostedInstanceNamespace } = Astro.props; +const { variant, hostedInstanceDocUrl, hostedInstanceLabel } = Astro.props; const hostedInstanceLinkClass = "text-sm font-semibold text-[var(--sl-color-accent)] underline underline-offset-4 hover:underline-offset-2 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--sl-color-text-accent)] transition-[text-underline-offset] duration-200"; @@ -19,7 +18,7 @@ const hostedInstanceLinkClass = <> Open an interactive playground to execute this example on our{" "} - {hostedInstanceNamespace} + {hostedInstanceLabel} {" "} ENSNode instance. diff --git a/docs/ensnode.io/src/components/organisms/OmnigraphStaticExampleSet.astro b/docs/ensnode.io/src/components/organisms/OmnigraphStaticExampleSet.astro index adfbbacc5..da6c0e9fa 100644 --- a/docs/ensnode.io/src/components/organisms/OmnigraphStaticExampleSet.astro +++ b/docs/ensnode.io/src/components/organisms/OmnigraphStaticExampleSet.astro @@ -82,7 +82,7 @@ const data = resolveOmnigraphStaticExample(id); responseJson={data.responseJson} adminUrl={data.adminUrl} hostedInstanceDocUrl={data.hostedInstanceDocUrl} - hostedInstanceNamespace={data.hostedInstanceNamespace} + hostedInstanceLabel={data.hostedInstanceLabel} /> ) : null} {panel === "enssdk" ? ( @@ -94,7 +94,7 @@ const data = resolveOmnigraphStaticExample(id); setupSnippets={data.enssdkSetupSnippets} responseJson={data.responseJson} hostedInstanceDocUrl={data.hostedInstanceDocUrl} - hostedInstanceNamespace={data.hostedInstanceNamespace} + hostedInstanceLabel={data.hostedInstanceLabel} /> ) : null} {panel === "enskit" ? ( @@ -106,7 +106,7 @@ const data = resolveOmnigraphStaticExample(id); setupSnippets={data.enskitSetupSnippets} responseJson={data.responseJson} hostedInstanceDocUrl={data.hostedInstanceDocUrl} - hostedInstanceNamespace={data.hostedInstanceNamespace} + hostedInstanceLabel={data.hostedInstanceLabel} /> ) : null} {panel === "curl" ? ( diff --git a/docs/ensnode.io/src/content/docs/docs/integrate/index.mdx b/docs/ensnode.io/src/content/docs/docs/integrate/index.mdx index 504f8b0b9..feb33321a 100644 --- a/docs/ensnode.io/src/content/docs/docs/integrate/index.mdx +++ b/docs/ensnode.io/src/content/docs/docs/integrate/index.mdx @@ -39,20 +39,33 @@ With `enssdk`, leverage ENSNode and the Omnigraph from any JavaScript runtime to ```ts title="example.ts" // create and extend an EnsNodeClient with Omnigraph API support -const client = createEnsNodeClient({ url: process.env.ENSNODE_URL! }).extend(omnigraph); +const client = createEnsNodeClient({ + url: process.env.ENSNODE_URL! + }) + .extend(omnigraph); // this is fully typechecked and supports editor autocomplete! const HelloWorldQuery = graphql(` query HelloWorld { - domain(by: { name: "eth" }) { + domain(by: { name: "vitalik.eth" }) { canonical { name { beautified } } owner { address } + resolve { + profile { + description + addresses { + ethereum + } + } + } } } `); // `result` is fully typed! -const result = await client.omnigraph.query({ query: HelloWorldQuery }); +const result = await client.omnigraph.query({ + query: HelloWorldQuery +}); ```