Swap Types
Understand the different swap types offered by SwapKit
SwapKit supports three distinct swap mechanisms, each serving different use cases and offering unique advantages.
Cross-Chain Swaps
Cross-chain swaps enable direct asset exchanges between different blockchain networks in a single transaction. These swaps are powered by specialized cross-chain protocols that act as bridges between otherwise isolated blockchains and cover the major tokens on those chains.
Available Providers
SwapKit integrates with four major cross-chain swap providers:
THORChain
NEAR
Chainflip
Maya Chain
Each provider offers different chain coverage, you can see more information on this here.
Single-Chain Swaps
Single-chain swaps occur within a single blockchain ecosystem, leveraging decentralized exchanges (DEXs) and aggregators to find the best rates for token swaps on that specific chain.
Current Provider
1inch, available on:
Ethereum (ETH)
Avalanche (AVAX)
Arbitrum (ARB)
BNB Smart Chain (BSC)
For a complete list of supported tokens on each chain, query the /tokens
endpoint.
Coming Soon
Jupiter integration for Solana single-chain swaps is currently in development and will be available soon, bringing comprehensive DEX aggregation to the Solana ecosystem.
Cross-Chain DEX Aggregation
Some tokens other than the gas assets like ETH, BNB or AVAX are available through our cross-chain providers, but others like most alt-coins are not. Cross-chain DEX aggregation combines single-chain DEX aggregators with cross-chain protocols to access any token on supported chains. This is achieved through two mechanisms:
Swap Ins
Swap ins perform a single-chain swap followed by a cross-chain transfer. This allows users to swap from any token in the source chain into the major tokens in other supported chains.
Swap Ins are currently supported with the combination of 1inch + THORChain (with support for other providers coming soon).
Supported Networks: available for swaps initiated on networks where THORChain and 1inch overlap:
Ethereum (ETH)
Avalanche (AVAX)
BNB Smart Chain (BSC)
Into any chain supported by THORChain.
Swap Outs
Swap outs perform the reverse operation, a cross-chain swap first followed by a single-chain swap on the destination chain.
Current Status: Temporarily Disabled
Using the /quote Endpoint
The /quote
endpoint intelligently routes your swaps through the appropriate providers based on the assets and chains involved.
As you delve into our documentation, come back here to understand more about the logic behind integrating Cross-Chain DEX Aggregation.
Provider Selection
The providers
parameter is optional. When not specified, the API will:
Search all available routing paths
Return the routes found
Include the utilized providers in the response
If you specify the providers
parameter but it's more restrictive than the available options, you'll receive an error:
{
"error": "noRoutesFound",
"message": "No routes found for ETH.CRV-0xD533a949740bb3306d119CC777fa900bA034cd52 -> BTC.BTC",
"data": {
"sellAsset": "ETH.CRV-0xD533a949740bb3306d119CC777fa900bA034cd52",
"buyAsset": "BTC.BTC"
}
}
Transaction Data
Include "includeTx": true
in your request to receive the transaction object needed to execute the swap. The response will include a legs
array showing each step of the swap process. This example shows a swap-in transaction where:
First leg: 1inch converts CRV to ETH on Ethereum
Second leg: THORChain swaps ETH for Bitcoin
"legs": [
{
"provider": "ONEINCH",
"sellAsset": "ETH.CRV-0xD533a949740bb3306d119CC777fa900bA034cd52",
"sellAmount": "2000",
"buyAsset": "ETH.ETH",
"buyAmount": "0.500852152196543104",
"buyAmountMaxSlippage": "0.490835109152612241",
"fees": [
{
"type": "inbound",
"amount": "0.000251000795472595",
"asset": "ETH.ETH",
"chain": "ETH",
"protocol": "ONEINCH"
}
]
},
{
"provider": "THORCHAIN",
"sellAsset": "ETH.ETH",
"sellAmount": "0.500852152196543104",
"buyAsset": "BTC.BTC",
"buyAmount": "0.01564204",
"buyAmountMaxSlippage": "0.01532919",
"fees": [
{
"type": "liquidity",
"amount": "0.00001569",
"asset": "BTC.BTC",
"chain": "THOR",
"protocol": "THORCHAIN"
},
{
"type": "outbound",
"amount": "0.00000918",
"asset": "BTC.BTC",
"chain": "THOR",
"protocol": "THORCHAIN"
},
{
"type": "affiliate",
"amount": "0",
"asset": "BTC.BTC",
"chain": "THOR",
"protocol": "THORCHAIN"
},
{
"type": "service",
"amount": "0.00003137",
"asset": "BTC.BTC",
"chain": "THOR",
"protocol": "THORCHAIN"
}
]
}
],
Last updated