Skip to main content
These examples use earn() and attribution from Call the API and execute() from Execute Calls in a Wallet.

Morpho Earn

This walkthrough shows separate deposit and withdrawal actions. Each requires the user’s approval. execute represents the wallet integration; earn runs on your backend. Application-specific values such as the selected vault, wallet address and slippage tolerance must come from your app. Discover and validate the vault first, as shown in List Vaults.
TypeScript

Upshift

Deposit, then on a later user action queue a full withdrawal, wait for maturity, and claim. The wallet integration must supply and persist the confirmed claim date; the response date is only an estimate.

Testing and Going Live

  • Confirm that the protocol and vault or product you selected are available in your integration.
  • Use reads and unsigned-call generation to test without moving funds. Check the returned chain ID before signing. An early-access endpoint can still build Base Mainnet transactions.
  • For Morpho Earn, test an approved-vault deposit and a liquidity-dependent synchronous withdrawal, including explicit zero and missing slippage bounds.
  • For Upshift, test the full request/wait/claim lifecycle, persist confirmed dates and handle non-claimable entries.
  • For Morpho Borrow, test borrowing with existing collateral and adding collateral with borrowing. Verify the fee breakdown, attribution suffix and atomic execution. Confirm position monitoring and repayment work before offering borrowing to users.
  • Test reverted receipts and partial sequential execution. Never report success solely because a transaction hash or batch ID was returned.
  • Before sending production traffic, verify your endpoint and builder code, test rate-limit handling, and confirm that transactions are attributed to your app.