Skip to content

chore(incentives): sync GraphQL schema with V3 backend#159

Open
mgrabina wants to merge 7 commits intomainfrom
SDK-779-rewards-hooks
Open

chore(incentives): sync GraphQL schema with V3 backend#159
mgrabina wants to merge 7 commits intomainfrom
SDK-779-rewards-hooks

Conversation

@mgrabina
Copy link
Copy Markdown
Contributor

@mgrabina mgrabina commented Apr 24, 2026

Summary

Regenerates packages/graphql/schema.graphql against the V3 backend (localhost:3011) and reruns gql-tada generate output so graphql-env.d.ts matches.

The ReserveIncentive fragments in packages/graphql/src/fragments/reserve.ts already forward-reference fields that live on the backend's MerklSupplyIncentive, MerklBorrowIncentive, SupplyPointsIncentive, BorrowPointsIncentive, and MeritSupplyIncentive types — 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 to unknown instead 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 build succeeds
  • pnpm run gql:download:local against a fresh V3 backend produces no further delta against this snapshot
  • Consumers of ReserveIncentive in downstream projects resolve to non-unknown types for the fields listed above

Linear: https://linear.app/aavelabs/issue/SDK-779

Closes SDK-779

…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.
@linear
Copy link
Copy Markdown

linear Bot commented Apr 24, 2026

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread packages/graphql/src/graphql-env.d.ts
@mgrabina mgrabina changed the title chore(graphql): refresh schema + regenerate gql-tada output chore(incentives): sync GraphQL schema with V3 backend Apr 24, 2026
mgrabina and others added 5 commits April 24, 2026 16:48
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants