API

Get MinSend

GET https://open-api.openocean.finance/cross_chain/v1/cross/getMinSend

Query Parameters

Name
Type
Description

fromChainId*

Number

source chainId(1, 56, 137, 250, 42161, 43113)

toChainId*

Number

dst chainId(1, 56, 137, 250, 42161, 43113)

address*

String

token address

{
  "code": 200,
  "data": {
    "cbridgeMinSend": "20000000000000000000", // with decimals
    "anyswapMinSend": "12000000000000000000"
  }
}

Get Cross Status

GET https://open-api.openocean.finance/cross_chain/v1/cross/getCrossStatus

Query Parameters

Name
Type
Description

chainId*

Number

source chainId(1, 56, 137, 250, 42161, 43113)

hash*

String

source hash

{
  "code": 0,
  "data": {
    "status": 5, // 2-fail, 3-pending, 5-success
    "outAmount": "14747312000000000000", // dst amount with decimals
    "destHash": "0xd6f968e28e57ea78e8efaccf275d3a1b1ec0ffce8e7b1fb01616ee8eca22dc9e", // dst chain hash
  }
}

Quote Route

GET https://open-api.openocean.finance/cross_chain/v1/cross/quoteByOO

Query Parameters

Name
Type
Description

fromChainId*

Number

source chainId(1, 56, 137, 250, 42161, 43113)

toChainId*

Number

dst chainId(1, 56, 137, 250, 42161, 43113)

fromSymbol*

String

source chain token symbol

toSymbol*

String

dst chain token symbol

amount*

String

with decimals (decimals 6, 100 - 100000000)

