@offckb/cli 0.3.0-rc2 → 0.3.0-rc3

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.
package/README.md CHANGED
@@ -27,6 +27,7 @@ There are BREAKING CHANGES between v0.2.x and v0.3.x, make sure to read the [mig
27
27
  - [Get started](#get-started)
28
28
  - [Running CKB](#running-ckb)
29
29
  - [List scripts info](#list-scripts-info)
30
+ - [Tweak Devnet Config](#tweak-devnet-config)
30
31
  - [Create a full-stack Project](#create-a-full-stack-project)
31
32
  - [Create a script-only Project](#create-a-script-only-project)
32
33
  - [Build and Deploy a script](#build-and-deploy-a-script)
@@ -49,7 +50,7 @@ There are BREAKING CHANGES between v0.2.x and v0.3.x, make sure to read the [mig
49
50
  npm install -g @offckb/cli
50
51
  ```
51
52
 
52
- *We recommand using [LTS](https://nodejs.org/en/download/package-manager) version of Node to run `offckb`*
53
+ _We recommand using [LTS](https://nodejs.org/en/download/package-manager) version of Node to run `offckb`_
53
54
 
54
55
  ## Usage
55
56
 
@@ -83,7 +84,7 @@ Commands:
83
84
  help [command] display help for command
84
85
  ```
85
86
 
86
- *Use `offckb [command] -h` to learn more about a specific command.*
87
+ _Use `offckb [command] -h` to learn more about a specific command._
87
88
 
88
89
  ## Get started
89
90
 
@@ -98,7 +99,7 @@ offckb node
98
99
  Or specify a CKB version:
99
100
 
100
101
  ```sh
101
- offckb node 0.117.0
102
+ offckb node 0.117.0
102
103
  ```
103
104
 
104
105
  Or set the default CKB version:
@@ -142,6 +143,39 @@ Or print the scripts info in a CCC style:
142
143
  offckb system-scripts --export-style ccc
143
144
  ```
144
145
 
146
+ ### Tweak Devnet Config
147
+
148
+ By default, offckb use a fixed devnet config for the local blockchain. You can tweak the config to customize the devnet:
149
+
150
+ First, start a default CKB devnet and locate your devnet folder
151
+
152
+ ```sh
153
+ offckb node
154
+ # after starting, press ctrl-c to kill the node
155
+ # then get the config
156
+ offckb config list
157
+ ```
158
+
159
+ Result:
160
+
161
+ ```json
162
+ {
163
+ "devnet": {
164
+ "rpcUrl": "http://localhost:8114",
165
+ "configPath": "~/Library/Application Support/offckb-nodejs/devnet",
166
+ "dataPath": "~/Library/Application Support/offckb-nodejs/devnet/data"
167
+ }
168
+ }
169
+ ```
170
+
171
+ Pay attention to the `devnet.configPath` and `devnet.dataPath`. They are the ones we need.
172
+
173
+ 1. `cd` into the `devnet.configPath`, this is the config folder for the local blockchain. Modify the config in the folder to better customize the devnet. For customization, see [Custom Devnet Setup](https://docs.nervos.org/docs/node/run-devnet-node#custom-devnet-setup) and [Configure CKB](https://github.com/nervosnetwork/ckb/blob/develop/docs/configure.md) for better explanation of the config files.
174
+ 2. After modifications, remove everything in the `devnet.dataPath` folder. This will clean the chain data.
175
+ 3. Restart local blockchain by running `offckb node`
176
+
177
+ Done.
178
+
145
179
  ### Create a full-stack Project
146
180
 
147
181
  Create a new project from predefined boilerplates.
@@ -166,7 +200,7 @@ Note: you need to have rust/cargo/cargo-generate/clang 16+ installed in your env
166
200
 
167
201
  The fullstack boilerplate project is a monorepo, which contains a script project and a frontend project.
168
202
 
169
- To build the script, in the root of the project, run:
203
+ To build the script, in the root of the project, run:
170
204
 
171
205
  ```sh
172
206
  make build
@@ -1,4 +1,4 @@
1
- name = "offckb"
1
+ name = "ckb_dev"
2
2
 
3
3
  [genesis]
4
4
  version = 0
@@ -65,18 +65,22 @@ function getSystemScriptsFromListHashes() {
65
65
  const listHashesString = (0, list_hashes_1.getListHashes)(settings.bins.defaultCKBVersion);
66
66
  if (listHashesString) {
67
67
  const listHashes = toml_1.default.parse(listHashesString);
68
- const systemScriptArray = listHashes.offckb.system_cells
68
+ const chainSpecHashes = Object.values(listHashes)[0];
69
+ if (chainSpecHashes == null) {
70
+ throw new Error(`invalid chain spec hashes file ${listHashesString}`);
71
+ }
72
+ const systemScriptArray = chainSpecHashes.system_cells
69
73
  .map((cell) => {
70
74
  var _a;
71
75
  // Extract the file name
72
76
  const name = ((_a = cell.path.split('/').pop()) === null || _a === void 0 ? void 0 : _a.replace(')', '')) || 'unknown script';
73
- const depGroupIndex = listHashes.offckb.dep_groups.findIndex((depGroup) => depGroup.included_cells.includes(`Bundled(specs/cells/${name})`));
77
+ const depGroupIndex = chainSpecHashes.dep_groups.findIndex((depGroup) => depGroup.included_cells.includes(`Bundled(specs/cells/${name})`));
74
78
  const depType = depGroupIndex === -1 ? 'code' : 'depGroup';
75
79
  const depGroup = depGroupIndex === -1
76
80
  ? undefined
77
81
  : {
78
- txHash: listHashes.offckb.dep_groups[depGroupIndex].tx_hash,
79
- index: listHashes.offckb.dep_groups[depGroupIndex].index,
82
+ txHash: chainSpecHashes.dep_groups[depGroupIndex].tx_hash,
83
+ index: chainSpecHashes.dep_groups[depGroupIndex].index,
80
84
  };
81
85
  const scriptInfo = systemCellToScriptInfo(cell, depType, depGroup);
82
86
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@offckb/cli",
3
- "version": "0.3.0-rc2",
3
+ "version": "0.3.0-rc3",
4
4
  "description": "ckb development network for your first try",
5
5
  "author": "CKB EcoFund",
6
6
  "license": "MIT",