Blockend
HomeLive Demo
BlockEnd Labs
BlockEnd Labs
  • About BlockEnd
    • Overview
    • 🎯Thesis
    • 🧭Compass
    • 🌊LEX Protocol
  • ⚡Compass Widgets
    • Widget Pro
      • Install Widget Pro
      • Customise Widget Pro
      • Widget Events
      • Wallet Management
    • Widget Lite
  • 👨‍💻Compass API
    • API Reference
      • Getting Started
      • Authentication
      • Fetching Quotes
      • Create Transaction
      • Get Raw Transaction To Execute
      • Check Transaction Status
      • Quick Swap API
      • Gasless Swaps
      • Type Definations
      • Get Supported Chains & Tokens
    • SDK
      • Getting Started
      • Configuration
      • Core Methods
        • getQuotes
        • Create Transaction
        • getNextTxn
        • Check Status
        • pollTransactionStatus
        • executeQuote
        • executeTransaction
      • Gasless Transactions
      • Tokens and Chains
    • Supported Chains
    • Liquidity Sources
  • Code Examples
    • EVM Swaps
    • EVM to SOL Bridge
    • SOLANA Swaps
    • Solana to EVM Bridge
  • Resources
    • Brand Assets
  • Troubleshooting
    • React issues
    • Next js issues
Powered by GitBook
On this page
  • Endpoint: GET /quick-swap
  • Query Parameters
  • Response
  • Limitations
  • Example
  • Error Responses

Was this helpful?

  1. Compass API
  2. API Reference

Quick Swap API

The Quick Swap API allows you to perform cross-chain or same-chain token swaps in a single call, returning both the best route and all the transactions required to complete it. This API is perfect for dApps, wallets, checkouts, or DeFi flows where simplicity and speed are essential.

Endpoint: GET /quick-swap

/quick-swap
    ?fromChainId=
    &fromAssetAddress=
    &toChainId=
    &toAssetAddress=
    &inputAmountDisplay=
    &userWalletAddress=
    &recipient=

Query Parameters

Field
Type
Description

fromChainId*

string

Source blockchain identifier

fromAssetAddress*

string

Token address on source chain

toChainId*

string

Destination blockchain identifier

toAssetAddress*

string

Token address on destination chain

inputAmountDisplay*

string

Human-readable input amount (e.g., "1.5") Note: Either inputAmountDisplay or inputAmount should be passed

inputAmount*

string

Input amount in decimal units Note: Either inputAmountDisplay or inputAmount should be passed

userWalletAddress*

string

User's wallet address

recipient

string

Final recipient of the tokens. If not provided userWalletAddress is used by default

slippage

number

Slippage tolerance in basis points (100 = 1%)

solanaOptions

SolanaOptions

Solana-specific parameters

evmOptions

EvmOptions

EVM-specific parameters

skipChecks

boolean

Skip validation checks

include

string

Comma-separated list of providers to include

exclude

string

Comma-separated list of providers to exclude

Solana Options

Field
Type
Description

solanaPriorityFee

number | PriorityLevel

Priority fee in micro lamports or priority level

solanaJitoTip

number | PriorityLevel

Jito MEV tip in lamports or priority level

EVM Options

Field
Type
Description

evmPriorityFee

number | PriorityLevel

Priority fee in wei or priority level

PriorityLevel = 'low' | 'medium' | 'high' | 'ultra' | 'degen'

Response

The Quick Swap endpoint returns a simplified response containing both the selected route and ready-to-execute transaction data.

Field
Type
Description

route

Route

The selected route for the swap (null if no suitable route)

txn

TxnData[]

Array of transaction data ready for execution (null if error)

error

string

Error message if the swap cannot be completed

Route Object

