Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.biconomy.io/llms.txt

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

Exit vault positions and receive any token you want—on any chain. Biconomy handles the redemption, swap, and bridge in a single transaction.

The Problem It Solves

Without Biconomy, exiting a vault position requires:
  1. Approve vault withdrawal (signature 1)
  2. Redeem shares for underlying (signature 2)
  3. Swap to desired token (signature 3)
  4. If cross-chain: bridge to destination (more signatures, more waiting)
With Biconomy: One signature. Funds arrive as whatever token you want, wherever you want.

How It Works

1

User Initiates Withdrawal

User specifies vault shares to redeem and desired output token
2

API Calculates Best Route

Biconomy finds optimal path: redeem → swap (if needed) → bridge (if needed)
3

User Signs Once

Single signature authorizes the entire withdrawal flow
4

Lossless Redemption

Direct vault redemption—no slippage on the withdrawal step

Quick Example

Withdraw from an AAVE vault on Base, receive USDC on Optimism:
const quote = await fetch('https://api.biconomy.io/v1/quote', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    mode: 'eoa',
    ownerAddress: userAddress,
    composeFlows: [{
      type: '/instructions/intent-vault',
      data: {
        srcChainId: 8453,           // Base
        srcVault: '0x4e65fE4DbA92790696d040ac24Aa414708F5c0AB',  // AAVE vault
        dstChainId: 10,             // Optimism
        dstToken: '0x94b008aa00579c1307b0ef2c499ad98a8ce58e58',  // USDT
        amount: '1000000000000000000',  // Vault shares to redeem
        slippage: 0.01
      }
    }]
  })
}).then(r => r.json());

// Sign and execute
const signature = await wallet.signTypedData(quote.typedDataToSign);

const result = await fetch('https://api.biconomy.io/v1/execute', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    signedQuote: quote,
    signature
  })
}).then(r => r.json());

console.log('Track at:', `https://meescan.biconomy.io/details/${result.supertxHash}`);

Same-Chain Withdrawal

Withdraw and swap to a different token on the same chain:
{
  type: '/instructions/intent-vault',
  data: {
    srcChainId: 8453,
    srcVault: YEARN_WETH_VAULT,    // Withdraw from Yearn WETH vault
    dstChainId: 8453,              // Same chain
    dstToken: USDC_BASE,           // Receive USDC
    amount: '5000000000000000000', // 5 vault shares
    slippage: 0.01
  }
}

Cross-Chain Exit

Exit a vault and receive tokens on a completely different chain:
{
  type: '/instructions/intent-vault',
  data: {
    srcChainId: 137,               // Polygon
    srcVault: AAVE_POLYGON_VAULT,  // AAVE position on Polygon
    dstChainId: 1,                 // Ethereum mainnet
    dstToken: ETH_MAINNET,         // Receive ETH
    amount: '10000000000000000000',
    slippage: 0.02,                // Higher slippage for volatile pair
    allowBridgeProviders: 'across' // Control bridge selection
  }
}

Understanding the Response

{
  "outputAmount": "985000000",
  "minOutputAmount": "975150000",
  "route": {
    "type": "vault-to-token",
    "summary": "vaultsfyi[aave-v3] => across => lifi[uniswap]",
    "steps": [
      {
        "type": "vault-redeem",
        "provider": "vaultsfyi",
        "protocol": "aave-v3",
        "vaultAddress": "0x...",
        "inputAmount": "1000000000000000000",
        "outputAmount": "1000000000"
      },
      {
        "type": "bridge",
        "provider": "across",
        "srcChainId": 8453,
        "dstChainId": 10
      },
      {
        "type": "swap",
        "provider": "lifi",
        "tool": "uniswap"
      }
    ],
    "totalGasFeesUsd": 0.15,
    "totalBridgeFeesUsd": 0.25,
    "estimatedTime": 120
  }
}
FieldDescription
route.typeAlways vault-to-token for withdrawals
vault-redeem stepDirect redemption from vault (lossless)
bridge stepCross-chain transfer if needed
swap stepToken conversion if needed

Provider Control

Control which DEXs and bridges are used for the post-withdrawal steps:
{
  type: '/instructions/intent-vault',
  data: {
    srcChainId: 8453,
    srcVault: MORPHO_VAULT,
    dstChainId: 42161,
    dstToken: ARB_TOKEN,
    amount: '1000000000000000000',
    slippage: 0.01,
    
    // Route preferences
    allowSwapProviders: 'lifi,uniswap',
    allowBridgeProviders: 'across',
    denySwapProviders: 'gluex'
  }
}

Fee Structure

ScenarioFee (BPS)
Same-chain, underlying token0
Same-chain with swap10
Cross-chain withdrawal15
Withdrawing to the vault’s native underlying token on the same chain incurs zero protocol fees—only gas.

Error Handling

const quote = await fetch('https://api.biconomy.io/v1/quote', {...})
  .then(r => r.json());

// Check for errors
if (quote.error) {
  if (quote.error.includes('insufficient balance')) {
    console.log('Not enough vault shares');
  }
  if (quote.error.includes('No route found')) {
    console.log('Try a different destination token');
  }
  return;
}

// Validate output
const minOutput = BigInt(quote.returnedData[0].minOutputAmount);
if (minOutput < userMinimum) {
  console.log('Output too low—try reducing slippage or amount');
  return;
}

Next Steps

Token to Vault

Deposit any token into vaults

Vault to Vault

Migrate positions between vaults