@offckb/cli 0.3.0-canary-1bb6394.0 → 0.3.0-canary-d3f7610.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 CHANGED
@@ -58,28 +58,29 @@ Usage: offckb [options] [command]
58
58
  ckb development network for your first try
59
59
 
60
60
  Options:
61
- -V, --version output the version number
62
- -h, --help display help for command
61
+ -V, --version output the version number
62
+ -h, --help display help for command
63
63
 
64
64
  Commands:
65
- create [options] [your-project-name] Create a new dApp from bare templates
66
- node [options] [CKB-Version] Use the CKB to start devnet
67
- proxy-rpc [options] Start the rpc proxy server
68
- clean Clean the devnet data, need to stop running the chain first
69
- accounts Print account list info
70
- list-hashes [CKB-Version] Use the CKB to list blockchain scripts hashes
71
- inject-config Add offckb.config.ts to your frontend workspace
72
- sync-scripts Sync scripts json file in your frontend workspace
73
- deposit [options] [toAddress] [amountInShannon] Deposit CKB tokens to address, only devnet and testnet
74
- transfer [options] [toAddress] [amountInShannon] Transfer CKB tokens to address, only devnet and testnet
75
- balance [options] [toAddress] Check account balance, only devnet and testnet
76
- deploy [options] Deploy contracts to different networks, only supports devnet and testnet
77
- my-scripts [options] Show deployed contracts info on different networks, only supports devnet and testnet
78
- config <action> [item] [value] do a configuration action
79
- debug [options] CKB Debugger for development
80
- system-scripts [options] Output system scripts of the local devnet
81
- mol [options] Generate CKB Moleculec binding code for development
82
- help [command] display help for command
65
+ create [options] [your-project-name] Create a new dApp from bare templates
66
+ node [options] [CKB-Version] Use the CKB to start devnet
67
+ proxy-rpc [options] Start the rpc proxy server
68
+ clean Clean the devnet data, need to stop running the chain first
69
+ accounts Print account list info
70
+ list-hashes [CKB-Version] Use the CKB to list blockchain scripts hashes
71
+ inject-config Add offckb.config.ts to your frontend workspace
72
+ sync-scripts Sync scripts json files in your frontend workspace
73
+ deposit [options] [toAddress] [amountInCKB] Deposit CKB tokens to address, only devnet and testnet
74
+ transfer [options] [toAddress] [amountInCKB] Transfer CKB tokens to address, only devnet and testnet
75
+ transfer-all [options] [toAddress] Transfer All CKB tokens to address, only devnet and testnet
76
+ balance [options] [toAddress] Check account balance, only devnet and testnet
77
+ deploy [options] Deploy contracts to different networks, only supports devnet and testnet
78
+ my-scripts [options] Show deployed contracts info on different networks, only supports devnet and testnet
79
+ config <action> [item] [value] do a configuration action
80
+ debug [options] CKB Debugger for development
81
+ system-scripts [options] Output system scripts of the local devnet
82
+ mol [options] Generate CKB Moleculec binding code for development
83
+ help [command] display help for command
83
84
  ```
84
85
 
85
86
  _Use `offckb [command] -h` to learn more about a specific command._
package/dist/cli.js CHANGED
@@ -53,6 +53,7 @@ const system_scripts_1 = require("./cmd/system-scripts");
53
53
  const proxy_rpc_1 = require("./cmd/proxy-rpc");
54
54
  const mol_1 = require("./cmd/mol");
55
55
  const fs = __importStar(require("fs"));
56
+ const transfer_all_1 = require("./cmd/transfer-all");
56
57
  const version = require('../package.json').version;
57
58
  const description = require('../package.json').description;
58
59
  // fix windows terminal encoding of simplified chinese text
@@ -111,6 +112,14 @@ program
111
112
  .action((toAddress, amountInCKB, options) => __awaiter(void 0, void 0, void 0, function* () {
112
113
  return (0, transfer_1.transfer)(toAddress, amountInCKB, options);
113
114
  }));
115
+ program
116
+ .command('transfer-all [toAddress]')
117
+ .description('Transfer All CKB tokens to address, only devnet and testnet')
118
+ .option('--network <network>', 'Specify the network to transfer to', 'devnet')
119
+ .option('--privkey <privkey>', 'Specify the private key to deploy scripts')
120
+ .action((toAddress, options) => __awaiter(void 0, void 0, void 0, function* () {
121
+ return (0, transfer_all_1.transferAll)(toAddress, options);
122
+ }));
114
123
  program
115
124
  .command('balance [toAddress]')
116
125
  .description('Check account balance, only devnet and testnet')
@@ -0,0 +1,5 @@
1
+ import { NetworkOption } from '../util/type';
2
+ export interface TransferAllOptions extends NetworkOption {
3
+ privkey?: string | null;
4
+ }
5
+ export declare function transferAll(toAddress: string, opt?: TransferAllOptions): Promise<void>;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.transferAll = void 0;
13
+ const ckb_1 = require("../sdk/ckb");
14
+ const type_1 = require("../util/type");
15
+ const link_1 = require("../util/link");
16
+ const validator_1 = require("../util/validator");
17
+ function transferAll(toAddress, opt = { network: type_1.Network.devnet }) {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ const network = opt.network;
20
+ (0, validator_1.validateNetworkOpt)(network);
21
+ if (opt.privkey == null) {
22
+ throw new Error('--privkey is required!');
23
+ }
24
+ const privateKey = opt.privkey;
25
+ const ckb = new ckb_1.CKB({ network });
26
+ const txHash = yield ckb.transferAll({
27
+ toAddress,
28
+ privateKey,
29
+ });
30
+ if (network === 'testnet') {
31
+ console.log(`Successfully transfer, check ${(0, link_1.buildTestnetTxLink)(txHash)} for details.`);
32
+ return;
33
+ }
34
+ console.log('Successfully transfer, txHash:', txHash);
35
+ });
36
+ }
37
+ exports.transferAll = transferAll;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@offckb/cli",
3
- "version": "0.3.0-canary-1bb6394.0",
3
+ "version": "0.3.0-canary-d3f7610.0",
4
4
  "description": "ckb development network for your first try",
5
5
  "author": "CKB EcoFund",
6
6
  "license": "MIT",