The route object contains the same structure as returned by the /quotes endpoint, including:

  • from/to: Source and destination token details

  • inputAmount/outputAmount: Input and output amounts in wei/native units

  • inputAmountDisplay/outputAmountDisplay: Human-readable amounts

  • provider: Liquidity provider used

  • estimatedTimeInSeconds: Estimated execution time

  • steps: Transaction steps (limited to simple swaps only)

  • fee: Fee breakdown

Transaction Data Array

The txn array contains 1-2 transaction objects ready for execution:

  1. Approval Transaction (if required): ERC20 token approval for non-native tokens

  2. Swap Transaction: The actual swap transaction

Each transaction object includes:

  • txnEvm: EVM transaction data (from, to, data, value, gasPrice, gasLimit)

  • txnSol: Solana transaction data (base64 encoded transaction)

  • networkType: "evm" or "sol"

  • routeId/stepId: Identifiers for tracking

Limitations

The Quick Swap endpoint is designed for simple swaps only and has the following restrictions:

  • Only supports single-step swaps (no complex multi-hop routes)

  • Automatically uses recommended providers only

  • Routes with more than 2 steps (approval + swap) will be rejected

  • Cross-chain swaps are supported but must be single-step

Example

Request:

https://api2.blockend.com/v1/quick-swap
?fromChainId=1
&fromAssetAddress=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
&toChainId=1
&toAssetAddress=0xA0b86a33E6417aE4bbBd449c8E87C2E2e20E84DE
&inputAmountDisplay=0.1
&userWalletAddress=0x17e7c3DD600529F34eFA1310f00996709FfA8d5c
&slippage=100

Response:

{
  "status": "success",
  "data": {
    "route": {
      "routeId": "01J2WB1NY6MD3F25CJTTB01D8F",
      "from": {
        "networkType": "evm",
        "chainId": "1",
        "address": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
        "decimals": 18,
        "name": "Ethereum",
        "symbol": "ETH",
        "isNative": true,
        "lastPrice": 3480.62
      },
      "to": {
        "networkType": "evm",
        "chainId": "1",
        "address": "0xA0b86a33E6417aE4bbBd449c8E87C2E2e20E84DE",
        "decimals": 18,
        "name": "USDC",
        "symbol": "USDC",
        "isNative": false,
        "lastPrice": 1.002
      },
      "inputAmount": "100000000000000000",
      "inputAmountDisplay": "0.1",
      "outputAmount": "348062000000",
      "outputAmountDisplay": "348.062",
      "provider": "1inch",
      "estimatedTimeInSeconds": 30,
      "steps": [{
        "stepId": "01J2WB1NY64MKVCM8FM994WMZV",
        "stepType": "swap",
        "from": { /* token details */ },
        "to": { /* token details */ },
        "inputAmount": "100000000000000000",
        "outputAmount": "348062000000"
      }]
    },
    "txn": [{
      "id": "txn_123",
      "routeId": "01J2WB1NY6MD3F25CJTTB01D8F",
      "stepId": "01J2WB1NY64MKVCM8FM994WMZV",
      "networkType": "evm",
      "txnType": "on-chain",
      "txnEvm": {
        "from": "0x17e7c3DD600529F34eFA1310f00996709FfA8d5c",
        "to": "0x1111111254eeb25477b68fb85ed929f73a960582",
        "value": "100000000000000000",
        "data": "0x7c025200000000000000000000000000...",
        "gasPrice": "20000000000",
        "gasLimit": "150000"
      }
    }]
  }
}

Error Responses

The endpoint may return the following error scenarios:

  • No routes found: When no suitable swap routes are available

  • Route too complex: When the optimal route requires multiple steps

  • Failed to compute transaction data: When transaction data cannot be generated

{
  "status": "success",
  "data": {
    "route": null,
    "txn": null,
    "error": "No routes found"
  }
}

This endpoint is perfect for applications that need simple, one-click swap functionality without the complexity of managing separate quote and transaction creation flows.

PreviousCheck Transaction StatusNextGasless Swaps

Last updated 5 days ago

Was this helpful?

👨‍💻