This guide uses a testing app ID. Planning to build a production app with our API? Reach out to us in the Townhall.
- From Bitcoin
- From EVM
- From Solana
- From Starknet
1
Get Quote
Let’s get a quote to trade 0.0005 BTC on Bitcoin Testnet4 to WBTC on Base Sepolia.
Copy
Ask AI
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'
Response
Copy
Ask AI
{
"status": "Ok",
"result": [
{
"source": {
"asset": "bitcoin_testnet:btc",
"amount": "50000",
"display": "0.00050000",
"value": "58.8200"
},
"destination": {
"asset": "base_sepolia:wbtc",
"amount": "49850",
"display": "0.00049850",
"value": "58.6435"
},
"solver_id": "0x9dd9c2d208b07bf9a4ef9ca311f36d7185749635"
}
]
}
2
Submit Order
Once a quote is received, we can submit the order:
Copy
Ask AI
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"
}
}'
Response
Copy
Ask AI
{
"status": "Ok",
"result": {
"order_id": "f8a12d1320fce93c5888b6014abeb5f5de85ecc8c0eef8133f3da03822592121",
"to": "tb1ptt49v22dcst7mquwfsmcu2t56xjg07whtcgufvhjuj5zu89y6q0qn8fvfp",
"amount": "50000"
}
}
Send 0.0005 BTC to
tb1ptt49v22dcst7mquwfsmcu2t56xjg07whtcgufvhjuj5zu89y6q0qn8fvfp. You can use our faucet on testnet.3
Check Order Status
Get the order by ID to check the status of the swap.
Copy
Ask AI
curl -X 'GET' \
'https://testnet.api.garden.finance/v2/orders/f8a12d1320fce93c5888b6014abeb5f5de85ecc8c0eef8133f3da03822592121' \
-H 'garden-app-id: f242ea49332293424c96c562a6ef575a819908c878134dcb4fce424dc84ec796' \
-H 'accept: application/json'
Response
Copy
Ask AI
{
"status": "Ok",
"result": {
"created_at": "2025-07-09T04:38:18.632122Z",
"source_swap": {
"created_at": "2025-07-09T04:38:18.632122Z",
"swap_id": "tb1ptt49v22dcst7mquwfsmcu2t56xjg07whtcgufvhjuj5zu89y6q0qn8fvfp",
"chain": "bitcoin_testnet",
"asset": "bitcoin_testnet:btc",
"initiator": "tb1p4pr78swsn60y4ushe05v28mqpqppxxkfkxu2wun5jw6duc8unj3sjrh4gd",
"redeemer": "460f2e8ff81fc4e0a8e6ce7796704e3829e3e3eedb8db9390bdc51f4f04cf0a6",
"delegate": "8f716d079bd4a6cb5c47a24cd22c352ffb50089e4461043cfe3b1f0f9082eec8",
"timelock": 144,
"filled_amount": "500000",
"asset_price": 108468.0,
"amount": "500000",
"secret_hash": "3c4522983261f81e2e679346bbda5dddd8b4ea0367dd4073f73f13320d9dee62",
"secret": "8cb8a02d5592b0b1556978e1d778b7eff2c23519b8aa65970fa6ac3daa33fb40",
"instant_refund_tx": "020000000001013a18563d08a2b7d596488a96065466f52a82c221b981492b1f35b999401de1660000000000ffffffff0120a1070000000000225120a847e3c1d09e9e4af217cbe8c51f600802131ac9b1b8a7727493b4de60fc9ca3044107583b76a92f651f9bb3a34189cd1b81b7f98f99d1ebc71ba313e72c441a96270707d0fda5cacb0b1de2daacae318fa8c44b35881dc0ffd92764c8e1ce0a7bef834107583b76a92f651f9bb3a34189cd1b81b7f98f99d1ebc71ba313e72c441a96270707d0fda5cacb0b1de2daacae318fa8c44b35881dc0ffd92764c8e1ce0a7bef8346208f716d079bd4a6cb5c47a24cd22c352ffb50089e4461043cfe3b1f0f9082eec8ac20460f2e8ff81fc4e0a8e6ce7796704e3829e3e3eedb8db9390bdc51f4f04cf0a6ba529c61c02160e11a135f94e536a5b222e5d09fd9db1be5f5f5e753920290c0410cf388f09023174326647e3e2f5e7b7023a678341cd85556bfe7f539cdd369fd2ab1729114a7bc658045926f1b2c0e0e70292c66bda90ddbbee9e2ba771a4e0a57054bbc00000000",
"initiate_tx_hash": "66e11d4099b9351f2b4981b921c2822af5665406968a4896d5b7a2083d56183a:90249",
"redeem_tx_hash": "7820a77ecd05f4182a0a5595e8364e221bdb1a440507d53bf20c5f658ae3cd67",
"refund_tx_hash": "",
"initiate_block_number": "90249",
"redeem_block_number": "90259",
"refund_block_number": "0",
"required_confirmations": 1,
"current_confirmations": 1,
"initiate_timestamp": null,
"redeem_timestamp": null,
"refund_timestamp": null
},
"destination_swap": {
"created_at": "2025-07-09T04:38:18.632122Z",
"swap_id": "3ab702b4db8f9b54f56d4ceeab7811ee02447785605a2c5b8df7dcc071efed91",
"chain": "base_sepolia",
"asset": "base_sepolia:wbtc",
"initiator": "0x661bA32eb5f86CaB358DDbB7F264b10c5825e2dd",
"redeemer": "0x004Cc75ACF4132Fc08cB6a252E767804F303F729",
"timelock": 3600,
"filled_amount": "498500",
"asset_price": 108468.0,
"amount": "498500",
"secret_hash": "3c4522983261f81e2e679346bbda5dddd8b4ea0367dd4073f73f13320d9dee62",
"secret": "8cb8a02d5592b0b1556978e1d778b7eff2c23519b8aa65970fa6ac3daa33fb40",
"initiate_tx_hash": "0xfb354436bbd8bd57760d82bfb441442e796e60aa7f8cd9e0978aa94a73eab2b8",
"redeem_tx_hash": "0x7b3d81b0caddadbb35a9cf717b5f23b2ceddfa7a1a5251b2dbee723247cffdd6",
"refund_tx_hash": "",
"initiate_block_number": "28133930",
"redeem_block_number": "28133933",
"refund_block_number": "0",
"required_confirmations": 0,
"current_confirmations": 0,
"initiate_timestamp": "2025-07-09T04:42:28Z",
"redeem_timestamp": "2025-07-09T04:42:34Z",
"refund_timestamp": null
},
"nonce": "1751978328975",
"order_id": "f8a12d1320fce93c5888b6014abeb5f5de85ecc8c0eef8133f3da03822592121",
"affiliate_fees": [],
"version": "v2"
}
}
The swap is complete once the
order.destination_swap.redeem_tx_hash field is populated.1
Get Quote
Let’s get a quote to trade 0.0005 WBTC on Ethereum Sepolia to BTC on Bitcoin Testnet4.
Copy
Ask AI
curl -X 'GET' 'https://testnet.api.garden.finance/v2/quote?from=ethereum_sepolia:wbtc&to=bitcoin_testnet:btc&from_amount=50000' \
-H 'garden-app-id: f242ea49332293424c96c562a6ef575a819908c878134dcb4fce424dc84ec796' \
-H 'accept: application/json'
Response
Copy
Ask AI
{
"status": "Ok",
"result": [
{
"source": {
"asset": "ethereum_sepolia:wbtc",
"amount": "50000",
"display": "0.00050000",
"value": "58.8700"
},
"destination": {
"asset": "bitcoin_testnet:btc",
"amount": "49850",
"display": "0.00049850",
"value": "58.6933"
},
"solver_id": "0x9dd9c2d208b07bf9a4ef9ca311f36d7185749635"
}
]
}
2
Submit Order
Once a quote is received, we can submit the order:Then deposit the funds:
Copy
Ask AI
curl --location 'http://testnet.api.garden.finance/v2/orders' \
--header 'garden-app-id: f242ea49332293424c96c562a6ef575a819908c878134dcb4fce424dc84ec796' \
--header 'Content-Type: application/json' \
--data '{
"source": {
"asset": "ethereum_sepolia:wbtc",
"owner": "0x004Cc75ACF4132Fc08cB6a252E767804F303F729",
"amount": "50000"
},
"destination": {
"asset": "bitcoin_testnet:btc",
"owner": "tb1p4pr78swsn60y4ushe05v28mqpqppxxkfkxu2wun5jw6duc8unj3sjrh4gd",
"amount": "49850"
}
}'
Response
Copy
Ask AI
{
"status": "Ok",
"result": {
"order_id": "646eabe9fd9e7612ac712d54d899cf3f1847251927184fbc22d80f2a9a55987d",
"transaction": {
"to": "0x88e1032252c712681a3659986f452e910d2134d8",
"value": "0x0",
"data": "0x97ffc7ae000000000000000000000000661ba32eb5f86cab358ddbb7f264b10c5825e2dd0000000000000000000000000000000000000000000000000000000000001c20000000000000000000000000000000000000000000000000000000000000c35061d22856ce12bc3693df0cd4967d404400449f61810080c52638fd805b379723",
"gas_limit": "0x493e0",
"chain_id": 11155111
},
"typed_data": {
"domain": {
"name": "HTLC",
"version": "2",
"chainId": "0xaa36a7",
"verifyingContract": "0x88e1032252c712681a3659986f452e910d2134d8"
},
"primaryType": "Initiate",
"types": {
"EIP712Domain": [
{
"name": "name",
"type": "string"
},
{
"name": "version",
"type": "string"
},
{
"name": "chainId",
"type": "uint256"
},
{
"name": "verifyingContract",
"type": "address"
}
],
"Initiate": [
{
"name": "redeemer",
"type": "address"
},
{
"name": "timelock",
"type": "uint256"
},
{
"name": "amount",
"type": "uint256"
},
{
"name": "secretHash",
"type": "bytes32"
}
]
},
"message": {
"redeemer": "0x661ba32eb5f86cab358ddbb7f264b10c5825e2dd",
"timelock": "0x1c20",
"amount": "0xc350",
"secretHash": "0x61d22856ce12bc3693df0cd4967d404400449f61810080c52638fd805b379723"
}
}
}
}
- Submit transaction
- Gasless submission
Copy
Ask AI
await window.ethereum.request({
method: 'eth_sendTransaction',
params: [response.result.transaction]
});
Copy
Ask AI
// Sign typed data.
const signature = await window.ethereum.request({
method: 'eth_signTypedData_v4',
params: [userAddress, JSON.stringify(response.result.typed_data)]
});
// Initiate the swap with the signature.
await fetch(`https://testnet.api.garden.finance/v2/orders/${response.result.order_id}?action=initiate`, {
method: 'PATCH',
headers: {
'garden-app-id': 'f242ea49332293424c96c562a6ef575a819908c878134dcb4fce424dc84ec796',
'Content-Type': 'application/json'
},
body: JSON.stringify({ signature })
});
3
Check Order Status
Get the order by ID to check the status of the swap.
Copy
Ask AI
curl -X 'GET' \
'https://testnet.api.garden.finance/v2/orders/646eabe9fd9e7612ac712d54d899cf3f1847251927184fbc22d80f2a9a55987d' \
-H 'garden-app-id: f242ea49332293424c96c562a6ef575a819908c878134dcb4fce424dc84ec796' \
-H 'accept: application/json'
Response
Copy
Ask AI
{
"status": "Ok",
"result": {
"created_at": "2025-07-11T14:48:19.354306Z",
"source_swap": {
"created_at": "2025-07-11T14:48:19.354306Z",
"swap_id": "30facc712b6eaa7a2453dba968da223d180322f224285db2820a8cdd7125147a",
"chain": "ethereum_sepolia",
"asset": "ethereum_sepolia:wbtc",
"initiator": "0x004Cc75ACF4132Fc08cB6a252E767804F303F729",
"redeemer": "0x661bA32eb5f86CaB358DDbB7F264b10c5825e2dd",
"timelock": 7200,
"filled_amount": "0",
"asset_price": 118000.0,
"amount": "50000",
"secret_hash": "61d22856ce12bc3693df0cd4967d404400449f61810080c52638fd805b379723",
"secret": "",
"initiate_tx_hash": "",
"redeem_tx_hash": "",
"refund_tx_hash": "",
"initiate_block_number": "0",
"redeem_block_number": "0",
"refund_block_number": "0",
"required_confirmations": 1,
"current_confirmations": 0,
"initiate_timestamp": null,
"redeem_timestamp": null,
"refund_timestamp": null
},
"destination_swap": {
"created_at": "2025-07-11T14:48:19.354306Z",
"swap_id": "tb1p57lque52sgj9juntnwz7s0sgpapwmh0tzck3n9lz0sw2h3nnfx4qk924vj",
"chain": "bitcoin_testnet",
"asset": "bitcoin_testnet:btc",
"initiator": "460f2e8ff81fc4e0a8e6ce7796704e3829e3e3eedb8db9390bdc51f4f04cf0a6",
"redeemer": "tb1p4pr78swsn60y4ushe05v28mqpqppxxkfkxu2wun5jw6duc8unj3sjrh4gd",
"delegate": "bc182774238a970984da3727d8acdc8c93c23f85167afd7d58db73ef9e81b9b0",
"timelock": 12,
"filled_amount": "0",
"asset_price": 118000.0,
"amount": "49850",
"secret_hash": "61d22856ce12bc3693df0cd4967d404400449f61810080c52638fd805b379723",
"secret": "",
"initiate_tx_hash": "",
"redeem_tx_hash": "",
"refund_tx_hash": "",
"initiate_block_number": "0",
"redeem_block_number": "0",
"refund_block_number": "0",
"required_confirmations": 0,
"current_confirmations": 0,
"initiate_timestamp": null,
"redeem_timestamp": null,
"refund_timestamp": null
},
"nonce": "6010738665599915909",
"order_id": "646eabe9fd9e7612ac712d54d899cf3f1847251927184fbc22d80f2a9a55987d",
"affiliate_fees": [],
"integrator": "test_integrator",
"version": "v1"
}
}
The swap is complete once the
order.destination_swap.redeem_tx_hash field is populated.1
Get Quote
Let’s get a quote to trade 0.354608265 SOL on Solana Testnet to BTC on Bitcoin Testnet4.
Copy
Ask AI
curl -X 'GET' 'https://testnet.api.garden.finance/v2/quote?from=solana_testnet:sol&to=bitcoin_testnet:btc&from_amount=354608265' \
-H 'garden-app-id: f242ea49332293424c96c562a6ef575a819908c878134dcb4fce424dc84ec796' \
-H 'accept: application/json'
Response
Copy
Ask AI
{
"status": "Ok",
"result": [
{
"source": {
"asset": "solana_testnet:sol",
"amount": "354608265",
"display": "0.35460826",
"value": "57.1238"
},
"destination": {
"asset": "bitcoin_testnet:btc",
"amount": "48515",
"display": "0.00048515",
"value": "56.9524"
},
"solver_id": "0x9dd9c2d208b07bf9a4ef9ca311f36d7185749635"
}
]
}
2
Submit Order
Once a quote is received, we can submit the order:Then deposit the funds:
Copy
Ask AI
curl --location 'http://testnet.api.garden.finance/v2/orders' \
--header 'garden-app-id: f242ea49332293424c96c562a6ef575a819908c878134dcb4fce424dc84ec796' \
--header 'Content-Type: application/json' \
--data '{
"source": {
"asset": "solana_testnet:sol",
"owner": "YH4btvqb4JBWSEJh22MuA231ekpJ5JqbBXQY1apJtKH",
"amount": "354608265"
},
"destination": {
"asset": "bitcoin_testnet:btc",
"owner": "tb1p4pr78swsn60y4ushe05v28mqpqppxxkfkxu2wun5jw6duc8unj3sjrh4gd",
"amount": "48515"
}
}'
Response
Copy
Ask AI
{
"status": "Ok",
"result": {
"order_id": "ee54521431fd3b7c01f46f2aaec086362d8cf2d6a7d3b31233c66c31bed9e4eb",
"versioned_tx": "01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100020408032aa331a727d64421581d1ec2ea7cdde7ac7bb04a7ab7bb5e7f4ea5992f08b30c777cae9e6cbeb9830b8b0cd529b6e1f3667ae0c1c21071cb64bba2c7763e000000000000000000000000000000000000000000000000000000000000000017b7828ca6c4f06b51139a60254f81fe1249c8e2b122febf32ca81322b9f1e8ed3c02412b5458cdb8b14d42d4a61166f85f0f4e4d536c8a9f111a4de7e86b77801030301000258053f7b71994b940e89e4221500000000c04b03000000000044070018cffb963a80cb5bf8974e0d64934c614d26340d947ddf3b762a014cacb8841dc97c588ab9e1b94f62627b97d54f8c1048b28c26749d413032e9d66c4e"
}
}
Copy
Ask AI
// Convert transaction object from response.
const buffer = Buffer.from(response.result.versioned_tx, 'hex');
const transaction = VersionedTransaction.deserialize(buffer);
// Sign and send using your wallet.
const signature = await wallet.signAndSendTransaction(transaction);
3
Check Order Status
Get the order by ID to check the status of the swap.
Copy
Ask AI
curl -X 'GET' \
'https://testnet.api.garden.finance/v2/orders/ee54521431fd3b7c01f46f2aaec086362d8cf2d6a7d3b31233c66c31bed9e4eb' \
-H 'garden-app-id: f242ea49332293424c96c562a6ef575a819908c878134dcb4fce424dc84ec796' \
-H 'accept: application/json'
Response
Copy
Ask AI
{
"status": "Ok",
"result": {
"created_at": "2025-07-13T01:35:18.538262Z",
"source_swap": {
"created_at": "2025-07-13T01:35:18.538262Z",
"swap_id": "4629969e622608f634a4be4116f80be482ef987bccf30ef9900eb3e0f242eb77",
"chain": "solana_testnet",
"asset": "solana_testnet:sol",
"initiator": "YH4btvqb4JBWSEJh22MuA231ekpJ5JqbBXQY1apJtKH",
"redeemer": "5aYv3mxzXupjUa6Yyi23Yn3n1kbgGEDfrJ6uBDq6VwQo",
"timelock": 216000,
"filled_amount": "0",
"asset_price": 161.11,
"amount": "354608265",
"secret_hash": "b8841dc97c588ab9e1b94f62627b97d54f8c1048b28c26749d413032e9d66c4e",
"secret": "",
"initiate_tx_hash": "",
"redeem_tx_hash": "",
"refund_tx_hash": "",
"initiate_block_number": "0",
"redeem_block_number": "0",
"refund_block_number": "0",
"required_confirmations": 1,
"current_confirmations": 0,
"initiate_timestamp": null,
"redeem_timestamp": null,
"refund_timestamp": null
},
"destination_swap": {
"created_at": "2025-07-13T01:35:18.538262Z",
"swap_id": "tb1pydwnxvdwfhs674py5z7wfst9nvm2t92s9lpfs6l7v4e0tsfxx64shepc0x",
"chain": "bitcoin_testnet",
"asset": "bitcoin_testnet:btc",
"initiator": "460f2e8ff81fc4e0a8e6ce7796704e3829e3e3eedb8db9390bdc51f4f04cf0a6",
"redeemer": "tb1p4pr78swsn60y4ushe05v28mqpqppxxkfkxu2wun5jw6duc8unj3sjrh4gd",
"delegate": "be7d111dca1cc2b967d1d1a20bf05c2cd5050307b072dd8bfccdf8cd52fddae7",
"timelock": 12,
"filled_amount": "0",
"asset_price": 161.11,
"amount": "48515",
"secret_hash": "b8841dc97c588ab9e1b94f62627b97d54f8c1048b28c26749d413032e9d66c4e",
"secret": "",
"initiate_tx_hash": "",
"redeem_tx_hash": "",
"refund_tx_hash": "",
"initiate_block_number": "0",
"redeem_block_number": "0",
"refund_block_number": "0",
"required_confirmations": 0,
"current_confirmations": 0,
"initiate_timestamp": null,
"redeem_timestamp": null,
"refund_timestamp": null
},
"nonce": "18331192702570975643",
"order_id": "ee54521431fd3b7c01f46f2aaec086362d8cf2d6a7d3b31233c66c31bed9e4eb",
"affiliate_fees": [],
"integrator": "DocsTesting",
"version": "v1"
}
}
The swap is complete once the
order.destination_swap.redeem_tx_hash field is populated.1
Get Quote
Let’s get a quote to trade 0.0005 WBTC on Starknet Sepolia to BTC on Bitcoin Testnet4.
Copy
Ask AI
curl -X 'GET' 'https://testnet.api.garden.finance/v2/quote?from=starknet_sepolia:wbtc&to=bitcoin_testnet:btc&from_amount=50000' \
-H 'garden-app-id: f242ea49332293424c96c562a6ef575a819908c878134dcb4fce424dc84ec796' \
-H 'accept: application/json'
Response
Copy
Ask AI
{
"status": "Ok",
"result": [
{
"source": {
"asset": "starknet_sepolia:wbtc",
"amount": "50000",
"display": "0.00050000",
"value": "58.8800"
},
"destination": {
"asset": "bitcoin_testnet:btc",
"amount": "49850",
"display": "0.00049850",
"value": "58.7033"
},
"solver_id": "0x9dd9c2d208b07bf9a4ef9ca311f36d7185749635"
}
]
}
2
Submit Order
Once a quote is received, we can submit the order:Then deposit the funds:
Copy
Ask AI
curl --location 'http://testnet.api.garden.finance/v2/orders' \
--header 'garden-app-id: f242ea49332293424c96c562a6ef575a819908c878134dcb4fce424dc84ec796' \
--header 'Content-Type: application/json' \
--data '{
"source": {
"asset": "starknet_sepolia:wbtc",
"owner": "0x00609190b1348bcc06da44d58c79709495c11a5a6f0b9e154e1209f2a17dd933",
"amount": "50000"
},
"destination": {
"asset": "bitcoin_testnet:btc",
"owner": "tb1p4pr78swsn60y4ushe05v28mqpqppxxkfkxu2wun5jw6duc8unj3sjrh4gd",
"amount": "49850"
}
}'
Response
Copy
Ask AI
{
"status": "Ok",
"result": {
"order_id": "08322ec7359a2fc8ef0918e0c0ada7943e22d87bd0c4632e9576de26f646b372",
"typed_data": {
"domain": {
"chainId": "SN_SEPOLIA",
"name": "HTLC",
"revision": "1",
"version": "1"
},
"message": {
"amount": {
"high": "0x0",
"low": "0xc350"
},
"redeemer": "3419807808164513772718725483164424774502669183354591566218616648407888577029",
"secretHash": [
3887207343,
2041436155,
1951867791,
3328046620,
3034489147,
987985137,
3049690424,
3858545034
],
"timelock": "2880"
},
"primaryType": "Initiate",
"types": {
"Initiate": [
{
"name": "redeemer",
"type": "ContractAddress"
},
{
"name": "amount",
"type": "u256"
},
{
"name": "timelock",
"type": "u128"
},
{
"name": "secretHash",
"type": "u128*"
}
],
"StarknetDomain": [
{
"name": "name",
"type": "shortstring"
},
{
"name": "version",
"type": "shortstring"
},
{
"name": "chainId",
"type": "shortstring"
},
{
"name": "revision",
"type": "shortstring"
}
]
}
},
"transaction": {
"calldata": [
"0x78f8ae98fe78b5df9d3755b5910864c028d5249b4af685eb45687b1b76a4205",
"0xb40",
"0xc350",
"0x0",
"0xe7b213af",
"0x79add7fb",
"0x7457238f",
"0xc65df61c",
"0xb4dea13b",
"0x3ae374f1",
"0xb5c69538",
"0xe5fcb98a"
],
"selector": "0x2aed25fcd0101fcece997d93f9d0643dfa3fbd4118cae16bf7d6cd533577c28",
"to": "0x6579d255314109429a4477d89629bc2b94f529ae01979c2f8014f9246482603"
}
}
}
- Submit transaction
- Gasless submission
Copy
Ask AI
await account.execute([{
contractAddress: response.result.transaction.to,
entrypoint: response.result.transaction.selector,
calldata: response.result.transaction.calldata
}]);
Copy
Ask AI
// Sign typed data.
const signature = await account.signMessage(response.result.typed_data);
// Initiate the swap with the signature.
await fetch(`https://testnet.api.garden.finance/v2/orders/${response.result.order_id}?action=initiate`, {
method: 'PATCH',
headers: {
'garden-app-id': 'f242ea49332293424c96c562a6ef575a819908c878134dcb4fce424dc84ec796',
'Content-Type': 'application/json'
},
body: JSON.stringify({ signature })
});
3
Check Order Status
Get the order by ID to check the status of the swap.
Copy
Ask AI
curl -X 'GET' \
'https://testnet.api.garden.finance/v2/orders/08322ec7359a2fc8ef0918e0c0ada7943e22d87bd0c4632e9576de26f646b372' \
-H 'garden-app-id: f242ea49332293424c96c562a6ef575a819908c878134dcb4fce424dc84ec796' \
-H 'accept: application/json'
Response
Copy
Ask AI
{
"status": "Ok",
"result": {
"created_at": "2025-07-11T14:46:01.293643Z",
"source_swap": {
"created_at": "2025-07-11T14:46:01.293643Z",
"swap_id": "61ea20c8abf2a327035c2bc1170b3d32a13b271f14ad5a3739f995ce9a54ebf",
"chain": "starknet_sepolia",
"asset": "starknet_sepolia:wbtc",
"initiator": "0x00609190b1348bcc06da44d58c79709495c11a5a6f0b9e154e1209f2a17dd933",
"redeemer": "0x078f8ae98fe78b5df9d3755b5910864c028d5249b4af685eb45687b1b76a4205",
"timelock": 2880,
"filled_amount": "0",
"asset_price": 118000.0,
"amount": "50000",
"secret_hash": "e7b213af79add7fb7457238fc65df61cb4dea13b3ae374f1b5c69538e5fcb98a",
"secret": "",
"initiate_tx_hash": "",
"redeem_tx_hash": "",
"refund_tx_hash": "",
"initiate_block_number": "0",
"redeem_block_number": "0",
"refund_block_number": "0",
"required_confirmations": 1,
"current_confirmations": 0,
"initiate_timestamp": null,
"redeem_timestamp": null,
"refund_timestamp": null
},
"destination_swap": {
"created_at": "2025-07-11T14:46:01.293643Z",
"swap_id": "tb1psllge60w4dtm9lkwhflyznay60775nl3k06s2rl6r96d99kv7ccqaxtq7h",
"chain": "bitcoin_testnet",
"asset": "bitcoin_testnet:btc",
"initiator": "460f2e8ff81fc4e0a8e6ce7796704e3829e3e3eedb8db9390bdc51f4f04cf0a6",
"redeemer": "tb1p4pr78swsn60y4ushe05v28mqpqppxxkfkxu2wun5jw6duc8unj3sjrh4gd",
"delegate": "60e484adb39f5dc2af267c160c92afcbc1dd93e9c4c745316b8f55c8e0d664fc",
"timelock": 12,
"filled_amount": "0",
"asset_price": 118000.0,
"amount": "49850",
"secret_hash": "e7b213af79add7fb7457238fc65df61cb4dea13b3ae374f1b5c69538e5fcb98a",
"secret": "",
"initiate_tx_hash": "",
"redeem_tx_hash": "",
"refund_tx_hash": "",
"initiate_block_number": "0",
"redeem_block_number": "0",
"refund_block_number": "0",
"required_confirmations": 0,
"current_confirmations": 0,
"initiate_timestamp": null,
"redeem_timestamp": null,
"refund_timestamp": null
},
"nonce": "2212051334241171111",
"order_id": "08322ec7359a2fc8ef0918e0c0ada7943e22d87bd0c4632e9576de26f646b372",
"affiliate_fees": [],
"integrator": "test_integrator",
"version": "v1"
}
}
The swap is complete once the
order.destination_swap.redeem_tx_hash field is populated.Congratulations, you have successfully completed a cross-chain swap!