Skip to main content
POST
Create a chain-agnostic Arkade-to-EVM swap.

Body

application/json

Chain-agnostic request for Arkade-to-EVM swaps.

The caller specifies the target chain via evm_chain_id and the token via its ERC-20 contract token_address. This endpoint supports any token reachable through 1inch aggregation (which covers Uniswap, Curve, etc.).

arkade_htlc_script_version
integer<int64>
required

Arkade HTLC script version. New swaps must use version 1.

claiming_address
string
required

EVM address that will sign the HTLC claim (SDK-derived for gasless claims). Typed: garbage is rejected at deserialization, before an invoice/HTLC exists — a background funder can never be handed an unparseable claim address. Always an EVM address, even for Solana bridge targets (the claim happens on the hub chain).

evm_chain_id
integer<int64>
required

Numeric EVM chain ID: 1 (Ethereum), 137 (Polygon), 42161 (Arbitrum).

Required range: x >= 0
hash_lock
string
required

Hash lock provided by the client (32-byte hex string with 0x prefix).

refund_pk
string
required

Refund public key used to generate the Arkade VHTLC.

target_address
string
required

Recipient where tokens land after the claim (user's final destination). An EVM hex address, or a base58 Solana pubkey for a Solana bridge target.

token_address
string
required

ERC-20 contract address of the desired token on the target chain.

user_id
string
required

User ID derived from wallet for recovery purposes.

amount_in
integer<int64> | null

How many sats the user wants to send (mutually exclusive with amount_out). Value is in satoshis (smallest BTC unit).

Required range: x >= 0
amount_out
string | null

How much target token the user wants to receive (mutually exclusive with amount_in). Value is in the target token's smallest unit (e.g. for USDC with 6 decimals, 1000000 = 1 USDC).

bridge_recipient_setup
boolean

ATA-existence flag for non-EVM CCTP destinations (Solana). See BitcoinToEvmSwapRequest::bridge_recipient_setup.

bridge_target_chain
string | null

Optional: CCTP bridge destination chain (e.g., "Ethereum", "Arbitrum"). When set, USDC will be bridged to this chain after the DEX swap.

bridge_target_token_address
string | null

Optional: USDC address on the bridge destination chain.

extra_fees
integer<int32> | null

Optional per-swap fee surcharge in basis points (0..=max_extra_fee_bps configured on the matching developer key).

Required range: x >= 0
gasless
boolean

Whether the server should execute the DEX swap on behalf of the user (gasless claim). When true, the gasless network fee is added to the total fee charged. Defaults to true.

referral_code
string | null

Optional referral code for tracking.

Response

Swap created successfully

Arkade → EVM swap response

arkade_htlc_script_version
integer<int64>
required
arkade_server_pk
string
required
btc_vhtlc_address
string
required
chain
string
required
client_evm_address
string
required

EVM address that will sign the HTLC claim (SDK-derived for gasless claims).

created_at
string<date-time>
required
evm_chain_id
integer<int64>
required
evm_coordinator_address
string
required
evm_expected_sats
string
required
evm_htlc_address
string
required
evm_htlc_kind
enum<string>
required

HTLC family of the lock: erc20 (HTLCErc20 + HTLCCoordinator) or native (HTLCNative + HTLCNativeCoordinator).

Available options:
erc20,
native
evm_htlc_version
integer<int64>
required

HTLCErc20 contract VERSION of the deployment this swap lives on — the EIP-712 domain version string for redeem/refund signatures.

evm_refund_locktime
integer<int64>
required
fee_sats
integer<int64>
required
hash_lock
string
required
id
string
required
network
string
required
receiver_pk
string
required
sender_pk
string
required
server_evm_address
string
required
source_amount
string
required
source_token
object
required
status
enum<string>
required

Atomic swap state machine for BTC --> Target Asset swaps using HTLCs.

Overview

This enum tracks the state of an atomic swap between Bitcoin (via Lightning/Arkade) and Target Asset (on Polygon, Ethereum, etc). The swap uses Hash Time-Locked Contracts (HTLCs) to ensure atomicity without requiring trust.

Normal Flow

  1. Client creates swap request → Pending
  2. Client sends BTC → ClientFunded
  3. Server locks WBTC in Polygon HTLC → ServerFunded
  4. Client reveals secret to claim Target Asset → ClientRedeemed
  5. Server uses secret to claim BTC → ServerRedeemed (terminal)

Refund Flows

State Diagram

See swap_states.md for a complete state diagram and detailed documentation.

Security

  • Bitcoin HTLC timeout must be longer than Polygon HTLC timeout
  • Secret becomes public when client claims TargetAsset on Polygon
  • ClientRefundedServerFunded is an error state that should never occur
Available options:
pending,
clientfundingseen,
clientfunded,
clientrefunded,
serverfunded,
clientredeeming,
clientredeemed,
serverredeemed,
clientfundedserverrefunded,
clientrefundedserverfunded,
clientrefundedserverrefunded,
expired,
clientinvalidfunded,
clientfundedtoolate,
serverwontfund,
clientredeemedandclientrefunded
target_amount
string
required
target_token
object
required
unilateral_claim_delay
integer<int64>
required
unilateral_refund_delay
integer<int64>
required
unilateral_refund_without_receiver_delay
integer<int64>
required
vhtlc_refund_locktime
integer<int64>
required
wbtc_address
string
required

WBTC token contract address on the target EVM chain (the token locked in the HTLC).

bridge_target_chain
string | null

CCTP bridge destination chain. When set, USDC is bridged cross-chain after the swap.

bridge_target_token_address
string | null

USDC address on the bridge destination chain.

btc_claim_txid
string | null
btc_fund_txid
string | null
evm_claim_txid
string | null
evm_fund_txid
string | null
target_evm_address
string | null

EVM address where tokens are swept after the claim (user's final destination).