Skip to main content

Documentation Index

Fetch the complete documentation index at: https://base-a060aa97-pat-schemav2-docs.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

The useEarnContext hook is used to access the context values of the Earn component. It can be used to build fully custom deposit and withdraw interfaces and contains all relevant data about a Morpho vault.

Usage

Note: This hook should be used within a <Earn /> or <EarnProvider /> (headless) component.
code
import { useEarnContext } from '@coinbase/onchainkit/earn';

const { depositAmount, 
        setDepositAmount, 
        apy, 
        nativeApy, 
        rewards, 
        vaultFee, 
        vaultToken, 
        liquidity, 
        deposits 
       // ...  
        } = useEarnContext();

// Use the values to build a custom deposit interface!

Returns

EarnContextType