@offckb/cli 0.3.4 → 0.4.0-canary-113bf31.0

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 (110) hide show
  1. package/README.md +17 -138
  2. package/build/build/Release/cpufeatures.node +0 -0
  3. package/build/build/Release/secp256k1.node +0 -0
  4. package/build/index.js +114977 -0
  5. package/package.json +12 -6
  6. package/dist/cfg/account.d.ts +0 -55
  7. package/dist/cfg/account.js +0 -66
  8. package/dist/cfg/env-path.d.ts +0 -9
  9. package/dist/cfg/env-path.js +0 -63
  10. package/dist/cfg/setting.d.ts +0 -67
  11. package/dist/cfg/setting.js +0 -147
  12. package/dist/cli.d.ts +0 -2
  13. package/dist/cli.js +0 -224
  14. package/dist/cmd/accounts.d.ts +0 -1
  15. package/dist/cmd/accounts.js +0 -40
  16. package/dist/cmd/balance.d.ts +0 -4
  17. package/dist/cmd/balance.js +0 -25
  18. package/dist/cmd/clean.d.ts +0 -1
  19. package/dist/cmd/clean.js +0 -27
  20. package/dist/cmd/config.d.ts +0 -11
  21. package/dist/cmd/config.js +0 -107
  22. package/dist/cmd/create.d.ts +0 -7
  23. package/dist/cmd/create.js +0 -77
  24. package/dist/cmd/debug.d.ts +0 -16
  25. package/dist/cmd/debug.js +0 -120
  26. package/dist/cmd/deploy.d.ts +0 -9
  27. package/dist/cmd/deploy.js +0 -76
  28. package/dist/cmd/deposit.d.ts +0 -5
  29. package/dist/cmd/deposit.js +0 -97
  30. package/dist/cmd/inject-config.d.ts +0 -4
  31. package/dist/cmd/inject-config.js +0 -72
  32. package/dist/cmd/list-hashes.d.ts +0 -25
  33. package/dist/cmd/list-hashes.js +0 -39
  34. package/dist/cmd/mol.d.ts +0 -2
  35. package/dist/cmd/mol.js +0 -38
  36. package/dist/cmd/my-scripts.d.ts +0 -4
  37. package/dist/cmd/my-scripts.js +0 -24
  38. package/dist/cmd/node.d.ts +0 -5
  39. package/dist/cmd/node.js +0 -70
  40. package/dist/cmd/proxy-rpc.d.ts +0 -7
  41. package/dist/cmd/proxy-rpc.js +0 -22
  42. package/dist/cmd/repl.d.ts +0 -17
  43. package/dist/cmd/repl.js +0 -111
  44. package/dist/cmd/sync-scripts.d.ts +0 -4
  45. package/dist/cmd/sync-scripts.js +0 -30
  46. package/dist/cmd/system-scripts.d.ts +0 -99
  47. package/dist/cmd/system-scripts.js +0 -301
  48. package/dist/cmd/transfer-all.d.ts +0 -6
  49. package/dist/cmd/transfer-all.js +0 -37
  50. package/dist/cmd/transfer.d.ts +0 -6
  51. package/dist/cmd/transfer.js +0 -38
  52. package/dist/deploy/index.d.ts +0 -18
  53. package/dist/deploy/index.js +0 -127
  54. package/dist/deploy/migration.d.ts +0 -50
  55. package/dist/deploy/migration.js +0 -178
  56. package/dist/deploy/toml.d.ts +0 -42
  57. package/dist/deploy/toml.js +0 -59
  58. package/dist/deploy/util.d.ts +0 -2
  59. package/dist/deploy/util.js +0 -18
  60. package/dist/molecule/mol.d.ts +0 -9
  61. package/dist/molecule/mol.js +0 -149
  62. package/dist/node/init-chain.d.ts +0 -1
  63. package/dist/node/init-chain.js +0 -40
  64. package/dist/node/install.d.ts +0 -11
  65. package/dist/node/install.js +0 -235
  66. package/dist/scripts/gen.d.ts +0 -5
  67. package/dist/scripts/gen.js +0 -78
  68. package/dist/scripts/private.d.ts +0 -4
  69. package/dist/scripts/private.js +0 -13
  70. package/dist/scripts/public.d.ts +0 -8
  71. package/dist/scripts/public.js +0 -229
  72. package/dist/scripts/type.d.ts +0 -51
  73. package/dist/scripts/type.js +0 -19
  74. package/dist/scripts/util.d.ts +0 -3
  75. package/dist/scripts/util.js +0 -93
  76. package/dist/sdk/ckb.d.ts +0 -37
  77. package/dist/sdk/ckb.js +0 -254
  78. package/dist/sdk/network.d.ts +0 -17
  79. package/dist/sdk/network.js +0 -22
  80. package/dist/template/offckb-config.d.ts +0 -4
  81. package/dist/template/offckb-config.js +0 -70
  82. package/dist/template/option.d.ts +0 -8
  83. package/dist/template/option.js +0 -22
  84. package/dist/tools/ckb-debugger.d.ts +0 -12
  85. package/dist/tools/ckb-debugger.js +0 -31
  86. package/dist/tools/ckb-tx-dumper.d.ts +0 -6
  87. package/dist/tools/ckb-tx-dumper.js +0 -20
  88. package/dist/tools/moleculec-es.d.ts +0 -8
  89. package/dist/tools/moleculec-es.js +0 -100
  90. package/dist/tools/moleculec-go.d.ts +0 -5
  91. package/dist/tools/moleculec-go.js +0 -35
  92. package/dist/tools/moleculec-rust.d.ts +0 -5
  93. package/dist/tools/moleculec-rust.js +0 -35
  94. package/dist/tools/rpc-proxy.d.ts +0 -7
  95. package/dist/tools/rpc-proxy.js +0 -90
  96. package/dist/type/base.d.ts +0 -11
  97. package/dist/type/base.js +0 -10
  98. package/dist/util/encoding.d.ts +0 -2
  99. package/dist/util/encoding.js +0 -24
  100. package/dist/util/fs.d.ts +0 -13
  101. package/dist/util/fs.js +0 -218
  102. package/dist/util/git.d.ts +0 -2
  103. package/dist/util/git.js +0 -106
  104. package/dist/util/link.d.ts +0 -1
  105. package/dist/util/link.js +0 -6
  106. package/dist/util/request.d.ts +0 -8
  107. package/dist/util/request.js +0 -61
  108. package/dist/util/validator.d.ts +0 -5
  109. package/dist/util/validator.js +0 -67
  110. package/npm-shrinkwrap.json +0 -4514
