This quickstart guide walks you through performing a cross-chain swap using the dKit API. We’ll swap ETH on Ethereum to BTC on Bitcoin via THORChain as an example.
Make sure you have your wallet connected and funded with the asset you want to swap.

Step 1: Get a Quote

First, get available routes and pricing for your swap. The quote endpoint will return the best available routes across all integrated DEXs.
curl --location 'https://api.dkit.xyz/v1/quote' \
--header 'Content-Type: application/json' \
--header 'x-api-key: 86c3fc76-25c8-455c-8d6d-0ecea88d0f6e' \
--data '{
    "sellAsset": "ETH.ETH",
    "sellAmount": "0.5",
    "buyAsset": "BTC.BTC",
    "slippage": 3,
    "affiliate": "dkit",
    "affiliateFee": 50,
    "includeTx": true,
    "providers": [
        "THORCHAIN"
    ],
    "sourceAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb7",
    "destinationAddress": "bc1qns9f7yfx3ry9lj6yz7c9er0vwa0ye2eklpzqfw"
}'
The quoteId and routeIndex of the response are used to fetch the status of the swap via the /track endpoint and return rich information on the route.

Step 2: Execute the Swap

Use the quote information to submit your transaction on-chain. For this ETH to BTC swap via THORChain, you’ll send ETH to the inbound address with the memo.
import { ethers } from 'ethers';

const executeSwap = async (route) => {
  // Connect to wallet (MetaMask, WalletConnect, etc.)
  const provider = new ethers.providers.Web3Provider(window.ethereum);
  const signer = provider.getSigner();
  
  // For THORChain swaps: send ETH to inbound address with memo
  const tx = {
    to: route.inboundAddress,
    value: ethers.utils.parseEther(route.sellAmount), // Convert 0.5 ETH to wei
    data: ethers.utils.toUtf8Bytes(route.memo),
    gasLimit: 100000
  };
  
  const txResponse = await signer.sendTransaction(tx);
  console.log('Transaction sent:', txResponse.hash);
  
  // Wait for transaction confirmation
  const receipt = await txResponse.wait();
  console.log('Transaction confirmed in block:', receipt.blockNumber);
  
  return txResponse.hash;
};

// Execute using the route from Step 1
const route = await getQuote();
const txHash = await executeSwap(route);
Always verify the targetAddress or inboundAddress matches what the quote returned before sending funds.

Step 3: Track Your Swap

Monitor the progress of your swap until completion. The swap tracking endpoint accepts the quoteId and routeIndex from the quote response and provides real-time status updates with rich route information.
curl --location 'https://api.dkit.xyz/v1/track' \
--header 'content-type: application/json' \
--header 'x-api-key: 86c3fc76-25c8-455c-8d6d-0ecea88d0f6e' \
--data '{
    "hash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
    "chainId": "ethereum",
    "quoteId": "a7c4b3ef-51d2-4c78-b8e1-8b3e12f7a6d9",
    "routeIndex": 0
}'
Congratulations! You’ve completed your first cross-chain swap with dKit.

What’s Next?