Skip to Content
Packages@cfxdevkit/cli

@cfxdevkit/cli

Conflux developer CLI: network status + HD key derivation.

Install

pnpm add @cfxdevkit/cli

Tiny developer CLI bundled with @cfxdevkit/cdk. Provides three commands:

  • cfx status — pings each chain and prints head block / epoch + latency.
  • cfx derive — derives dual-space accounts (EVM 0x… + Core cfx[…]:…) from a mnemonic or generates new ones.
  • cfx generate — prints a fresh BIP-39 mnemonic.

Examples

cfx status cfx status --chain core-testnet cfx status --chain 1030 --rpc https://my-private-rpc.example cfx status --json cfx derive --generate --count 3 --core-network-id 1 cfx derive --mnemonic "test test test test test test test test test test test junk" --count 5 cfx derive --mnemonic "..." --type mining --core-network-id 2029 --show-private-keys cfx generate

Notes

  • The default --core-network-id is 1029 (mainnet cfx:…). Use 1 for testnet (cfxtest:…) and 2029 for the local devnet (net2029:…).
  • --type mining switches the BIP-44 account segment from 0' to 1', matching the convention used by the original @cfxdevkit/cdk POC for faucet / miner accounts.
  • Private keys are not printed unless you pass --show-private-keys.

API Reference

Sub-paths

Sub-pathExports
.ParsedArgs, parseArgs, DeriveReport, runDerive, GenerateReport, runGenerate, runStatus, StatusReport, run

.

export { ParsedArgs } export { parseArgs } export { DeriveReport } export { runDerive } export { GenerateReport } export { runGenerate } export { runStatus } export { StatusReport } export { run }

Usage

import { run } from '@cfxdevkit/cli'; // Run CLI with default behavior (uses process.argv) await run(); // Run CLI with custom arguments await run({ command: 'status', chain: 'core-testnet', json: true });

Tier

Tier 1 — platform — May import Tier 0 framework packages.

API Reference

See API.md for the full public surface.

API REFERENCE EXCERPT:

@cfxdevkit/cli — Public API

Conflux developer CLI: network status + HD key derivation.

Sub-paths

Sub-pathExports
.15 symbols

.

// Represents the parsed command-line arguments structure. export { ParsedArgs } // Parses raw command-line arguments into a structured format. export { parseArgs } // Report type returned after successfully deriving an HD wallet key. export { DeriveReport } // Options for configuring HD key derivation. export { RunDeriveOptions } // Runs HD key derivation, returning a report. export { runDerive } // Report type returned after successfully generating a new keypair. export { GenerateReport } // Options for configuring key generation. export { RunGenerateOptions } // Generates a new keypair, returning a report. export { runGenerate } // Options for querying network status. export { RunStatusOptions } // Queries the current network status and returns a report. export { runStatus } // Report type returned after successfully retrieving network status. export { StatusReport } // Main entry point for CLI execution, dispatching to appropriate subcommands. export { run }

Usage

import { run } from '@cfxdevkit/cli'; // Run the CLI with process.argv await run(process.argv.slice(2));

Subcommand Usage Examples

Derive Accounts

import { runDerive, RunDeriveOptions } from '@cfxdevkit/cli'; const options: RunDeriveOptions = { mnemonic: 'test test test test test test test test test test test junk', count: 3, coreNetworkId: 1, type: 'mining', showPrivateKeys: true }; const report = await runDerive(options); console.log(report.accounts);

Generate Mnemonic

import { runGenerate, RunGenerateOptions } from '@cfxdevkit/cli'; const options: RunGenerateOptions = { // optional: strength in bits (128, 192, or 256) }; const report = await runGenerate(options); console.log(report.mnemonic);

Check Network Status

import { runStatus, RunStatusOptions } from '@cfxdevkit/cli'; const options: RunStatusOptions = { chain: 'core-testnet', json: true }; const report = await runStatus(options); console.log(report);

API Reference

.

// Represents the parsed command-line arguments structure. export { ParsedArgs } // Parses raw command-line arguments into a structured format. export { parseArgs } // Report type returned after successfully extracting smart contract artifacts. export { ContractsExtractReport } // Options for configuring the smart contract extraction process. export { RunContractsExtractOptions } // Runs the smart contract extraction process, returning a report. export { runContractsExtract } // Report type returned after successfully deriving an HD wallet key. export { DeriveReport } // Options for configuring HD key derivation. export { RunDeriveOptions } // Runs HD key derivation, returning a report. export { runDerive } // Report type returned after successfully generating a new keypair. export { GenerateReport } // Options for configuring key generation. export { RunGenerateOptions } // Generates a new keypair, returning a report. export { runGenerate } // Options for querying network status. export { RunStatusOptions } // Queries the current network status and returns a report. export { runStatus } // Report type returned after successfully retrieving network status. export { StatusReport } // Main entry point for CLI execution, dispatching to appropriate subcommands. export { run }

Usage

import { run } from '@cfxdevkit/cli'; // Run the CLI with process.argv await run(process.argv.slice(2));

Subcommand Usage Examples

Smart Contract Extraction

import { runContractsExtract, RunContractsExtractOptions } from '@cfxdevkit/cli'; const options: RunContractsExtractOptions = { // configuration for extraction }; const report = await runContractsExtract(options);

HD Key Derivation

import { runDerive, RunDeriveOptions } from '@cfxdevkit/cli'; const options: RunDeriveOptions = { // derivation path and other settings }; const report = await runDerive(options);

Key Generation

import { runGenerate, RunGenerateOptions } from '@cfxdevkit/cli'; const options: RunGenerateOptions = { // optional seed or entropy source }; const report = await runGenerate(options);

Network Status Query

import { runStatus, RunStatusOptions } from '@cfxdevkit/cli'; const options: RunStatusOptions = { // network endpoint or timeout config }; const report = await runStatus(options);
Last updated on