Skip to main content
Swap tokens without users needing ETH or native tokens for gas. Biconomy handles gas abstraction—users can pay fees in the token they’re swapping, or you can sponsor gas entirely.

How It Works

1

User Initiates Swap

User selects tokens and amount to swap
2

API Finds Best Route

Biconomy finds optimal route across DEXs and bridges
3

User Signs Once

Single signature approves the entire swap—no separate gas transaction
4

MEE Executes

Biconomy relayers execute and pay gas, deducting fee from swap or your sponsorship

Quick Example

Swap 100 USDC on Base to USDT on Optimism—completely gasless:
// 1. Request a quote
const quote = await fetch('https://api.biconomy.io/v1/quote', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    mode: 'smart-account',
    ownerAddress: '0xYourAddress',
    // No feeToken = sponsored (gasless)
    composeFlows: [{
      type: '/instructions/intent-simple',
      data: {
        srcChainId: 8453,           // Base
        dstChainId: 10,             // Optimism
        srcToken: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913',  // USDC
        dstToken: '0x94b008aa00579c1307b0ef2c499ad98a8ce58e58',  // USDT
        amount: '100000000',        // 100 USDC (6 decimals)
        slippage: 0.01              // 1%
      }
    }]
  })
}).then(r => r.json());

// 2. Sign the payload
const signature = await wallet.signMessage({
  message: quote.payloadToSign[0].signablePayload.message
});

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

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

Two Ways to Go Gasless

Works with Any Wallet

Smart Accounts

Use mode: 'smart-account' for Nexus or ERC-4337 accounts. Native gas abstraction.

EOA Wallets

Use mode: 'eoa' for MetaMask, Rabby, etc. Requires fundingTokens parameter.

EOA Example (MetaMask, Rabby, etc.)

const quote = await fetch('https://api.biconomy.io/v1/quote', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    mode: 'eoa',
    ownerAddress: userAddress,
    fundingTokens: [{
      tokenAddress: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913',
      chainId: 8453,
      amount: '100000000'
    }],
    feeToken: {
      address: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913',
      chainId: 8453
    },
    composeFlows: [{
      type: '/instructions/intent-simple',
      data: {
        srcChainId: 8453,
        dstChainId: 10,
        srcToken: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913',
        dstToken: '0x94b008aa00579c1307b0ef2c499ad98a8ce58e58',
        amount: '100000000',
        slippage: 0.01
      }
    }]
  })
}).then(r => r.json());

Understanding the Response

The quote response tells you exactly what will happen:
{
  "fee": {
    "amount": "50000",           // Fee in token units
    "token": "0x833589...",      // Fee token address
    "chainId": 8453
  },
  "returnedData": [{
    "outputAmount": "99500000",  // Expected output
    "minOutputAmount": "98505000", // After slippage
    "route": {
      "summary": "lifi[uniswap] => across",
      "estimatedTime": 120
    }
  }]
}
FieldWhat It Means
fee.amountHow much gas costs (in fee token units)
outputAmountExpected tokens user will receive
minOutputAmountMinimum after slippage protection
route.summaryWhich DEXs/bridges will be used

Next Steps