API Reference / Integrations / Cake Wallet
Cake Wallet integration
SmallSwap exposes a Trocador-shaped API. If Cake already speaks Trocador, integrating SmallSwap is a base-URL change plus a partner key.
TL;DR
- Point your existing
TrocadorExchangeProviderbase URL athttps://smallswap.example/api/v1(clearnet) orhttp://<onion>.onion/api/v1(tor). - Use your partner key in the
API-Keyheader. We issue these out-of-band — contact us to get one. - Optionally set a
markupin basis points; we credit the markup to your commission account on every completed swap. - Done.
/new_rate,/new_trade,/trade,/exchangesall return the shapes your existing parser expects.
Field-by-field compatibility
Audited against Cake's open-source TrocadorExchangeProvider (lib/exchange/provider/trocador_exchange_provider.dart) at the time of writing.
| Cake / Trocador | SmallSwap | Notes |
|---|---|---|
| ticker_from | ticker_from | Identical. |
| ticker_to | ticker_to | Identical. |
| network_from | network_from | Identical. |
| network_to | network_to | Identical. |
| trade_id | trade_id | Top-level swap ID. |
| address_provider | address_provider | Deposit address (where the user sends). |
| address_provider_memo | address_provider_memo | Memo / destination tag on the deposit address. |
| address_user | address_user | Receiving address (where we send output). |
| refund_address | refund_address | Required. Identical. |
| password | password | Per-trade lookup secret. 32-char hex. |
| id_provider | id_provider | Our internal sub-provider trade ID. Distinct from trade_id. |
| markup | markup | Basis points. Cake passes from secrets.trocadorExchangeMarkup. |
| min_kycrating | min_kycrating | Accepted, ignored. We're a single provider rated A. |
| refund_memo | refund_memo | Cake passes '0' by default. We accept. |
Endpoint shape parity
/new_tradeis GET, query-parametered. Matches Trocador. Cake's hard-wired GET works as-is./new_ratenests routes atquotes.quotes. Cake'sresponseJSON['quotes']['quotes']parser reads us directly./tradereturns a single-element array. Cake'sresponseListJson.firstreads us directly.- Auth header is
API-Key. Cake sendsheaders: {'API-Key': apiKey}. We accept it as canonical. (X-SmallSwap-API-Keyworks as alias.)
TradeState mapping
Cake's TradeState.deserialize accepts both numeric Trocador codes and string aliases. We emit lowercase string values:
- awaiting_deposit → pending
- deposit_detected → confirming
- confirming → confirming
- processing → processing
- sending → trading
- completed → finished / traded
- refunded → refunded
- failed → failed
- expired → expired
- hold → hold
Unknown raws fall through to TradeState(raw: raw, title: raw) in Cake — so any future status we add renders gracefully without code changes on Cake's side.
Onion routing
Cake's Trocador provider has clearNetAuthority and onionApiAuthority wired up; the onion authority is commented out for Trocador but the infrastructure is there. When Cake's useTorOnly flag is set, point the onion authority at our .onion service:
clearNetAuthority = 'smallswap.example'; onionApiAuthority = '<our-onion>.onion';
Our clearnet and .onion surfaces are byte-identical. Same response shapes, same TLS-stripped behavior over Tor.
Commission
- Cake passes
markup=N(basis points) on/new_rateand/new_trade. - We add that markup to our base spread when computing
amount_to. - On every
completedswap, we credit(amount_from × markup_bps / 10000)in USD to Cake's commission account. - Settlement: weekly payout in XMR or USDT (Tron). Threshold $20 — under rolls over.
Default per-key cap is 50 bps. Hard server-side ceiling is 300 bps (3%). Higher than that undermines the best-rate promise; talk to us.
Rate limits
Partner keys get 6000 reads/min and 600 writes/min — well over Cake's expected per-user volume even at peak.
Risk pill
SmallSwap-self-fill routes carry the PreCheck risk badge (risk levels). We screen address and refund against the OFAC SDN list at quote and create time, and the deposit-origin at deposit time. Flagged swaps refund to refund_address with status=refunded — no hold, no manual review.
Getting a partner key
Partner keys are issued out-of-band so we can confirm the integrating party and agree commission terms. Reach out through the contact channel on the SmallSwap home page.