LogoLogo
  • Introduction to Unizen
    • Unizen Overview
      • Unizen Liquidity Distribution Mechanism (ULDM)
        • ULDM Performance
      • Unizen Interoperability Protocol (UIP)
        • LayerZero
        • DeBridge
        • Stargate
        • Celer
        • Axelar
        • Thorchain
    • Unizen Dashboard
      • General
      • Portfolio
      • History
    • Unizen Trade
      • Fees
    • Unizen Explore
      • Unizen Omni-Chain Data Pool
    • Unizen Earn
  • ZCX
    • Token Utility
    • Tokenomics
  • API - Introduction
    • Introduction
    • Before you get started
      • Understanding Price Impact and Price Slippage in Token Swaps
      • Token Allowance Management for Non-updatable Allowance Tokens
      • Tokens with taxes
      • Wrapping and Unwrapping Native Tokens
      • Quote expiration deadline
    • Security Best Practices for Integrating Unizen
      • Why disable CORS
      • How to integrate with a reverse proxy
    • Version 2 of our smart contracts
      • Migration to smart contract v2
  • API - GET STARTED
    • QuickStart guide
    • Swagger
    • Information endpoints
      • GET /trade/v1/info/chains
      • GET /trade/v1/info/sources
      • GET/v1/info/cross-providers
      • GET /trade/v1/info/token/search
      • GET /v1/info/token/popular
      • GET /trade/v1/info/token/{chainId}/{tokenAddress}
      • GET /trade/v1/info/tokenLogo/{chainId}/{tokenAddress}
      • GET /info/thorchain-inbound-address
      • GET /trade/v1/info/tx/{txHash}
      • GET /trade/v1/info/trade/{chainId}/{txHash}
      • GET /trade/v1/info/trades
    • Approval
      • GET /trade/v1/{chainId}/approval/spender
      • GET /trade/v1/{chainId}/approval/transaction
      • GET /trade/v1/{chainId}/approval/allowance
    • Single-Chain Swap
      • GET /trade/v1/{chainId}/quote/single
      • GET /trade/v1/{chainId}/swap/single
      • Send transaction in evm chains
      • Send transaction in Solana
    • Cross-Chain Swap
      • GET /trade/v1/{chainId}/quote/cross
      • GET /trade/v1/{chainId}/swap/cross
      • Send transaction
    • Gasless orders
      • POST /trade/v1/gasless/typed-data
      • POST /v1/gasless/estimate
      • POST /v1/gasless/create
      • POST /v1/gasless/cancel
      • GET /trade/v1/gasless/status/{orderId}
      • GET /v1/gasless/orderByAddress/{address}
    • UTXO Assets and Cosmos Swap
      • GET /trade/v1/{chainId}/quote/cross 1
      • GET /trade/v1/{chainId}/swap/cross
      • Sending transactions
    • Efficient Quote Retrieval with Batch Processing
      • GET /trade/v1/{chainId}/batch_quote/single
    • Error Messages
  • GASLESS TRADES
    • Obtaining gasless quotes
    • Gas estimation
    • Executing the trade
    • Following the orders
  • On-Chain Contracts - Get Started
    • Integration with Unizen Contracts for Token Swapping
    • Registering Errors on Smart Contract Calls
  • PERMIT2
    • What is Permit2?
    • Usage in our api
  • WIDGET - Get Started
    • Embed the Unizen Widget
    • Playground
  • Other
    • Smart Contracts
    • Security Audits
    • Roadmap
  • links
    • Unizen
    • Marketing Website
    • Medium
    • Twitter
    • Discord
    • Telegram
Powered by GitBook
On this page

Was this helpful?

  1. API - GET STARTED
  2. UTXO Assets and Cosmos Swap

GET /trade/v1/{chainId}/quote/cross 1

