Skip to content

Migrate subgraph queries from The Graph to Envio HyperIndex#70

Open
hernandoagf wants to merge 8 commits intodevelopmentfrom
feature/subgraphs-migration
Open

Migrate subgraph queries from The Graph to Envio HyperIndex#70
hernandoagf wants to merge 8 commits intodevelopmentfrom
feature/subgraphs-migration

Conversation

@hernandoagf
Copy link
Contributor

What does this PR do?

Migrates all subgraph queries from The Graph to Envio HyperIndex, replacing the previous GraphQL API with Envio's Hasura-based query format.

Key changes:

  • Rewrites all GraphQL queries in modules/gql/queries/subgraph/ to use Envio's Hasura syntax (_eq, _in, _nin, order_by, limit/offset, etc.)
  • Entity IDs in Envio are prefixed with {chainId}- (e.g., 1-0xabc...), so queries that filter by ID now prefix addresses accordingly
  • Adds a stripChainIdPrefix utility in gqlUtils.ts and then replaces most usages with new Envio plain-address fields (entity.address / entity.pollId) for cleaner code
  • Updates gql.constants.ts to point to Envio HyperIndex endpoints instead of The Graph
  • Updates network configuration to support the new subgraph URLs
  • Removes unused code: fetchAllLocksSummed, ParticipationChart, allLocksSummed query, and the /api/executive/all-locks endpoint
  • Adds pollId field to the SubgraphPoll type

Steps for testing

  1. Delegates page — Verify delegate list loads correctly with proper addresses, SKY delegated amounts, and last vote dates
  2. Single delegate page — Check delegation history, delegator list, and executive support data
  3. Polling page — Confirm polls load with correct IDs, start/end dates, and metadata
  4. Poll detail page — Verify vote tally displays voters with correct addresses and SKY weights
  5. Executive page — Check that executive vote tallies show correct spell addresses and voter breakdowns
  6. Account page — Verify "delegated to" section and current votes display correctly
  7. API endpoints — Test /api/delegates/[address]/delegator/[delegatorAddress]/history returns correct delegate addresses

hernandoagf and others added 2 commits February 27, 2026 13:25
Replace all per-chain subgraph URLs with a single Envio HyperIndex endpoint
and convert all GraphQL queries to Hasura syntax. Entity IDs are now prefixed
with chainId, so all fetch functions strip prefixes where needed. Also removes
legacy allLocksSummed (spock indexer), its API endpoint, and the unused
ParticipationChart component.
Replace stripChainIdPrefix(entity.id) calls with direct field access
using new Envio HyperIndex fields (entity.address / entity.pollId),
making the code cleaner and removing unnecessary string manipulation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sky-governance-portal Ready Ready Preview, Comment Mar 6, 2026 6:22pm

Request Review

hernandoagf and others added 2 commits March 2, 2026 14:02
Envio indexer stores addresses as plain strings with inconsistent
casing across chains (checksummed vs lowercase). Using _ilike instead
of _eq ensures address filters match regardless of case.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ries

Replace _in/_nin with _or/_and using _ilike/_nilike for address fields,
and convert Delegate_by_pk lookups to regular queries with _ilike to
handle inconsistent address casing across chains in the Envio indexer.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants