Skip to content

Documentation

Reference

Supported networks and assets, the intent vocabulary, the plan status machine, and every environment variable ZeFi reads.

Registry

Supported networks

Capability is stated per chain. “Plan-only” means ZeFi understands the chain well enough to route to it but holds no wallet connection there.

NetworkChain idNativeCapabilityExplorer
Ethereum1ETHRead and executeetherscan.io
Base8453ETHRead and executebasescan.org
Arbitrum One42161ETHRead and executearbiscan.io
OP Mainnet10ETHRead and executeoptimistic.etherscan.io
Polygon PoS137POLRead and executepolygonscan.com
SolanaSOLPlan onlysolscan.io

Verified assets

DAIETHPOLSOLUSDCUSDTWBTCWETH

Addresses and decimals for these assets are curated and stored EIP-55 checksummed. A test asserts every address in the registry is a valid checksummed address, so a typo fails the build rather than reaching a user. Any asset outside this list requires an explicit contract address — ZeFi will not guess one.

Intent categories

  • EXPLAIN
  • PORTFOLIO_QUERY
  • SEND
  • SWAP
  • BRIDGE
  • APPROVE
  • CONTRACT_INTERACTION
  • COMPARE_ROUTES
  • ROUTEFOLD_ANALYSIS
  • UNKNOWN

SEND, SWAP, BRIDGE, APPROVE and CONTRACT_INTERACTION are transactional and produce a plan. The rest are answered directly.

Plan statuses

  • draftDraft
  • missing_informationMissing information
  • ready_to_simulateReady to simulate
  • simulatingSimulating
  • simulation_passedSimulation passed
  • simulation_warningSimulation warning
  • ready_for_signatureReady for signature
  • submittedSubmitted
  • confirmedConfirmed
  • failedFailed
  • cancelledCancelled

Transitions are enforced by an explicit state machine. An invalid transition throws rather than silently succeeding; confirmed, failed and cancelled are terminal.

Configuration

Environment variables

Every variable ZeFi reads. Absent credentials produce a labelled, degraded mode — never a silent fallback and never a fabricated value.

Core

DATABASE_URL
PostgreSQL connection string. Omit to run without persistence.
NEXT_PUBLIC_APP_URL
Canonical public URL. Defaults to https://zefi.ae.

Authentication

NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
Clerk publishable key.
CLERK_SECRET_KEY
Clerk secret key. Server-only.
NEXT_PUBLIC_CLERK_SIGN_IN_URL
Defaults to /sign-in.
NEXT_PUBLIC_CLERK_SIGN_UP_URL
Defaults to /sign-up.

AI

AI_PROVIDER
openai (default) or anthropic. Unset auto-selects whichever is fully configured.
OPENAI_API_KEY
OpenAI API key.
OPENAI_MODEL
Model identifier. Never hardcoded in source — set what your key can access.
OPENAI_BASE_URL
Optional. For an Azure or OpenAI-compatible gateway.
ANTHROPIC_API_KEY
Alternative provider key.
ANTHROPIC_MODEL
Alternative provider model identifier.
AI_MAX_TOKENS
Optional. Defaults to 2048.
AI_TIMEOUT_MS
Optional. Defaults to 45000.

Wallet & RPC

NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID
Enables the WalletConnect connector when present.
RPC_URL_ETHEREUM
Server-side endpoint. Public fallback used when unset.
RPC_URL_BASE
Server-side endpoint.
RPC_URL_ARBITRUM
Server-side endpoint.
RPC_URL_OPTIMISM
Server-side endpoint.
RPC_URL_POLYGON
Server-side endpoint.

Feature flags

TRANSACTION_EXECUTION_ENABLED
Master switch for requesting wallet signatures. Defaults to false.
DEMO_MODE
Serves labelled fixtures when credentials are absent. Never a silent fallback.
NEXT_PUBLIC_ROUTEFOLD_URL
Public URL of a separate Routefold deployment.

Provider-ready

SIMULATION_PROVIDER
Enables deep simulation. Unset means local validation only.
SWAP_PROVIDER
Enables swap route quotes and calldata.
BRIDGE_PROVIDER
Enables bridge route comparison and calldata.
PORTFOLIO_PROVIDER
Enables USD pricing for volatile assets.

Running ZeFi

Commands

  • pnpm installInstall dependencies
  • pnpm db:migrateApply migrations to a local database
  • pnpm db:seedSeed labelled demo data for one user
  • pnpm devStart the development server
  • pnpm lintLint
  • pnpm typecheckType-check with no emit
  • pnpm testUnit and integration tests
  • pnpm test:e2ePlaywright smoke tests against a production build
  • pnpm buildProduction build

Full setup, architecture and deployment notes live in the repository: README.md, ARCHITECTURE.md, SECURITY.md, DEPLOYMENT.md, TRANSACTION_SAFETY.md and AI_SYSTEM.md. See also how it works for the capability matrix.