Skip to content

feat: add claim rewards component and API route to yield demo#149

Merged
rodrigo-privy merged 1 commit intomainfrom
rgrabowsky/add-claims-to-yield-demo
Mar 5, 2026
Merged

feat: add claim rewards component and API route to yield demo#149
rodrigo-privy merged 1 commit intomainfrom
rgrabowsky/add-claims-to-yield-demo

Conversation

@rodrigo-privy
Copy link
Contributor

@rodrigo-privy rodrigo-privy commented Mar 4, 2026

Summary

  • Add "Claim Rewards" component and /api/claim route to the yield demo, calling the new ethereum_yield_claim endpoint to claim accrued incentive rewards (e.g. MORPHO) via the Merkl protocol
  • Make the transaction data model multi-currency so the transaction history table can display both USDC (deposit/withdraw) and non-USDC tokens (claim) with appropriate formatting
  • Gracefully distinguish "no rewards available" from other API errors, showing an informational message instead of a red error

Changes

  • New: ClaimRewardsForm component — single-button UI (no amount input), placed below Withdraw on the dashboard
  • New: /api/claim route — proxies to Privy's ethereum_yield_claim endpoint, normalizes the broader claim status set to match the three-value model used by deposit/withdraw
  • Updated: Transaction interface — added token_symbol and token_decimals as required fields, made vault_id optional (claims don't involve a vault)
  • Updated: deposit/withdraw routes — pass USDC_TOKEN constant when storing transactions
  • Updated: TransactionHistory — renders claim rows as "Claimed X.XXXX MORPHO" alongside existing "Deposited/Withdrew $X.XX USDC" rows
  • Updated: constants.ts — added MORPHO token constants, USDC_TOKEN shorthand, and generic formatTokenAmount formatter

Testing

  • Tested: "No rewards" path — verified the claim button returns an amber info message ("No rewards available to claim yet") when the wallet has no claimable rewards, and the API correctly returns a 400 with code: "no_rewards"
  • Regression Tests: Test deposits and withdrawals still worked and added transactions to the transaction history table correctly
  • Pending: Success path — coordinating with Merkl to airdrop test reward tokens to the demo wallet so we can verify the full claim flow and transaction history display

Screenshots

Claim component under withdrawal component:
Screenshot 2026-03-04 at 11 48 01 AM

Loading state:
Screenshot 2026-03-04 at 11 48 08 AM

No rewards available to claim:
Screenshot 2026-03-04 at 11 48 19 AM

Transaction history table with claim API mocked (pending additional test, see above):
Screenshot 2026-03-04 at 12 12 27 PM

@vercel
Copy link

vercel bot commented Mar 4, 2026

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

Project Deployment Actions Updated (UTC)
privy-next-cross-app-provider Building Building Preview, Comment Mar 5, 2026 9:59pm
privy-next-funding Building Building Preview, Comment Mar 5, 2026 9:59pm
privy-next-wagmi Building Building Preview, Comment Mar 5, 2026 9:59pm
privy-next-yield-demo Ready Ready Preview, Comment Mar 5, 2026 9:59pm
privy-react-farcaster Error Error Mar 5, 2026 9:59pm
privy-react-fiat-onramp Error Error Mar 5, 2026 9:59pm
privy-react-funding Error Error Mar 5, 2026 9:59pm
privy-react-permissionless Error Error Mar 5, 2026 9:59pm
privy-react-smart-wallets Error Error Mar 5, 2026 9:59pm
12 Skipped Deployments
Project Deployment Actions Updated (UTC)
privy-next-cross-app-connect Ignored Ignored Preview Mar 5, 2026 9:59pm
privy-next-farcaster Ignored Ignored Preview Mar 5, 2026 9:59pm
privy-next-farcaster-mini-app Ignored Ignored Preview Mar 5, 2026 9:59pm
privy-next-fiat-onramp Ignored Ignored Preview Mar 5, 2026 9:59pm
privy-next-permissionless Ignored Ignored Preview Mar 5, 2026 9:59pm
privy-next-session-keys Ignored Ignored Preview Mar 5, 2026 9:59pm
privy-next-smart-wallets Ignored Ignored Preview Mar 5, 2026 9:59pm
privy-next-solana Ignored Ignored Preview Mar 5, 2026 9:59pm
privy-next-starter Ignored Ignored Preview Mar 5, 2026 9:59pm
privy-react-pwa Ignored Ignored Preview Mar 5, 2026 9:59pm
privy-react-starter Ignored Ignored Preview Mar 5, 2026 9:59pm
privy-react-whitelabel-starter Ignored Ignored Preview Mar 5, 2026 9:59pm

Request Review

@rodrigo-privy rodrigo-privy force-pushed the rgrabowsky/add-claims-to-yield-demo branch from 69dc466 to 08075f8 Compare March 4, 2026 17:13
@rodrigo-privy rodrigo-privy force-pushed the rgrabowsky/add-claims-to-yield-demo branch from 08075f8 to e61f5db Compare March 4, 2026 17:17
@rodrigo-privy rodrigo-privy force-pushed the rgrabowsky/add-claims-to-yield-demo branch from e61f5db to d58acbd Compare March 4, 2026 17:24
@rodrigo-privy rodrigo-privy force-pushed the rgrabowsky/add-claims-to-yield-demo branch from d58acbd to 7f1cc4a Compare March 4, 2026 17:29
@rodrigo-privy rodrigo-privy marked this pull request as ready for review March 4, 2026 17:30
}

// Create one transaction per reward token
const now = Date.now();
Copy link
Contributor

Choose a reason for hiding this comment

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

can't we pull now from the claim response? like this should be created_at

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ooh this is a good callout - the yield claim API doesn't have created_at and updated_at like deposit and withdraw yet. But it should be super easy to add because those fields are available in the CockroachDB transaction.

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