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}/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"
}

PreviousGET /trade/v1/{chainId}/quote/cross 1NextSending transactions

Last updated 9 months ago

Was this helpful?