Skip to content

Commit 3a6f325

Browse files
committed
feat(conflux-devkit): setup wizard + fix API/routes + default port 7748
- AppShell gates the entire UI on keystore initialization status — first-time visitors see the setup wizard full-screen, not a broken dashboard - Extract SetupWizard to src/components/SetupWizard.tsx; wallet/page imports it - Add NEXT_PUBLIC_API_URL + NEXT_PUBLIC_WS_URL support in api.ts / socket.ts; .env.development.local points to http://localhost:7748 for use - Backend: fix node-manager DEFAULT_CONFIG chainId 1→2029, evmChainId 71→2030 - Backend: fix keystore status response (initialized/encryptionEnabled vs stale names) - Backend: fix wallets/accounts endpoints to return flat arrays (no wrapper object) - Backend: replace non-implemented fundAccount() with fundEvmAccount/fundCoreAccount - Backend: add try/catch to all async route handlers (devnode, accounts) - CLI: change default port 4200 → 7748 (aligns with README) fix: node startup, WS ports, mining UI sync, contracts page - Fix miningAuthor sentinel value 'auto' being passed to native binary instead of the derived Core address, causing 'Node startup communication failed' on every POST /api/node/start - Add EVM WebSocket port (evmWsPort, default 8546) alongside existing Core WS port; wire jsonrpcWsEthPort into @xcfx/node createServer(); expose coreWs and evmWs fields from getRpcUrls() and /api/network/rpc-urls - Fix mining page showing 'Off' when node is actively mining: frontend MiningStatus type had {enabled,blockTime,latestEpoch} but backend returns {isRunning,interval,blocksMined}; align types and field usage - Fix contracts page crash: templates endpoint was returning {templates:[]} wrapper that .map() iterated wrong; fix to return plain array including source field for editor preview; fix compile response shape to match CompileResult type (was nested under {ok,result}); fix deploy to wait for receipt and return contractAddress; mine a block post-deploy when auto-mining is inactive so the tx gets confirmed UX overhaul: dashboard consolidation, live balances, contract deploy error handling - Dashboard (page.tsx): merged Accounts + Mining + Network into single vertical scroll page; wallet selector before start; network config preview (editable when stopped, read-only when running); status label reflects Starting.../ Stopping... immediately on button press; accounts table shows first 5 rows with expand to show all 10; live Core+EVM balances; faucet card; fund modal; full auto-mine toggle + interval + manual mine controls; all 4 RPC endpoints - Accounts route (accounts.ts): fetch live Core balance via cfx_getBalance JSON-RPC and EVM balance via viem on every GET /api/accounts call; balances now populate correctly in the table - Contracts deploy route (contracts.ts): wrap requireManager() + entire EVM deploy pipeline in try/catch blocks; add timeout: 10_000 to viem HTTP transports; always respond with a JSON error instead of hanging the connection - Sidebar.tsx: remove Accounts/Mining/Network links; keep Dashboard/Contracts/Wallet - Types: fix NodeStatusEvent (socket.ts) and NodeStatus (api.ts) to match actual backend shape — rpcUrls now includes coreWs/evmWs fields UX polish: mining toggle, RPC on top, faucet Core-only, contracts crash fix Dashboard (page.tsx): - Mining: collapse three cards into one. Header shows blocks-mined count + auto-mine toggle switch (pill). When ON: interval (ms) input; Update button appears only when value differs from current interval (stop+restart). When OFF: manual mine (blocks input + Mine button). - RPC Endpoints: moved above Accounts, immediately after the status card. Added Core Chain ID + EVM Chain ID rows with copy buttons at the bottom of that card. Removed the read-only grid from inside the status card; network config (editable) still appears in the status card when the node is stopped. - Faucet: removed EVM address/balance column. Now shows Core address + Core balance on the left; Keys + Fund buttons moved into the faucet card header (right side). Accounts section header is now just the section label. Contracts (page.tsx): - Added nodeApi.status query (refetchInterval: 3s). - Yellow warning banner when node is not running (AlertTriangle icon). - Deploy button disabled + title tooltip when node is down. - loadTemplate: wrapped in try/catch; errors surface in local loadError state instead of causing an unhandled promise rejection that could crash the app. - deployMutation.onError: uses e instanceof Error ? e.message : String(e) to handle TypeError ('Failed to fetch') and other non-Error objects safely. Wallet-scoped data dirs, wipe-restart, mining order, Save Config safety Backend (node-manager.ts): - Data directory is now per-wallet: ~/.conflux-devkit/wallets/<wallet-id>/data instead of the shared ~/.conflux-devkit/data. Switching wallets always starts the node with a fresh, isolated chain state directory. - Removed dataDir from DEFAULT_CONFIG; it is computed at start() time from the active wallet's ID via walletDataDir(id). - Added restartWipe(): stop → rm -rf wallet data dir → start fresh. - Updated config type to Omit<ServerConfig, 'dataDir'> throughout. Backend (routes/devnode.ts): - Added POST /api/node/restart-wipe route that calls nodeManager.restartWipe(). Frontend (lib/api.ts): - Added nodeApi.restartWipe() → POST /node/restart-wipe. Frontend (app/globals.css): - Added .btn-warning (amber) style used by the new Wipe & Restart button. Frontend (app/page.tsx): - Save Config button is now disabled when isBusy (node starting/stopping), preventing config writes during transient states. - Mining card is now rendered above RPC Endpoints when the node is running. - Added restartWipeMutation and 'Wipe & Restart' amber button (Trash2 icon) next to the Restart button; shows a confirm() dialog before proceeding. - restartWipeMutation.isPending contributes to isBusy and statusLabel. - Error display now includes restartWipeMutation.error. Contracts: fix EVM deploy, add Core deploy, persist deployed contracts Backend: - contract-storage.ts: new ContractStorageService singleton persisting deployed contract records to <walletDataDir>/contracts.json per wallet. Wired into NodeManager.start() (setDataDir) and restartWipe() (wipeFile). - contracts.ts: complete rewrite - EVM deploy: encodeDeployData + sendTransaction with gas: 5_000_000n bypasses eth_estimateGas which Conflux eSpace falsely rejects - Use nodeManager.getConfig() for chain IDs (avoids undefined->71 fallback) - Core Space deploy: cive library with privateKeyToAccount(key, {networkId}) and toCiveChain(); receipt.contractCreated for contract address - All deploys persist to contractStorage after success - New routes: GET/DELETE /deployed, GET/DELETE /deployed/:id - package.json: added cive ^0.8.1 Frontend: - api.ts: del() helper, StoredContract interface, id in DeployResult, contractName in deploy opts, contractsApi.deployed() and deleteDeployed() - contracts/page.tsx: full rewrite with 3 tabs (Templates/Custom/Deployed) - Deployed tab: lists persisted contracts with address copy, chain badge, ABI entry count, tx hash copy, delete button - deployMutation: passes contractName, invalidates deployed query on success Contracts: fix TS error - add chain: coreChain to Core deployContract call fix: deploy — _packMining lock prevents xcfx concurrent-mine crash; follow xcfx-node reference pattern - Switch auto-miner from mine({numTxs:1}) every 500ms to mine({blocks:1}) every 2000ms (mine({blocks}) is fast; mine({numTxs}) takes >10s on slow machines causing timeout cascade) - Add _packMining flag: auto-miner skips its tick while packMine() is running (concurrent test_generateEmptyBlocks + test_generateOneBlock crashes xcfx) - Add packMine() method with 120s timeout client and _packMining lock - devPackTxImmediately: false — matches xcfx-node reference test - Deploy routes: packMine() once then poll loop [getTransactionReceipt + mine({blocks:1}) + sleep(200)] - EVM: mine({numTxs:1}) is required to pack eSpace txs (mine({blocks}) never packs them) - Core: same pattern for consistency feat: contract interact panel — ABI viewer, read/write functions, account picker Backend: - POST /api/contracts/:id/call — server-side read and write for deployed contracts - Reads (view/pure): readContract via viem/cive, returns serialized result as JSON - Writes: writeContract + packMine() + poll loop (same pattern as deploy) - Correct status mapping: cive outcomeStatus is 'success'|'failed'|'skipped' (not 0/1) - serializeValue() helper: recursively converts BigInt to string for JSON serialization - Address casts: use CiveAddress (type import from cive) instead of 'as any' - contractsApi.call() added to API client UI (contracts/page.tsx): - FunctionCallForm component: per-function form with typed inputs (one field per param) - ContractInteractPanel: Read/Write sections, auto-packed write with loading state - Deployed card: expandable 'Interact' toggle — inline, no modal needed - Account picker dropdown for write functions (all 10 funded accounts) - Replace broken ExternalLink RPC button with copy-RPC-URL button - Fix ExternalLink icon: opening a JSON-RPC port in browser always returns POST error feat: wipe data without restart + collapse RPC into status card Backend: - Extract wipeData() from restartWipe() — stop if running, wipe data dir + contracts.json, do not restart - restartWipe() now calls wipeData() then start() - POST /api/node/wipe — wipes active wallet data dir regardless of node state UI: - Dashboard: 'Wipe Data' button accessible when node is stopped (was previously only 'Wipe & Restart' when running) Both wipe actions ask for confirm() before proceeding - Status label shows 'Wiping...' during wipe mutation - RPC Endpoints section moved inside the top status card, collapsed by default Toggled by 'RPC Endpoints' label with chevron — stays hidden until user needs it Removes a permanent card from the dashboard reducing vertical noise feat: per-param ctor args, account selector, fund auto-detect fix(fund): use Core→eSpace bridge; compact mining; security middleware; bundle workspace deps fund: - fundEvmAccount now routes through the Conflux cross-chain internal contract (0x0888...0006 transferEVM) from the Core-space faucet wallet instead of trying to send from an EVM wallet that has no balance; fixes 'total cost exceeds balance' error when funding eSpace addresses mining card: - Collapse all mining controls onto a single compact flex row: title, blocks count badge, interval/blocks input, mine button, and auto toggle all inline with a divider before the toggle security: - In-memory rate limiter (200 req/min/IP, no extra deps) - Bearer token auth middleware activated by --api-key CLI flag; loopback IPs are always trusted; all /api routes protected when key is set - --host flag to set bind address (default 127.0.0.1); warns when binding to a public interface without an API key - --cors-origin flag for explicit CORS origin restriction - GET /api/settings returns active security config (key value never exposed) - SecurityPanel component in the dashboard showing bind address, auth status, CORS, rate-limit settings and a public-host hardening checklist build: - tsup noExternal: [/^@cfxdevkit\//] bundles all workspace packages into the single CLI output so the published npm package runs standalone fix(build): CJS format, graceful shutdown, root scripts - Switch tsup to CJS format: solc/memorystream/require() now work correctly - Remove "type": "module" from devkit package.json - Replace ESM __dirname workaround with native CJS __dirname global - Add stop() to AppInstance: closes io, nodeManager, httpServer - Register SIGINT/SIGTERM in cli.ts for proper Ctrl+C handling - Add devkit:build, devkit:start, devkit:dev to root package.json fix(deps): add @xcfx/node as direct dep of devtools/devkit @xcfx/node is a NAPI-RS native module — it cannot be bundled by tsup. It was only declared in packages/devnode but not in devtools/devkit, so when the bundled dist/cli.js tried to require('@xcfx/node') at runtime the module resolver could not find it, causing the worker process to exit with code 1 immediately on every node-start attempt. Adding it as a direct dep causes pnpm to create the required symlink under devtools/devkit/node_modules/@xcfx/node so the built CLI can resolve it correctly. feat(contracts): add 6 practical/didactical Solidity templates New templates (all pure Solidity, no OpenZeppelin deps): - Counter: ownable step counter with increment/decrement/reset - BasicNFT: ERC-721 from scratch — ownership, approvals, transfers - Voting: ballot with weighted vote delegation — structs, governance - Escrow: three-party escrow — payable, state machines, CFX transfers - MultiSigWallet: M-of-N multisig — collective governance, low-level call - Registry: on-chain name service — keccak256 keys, string storage UI Templates tab overhaul: - Difficulty badge (beginner / intermediate / advanced) - Concept tags per template (ERC-20, NFT, governance, etc.) - Constructor args hint - Description instead of raw source preview chore: biome cleanup, CI, docs - Fix all biome lint errors: remove unused imports (Shield, ServerSettings, NetworkConfig, RpcUrls), remove unused CopyBtn in wallet page, remove useless fragment, replace non-null assertions with null coalescing, fix array-index keys with stable composite keys, prefix unused params with underscore - Add biome.json overrides: suppress noUnknownAtRules for CSS files (Tailwind directives), suppress noLabelWithoutControl for devkit-ui (developer tooling, not public-facing app) - Exclude globals.css from biome (Tailwind directives cause parse errors) - Create .github/workflows/ci.yml: lint, typecheck, build, test jobs using pnpm 10.11.0 + Node 22, Turbo cache, coverage artifact upload - Update README.md: remove duplicate sections, add conflux-devkit features section with template inventory and devkit/README.md reference - Create devtools/devkit/README.md: full CLI documentation with options, dashboard feature table, template catalogue, RPC endpoints, security guidance, WebSocket events, build-from-source instructions
1 parent 9b76e05 commit 3a6f325

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+4643
-822
lines changed

