repos
repos
The repos module groups the Conflux Development Kit into logical layers that can be composed together to build, test, and maintain Conflux‑based applications.
Purpose
- cfx‑core – Tier 0a chain primitives: address codecs, unit conversion, chain configs, RPC clients for Core Space and eSpace, and wallet utilities.
- cfx‑domain – Tier 0b/0c vertical packages: automation strategies (
@cfxdevkit/automation) for limit orders, DCA, TWAP, swaps, and a placeholder game‑engine kit. - cfx‑keys – Tier 0b trust‑boundary services (
@cfxdevkit/services) providing pluggable keystore providers, embedded wallet manager, and cryptographic primitives. - cfx‑meta – Architecture governance (
arch‑rules.yaml,@cfxdevkit/arch‑rules, validation scripts) that enforces monorepo constraints as a dev‑only dependency. - cfx‑solidity – Solidity pipeline: standard ABIs (
@cfxdevkit/abis) and typed contract helpers (@cfxdevkit/contracts) for eSpace and Core Space. - cfx‑tools – LLM‑agent framework (
@cfxdevkit/llm‑agents) for automated repository maintenance (review, check, smoke‑test workflows). - cfx‑ui – Opinionated DeFi widgets (
@cfxdevkit/defi‑react) built on CSS variables, hooks, and viem integration for token swaps, liquidity, portfolio tracking, and tx status.
How the sub‑modules fit together
-
Wallet → RPC → Contracts
A dApp typically starts with a wallet created viacfx‑keys(Keystore Provider → Embedded Wallet Manager). The wallet signs transactions, which are sent through thecfx‑coreRPC client (Core Space or eSpace). Contract interactions use the typed helpers fromcfx‑solidity(@cfxdevkit/contracts) together with ABI definitions from@cfxdevkit/abis. -
DeFi UI layer
Thecfx‑uiDefi‑React components consume wallet connections (via viem adapters) and blockchain data hooks that call thecfx‑coreRPC clients. They render swap, liquidity, and portfolio widgets that ultimately invoke contract methods fromcfx‑solidity. -
Automation jobs
cfx‑domain’s@cfxdevkit/automationpackage defines jobs (limit order, DCA, TWAP, swaps). At runtime, the job keeper reads wallet state fromcfx‑keys, queries prices via oracles, and executes transactions through thecfx‑coreRPC client, using contract bindings fromcfx‑solidity. -
Repository maintenance
cfx‑toolsprovides LLM‑driven agents that lint, test, and refactor code across all sub‑modules. Agents can trigger validation scripts incfx‑metato ensure architectural rules are not violated when changes touchcfx‑core,cfx‑keys, orcfx‑solidity. -
Architecture enforcement
cfx‑metasupplies the single source of truth for dependency and layering rules. CI pipelines run its validation scripts, which inspect imports acrosscfx‑core,cfx‑domain,cfx‑keys,cfx‑solidity,cfx‑tools, andcfx‑uito prevent illegal coupling (e.g., UI depending directly on keystore internals).
Representative cross‑module workflows
- Swap execution – UI (
cfx‑ui) → wallet (cfx‑keys) → RPC (cfx‑core) → contract call (cfx‑solidity). - Limit‑order automation – Automation job (
cfx‑domain) → price oracle → wallet (cfx‑keys) → transaction (cfx‑core) → contract (cfx‑solidity). - Repo health check – LLM agent (
cfx‑tools) → runs tests → invokescfx‑metavalidation → reports architectural drift.
For detailed API and usage of each layer, see the respective sub‑module pages: