Skip to main content
This guide covers Cross-Program Invocation (CPI) integration for the Earn protocol’s deposit and withdraw functions. Use this when your on-chain program needs to call Jupiter Lend Earn directly. For TypeScript SDK integration (off-chain), see Deposit and Withdraw.

Program Addresses


Deposit CPI

Discriminator

Deposit CPI Struct

Deposit Implementation

Deposit Account Explanations


Withdraw CPI

Discriminator

Withdraw CPI Struct

Withdraw Account Explanations


Context Helpers (TypeScript)

For frontend/client code that needs to resolve CPI accounts, the SDK provides context helpers that return all required account addresses:

Key Notes

Account Derivation

Most accounts follow standard PDA derivation patterns:
  • Lending PDA: [LENDING_SEED, mint.key(), f_token_mint.key()]
  • jlToken Mint: [F_TOKEN_MINT_SEED, mint.key()]
  • Lending Admin: [LENDING_ADMIN_SEED]

Special Considerations

  • Amount = u64::MAX: Deposits/withdraws the entire balance
  • Account Creation: ATA accounts are created automatically when needed (init_if_needed)
  • Claim Account: Only present in withdraw operations for processing withdrawal claims

Error Codes

Return Values

  • deposit() returns shares minted
  • withdraw() returns shares burned