@offckb/cli 0.3.3 → 0.3.4

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 (49) hide show
  1. package/README.md +6 -0
  2. package/dist/cfg/env-path.js +1 -1
  3. package/dist/cfg/setting.js +22 -12
  4. package/dist/cli.js +17 -7
  5. package/dist/cmd/accounts.js +1 -2
  6. package/dist/cmd/balance.js +3 -4
  7. package/dist/cmd/clean.js +1 -2
  8. package/dist/cmd/config.js +2 -2
  9. package/dist/cmd/create.js +3 -4
  10. package/dist/cmd/debug.d.ts +1 -1
  11. package/dist/cmd/debug.js +8 -9
  12. package/dist/cmd/deploy.js +24 -7
  13. package/dist/cmd/deposit.js +3 -4
  14. package/dist/cmd/inject-config.js +18 -9
  15. package/dist/cmd/list-hashes.js +2 -3
  16. package/dist/cmd/mol.js +2 -3
  17. package/dist/cmd/my-scripts.js +1 -2
  18. package/dist/cmd/node.js +9 -10
  19. package/dist/cmd/proxy-rpc.js +1 -2
  20. package/dist/cmd/repl.js +5 -6
  21. package/dist/cmd/sync-scripts.js +1 -2
  22. package/dist/cmd/system-scripts.js +11 -11
  23. package/dist/cmd/transfer-all.js +3 -4
  24. package/dist/cmd/transfer.js +3 -4
  25. package/dist/deploy/index.js +6 -6
  26. package/dist/deploy/migration.js +25 -15
  27. package/dist/deploy/toml.js +2 -3
  28. package/dist/deploy/util.js +1 -2
  29. package/dist/molecule/mol.js +20 -10
  30. package/dist/node/init-chain.js +1 -2
  31. package/dist/node/install.js +26 -17
  32. package/dist/scripts/gen.js +21 -12
  33. package/dist/scripts/private.js +1 -2
  34. package/dist/scripts/util.js +18 -9
  35. package/dist/sdk/ckb.js +7 -7
  36. package/dist/template/offckb-config.js +17 -7
  37. package/dist/template/option.js +1 -2
  38. package/dist/tools/ckb-tx-dumper.js +1 -2
  39. package/dist/tools/rpc-proxy.d.ts +0 -1
  40. package/dist/tools/rpc-proxy.js +1 -2
  41. package/dist/util/encoding.js +2 -3
  42. package/dist/util/fs.d.ts +1 -0
  43. package/dist/util/fs.js +34 -20
  44. package/dist/util/git.js +19 -10
  45. package/dist/util/link.js +1 -2
  46. package/dist/util/request.js +2 -2
  47. package/dist/util/validator.js +5 -6
  48. package/npm-shrinkwrap.json +4514 -0
  49. package/package.json +6 -4
