Skip to main content

Send funds

Send tokens from your wallet to any address on the same chain. A transfer works like an order: you create it, sign the payloads it returns, then execute it. A payload is an unsigned transaction.

Create the transfer​

Send the asset_id from the catalog, the amount in that asset with qty_unit: "base", and the destination address in to. Leave out network; the transfer uses the asset's chain.

The transfer comes back with status awaiting_signature and its payloads. Keep id and payloads.

Create a transfer of 5 USDC on Solana
const transfer = await post("/v1/gateway/transfers", {
asset_id: assetId,
qty: "5",
qty_unit: "base",
to: "9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin",
});
Response201keep id and payloads
{
"id": "6d5c4b3a-2f1e-4d0c-9b8a-7f6e5d4c3b2a",
"status": "awaiting_signature",
"asset_symbol": "USDC",
"chain": "solana",
"to": "9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin",
"qty": "5",
"payloads": [{ "digest": "8e1a…4f2b", "payload": "{\"organizationId\":\"…\",…}" }],
"…": "…"
}

Sign and execute​

Sign each payload with your API key, the same way you sign an order, and post the signatures in the order the payloads came back. Getting started has the signing code.

auth_type: "api_key" tells us your API key made the signatures.

Transfers are final

Once the chain confirms a transfer, it can't be reversed. Check the address and the network before you execute.

Sign the payloads, then execute
const signatures = await Promise.all(
transfer.payloads.map((p) => stamp(p.payload)),
);

const done = await post(
`/v1/gateway/transfers/${transferId}/execute`,
{
signatures,
auth_type: "api_key",
},
);
Response200the transfer, finished
{
"id": "6d5c4b3a-2f1e-4d0c-9b8a-7f6e5d4c3b2a",
"status": "completed",
"sent": "5",
"received": "5",
"explorer_url": "https://solscan.io/tx/4Hn8…Yt3z",
"…": "…"
}

Execute returns once the transaction has landed, with status completed. If it fails, the transfer is marked failed and you create a new one. Executing the same transfer again returns 409. To look a transfer up later, call GET /v1/gateway/transfers/{id}.

Next: Place orders