For UTXO Assets and Cosmos trade, currently we only support trading:

  • All currencies on Ethereum, Avax, Binance Smart Chain networks -> UTXO Assets and Cosmos

  • UTXO Assets and Cosmos -> Native Currency on Ethereum, Avax, Binance Smart Chain

  • UTXO Assets and Cosmos -> UTXO Assets and Cosmos

List of chain id and decimals for UTXO and Cosmos

  • BTC: chainId: -3980891822, decimals 8

  • BCH: chainId: -174457306, decimals 8

  • LTC: chainId: -33463083, decimals 8

  • DOGE: chainId: -3143381382, decimals 8

  • GAIA (Cosmos) : chainId: -978111860, decimals 6

Parameters

This is the list of important params for UTXO and Cosmos trade

Name
Description

fromTokenAddress*

The address of the token being traded. If native, use address zero: 0x0000000000000000000000000000000000000000.

For UTXO or Cosmos assets, use Address Zero

Example: 0x0000000000000000000000000000000000000000

toTokenAddress*

Zero address, as we only support trade from native UTXO or Cosmos to Ethereum on the Ethereum mainnet, Avax on the Avax, and BNB on Binance Smart Chain network. Example: 0x0000000000000000000000000000000000000000

amount*

Amount of tokens being traded. Example: 1 BTC → 100000000, 1 ETH → 1000000000000000000

destinationChainId*

The chain ID of the destination network Available values: 1, 56, 43114, -3980891822, -174457306, -33463083, -3143381382, -978111860

sender*

The address of the sender. If trading from UTXO or Cosmos to EVM, the sender is your UTXO or Cosmos address. If trading from EVM to UTXO or Cosmos, the sender is your EVM address.

receiver*

The address of the receiver. If trading from UTXO or Cosmos to EVM, the receiver is your EVM address. If trading from EVM to UTXO or Cosmos, the receiver is your UTXO or Cosmos address. Example: - BTC: bc1qf7cd6pvs9sqnkr0nadsuhgecy8prnc9t8k0jny - BCH: qpg6w46s2l25d2mehycfay8hrntwz4l4ty8cuju0np - DOGE: DGcwfQ8tb6BXK4nv2wE28Vs9Aw56LaEV28 - LTC: ltc1q08tx4wsj2vmdttz7tys0275a7wrenlqpqcw8zc - Cosmos: cosmos1aac5zxrt2xj39pujq5594w86ywntkal5skju7w

isExactOut

For UTXO assets and Cosmos trade, we don't support exact out trade. isExactOut is false for this trade

chainId*

The chain ID of the chain to quote on. Available values: 1, 56, 43114, -3980891822, -174457306, -33463083, -3143381382, -978111860

Response

200: OK The response is an array of objects. Currently, we only support Thorchain for native UTXO assets and Cosmos trade, so this array will have only one item for Thorchain.

