@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.
Files changed (109) hide show
  1. package/README.md +10 -139
  2. package/build/build/Release/secp256k1.node +0 -0
  3. package/build/index.js +114965 -0
  4. package/package.json +12 -6
  5. package/dist/cfg/account.d.ts +0 -55
  6. package/dist/cfg/account.js +0 -66
  7. package/dist/cfg/env-path.d.ts +0 -9
  8. package/dist/cfg/env-path.js +0 -63
  9. package/dist/cfg/setting.d.ts +0 -70
  10. package/dist/cfg/setting.js +0 -150
  11. package/dist/cli.d.ts +0 -2
  12. package/dist/cli.js +0 -228
  13. package/dist/cmd/accounts.d.ts +0 -1
  14. package/dist/cmd/accounts.js +0 -40
  15. package/dist/cmd/balance.d.ts +0 -4
  16. package/dist/cmd/balance.js +0 -25
  17. package/dist/cmd/clean.d.ts +0 -1
  18. package/dist/cmd/clean.js +0 -27
  19. package/dist/cmd/config.d.ts +0 -11
  20. package/dist/cmd/config.js +0 -107
  21. package/dist/cmd/create.d.ts +0 -15
  22. package/dist/cmd/create.js +0 -104
  23. package/dist/cmd/debug.d.ts +0 -16
  24. package/dist/cmd/debug.js +0 -120
  25. package/dist/cmd/deploy.d.ts +0 -9
  26. package/dist/cmd/deploy.js +0 -76
  27. package/dist/cmd/deposit.d.ts +0 -5
  28. package/dist/cmd/deposit.js +0 -97
  29. package/dist/cmd/inject-config.d.ts +0 -4
  30. package/dist/cmd/inject-config.js +0 -73
  31. package/dist/cmd/list-hashes.d.ts +0 -25
  32. package/dist/cmd/list-hashes.js +0 -39
  33. package/dist/cmd/mol.d.ts +0 -2
  34. package/dist/cmd/mol.js +0 -38
  35. package/dist/cmd/my-scripts.d.ts +0 -4
  36. package/dist/cmd/my-scripts.js +0 -24
  37. package/dist/cmd/node.d.ts +0 -5
  38. package/dist/cmd/node.js +0 -70
  39. package/dist/cmd/proxy-rpc.d.ts +0 -7
  40. package/dist/cmd/proxy-rpc.js +0 -22
  41. package/dist/cmd/repl.d.ts +0 -17
  42. package/dist/cmd/repl.js +0 -111
  43. package/dist/cmd/sync-scripts.d.ts +0 -4
  44. package/dist/cmd/sync-scripts.js +0 -30
  45. package/dist/cmd/system-scripts.d.ts +0 -99
  46. package/dist/cmd/system-scripts.js +0 -301
  47. package/dist/cmd/transfer-all.d.ts +0 -6
  48. package/dist/cmd/transfer-all.js +0 -37
  49. package/dist/cmd/transfer.d.ts +0 -6
  50. package/dist/cmd/transfer.js +0 -38
  51. package/dist/deploy/index.d.ts +0 -18
  52. package/dist/deploy/index.js +0 -127
  53. package/dist/deploy/migration.d.ts +0 -50
  54. package/dist/deploy/migration.js +0 -178
  55. package/dist/deploy/toml.d.ts +0 -42
  56. package/dist/deploy/toml.js +0 -59
  57. package/dist/deploy/util.d.ts +0 -2
  58. package/dist/deploy/util.js +0 -18
  59. package/dist/molecule/mol.d.ts +0 -9
  60. package/dist/molecule/mol.js +0 -149
  61. package/dist/node/init-chain.d.ts +0 -1
  62. package/dist/node/init-chain.js +0 -40
  63. package/dist/node/install.d.ts +0 -11
  64. package/dist/node/install.js +0 -235
  65. package/dist/scripts/gen.d.ts +0 -5
  66. package/dist/scripts/gen.js +0 -78
  67. package/dist/scripts/private.d.ts +0 -4
  68. package/dist/scripts/private.js +0 -13
  69. package/dist/scripts/public.d.ts +0 -8
  70. package/dist/scripts/public.js +0 -229
  71. package/dist/scripts/type.d.ts +0 -51
  72. package/dist/scripts/type.js +0 -19
  73. package/dist/scripts/util.d.ts +0 -3
  74. package/dist/scripts/util.js +0 -93
  75. package/dist/sdk/ckb.d.ts +0 -37
  76. package/dist/sdk/ckb.js +0 -254
  77. package/dist/sdk/network.d.ts +0 -17
  78. package/dist/sdk/network.js +0 -22
  79. package/dist/template/offckb-config.d.ts +0 -4
  80. package/dist/template/offckb-config.js +0 -70
  81. package/dist/template/option.d.ts +0 -8
  82. package/dist/template/option.js +0 -29
  83. package/dist/tools/ckb-debugger.d.ts +0 -13
  84. package/dist/tools/ckb-debugger.js +0 -46
  85. package/dist/tools/ckb-tx-dumper.d.ts +0 -6
  86. package/dist/tools/ckb-tx-dumper.js +0 -20
  87. package/dist/tools/moleculec-es.d.ts +0 -8
  88. package/dist/tools/moleculec-es.js +0 -100
  89. package/dist/tools/moleculec-go.d.ts +0 -5
  90. package/dist/tools/moleculec-go.js +0 -35
  91. package/dist/tools/moleculec-rust.d.ts +0 -5
  92. package/dist/tools/moleculec-rust.js +0 -35
  93. package/dist/tools/rpc-proxy.d.ts +0 -7
  94. package/dist/tools/rpc-proxy.js +0 -90
  95. package/dist/type/base.d.ts +0 -11
  96. package/dist/type/base.js +0 -10
  97. package/dist/util/encoding.d.ts +0 -2
  98. package/dist/util/encoding.js +0 -24
  99. package/dist/util/fs.d.ts +0 -13
  100. package/dist/util/fs.js +0 -218
  101. package/dist/util/git.d.ts +0 -2
  102. package/dist/util/git.js +0 -106
  103. package/dist/util/link.d.ts +0 -1
  104. package/dist/util/link.js +0 -6
  105. package/dist/util/request.d.ts +0 -8
  106. package/dist/util/request.js +0 -61
  107. package/dist/util/validator.d.ts +0 -5
  108. package/dist/util/validator.js +0 -67
  109. package/npm-shrinkwrap.json +0 -4514
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@offckb/cli",
3
- "version": "0.3.5",
3
+ "version": "0.4.0-canary-0b6fdc0.0",
4
4
  "description": "ckb development network for your first try",
