ZAIC PAYMulti-chain stablecoin wallet
ZAIC PAY API
ZAIC PAY is a USSD-first multi-chain wallet. Server functions are invoked via TanStack RPC (POST /_serverFn/<id>) from the browser; external systems use the public HTTP endpoints below.
Supported chains
- EVM mainnets: Ethereum, Base, BNB Chain, Polygon, Arbitrum, Optimism, Avalanche
- EVM testnets: Sepolia, Base Sepolia, BSC Testnet, Polygon Amoy, Arbitrum Sepolia, Optimism Sepolia, Avalanche Fuji
- Non-EVM testnets: Solana Devnet, Tron Nile, Stellar Testnet, XRP Testnet, Bitcoin Testnet
Endpoints
| Name | Method | Kind | Description |
|---|---|---|---|
| registerUser | POST | ServerFn | Create account: phone + 4-6 digit PIN. Provisions Stellar testnet keypair + USDC trustline. |
| loginWithPin | POST | ServerFn | Authenticate with phone + PIN. Sets session cookie. |
| logout | POST | ServerFn | Clear the session cookie. |
| getMyAccount | GET | ServerFn | Return signed-in user, wallet, ledger balances, recent transactions. |
| provisionMyChains | POST | ServerFn | Idempotent: create HD mnemonic (if missing) and derive an address on every supported chain (EVM mainnet+testnet, Solana Devnet, Bitcoin Testnet, Tron Nile, XRP Testnet, Stellar Testnet). |
| getMyAddresses | GET | ServerFn | List addresses the user owns across every chain. |
| getMyChainBalances | GET | ServerFn | Live on-chain balances across every chain. |
| sendOnChain | POST | ServerFn | Body: { chain, network, asset, to, amount, pin }. PIN-gated. Signs & broadcasts on chosen chain. |
| scanMyDeposits | POST | ServerFn | Scan every chain for new incoming transfers; credit ledger idempotently. |
| sendByPhone | POST | ServerFn | Off-chain ledger transfer between ZAIC PAY accounts. Instant. |
| getChainCatalog | GET | ServerFn | Metadata for every supported chain — label, native symbol, assets, faucet. |
| withdrawEvm | POST | ServerFn | Legacy: EVM-mainnet ERC-20 withdrawal using the original per-user EVM key. |
| POST /api/ussd | POST | HTTP | Africa's Talking-compatible USSD handler. Form fields: sessionId, phoneNumber, text. Returns CON/END strings. |
| POST /api/public/cron/stellar-poll | POST | HTTP | Cron endpoint that polls Stellar Horizon for new deposits. |
USSD menu
*284# → ZAIC PAY 1. Check balance (per chain) 2. Send to phone (off-chain instant) 3. Withdraw to wallet (chain → asset → address → amount → PIN) 4. Receive (show address per chain) 5. Recent activity 6. Settings
Security
- BIP39 mnemonic generated per user, encrypted with AES-256-GCM via
WALLET_ENCRYPTION_KEY. - PINs hashed with bcrypt (Argon2 cannot run in this serverless runtime).
- Session cookies: HttpOnly, Secure, SameSite=None, 30-day.
- RLS scoped to
auth.uid(); service role only inside server functions.
