Cross Chain API

Get MinSend

  • Method: Get

  • URL: https://api.0xgen.io/cross_chain/v1/cross/getMinSend

  • Parameters:

{
    fromChainId: String // from chain id 
    toChainId: String // destination chain id
    address: String // token address
}
  • Example:

Request:

https://api.0xgen.io/cross_chain/v1/cross/getMinSend?fromChainId=56&toChainId=137&address=0x55d398326f99059ff775485246999027b3197955

Response:

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

Get Cross Status

  • Method: Get

  • URL: https://api.0xgen.io/cross_chain/v1/cross/getCrossStatus

  • Parameters:

{
    chainId: String //source chain Id
    hash: String //source hash
}
  • Example:

Request:

https://api.0xgen.io/cross_chain/v1/cross/getCrossStatus?chainId=56&hash=0x3703cb8300422f2beceba6a71cc6615008d26c42a0ab4b31d041289fc3b9de3e

Response:

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

Quote Route

  • Method: Get

  • URL: https://api.0xgen.io/cross_chain/v1/cross/quote

  • Parameters:

{
    fromChainId: String //Source chain id
    toChainId: String //dst chain id
    fromSymbole: String //source chain token symbol
    toSymbole: String // dst chain token symbol
    amount: String //with decimals
}
  • Example:

Request:

https://api.0xgen.io/cross_chain/v1/cross/quote?fromSymbol=USDT&fromChainId=56&toSymbol=USDT&toChainId=137&amount=100000000000000000000000

Response:

{
    "code": 200,
    "data": {
        "fromAsset": {
            "ids": "tether",
            "name": "Binance-Peg USD (T)",
            "address": "0x55d398326f99059ff775485246999027b3197955",
            "decimals": 18,
            "symbol": "USDT",
            "chain": "bsc",
            "chainId": 56,
            "icon": "https://0xgencloudStage/logos/bsc/0x55d398326f99059ff775485246999027b3197955.png"
        },
        "fromChainId": "56",
        "toAsset": {
            "ids": "tether",
            "name": "Tether USD",
            "address": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
            "decimals": 6,
            "symbol": "USDT",
            "chain": "polygon",
            "chainId": 137,
            "icon": "https://0xgencloudStage/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://0xgencloudStage/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://0xgencloudStage/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": "https://0xgencloudStage/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://0xgencloudStage/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://0xgencloudStage/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://0xgencloudStage/static/bridge-anyswap.png"
                    },
                    "fromAsset": {
                        "ids": "tether",
                        "name": "Binance-Peg USD (T)",
                        "address": "0x55d398326f99059ff775485246999027b3197955",
                        "decimals": 18,
                        "symbol": "USDT",
                        "chain": "bsc",
                        "chainId": 56,
                        "icon": "https://0xgencloudStage/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://0xgencloudStage/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://0xgencloudStage/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://0xgencloudStage/logos/bsc/0x55d398326f99059ff775485246999027b3197955.png",
                        "amount": "10000000000000000000",
                        "assetAddress": "0x55d398326f99059ff775485246999027b3197955"
                    }
                },
                "data": "0x" // input data
            }
        ],
        "amount": "100000000000000000000000"
    }
}

Last updated