86ahp2bjc: migrate token distribution to Kubb SDK#1947
Conversation
…T SDK Replaces GraphQL client queries (useGetProposalsQuery, useTokenMetricsLazyQuery, useHistoricalTokenDataQuery) with their REST equivalents from @anticapture/client. Touches useProposals, useChartMetrics, useTimeSeriesData, and useDaoTokenHistoricalData. https://claude.ai/code/session_01Wr71Qt1BvADmKo8ZycQDar
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
🚅 Deployed to the anticapture-pr-1947 environment in anticapture-infra
14 services not affected by this PR
|
|
Dashboard E2E — investigation findings The E2E check has failed twice (consistently, not a flake). I've traced what changed but cannot see the Playwright output to confirm the exact error. Here's what I found: What this PR changes at the network level: After this migration those same hooks make REST calls through the Next.js proxy → Why that matters for E2E: The What to check:
All other CI checks (typecheck, lint, changeset, codegen) pass. Generated by Claude Code |
Remove identity map() in useDaoTokenHistoricalData since the schema already matches. Add lean: true to useProposals to omit descriptions. https://claude.ai/code/session_01Wr71Qt1BvADmKo8ZycQDar
…hangesets Update sitemap.test.ts assertions to expect lean:true in proposal fetches after collaborator added lean parameter to getAllProposalPages. Add changesets for @anticapture/gateful and @anticapture/api-gateway as required by the api-contract-updates CI check. https://claude.ai/code/session_01Wr71Qt1BvADmKo8ZycQDar
… claude/funny-wozniak-nCq4e
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8ffc325c76
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…to token historical hook Restore sitemap.test.ts with lean:true assertions to cover the lean param added to getAllProposalPages. Adds refetch to useDaoTokenHistoricalData to align with the same hook in dev (PR #1941). https://claude.ai/code/session_01Wr71Qt1BvADmKo8ZycQDar
Summary
useGetProposalsQuery(GraphQL) withuseProposalsfrom@anticapture/client/hooksin the token-distribution feature hookuseTokenMetricsLazyQuery(GraphQL) with thetokenMetricsREST SDK function in the shareduseTimeSeriesDatahookuseHistoricalTokenDataQuery(GraphQL) withuseHistoricalTokenDatafrom@anticapture/client/hooksinuseDaoTokenHistoricalDatauseChartMetricsto use the new REST response shape (.itemsinstead of.proposals.items,isLoadinginstead ofloading)Approach
Each GraphQL query is mapped to its REST equivalent from the Kubb-generated
@anticapture/clientpackage:useGetProposalsQueryuseProposalsfrom@anticapture/client/hooksuseTokenMetricsLazyQuerytokenMetricsSDK function from@anticapture/clientuseHistoricalTokenDataQueryuseHistoricalTokenDatafrom@anticapture/client/hooksThe DAO identifier moves from an Apollo context header (
anticapture-dao-id) to a URL path parameter, which is the REST API pattern.Files changed and why
features/token-distribution/hooks/useProposals.ts— the only file in token-distribution that directly imported graphql-client; replaced with the Kubb hookfeatures/token-distribution/hooks/useChartMetrics.tsx— updated to use new return types:isLoading(React Query) instead ofloading(Apollo), anddata.itemsinstead ofdata.proposals.itemsshared/hooks/useTimeSeriesData.ts— shared hook that powered the token-metrics timeseries; migrated to call the REST SDK function in aPromise.allpreserving the existing manual state-machine patternfeatures/attack-profitability/hooks/useDaoTokenHistoricalData.ts— shared hook used by token-distribution for the TOKEN_PRICE metric; migrated touseHistoricalTokenData; returnsloading(mapped fromisLoading) to preserve backward compatibility with attack-profitability and panel callersAssumptions I made
TokenMetricItem.highandTokenMetricItem.volumeas strings at runtime (despite the Kubb type sayingbigintdue to the EthereumGenerator). The mapping code usesString(item.high)andString(item.volume)to safely convert to the localTokenMetricItemtype.useDaoTokenHistoricalDatais shared with attack-profitability and panel features; its external API (returning{ data, loading, error }) is preserved to avoid touching those callers.What I did NOT do
useDaoTokenHistoricalDatain attack-profitability or panel (backward-compatible)TokenMetricItemtype shape (kept asstringto avoid cascading changes to mocked data and other consumers)useTimeSeriesDatato useuseTokenMetricsReact Query hook — kept the manualuseCallback/useEffectpattern to preserve the refresh interval and parallel-fetch behaviourOpen questions for review
TokenMetricItemtype (high: string, volume: string) be updated to match the Kubb SDK type (high: bigint, volume: bigint)? This would allow removing theString()mapping inuseTimeSeriesData.useTimeSeriesDatamight be a candidate for full React Query migration (useQueries) in a follow-up; this PR intentionally preserves the existing state machine.Link
ClickUp task: https://app.clickup.com/t/86ahp2bjc
Generated by Claude Code