@cfxdevkit/services 0.1.0 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/README.md +16 -22
  3. package/package.json +23 -22
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Changelog
2
2
 
3
- All notable changes to `@cfxdevkit/sdk` will be documented here.
3
+ All notable changes to `@cfxdevkit/services` will be documented here.
4
4
 
5
5
  Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
6
 
package/README.md CHANGED
@@ -13,9 +13,9 @@ Provides chain clients, contract utilities, wallet derivation, swap services, an
13
13
  ## Installation
14
14
 
15
15
  ```bash
16
- pnpm add @cfxdevkit/sdk
16
+ pnpm add @cfxdevkit/services
17
17
  # or
18
- npm install @cfxdevkit/sdk
18
+ npm install @cfxdevkit/services
19
19
  ```
20
20
 
21
21
  Peer dependencies (install if using React hooks):
@@ -30,15 +30,9 @@ pnpm add react react-dom
30
30
 
31
31
  | Subpath | Contents |
32
32
  |---------|----------|
33
- | `@cfxdevkit/sdk` | Full barrel everything |
34
- | `@cfxdevkit/sdk/clients` | `ClientManager`, `CoreClient`, `EspaceClient` |
35
- | `@cfxdevkit/sdk/config` | Chain definitions for Core + eSpace |
36
- | `@cfxdevkit/sdk/types` | Shared TypeScript types |
37
- | `@cfxdevkit/sdk/utils` | Logger |
38
- | `@cfxdevkit/sdk/wallet` | HD derivation, session keys, batching, embedded wallets |
39
- | `@cfxdevkit/sdk/contracts` | `ContractDeployer`, `ContractReader`, `ContractWriter`, ERC ABIs |
40
- | `@cfxdevkit/sdk/services` | `SwapService` (Swappi DEX), `KeystoreService`, `EncryptionService` |
41
- | `@cfxdevkit/sdk/automation` | `SafetyGuard`, `RetryQueue`, `PriceChecker`, `AUTOMATION_MANAGER_ABI`, types |
33
+ | `@cfxdevkit/core` | RPC clients, core utilities |
34
+ | `@cfxdevkit/services` | `SwapService`, `KeystoreService`, `EncryptionService` |
35
+ | `@cfxdevkit/core/wallet` | HD derivation, session keys, batching, embedded wallets |
42
36
 
43
37
  ---
44
38
 
@@ -47,7 +41,7 @@ pnpm add react react-dom
47
41
  ### Connect to Conflux eSpace
48
42
 
49
43
  ```typescript
50
- import { ClientManager, EVM_MAINNET } from '@cfxdevkit/sdk';
44
+ import { ClientManager, EVM_MAINNET } from '@cfxdevkit/core';
51
45
 
52
46
  const manager = new ClientManager({
53
47
  evm: { chain: EVM_MAINNET },
@@ -61,7 +55,7 @@ console.log('Current block:', block);
61
55
  ### Connect to Conflux Core Space
62
56
 
63
57
  ```typescript
64
- import { ClientManager, CORE_MAINNET } from '@cfxdevkit/sdk';
58
+ import { ClientManager, CORE_MAINNET } from '@cfxdevkit/core';
65
59
 
