Skip to content

Repository files navigation

sPENDLE Claim & Swap

Claim Pendle sPENDLE rewards on Ethereum mainnet, then optionally swap selected reward tokens into PENDLE through 0x.

sPENDLE Claim & Swap UI

Live Demo

Live URL: https://spendle-claim.vercel.app

Source: https://github.com/hell0men/spendle-claim

What It Does

  • Loads Pendle reward proofs through a server-side proxy.
  • Verifies the current distributor merkleRoot() before claiming.
  • Reads claimed(token, user) on-chain and shows only remaining claimable amounts.
  • Lets you choose per token:
    • Claim
    • Swap
  • Keeps PENDLE and sPENDLE as claim-only tokens.
  • Uses 0x Swap API v2 AllowanceHolder quotes for selected swaps.
  • Checks ERC-20 allowance before swaps and skips unnecessary approvals.
  • Supports classic EOA mode by default.
  • Offers an optional EIP-5792 atomic batch toggle for wallets that support it.

Contracts

  • Pendle distributor: 0x3942F7B55094250644cFfDa7160226Caa349A38E
  • PENDLE: 0x808507121B80c02388fAd14726482e061B8da827
  • sPENDLE: 0x999999999991E178D52Cd95AFd4b00d066664144
  • 0x AllowanceHolder spender is returned dynamically by the 0x quote response.

Setup

Install dependencies:

pnpm install

Create .env.local:

NEXT_PUBLIC_WC_PROJECT_ID=your_walletconnect_project_id
NEXT_PUBLIC_RPC_URL=https://eth-mainnet.g.alchemy.com/v2/your_key
ZEROX_API_KEY=your_0x_api_key

Run locally:

pnpm dev

Open:

http://localhost:3000

Environment Variables

Name Scope Description
NEXT_PUBLIC_WC_PROJECT_ID Browser WalletConnect project ID for ConnectKit.
NEXT_PUBLIC_RPC_URL Browser Ethereum mainnet RPC URL.
ZEROX_API_KEY Server 0x API key used by /api/quotes.

Where To Get Env Keys

  • NEXT_PUBLIC_WC_PROJECT_ID: create a project in Reown Cloud and copy the project ID.
  • NEXT_PUBLIC_RPC_URL: create an Ethereum mainnet app in Alchemy or Infura and copy the HTTPS RPC URL.
  • ZEROX_API_KEY: create an API key in the 0x Dashboard.

Flow

Classic EOA mode is the default:

  1. Connect wallet.
  2. Refresh rewards.
  3. Select which tokens to claim and which tokens to swap.
  4. Submit claim.
  5. After claim confirmation, the app fetches fresh 0x quotes.
  6. The app requests only the approvals that are still needed.
  7. Each selected token is swapped into PENDLE.

Atomic batch mode is optional. It may use wallet-specific EIP-7702 delegation for EOAs, so keep it disabled unless you explicitly want that behavior.

Notes

Pendle's reward BFF is intended for the official UI. This app calls it only through the Next.js server proxy and sets Pendle UI headers server-side. If Pendle changes the BFF gate, the reward proxy may need to move to an official core API endpoint.

Build

pnpm build

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages