@cfxdevkit/client
v2.1.8
Published
Typed HTTP client for the Conflux Devkit devnode-server control plane.
Readme
@cfxdevkit/client
Typed HTTP client for the Conflux Devkit devnode-server control plane.
Install
pnpm add @cfxdevkit/clientUsage
import { ConfluxDevkitClient } from '@cfxdevkit/client';
const client = ConfluxDevkitClient.createConfluxDevkitClient({
baseUrl: 'http://localhost:12345',
});
// Start a node with a specific profile
await client.createNodeNamespace().start({ profile: 'devnet' });
// Restart the node
await client.createNodeNamespace().restart();
// Wipe node state and restart
await client.createNodeNamespace().wipe({ profile: 'devnet' });
// Check node health
const health = await client.createHealthNamespace().getHealth();
// Start/stop mining
await client.createMiningNamespace().mine({ start: true });
// Deploy a contract from a compiled artifact
const artifact = { /* compiled artifact */ };
const receipt = await client.createDeployNamespace().deployContract({
artifact,
constructorArgs: [],
sender: '0x...',
});
console.log('Deployed at:', receipt.contractAddress);
// Compile Solidity source
const result = await client.createCompilerNamespace().compile({
sources: { 'Greeter.sol': 'pragma solidity ^0.8.0; contract Greeter {}' },
outputSelection: { '*': { '*': ['abi', 'evm.bytecode.object'] } },
});
// Manage accounts and wallets
const accounts = await client.createAccountsNamespace().list();
const wallet = await client.createKeystoreNamespace().createWallet({ password: 'secret' });
// Bootstrap a node from a template
const templates = await client.createBootstrapNamespace().listTemplates();
const deployResult = await client.createBootstrapNamespace().deployTemplate({
templateName: 'devnet',
config: { /* template-specific config */ },
});API Reference
See API.md for the full public surface.
Sub-paths
| Sub-path | Exports |
|----------|---------|
| . | 76 symbols |
Tier
Tier 1 — platform — May import Tier 0 framework packages.
