Deposit Flow

This guide walks through the complete deposit flow for integrating Yieldo into a frontend application.

Overview

User selects vault → Get quote → Approve token → Sign intent → Build tx → Send tx → Track status

Step 1: Select a Vault

Fetch available vaults and let the user choose one.

const response = await fetch('https://api.yieldo.xyz/v1/vaults?chain_id=8453');
const vaults = await response.json();

Step 2: Get a Quote

Once the user specifies a source chain, token, and amount, request a quote.

const quote = await fetch('https://api.yieldo.xyz/v1/quote', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    from_chain_id: 42161,
    from_token: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831',
    from_amount: '1000000000', // 1000 USDC
    vault_id: 'base-steakhouse-prime-usdc',
    user_address: userAddress,
  }),
});
const quoteData = await quote.json();

The response contains:

  • estimate - Shows the expected output, fees, and estimated shares

  • intent - The deposit intent data

  • eip712 - The typed data to sign

  • approval - Token approval details (if needed)

Step 3: Approve Token Spending

If quoteData.approval is not null, the user needs to approve the token first.

Tip: For native token deposits (e.g., ETH), the approval field will be null and you can skip this step.

Step 4: Sign the EIP-712 Intent

Ask the user to sign the typed data returned in the quote.

Step 5: Build the Transaction

Submit the signature to get the final transaction.

Step 6: Send the Transaction

Send the transaction using the user's wallet.

Step 7: Track the Deposit

For cross-chain deposits, poll the status endpoint until the transfer completes.

Complete Example

Last updated

Was this helpful?