Skip to main content

POST /leokit/deposit

Generate unsigned transaction(s) for executing a swap based on a previously obtained quote.

Request Body

{
  "quote_id": "01936b4a-7c8e-7890-abcd-ef1234567890",
  "selected_protocol": "thorchain"
}
FieldTypeRequiredDescription
quote_idstringYesUUID from quote response
selected_protocolstringYesProtocol to use (must exist in quote)

Validation Rules

  1. Quote Existence - Quote must exist in database
  2. Client Ownership - Quote must belong to requesting client (API key match)
  3. Protocol Availability - Selected protocol must be in quote’s available protocols
  4. Quote Expiry - Quote must not be expired (protocol-specific rules)
  5. Ecosystem Support - Blockchain ecosystem must be supported

Response Formats by Ecosystem

The response format varies based on the source blockchain ecosystem.

UTXO Chains (Bitcoin, Litecoin, Dogecoin, Dash)

Supported Chains: BTC, LTC, DOGE, DASH

PSBT Format (BTC, LTC, DOGE)

{
  "type": "UTXO",
  "protocol": "thorchain",
  "quote_id": "01936b4a-7c8e-7890-abcd-ef1234567890",
  "details": {
    "from_address": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
    "to_address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
    "from_asset": "BTC.BTC",
    "to_asset": "ETH.USDC-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
    "amount": "100000000",
    "decimals": 8,
    "memo": "=:ETH.USDC-0xA0b86991:0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb:198500000"
  },
  "unsigned_transaction": {
    "psbt_hex": "cHNidP8BAH0CAAAAAR...",
    "selected_utxos": [
      {
        "txid": "a1b2c3d4e5f67890abcdef1234567890abcdef1234567890abcdef1234567890",
        "vout": 0,
        "value": 105000000,
        "script": "0014751e76e8199196d454941c45d1b3a323f1433bd6"
      }
    ],
    "chain": "BTC"
  }
}

Raw Transaction Format (DASH)

For DASH, raw_unsigned_tx is provided instead of psbt_hex:
{
  "type": "UTXO",
  "protocol": "thorchain",
  "quote_id": "01936b4a-7c8e-7890-abcd-ef1234567890",
  "details": {
    "from_address": "Xy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
    "to_address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
    "from_asset": "DASH.DASH",
    "to_asset": "ETH.USDC-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
    "amount": "100000000",
    "decimals": 8,
    "memo": "=:ETH.USDC-0xA0b86991:0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb:198500000"
  },
  "unsigned_transaction": {
    "raw_unsigned_tx": "0200000001a1b2c3d4...",
    "selected_utxos": [
      {
        "txid": "a1b2c3d4e5f67890abcdef1234567890abcdef1234567890abcdef1234567890",
        "vout": 0,
        "value": 105000000,
        "script": "76a914751e76e8199196d454941c45d1b3a323f1433bd688ac"
      }
    ],
    "chain": "DASH"
  }
}

Key Features

  • PSBT Format: Bitcoin, Litecoin, Dogecoin use Partially Signed Bitcoin Transaction format
  • OP_RETURN Memo: Embedded in transaction for THORChain/MAYA swaps
  • UTXO Selection: Automatic selection with fee estimation
  • Change Outputs: Only created if above dust threshold (546 sats for BTC/LTC, 1 DOGE for DOGE)

Memo Length Limits

  • BTC/LTC: 150 bytes (OP_RETURN limit: 80 bytes)
  • DOGE: 80 bytes

EVM Chains (Ethereum, BSC, Arbitrum, etc.)

Supported Chains: ETH, BSC, ARB, AVAX, BASE, POLYGON, OPTIMISM, FANTOM

Native Token Transfer (ETH, BNB, etc.)

{
  "type": "EVM",
  "protocol": "thorchain",
  "quote_id": "01936b4a-7c8e-7890-abcd-ef1234567890",
  "details": {
    "from_address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
    "to_address": "0x1234567890AbcdEF1234567890aBcdef12345678",
    "from_asset": "ETH.ETH",
    "to_asset": "BTC.BTC",
    "amount": "1000000000000000000",
    "decimals": 18,
    "memo": "=:BTC.BTC:bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh:9850000000"
  },
  "unsigned_transactions": [
    {
      "from": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
      "to": "0xD37BbE5744D730a1d98d8DC97c42F0Ca46aD7146",
      "value": "0xde0b6b3a7640000",
      "data": "0x44bc937b0000000000000000000000001234567890abcdef1234567890abcdef12345678...",
      "nonce": 42,
      "chainId": 1,
      "gasLimit": "150000",
      "maxFeePerGas": "50000000000",
      "maxPriorityFeePerGas": "2000000000"
    }
  ]
}

