chore(incentives): sync GraphQL schema with V3 backend#159
Open
chore(incentives): sync GraphQL schema with V3 backend#159
Conversation
…userRewards Extends the ReserveIncentive union and the claim flow so that the V3 interface can drop its hardcoded MERIT_DATA_MAP, ETHENA/ETHERFI/SONIC maps, and direct fetches to `apps.aavechan.com` + `api.merkl.xyz`. All per-campaign data (live APR, reward token, tooltip copy, points emission, user eligibility) now flows through the Reserve.incentives union the aave-v3-backend ships. GraphQL fragments (`packages/graphql/src/fragments/reserve.ts`) - MerklSupply/MerklBorrowIncentive: +description, +customMessage, +customForumLink, +customClaimMessage. - SupplyPoints/BorrowPointsIncentive: +dailyPoints, +pointsPerThousandUsd, +description, +customMessage, +customForumLink. - MeritSupply/MeritBorrow/MeritBorrowAndSupplyIncentiveCondition: +actionKey, +rewardTokenAddress, +rewardTokenSymbol, +customMessage, +customForumLink, +selfApr. Claim action (`packages/client/src/actions/incentives.ts`) - New `userRewards()` action backed by the backend's `userRewards` query. Accepts an optional `rewardIds` filter so multi-select UIs can scope claims to Aave-owned programs. Replaces `userMeritRewards()`, which stays for compat but is marked `@deprecated`. React bindings (`packages/react/src/incentives.ts`) - `useUserRewards()` hook with suspense + non-suspense overloads following the existing hook conventions. - `useUserMeritRewards()` marked `@deprecated` with a pointer to the replacement. Versions bumped for the V3 interface to pick up: - @aave/client 0.10.0 -> 0.11.0 - @aave/graphql 0.12.0 -> 0.13.0 - @aave/react 0.9.0 -> 0.10.0 Schema snapshot + gql.tada env file regenerated against the backend's updated schema.
Regenerates `packages/graphql/schema.graphql` against the running V3 backend and re-runs `gql-tada generate output`. The SDK fragments (actionKey, rewardTokenAddress, customMessage, selfApr, dailyPoints, etc) already referenced these fields, but the committed schema was stale, so gql.tada's type checking silently fell back to `unknown` in places. No behaviour changes — just closes the drift between the fragments and the introspected schema.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f12848333f
ℹ️ 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".
The regenerated schema introduced `RewardId` as a custom scalar but it wasn't mapped in the gql.tada scalars config, so `UserRewardsFilter.rewardIds` and every incentive `id` resolved to `unknown`. Add a `RewardId` branded string type in @aave/types and map it so the new rewards API surface is strongly typed. Update the changeset to cover the new @aave/types export, the userRewards query in @aave/graphql, the userRewards action in @aave/client, and the useUserRewards hook in @aave/react.
The V3 backend (aave-v3-backend#200) reclassified the Ethena and EtherFi
partner programs as POINTS instead of STATIC, since the V3 interface
always rendered them as airdrop / loyalty multipliers ("5x Ethena
Rewards", "x3 multiplier"), not fixed-APR boosts. STATIC is no longer
used.
Schema, fragments and tada cache are regenerated to remove the two
types from `ReserveIncentive`. Existing partner program data is now
served as `SupplyPointsIncentive { program, multiplier, ... }` — same
shape the SDK already exposes for Aave Points and Tydro Ink.
…ackend rename The v3 backend (aave/aave-v3-backend#207) renamed `MerklSupplyIncentive.extraApy` → `extraSupplyApr` and `MerklBorrowIncentive.discountApy` → `borrowAprDiscount` to honestly label the values (Merkl returns APR; the interface converts to APY downstream). Naming now matches `Aave*Incentive` and `Merit*Incentive`. Sync the schema, fragments, and tada cache regen.
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
Regenerates
packages/graphql/schema.graphqlagainst the V3 backend (localhost:3011) and rerunsgql-tada generate outputsographql-env.d.tsmatches.The
ReserveIncentivefragments inpackages/graphql/src/fragments/reserve.tsalready forward-reference fields that live on the backend'sMerklSupplyIncentive,MerklBorrowIncentive,SupplyPointsIncentive,BorrowPointsIncentive, andMeritSupplyIncentivetypes —actionKey,customMessage,customForumLink,customClaimMessage,rewardTokenAddress,rewardTokenSymbol,selfApr,description,dailyPoints,pointsPerThousandUsd. The committed schema snapshot didn't include them yet, so gql.tada was falling back tounknowninstead of the narrow types at every consumer.This PR is pure regen. No fragment edits, no new queries. Unblocks the interface hooks that read these fields (tracked separately in the interface PR).
Test plan
pnpm install && pnpm -r buildsucceedspnpm run gql:download:localagainst a fresh V3 backend produces no further delta against this snapshotReserveIncentivein downstream projects resolve to non-unknowntypes for the fields listed aboveLinear: https://linear.app/aavelabs/issue/SDK-779
Closes SDK-779