package/README.md CHANGED
@@ -54,6 +54,12 @@ There are BREAKING CHANGES between v0.2.x and v0.3.x, make sure to read the [mig
54
54
  npm install -g @offckb/cli
55
55
  ```
56
56
 
57
+ or use `pnpm` to install:
58
+
59
+ ```sh
60
+ pnpm install -g @offckb/cli
61
+ ```
62
+
57
63
  _We recommend using [LTS](https://nodejs.org/en/download/package-manager) version of Node to run `offckb`_
58
64
 
59
65
  ## Usage
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = envPaths;
6
7
  // take and adapt from https://github.com/sindresorhus/env-paths/blob/main/index.js
7
8
  const path_1 = __importDefault(require("path"));
8
9
  const os_1 = __importDefault(require("os"));
@@ -60,4 +61,3 @@ function envPaths(appName, { suffix = 'nodejs' } = {}) {
60
61
  }
61
62
  return linux(appName);
62
63
  }
63
- exports.default = envPaths;
@@ -15,18 +15,32 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
37
  };
28
38
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.getCKBBinaryPath = exports.getCKBBinaryInstallPath = exports.writeSettings = exports.readSettings = exports.defaultSettings = exports.packageRootPath = exports.packageSrcPath = exports.cachePath = exports.dataPath = exports.configPath = void 0;
39
+ exports.defaultSettings = exports.packageRootPath = exports.packageSrcPath = exports.cachePath = exports.dataPath = exports.configPath = void 0;
40
+ exports.readSettings = readSettings;
41
+ exports.writeSettings = writeSettings;
42
+ exports.getCKBBinaryInstallPath = getCKBBinaryInstallPath;
43
+ exports.getCKBBinaryPath = getCKBBinaryPath;
30
44
  const fs = __importStar(require("fs"));
31
45
  const path = __importStar(require("path"));
32
46
  const env_path_1 = __importDefault(require("./env-path"));
@@ -100,7 +114,6 @@ function readSettings() {
100
114
  return exports.defaultSettings;
101
115
  }
102
116
  }
103
- exports.readSettings = readSettings;
104
117
  function writeSettings(settings) {
105
118
  try {
106
119
  fs.mkdirSync(path.dirname(exports.configPath), { recursive: true });
@@ -111,16 +124,13 @@ function writeSettings(settings) {
111
124
  console.error('Error writing settings:', error);
112
125
  }
113
126
  }
114
- exports.writeSettings = writeSettings;
115
127
  function getCKBBinaryInstallPath(version) {
116
128
  const setting = readSettings();
117
129
  return `${setting.bins.rootFolder}/${version}`;
118
130
  }
119
- exports.getCKBBinaryInstallPath = getCKBBinaryInstallPath;
120
131
  function getCKBBinaryPath(version) {
121
132
  return `${getCKBBinaryInstallPath(version)}/ckb`;
122
133
  }
123
- exports.getCKBBinaryPath = getCKBBinaryPath;
124
134
  function deepMerge(target, source) {
125
135
  for (const key in source) {
126
136
  if (source[key] && typeof source[key] === 'object') {
package/dist/cli.js CHANGED
@@ -16,13 +16,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
16
16
  }) : function(o, v) {
17
17
  o["default"] = v;
18
18
  });
19
- var __importStar = (this && this.__importStar) || function (mod) {
20
- if (mod && mod.__esModule) return mod;
21
- var result = {};
22
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
- __setModuleDefault(result, mod);
24
- return result;
25
- };
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
26
36
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
27
37
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
28
38
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.accounts = void 0;
6
+ exports.accounts = accounts;
7
7
  const account_json_1 = __importDefault(require("../../account/account.json"));
8
8
  const chalk_1 = __importDefault(require("chalk"));
9
9
  const highlightText = (text) => {
@@ -38,4 +38,3 @@ lockScript:
38
38
  console.log(item(i, account));
39
39
  }
40
40
  }
41
- exports.accounts = accounts;
@@ -9,12 +9,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.balanceOf = void 0;
12
+ exports.balanceOf = balanceOf;
13
13
  const ckb_1 = require("../sdk/ckb");
14
14
  const validator_1 = require("../util/validator");
15
15
  const base_1 = require("../type/base");
16
- function balanceOf(address, opt = { network: base_1.Network.devnet }) {
17
- return __awaiter(this, void 0, void 0, function* () {
16
+ function balanceOf(address_1) {
17
+ return __awaiter(this, arguments, void 0, function* (address, opt = { network: base_1.Network.devnet }) {
18
18
  const network = opt.network;
19
19
  (0, validator_1.validateNetworkOpt)(network);
20
20
  const ckb = new ckb_1.CKB({ network });
@@ -23,4 +23,3 @@ function balanceOf(address, opt = { network: base_1.Network.devnet }) {
23
23
  process.exit(0);
24
24
  });
25
25
  }
26
- exports.balanceOf = balanceOf;
package/dist/cmd/clean.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.clean = void 0;
6
+ exports.clean = clean;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const fs_2 = require("../util/fs");
9
9
  const setting_1 = require("../cfg/setting");
@@ -25,4 +25,3 @@ function clean() {
25
25
  console.log(`${allDevnetDataPath} not found, unable to clean it.`);
26
26
  }
27
27
  }
28
- exports.clean = clean;
@@ -9,7 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.Config = exports.ConfigItem = exports.ConfigAction = void 0;
12
+ exports.ConfigItem = exports.ConfigAction = void 0;
13
+ exports.Config = Config;
13
14
  const setting_1 = require("../cfg/setting");
14
15
  const request_1 = require("../util/request");
15
16
  const validator_1 = require("../util/validator");
@@ -100,7 +101,6 @@ function Config(action, item, value) {
100
101
  throw new Error('invalid config action.');
101
102
  });
102
103
  }
103
- exports.Config = Config;
104
104
  function extractVersion(version) {
105
105
  // If the version starts with 'v', remove it
106
106
  return version.startsWith('v') ? version.slice(1) : version;
@@ -12,7 +12,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.selectBareTemplate = exports.create = exports.createScriptProject = void 0;
15
+ exports.createScriptProject = createScriptProject;
16
+ exports.create = create;
17
+ exports.selectBareTemplate = selectBareTemplate;
16
18
  const path_1 = __importDefault(require("path"));
17
19
  const fs_1 = require("../util/fs");
18
20
  const git_1 = require("../util/git");
@@ -32,7 +34,6 @@ function createScriptProject(name) {
32
34
  console.error('create script project failed, ', error.message);
33
35
  }
34
36
  }
35
- exports.createScriptProject = createScriptProject;
36
37
  function create(name, template) {
37
38
  return __awaiter(this, void 0, void 0, function* () {
38
39
  const targetPath = path_1.default.resolve(process.cwd(), name);
@@ -58,7 +59,6 @@ function create(name, template) {
58
59
  }
59
60
  });
60
61
  }
61
- exports.create = create;
62
62
  function selectBareTemplate() {
63
63
  return __awaiter(this, void 0, void 0, function* () {
64
64
  const opts = yield (0, option_1.loadBareTemplateOpts)();
@@ -75,4 +75,3 @@ function selectBareTemplate() {
75
75
  return opts.find((opt) => opt.value === answer);
76
76
  });
77
77
  }
78
- exports.selectBareTemplate = selectBareTemplate;
@@ -6,7 +6,7 @@ export declare function buildTransactionDebugOptions(txHash: string, network: Ne
6
6
  }[];
7
7
  export declare function debugSingleScript(txHash: string, cellIndex: number, cellType: 'input' | 'output', scriptType: 'type' | 'lock', network: Network, bin?: string): void;
8
8
  export declare function parseSingleScriptOption(value: string): {
9
- cellType: "output" | "input";
9
+ cellType: "input" | "output";
10
10
  cellIndex: number;
11
11
  scriptType: "type" | "lock";
12
12
  };
package/dist/cmd/debug.js CHANGED
@@ -3,7 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.debugRaw = exports.buildDebugFullTransactionFilePath = exports.buildTransactionJsonFilePath = exports.buildTxFileOptionBy = exports.parseSingleScriptOption = exports.debugSingleScript = exports.buildTransactionDebugOptions = exports.debugTransaction = void 0;
6
+ exports.debugTransaction = debugTransaction;
7
+ exports.buildTransactionDebugOptions = buildTransactionDebugOptions;
8
+ exports.debugSingleScript = debugSingleScript;
9
+ exports.parseSingleScriptOption = parseSingleScriptOption;
10
+ exports.buildTxFileOptionBy = buildTxFileOptionBy;
11
+ exports.buildTransactionJsonFilePath = buildTransactionJsonFilePath;
12
+ exports.buildDebugFullTransactionFilePath = buildDebugFullTransactionFilePath;
13
+ exports.debugRaw = debugRaw;
7
14
  const setting_1 = require("../cfg/setting");
8
15
  const ckb_debugger_1 = require("../tools/ckb-debugger");
9
16
  const fs_1 = __importDefault(require("fs"));
@@ -21,7 +28,6 @@ function debugTransaction(txHash, network) {
21
28
  debugRaw(`${txFile} ${opt.cmdOption}`);
22
29
  }
23
30
  }
24
- exports.debugTransaction = debugTransaction;
25
31
  function buildTransactionDebugOptions(txHash, network) {
26
32
  var _a;
27
33
  const txJsonFilePath = buildTransactionJsonFilePath(network, txHash);
@@ -50,7 +56,6 @@ function buildTransactionDebugOptions(txHash, network) {
50
56
  }
51
57
  return result;
52
58
  }
53
- exports.buildTransactionDebugOptions = buildTransactionDebugOptions;
54
59
  function debugSingleScript(txHash, cellIndex, cellType, scriptType, network, bin) {
55
60
  const txFile = buildTxFileOptionBy(txHash, network);
56
61
  let opt = `--cell-index ${cellIndex} --cell-type ${cellType} --script-group-type ${scriptType}`;
@@ -59,7 +64,6 @@ function debugSingleScript(txHash, cellIndex, cellType, scriptType, network, bin
59
64
  }
60
65
  debugRaw(`${txFile} ${opt}`);
61
66
  }
62
- exports.debugSingleScript = debugSingleScript;
63
67
  // Helper function to validate and parse the --script value
64
68
  function parseSingleScriptOption(value) {
65
69
  const regex = /^(input|output)\[(\d+)\]\.(lock|type)$/i;
@@ -74,7 +78,6 @@ function parseSingleScriptOption(value) {
74
78
  scriptType: scriptType.toLowerCase(), // lock or type
75
79
  };
76
80
  }
77
- exports.parseSingleScriptOption = parseSingleScriptOption;
78
81
  function buildTxFileOptionBy(txHash, network) {
79
82
  const settings = (0, setting_1.readSettings)();
80
83
  const outputFilePath = buildDebugFullTransactionFilePath(network, txHash);
@@ -89,7 +92,6 @@ function buildTxFileOptionBy(txHash, network) {
89
92
  const opt = `--tx-file ${(0, encoding_1.encodeBinPathForTerminal)(outputFilePath)}`;
90
93
  return opt;
91
94
  }
92
- exports.buildTxFileOptionBy = buildTxFileOptionBy;
93
95
  function buildTransactionJsonFilePath(network, txHash) {
94
96
  const settings = (0, setting_1.readSettings)();
95
97
  if (network === base_1.Network.devnet) {
@@ -100,7 +102,6 @@ function buildTransactionJsonFilePath(network, txHash) {
100
102
  }
101
103
  return `${settings.mainnet.transactionsPath}/${txHash}.json`;
102
104
  }
103
- exports.buildTransactionJsonFilePath = buildTransactionJsonFilePath;
104
105
  function buildDebugFullTransactionFilePath(network, txHash) {
105
106
  const settings = (0, setting_1.readSettings)();
106
107
  if (network === base_1.Network.devnet) {
@@ -111,11 +112,9 @@ function buildDebugFullTransactionFilePath(network, txHash) {
111
112
  }
112
113
  return `${settings.mainnet.debugFullTransactionsPath}/${txHash}.json`;
113
114
  }
114
- exports.buildDebugFullTransactionFilePath = buildDebugFullTransactionFilePath;
115
115
  function debugRaw(options) {
116
116
  if (!ckb_debugger_1.CKBDebugger.isBinaryInstalled()) {
117
117
  ckb_debugger_1.CKBDebugger.installCKBDebugger();
118
118
  }
119
119
  return ckb_debugger_1.CKBDebugger.runRaw(options);
120
120
  }
121
- exports.debugRaw = debugRaw;
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.deploy = void 0;
15
+ exports.deploy = deploy;
16
16
  const base_1 = require("../type/base");
17
17
  const path_1 = __importDefault(require("path"));
18
18
  const account_1 = require("../cfg/account");
@@ -21,9 +21,9 @@ const validator_1 = require("../util/validator");
21
21
  const deploy_1 = require("../deploy");
22
22
  const ckb_1 = require("../sdk/ckb");
23
23
  const fs_2 = __importDefault(require("fs"));
24
- function deploy(opt = { network: base_1.Network.devnet, typeId: false, target: undefined, proxyRpc: false }) {
25
- var _a;
26
- return __awaiter(this, void 0, void 0, function* () {
24
+ function deploy() {
25
+ return __awaiter(this, arguments, void 0, function* (opt = { network: base_1.Network.devnet, typeId: false, target: undefined, proxyRpc: false }) {
26
+ var _a;
27
27
  const network = opt.network;
28
28
  (0, validator_1.validateNetworkOpt)(network);
29
29
  const isEnableProxyRpc = opt.proxyRpc;
@@ -35,7 +35,16 @@ function deploy(opt = { network: base_1.Network.devnet, typeId: false, target: u
35
35
  const targetFolder = opt.target;
36
36
  if (targetFolder) {
37
37
  const binFilesOrFolder = (0, fs_1.isAbsolutePath)(targetFolder) ? targetFolder : path_1.default.resolve(process.cwd(), targetFolder);
38
- const binPaths = (0, fs_1.getBinaryFilesFromPath)(binFilesOrFolder);
38
+ let binPaths = (0, fs_1.getBinaryFilesFromPath)(binFilesOrFolder);
39
+ // ignore the binary file which is too large(> 500kb) to upload on chain
40
+ binPaths = binPaths.filter((binPath) => {
41
+ const size = (0, fs_1.getBinaryFileSizeInBytes)(binPath);
42
+ if (size > 500 * 1024) {
43
+ console.warn(`[warning]: ignore deploying the binary file ${binPath} since its size is too large: ${size} bytes`);
44
+ return false;
45
+ }
46
+ return true;
47
+ });
39
48
  const results = yield (0, deploy_1.deployBinaries)(binPaths, privateKey, enableTypeId, ckb);
40
49
  // record the deployed contract infos
41
50
  (0, deploy_1.recordDeployResult)(results, network); // we don't update my-scripts.json since we don't know where the file is
@@ -50,10 +59,18 @@ function deploy(opt = { network: base_1.Network.devnet, typeId: false, target: u
50
59
  if (!fs_2.default.existsSync(userOffCKBConfigPath)) {
51
60
  throw new Error(`config file not exits: ${userOffCKBConfigPath}, tips: use --config to specific the offckb.config.ts file`);
52
61
  }
53
- const bins = (0, deploy_1.getToDeployBinsPath)(userOffCKBConfigPath);
62
+ let bins = (0, deploy_1.getToDeployBinsPath)(userOffCKBConfigPath);
63
+ // ignore the binary file which is too large(> 500kb) to upload on chain
64
+ bins = bins.filter((binPath) => {
65
+ const size = (0, fs_1.getBinaryFileSizeInBytes)(binPath);
66
+ if (size > 500 * 1024) {
67
+ console.warn(`[warning]: ignore deploying the binary file ${binPath} since its size is too large: ${size} bytes`);
68
+ return false;
69
+ }
70
+ return true;
71
+ });
54
72
  const results = yield (0, deploy_1.deployBinaries)(bins, privateKey, enableTypeId, ckb);
55
73
  // record the deployed contract infos
56
74
  (0, deploy_1.recordDeployResult)(results, network, userOffCKBConfigPath);
57
75
  });
58
76
  }
59
- exports.deploy = deploy;
@@ -9,15 +9,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.deposit = void 0;
12
+ exports.deposit = deposit;
13
13
  const ckb_1 = require("../sdk/ckb");
14
14
  const account_1 = require("../cfg/account");
15
15
  const base_1 = require("../type/base");
16
16
  const link_1 = require("../util/link");
17
17
  const validator_1 = require("../util/validator");
18
18
  const request_1 = require("../util/request");
19
- function deposit(toAddress, amountInCKB, opt = { network: base_1.Network.devnet, proxyRpc: false }) {
20
- return __awaiter(this, void 0, void 0, function* () {
19
+ function deposit(toAddress_1, amountInCKB_1) {
20
+ return __awaiter(this, arguments, void 0, function* (toAddress, amountInCKB, opt = { network: base_1.Network.devnet, proxyRpc: false }) {
21
21
  const network = opt.network;
22
22
  (0, validator_1.validateNetworkOpt)(network);
23
23
  const isEnableProxyRpc = opt.proxyRpc;
@@ -35,7 +35,6 @@ function deposit(toAddress, amountInCKB, opt = { network: base_1.Network.devnet,
35
35
  console.log('tx hash: ', txHash);
36
36
  });
37
37
  }
38
- exports.deposit = deposit;
39
38
  function depositFromTestnetFaucet(ckbAddress, ckb) {
40
39
  return __awaiter(this, void 0, void 0, function* () {
41
40
  console.log('testnet faucet only supports fixed-amount claim: 10,000 CKB');
@@ -15,15 +15,25 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.injectConfig = void 0;
36
+ exports.injectConfig = injectConfig;
27
37
  const fs_1 = require("fs");
28
38
  const path_1 = __importStar(require("path"));
29
39
  const gen_1 = require("../scripts/gen");
@@ -60,4 +70,3 @@ function injectConfig({ target }) {
60
70
  Check example at https://github.com/nervosnetwork/docs.nervos.org/tree/develop/examples/simple-transfer
61
71
  `);