{
    "code": 200,
    "data": {
        "fromAsset": {
            "ids": "tether",
            "name": "Binance-Peg USD (T)",
            "address": "0x55d398326f99059ff775485246999027b3197955",
            "decimals": 18,
            "symbol": "USDT",
            "chain": "bsc",
            "chainId": 56,
            "icon": "https://ethapi.openocean.finance/logos/bsc/0x55d398326f99059ff775485246999027b3197955.png"
        },
        "fromChainId": "56",
        "toAsset": {
            "ids": "tether",
            "name": "Tether USD",
            "address": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
            "decimals": 6,
            "symbol": "USDT",
            "chain": "polygon",
            "chainId": 137,
            "icon": "//openocean.oss-cn-hongkong.aliyuncs.com/images/1640831384587_011475796734160326.png"
        },
        "toChainId": "137",
        "routes": [
            {
                "isApprovalRequired": true,
                "allowanceTarget": "0xCbe95610cAc371F8e7e5FA7293830474387Aa796",
                "middlewareRoute": [
                    "data": "0x" // swap inputData, if need to swap
                ],
                "bridgeRoute": {
                    "bridgeName": "cbridge",
                    "bridgeId": 10,
                    "messageBus": "0x95714818fdd7a5454f73da9c777b3ee6ebaeea6b",
                    "tokenReceiver": "0xb6a5c7bcAC5ac0f12f36B26379a7E00d76Ec018B",
                    "bridgeInfo": {
                        "serviceTime": 600000,
                        "displayName": "cbridge",
                        "icon": "https://cloudstorage.openocean.finance/static/font/cBrdigeDark.png?t=2"
                    },
                    "fromAsset": {
                        "ids": "tether",
                        "name": "Binance-Peg USD (T)",
                        "address": "0x55d398326f99059ff775485246999027b3197955",
                        "decimals": 18,
                        "symbol": "USDT",
                        "chain": "bsc",
                        "chainId": 56,
                        "icon": "https://ethapi.openocean.finance/logos/bsc/0x55d398326f99059ff775485246999027b3197955.png",
                        "cross": 30000
                    },
                    "fromChainId": 56,
                    "toAsset": {
                        "ids": "tether",
                        "name": "Tether USD",
                        "address": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
                        "decimals": 6,
                        "symbol": "USDT",
                        "chain": "polygon",
                        "chainId": 137,
                        "icon": "//openocean.oss-cn-hongkong.aliyuncs.com/images/1640831384587_011475796734160326.png",
                        "cross": 30000
                    },
                    "toChainId": 137,
                    "inputAmount": "100000000000000000000000",
                    "outputAmount": "99949353679"
                },
                "fees": {
                    "gasLimit": [],
                    "middlewareFee": {
                        "chainId": 56,
                        "address": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
                        "name": "Binance Chain Native Token",
                        "symbol": "BNB",
                        "decimals": 18,
                        "icon": "https://ethapi.openocean.finance/logos/bsc/0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee.png",
                        "ids": "binancecoin",
                        "assetAddress": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
                        "amount": 0
                    },
                    "bridgeFee": {
                        "ids": "tether",
                        "name": "Binance-Peg USD (T)",
                        "address": "0x55d398326f99059ff775485246999027b3197955",
                        "decimals": 18,
                        "symbol": "USDT",
                        "chain": "bsc",
                        "chainId": 56,
                        "icon": "https://ethapi.openocean.finance/logos/bsc/0x55d398326f99059ff775485246999027b3197955.png",
                        "amount": "50646320999992895000",
                        "assetAddress": "0x55d398326f99059ff775485246999027b3197955"
                    }
                },
                "data": "0x" // input data
            },
            {
                "isApprovalRequired": true,
                "allowanceTarget": "0x23C78B3d85b45BfA6DC8e09b517ba2d9b0ECCA8C",
                "middlewareRoute": [],
                "bridgeRoute": {
                    "bridgeName": "anyswap",
                    "bridgeId": 1,
                    "messageBus": "0x95714818fdd7a5454f73da9c777b3ee6ebaeea6b",
                    "tokenReceiver": "0xb6a5c7bcAC5ac0f12f36B26379a7E00d76Ec018B",
                    "bridgeInfo": {
                        "serviceTime": 600000,
                        "displayName": "anyswap",
                        "icon": "https://cloudstorage.openocean.finance/static/bridge-anyswap.png"
                    },
                    "fromAsset": {
                        "ids": "tether",
                        "name": "Binance-Peg USD (T)",
                        "address": "0x55d398326f99059ff775485246999027b3197955",
                        "decimals": 18,
                        "symbol": "USDT",
                        "chain": "bsc",
                        "chainId": 56,
                        "icon": "https://ethapi.openocean.finance/logos/bsc/0x55d398326f99059ff775485246999027b3197955.png",
                        "cross": "0xedf0c420bc3b92b961c6ec411cc810ca81f5f21a"
                    },
                    "fromChainId": 56,
                    "toAsset": {
                        "ids": "tether",
                        "name": "Tether USD",
                        "address": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
                        "decimals": 6,
                        "symbol": "USDT",
                        "chain": "polygon",
                        "chainId": 137,
                        "icon": "//openocean.oss-cn-hongkong.aliyuncs.com/images/1640831384587_011475796734160326.png",
                        "cross": "0xedf0c420bc3b92b961c6ec411cc810ca81f5f21a"
                    },
                    "toChainId": 137,
                    "inputAmount": "100000000000000000000000",
                    "outputAmount": "99990000000"
                },
                "fees": {
                    "gasLimit": [],
                    "middlewareFee": {
                        "chainId": 56,
                        "address": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
                        "name": "Binance Chain Native Token",
                        "symbol": "BNB",
                        "decimals": 18,
                        "icon": "https://ethapi.openocean.finance/logos/bsc/0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee.png",
                        "ids": "binancecoin",
                        "assetAddress": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
                        "amount": 0
                    },
                    "bridgeFee": {
                        "ids": "tether",
                        "name": "Binance-Peg USD (T)",
                        "address": "0x55d398326f99059ff775485246999027b3197955",
                        "decimals": 18,
                        "symbol": "USDT",
                        "chain": "bsc",
                        "chainId": 56,
                        "icon": "https://ethapi.openocean.finance/logos/bsc/0x55d398326f99059ff775485246999027b3197955.png",
                        "amount": "10000000000000000000",
                        "assetAddress": "0x55d398326f99059ff775485246999027b3197955"
                    }
                },
                "data": "0x" // input data
            }
        ],
        "amount": "100000000000000000000000"
    }
}

Cross Swap

POST https://open-api.openocean.finance/cross_chain/v1/cross/:plat/swap

get the cross input data

Request Body

Name
Type
Description

plat*

string

bridge name stargate/squid/symbiosis

account*

string

0x2132b141D19D7563e686Bb6f4764C7cE9097D514

route*

object

route from quoteByOO interface

{
    "code": 200,
    "data": {
        "from": "0x2132b141D19D7563e686Bb6f4764C7cE9097D514",
        "to": "0x43c47B76D24Ad1F73f5Ab12442A016397A5ae9F6",
        "data": "0xa44bbb150000000000000000...", // input data
        "value": "3041816680838351"
    }
}

request:

https://open-api.openocean.finance/cross_chain/v1/cross/ate/swap

Request Body:

