This guide uses a test API key. Planning to build a production app with our API? Reach out to us in the Townhall.

1

Get Quote

Let’s get a quote to trade 0.0005 BTC on Bitcoin Testnet4 to WBTC on Base Sepolia.

curl -X 'GET' 'https://testnet.api.garden.finance/v2/quote?from=bitcoin_testnet:btc&to=base_sepolia:wbtc&from_amount=50000' \
-H 'garden-app-id: f242ea49332293424c96c562a6ef575a819908c878134dcb4fce424dc84ec796' \
-H 'accept: application/json'                

Try it out here

2

Submit Order

curl --location 'http://testnet.api.garden.finance/v2/orders' \
    --header 'garden-app-id: f242ea49332293424c96c562a6ef575a819908c878134dcb4fce424dc84ec796' \
    --header 'Content-Type: application/json' \
    --data '{
        "source": {
            "asset": "bitcoin_testnet:btc",
            "owner": "tb1p4pr78swsn60y4ushe05v28mqpqppxxkfkxu2wun5jw6duc8unj3sjrh4gd"
            "amount": "50000"
        },
        "destination": {
            "asset": "base_sepolia:wbtc",
            "owner": "0x004Cc75ACF4132Fc08cB6a252E767804F303F729"
            "amount": "49850"
        }
    }'

Try it out here

Response
{
    "status": "Ok",
    "result": {
        "order_id": "f8a12d1320fce93c5888b6014abeb5f5de85ecc8c0eef8133f3da03822592121",
        "to": "tb1ptt49v22dcst7mquwfsmcu2t56xjg07whtcgufvhjuj5zu89y6q0qn8fvfp",
        "amount": "50000"
    }
}

Send 0.0005 BTC to tb1ptt49v22dcst7mquwfsmcu2t56xjg07whtcgufvhjuj5zu89y6q0qn8fvfp, you can use our faucet

3

Check Order Status

Wait until the order.destination_swap.redeem_tx_hash is set

curl -X 'GET' \
'http://testnet.api.garden.finance/v2/orders/id/f8a12d1320fce93c5888b6014abeb5f5de85ecc8c0eef8133f3da03822592121' \
-H 'garden-app-id: f242ea49332293424c96c562a6ef575a819908c878134dcb4fce424dc84ec796' \
-H 'accept: application/json'                

Try it out here

Congratulations, you have successfully completed a cross-chain swap!