66
60
  const manager = new ClientManager({
67
61
  core: { chain: CORE_MAINNET },
@@ -75,7 +69,7 @@ console.log('Current epoch:', epochNumber);
75
69
  ### HD Wallet Derivation
76
70
 
77
71
  ```typescript
78
- import { generateMnemonic, deriveAccounts } from '@cfxdevkit/sdk/wallet';
72
+ import { generateMnemonic, deriveAccounts } from '@cfxdevkit/core/wallet';
79
73
 
80
74
  // Generate new wallet
81
75
  const mnemonic = generateMnemonic();
@@ -92,9 +86,9 @@ for (const account of accounts) {
92
86
  ### Read an ERC-20 token
93
87
 
94
88
  ```typescript
95
- import { ClientManager, EVM_MAINNET } from '@cfxdevkit/sdk/clients';
96
- import { ContractReader } from '@cfxdevkit/sdk/contracts';
97
- import { ERC20_ABI } from '@cfxdevkit/sdk/contracts';
89
+ import { ClientManager, EVM_MAINNET } from '@cfxdevkit/core';
90
+ import { ContractReader } from '@cfxdevkit/core/contracts';
91
+ import { ERC20_ABI } from '@cfxdevkit/core/contracts';
98
92
 
99
93
  const manager = new ClientManager({ evm: { chain: EVM_MAINNET } });
100
94
  await manager.connect();
@@ -113,8 +107,8 @@ console.log('Balance:', balance);
113
107
  ### Query a DEX swap quote (Swappi)
114
108
 
115
109
  ```typescript
116
- import { ClientManager, EVM_MAINNET } from '@cfxdevkit/sdk/clients';
117
- import { SwapService } from '@cfxdevkit/sdk/services';
110
+ import { ClientManager, EVM_MAINNET } from '@cfxdevkit/core';
111
+ import { SwapService } from '@cfxdevkit/services';
118
112
 
119
113
  const manager = new ClientManager({ evm: { chain: EVM_MAINNET } });
120
114
  await manager.connect();
@@ -132,7 +126,7 @@ console.log('Expected out:', quote.amountOut);
132
126
  ### Encrypted Keystore
133
127
 
134
128
  ```typescript
135
- import { KeystoreService } from '@cfxdevkit/sdk/services';
129
+ import { KeystoreService } from '@cfxdevkit/services';
136
130
 
137
131
  const keystore = new KeystoreService('/path/to/.keystore.json');
138
132
  await keystore.setup({ password: 'my-password' });
@@ -150,7 +144,7 @@ const accounts = await keystore.deriveAccountsFromMnemonic(
150
144
  ```typescript
151
145
  import {
152
146
  SafetyGuard, RetryQueue, PriceChecker, AUTOMATION_MANAGER_ABI,
153
- } from '@cfxdevkit/sdk/automation';
147
+ } from '@cfxdevkit/core/automation';
154
148
 
155
149
  // Injectable logger — pass pino/winston/console or omit for silence
156
150
  const guard = new SafetyGuard({ maxSwapUsd: 5_000 }, myLogger);
@@ -172,7 +166,7 @@ const { conditionMet, swapUsd } = await checker.checkLimitOrder(job);
172
166
  ## Architecture
173
167
 
174
168
  ```
175
- @cfxdevkit/sdk
169
+ @cfxdevkit/core
176
170
 
177
171
  ├── clients/ ← cive (Core) + viem (eSpace) thin wrappers + ClientManager
178
172
  ├── config/ ← Chain definitions: local / testnet / mainnet for both spaces
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cfxdevkit/services",
3
- "version": "0.1.0",
3
+ "version": "1.0.7",
4
4
  "description": "High-level services for Conflux SDK (Swap, Keystore, Encryption)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -28,6 +28,21 @@
28
28
  },
29
29
  "./package.json": "./package.json"
30
30
  },
31
+ "scripts": {
32
+ "build": "tsup",
33
+ "build:watch": "tsup --watch",
34
+ "type-check": "tsc --noEmit",
35
+ "test": "vitest run",
36
+ "test:watch": "vitest",
37
+ "test:coverage": "vitest run --coverage --pass-with-no-tests",
38
+ "clean": "rm -rf dist",
39
+ "lint": "biome lint src/",
40
+ "lint:fix": "biome lint --write src/",
41
+ "format": "biome format src/",
42
+ "format:fix": "biome format --write src/",
43
+ "check": "biome check src/",
44
+ "check:fix": "biome check --write src/"
45
+ },
31
46
  "keywords": [
32
47
  "conflux",
33
48
  "blockchain",
@@ -45,16 +60,16 @@
45
60
  "license": "Apache-2.0",
46
61
  "repository": {
47
62
  "type": "git",
48
- "url": "git+https://github.com/cfxdevkit/conflux-sdk.git"
63
+ "url": "git+https://github.com/cfxdevkit/devkit.git"
49
64
  },
50
- "homepage": "https://github.com/cfxdevkit/conflux-sdk#readme",
65
+ "homepage": "https://github.com/cfxdevkit/devkit#readme",
51
66
  "bugs": {
52
- "url": "https://github.com/cfxdevkit/conflux-sdk/issues"
67
+ "url": "https://github.com/cfxdevkit/devkit/issues"
53
68
  },
54
69
  "dependencies": {
70
+ "@cfxdevkit/core": "workspace:*",
55
71
  "viem": "^2.43.3",
56
- "zod": "^3.23.0",
57
- "@cfxdevkit/core": "0.1.0"
72
+ "zod": "^3.23.0"
58
73
  },
59
74
  "devDependencies": {
60
75
  "@biomejs/biome": "^2.3.10",
@@ -79,19 +94,5 @@
79
94
  "engines": {
80
95
  "node": ">=18.0.0"
81
96
  },
82
- "scripts": {
83
- "build": "tsup",
84
- "build:watch": "tsup --watch",
85
- "type-check": "tsc --noEmit",
86
- "test": "vitest run",
87
- "test:watch": "vitest",
88
- "test:coverage": "vitest run --coverage",
89
- "clean": "rm -rf dist",
90
- "lint": "biome lint src/",
91
- "lint:fix": "biome lint --write src/",
92
- "format": "biome format src/",
93
- "format:fix": "biome format --write src/",
94
- "check": "biome check src/",
95
- "check:fix": "biome check --write src/"
96
- }
97
- }
97
+ "packageManager": "pnpm@10.11.0"
98
+ }