ERC20 Token Transfer with Approval

{
  "type": "EVM",
  "protocol": "thorchain",
  "quote_id": "01936b4a-7c8e-7890-abcd-ef1234567890",
  "details": {
    "from_address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
    "to_address": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
    "from_asset": "ETH.USDC-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
    "to_asset": "BTC.BTC",
    "amount": "2000000000",
    "decimals": 6,
    "memo": "=:BTC.BTC:bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh"
  },
  "unsigned_transactions": [
    {
      "from": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
      "to": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
      "value": "0x0",
      "data": "0x095ea7b3000000000000000000000000d37bbe5744d730a1d98d8dc97c42f0ca46ad714600000000000000000000000000000000000000000000000000000000773594000",
      "nonce": 42,
      "chainId": 1,
      "gasLimit": "60000",
      "maxFeePerGas": "50000000000",
      "maxPriorityFeePerGas": "2000000000"
    },
    {
      "from": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
      "to": "0xD37BbE5744D730a1d98d8DC97c42F0Ca46aD7146",
      "value": "0x0",
      "data": "0x44bc937b...",
      "nonce": 43,
      "chainId": 1,
      "gasLimit": "180000",
      "maxFeePerGas": "50000000000",
      "maxPriorityFeePerGas": "2000000000"
    }
  ]
}

Key Features

  • Multiple Transactions: ERC20 swaps require approval + deposit transactions
  • USDT Special Case: Allowance reset to 0 before setting new amount
  • Nonce Sequencing: Sequential nonce for each transaction in array
  • EIP-1559: Supports both legacy (gasPrice) and EIP-1559 (maxFeePerGas) formats
  • Router Contracts: THORChain/MAYA use depositWithExpiry function
  • Direct Transfers: Chainflip and NEAR use simple transfers to deposit addresses

NEAR Protocol

Native NEAR Transfer

{
  "type": "NEAR",
  "protocol": "near",
  "quote_id": "01936b4a-7c8e-7890-abcd-ef1234567890",
  "details": {
    "from_address": "alice.near",
    "to_address": "bob.near",
    "from_asset": "NEAR.NEAR",
    "to_asset": "ETH.USDC-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
    "amount": "5000000000000000000000000",
    "decimals": 24
  },
  "unsigned_transaction": {
    "receiverId": "swap.1click.near",
    "actions": [
      {
        "type": "Transfer",
        "params": {
          "deposit": "5000000000000000000000000"
        }
      }
    ]
  }
}

NEP-141 Token Transfer

{
  "type": "NEAR",
  "protocol": "near",
  "quote_id": "01936b4a-7c8e-7890-abcd-ef1234567890",
  "details": {
    "from_address": "alice.near",
    "to_address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
    "from_asset": "NEAR.USDC-a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.factory.bridge.near",
    "to_asset": "ETH.ETH",
    "amount": "2000000000",
    "decimals": 6
  },
  "unsigned_transaction": {
    "receiverId": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.factory.bridge.near",
    "actions": [
      {
        "type": "FunctionCall",
        "params": {
          "methodName": "ft_transfer",
          "args": {
            "receiver_id": "swap.1click.near",
            "amount": "2000000000",
            "memo": null
          },
          "gas": "30000000000000",
          "deposit": "1"
        }
      }
    ]
  }
}

Key Features

  • YoctoNEAR: All amounts in yoctoNEAR (10^24 for native NEAR)
  • Fixed Gas: 30 TGas for ft_transfer calls
  • Attached Deposit: 1 yoctoNEAR required for token transfers
  • Contract Parsing: Extracts contract address from asset format

Cosmos Chains

Supported Chains: Cosmos Hub, Kujira, THORChain (native RUNE)

MsgSend (Standard Cosmos Transfer)

