SmallSwap SmallSwap

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

  1. Point your existing TrocadorExchangeProvider base URL at https://smallswap.example/api/v1 (clearnet) or http://<onion>.onion/api/v1 (tor).
  2. Use your partner key in the API-Key header. We issue these out-of-band — contact us to get one.
  3. Optionally set a markup in basis points; we credit the markup to your commission account on every completed swap.
  4. Done. /new_rate, /new_trade, /trade, /exchanges all 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 / TrocadorSmallSwapNotes
ticker_fromticker_fromIdentical.
ticker_toticker_toIdentical.
network_fromnetwork_fromIdentical.
network_tonetwork_toIdentical.
trade_idtrade_idTop-level swap ID.
address_provideraddress_providerDeposit address (where the user sends).
address_provider_memoaddress_provider_memoMemo / destination tag on the deposit address.
address_useraddress_userReceiving address (where we send output).
refund_addressrefund_addressRequired. Identical.
passwordpasswordPer-trade lookup secret. 32-char hex.
id_providerid_providerOur internal sub-provider trade ID. Distinct from trade_id.
markupmarkupBasis points. Cake passes from secrets.trocadorExchangeMarkup.
min_kycratingmin_kycratingAccepted, ignored. We're a single provider rated A.
refund_memorefund_memoCake passes '0' by default. We accept.

Endpoint shape parity

  • /new_trade is GET, query-parametered. Matches Trocador. Cake's hard-wired GET works as-is.
  • /new_rate nests routes at quotes.quotes. Cake's responseJSON['quotes']['quotes'] parser reads us directly.
  • /trade returns a single-element array. Cake's responseListJson.first reads us directly.
  • Auth header is API-Key. Cake sends headers: {'API-Key': apiKey}. We accept it as canonical. (X-SmallSwap-API-Key works 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

  1. Cake passes markup=N (basis points) on /new_rate and /new_trade.
  2. We add that markup to our base spread when computing amount_to.
  3. On every completed swap, we credit (amount_from × markup_bps / 10000) in USD to Cake's commission account.
  4. 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.