Add serve-hedera-contract-as-graphql snippet — bridge Hedera into The Graph tooling - #52
Open
mrarejimmyz wants to merge 1 commit into
Open
mrarejimmyz wants to merge 1 commit into
mrarejimmyz wants to merge 1 commit into
Conversation
Bridges Hedera Mirror Node into standardized-subgraph GraphQL shape so Hedera contracts can be queried by any Graph-native tool (subgraph MCP servers, playgrounds, GraphiQL, subgraph explorers). The Graph doesn't index Hedera (verified via the official networks registry — 129 EVM chains supported, Hedera not among them). Mirror Node already indexes every contract event with sub-second consensus, but speaks REST/JSON. This snippet is the ~200 LOC of glue. - Self-contained: `npm install && node index.mjs` — no external services - ERC-4626 preset: any vault that emits Deposited/Withdrawn events gets the whole Messari-standardized query surface for free (pools, transactions, _meta) - Runs out-of-the-box against a live ZkWard testnet vault; set VAULT_ADDRESS to point at your own contract - Same query shape works against a Studio-hosted subgraph AND this endpoint — proof that the schema abstracts over indexing backends Extended library with more presets + HCS-attestation add-ons lives at github.com/ZkVanguard/zkward-ethglobal (packages/hedera-graphql-adapter).
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try the Wiz Code extension for VS Code, JetBrains, or Visual Studio. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
serve-hedera-contract-as-graphql/— self-contained snippet that exposes any Hedera contract as a standardized-subgraph GraphQL endpoint via Mirror Nodenpm install && node index.mjsDeposited(address indexed, uint256, uint256)+Withdrawn(...)gets the full Messari-standardized query surface (pools,transactions,_meta) for freeWhy
The Graph doesn't index Hedera. I verified this against the official networks registry: 129 EVM chains supported, Hedera not among them (as of 2026-09-07). Any Hedera dApp that wants "subgraph playground for our users", "AI agent that queries our contract state", or just "GraphQL instead of REST" ends up hand-rolling a Mirror Node client.
Meanwhile Hedera Mirror Node already indexes every contract event on Hedera for free with sub-second consensus. All the raw material is there — nothing turns it into subgraph-shaped GraphQL. This snippet is the missing glue.
Result: all Graph-native tooling — subgraph MCP servers, playgrounds, GraphiQL, subgraph explorers — works over Hedera contracts unchanged.
What ships
index.mjs— Express server exposingPOST /graphql+GET /graphql/sdladapter.mjs— self-contained bundled adapter (Mirror Node client + GraphQL executor + ERC-4626 preset)README.md— 60-second quickstart + "same query, both backends" demopackage.json— onlyexpress+graphqlpeer deps.env.example—HEDERA_NETWORK,VAULT_ADDRESS,PORTDefault
VAULT_ADDRESSpoints at a live public testnet vault so the snippet runs out-of-the-box with real data — no faucet or contract deploy needed.Verified working
Same query works against a Studio-hosted subgraph on any of the 129 supported EVM chains — one schema, N backends. That's the "one query pattern spans many protocols" pattern extended to include Hedera.
Extended library
The snippet bundles the adapter inline to stay self-contained per repo convention. The upstream package with more presets, TypeScript types, and optional HCS-attestation add-ons for AI-agent trust chains lives at:
@zkward/hedera-graphql-adaptermcp/zkward-vaults— Claude Desktop / Cursor tool that queries this shape across multiple backendsTest plan
npm installsucceeds on fresh clonenode index.mjsstarts server on :4000POST /graphqlreturns real vault state from Mirror NodeGET /graphql/sdlreturns the standardized schemaRelated