@offckb/cli 0.3.5 → 0.4.0-canary-0b6fdc0.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.
- package/README.md +10 -139
- package/build/build/Release/secp256k1.node +0 -0
- package/build/index.js +114965 -0
- package/package.json +12 -6
- package/dist/cfg/account.d.ts +0 -55
- package/dist/cfg/account.js +0 -66
- package/dist/cfg/env-path.d.ts +0 -9
- package/dist/cfg/env-path.js +0 -63
- package/dist/cfg/setting.d.ts +0 -70
- package/dist/cfg/setting.js +0 -150
- package/dist/cli.d.ts +0 -2
- package/dist/cli.js +0 -228
- package/dist/cmd/accounts.d.ts +0 -1
- package/dist/cmd/accounts.js +0 -40
- package/dist/cmd/balance.d.ts +0 -4
- package/dist/cmd/balance.js +0 -25
- package/dist/cmd/clean.d.ts +0 -1
- package/dist/cmd/clean.js +0 -27
- package/dist/cmd/config.d.ts +0 -11
- package/dist/cmd/config.js +0 -107
- package/dist/cmd/create.d.ts +0 -15
- package/dist/cmd/create.js +0 -104
- package/dist/cmd/debug.d.ts +0 -16
- package/dist/cmd/debug.js +0 -120
- package/dist/cmd/deploy.d.ts +0 -9
- package/dist/cmd/deploy.js +0 -76
- package/dist/cmd/deposit.d.ts +0 -5
- package/dist/cmd/deposit.js +0 -97
- package/dist/cmd/inject-config.d.ts +0 -4
- package/dist/cmd/inject-config.js +0 -73
- package/dist/cmd/list-hashes.d.ts +0 -25
- package/dist/cmd/list-hashes.js +0 -39
- package/dist/cmd/mol.d.ts +0 -2
- package/dist/cmd/mol.js +0 -38
- package/dist/cmd/my-scripts.d.ts +0 -4
- package/dist/cmd/my-scripts.js +0 -24
- package/dist/cmd/node.d.ts +0 -5
- package/dist/cmd/node.js +0 -70
- package/dist/cmd/proxy-rpc.d.ts +0 -7
- package/dist/cmd/proxy-rpc.js +0 -22
- package/dist/cmd/repl.d.ts +0 -17
- package/dist/cmd/repl.js +0 -111
- package/dist/cmd/sync-scripts.d.ts +0 -4
- package/dist/cmd/sync-scripts.js +0 -30
- package/dist/cmd/system-scripts.d.ts +0 -99
- package/dist/cmd/system-scripts.js +0 -301
- package/dist/cmd/transfer-all.d.ts +0 -6
- package/dist/cmd/transfer-all.js +0 -37
- package/dist/cmd/transfer.d.ts +0 -6
- package/dist/cmd/transfer.js +0 -38
- package/dist/deploy/index.d.ts +0 -18
- package/dist/deploy/index.js +0 -127
- package/dist/deploy/migration.d.ts +0 -50
- package/dist/deploy/migration.js +0 -178
- package/dist/deploy/toml.d.ts +0 -42
- package/dist/deploy/toml.js +0 -59
- package/dist/deploy/util.d.ts +0 -2
- package/dist/deploy/util.js +0 -18
- package/dist/molecule/mol.d.ts +0 -9
- package/dist/molecule/mol.js +0 -149
- package/dist/node/init-chain.d.ts +0 -1
- package/dist/node/init-chain.js +0 -40
- package/dist/node/install.d.ts +0 -11
- package/dist/node/install.js +0 -235
- package/dist/scripts/gen.d.ts +0 -5
- package/dist/scripts/gen.js +0 -78
- package/dist/scripts/private.d.ts +0 -4
- package/dist/scripts/private.js +0 -13
- package/dist/scripts/public.d.ts +0 -8
- package/dist/scripts/public.js +0 -229
- package/dist/scripts/type.d.ts +0 -51
- package/dist/scripts/type.js +0 -19
- package/dist/scripts/util.d.ts +0 -3
- package/dist/scripts/util.js +0 -93
- package/dist/sdk/ckb.d.ts +0 -37
- package/dist/sdk/ckb.js +0 -254
- package/dist/sdk/network.d.ts +0 -17
- package/dist/sdk/network.js +0 -22
- package/dist/template/offckb-config.d.ts +0 -4
- package/dist/template/offckb-config.js +0 -70
- package/dist/template/option.d.ts +0 -8
- package/dist/template/option.js +0 -29
- package/dist/tools/ckb-debugger.d.ts +0 -13
- package/dist/tools/ckb-debugger.js +0 -46
- package/dist/tools/ckb-tx-dumper.d.ts +0 -6
- package/dist/tools/ckb-tx-dumper.js +0 -20
- package/dist/tools/moleculec-es.d.ts +0 -8
- package/dist/tools/moleculec-es.js +0 -100
- package/dist/tools/moleculec-go.d.ts +0 -5
- package/dist/tools/moleculec-go.js +0 -35
- package/dist/tools/moleculec-rust.d.ts +0 -5
- package/dist/tools/moleculec-rust.js +0 -35
- package/dist/tools/rpc-proxy.d.ts +0 -7
- package/dist/tools/rpc-proxy.js +0 -90
- package/dist/type/base.d.ts +0 -11
- package/dist/type/base.js +0 -10
- package/dist/util/encoding.d.ts +0 -2
- package/dist/util/encoding.js +0 -24
- package/dist/util/fs.d.ts +0 -13
- package/dist/util/fs.js +0 -218
- package/dist/util/git.d.ts +0 -2
- package/dist/util/git.js +0 -106
- package/dist/util/link.d.ts +0 -1
- package/dist/util/link.js +0 -6
- package/dist/util/request.d.ts +0 -8
- package/dist/util/request.js +0 -61
- package/dist/util/validator.d.ts +0 -5
- package/dist/util/validator.js +0 -67
- package/npm-shrinkwrap.json +0 -4514
package/README.md
CHANGED
|
@@ -8,46 +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
|
-
-
|
|
16
|
-
|
|
17
|
-
**Migrate from v0.
|
|
18
|
-
|
|
19
|
-
There are BREAKING CHANGES between v0.
|
|
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
|
-
- [Create a dApp-only Project](#create-a-dapp-only-project)
|
|
34
|
-
- [Build and Deploy a script](#build-and-deploy-a-script)
|
|
35
|
-
- [Start the frontend project](#start-the-frontend-project)
|
|
36
|
-
- [Debug a transaction](#debug-a-transaction)
|
|
37
|
-
- [Generate Moleculec bindings](#generate-moleculec-bindings)
|
|
38
|
-
- [REPL Mode](#repl-mode)
|
|
39
|
-
- [Start the OffCKB REPL](#start-the-offckb-repl)
|
|
40
|
-
- [Build CKB transaction in REPL](#build-ckb-transaction-in-repl)
|
|
41
|
-
- [Get balance in REPL](#get-balance-in-repl)
|
|
42
|
-
- [Config Setting](#config-setting)
|
|
43
|
-
- [List All Settings](#list-all-settings)
|
|
44
|
-
- [Set CKB version](#set-ckb-version)
|
|
45
|
-
- [Set Network Proxy](#set-network-proxy)
|
|
46
|
-
- [Built-in scripts](#built-in-scripts)
|
|
47
|
-
- [Accounts](#accounts)
|
|
48
|
-
- [About CCC](#about-ccc)
|
|
49
|
-
- [FAQ](#faq)
|
|
50
|
-
- [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.
|
|
51
19
|
|
|
52
20
|
## Install
|
|
53
21
|
|
|
@@ -75,12 +43,10 @@ Options:
|
|
|
75
43
|
-h, --help display help for command
|
|
76
44
|
|
|
77
45
|
Commands:
|
|
78
|
-
create [options] [your-project-name] Create a new dApp from bare templates
|
|
79
46
|
node [options] [CKB-Version] Use the CKB to start devnet
|
|
80
|
-
|
|
47
|
+
create [options] [your-project-name] Create a new dApp from bare templates
|
|
81
48
|
clean Clean the devnet data, need to stop running the chain first
|
|
82
49
|
accounts Print account list info
|
|
83
|
-
list-hashes [CKB-Version] Use the CKB to list blockchain scripts hashes
|
|
84
50
|
inject-config Add offckb.config.ts to your frontend workspace
|
|
85
51
|
sync-scripts Sync scripts json files in your frontend workspace
|
|
86
52
|
deposit [options] [toAddress] [amountInCKB] Deposit CKB tokens to address, only devnet and testnet
|
|
@@ -92,8 +58,6 @@ Commands:
|
|
|
92
58
|
config <action> [item] [value] do a configuration action
|
|
93
59
|
debug [options] CKB Debugger for development
|
|
94
60
|
system-scripts [options] Output system scripts of the local devnet
|
|
95
|
-
mol [options] Generate CKB Moleculec binding code for development
|
|
96
|
-
repl [options] A custom Nodejs REPL environment bundle for CKB.
|
|
97
61
|
help [command] display help for command
|
|
98
62
|
```
|
|
99
63
|
|
|
@@ -122,19 +86,7 @@ offckb config set ckb-version 0.117.0
|
|
|
122
86
|
offckb node
|
|
123
87
|
```
|
|
124
88
|
|
|
125
|
-
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:
|
|
126
|
-
|
|
127
|
-
The proxy server is optional, you can use the RPC server directly if you don't need a proxy:
|
|
128
|
-
|
|
129
|
-
```sh
|
|
130
|
-
offckb node --no-proxy
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
Or start the proxy server in a standalone terminal to better monitor the logs:
|
|
134
|
-
|
|
135
|
-
```sh
|
|
136
|
-
offckb proxy-rpc --ckb-rpc http://localhost:8114 --port 9000 --network devnet
|
|
137
|
-
```
|
|
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.
|
|
138
90
|
|
|
139
91
|
### List scripts info
|
|
140
92
|
|
|
@@ -207,7 +159,7 @@ You can create a new script project without a frontend. This is useful when you
|
|
|
207
159
|
offckb create <your-project-name> --script
|
|
208
160
|
```
|
|
209
161
|
|
|
210
|
-
Note: you need to have
|
|
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.
|
|
211
163
|
|
|
212
164
|
### Create a dApp-only Project
|
|
213
165
|
|
|
@@ -318,88 +270,6 @@ offckb debug <transaction-hash> --single-script <single-cell-script-option> --bi
|
|
|
318
270
|
|
|
319
271
|
All the debug utils are borrowed from [ckb-debugger](https://github.com/nervosnetwork/ckb-standalone-debugger/tree/develop/ckb-debugger).
|
|
320
272
|
|
|
321
|
-
### Generate Moleculec bindings
|
|
322
|
-
|
|
323
|
-
[Moleculec](https://github.com/nervosnetwork/molecule) is the official Serialization/Deserialization system for CKB smart contracts.
|
|
324
|
-
|
|
325
|
-
You will define your data structure in `.mol` file(schema), and generate the bindings for different programming languages to use in your development.
|
|
326
|
-
|
|
327
|
-
```sh
|
|
328
|
-
offckb mol --schema <path/to/mol/file> --output <path/to/output/file> --lang <lang>
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
The `lang` could be `ts`, `js`, `c`, `rs` and `go`.
|
|
332
|
-
|
|
333
|
-
If you have multiple `.mol` files, you can use a folder as the input and specify an output folder:
|
|
334
|
-
|
|
335
|
-
```sh
|
|
336
|
-
offckb mol --schema <path/to/mol/folder> --output-folder <path/to/output/folder> --lang <lang>
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
## REPL Mode
|
|
340
|
-
|
|
341
|
-
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.
|
|
342
|
-
|
|
343
|
-
### Start the OffCKB REPL
|
|
344
|
-
|
|
345
|
-
```sh
|
|
346
|
-
offckb repl --network <devnet/testnet/mainnet, default: devnet>
|
|
347
|
-
|
|
348
|
-
Welcome to OffCKB REPL!
|
|
349
|
-
[[ Default Network: devnet, enableProxyRPC: false ]]
|
|
350
|
-
Type 'help()' to learn how to use.
|
|
351
|
-
OffCKB >
|
|
352
|
-
```
|
|
353
|
-
|
|
354
|
-
Type `help()` to learn about the built-in variables and functions:
|
|
355
|
-
|
|
356
|
-
```sh
|
|
357
|
-
OffCKB > help()
|
|
358
|
-
|
|
359
|
-
OffCKB Repl, a Nodejs REPL with CKB bundles.
|
|
360
|
-
|
|
361
|
-
Global Variables to use:
|
|
362
|
-
- ccc, cccA, imported from CKB Javascript SDK CCC
|
|
363
|
-
- client, a CCC client instance bundle with current network
|
|
364
|
-
- Client, a Wrap of CCC client class, you can build new client with
|
|
365
|
-
const myClient = Client.new('devnet' | 'testnet' | 'mainnet');
|
|
366
|
-
// or
|
|
367
|
-
const myClient = Client.fromUrl('<your rpc url>', 'devnet' | 'testnet' | 'mainnet');
|
|
368
|
-
- accounts, test accounts array from OffCKB
|
|
369
|
-
- networks, network information configs
|
|
370
|
-
- help, print this help message
|
|
371
|
-
```
|
|
372
|
-
|
|
373
|
-
### Build CKB transaction in REPL
|
|
374
|
-
|
|
375
|
-
```sh
|
|
376
|
-
OffCKB > let amountInCKB = ccc.fixedPointFrom(63);
|
|
377
|
-
OffCKB > let tx = ccc.Transaction.from({
|
|
378
|
-
... outputs: [
|
|
379
|
-
... {
|
|
380
|
-
... capacity: ccc.fixedPointFrom(amountInCKB),
|
|
381
|
-
... lock: accounts[0].lockScript,
|
|
382
|
-
... },
|
|
383
|
-
... ],
|
|
384
|
-
... });
|
|
385
|
-
OffCKB > let signer = new ccc.SignerCkbPrivateKey(client, accounts[0].privkey);
|
|
386
|
-
OffCKB > await tx.completeInputsByCapacity(signer);
|
|
387
|
-
2
|
|
388
|
-
OffCKB > await tx.completeFeeBy(signer, 1000);
|
|
389
|
-
[ 0, true ]
|
|
390
|
-
OffCKB > await mySigner.sendTransaction(tx)
|
|
391
|
-
'0x50fbfa8c47907d6842a325e85e48d5da6917e16ca7e2253ec3bd5bcdf8da99ce'
|
|
392
|
-
```
|
|
393
|
-
|
|
394
|
-
### Get balance in REPL
|
|
395
|
-
|
|
396
|
-
```sh
|
|
397
|
-
OffCKB > let myClient = Client.fromUrl(networks.testnet.rpc_url, 'testnet');
|
|
398
|
-
OffCKB > await myClient.getBalanceSingle(accounts[0].lockScript);
|
|
399
|
-
60838485293944n
|
|
400
|
-
OffCKB >
|
|
401
|
-
```
|
|
402
|
-
|
|
403
273
|
## Config Setting
|
|
404
274
|
|
|
405
275
|
### List All Settings
|
|
@@ -469,3 +339,4 @@ npm install -g @offckb/cli
|
|
|
469
339
|
## Contributing
|
|
470
340
|
|
|
471
341
|
check [development doc](/docs/develop.md)
|
|
342
|
+
|
|
Binary file
|