{
  "type": "COSMOS",
  "protocol": "thorchain",
  "quote_id": "01936b4a-7c8e-7890-abcd-ef1234567890",
  "details": {
    "from_address": "cosmos1xyz...",
    "to_address": "thor1abc...",
    "from_asset": "GAIA.ATOM",
    "to_asset": "ETH.USDC-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
    "amount": "1000000",
    "decimals": 6,
    "memo": "=:ETH.USDC:0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb"
  },
  "unsigned_transaction": {
    "msgs": [
      {
        "typeUrl": "/cosmos.bank.v1beta1.MsgSend",
        "value": {
          "fromAddress": "cosmos1xyz...",
          "toAddress": "cosmos1depositaddress...",
          "amount": [
            {
              "denom": "uatom",
              "amount": "1000000"
            }
          ]
        }
      }
    ],
    "fee": {
      "gas": "200000",
      "amount": [
        {
          "denom": "uatom",
          "amount": "5000"
        }
      ]
    },
    "memo": "=:ETH.USDC:0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
    "chainId": "cosmoshub-4",
    "accountNumber": 12345,
    "sequence": 67
  }
}

MsgDeposit (THOR.RUNE Native Swaps)

{
  "type": "COSMOS",
  "protocol": "thorchain",
  "quote_id": "01936b4a-7c8e-7890-abcd-ef1234567890",
  "details": {
    "from_address": "thor1abc...",
    "to_address": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
    "from_asset": "THOR.RUNE",
    "to_asset": "BTC.BTC",
    "amount": "100000000",
    "decimals": 8,
    "memo": "=:BTC.BTC:bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh"
  },
  "unsigned_transaction": {
    "msgs": [
      {
        "typeUrl": "/types.MsgDeposit",
        "value": {
          "coins": [
            {
              "asset": "THOR.RUNE",
              "amount": "100000000"
            }
          ],
          "memo": "=:BTC.BTC:bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
          "signer": "thor1abc..."
        }
      }
    ],
    "fee": {
      "gas": "250000",
      "amount": [
        {
          "denom": "rune",
          "amount": "2000000"
        }
      ]
    },
    "chainId": "thorchain-mainnet-v1",
    "accountNumber": 12345,
    "sequence": 67
  }
}

Key Features

  • Gas Simulation: Real-time estimation with 30% buffer
  • Dynamic Fees: Based on recommended_gas_rate from inbound_addresses API
  • Account Lookup: Fetches sequence and account number automatically
  • Fixed RUNE Fee: 0.02 RUNE for THORChain transactions

Other Ecosystems

TRON

{
  "type": "TRON",
  "protocol": "thorchain",
  "quote_id": "01936b4a-7c8e-7890-abcd-ef1234567890",
  "details": {
    "from_address": "TXyz123...",
    "to_address": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
    "from_asset": "TRON.TRX",
    "to_asset": "BTC.BTC",
    "amount": "1000000",
    "decimals": 6,
    "memo": "=:BTC.BTC:bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh"
  },
  "unsigned_transaction": {
    "raw_data": {...},
    "raw_data_hex": "0a02...",
    "txID": "abc123..."
  }
}

Cardano

{
  "type": "CARDANO",
  "protocol": "thorchain",
  "quote_id": "01936b4a-7c8e-7890-abcd-ef1234567890",
  "details": {
    "from_address": "addr1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh...",
    "to_address": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
    "from_asset": "CARDANO.ADA",
    "to_asset": "BTC.BTC",
    "amount": "1000000",
    "decimals": 6,
    "memo": "=:BTC.BTC:bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh"
  },
  "unsigned_transaction": {
    "cbor_hex": "84a40081..."
  }
}

XRP

{
  "type": "XRP",
  "protocol": "thorchain",
  "quote_id": "01936b4a-7c8e-7890-abcd-ef1234567890",
  "details": {
    "from_address": "rXyz123...",
    "to_address": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
    "from_asset": "XRP.XRP",
    "to_asset": "BTC.BTC",
    "amount": "1000000",
    "decimals": 6,
    "memo": "=:BTC.BTC:bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh"
  },
  "unsigned_transaction": {
    "tx_blob": "120000228000000024...",
    "hash": "ABC123..."
  }
}