GET
/
base
/
calldata
curl -X POST "https://api.fibrous.finance/base/calldata" \
  -H "Content-Type: application/json" \
  -d '{
    "route_response": {
      "success": true,
      "inputToken": {
        "address": "0x4200000000000000000000000000000000000006",
        "symbol": "ETH",
        "decimals": 18
      },
      "inputAmount": "1000000000000000000",
      "outputToken": {
        "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "symbol": "USDC",
        "decimals": 6
      },
      "outputAmount": "1650230000",
      "route": [
        {
          "protocol": "uniswap",
          "poolAddress": "0x...",
          "tokenIn": "0x4200000000000000000000000000000006",
          "tokenOut": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
        }
      ]
    },
    "slippage": 0.5,
    "signer": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"
  }'
{
  "success": true,
  "data": {
    "to": "0x1234...",
    "data": "0x...",
    "value": "0"
  }
}

https://api.fibrous.finance/base

Generate the calldata required to execute a swap through the Fibrous Finance router contract. This endpoint provides the raw transaction data that can be used to execute the swap directly through a Web3 provider.

Request Body Parameters

route_response
object
required

The complete response object from the /base/route endpoint. This contains all the necessary information about the optimal route.

slippage
number
required

Maximum acceptable slippage in percentage (0.1 to 49). Example: 0.5 for 0.5% slippage tolerance

signer
string
required

The address that will sign and execute the transaction. This address must have sufficient balance of the input token.

Response

success
boolean

Indicates if the request was successful.

calldata
string

The hex-encoded calldata to execute the swap through the router contract.

Error Responses

Invalid Route

{
  "success": false,
  "error": "Invalid route",
  "details": "The provided route is invalid or expired"
}

Invalid Slippage

{
  "success": false,
  "error": "Invalid slippage",
  "details": "Slippage must be between 0.1 and 49"
}

Invalid Signer

{
  "success": false,
  "error": "Invalid signer",
  "details": "The provided signer address is not valid"
}
curl -X POST "https://api.fibrous.finance/base/calldata" \
  -H "Content-Type: application/json" \
  -d '{
    "route_response": {
      "success": true,
      "inputToken": {
        "address": "0x4200000000000000000000000000000000000006",
        "symbol": "ETH",
        "decimals": 18
      },
      "inputAmount": "1000000000000000000",
      "outputToken": {
        "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "symbol": "USDC",
        "decimals": 6
      },
      "outputAmount": "1650230000",
      "route": [
        {
          "protocol": "uniswap",
          "poolAddress": "0x...",
          "tokenIn": "0x4200000000000000000000000000000006",
          "tokenOut": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
        }
      ]
    },
    "slippage": 0.5,
    "signer": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"
  }'
{
  "success": true,
  "data": {
    "to": "0x1234...",
    "data": "0x...",
    "value": "0"
  }
}

Usage with Web3

Once you have the calldata, you can execute the swap using any Web3 library:

// Using ethers.js
const tx = await signer.sendTransaction({
  to: ROUTER_ADDRESS,
  data: calldata,
  value: inputAmount // if swapping ETH
});

// Using web3.js
const tx = await web3.eth.sendTransaction({
  from: signerAddress,
  to: ROUTER_ADDRESS,
  data: calldata,
  value: inputAmount // if swapping ETH
});

Tips

  1. Always verify the min_received amount matches your expectations
  2. Check that the destination address is correct
  3. Consider gas costs when splitting across multiple protocols
  4. Store the route response before requesting calldata

Rate Limits

Please refer to our rate limiting documentation for details about request limits and quotas.