GET /trade/v1/{chainId}/swap/cross
Parameters
Name
Description
chainId *
The chain ID of the chain to quote on. Available values: 1, 56, 43114, -3980891822, -174457306, -33463083, -3143381382, -978111860
Request body
The transaction data for the cross-chain trade.
{
"transactionData": {},// transactionData is transactionData object from quote API
"nativeValue": "29422186306758765852",
"account": "0xF0Fbf42C54Ac40dA016003baD35E5AefaC6E1CE1"
}
For example:
{
transactionData: {
"inbound_address": "0x9c4c8387b447364e788acaa36ed921c0c6195507",
"outbound_delay_blocks": 0,
"outbound_delay_seconds": 0,
"fees": {
"asset": "BTC.BTC",
"affiliate": "412",
"outbound": "2427",
"liquidity": "164",
"total": "3003",
"slippage_bps": 9,
"total_bps": 179
},
"slippage_bps": 9,
"streaming_slippage_bps": 9,
"router": "0xb30ec53f98ff5947ede720d32ac2da7e52a5f56b",
"expiry": 1723627398,
"warning": "Do not cache this response. Do not send funds after the expiry.",
"notes": "Base Asset: Send the inbound_address the asset with the memo encoded in hex in the data field. Tokens: First approve router to spend tokens from user: asset.approve(router, amount). Then call router.depositWithExpiry(inbound_address, asset, amount, memo, expiry). Asset is the token contract address. Amount should be in native asset decimals (eg 1e18 for most tokens). Do not send to or from contract addresses.",
"recommended_min_amount_in": "5845355010",
"recommended_gas_rate": "7",
"gas_rate_units": "gwei",
"memo": "=:BTC.BTC:bc1qdp2c5hsk9lwldum5vm2xx65dxacwzxxyy2y4wt::zcx-com:25",
"expected_amount_out": "161754",
"expected_amount_out_streaming": "",
"max_streaming_quantity": 0,
"streaming_swap_blocks": 0,
"amount": "100408321618356225713",
"tradeProtocol": "CROSS_CHAIN_THORCHAIN",
"params": {
"uuidPercentage": 0,
"sharePercent": 0
},
"call": [
{
"targetExchange": "0xC6665d98Efd81f47B03801187eB46cbC63F328B0",
"targetExchangeID": "pancakeStable",
"sellToken": "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
"buyToken": "0x55d398326f99059fF775485246999027B3197955",
"amountDelta": "99756837107886218311",
"amount": "100000000000000000000",
"data": "0xa6cbf4170000000000000000000000008ac76a51cc950d9822d68b83fe1ad97b32cd580d00000000000000000000000055d398326f99059ff775485246999027b31979550000000000000000000000000000000000000000000000056bc75e2d6310000000000000000000000000000000000000000000000000000568677ad0b4105c470000000000000000000000000000000000000000000000000000000000000000"
}
],
"info": {
"feePercent": 0,
"sharePercent": 0,
"srcToken": "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
"dstToken": "0x55d398326f99059fF775485246999027B3197955",
"deadline": 1723712898,
"slippage": 0.002,
"tokenHasTaxes": false,
"path": [
"0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
"0x55d398326f99059fF775485246999027B3197955"
],
"tradeType": 0,
"amountIn": "100000000000000000000",
"amountOutMin": "99756837107886218311",
"actualQuote": "99956750609104427165",
"uuid": "UNIZEN-CLI",
"apiId": "17",
"userPSFee": 0,
"memo": "=:BTC.BTC:bc1qdp2c5hsk9lwldum5vm2xx65dxacwzxxyy2y4wt::zcx-com:25",
"vault": "0x9c4c8387b447364e788acaa36ed921c0c6195507"
}
},
"nativeValue": "100000000",
"account": "0x2472d3EF4bF71af00c3dE490a5a53A99CbAC0791" //your account on source chain. if it's UTXO, account is your UTXO address
}
Response
Response for trade from UTXO asset or Cosmos to EVM:
{
"data": {
"method": "transfer",
"params": [
{
"from": "bc1qdp2c5hsk9lwldum5vm2xx65dxacwzxxyy2y4wt",
"recipient": "bc1qkttu0a6gljrrswzyw3rwp59sunjep7zfqgyvr9",
"asset": "BTC.BTC",
"feeRate": 5,
"amount": {
"amount": "100000000",
"decimals": 8
},
"memo": "=:ETH.ETH:0x207ca4370639120f9A049aF9CAB4fCaa608F2445::zcx-com:25"
}
]
}
}
Response for trade from EVM to BTC:
{
"to": "0x0f0ae95b14adb4b5abb75448ffd34753078b1e63",
"data": "0x3d3a4254432e4254433a62633171647032633568736b396c776c64756d35766d327878363564786163777a7878797932793477743a3a7a63782d636f6d3a3235",
"nativeValue": "1000000000000000000"
}
Last updated