62
72
  }
63
- exports.injectConfig = injectConfig;
@@ -9,7 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getDevnetListHashes = exports.printDevnetListHashes = void 0;
12
+ exports.printDevnetListHashes = printDevnetListHashes;
13
+ exports.getDevnetListHashes = getDevnetListHashes;
13
14
  const child_process_1 = require("child_process");
14
15
  const setting_1 = require("../cfg/setting");
15
16
  const encoding_1 = require("../util/encoding");
@@ -19,7 +20,6 @@ function printDevnetListHashes(version) {
19
20
  console.log(output);
20
21
  });
21
22
  }
22
- exports.printDevnetListHashes = printDevnetListHashes;
23
23
  function getDevnetListHashes(version) {
24
24
  const settings = (0, setting_1.readSettings)();
25
25
  const ckbVersion = version || settings.bins.defaultCKBVersion;
@@ -37,4 +37,3 @@ function getDevnetListHashes(version) {
37
37
  return null;
38
38
  }
39
39
  }
40
- exports.getDevnetListHashes = getDevnetListHashes;
package/dist/cmd/mol.js CHANGED
@@ -12,7 +12,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.molFiles = exports.molSingleFile = void 0;
15
+ exports.molSingleFile = molSingleFile;
16
+ exports.molFiles = molFiles;
16
17
  const mol_1 = require("../molecule/mol");
