Documentation Index
Fetch the complete documentation index at: https://docs.calmtreasury.xyz/llms.txt
Use this file to discover all available pages before exploring further.
The whole flow
Steps
Initial state while session bootstraps and first state read happens. Shows a
spinner.
Customer isn’t registered yet (
GET /v1/wallets/:address returned 404 customer_not_registered). Shows a form for first_name, last_name,
email, country. Submit → POST /v1/wallets/:address.Customer exists but
hasAcceptedTos === false. Shows Bridge’s hosted ToS in
an iframe. Bridge posts { signedAgreementId } via postMessage on accept;
the SDK refreshes state immediately.kycState is not_started or incomplete. Shows Bridge’s hosted KYC in an
iframe. SDK polls GET /v1/wallets/:address every 5 seconds to watch the
state transition.kycState === "under_review". Bridge is reviewing the user’s submission.
SDK keeps polling.kycState === "rejected". Terminal. The user has to start over via support
channels — Bridge doesn’t allow programmatic recovery.kycState === "active" and no virtual account exists yet. Shows currency
(USD/GBP/EUR) and chain (Arbitrum/Base/Ethereum/HyperEVM) pickers. Submit →
POST /v1/wallets/:address/virtual-account.Brief “provisioning” state while the VA create request is in flight.
Virtual account exists. Renders
deposit_instructions from Bridge (bank
routing + account, sort code + account, IBAN + BIC — varies by currency).
Fires onComplete(va) once.Any unrecoverable error (network failure, bad token, etc.). Shows the error
message. Partner-driven retry by remounting the Provider.
Derivation rule
deriveStep(walletState, virtualAccount) is a pure function — same inputs
always produce the same step. Listed by precedence:
| Condition | Step |
|---|---|
walletState === null and not in registration | loading |
| Explicitly forced to register | register |
kycState === "rejected" | rejected |
!hasAcceptedTos | bridge_tos |
kycState ∈ {not_started, incomplete} | kyc |
kycState === "under_review" | review |
kycState === "active" and va === null | choose_currency_chain |
kycState === "active" and va !== null | instructions |
When state refreshes
| Trigger | Effect |
|---|---|
| Mount | One-shot bootstrap |
postMessage from Bridge ToS iframe | Immediate refresh |
5-second poll while in bridge_tos/kyc/review | Refresh |
| Successful register/VA create | Immediate refresh |
useCalm().refresh() | Manual trigger |
instructions or rejected, polling stops.