Cloak API
Amounts & assets
Every amount in this API is a decimal string of raw base units, never a float, never a display value.
"10000000000" in an asset with 6 decimals is 10,000 tokens. Keep amounts as strings to avoid rounding errors.
Asset IDs
Use the assetId returned by GET /tokens. Cache the token list for minutes, not hours, because supported assets and limits can change.
| assetId | Symbol | Decimals | Mint |
|---|---|---|---|
| veilo-sol | SOL | 9 | 11111111111111111111111111111111 |
| veilo-wsol | wSOL | 9 | So11111111111111111111111111111111111111112 |
| veilo-usdc | USDC | 6 | EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v |
| veilo-usdt | USDT | 6 | Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB |
| veilo-usd1 | USD1 | 6 | USD1ttGY1N17NEEHLmELoaybftRBUSErhqYiQzvEmuB |
| veilo-jup | JUP | 6 | JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN |
SOL and wSOL are not aliases
Native SOL uses the all-zero mint and has its own pool. Wrapped SOL is a separate pool with separate limits and a distinct assetId. Sending a user to the wrong one gives them the wrong minimum.
exact_in and exact_out
mode decides whether amount is what the sender pays or what the recipient receives.
| mode | What is pinned | Use it when |
|---|---|---|
| exact_in | What the sender pays. | The user chooses an amount to spend. This is the default. |
| exact_out | What the recipient receives. | Your app promises a specific delivered amount. |
exact_out delivers the quoted amount
A 10,000.00 USDC exact_out target delivers 10,000.00 USDC after fees.exact_out is same-asset only; a private swap must use exact_in, which still delivers an exact amount.
Limits are per asset and live
Read the current minimum and maximum from GET /tokensor a limit error. Do not hard-code them. See Limits.