package/README.md CHANGED
@@ -8,45 +8,14 @@
8
8
 
9
9
  CKB local development network for your first try.
10
10
 
11
- - One-line command to start a devnet
12
- - No docker required
11
+ - One-line command to start a devnet, no docker required
13
12
  - Pre-funded test accounts
14
13
  - Built-in scripts like [Omnilock](https://github.com/cryptape/omnilock) and [Spore-contract](https://github.com/sporeprotocol/spore-contract)
15
- - Multiple minimal dApp templates to learn and get your hands dirty
16
-
17
- **Migrate from v0.2.x to v0.3.x:**
18
-
19
- There are BREAKING CHANGES between v0.2.x and v0.3.x, make sure to read the [migration guide](/docs/migration.md) before upgrading.
20
-
21
- ## Table of Contents
22
-
23
- - [OffCKB](#offckb)
24
- - [Table of Contents](#table-of-contents)
25
- - [Install](#install)
26
- - [Usage](#usage)
27
- - [Get started](#get-started)
28
- - [Running CKB](#running-ckb)
29
- - [List scripts info](#list-scripts-info)
30
- - [Tweak Devnet Config](#tweak-devnet-config)
31
- - [Create a full-stack Project](#create-a-full-stack-project)
32
- - [Create a script-only Project](#create-a-script-only-project)
33
- - [Build and Deploy a script](#build-and-deploy-a-script)
34
- - [Start the frontend project](#start-the-frontend-project)
35
- - [Debug a transaction](#debug-a-transaction)
36
- - [Generate Moleculec bindings](#generate-moleculec-bindings)
37
- - [REPL Mode](#repl-mode)
38
- - [Start the OffCKB REPL](#start-the-offckb-repl)
39
- - [Build CKB transaction in REPL](#build-ckb-transaction-in-repl)
40
- - [Get balance in REPL](#get-balance-in-repl)
41
- - [Config Setting](#config-setting)
42
- - [List All Settings](#list-all-settings)
43
- - [Set CKB version](#set-ckb-version)
44
- - [Set Network Proxy](#set-network-proxy)
45
- - [Built-in scripts](#built-in-scripts)
46
- - [Accounts](#accounts)
47
- - [About CCC](#about-ccc)
48
- - [FAQ](#faq)
49
- - [Contributing](#contributing)
14
+ - Create boilerplate project to build your CKB dApp
15
+
16
+ **Migrate from v0.3.x to v0.4.x:**
17
+
18
+ There are BREAKING CHANGES between v0.3.x and v0.4.x, make sure to read the [migration guide](/docs/migration.md) before upgrading.
50
19
 
51
20
  ## Install
52
21
 
@@ -74,12 +43,10 @@ Options:
74
43
  -h, --help display help for command
75
44
 
76
45
  Commands:
77
- create [options] [your-project-name] Create a new dApp from bare templates
78
46
  node [options] [CKB-Version] Use the CKB to start devnet
79
- proxy-rpc [options] Start the rpc proxy server
47
+ create [options] [your-project-name] Create a new dApp from bare templates
80
48
  clean Clean the devnet data, need to stop running the chain first
81
49
  accounts Print account list info
82
- list-hashes [CKB-Version] Use the CKB to list blockchain scripts hashes
83
50
  inject-config Add offckb.config.ts to your frontend workspace
84
51
  sync-scripts Sync scripts json files in your frontend workspace
85
52
  deposit [options] [toAddress] [amountInCKB] Deposit CKB tokens to address, only devnet and testnet
@@ -91,8 +58,6 @@ Commands:
91
58
  config <action> [item] [value] do a configuration action
92
59
  debug [options] CKB Debugger for development
93
60
  system-scripts [options] Output system scripts of the local devnet
94
- mol [options] Generate CKB Moleculec binding code for development
95
- repl [options] A custom Nodejs REPL environment bundle for CKB.
96
61
  help [command] display help for command
97
62
  ```
98
63
 
@@ -121,19 +86,7 @@ offckb config set ckb-version 0.117.0
121
86
  offckb node
122
87
  ```
123
88
 
124
- Once you start the devnet, there is a RPC server running at `http://localhost:8114`. There is also a RPC proxy server running at `http://localhost:9000` which will proxy all the requests to the RPC server. The meaning of using a proxy RPC server is to record request and automatically dump failed transactions so you can debug them easily later.
125
-
126
- The proxy server is optional, you can use the RPC server directly if you don't need a proxy:
127
-
128
- ```sh
129
- offckb node --no-proxy
130
- ```
131
-
132
- Or start the proxy server in a standalone terminal to better monitor the logs:
133
-
134
- ```sh
135
- offckb proxy-rpc --ckb-rpc http://localhost:8114 --port 9000 --network devnet
136
- ```
89
+ Once you start the devnet, there is a RPC server running at `http://localhost:8114`. There is also a RPC proxy server running at `http://localhost:28114` which will proxy all the requests to the RPC server. The meaning of using a proxy RPC server is to record request and automatically dump failed transactions so you can debug them easily later.
137
90
 
138
91
  ### List scripts info
139
92
 
@@ -206,7 +159,15 @@ You can create a new script project without a frontend. This is useful when you
206
159
  offckb create <your-project-name> --script
207
160
  ```
208
161
 
209
- Note: you need to have rust/cargo/cargo-generate/clang 16+ installed in your environment to use this command. offckb doesn't do anything really, it just call [ckb-script-template](https://github.com/cryptape/ckb-script-templates) to do all the magic.
162
+ Note: you need to have pnpm installed in your environment to use this command. offckb doesn't do anything really, it just call [create-js-vm-app](https://github.com/nervosnetwork/ckb-js-vm/tree/main/packages/create-app) to do all the magic.
163
+
164
+ ### Create a dApp-only Project
165
+
166
+ You can create a new dApp project without the script(CKB Smart Contract). This is useful when you don't need to create your own on-chain script logic.
167
+
168
+ ```sh
169
+ offckb create <your-project-name> --dapp # or -d
170
+ ```
210
171
 
211
172
  ### Build and Deploy a script
212
173
 
@@ -309,88 +270,6 @@ offckb debug <transaction-hash> --single-script <single-cell-script-option> --bi
309
270
 
310
271
  All the debug utils are borrowed from [ckb-debugger](https://github.com/nervosnetwork/ckb-standalone-debugger/tree/develop/ckb-debugger).
311
272
 
312
- ### Generate Moleculec bindings
313
-
314
- [Moleculec](https://github.com/nervosnetwork/molecule) is the official Serialization/Deserialization system for CKB smart contracts.
315
-
316
- You will define your data structure in `.mol` file(schema), and generate the bindings for different programming languages to use in your development.
317
-
318
- ```sh
319
- offckb mol --schema <path/to/mol/file> --output <path/to/output/file> --lang <lang>
320
- ```
321
-
322
- The `lang` could be `ts`, `js`, `c`, `rs` and `go`.
323
-
324
- If you have multiple `.mol` files, you can use a folder as the input and specify an output folder:
325
-
326
- ```sh
327
- offckb mol --schema <path/to/mol/folder> --output-folder <path/to/output/folder> --lang <lang>
328
- ```
329
-
330
- ## REPL Mode
331
-
332
- OffCKB pack a custom Nodejs REPL with built-in variables and functions to help you develop CKB right in the terminal with minimal effort. This is suitable for simple script testing task when you don't want to write long and serious codes.
333
-
334
- ### Start the OffCKB REPL
335
-
336
- ```sh
337
- offckb repl --network <devnet/testnet/mainnet, default: devnet>
338
-
339
- Welcome to OffCKB REPL!
340
- [[ Default Network: devnet, enableProxyRPC: false ]]
341
- Type 'help()' to learn how to use.
342
- OffCKB >
343
- ```
344
-
345
- Type `help()` to learn about the built-in variables and functions:
346
-
347
- ```sh
348
- OffCKB > help()
349
-
350
- OffCKB Repl, a Nodejs REPL with CKB bundles.
351
-
352
- Global Variables to use:
353
- - ccc, cccA, imported from CKB Javascript SDK CCC
354
- - client, a CCC client instance bundle with current network
355
- - Client, a Wrap of CCC client class, you can build new client with
356
- const myClient = Client.new('devnet' | 'testnet' | 'mainnet');
357
- // or
358
- const myClient = Client.fromUrl('<your rpc url>', 'devnet' | 'testnet' | 'mainnet');
359
- - accounts, test accounts array from OffCKB
360
- - networks, network information configs
361
- - help, print this help message
362
- ```
363
-
364
- ### Build CKB transaction in REPL
365
-
366
- ```sh
367
- OffCKB > let amountInCKB = ccc.fixedPointFrom(63);
368
- OffCKB > let tx = ccc.Transaction.from({
369
- ... outputs: [
370
- ... {
371
- ... capacity: ccc.fixedPointFrom(amountInCKB),
372
- ... lock: accounts[0].lockScript,
373
- ... },
374
- ... ],
375
- ... });
376
- OffCKB > let signer = new ccc.SignerCkbPrivateKey(client, accounts[0].privkey);
377
- OffCKB > await tx.completeInputsByCapacity(signer);
378
- 2
379
- OffCKB > await tx.completeFeeBy(signer, 1000);
380
- [ 0, true ]
381
- OffCKB > await mySigner.sendTransaction(tx)
382
- '0x50fbfa8c47907d6842a325e85e48d5da6917e16ca7e2253ec3bd5bcdf8da99ce'
383
- ```
384
-
385
- ### Get balance in REPL
386
-
387
- ```sh
388
- OffCKB > let myClient = Client.fromUrl(networks.testnet.rpc_url, 'testnet');
389
- OffCKB > await myClient.getBalanceSingle(accounts[0].lockScript);
390
- 60838485293944n
391
- OffCKB >
392
- ```
393
-
394
273
  ## Config Setting
395
274
 
396
275
  ### List All Settings