17
18
  const fs_1 = __importDefault(require("fs"));
18
19
  const path_1 = __importDefault(require("path"));
@@ -21,7 +22,6 @@ function molSingleFile(schemeFilePath, outputFilePath, bindingLang) {
21
22
  yield (0, mol_1.generateMolBindings)(schemeFilePath, outputFilePath, bindingLang);
22
23
  });
23
24
  }
24
- exports.molSingleFile = molSingleFile;
25
25
  function molFiles(schemaFolderPath, outputFolderPath, bindingLang) {
26
26
  return __awaiter(this, void 0, void 0, function* () {
27
27
  const files = fs_1.default.readdirSync(schemaFolderPath).filter((file) => file.endsWith('.mol'));
@@ -36,4 +36,3 @@ function molFiles(schemaFolderPath, outputFolderPath, bindingLang) {
36
36
  }
37
37
  });
38
38
  }
39
- exports.molFiles = molFiles;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.printMyScripts = void 0;
3
+ exports.printMyScripts = printMyScripts;
4
4
  const toml_1 = require("../deploy/toml");
5
5
  const util_1 = require("../deploy/util");
6
6
  const util_2 = require("../scripts/util");
@@ -22,4 +22,3 @@ function printMyScripts(option = { network: base_1.Network.devnet }) {
22
22
  console.log(`\n`);
23
23
  });
