GET /trade/v1/{chainId}/swap/cross

Parameters

NameDescription

chainId *

The chain ID of the chain to quote on. Available values: 1, 43114, -3980891822

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": {
        "dust_threshold": "10000",
        "expected_amount_out": "1847866609",
        "expected_amount_out_streaming": "",
        "expiry": 1706758452,
        "fees": {
            "affiliate": "4652412",
            "asset": "ETH.ETH",
            "liquidity": "4040448",
            "outbound": "360000",
            "slippage_bps": 21,
            "total": "9052860",
            "total_bps": 48
        },
        "inbound_address": "bc1qkttu0a6gljrrswzyw3rwp59sunjep7zfqgyvr9",
        "inbound_confirmation_blocks": 1,
        "inbound_confirmation_seconds": 600,
        "max_streaming_quantity": 0,
        "memo": "=:ETH.ETH:0x207ca4370639120f9A049aF9CAB4fCaa608F2445::zcx-com:25",
        "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 (P2WSH with Bech32 address format preferred).",
        "outbound_delay_blocks": 103,
        "outbound_delay_seconds": 618,
        "recommended_min_amount_in": "222000",
        "slippage_bps": 21,
        "streaming_slippage_bps": 21,
        "streaming_swap_blocks": 0,
        "total_swap_seconds": 1218,
        "warning": "Do not cache this response. Do not send funds after the expiry.",
        "amount": "100000000",
        "tradeType": "BTC_TO_NATIVE",
        "tradeProtocol": "CROSS_CHAIN_THORCHAIN"
    },
    "nativeValue": "100000000",
    "account": "bc1qdp2c5hsk9lwldum5vm2xx65dxacwzxxyy2y4wt"
}

Response

Response for trade from BTC 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