.github/workflows/ci.yml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
# ─────────────────────────────────────────────────────────────────────────────
15+
# Lint — Biome check (format + lint)
16+
# ─────────────────────────────────────────────────────────────────────────────
17+
lint:
18+
name: Lint (Biome)
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- uses: pnpm/action-setup@v4
24+
with:
25+
version: "10.11.0"
26+
27+
- uses: actions/setup-node@v4
28+
with:
29+
node-version: "22"
30+
cache: "pnpm"
31+
32+
- name: Install dependencies
33+
run: pnpm install --frozen-lockfile
34+
35+
- name: Run Biome check
36+
run: pnpm check
37+
38+
# ─────────────────────────────────────────────────────────────────────────────
39+
# Type-check — TypeScript across all packages
40+
# ─────────────────────────────────────────────────────────────────────────────
41+
typecheck:
42+
name: Type-check (TypeScript)
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@v4
46+
47+
- uses: pnpm/action-setup@v4
48+
with:
49+
version: "10.11.0"
50+
51+
- uses: actions/setup-node@v4
52+
with:
53+
node-version: "22"
54+
cache: "pnpm"
55+
56+
- name: Install dependencies
57+
run: pnpm install --frozen-lockfile
58+
59+
- name: Type-check
60+
run: pnpm type-check
61+
62+
# ─────────────────────────────────────────────────────────────────────────────
63+
# Build — Turborepo build pipeline
64+
# ─────────────────────────────────────────────────────────────────────────────
65+
build:
66+
name: Build
67+
runs-on: ubuntu-latest
68+
steps:
69+
- uses: actions/checkout@v4
70+
71+
- uses: pnpm/action-setup@v4
72+
with:
73+
version: "10.11.0"
74+
75+
- uses: actions/setup-node@v4
76+
with:
77+
node-version: "22"
78+
cache: "pnpm"
79+
80+
- name: Install dependencies
81+
run: pnpm install --frozen-lockfile
82+
83+
- name: Build all packages
84+
run: pnpm build
85+
86+
- name: Cache Turbo build
87+
uses: actions/cache@v4
88+
with:
89+
path: .turbo
90+
key: turbo-${{ github.sha }}
91+
restore-keys: turbo-
92+
93+
# ─────────────────────────────────────────────────────────────────────────────
94+
# Test — Vitest with v8 coverage
95+
# ─────────────────────────────────────────────────────────────────────────────
96+
test:
97+
name: Test
98+
runs-on: ubuntu-latest
99+
needs: build
100+
steps:
101+
- uses: actions/checkout@v4
102+
103+
- uses: pnpm/action-setup@v4
104+
with:
105+
version: "10.11.0"
106+
107+
- uses: actions/setup-node@v4
108+
with:
109+
node-version: "22"
110+
cache: "pnpm"
111+
112+
- name: Install dependencies
113+
run: pnpm install --frozen-lockfile
114+
115+
- name: Restore Turbo cache
116+
uses: actions/cache@v4
117+
with:
118+
path: .turbo
119+
key: turbo-${{ github.sha }}
120+
restore-keys: turbo-
121+
122+
- name: Run tests with coverage
123+
run: pnpm test
124+
125+
- name: Upload coverage reports
126+
if: always()
127+
uses: actions/upload-artifact@v4
128+
with:
129+
name: coverage
130+
path: |
131+
packages/*/coverage/
132+
devtools/*/coverage/
133+
retention-days: 7