24
24
  }
25
- exports.printMyScripts = printMyScripts;
package/dist/cmd/node.js CHANGED
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.node = void 0;
12
+ exports.node = node;
13
13
  const child_process_1 = require("child_process");
14
14
  const init_chain_1 = require("../node/init-chain");
15
15
  const install_1 = require("../node/install");
@@ -17,9 +17,9 @@ const setting_1 = require("../cfg/setting");
17
17
  const encoding_1 = require("../util/encoding");
18
18
  const rpc_proxy_1 = require("../tools/rpc-proxy");
19
19
  const base_1 = require("../type/base");
20
- function node({ version, noProxyServer }) {
21
- var _a, _b;
22
- return __awaiter(this, void 0, void 0, function* () {
20
+ function node(_a) {
21
+ return __awaiter(this, arguments, void 0, function* ({ version, noProxyServer }) {
22
+ var _b, _c;
23
23
  const settings = (0, setting_1.readSettings)();
24
24
  const ckbVersion = version || settings.bins.defaultCKBVersion;
25
25
  yield (0, install_1.installCKBBinary)(ckbVersion);
@@ -32,22 +32,22 @@ function node({ version, noProxyServer }) {
32
32
  // Run first command
33
33
  const ckbProcess = (0, child_process_1.exec)(ckbCmd);
34
34
  // Log first command's output
35
- (_a = ckbProcess.stdout) === null || _a === void 0 ? void 0 : _a.on('data', (data) => {
35
+ (_b = ckbProcess.stdout) === null || _b === void 0 ? void 0 : _b.on('data', (data) => {
36
36
  console.log('CKB:', data.toString());
37
37
  });
38
- (_b = ckbProcess.stderr) === null || _b === void 0 ? void 0 : _b.on('data', (data) => {
38
+ (_c = ckbProcess.stderr) === null || _c === void 0 ? void 0 : _c.on('data', (data) => {
39
39
  console.error('CKB error:', data.toString());
40
40
  });
41
41
  // Start the second command after 3 seconds
42
42
  setTimeout(() => __awaiter(this, void 0, void 0, function* () {
43
- var _c, _d;
43
+ var _a, _b;
44
44
  try {
45
45
  // Run second command
46
46
  const minerProcess = (0, child_process_1.exec)(minerCmd);
47
- (_c = minerProcess.stdout) === null || _c === void 0 ? void 0 : _c.on('data', (data) => {
47
+ (_a = minerProcess.stdout) === null || _a === void 0 ? void 0 : _a.on('data', (data) => {
48
48
  console.log('CKB-Miner:', data.toString());
49
49
  });
50
- (_d = minerProcess.stderr) === null || _d === void 0 ? void 0 : _d.on('data', (data) => {
50
+ (_b = minerProcess.stderr) === null || _b === void 0 ? void 0 : _b.on('data', (data) => {
51
51
  console.error('CKB-Miner error:', data.toString());
52
52
  });
53
53
  console.log('noProxyServer: ', noProxyServer);
@@ -68,4 +68,3 @@ function node({ version, noProxyServer }) {
68
68
  }
69
69
  });
70
70
  }
71
- exports.node = node;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.proxyRpc = void 0;
3
+ exports.proxyRpc = proxyRpc;
4
4
  const setting_1 = require("../cfg/setting");
5
5
  const rpc_proxy_1 = require("../tools/rpc-proxy");
6
6
  const base_1 = require("../type/base");
@@ -20,4 +20,3 @@ function proxyRpc(options) {
20
20
  const proxy = (0, rpc_proxy_1.createRPCProxy)(network, ckbRpc, port);
21
21
  proxy.start();
22
22
  }
23
- exports.proxyRpc = proxyRpc;
package/dist/cmd/repl.js CHANGED
@@ -3,7 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.buildMyScripts = exports.buildSystemScripts = exports.printHelpText = exports.initGlobalClientBuilder = exports.repl = void 0;
6
+ exports.repl = repl;
7
+ exports.initGlobalClientBuilder = initGlobalClientBuilder;
8
+ exports.printHelpText = printHelpText;
9
+ exports.buildSystemScripts = buildSystemScripts;
10
+ exports.buildMyScripts = buildMyScripts;
7
11
  const repl_1 = require("repl");
8
12
  const core_1 = require("@ckb-ccc/core");
9
13
  const advanced_1 = require("@ckb-ccc/core/advanced");
@@ -34,7 +38,6 @@ function repl({ network = base_1.Network.devnet, proxyRpc = false }) {
34
38
  context.systemScripts = buildSystemScripts().new(network);
35
39
  context.help = printHelpText;
36
40
  }
37
- exports.repl = repl;
38
41
  function initGlobalClientBuilder(proxyRpc) {
39
42
  return {
40
43
  new: (network) => {
@@ -69,7 +72,6 @@ function initGlobalClientBuilder(proxyRpc) {
69
72
  },
70
73
  };
71
74
  }
72
- exports.initGlobalClientBuilder = initGlobalClientBuilder;
73
75
  function printHelpText() {
74
76
  return console.log(`
75
77
  OffCKB Repl, a Nodejs REPL with CKB bundles.
@@ -88,7 +90,6 @@ Global Variables to use:
88
90
  - help, print this help message
89
91
  `);
90
92
  }
91
- exports.printHelpText = printHelpText;
92
93
  function buildSystemScripts() {
93
94
  return {
94
95
  new: (network) => {
@@ -101,7 +102,6 @@ function buildSystemScripts() {
101
102
  },
102
103
  };
103
104
  }
104
- exports.buildSystemScripts = buildSystemScripts;
105
105
  function buildMyScripts() {
106
106
  return {
107
107
  new: (network) => {
@@ -109,4 +109,3 @@ function buildMyScripts() {
109
109
  },
110
110
  };
111
111
  }
112
- exports.buildMyScripts = buildMyScripts;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.syncScripts = void 0;
6
+ exports.syncScripts = syncScripts;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const gen_1 = require("../scripts/gen");
9
9
  const offckb_config_1 = require("../template/offckb-config");
@@ -28,4 +28,3 @@ function syncScripts({ configPath }) {
28
28
  (0, gen_1.genMyScriptsJsonFile)(myScriptsJsonFilePath);
29
29
  console.log('scripts json config updated.');
30
30
  }
31
- exports.syncScripts = syncScripts;