Guide

Cross-Chain API Documentation

API

OpenOcean Cross-Chain Swap API Integration Guide

OpenOcean offers an API for cross-chain trading, allowing developers to implement cross-chain asset transfers seamlessly. This guide provides a step-by-step introduction to using this API feature.

Cross-Chain Swap Overview

The Cross-Chain swap feature allows users to directly swap and transfer whitelisted assets between supported major chains on the OpenOcean, including BTC to EVM chains, EVM to EVM chains.

Cross-Chain Swap & Transfer in 3 Steps

  1. Get Quote for Cross-chain Transfer

  2. Execute Cross-chain Transaction

  3. Monitor Transaction Status

1. Get Quote for Cross-chain Transfer

You can call the Quote API to get all available routes and fees for your cross-chain transfer.

Example request:

// Transfer 30 USDT from BSC to USDC on Polygon
import axios from 'axios';
const response = await axios({
    url: 'https://open-api.openocean.finance/cross_chain/v1/cross/quoteByOO?' +
         'fromSymbol=USDT' +
         '&fromChainId=56' +  
         '&toSymbol=USDC' +
         '&toChainId=137' +
         '&amount=30000000000000000000' +
         '&sort=cheapestRoute',
    method: 'GET'
});

const quote = response.data;

Example response:

2. Execute Cross-chain Transaction

After getting the quote, you can execute the cross-chain transfer by using the swap API.

Example request:

Example response:

3. Monitor Transaction Status

Track your transaction status until completed.

Example request:

Example response:

Important Notes

  1. All amounts must include token decimals

  2. Always check minimum transfer amounts

  3. Monitor transactions until complete

  4. Some routes may require additional swaps on destination chain

Last updated