@offckb/cli 0.2.6 → 0.3.0-canary-cfe9b48.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 (96) hide show
  1. package/README.md +59 -17
  2. package/ckb/devnet/specs/dev.toml +7 -7
  3. package/dist/cfg/env-path.d.ts +9 -0
  4. package/dist/cfg/env-path.js +63 -0
  5. package/dist/cfg/setting.d.ts +45 -0
  6. package/dist/cfg/setting.js +124 -0
  7. package/dist/cli.js +54 -30
  8. package/dist/cmd/clean.js +7 -5
  9. package/dist/cmd/config.d.ts +11 -0
  10. package/dist/cmd/config.js +102 -0
  11. package/dist/cmd/create.d.ts +1 -1
  12. package/dist/cmd/create.js +19 -8
  13. package/dist/cmd/debug.d.ts +13 -0
  14. package/dist/cmd/debug.js +100 -0
  15. package/dist/cmd/deploy.js +45 -25
  16. package/dist/cmd/deposit.js +11 -7
  17. package/dist/cmd/inject-config.d.ts +0 -3
  18. package/dist/cmd/inject-config.js +20 -80
  19. package/dist/cmd/list-hashes.d.ts +25 -1
  20. package/dist/cmd/list-hashes.js +24 -16
  21. package/dist/cmd/{deployed-scripts.d.ts → my-scripts.d.ts} +1 -1
  22. package/dist/cmd/my-scripts.js +25 -0
  23. package/dist/cmd/node.d.ts +5 -1
  24. package/dist/cmd/node.js +22 -8
  25. package/dist/cmd/proxy-rpc.d.ts +7 -0
  26. package/dist/cmd/proxy-rpc.js +23 -0
  27. package/dist/cmd/sync-config.js +16 -11
  28. package/dist/cmd/system-scripts.d.ts +42 -0
  29. package/dist/cmd/system-scripts.js +265 -0
  30. package/dist/deploy/migration.d.ts +45 -0
  31. package/dist/deploy/migration.js +131 -0
  32. package/dist/deploy/toml.d.ts +38 -0
  33. package/dist/deploy/toml.js +60 -0
  34. package/dist/deploy/util.d.ts +2 -0
  35. package/dist/deploy/util.js +19 -0
  36. package/dist/node/init-chain.js +41 -0
  37. package/dist/{cmd/develop → node}/install.d.ts +4 -5
  38. package/dist/{cmd/develop → node}/install.js +32 -32
  39. package/dist/scripts/gen.d.ts +5 -0
  40. package/dist/scripts/gen.js +69 -0
  41. package/dist/scripts/public.d.ts +8 -0
  42. package/dist/scripts/public.js +396 -0
  43. package/dist/scripts/type.d.ts +46 -0
  44. package/dist/scripts/type.js +19 -0
  45. package/dist/scripts/util.d.ts +3 -0
  46. package/dist/scripts/util.js +84 -0
  47. package/dist/template/config.d.ts +4 -0
  48. package/dist/template/config.js +60 -0
  49. package/dist/template/offckb.config.d.ts +69 -0
  50. package/dist/template/offckb.config.js +81 -0
  51. package/dist/{util/template.d.ts → template/option.d.ts} +1 -1
  52. package/dist/template/option.js +11 -0
  53. package/dist/template/option.json +16 -0
  54. package/dist/tools/ckb-debugger.d.ts +12 -0
  55. package/dist/tools/ckb-debugger.js +31 -0
  56. package/dist/tools/ckb-tx-dumper.d.ts +6 -0
  57. package/dist/tools/ckb-tx-dumper.js +21 -0
  58. package/dist/tools/rpc-proxy.d.ts +9 -0
  59. package/dist/tools/rpc-proxy.js +84 -0
  60. package/dist/util/ckb.d.ts +64 -0
  61. package/dist/util/ckb.js +16 -3
  62. package/dist/util/encoding.d.ts +1 -0
  63. package/dist/util/encoding.js +7 -1
  64. package/dist/util/fs.d.ts +1 -2
  65. package/dist/util/fs.js +8 -32
  66. package/dist/util/git.js +19 -7
  67. package/dist/util/request.d.ts +8 -0
  68. package/dist/util/request.js +57 -0
  69. package/dist/util/type.d.ts +1 -0
  70. package/dist/util/validator.d.ts +1 -0
  71. package/dist/util/validator.js +13 -4
  72. package/package.json +9 -4
  73. package/templates/offckb.config.ts +3 -3
  74. package/templates/template.json +16 -0
  75. package/dist/cfg/const.d.ts +0 -21
  76. package/dist/cfg/const.js +0 -51
  77. package/dist/cmd/deployed-scripts.js +0 -14
  78. package/dist/cmd/develop/build-account.d.ts +0 -1
  79. package/dist/cmd/develop/build-account.js +0 -9
  80. package/dist/cmd/develop/genkey.d.ts +0 -14
  81. package/dist/cmd/develop/genkey.js +0 -143
  82. package/dist/cmd/develop/init-chain.js +0 -76
  83. package/dist/cmd/develop/lumos-config.d.ts +0 -4
  84. package/dist/cmd/develop/lumos-config.js +0 -153
  85. package/dist/util/config.d.ts +0 -9
  86. package/dist/util/config.js +0 -136
  87. package/dist/util/template.js +0 -30
  88. package/templates/config.json +0 -98
  89. /package/ckb/devnet/specs/{omni_lock → omnilock} +0 -0
  90. /package/ckb/devnet/specs/{spore-scripts → spore}/spore +0 -0
  91. /package/ckb/devnet/specs/{spore-scripts/cluster → spore/spore_cluster} +0 -0
  92. /package/ckb/devnet/specs/{spore-scripts/cluster_agent → spore/spore_cluster_agent} +0 -0
  93. /package/ckb/devnet/specs/{spore-scripts/cluster_proxy → spore/spore_cluster_proxy} +0 -0
  94. /package/ckb/devnet/specs/{spore-scripts → spore}/spore_extension_lua +0 -0
  95. /package/ckb/devnet/specs/{xudt_rce → xudt} +0 -0
  96. /package/dist/{cmd/develop → node}/init-chain.d.ts +0 -0