5
5
  "author": "CKB EcoFund",
6
6
  "license": "MIT",
@@ -8,23 +8,28 @@
8
8
  "type": "git",
9
9
  "url": "git+https://github.com/ckb-devrel/offckb.git"
10
10
  },
11
- "main": "dist/cli.js",
11
+ "main": "build/index.js",
12
12
  "bin": {
13
- "offckb": "dist/cli.js"
13
+ "offckb": "build/index.js"
14
14
  },
15
15
  "files": [
16
- "dist",
16
+ "build",
17
17
  "account",
18
18
  "ckb",
19
- "npm-shrinkwrap.json",
20
19
  "templates/v3/offckb.config.example.ts"
21
20
  ],
22
21
  "private": false,
23
22
  "publishConfig": {
24
23
  "access": "public"
25
24
  },
25
+ "pnpm": {
26
+ "onlyBuiltDependencies": [
27
+ "cpu-features",
28
+ "secp256k1"
29
+ ]
30
+ },
26
31
  "scripts": {
27
- "build": "tsc",
32
+ "build": "tsc && ncc build dist/cli.js -o build --external cpu-features",
28
33
  "start": "ts-node-dev --transpile-only src/cli.ts",
29
34
  "clean": "rm -rf ./target",
30
35
  "lint": "eslint \"src/**/*.ts\" --ignore-pattern 'node_modules/'",
@@ -54,6 +59,7 @@
54
59
  "@types/tar": "^6.1.11",
55
60
  "@typescript-eslint/eslint-plugin": "^7.0.2",
56
61
  "@typescript-eslint/parser": "^7.0.2",
62
+ "@vercel/ncc": "^0.38.3",
57
63
  "eslint": "^8.57.0",
58
64
  "husky": "^9.0.11",
59
65
  "lint-staged": "^15.2.2",
@@ -1,55 +0,0 @@
1
- export declare const ckbDevnetMinerAccount: {
2
- privkey: string;
3
- pubkey: string;
4
- lockScript: {
5
- codeHash: string;
6
- hashType: string;
7
- args: string;
8
- };
9
- address: string;
10
- args: string;
11
- };
12
- export declare const AliceAccount: {
13
- privkey: string;
14
- pubkey: string;
15
- lockScript: {
16
- codeHash: string;
17
- hashType: string;
18
- args: string;
19
- };
20
- address: string;
21
- args: string;
22
- };
23
- export declare const BobAccount: {
24
- privkey: string;
25
- pubkey: string;
26
- lockScript: {
27
- codeHash: string;
28
- hashType: string;
29
- args: string;
30
- };
31
- address: string;
32
- args: string;
33
- };
34
- export declare const CarolAccount: {
35
- privkey: string;
36
- pubkey: string;
37
- lockScript: {
38
- codeHash: string;
39
- hashType: string;
40
- args: string;
41
- };
42
- address: string;
43
- args: string;
44
- };
45
- export declare const deployerAccount: {
46
- privkey: string;
47
- pubkey: string;
48
- lockScript: {
49
- codeHash: string;
50
- hashType: string;
51
- args: string;
52
- };
53
- address: string;
54
- args: string;
55
- };
@@ -1,66 +0,0 @@
1
- "use strict";
2
- //!note: do not use any accounts from OffCKB for real money!
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.deployerAccount = exports.CarolAccount = exports.BobAccount = exports.AliceAccount = exports.ckbDevnetMinerAccount = void 0;
5
- // ckb devnet miner and faucet from accounts/ckb-miner-and-faucet.key
6
- exports.ckbDevnetMinerAccount = {
7
- privkey: '0x650e256211f5e0beee9084596aa2cb84d11eb033cced5e2d5b191593a9f9f1d4',
8
- pubkey: '0x0201e68f3db9f4883861a69bc42484378e6d70a0de385e6420448e2c5e7e53d49d',
9
- lockScript: {
10
- codeHash: '0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8',
11
- hashType: 'type',
12
- args: '0xa1db2eef3f29f3ef6f86c8d2a0772c705c449f4a',
13
- },
14
- address: 'ckb1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqdpmvhw70ef70hklpkg62s8wtrst3zf7jshsjzqx',
15
- args: '0xa1db2eef3f29f3ef6f86c8d2a0772c705c449f4a',
16
- };
17
- // we should keep alice, bob and carol with some testnet balance.
18
- // first account from account/account.json
19
- exports.AliceAccount = {
20
- privkey: '0x6109170b275a09ad54877b82f7d9930f88cab5717d484fb4741ae9d1dd078cd6',
21
- pubkey: '0x02025fa7b61b2365aa459807b84df065f1949d58c0ae590ff22dd2595157bffefa',
22
- lockScript: {
23
- codeHash: '0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8',
24
- hashType: 'type',
25
- args: '0x8e42b1999f265a0078503c4acec4d5e134534297',
26
- },
27
- address: 'ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqvwg2cen8extgq8s5puft8vf40px3f599cytcyd8',
28
- args: '0x8e42b1999f265a0078503c4acec4d5e134534297',
29
- };
30
- // second account from account/account.json
31
- exports.BobAccount = {
32
- privkey: '0x9f315d5a9618a39fdc487c7a67a8581d40b045bd7a42d83648ca80ef3b2cb4a1',
33
- pubkey: '0x026efa0579f09cc7c1129b78544f70098c90b2ab155c10746316f945829c034a2d',
34
- lockScript: {
35
- codeHash: '0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8',
36
- hashType: 'type',
37
- args: '0x758d311c8483e0602dfad7b69d9053e3f917457d',
38
- },
39
- address: 'ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqt435c3epyrupszm7khk6weq5lrlyt52lg48ucew',
40
- args: '0x758d311c8483e0602dfad7b69d9053e3f917457d',
41
- };
42
- // third account from account/account.json
43
- exports.CarolAccount = {
44
- privkey: '0x59ddda57ba06d6e9c5fa9040bdb98b4b098c2fce6520d39f51bc5e825364697a',
45
- pubkey: '0x02f1ec8d18e8ff13ecf7b3ab8f683d0c3a6d63478a7f7d14ca0fdfe8fea331e863',
46
- lockScript: {
47
- codeHash: '0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8',
48
- hashType: 'type',
49
- args: '0x9d1edebedf8f026c0d597c4c5cd3f45dec1f7557',
50
- },
51
- address: 'ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqvarm0tahu0qfkq6ktuf3wd8azaas0h24c9myfz6',
52
- args: '0x9d1edebedf8f026c0d597c4c5cd3f45dec1f7557',
53
- };
54
- // we should keep deployerAccount with some testnet balance.
55
- // last account from account/account.json
56
- exports.deployerAccount = {
57
- privkey: '0xace08599f3174f4376ae51fdc30950d4f2d731440382bb0aa1b6b0bd3a9728cd',
58
- pubkey: '0x0216bc7b5b0a30fb910c372062a7f8cfa89f3a231f5d4a975e60a787ea828aa49e',
59
- lockScript: {
60
- codeHash: '0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8',
61
- hashType: 'type',
62
- args: '0x4118c8c16749bf126b22468d030bf9de7da3717b',
63
- },
64
- address: 'ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsq2prryvze6fhufxkgjx35psh7w70k3hz7c3mtl4d',
65
- args: '0x4118c8c16749bf126b22468d030bf9de7da3717b',
66
- };
@@ -1,9 +0,0 @@
1
- export default function envPaths(appName: string, { suffix }?: {
2
- suffix?: string | undefined;
3
- }): {
4
- data: string;
5
- config: string;
6
- cache: string;
7
- log: string;
8
- temp: string;
9
- };
@@ -1,63 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.default = envPaths;
7
- // take and adapt from https://github.com/sindresorhus/env-paths/blob/main/index.js
8
- const path_1 = __importDefault(require("path"));
9
- const os_1 = __importDefault(require("os"));
10
- const process_1 = __importDefault(require("process"));
11
- const homedir = os_1.default.homedir();
12
- const tmpdir = os_1.default.tmpdir();
13
- const { env } = process_1.default;
14
- const macos = (appName) => {
15
- const library = path_1.default.join(homedir, 'Library');
16
- return {
17
- data: path_1.default.join(library, 'Application Support', appName),
18
- config: path_1.default.join(library, 'Preferences', appName),
19
- cache: path_1.default.join(library, 'Caches', appName),
20
- log: path_1.default.join(library, 'Logs', appName),
21
- temp: path_1.default.join(tmpdir, appName),
22
- };
23
- };
24
- const windows = (appName) => {
25
- const appData = env.APPDATA || path_1.default.join(homedir, 'AppData', 'Roaming');
26
- const localAppData = env.LOCALAPPDATA || path_1.default.join(homedir, 'AppData', 'Local');
27
- return {
28
- // Data/config/cache/log are invented by me as Windows isn't opinionated about this
29
- data: path_1.default.join(localAppData, appName, 'Data'),
30
- config: path_1.default.join(appData, appName, 'Config'),
31
- cache: path_1.default.join(localAppData, appName, 'Cache'),
32
- log: path_1.default.join(localAppData, appName, 'Log'),
33
- temp: path_1.default.join(tmpdir, appName),
34
- };
35
- };
36
- // https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
37
- const linux = (appName) => {
38
- const username = path_1.default.basename(homedir);
39
- return {
40
- data: path_1.default.join(env.XDG_DATA_HOME || path_1.default.join(homedir, '.local', 'share'), appName),
41
- config: path_1.default.join(env.XDG_CONFIG_HOME || path_1.default.join(homedir, '.config'), appName),
42
- cache: path_1.default.join(env.XDG_CACHE_HOME || path_1.default.join(homedir, '.cache'), appName),
43
- // https://wiki.debian.org/XDGBaseDirectorySpecification#state
44
- log: path_1.default.join(env.XDG_STATE_HOME || path_1.default.join(homedir, '.local', 'state'), appName),
45
- temp: path_1.default.join(tmpdir, username, appName),
46
- };
47
- };
48
- function envPaths(appName, { suffix = 'nodejs' } = {}) {
49
- if (typeof appName !== 'string') {
50
- throw new TypeError(`Expected a string, got ${typeof appName}`);
51
- }
52
- if (suffix) {
53
- // Add suffix to prevent possible conflict with native apps
54
- appName += `-${suffix}`;
55
- }
56
- if (process_1.default.platform === 'darwin') {
57
- return macos(appName);
58
- }
59
- if (process_1.default.platform === 'win32') {
60
- return windows(appName);
61
- }
62
- return linux(appName);
63
- }
@@ -1,70 +0,0 @@
1
- export declare const configPath: string;
2
- export declare const dataPath: string;
3
- export declare const cachePath: string;
4
- export declare const packageSrcPath: string;
5
- export declare const packageRootPath: string;
6
- export interface ProxyBasicCredentials {
7
- username: string;
8
- password: string;
9
- }
10
- export interface ProxyConfig {
11
- host: string;
12
- port: number;
13
- auth?: ProxyBasicCredentials;
14
- protocol?: string;
15
- }
16
- export interface Settings {
17
- proxy?: ProxyConfig;
18
- rpc: {
19
- proxyPort: number;
20
- };
21
- bins: {
22
- rootFolder: string;
23
- defaultCKBVersion: string;
24
- downloadPath: string;
25
- };
26
- devnet: {
27
- rpcUrl: string;
28
- configPath: string;
29
- dataPath: string;
30
- debugFullTransactionsPath: string;
31
- transactionsPath: string;
32
- failedTransactionsPath: string;
33
- contractsPath: string;
34
- };
35
- testnet: {
36
- rpcUrl: string;
37
- debugFullTransactionsPath: string;
38
- transactionsPath: string;
39
- failedTransactionsPath: string;
40
- contractsPath: string;
41
- };
42
- mainnet: {
43
- rpcUrl: string;
44
- debugFullTransactionsPath: string;
45
- transactionsPath: string;
46
- failedTransactionsPath: string;
47
- contractsPath: string;
48
- };
49
- dappTemplate: {
50
- gitRepoUrl: string;
51
- gitBranch: string;
52
- gitFolder: string;
53
- downloadPath: string;
54
- };
55
- tools: {
56
- moleculeES: {
57
- downloadPath: string;
58
- cachePath: string;
59
- binFolder: string;
60
- };
61
- ckbDebugger: {
62
- minVersion: string;
63
- };
64
- };
65
- }
66
- export declare const defaultSettings: Settings;
67
- export declare function readSettings(): Settings;
68
- export declare function writeSettings(settings: Settings): void;
69
- export declare function getCKBBinaryInstallPath(version: string): string;
70
- export declare function getCKBBinaryPath(version: string): string;
@@ -1,150 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
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
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
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;
44
- const fs = __importStar(require("fs"));
45
- const path = __importStar(require("path"));
46
- const env_path_1 = __importDefault(require("./env-path"));
47
- const paths = (0, env_path_1.default)('offckb');
48
- exports.configPath = path.join(paths.config, 'settings.json');
49
- exports.dataPath = paths.data;
50
- exports.cachePath = paths.cache;
51
- exports.packageSrcPath = path.dirname(require.main.filename);
52
- exports.packageRootPath = path.resolve(exports.packageSrcPath, '../');
53
- exports.defaultSettings = {
54
- proxy: undefined,
55
- rpc: {
56
- proxyPort: 9000,
57
- },
58
- bins: {
59
- rootFolder: path.resolve(exports.dataPath, 'bins'),
60
- defaultCKBVersion: '0.201.0',
61
- downloadPath: path.resolve(exports.cachePath, 'download'),
62
- },
63
- devnet: {
64
- rpcUrl: 'http://localhost:8114',
65
- // todo: maybe add a root folder for all devnet data
66
- // so we can clean it easily
67
- configPath: path.resolve(exports.dataPath, 'devnet'),
68
- dataPath: path.resolve(exports.dataPath, 'devnet/data'),
69
- debugFullTransactionsPath: path.resolve(exports.dataPath, 'devnet/full-transactions'),
70
- transactionsPath: path.resolve(exports.dataPath, 'devnet/transactions'),
71
- failedTransactionsPath: path.resolve(exports.dataPath, 'devnet/failed-transactions'),
72
- contractsPath: path.resolve(exports.dataPath, 'devnet/contracts'),
73
- },
74
- testnet: {
75
- rpcUrl: 'https://testnet.ckb.dev',
76
- debugFullTransactionsPath: path.resolve(exports.dataPath, 'testnet/full-transactions'),
77
- transactionsPath: path.resolve(exports.dataPath, 'testnet/transactions'),
78
- failedTransactionsPath: path.resolve(exports.dataPath, 'testnet/failed-transactions'),
79
- contractsPath: path.resolve(exports.dataPath, 'testnet/contracts'),
80
- },
81
- mainnet: {
82
- rpcUrl: 'https://mainnet.ckb.dev',
83
- debugFullTransactionsPath: path.resolve(exports.dataPath, 'mainnet/full-transactions'),
84
- transactionsPath: path.resolve(exports.dataPath, 'mainnet/transactions'),
85
- failedTransactionsPath: path.resolve(exports.dataPath, 'mainnet/failed-transactions'),
86
- contractsPath: path.resolve(exports.dataPath, 'mainnet/contracts'),
87
- },
88
- dappTemplate: {
89
- gitRepoUrl: `https://github.com/ckb-devrel/offckb`,
90
- gitBranch: 'master',
91
- gitFolder: 'templates/v3',
92
- downloadPath: path.resolve(exports.cachePath, 'download', 'dapp-template'),
93
- },
94
- tools: {
95
- moleculeES: {
96
- downloadPath: path.resolve(exports.cachePath, 'download', 'molecule-es'),
97
- cachePath: path.resolve(exports.cachePath, 'tools', 'moleculec-es'),
98
- binFolder: path.resolve(exports.dataPath, 'tools', 'moleculec-es'),
99
- },
100
- ckbDebugger: {
101
- minVersion: '0.200.0',
102
- },
103
- },
104
- };
105
- function readSettings() {
106
- try {
107
- if (fs.existsSync(exports.configPath)) {
108
- const data = fs.readFileSync(exports.configPath, 'utf8');
109
- return deepMerge(exports.defaultSettings, JSON.parse(data));
110
- }
111
- else {
112
- return exports.defaultSettings;
113
- }
114
- }
115
- catch (error) {
116
- console.error('Error reading settings:', error);
117
- return exports.defaultSettings;
118
- }
119
- }
120
- function writeSettings(settings) {
121
- try {
122
- fs.mkdirSync(path.dirname(exports.configPath), { recursive: true });
123
- fs.writeFileSync(exports.configPath, JSON.stringify(settings, null, 2));
124
- console.log('save new settings');
125
- }
126
- catch (error) {
127
- console.error('Error writing settings:', error);
128
- }
129
- }
130
- function getCKBBinaryInstallPath(version) {
131
- const setting = readSettings();
132
- return `${setting.bins.rootFolder}/${version}`;
133
- }
134
- function getCKBBinaryPath(version) {
135
- return `${getCKBBinaryInstallPath(version)}/ckb`;
136
- }
137
- function deepMerge(target, source) {
138
- for (const key in source) {
139
- if (source[key] && typeof source[key] === 'object') {
140
- if (!target[key]) {
141
- target[key] = {};
142
- }
143
- deepMerge(target[key], source[key]);
144
- }
145
- else {
146
- target[key] = source[key];
147
- }
148
- }
149
- return target;
150
- }
package/dist/cli.d.ts DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};