README.md

Lines changed: 7 additions & 194 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ docs/ API reference and architecture docs
5454
| Package | What it gives you |
5555
|---|---|
5656
| `@cfxdevkit/wallet-connect` | wagmi v2 + ConnectKit + SIWE: `<WalletConnect>`, `AuthProvider`, chain constants |
57-
| `@cfxdevkit/react` | Headless render-prop components: `<ConnectButton>`, `<AccountCard>`, `<ContractReader>`, `<SwapWidget>` |
57+
| `@cfxdevkit/react` | Headless render-prop components: `<ConnectButton>`, `<AccountCard>`, `<ContractReader>`, `<ContractWriter>`, `<SwapWidget>` |
5858

5959
---
6060

@@ -67,14 +67,16 @@ npx conflux-devkit
6767
# opens http://localhost:7748
6868
```
6969

70-
Gives you:
70+
Features:
7171
- **Node lifecycle** — start / stop / restart `@xcfx/node`
72-
- **Accounts** — pre-funded genesis accounts, faucet, fund
73-
- **Contracts** — compile and deploy Solidity (from templates or paste your own source)
72+
- **Accounts** — pre-funded genesis accounts, faucet, fund EVM/Core addresses
73+
- **Contracts** — compile and deploy Solidity (6 built-in templates or paste source)
7474
- **Mining** — manual `mine N blocks` or configure auto-mining interval
7575
- **Network** — inspect and configure RPC ports / chain IDs
7676
- **Wallet** — keystore setup, mnemonic management, lock/unlock
7777

78+
See [devtools/devkit/README.md](devtools/devkit/README.md) for full CLI documentation.
79+
7880
Build from source:
7981

8082
```bash
@@ -175,17 +177,6 @@ pnpm --filter @cfxdevkit/contracts-dev codegen
175177
pnpm --filter @cfxdevkit/contracts build
176178
```
177179

178-
ABI, bytecode, and chain-keyed addresses are then importable from:
179-
180-
```typescript
181-
import {
182-
automationManagerAbi,
183-
automationManagerAddress,
184-
automationManagerConfig,
185-
automationManagerBytecode,
186-
} from '@cfxdevkit/contracts';
187-
```
188-
189180
---
190181

191182
## Development
@@ -243,7 +234,7 @@ Packages only import from **lower** layers — never sideways, never upward.
243234
|---|---|
244235
| pnpm workspaces | Dependency linking across packages |
245236
| Turborepo | Incremental build pipeline with cache |
246-
| tsup | Bundle each package to ESM |
237+
| tsup | Bundle each package to ESM + CJS |
247238
| TypeScript 5 | Strict type-checking |
248239
| Biome | Lint + format |
249240
| Vitest | Tests with v8 coverage |
@@ -257,182 +248,4 @@ Packages only import from **lower** layers — never sideways, never upward.
257248
Apache 2.0 — see `LICENSE` in each package.
258249

259250

260-
A layered, fully typed TypeScript SDK for building on **Conflux eSpace** and
261-
**Conflux Core Space**. Use only the layers your project needs — from raw RPC
262-
clients through to production-ready React components.
263-
264-
---
265-
266-
## Packages
267-
268-
Seven focused packages. Full reference with every export and import recipe →
269-
[docs/PACKAGES.md](docs/PACKAGES.md)
270-
271-
### Layer 0 — Core (always start here)
272-
273-
| Package | Dir | What it gives you |
274-
|---|---|---|
275-
| `@cfxdevkit/core` | `packages/core` | RPC clients (EVM + Core Space), contract read/write/deploy, HD wallet derivation, session keys, transaction batching, common ABIs (`ERC20_ABI`, …), chain configs |
276-
277-
### Layer 1 — Services & tools
278-
279-
| Package | Dir | What it gives you |
280-
|---|---|---|
281-
| `@cfxdevkit/services` | `packages/services` | AES-256 encryption, encrypted HD keystore (file-based), Swappi DEX swap |
282-
| `@cfxdevkit/wallet` | `packages/wallet` | Focused re-export of `core`'s wallet API — use when you don't need the full RPC layer |
283-
| `@cfxdevkit/compiler` | `packages/compiler` | Runtime Solidity compiler (solc-js), pre-built contract templates — works in Node.js and browser |
284-
| `@cfxdevkit/devnode` | `packages/devnode` | Local `@xcfx/node` lifecycle: start/stop/mine/faucet. **Dev and test only.** |
285-
286-
### Layer 2 — React UI
287-
288-
| Package | Dir | What it gives you |
289-
|---|---|---|
290-
| `@cfxdevkit/wallet-connect` | `packages/wallet-connect` | wagmi v2 + ConnectKit + SIWE: `<WalletConnect>`, `AuthProvider`, chain constants, `useNetworkSwitch` |
291-
| `@cfxdevkit/react` | `packages/react` | Headless render-prop components: `<ConnectButton>`, `<AccountCard>`, `<ContractReader>`, `<ContractWriter>`, `<SwapWidget>`, and hooks |
292-
293-
---
294-
295-
## Quick start
296-
297-
```bash
298-
pnpm add @cfxdevkit/core # foundation — always needed
299-
pnpm add @cfxdevkit/services # encryption, keystore, swap
300-
pnpm add @cfxdevkit/wallet # wallet logic without full RPC
301-
pnpm add @cfxdevkit/compiler # runtime Solidity compilation
302-
pnpm add @cfxdevkit/devnode -D # local dev node (dev/test only)
303-
pnpm add @cfxdevkit/wallet-connect wagmi viem connectkit @tanstack/react-query
304-
pnpm add @cfxdevkit/react
305-
```
306-
307-
### Read contract state
308-
309-
```typescript
310-
import { ClientManager, ContractReader, ERC20_ABI } from '@cfxdevkit/core';
311-
312-
const client = new ClientManager({ network: 'testnet' });
313-
const reader = new ContractReader(client.evm);
314-
const balance = await reader.read({
315-
address: '0xTokenAddress',
316-
abi: ERC20_ABI,
317-
functionName: 'balanceOf',
318-
args: ['0xUserAddress'],
319-
});
320-
```
321-
322-
### Wallet connection (React)
323-
324-
```tsx
325-
import { WalletConnect, AuthProvider, wagmiConfig } from '@cfxdevkit/wallet-connect';
326-
import { WagmiProvider } from 'wagmi';
327-
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
328-
329-
const queryClient = new QueryClient();
330-
331-
export function Layout({ children }) {
332-
return (
333-
<WagmiProvider config={wagmiConfig}>
334-
<QueryClientProvider client={queryClient}>
335-
<AuthProvider>{children}</AuthProvider>
336-
</QueryClientProvider>
337-
</WagmiProvider>
338-
);
339-
}
340-
341-
// Anywhere in the tree:
342-
<WalletConnect />
343-
```
344-
345-
### Backend embedded wallet
346-
347-
```typescript
348-
import { EmbeddedWalletManager, generateMnemonic } from '@cfxdevkit/wallet';
349-
import { SwapService } from '@cfxdevkit/services';
350-
import { ClientManager } from '@cfxdevkit/core';
351-
352-
const wallet = new EmbeddedWalletManager({ mnemonic: generateMnemonic(), networkType: 'testnet' });
353-
const client = new ClientManager({ network: 'testnet' });
354-
const swapper = new SwapService(client.evm);
355-
```
356-
357-
### Test against a local node
358-
359-
```typescript
360-
import { DevKitWithDevNode } from '@cfxdevkit/devnode';
361-
362-
const node = new DevKitWithDevNode();
363-
await node.start();
364-
await node.mine(3);
365-
await node.faucet(testAddress, 100n);
366-
// ... your tests against localhost:8545
367-
await node.stop();
368-
```
369-
370-
---
371-
372-
## Development
373-
374-
```bash
375-
pnpm install # install all workspace dependencies
376-
pnpm build # build all packages in dependency order
377-
pnpm test # run all tests
378-
pnpm type-check # TypeScript across all packages
379-
pnpm check # lint + format check (Biome)
380-
pnpm format # auto-format all sources
381-
```
382-
383-
Build a single package and everything that depends on it:
384-
385-
```bash
386-
pnpm turbo build --filter=@cfxdevkit/core...
387-
```
388-
389251
---
390-
391-
## Dependency rules
392-
393-
Packages only import from **lower** layers — never sideways, never upward.
394-
395-
```
396-
@cfxdevkit/wallet-connect @cfxdevkit/react
397-
↑ ↑
398-
(peer deps: react, wagmi, viem)
399-
400-
@cfxdevkit/wallet @cfxdevkit/services @cfxdevkit/compiler @cfxdevkit/devnode
401-
402-
@cfxdevkit/core
403-
(external deps: viem, cive)
404-
```
405-
406-
---
407-
408-
## Supported networks
409-
410-
| Network | Chain ID | RPC |
411-
|---|---|---|
412-
| Conflux eSpace Mainnet | 1030 | `https://evm.confluxrpc.com` |
413-
| Conflux eSpace Testnet | 71 | `https://evmtestnet.confluxrpc.com` |
414-
| Conflux eSpace Local | 2030 | `http://localhost:8545` |
415-
| Conflux Core Space Mainnet | 1029 | `https://main.confluxrpc.com` |
416-
| Conflux Core Space Testnet | 1001 | `https://test.confluxrpc.com` |
417-
| Conflux Core Space Local | 2029 | `http://localhost:12537` |
418-
419-
---
420-
421-
## Toolchain
422-
423-
| Tool | Purpose |
424-
|---|---|
425-
| pnpm workspaces | Dependency linking across packages |
426-
| Turborepo | Incremental build pipeline with cache |
427-
| tsup | Bundle each package to ESM + CJS |
428-
| TypeScript 5 | Strict type-checking |
429-
| Biome | Lint + format |
430-
| Vitest | Tests with v8 coverage |
431-
432-
---
433-
434-
## License
435-
436-
Apache 2.0 — see `LICENSE` in each package.
437-
438-

0 commit comments

Comments
 (0)