@@ -1,136 +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 (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
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.buildFullLumosConfig = exports.readPredefinedTestnetLumosConfig = exports.readPredefinedMainnetLumosConfig = exports.readPredefinedDevnetLumosConfig = exports.readUserDeployedScriptsInfo = exports.updateScriptInfoInOffCKBConfigTs = exports.updateOffCKBConfigVersion = void 0;
27
- const fs = __importStar(require("fs"));
28
- const path = __importStar(require("path"));
29
- const const_1 = require("../cfg/const");
30
- const lumos_1 = require("@ckb-lumos/lumos");
31
- const type_1 = require("./type");
32
- const version = require('../../package.json').version;
33
- function updateOffCKBConfigVersion(filePath) {
34
- const versionTarget = 'update-me-offckb-config-version';
35
- let fileContent = fs.readFileSync(filePath, 'utf-8');
36
- fileContent = fileContent.replace(versionTarget, version);
37
- // Write the updated content back to the file
38
- fs.writeFileSync(filePath, fileContent, 'utf-8');
39
- }
40
- exports.updateOffCKBConfigVersion = updateOffCKBConfigVersion;
41
- function updateScriptInfoInOffCKBConfigTs(newConfig, filePath, network) {
42
- // Read the content of the offckb.config.ts file
43
- let fileContent = fs.readFileSync(filePath, 'utf-8');
44
- if (network === type_1.Network.devnet) {
45
- /// Define the regular expression pattern to match the JSON content
46
- const regexPattern = /\/\/ ---devnet lumos config---([\s\S]*?)\/\/ ---end of devnet lumos config---/;
47
- // Replace the old JSON content with the new JSON content using the regular expression
48
- fileContent = fileContent.replace(regexPattern, `// ---devnet lumos config---\nconst lumosConfig: config.Config = ${JSON.stringify(newConfig, null, 2)} as config.Config;\n// ---end of devnet lumos config---`);
49
- // Write the updated content back to the file
50
- fs.writeFileSync(filePath, fileContent, 'utf-8');
51
- }
52
- if (network === type_1.Network.testnet) {
53
- /// Define the regular expression pattern to match the JSON content
54
- const regexPattern = /\/\/ ---testnet lumos config---([\s\S]*?)\/\/ ---end of testnet lumos config---/;
55
- // Replace the old JSON content with the new JSON content using the regular expression
56
- fileContent = fileContent.replace(regexPattern, `// ---testnet lumos config---\nconst testnetLumosConfig: config.Config = ${JSON.stringify(newConfig, null, 2)} as config.Config;\n// ---end of testnet lumos config---`);
57
- // Write the updated content back to the file
58
- fs.writeFileSync(filePath, fileContent, 'utf-8');
59
- }
60
- if (network === type_1.Network.mainnet) {
61
- /// Define the regular expression pattern to match the JSON content
62
- const regexPattern = /\/\/ ---mainnet lumos config---([\s\S]*?)\/\/ ---end of mainnet lumos config---/;
63
- // Replace the old JSON content with the new JSON content using the regular expression
64
- fileContent = fileContent.replace(regexPattern, `// ---mainnet lumos config---\nconst mainnetLumosConfig: config.Config = ${JSON.stringify(newConfig, null, 2)} as config.Config;\n// ---end of mainnet lumos config---`);
65
- // Write the updated content back to the file
66
- fs.writeFileSync(filePath, fileContent, 'utf-8');
67
- }
68
- }
69
- exports.updateScriptInfoInOffCKBConfigTs = updateScriptInfoInOffCKBConfigTs;
70
- function readUserDeployedScriptsInfo(network) {
71
- const deployedScriptsInfo = {};
72
- // Read all files in the folder
73
- const folder = path.resolve(const_1.deployedContractInfoFolderPath, network);
74
- if (!fs.existsSync(folder)) {
75
- return deployedScriptsInfo;
76
- }
77
- const files = fs.readdirSync(folder);
78
- // Iterate through each file
79
- files.forEach((fileName) => {
80
- // Construct the full file path
81
- const filePath = path.join(folder, fileName);
82
- // Check if the file is a JSON file
83
- if (fileName.endsWith('.json')) {
84
- try {
85
- // Read the file content
86
- const fileContent = fs.readFileSync(filePath, 'utf-8');
87
- // Parse the JSON content
88
- const scriptContent = JSON.parse(fileContent);
89
- const rawFileName = path.parse(fileName).name.replace(/-/g, '_');
90
- // Add the file content to the result object with the file name as the key
91
- deployedScriptsInfo[rawFileName] = scriptContent;
92
- }
93
- catch (error) {
94
- console.error(`Error reading or parsing file '${fileName}':`, error);
95
- }
96
- }
97
- });
98
- return deployedScriptsInfo;
99
- }
100
- exports.readUserDeployedScriptsInfo = readUserDeployedScriptsInfo;
101
- function readPredefinedDevnetLumosConfig() {
102
- const filePath = path.resolve(const_1.dappTemplatePath, 'config.json');
103
- try {
104
- const fileContent = fs.readFileSync(filePath, 'utf-8');
105
- const jsonData = JSON.parse(fileContent);
106
- return jsonData;
107
- }
108
- catch (error) {
109
- throw new Error('Error reading the json file:' + error.message);
110
- }
111
- }
112
- exports.readPredefinedDevnetLumosConfig = readPredefinedDevnetLumosConfig;
113
- function readPredefinedMainnetLumosConfig() {
114
- const predefined = lumos_1.config.predefined.LINA;
115
- // add more example like spore;
116
- return predefined;
117
- }
118
- exports.readPredefinedMainnetLumosConfig = readPredefinedMainnetLumosConfig;
119
- function readPredefinedTestnetLumosConfig() {
120
- const predefined = lumos_1.config.predefined.AGGRON4;
121
- // add more example like spore;
122
- return predefined;
123
- }
124
- exports.readPredefinedTestnetLumosConfig = readPredefinedTestnetLumosConfig;
125
- function buildFullLumosConfig(network) {
126
- const config = network === type_1.Network.devnet
127
- ? readPredefinedDevnetLumosConfig()
128
- : network === type_1.Network.testnet
129
- ? readPredefinedTestnetLumosConfig()
130
- : readPredefinedMainnetLumosConfig();
131
- const userDeployedScripts = readUserDeployedScriptsInfo(network);
132
- const conf = JSON.parse(JSON.stringify(config));
133
- conf.SCRIPTS = Object.assign(Object.assign({}, config.SCRIPTS), userDeployedScripts);
134
- return conf;
135
- }
136
- exports.buildFullLumosConfig = buildFullLumosConfig;
@@ -1,30 +0,0 @@
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
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.loadBareTemplateOpts = void 0;
16
- const axios_1 = __importDefault(require("axios"));
17
- const const_1 = require("../cfg/const");
18
- function loadBareTemplateOpts() {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- const githubUrl = `https://raw.githubusercontent.com/${const_1.dappTemplateGitRepoUserAndName}/${const_1.dappTemplateGitBranch}/${const_1.dappTemplateGitFolder}/${const_1.bareTemplateGitSelectOptionFile}`;
21
- try {
22
- const response = yield axios_1.default.get(githubUrl);
23
- return response.data;
24
- }
25
- catch (error) {
26
- throw new Error(`Error fetching JSON: ${error.message}`);
27
- }
28
- });
29
- }
30
- exports.loadBareTemplateOpts = loadBareTemplateOpts;
@@ -1,98 +0,0 @@
1
- {
2
- "PREFIX": "ckt",
3
- "SCRIPTS": {
4
- "SECP256K1_BLAKE160": {
5
- "CODE_HASH": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
6
- "HASH_TYPE": "type",
7
- "TX_HASH": "0x75be96e1871693f030db27ddae47890a28ab180e88e36ebb3575d9f1377d3da7",
8
- "INDEX": "0x0",
9
- "DEP_TYPE": "depGroup",
10
- "SHORT_ID": 1
11
- },
12
- "SECP256K1_BLAKE160_MULTISIG": {
13
- "CODE_HASH": "0x5c5069eb0857efc65e1bca0c07df34c31663b3622fd3876c876320fc9634e2a8",
14
- "HASH_TYPE": "type",
15
- "TX_HASH": "0x75be96e1871693f030db27ddae47890a28ab180e88e36ebb3575d9f1377d3da7",
16
- "INDEX": "0x1",
17
- "DEP_TYPE": "depGroup"
18
- },
19
- "DAO": {
20
- "CODE_HASH": "0x82d76d1b75fe2fd9a27dfbaa65a039221a380d76c926f378d3f81cf3e7e13f2e",
21
- "HASH_TYPE": "type",
22
- "TX_HASH": "0x1dbed8dcfe0f18359c65c5e9546fd15cd69de73ea0a502345be30180649c9467",
23
- "INDEX": "0x2",
24
- "DEP_TYPE": "code",
25
- "SHORT_ID": 2
26
- },
27
- "SUDT": {
28
- "CODE_HASH": "0x6283a479a3cf5d4276cd93594de9f1827ab9b55c7b05b3d28e4c2e0a696cfefd",
29
- "HASH_TYPE": "type",
30
- "TX_HASH": "0x1dbed8dcfe0f18359c65c5e9546fd15cd69de73ea0a502345be30180649c9467",
31
- "INDEX": "0x5",
32
- "DEP_TYPE": "code"
33
- },
34
- "XUDT": {
35
- "CODE_HASH": "0x1a1e4fef34f5982906f745b048fe7b1089647e82346074e0f32c2ece26cf6b1e",
36
- "HASH_TYPE": "type",
37
- "TX_HASH": "0x1dbed8dcfe0f18359c65c5e9546fd15cd69de73ea0a502345be30180649c9467",
38
- "INDEX": "0x6",
39
- "DEP_TYPE": "code"
40
- },
41
- "OMNILOCK": {
42
- "CODE_HASH": "0x9c6933d977360f115a3e9cd5a2e0e475853681b80d775d93ad0f8969da343e56",
43
- "HASH_TYPE": "type",
44
- "TX_HASH": "0x1dbed8dcfe0f18359c65c5e9546fd15cd69de73ea0a502345be30180649c9467",
45
- "INDEX": "0x7",
46
- "DEP_TYPE": "code"
47
- },
48
- "ANYONE_CAN_PAY": {
49
- "CODE_HASH": "0xe09352af0066f3162287763ce4ddba9af6bfaeab198dc7ab37f8c71c9e68bb5b",
50
- "HASH_TYPE": "type",
51
- "TX_HASH": "0x1dbed8dcfe0f18359c65c5e9546fd15cd69de73ea0a502345be30180649c9467",
52
- "INDEX": "0x8",
53
- "DEP_TYPE": "code"
54
- },
55
- "ALWAYS_SUCCESS": {
56
- "CODE_HASH": "0xbb4469004225b39e983929db71fe2253cba1d49a76223e9e1d212cdca1f79f28",
57
- "HASH_TYPE": "type",
58
- "TX_HASH": "0x1dbed8dcfe0f18359c65c5e9546fd15cd69de73ea0a502345be30180649c9467",
59
- "INDEX": "0x9",
60
- "DEP_TYPE": "code"
61
- },
62
- "SPORE": {
63
- "CODE_HASH": "0x7e8bf78a62232caa2f5d47e691e8db1a90d05e93dc6828ad3cb935c01ec6d208",
64
- "HASH_TYPE": "data1",
65
- "TX_HASH": "0x1dbed8dcfe0f18359c65c5e9546fd15cd69de73ea0a502345be30180649c9467",
66
- "INDEX": "0xa",
67
- "DEP_TYPE": "code"
68
- },
69
- "SPORE_CLUSTER": {
70
- "CODE_HASH": "0x7366a61534fa7c7e6225ecc0d828ea3b5366adec2b58206f2ee84995fe030075",
71
- "HASH_TYPE": "data1",
72
- "TX_HASH": "0x1dbed8dcfe0f18359c65c5e9546fd15cd69de73ea0a502345be30180649c9467",
73
- "INDEX": "0xb",
74
- "DEP_TYPE": "code"
75
- },
76
- "SPORE_CLUSTER_AGENT": {
77
- "CODE_HASH": "0xc986099b41d79ca1b2a56ce5874bcda8175440a17298ea5e2bbc3897736b8c21",
78
- "HASH_TYPE": "data1",
79
- "TX_HASH": "0x1dbed8dcfe0f18359c65c5e9546fd15cd69de73ea0a502345be30180649c9467",
80
- "INDEX": "0xc",
81
- "DEP_TYPE": "code"
82
- },
83
- "SPORE_CLUSTER_PROXY": {
84
- "CODE_HASH": "0xbe8b9ce3d05a32c4bb26fe71cd5fc1407ce91e3a8b9e8719be2ab072cef1454b",
85
- "HASH_TYPE": "data1",
86
- "TX_HASH": "0x1dbed8dcfe0f18359c65c5e9546fd15cd69de73ea0a502345be30180649c9467",
87
- "INDEX": "0xd",
88
- "DEP_TYPE": "code"
89
- },
90
- "SPORE_LUA": {
91
- "CODE_HASH": "0x94a9b875911ace20f1f0d063a26495d14e4b04e32fd218261bb747f34e71ae47",
92
- "HASH_TYPE": "data1",
93
- "TX_HASH": "0x1dbed8dcfe0f18359c65c5e9546fd15cd69de73ea0a502345be30180649c9467",
94
- "INDEX": "0xe",
95
- "DEP_TYPE": "code"
96
- }
97
- }
98
- }
File without changes
File without changes
File without changes
File without changes