{
    "srcTradeList": [
        {
            "fee": "0",
            "toTokenAmountWithoutFee": "100895388037136513049",
            "fromTokenAmount": "100000000000000000000",
            "toTokenAmount": "100895388037136513049",
            "deltaAmount": "100695474535918293668",
            "tokenFrom": {
                "name": "USDC",
                "symbol": "USDC",
                "decimals": 18,
                "contractAddress": "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
                "priceInUsd": 0.9999971484215191,
                "chainId": 56,
                "buyTax": 0,
                "sellTax": 0
            },
            "tokenTo": {
                "name": "Tether USDt",
                "symbol": "USDT",
                "decimals": 18,
                "contractAddress": "0x55d398326f99059fF775485246999027B3197955",
                "priceInUsd": 1.000470720675468,
                "chainId": 56,
                "buyTax": 0,
                "sellTax": 0
            },
            "tradeType": 0,
            "protocol": [
                {
                    "name": "PancakeSwap Stable",
                    "logo": "https://pancakeswap.finance/favicon.ico",
                    "route": [
                        "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
                        "0x55d398326f99059fF775485246999027B3197955"
                    ],
                    "percentage": 100
                }
            ],
            "transactionData": {
                "info": {
                    "feePercent": 0,
                    "sharePercent": 0,
                    "srcToken": "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
                    "dstToken": "0x55d398326f99059fF775485246999027B3197955",
                    "deadline": 1723712648,
                    "slippage": 0.002,
                    "tokenHasTaxes": false,
                    "path": [
                        "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
                        "0x55d398326f99059fF775485246999027B3197955"
                    ],
                    "tradeType": 0,
                    "amountIn": "100000000000000000000",
                    "amountOutMin": "99756837107886218311",
                    "actualQuote": "99956750609104427165",
                    "uuid": "UNIZEN-CLI",
                    "apiId": "17",
                    "userPSFee": 0
                },
                "call": [
                    {
                        "targetExchange": "0xC6665d98Efd81f47B03801187eB46cbC63F328B0",
                        "targetExchangeID": "pancakeStable",
                        "sellToken": "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
                        "buyToken": "0x55d398326f99059fF775485246999027B3197955",
                        "amountDelta": "99756837107886218311",
                        "amount": "100000000000000000000",
                        "data": "0xa6cbf4170000000000000000000000008ac76a51cc950d9822d68b83fe1ad97b32cd580d00000000000000000000000055d398326f99059ff775485246999027b31979550000000000000000000000000000000000000000000000056bc75e2d6310000000000000000000000000000000000000000000000000000568677ad0b4105c470000000000000000000000000000000000000000000000000000000000000000"
                    }
                ]
            },
            "nativeValue": "0",
            "contractVersion": "v1",
            "gasPrice": "1000000000"
        },
    ],
    "dstTradeList": [],
    "srcTrade": {
        "fee": "0",
        "toTokenAmountWithoutFee": "100895388037136513049",
        "fromTokenAmount": "100000000000000000000",
        "toTokenAmount": "100895388037136513049",
        "deltaAmount": "100695474535918293668",
        "tokenFrom": {
            "name": "USDC",
            "symbol": "USDC",
            "decimals": 18,
            "contractAddress": "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
            "priceInUsd": 0.9999971484215191,
            "chainId": 56,
            "buyTax": 0,
            "sellTax": 0
        },
        "tokenTo": {
            "name": "Tether USDt",
            "symbol": "USDT",
            "decimals": 18,
            "contractAddress": "0x55d398326f99059fF775485246999027B3197955",
            "priceInUsd": 1.000470720675468,
            "chainId": 56,
            "buyTax": 0,
            "sellTax": 0
        },
        "tradeType": 0,
        "protocol": [
            {
                "name": "PancakeSwap Stable",
                "logo": "https://pancakeswap.finance/favicon.ico",
                "route": [
                    "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
                    "0x55d398326f99059fF775485246999027B3197955"
                ],
                "percentage": 100
            }
        ],
        "transactionData": {
            "info": {
                "feePercent": 0,
                "sharePercent": 0,
                "srcToken": "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
                "dstToken": "0x55d398326f99059fF775485246999027B3197955",
                "deadline": 1723712648,
                "slippage": 0.002,
                "tokenHasTaxes": false,
                "path": [
                    "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
                    "0x55d398326f99059fF775485246999027B3197955"
                ],
                "tradeType": 0,
                "amountIn": "100000000000000000000",
                "amountOutMin": "99756837107886218311",
                "actualQuote": "99956750609104427165",
                "uuid": "UNIZEN-CLI",
                "apiId": "17",
                "userPSFee": 0
            },
            "call": [
                {
                    "targetExchange": "0xC6665d98Efd81f47B03801187eB46cbC63F328B0",
                    "targetExchangeID": "pancakeStable",
                    "sellToken": "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
                    "buyToken": "0x55d398326f99059fF775485246999027B3197955",
                    "amountDelta": "99756837107886218311",
                    "amount": "100000000000000000000",
                    "data": "0xa6cbf4170000000000000000000000008ac76a51cc950d9822d68b83fe1ad97b32cd580d00000000000000000000000055d398326f99059ff775485246999027b31979550000000000000000000000000000000000000000000000056bc75e2d6310000000000000000000000000000000000000000000000000000568677ad0b4105c470000000000000000000000000000000000000000000000000000000000000000"
                }
            ]
        },
        "nativeValue": "0",
        "contractVersion": "v1",
        "gasPrice": "1000000000"
    },
    "dstTrade": {
        "toTokenAmount": "161293",
        "deltaAmount": "161293",
        "tokenTo": {
            "name": "BTC",
            "symbol": "BTC",
            "decimals": 8,
            "contractAddress": "0x0000000000000000000000000000000000000000",
            "chainId": -3980891822,
            "priceInUsd": 60914.241350926735,
            "buyTax": 0,
            "sellTax": 0
        }
    },
    "transactionData": {
        "inbound_address": "0x9c4c8387b447364e788acaa36ed921c0c6195507",
        "outbound_delay_blocks": 0,
        "outbound_delay_seconds": 0,
        "fees": {
            "asset": "BTC.BTC",
            "affiliate": "414",
            "outbound": "3641",
            "liquidity": "165",
            "total": "4220",
            "slippage_bps": 9,
            "total_bps": 249
        },
        "slippage_bps": 9,
        "streaming_slippage_bps": 9,
        "router": "0xb30ec53f98ff5947ede720d32ac2da7e52a5f56b",
        "expiry": 1723627149,
        "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": "5831301363",
        "recommended_gas_rate": "7",
        "gas_rate_units": "gwei",
        "memo": "=:BTC.BTC:bc1qdp2c5hsk9lwldum5vm2xx65dxacwzxxyy2y4wt::zcx-com:25",
        "expected_amount_out": "161293",
        "expected_amount_out_streaming": "",
        "max_streaming_quantity": 0,
        "streaming_swap_blocks": 0,
        "amount": "100895388037136513049",
        "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": 1723712648,
            "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": "0",
    "nativeFee": "0",
    "tradeProtocol": "CROSS_CHAIN_THORCHAIN",
    "sourceChainId": 56,
    "destinationChainId": -3980891822,
    "contractVersion": "v1",
    "providerInfo": {
        "name": "Thorchain",
        "logo": "https://thorchain.org/images/logos/full-dark.png",
        "website": "https://thorchain.org/",
        "docsLink": "https://thorchain.org/integrate",
        "description": "THORChain is a network that facilitates native asset settlement between Bitcoin, Ethereum, BNB Chain, Avalanche, Cosmos Hub, Dogecoin, Bitcoin Cash & Litecoin"
    },
    "tradeParams": {
        "sender": "0x2472d3EF4bF71af00c3dE490a5a53A99CbAC0791",
        "receiver": "bc1qdp2c5hsk9lwldum5vm2xx65dxacwzxxyy2y4wt",
        "tokenIn": "0x55d398326f99059ff775485246999027b3197955",
        "tokenOut": "0x0000000000000000000000000000000000000000",
        "amount": "100895388037136513049",
        "srcChainId": 56,
        "dstChainId": -3980891822,
        "inNative": true,
        "outNative": true,
        "deadline": 1723627149,
        "tokenInfo": [
            {
                "name": "USDT",
                "symbol": "USDT",
                "decimals": 18,
                "contractAddress": "0x55d398326f99059ff775485246999027b3197955",
                "chainId": 56,
                "buyTax": 0,
                "sellTax": 0
            },
            {
                "name": "BTC",
                "symbol": "BTC",
                "decimals": 8,
                "contractAddress": "0x0000000000000000000000000000000000000000",
                "chainId": -3980891822,
                "priceInUsd": 60914.241350926735,
                "buyTax": 0,
                "sellTax": 0
            }
        ]
    }
}

PreviousUTXO Assets and Cosmos SwapNextGET /trade/v1/{chainId}/swap/cross

Last updated 9 months ago

Was this helpful?