SafeSwap is an intent engine, not a swap bot. Users describe an exact-input swap goal in English or Chinese, the system validates the intent, fetches a quote, compiles a PTB, runs guardian checks, generates a human-readable preview, requires explicit confirmation, and only then unlocks wallet signing.
Intent -> Validate -> Quote -> PTB -> Guardian -> Preview -> Confirm -> Wallet
Direct wallet access is intentionally not exposed. Guardian and confirmation are mandatory.
Requirements:
- Node.js 20+
- npm 10+
Install dependencies:
npm installRun the backend:
npm run dev --workspace backendRun the frontend:
npm run dev --workspace frontendCopy values from .env.example as needed. Important variables:
MOCK_MODE: whentrue, uses mock whitelist pairs and mock quote generationREMOTE_WHITELIST_URL: remote whitelist source used when mock mode is disabledWHITELIST_CACHE_TTL_MS: whitelist snapshot TTL; expired or unavailable whitelist blocks new flowsNEXT_PUBLIC_API_BASE_URL: frontend API originSUI_RPC_URL: reserved for Sui integration and signing handoff
Backend and frontend unit/integration tests pass with:
npm run test --workspace backend
npm run test --workspace frontendPlaywright e2e specs are present in frontend/tests/e2e/, but this environment does not yet have Playwright browser binaries installed. Install them with npx playwright install before running npm run test:e2e --workspace frontend.
SUI -> USDCUSDC -> SUI
Preview and validation copy default to the input language and can be switched manually between English and Chinese before confirmation.