This guide covers development workflows, coding standards, and testing procedures. For initial setup and installation, please refer to the README.
| Command | Description |
|---|---|
pnpm dev |
Start development server (Vite) |
pnpm build |
Build for production |
pnpm preview |
Preview production build locally |
pnpm lint |
Fix linting issues (ESLint) |
pnpm lint:check |
Check for linting issues without fixing |
pnpm format |
Format code with Prettier |
pnpm typecheck |
Run TypeScript type checking |
pnpm test |
Run unit tests (Vitest) |
pnpm test:e2e |
Run end-to-end tests (Playwright) |
pnpm deploy |
Build and deploy to Cloudflare Workers |
- Strict Typing: Never use
any. Useunknownor narrow types. - Type Safety: Avoid type assertions (
as). Let TypeScript infer or prove correctness. - Inference: Do not manually type obvious variables (e.g.,
const x = 5is better thanconst x: number = 5).
- Components: Strictly presentational. Keep logic in hooks/lib.
- Imports: Use barrel files (
index.ts) for clean imports (e.g.,import { ... } from '@/components'). - Styling: Tailwind CSS with
shadcn/uicomponents. Usecn()for class merging.
- Network: QF Network Testnet
- Endpoint:
wss://test.qfnetwork.xyz - Native Token: QF
- Decimals: 18 (Native QF). Note that created assets default to 12 decimals in the UI, but the system supports arbitrary precision.
- Descriptors: Located in
.papi/descriptors - Metadata: Stored in
.papi/metadata - Regeneration: Descriptors are automatically generated on
pnpm install. To regenerate manually, runpnpm exec papior delete.papi/and reinstall.
The app uses bigint for all chain values (Planck) and string for UI inputs to avoid floating-point errors.
Key Functions (import from @/lib):
-
toPlanck(value: string, decimals: number = 18): bigintConverts user input ("1.5") to chain units (1500000000000n). -
fromPlanck(value: bigint, decimals: number = 18, options?): stringConverts chain units back to a human-readable string. Options:{ fixed?: boolean }(pad decimals). -
formatBalance(value: string, options?: FormatBalanceOptions): stringFormats a string number for display (e.g., "1,234.56 QF"). Options:locale,symbol,displayDecimals,mode('floor'|'round'|'ceil').
Located in src/__tests__/. Focus on business logic (lib/) and hooks.
pnpm test # Run all tests
pnpm test:watch # Watch mode
pnpm test:ui # Interactive UI
pnpm test:coverage # Coverage reportLocated in e2e/. Tests full user flows against the testnet.
pnpm test:e2e # Run headless
pnpm test:e2e:ui # Interactive UI
pnpm test:e2e:headed # Run with browser visible