@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
@@ -1,40 +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.initChainIfNeeded = initChainIfNeeded;
16
- const fs_1 = __importDefault(require("fs"));
17
- const path_1 = __importDefault(require("path"));
18
- const fs_2 = require("../util/fs");
19
- const setting_1 = require("../cfg/setting");
20
- function initChainIfNeeded() {
21
- return __awaiter(this, void 0, void 0, function* () {
22
- const settings = (0, setting_1.readSettings)();
23
- const devnetSourcePath = path_1.default.resolve(setting_1.packageRootPath, './ckb/devnet');
24
- const devnetConfigPath = settings.devnet.configPath;
25
- if (!(0, fs_2.isFolderExists)(devnetConfigPath)) {
26
- const devnetConfigPath = settings.devnet.configPath;
27
- yield (0, fs_2.copyFilesWithExclusion)(devnetSourcePath, devnetConfigPath, ['data']);
28
- console.debug(`init devnet config folder: ${devnetConfigPath}`);
29
- // copy and edit ckb-miner.toml
30
- const minerToml = path_1.default.join(devnetSourcePath, 'ckb-miner.toml');
31
- const newMinerToml = path_1.default.join(devnetConfigPath, 'ckb-miner.toml');
32
- // Read the content of the ckb-miner.toml file
33
- const data = fs_1.default.readFileSync(minerToml, 'utf8');
34
- // Replace the URL
35
- const modifiedData = data.replace('http://ckb:8114/', settings.devnet.rpcUrl);
36
- // Write the modified content back to the file
37
- fs_1.default.writeFileSync(newMinerToml, modifiedData, 'utf8');
38
- }
39
- });
40
- }
@@ -1,11 +0,0 @@
1
- export declare function installCKBBinary(version: string): Promise<void>;
2
- export declare function downloadCKBBinaryAndUnzip(version: string): Promise<void>;
3
- export declare function downloadAndSaveCKBBinary(version: string, tempFilePath: string): Promise<void>;
4
- export declare function unZipFile(filePath: string, extractDir: string, useTar?: boolean): Promise<void>;
5
- export declare function decompressTarGzAsync(tarballPath: string, destinationDir: string): Promise<void>;
6
- export declare function getVersionFromBinary(binPath: string): string | null;
7
- export declare function buildDownloadUrl(version: string, opt?: {
8
- os?: string;
9
- arch?: string;
10
- ext?: string;
11
- }): string;
@@ -1,235 +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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
- return new (P || (P = Promise))(function (resolve, reject) {
38
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
- step((generator = generator.apply(thisArg, _arguments || [])).next());
42
- });
43
- };
44
- var __importDefault = (this && this.__importDefault) || function (mod) {
45
- return (mod && mod.__esModule) ? mod : { "default": mod };
46
- };
47
- Object.defineProperty(exports, "__esModule", { value: true });
48
- exports.installCKBBinary = installCKBBinary;
49
- exports.downloadCKBBinaryAndUnzip = downloadCKBBinaryAndUnzip;
50
- exports.downloadAndSaveCKBBinary = downloadAndSaveCKBBinary;
51
- exports.unZipFile = unZipFile;
52
- exports.decompressTarGzAsync = decompressTarGzAsync;
53
- exports.getVersionFromBinary = getVersionFromBinary;
54
- exports.buildDownloadUrl = buildDownloadUrl;
55
- const child_process_1 = require("child_process");
56
- const fs = __importStar(require("fs"));
57
- const path = __importStar(require("path"));
58
- const semver_1 = __importDefault(require("semver"));
59
- const os_1 = __importDefault(require("os"));
60
- const adm_zip_1 = __importDefault(require("adm-zip"));
61
- const tar = __importStar(require("tar"));
62
- const request_1 = require("../util/request");
63
- const setting_1 = require("../cfg/setting");
64
- const encoding_1 = require("../util/encoding");
65
- const cpu_features_1 = __importDefault(require("cpu-features"));
66
- function installCKBBinary(version) {
67
- return __awaiter(this, void 0, void 0, function* () {
68
- const ckbBinPath = (0, setting_1.getCKBBinaryPath)(version);
69
- const outputVersion = getVersionFromBinary(ckbBinPath);
70
- if (outputVersion) {
71
- if (!semver_1.default.eq(version, outputVersion)) {
72
- console.log(`CKB version ${outputVersion} is not equal to the ${version}, download and install the new version ${version}..`);
73
- }
74
- else {
75
- return;
76
- }
77
- }
78
- else {
79
- console.log(`CKB Binary not found, download and install the new version ${version}..`);
80
- }
81
- yield downloadCKBBinaryAndUnzip(version);
82
- });
83
- }
84
- function downloadCKBBinaryAndUnzip(version) {
85
- return __awaiter(this, void 0, void 0, function* () {
86
- const ckbPackageName = buildCKBGithubReleasePackageName(version);
87
- try {
88
- const ext = getExtension();
89
- const tempFilePath = path.join(os_1.default.tmpdir(), `${ckbPackageName}.${ext}`);
90
- yield downloadAndSaveCKBBinary(version, tempFilePath);
91
- // Unzip the file
92
- const extractDir = path.join((0, setting_1.readSettings)().bins.downloadPath, `ckb_v${version}`);
93
- yield unZipFile(tempFilePath, extractDir, ext === 'tar.gz');
94
- // Install the extracted files
95
- const sourcePath = path.join(extractDir, ckbPackageName);
96
- const targetPath = (0, setting_1.getCKBBinaryInstallPath)(version);
97
- if (fs.existsSync(targetPath)) {
98
- fs.rmdirSync(targetPath, { recursive: true });
99
- }
100
- fs.mkdirSync(targetPath, { recursive: true });
101
- fs.renameSync(sourcePath, targetPath); // Move binary to desired location
102
- fs.chmodSync((0, setting_1.getCKBBinaryPath)(version), '755'); // Make the binary executable
103
- console.log(`CKB ${version} installed successfully.`);
104
- }
105
- catch (error) {
106
- console.error('Error installing dependency binary:', error);
107
- }
108
- });
109
- }
110
- function downloadAndSaveCKBBinary(version, tempFilePath) {
111
- return __awaiter(this, void 0, void 0, function* () {
112
- const downloadURL = buildDownloadUrl(version);
113
- console.log(`downloading ${downloadURL} ..`);
114
- const response = yield request_1.Request.send(downloadURL);
115
- const arrayBuffer = yield response.arrayBuffer();
116
- fs.writeFileSync(tempFilePath, Buffer.from(arrayBuffer));
117
- });
118
- }
119
- function unZipFile(filePath_1, extractDir_1) {
120
- return __awaiter(this, arguments, void 0, function* (filePath, extractDir, useTar = false) {
121
- // Ensure the destination directory exists, if not create it
122
- if (!fs.existsSync(extractDir)) {
123
- fs.mkdirSync(extractDir, { recursive: true });
124
- }
125
- if (useTar === true) {
126
- return yield decompressTarGzAsync(filePath, extractDir);
127
- }
128
- const zip = new adm_zip_1.default(filePath);
129
- zip.extractAllTo(extractDir, true);
130
- });
131
- }
132
- function decompressTarGzAsync(tarballPath, destinationDir) {
133
- return __awaiter(this, void 0, void 0, function* () {
134
- return new Promise((resolve, reject) => {
135
- // Create a readable stream from the .tar.gz file
136
- const tarballStream = fs.createReadStream(tarballPath);
137
- // Extract the contents of the .tar.gz file to the destination directory
138
- tarballStream
139
- .pipe(tar.x({
140
- cwd: destinationDir,
141
- }))
142
- .on('error', (err) => {
143
- console.error('Error extracting tarball:', err);
144
- reject(err); // Reject with error if extraction fails
145
- })
146
- .on('finish', () => {
147
- console.log('Extraction complete.');
148
- resolve(); // Resolve when extraction completes
149
- });
150
- });
151
- });
152
- }
153
- function getVersionFromBinary(binPath) {
154
- try {
155
- const versionOutput = (0, child_process_1.execSync)(`${(0, encoding_1.encodeBinPathForTerminal)(binPath)} --version`, {
156
- encoding: 'utf-8',
157
- });
158
- const versionMatch = versionOutput.match(/(\d+\.\d+\.\d+(-rc\d+)?)/);
159
- if (versionMatch) {
160
- return versionMatch[0];
161
- }
162
- return null;
163
- }
164
- catch (error) {
165
- return null;
166
- }
167
- }
168
- function getOS() {
169
- const platform = os_1.default.platform();
170
- if (platform === 'darwin') {
171
- return 'apple-darwin';
172
- }
173
- else if (platform === 'linux') {
174
- return 'unknown-linux-gnu';
175
- }
176
- else if (platform === 'win32') {
177
- return 'pc-windows-msvc';
178
- }
179
- else {
180
- throw new Error('Unsupported operating system');
181
- }
182
- }
183
- function getArch() {
184
- const arch = os_1.default.arch();
185
- if (arch === 'x64') {
186
- return 'x86_64';
187
- }
188
- else if (arch === 'arm64') {
189
- return 'aarch64';
190
- }
191
- else {
192
- throw new Error('Unsupported architecture');
193
- }
194
- }
195
- function getExtension() {
196
- const platform = os_1.default.platform();
197
- if (platform === 'linux') {
198
- return 'tar.gz';
199
- }
200
- return 'zip';
201
- }
202
- function isPortable() {
203
- const features = (0, cpu_features_1.default)();
204
- if (features.arch === 'x86') {
205
- const flags = features.flags;
206
- // if lacks any of the following instruction, use portable binary
207
- return !(flags.avx2 && flags.sse4_2 && flags.bmi2 && flags.pclmulqdq);
208
- }
209
- return false;
210
- }
211
- function buildCKBGithubReleasePackageName(version, opt = {}) {
212
- const os = opt.os || getOS();
213
- const arch = opt.arch || getArch();
214
- if (isPortable()) {
215
- return `ckb_v${version}_${arch}-${os}-portable`;
216
- }
217
- else {
218
- return `ckb_v${version}_${arch}-${os}`;
219
- }
220
- }
221
- function buildCKBGithubReleasePackageNameWithExtension(version, opt = {}) {
222
- const os = opt.os || getOS();
223
- const arch = opt.arch || getArch();
224
- const extension = opt.ext || getExtension();
225
- if (isPortable()) {
226
- return `ckb_v${version}_${arch}-${os}-portable.${extension}`;
227
- }
228
- else {
229
- return `ckb_v${version}_${arch}-${os}.${extension}`;
230
- }
231
- }
232
- function buildDownloadUrl(version, opt = {}) {
233
- const fullPackageName = buildCKBGithubReleasePackageNameWithExtension(version, opt);
234
- return `https://github.com/nervosnetwork/ckb/releases/download/v${version}/${fullPackageName}`;
235
- }
@@ -1,5 +0,0 @@
1
- import { NetworkMyScripts, NetworkSystemScripts } from './type';
2
- export declare function genSystemScripts(): NetworkSystemScripts | null;
3
- export declare function genSystemScriptsJsonFile(filePath: string): void;
4
- export declare function genMyScripts(): NetworkMyScripts;
5
- export declare function genMyScriptsJsonFile(filePath: string): void;
@@ -1,78 +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.genSystemScripts = genSystemScripts;
40
- exports.genSystemScriptsJsonFile = genSystemScriptsJsonFile;
41
- exports.genMyScripts = genMyScripts;
42
- exports.genMyScriptsJsonFile = genMyScriptsJsonFile;
43
- const fs = __importStar(require("fs"));
44
- const public_1 = __importDefault(require("./public"));
45
- const system_scripts_1 = require("../cmd/system-scripts");
46
- const path_1 = __importDefault(require("path"));
47
- const base_1 = require("../type/base");
48
- const util_1 = require("./util");
49
- function genSystemScripts() {
50
- const devnetScripts = (0, system_scripts_1.getDevnetSystemScriptsFromListHashes)();
51
- if (devnetScripts != null) {
52
- const networkScripts = {
53
- devnet: devnetScripts,
54
- testnet: public_1.default.testnet,
55
- mainnet: public_1.default.mainnet,
56
- };
57
- return networkScripts;
58
- }
59
- return null;
60
- }
61
- function genSystemScriptsJsonFile(filePath) {
62
- const scripts = genSystemScripts();
63
- fs.mkdirSync(path_1.default.dirname(filePath), { recursive: true });
64
- fs.writeFileSync(filePath, JSON.stringify(scripts, null, 2));
65
- }
66
- function genMyScripts() {
67
- const networkMyScripts = {
68
- devnet: (0, util_1.readUserDeployedScriptsInfo)(base_1.Network.devnet),
69
- testnet: (0, util_1.readUserDeployedScriptsInfo)(base_1.Network.testnet),
70
- mainnet: (0, util_1.readUserDeployedScriptsInfo)(base_1.Network.mainnet),
71
- };
72
- return networkMyScripts;
73
- }
74
- function genMyScriptsJsonFile(filePath) {
75
- const scripts = genMyScripts();
76
- fs.mkdirSync(path_1.default.dirname(filePath), { recursive: true });
77
- fs.writeFileSync(filePath, JSON.stringify(scripts, null, 2));
78
- }
@@ -1,4 +0,0 @@
1
- import { ccc } from '@ckb-ccc/core';
2
- export declare function buildCCCDevnetKnownScripts(): Record<ccc.KnownScript, Pick<ccc.Script, "codeHash" | "hashType"> & {
3
- cellDeps: ccc.CellDepInfoLike[];
4
- }>;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildCCCDevnetKnownScripts = buildCCCDevnetKnownScripts;
4
- //todo: extract getSystemScriptsFromListHashes/toCCCKnownScripts from cmd folder
5
- const system_scripts_1 = require("../cmd/system-scripts");
6
- function buildCCCDevnetKnownScripts() {
7
- const devnetSystemScripts = (0, system_scripts_1.getDevnetSystemScriptsFromListHashes)();
8
- if (devnetSystemScripts == null) {
9
- throw new Error('can not getSystemScriptsFromListHashes in devnet');
10
- }
11
- const devnetKnownScripts = (0, system_scripts_1.toCCCKnownScripts)(devnetSystemScripts);
12
- return devnetKnownScripts;
13
- }
@@ -1,8 +0,0 @@
1
- import { SystemScriptsRecord } from './type';
2
- export declare const TESTNET_SYSTEM_SCRIPTS: SystemScriptsRecord;
3
- export declare const MAINNET_SYSTEM_SCRIPTS: SystemScriptsRecord;
4
- declare const _default: {
5
- testnet: SystemScriptsRecord;
6
- mainnet: SystemScriptsRecord;
7
- };
8
- export default _default;
@@ -1,229 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MAINNET_SYSTEM_SCRIPTS = exports.TESTNET_SYSTEM_SCRIPTS = void 0;
4
- const advanced_1 = require("@ckb-ccc/core/advanced");
5
- const advanced_2 = require("@ckb-ccc/core/advanced");
6
- // spore: https://github.com/sporeprotocol/spore-contract/blob/master/docs/VERSIONS.md
7
- exports.TESTNET_SYSTEM_SCRIPTS = {
8
- secp256k1_blake160_sighash_all: {
9
- name: 'secp256k1_blake160_sighash_all',
10
- script: advanced_1.TESTNET_SCRIPTS.Secp256k1Blake160,
11
- },
12
- dao: {
13
- name: 'dao',
14
- script: advanced_1.TESTNET_SCRIPTS.NervosDao,
15
- },
16
- secp256k1_blake160_multisig_all: {
17
- name: 'secp256k1_blake160_multisig_all',
18
- script: advanced_1.TESTNET_SCRIPTS.Secp256k1Multisig,
19
- },
20
- sudt: {
21
- name: 'sudt',
22
- script: {
23
- codeHash: '0xc5e5dcf215925f7ef4dfaf5f4b4f105bc321c02776d6e7d52a1db3fcd9d011a4',
24
- hashType: 'type',
25
- cellDeps: [
26
- {
27
- cellDep: {
28
- outPoint: {
29
- txHash: '0xe12877ebd2c3c364dc46c5c992bcfaf4fee33fa13eebdf82c591fc9825aab769',
30
- index: 0,
31
- },
32
- depType: 'code',
33
- },
34
- },
35
- ],
36
- },
37
- },
38
- xudt: {
39
- name: 'xudt',
40
- script: advanced_1.TESTNET_SCRIPTS.XUdt,
41
- },
42
- omnilock: {
43
- name: 'omnilock',
44
- script: advanced_1.TESTNET_SCRIPTS.OmniLock,
45
- },
46
- anyone_can_pay: {
47
- name: 'anyone_can_pay',
48
- script: advanced_1.TESTNET_SCRIPTS.AnyoneCanPay,
49
- },
50
- always_success: undefined,
51
- spore: {
52
- name: 'spore',
53
- script: {
54
- codeHash: '0x685a60219309029d01310311dba953d67029170ca4848a4ff638e57002130a0d',
55
- hashType: 'data',
56
- cellDeps: [
57
- {
58
- cellDep: {
59
- outPoint: {
60
- txHash: '0x5e8d2a517d50fd4bb4d01737a7952a1f1d35c8afc77240695bb569cd7d9d5a1f',
61
- index: 0,
62
- },
63
- depType: 'code',
64
- },
65
- },
66
- ],
67
- },
68
- },
69
- spore_cluster: {
70
- name: 'spore_cluster',
71
- script: {
72
- codeHash: '0x0bbe768b519d8ea7b96d58f1182eb7e6ef96c541fbd9526975077ee09f049058',
73
- hashType: 'data',
74
- cellDeps: [
75
- {
76
- cellDep: {
77
- outPoint: {
78
- txHash: '0xcebb174d6e300e26074aea2f5dbd7f694bb4fe3de52b6dfe205e54f90164510a',
79
- index: 0,
80
- },
81
- depType: 'code',
82
- },
83
- },
84
- ],
85
- },
86
- },
87
- spore_cluster_agent: {
88
- name: 'spore_cluster_agent',
89
- script: {
90
- codeHash: '0x923e997654b2697ee3f77052cb884e98f28799a4270fd412c3edb8f3987ca622',
91
- hashType: 'data',
92
- cellDeps: [
93
- {
94
- cellDep: {
95
- outPoint: {
96
- txHash: '0x52210232292d10c51b48e72a2cea60d8f0a08c2680a97a8ee7ca0a39379f0036',
97
- index: 0,
98
- },
99
- depType: 'code',
100
- },
101
- },
102
- ],
103
- },
104
- },
105
- spore_cluster_proxy: {
106
- name: 'spore_cluster_proxy',
107
- script: {
108
- codeHash: '0x4349889bda064adab8f49f7dd8810d217917f7df28e9b2a1df0b74442399670a',
109
- hashType: 'data',
110
- cellDeps: [
111
- {
112
- cellDep: {
113
- outPoint: {
114
- txHash: '0xc5a41d58155b11ecd87a5a49fdcb6e83bd6684d3b72b2f3686f081945461c156',
115
- index: 0,
116
- },
117
- depType: 'code',
118
- },
119
- },
120
- ],
121
- },
122
- },
123
- spore_extension_lua: {
124
- name: 'spore_extension_lua',
125
- script: {
126
- codeHash: '0x5ff1a403458b436ea4b2ceb72f1fa70a6507968493315b646f5302661cb68e57',
127
- hashType: 'data',
128
- cellDeps: [
129
- {
130
- cellDep: {
131
- outPoint: {
132
- txHash: '0x9b2098e5b6f575b2fd34ffd0212bc1c96e1f9e86fcdb146511849c174dfe0d02',
133
- index: 0,
134
- },
135
- depType: 'code',
136
- },
137
- },
138
- ],
139
- },
140
- },
141
- };
142
- exports.MAINNET_SYSTEM_SCRIPTS = {
143
- secp256k1_blake160_sighash_all: {
144
- name: 'secp256k1_blake160_sighash_all',
145
- script: advanced_2.MAINNET_SCRIPTS.Secp256k1Blake160,
146
- },
147
- dao: {
148
- name: 'dao',
149
- script: advanced_2.MAINNET_SCRIPTS.NervosDao,
150
- },
151
- secp256k1_blake160_multisig_all: {
152
- name: 'secp256k1_blake160_multisig_all',
153
- script: advanced_2.MAINNET_SCRIPTS.Secp256k1Multisig,
154
- },
155
- sudt: {
156
- name: 'sudt',
157
- script: {
158
- codeHash: '0x5e7a36a77e68eecc013dfa2fe6a23f3b6c344b04005808694ae6dd45eea4cfd5',
159
- hashType: 'type',
160
- cellDeps: [
161
- {
162
- cellDep: {
163
- outPoint: {
164
- txHash: '0xc7813f6a415144643970c2e88e0bb6ca6a8edc5dd7c1022746f628284a9936d5',
165
- index: 0,
166
- },
167
- depType: 'code',
168
- },
169
- },
170
- ],
171
- },
172
- },
173
- xudt: {
174
- name: 'xudt',
175
- script: advanced_2.MAINNET_SCRIPTS.XUdt,
176
- },
177
- omnilock: {
178
- name: 'omnilock',
179
- script: advanced_2.MAINNET_SCRIPTS.OmniLock,
180
- },
181
- anyone_can_pay: {
182
- name: 'anyone_can_pay',
183
- script: advanced_2.MAINNET_SCRIPTS.AnyoneCanPay,
184
- },
185
- always_success: undefined,
186
- spore: {
187
- name: 'spore',
188
- script: {
189
- codeHash: '0x4a4dce1df3dffff7f8b2cd7dff7303df3b6150c9788cb75dcf6747247132b9f5',
190
- hashType: 'data',
191
- cellDeps: [
192
- {
193
- cellDep: {
194
- outPoint: {
195
- txHash: '0x96b198fb5ddbd1eed57ed667068f1f1e55d07907b4c0dbd38675a69ea1b69824',
196
- index: 0,
197
- },
198
- depType: 'code',
199
- },
200
- },
201
- ],
202
- },
203
- },
204
- spore_cluster: {
205
- name: 'spore_cluster',
206
- script: {
207
- codeHash: '0x7366a61534fa7c7e6225ecc0d828ea3b5366adec2b58206f2ee84995fe030075',
208
- hashType: 'data',
209
- cellDeps: [
210
- {
211
- cellDep: {
212
- outPoint: {
213
- txHash: '0xe464b7fb9311c5e2820e61c99afc615d6b98bdefbe318c34868c010cbd0dc938',
214
- index: 0,
215
- },
216
- depType: 'code',
217
- },
218
- },
219
- ],
220
- },
221
- },
222
- spore_cluster_agent: undefined,
223
- spore_cluster_proxy: undefined,
224
- spore_extension_lua: undefined,
225
- };
226
- exports.default = {
227
- testnet: exports.TESTNET_SYSTEM_SCRIPTS,
228
- mainnet: exports.MAINNET_SYSTEM_SCRIPTS,
229
- };
@@ -1,51 +0,0 @@
1
- import { DepType, HashType } from '@ckb-ccc/core';
2
- export declare enum SystemScriptName {
3
- secp256k1_blake160_sighash_all = "secp256k1_blake160_sighash_all",
4
- secp256k1_blake160_multisig_all = "secp256k1_blake160_multisig_all",
5
- dao = "dao",
6
- sudt = "sudt",
7
- xudt = "xudt",
8
- omnilock = "omnilock",
9
- anyone_can_pay = "anyone_can_pay",
10
- always_success = "always_success",
11
- spore = "spore",
12
- spore_cluster = "spore_cluster",
13
- spore_cluster_agent = "spore_cluster_agent",
14
- spore_cluster_proxy = "spore_cluster_proxy",
15
- spore_extension_lua = "spore_extension_lua"
16
- }
17
- export interface ScriptInfo {
18
- codeHash: `0x${string}`;
19
- hashType: HashType;
20
- cellDeps: {
21
- cellDep: {
22
- outPoint: {
23
- txHash: `0x${string}`;
24
- index: number;
25
- };
26
- depType: DepType;
27
- };
28
- type?: {
29
- codeHash: `0x${string}`;
30
- hashType: HashType;
31
- args: `0x${string}`;
32
- };
33
- }[];
34
- }
35
- export interface SystemScript {
36
- name: string;
37
- file?: string;
38
- script: ScriptInfo;
39
- }
40
- export type SystemScriptsRecord = Record<SystemScriptName, SystemScript | undefined>;
41
- export interface NetworkSystemScripts {
42
- devnet: SystemScriptsRecord;
43
- testnet: SystemScriptsRecord;
44
- mainnet: SystemScriptsRecord;
45
- }
46
- export type MyScriptsRecord = Record<string, ScriptInfo | undefined>;
47
- export interface NetworkMyScripts {
48
- devnet: MyScriptsRecord;
49
- testnet: MyScriptsRecord;
50
- mainnet: MyScriptsRecord;
51
- }