Skip to main content

Cross-chain Swaps

Harbor provides a cross-chain swapping product enabling Web3 developers to offer users native asset swaps with strong price execution. The system operates through an Exchange subnet featuring a performant CLOB (Central Limit Order Book) where institutional market makers fulfill orders.

Developers utilize the Swaps API to request quotes and monitor execution stages.

Swap Lifecycle

All swaps follow a consistent four-phase process:

1
Quoting
Request a quote with asset pair, amount, and tolerance
2
Deposit
Broadcast transaction to source blockchain
3
Processing
Validators observe and execute via Smart Order Router
4
Withdraw
Funds sent to destination address

Execute a Swap

For the complete API specification, see the Swap API Reference.

Request a quote from the Swaps API to get pricing and deposit instructions.

Endpoint: GET https://quote.harbor.xyz/swap/v1/quote

ParameterTypeRequiredDescription
fromAssetstringYesSource asset (e.g., BTC.BTC)
toAssetstringYesDestination asset (e.g., ETH.ETH)
amountstringYesAmount in 1e8 decimals
destinationstringYesRecipient address on destination chain
toleranceBpsnumberNoSlippage tolerance in basis points (default: 100 = 1%)

Example Request:

curl -X GET "https://quote.harbor.xyz/swap/v1/quote?\
fromAsset=BTC.BTC&\
toAsset=ETH.ETH&\
amount=10000000&\
destination=0x742d35Cc6634C0532925a3b844Bc9e7595f8FbDc&\
toleranceBps=100"

Example Response:

{
"inboundAddress": "bc1q6csj53wdrzyzextj2syljvhh0vhynyrx904gp8",
"inboundConfirmationBlocks": "1",
"inboundConfirmationSeconds": "600",
"fees": {
"asset": "ETH.ETH",
"affiliate": "0",
"outbound": "684",
"liquidity": "23225",
"total": "23909",
"totalBps": "8"
},
"expiry": "1768843381",
"warning": "Do not cache this response. Do not send funds after the expiry.",
"notes": "First output should be to inbound_address, second output should be change back to self, third output should be OP_RETURN, limited to 80 bytes. Do not send below the dust threshold. Do not use exotic spend scripts, locks or address formats.",
"dustThreshold": "10000",
"recommendedMinAmountIn": "0",
"recommendedGasRate": "3",
"gasRateUnits": "satsperbyte",
"expectedAmountOut": "29006947",
"totalSwapSeconds": "620"
}

Try It Out

Use this interactive tool to test the quote API:

Loading quote tool...

Swap Types

Harbor supports multiple order execution strategies to accommodate different swap requirements:

Single-book AON Walk

The full swap amount is placed as a single All-or-Nothing order starting at quote price, walking down by tolerance_bps periodically until filled. AON orders must be filled completely in a single match—no partial fills allowed.

Multi-book AON Walk

Coming Soon

The full swap amount is placed as a multi-book All-or-Nothing order starting at quote price, walking down towards tolerance_bps periodically. AON ensures complete fills while multi-book routing improves execution across multiple liquidity sources.

TWAP

Coming Soon

Time-Weighted Average Price execution. The swap is broken into multiple smaller orders spread over a user-defined time period, enabling larger swaps with reduced market impact.

Next Steps