{
    "account": "0x2132b141D19D7563e686Bb6f4764C7cE9097D514",
    "route": {
                "isApprovalRequired": true,
                "allowanceTarget": "0x018fEADD83a8f2ad4d2508469a3a3215483C4377",
                "middlewareRoute": [
                    {
                        "137": {
                            "middlewareId": 7,
                            "middlewareName": "OpenOcean",
                            "middlewareInfo": {
                                "displayName": "OpenOcean",
                                "icon": "https://ethapi.openocean.finance/logos/bsc/0x9029fdfae9a03135846381c7ce16595c3554e10a.png"
                            },
                            "fromAsset": {
                                "ids": "tether",
                                "name": "Tether USD",
                                "address": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
                                "decimals": 6,
                                "symbol": "USDT",
                                "chain": "polygon",
                                "chainId": "137",
                                "icon": "https://s3.openocean.finance/images/1640831384587_011475796734160326.png"
                            },
                            "toAsset": {
                                "ids": "usd-coin",
                                "name": "USD Coin",
                                "address": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
                                "decimals": 6,
                                "symbol": "USDC",
                                "chain": "polygon",
                                "chainId": "137",
                                "icon": "https://ethapi.openocean.finance/logos/polygon/0x2791bca1f2de4661ed88a30c99a7a9449aa84174.png"
                            },
                            "inputAmount": "29670300",
                            "outputAmount": "29757056",
                            "value": 0
                        }
                    }
                ],
                "bridgeRoute": {
                    "bridgeId": 23,
                    "messageBus": "0x4a364f8c717cAAD9A442737Eb7b8A55cc6cf18D8",
                    "tokenReceiver": "0x04954F93D189c9aFB6E09c47a55d9A124537aB08",
                    "bridgeInfo": {
                        "serviceTime": 600000,
                        "displayName": "Stargate Bridge",
                        "icon": "https://cloudstorage.openocean.finance/static/stargate.svg",
                        "code": "stargate"
                    },
                    "fromAsset": {
                        "ids": "tether",
                        "name": "Binance-Peg USD (T)",
                        "address": "0x55d398326f99059ff775485246999027b3197955",
                        "decimals": 18,
                        "symbol": "USDT",
                        "chain": "bsc",
                        "chainId": "56",
                        "icon": "https://ethapi.openocean.finance/logos/bsc/0x55d398326f99059ff775485246999027b3197955.png",
                        "cross": "0xedf0c420bc3b92b961c6ec411cc810ca81f5f21a"
                    },
                    "fromChainId": "56",
                    "toAsset": {
                        "ids": "tether",
                        "name": "Tether USD",
                        "address": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
                        "decimals": 6,
                        "symbol": "USDT",
                        "chain": "polygon",
                        "chainId": "137",
                        "icon": "https://s3.openocean.finance/images/1640831384587_011475796734160326.png",
                        "cross": "0xedf0c420bc3b92b961c6ec411cc810ca81f5f21a"
                    },
                    "toChainId": "137",
                    "value": 0,
                    "inputAmount": "30000000000000000000",
                    "outputAmount": "29670300"
                },
                "fees": {
                    "gasLimit": [
                        {
                            "chainId": 137,
                            "address": "0x0000000000000000000000000000000000001010",
                            "icon": "https://s3.openocean.finance/images/1637561049975_1903381661429342.png",
                            "name": "Matic",
                            "symbol": "MATIC",
                            "decimals": 18,
                            "ids": "matic-network",
                            "assetAddress": "0x0000000000000000000000000000000000001010",
                            "amount": 465385,
                            "value": 0.05403689156807064
                        }
                    ],
                    "middlewareFee": {
                        "chainId": 56,
                        "address": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
                        "name": "Binance Chain Native Token",
                        "symbol": "BNB",
                        "decimals": 18,
                        "icon": "https://ethapi.openocean.finance/logos/bsc/0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee.png",
                        "ids": "binancecoin",
                        "assetAddress": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
                        "amount": 0
                    },
                    "bridgeFee": {
                        "ids": "tether",
                        "name": "Binance-Peg USD (T)",
                        "address": "0x55d398326f99059ff775485246999027b3197955",
                        "decimals": 18,
                        "symbol": "USDT",
                        "chain": "bsc",
                        "chainId": "56",
                        "icon": "https://ethapi.openocean.finance/logos/bsc/0x55d398326f99059ff775485246999027b3197955.png",
                        "amount": "329699999999999000",
                        "assetAddress": "0x55d398326f99059ff775485246999027b3197955"
                    }
                },
                "type": 1,
                "src_poolId": 2,
                "dst_poolId": 1,
                "src_chainId": 102,
                "dst_chainId": 109
            }
}

responseīŧš

{
    "code": 200,
    "data": {
        "from": "0x2132b141D19D7563e686Bb6f4764C7cE9097D514",
        "to": "0x43c47B76D24Ad1F73f5Ab12442A016397A5ae9F6",
        "data": "0xa44bbb150000000000000000...", // input data
        "value": "3041816680838351"
    }
}

Last updated