@offckb/cli 0.3.4 → 0.4.0-canary-113bf31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -138
- package/build/build/Release/cpufeatures.node +0 -0
- package/build/build/Release/secp256k1.node +0 -0
- package/build/index.js +114977 -0
- package/package.json +12 -6
- package/dist/cfg/account.d.ts +0 -55
- package/dist/cfg/account.js +0 -66
- package/dist/cfg/env-path.d.ts +0 -9
- package/dist/cfg/env-path.js +0 -63
- package/dist/cfg/setting.d.ts +0 -67
- package/dist/cfg/setting.js +0 -147
- package/dist/cli.d.ts +0 -2
- package/dist/cli.js +0 -224
- package/dist/cmd/accounts.d.ts +0 -1
- package/dist/cmd/accounts.js +0 -40
- package/dist/cmd/balance.d.ts +0 -4
- package/dist/cmd/balance.js +0 -25
- package/dist/cmd/clean.d.ts +0 -1
- package/dist/cmd/clean.js +0 -27
- package/dist/cmd/config.d.ts +0 -11
- package/dist/cmd/config.js +0 -107
- package/dist/cmd/create.d.ts +0 -7
- package/dist/cmd/create.js +0 -77
- package/dist/cmd/debug.d.ts +0 -16
- package/dist/cmd/debug.js +0 -120
- package/dist/cmd/deploy.d.ts +0 -9
- package/dist/cmd/deploy.js +0 -76
- package/dist/cmd/deposit.d.ts +0 -5
- package/dist/cmd/deposit.js +0 -97
- package/dist/cmd/inject-config.d.ts +0 -4
- package/dist/cmd/inject-config.js +0 -72
- package/dist/cmd/list-hashes.d.ts +0 -25
- package/dist/cmd/list-hashes.js +0 -39
- package/dist/cmd/mol.d.ts +0 -2
- package/dist/cmd/mol.js +0 -38
- package/dist/cmd/my-scripts.d.ts +0 -4
- package/dist/cmd/my-scripts.js +0 -24
- package/dist/cmd/node.d.ts +0 -5
- package/dist/cmd/node.js +0 -70
- package/dist/cmd/proxy-rpc.d.ts +0 -7
- package/dist/cmd/proxy-rpc.js +0 -22
- package/dist/cmd/repl.d.ts +0 -17
- package/dist/cmd/repl.js +0 -111
- package/dist/cmd/sync-scripts.d.ts +0 -4
- package/dist/cmd/sync-scripts.js +0 -30
- package/dist/cmd/system-scripts.d.ts +0 -99
- package/dist/cmd/system-scripts.js +0 -301
- package/dist/cmd/transfer-all.d.ts +0 -6
- package/dist/cmd/transfer-all.js +0 -37
- package/dist/cmd/transfer.d.ts +0 -6
- package/dist/cmd/transfer.js +0 -38
- package/dist/deploy/index.d.ts +0 -18
- package/dist/deploy/index.js +0 -127
- package/dist/deploy/migration.d.ts +0 -50
- package/dist/deploy/migration.js +0 -178
- package/dist/deploy/toml.d.ts +0 -42
- package/dist/deploy/toml.js +0 -59
- package/dist/deploy/util.d.ts +0 -2
- package/dist/deploy/util.js +0 -18
- package/dist/molecule/mol.d.ts +0 -9
- package/dist/molecule/mol.js +0 -149
- package/dist/node/init-chain.d.ts +0 -1
- package/dist/node/init-chain.js +0 -40
- package/dist/node/install.d.ts +0 -11
- package/dist/node/install.js +0 -235
- package/dist/scripts/gen.d.ts +0 -5
- package/dist/scripts/gen.js +0 -78
- package/dist/scripts/private.d.ts +0 -4
- package/dist/scripts/private.js +0 -13
- package/dist/scripts/public.d.ts +0 -8
- package/dist/scripts/public.js +0 -229
- package/dist/scripts/type.d.ts +0 -51
- package/dist/scripts/type.js +0 -19
- package/dist/scripts/util.d.ts +0 -3
- package/dist/scripts/util.js +0 -93
- package/dist/sdk/ckb.d.ts +0 -37
- package/dist/sdk/ckb.js +0 -254
- package/dist/sdk/network.d.ts +0 -17
- package/dist/sdk/network.js +0 -22
- package/dist/template/offckb-config.d.ts +0 -4
- package/dist/template/offckb-config.js +0 -70
- package/dist/template/option.d.ts +0 -8
- package/dist/template/option.js +0 -22
- package/dist/tools/ckb-debugger.d.ts +0 -12
- package/dist/tools/ckb-debugger.js +0 -31
- package/dist/tools/ckb-tx-dumper.d.ts +0 -6
- package/dist/tools/ckb-tx-dumper.js +0 -20
- package/dist/tools/moleculec-es.d.ts +0 -8
- package/dist/tools/moleculec-es.js +0 -100
- package/dist/tools/moleculec-go.d.ts +0 -5
- package/dist/tools/moleculec-go.js +0 -35
- package/dist/tools/moleculec-rust.d.ts +0 -5
- package/dist/tools/moleculec-rust.js +0 -35
- package/dist/tools/rpc-proxy.d.ts +0 -7
- package/dist/tools/rpc-proxy.js +0 -90
- package/dist/type/base.d.ts +0 -11
- package/dist/type/base.js +0 -10
- package/dist/util/encoding.d.ts +0 -2
- package/dist/util/encoding.js +0 -24
- package/dist/util/fs.d.ts +0 -13
- package/dist/util/fs.js +0 -218
- package/dist/util/git.d.ts +0 -2
- package/dist/util/git.js +0 -106
- package/dist/util/link.d.ts +0 -1
- package/dist/util/link.js +0 -6
- package/dist/util/request.d.ts +0 -8
- package/dist/util/request.js +0 -61
- package/dist/util/validator.d.ts +0 -5
- package/dist/util/validator.js +0 -67
- package/npm-shrinkwrap.json +0 -4514
package/dist/cmd/repl.js
DELETED
|
@@ -1,111 +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.repl = repl;
|
|
7
|
-
exports.initGlobalClientBuilder = initGlobalClientBuilder;
|
|
8
|
-
exports.printHelpText = printHelpText;
|
|
9
|
-
exports.buildSystemScripts = buildSystemScripts;
|
|
10
|
-
exports.buildMyScripts = buildMyScripts;
|
|
11
|
-
const repl_1 = require("repl");
|
|
12
|
-
const core_1 = require("@ckb-ccc/core");
|
|
13
|
-
const advanced_1 = require("@ckb-ccc/core/advanced");
|
|
14
|
-
const network_1 = require("../sdk/network");
|
|
15
|
-
const base_1 = require("../type/base");
|
|
16
|
-
const private_1 = require("../scripts/private");
|
|
17
|
-
const account_json_1 = __importDefault(require("../../account/account.json"));
|
|
18
|
-
const validator_1 = require("../util/validator");
|
|
19
|
-
const gen_1 = require("../scripts/gen");
|
|
20
|
-
const util_1 = require("../scripts/util");
|
|
21
|
-
function repl({ network = base_1.Network.devnet, proxyRpc = false }) {
|
|
22
|
-
(0, validator_1.validateNetworkOpt)(network);
|
|
23
|
-
console.log(
|
|
24
|
-
// Note remember update the CCC version since require CCC's package.json not work
|
|
25
|
-
`Welcome to OffCKB REPL!\n[[ Default Network: ${network}, enableProxyRPC: ${proxyRpc}, CCC SDK: 0.0.16-alpha.3 ]]\nType 'help()' to learn how to use.`);
|
|
26
|
-
const context = (0, repl_1.start)({
|
|
27
|
-
prompt: 'OffCKB > ',
|
|
28
|
-
ignoreUndefined: true,
|
|
29
|
-
useColors: true,
|
|
30
|
-
}).context;
|
|
31
|
-
context.ccc = core_1.ccc;
|
|
32
|
-
context.cccA = advanced_1.cccA;
|
|
33
|
-
context.networks = network_1.networks;
|
|
34
|
-
context.Client = initGlobalClientBuilder(proxyRpc);
|
|
35
|
-
context.client = initGlobalClientBuilder(proxyRpc).new(network);
|
|
36
|
-
context.accounts = account_json_1.default;
|
|
37
|
-
context.myScripts = buildMyScripts().new(network);
|
|
38
|
-
context.systemScripts = buildSystemScripts().new(network);
|
|
39
|
-
context.help = printHelpText;
|
|
40
|
-
}
|
|
41
|
-
function initGlobalClientBuilder(proxyRpc) {
|
|
42
|
-
return {
|
|
43
|
-
new: (network) => {
|
|
44
|
-
if (proxyRpc) {
|
|
45
|
-
return network === 'mainnet'
|
|
46
|
-
? new core_1.ccc.ClientPublicMainnet({ url: network_1.networks.mainnet.proxy_rpc_url })
|
|
47
|
-
: network === 'testnet'
|
|
48
|
-
? new core_1.ccc.ClientPublicTestnet({ url: network_1.networks.testnet.proxy_rpc_url })
|
|
49
|
-
: new core_1.ccc.ClientPublicTestnet({
|
|
50
|
-
url: network_1.networks.devnet.proxy_rpc_url,
|
|
51
|
-
scripts: (0, private_1.buildCCCDevnetKnownScripts)(),
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
return network === 'mainnet'
|
|
55
|
-
? new core_1.ccc.ClientPublicMainnet()
|
|
56
|
-
: network === 'testnet'
|
|
57
|
-
? new core_1.ccc.ClientPublicTestnet()
|
|
58
|
-
: new core_1.ccc.ClientPublicTestnet({
|
|
59
|
-
url: network_1.networks.devnet.rpc_url,
|
|
60
|
-
scripts: (0, private_1.buildCCCDevnetKnownScripts)(),
|
|
61
|
-
});
|
|
62
|
-
},
|
|
63
|
-
fromUrl: (rpcUrl, network) => {
|
|
64
|
-
return network === 'mainnet'
|
|
65
|
-
? new core_1.ccc.ClientPublicMainnet({ url: rpcUrl })
|
|
66
|
-
: network === 'testnet'
|
|
67
|
-
? new core_1.ccc.ClientPublicTestnet({ url: rpcUrl })
|
|
68
|
-
: new core_1.ccc.ClientPublicTestnet({
|
|
69
|
-
url: rpcUrl,
|
|
70
|
-
scripts: (0, private_1.buildCCCDevnetKnownScripts)(),
|
|
71
|
-
});
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
function printHelpText() {
|
|
76
|
-
return console.log(`
|
|
77
|
-
OffCKB Repl, a Nodejs REPL with CKB bundles.
|
|
78
|
-
|
|
79
|
-
Global Variables to use:
|
|
80
|
-
- ccc, cccA, imported from CKB Javascript SDK CCC
|
|
81
|
-
- client, a CCC client instance bundle with current network
|
|
82
|
-
- Client, a Wrap of CCC client class, you can build new client with
|
|
83
|
-
const myClient = Client.new('devnet' | 'testnet' | 'mainnet');
|
|
84
|
-
// or
|
|
85
|
-
const myClient = Client.fromUrl('<your rpc url>', 'devnet' | 'testnet' | 'mainnet');
|
|
86
|
-
- accounts, test accounts array from OffCKB
|
|
87
|
-
- networks, network information configs
|
|
88
|
-
- myScripts, user-deployed scripts information via offckb deploy
|
|
89
|
-
- systemScripts, built-in scripts information in the blockchain
|
|
90
|
-
- help, print this help message
|
|
91
|
-
`);
|
|
92
|
-
}
|
|
93
|
-
function buildSystemScripts() {
|
|
94
|
-
return {
|
|
95
|
-
new: (network) => {
|
|
96
|
-
const systemScripts = (0, gen_1.genSystemScripts)();
|
|
97
|
-
return network === base_1.Network.devnet
|
|
98
|
-
? systemScripts === null || systemScripts === void 0 ? void 0 : systemScripts.devnet
|
|
99
|
-
: network === base_1.Network.testnet
|
|
100
|
-
? systemScripts === null || systemScripts === void 0 ? void 0 : systemScripts.testnet
|
|
101
|
-
: systemScripts === null || systemScripts === void 0 ? void 0 : systemScripts.mainnet;
|
|
102
|
-
},
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
function buildMyScripts() {
|
|
106
|
-
return {
|
|
107
|
-
new: (network) => {
|
|
108
|
-
return (0, util_1.readUserDeployedScriptsInfo)(network);
|
|
109
|
-
},
|
|
110
|
-
};
|
|
111
|
-
}
|
package/dist/cmd/sync-scripts.js
DELETED
|
@@ -1,30 +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.syncScripts = syncScripts;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const gen_1 = require("../scripts/gen");
|
|
9
|
-
const offckb_config_1 = require("../template/offckb-config");
|
|
10
|
-
const fs_1 = require("../util/fs");
|
|
11
|
-
const fs_2 = __importDefault(require("fs"));
|
|
12
|
-
function syncScripts({ configPath }) {
|
|
13
|
-
const userOffCKBConfigPath = configPath
|
|
14
|
-
? (0, fs_1.isAbsolutePath)(configPath)
|
|
15
|
-
? configPath
|
|
16
|
-
: path_1.default.resolve(process.cwd(), configPath)
|
|
17
|
-
: path_1.default.resolve(process.cwd(), 'offckb.config.ts');
|
|
18
|
-
if (!fs_2.default.existsSync(userOffCKBConfigPath)) {
|
|
19
|
-
throw new Error(`config file not exits: ${userOffCKBConfigPath}, tips: use --config to specific the offckb.config.ts file`);
|
|
20
|
-
}
|
|
21
|
-
const contractInfoFolder = offckb_config_1.OffCKBConfigFile.readContractInfoFolder(userOffCKBConfigPath);
|
|
22
|
-
if (!contractInfoFolder) {
|
|
23
|
-
throw new Error('No contract info folder found in offckb.config.ts!');
|
|
24
|
-
}
|
|
25
|
-
const systemJsonFilePath = path_1.default.resolve(contractInfoFolder, 'system-scripts.json');
|
|
26
|
-
(0, gen_1.genSystemScriptsJsonFile)(systemJsonFilePath);
|
|
27
|
-
const myScriptsJsonFilePath = path_1.default.resolve(contractInfoFolder, 'my-scripts.json');
|
|
28
|
-
(0, gen_1.genMyScriptsJsonFile)(myScriptsJsonFilePath);
|
|
29
|
-
console.log('scripts json config updated.');
|
|
30
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { SystemCell } from './list-hashes';
|
|
2
|
-
import { CellDepInfoLike, Script } from '@ckb-ccc/core';
|
|
3
|
-
import { ScriptInfo, SystemScriptsRecord } from '../scripts/type';
|
|
4
|
-
import { Network, NetworkOption } from '../type/base';
|
|
5
|
-
export declare enum PrintStyle {
|
|
6
|
-
system = "system",
|
|
7
|
-
lumos = "lumos",
|
|
8
|
-
ccc = "ccc"
|
|
9
|
-
}
|
|
10
|
-
export interface PrintProps extends NetworkOption {
|
|
11
|
-
style?: PrintStyle;
|
|
12
|
-
}
|
|
13
|
-
export declare function printSystemScripts({ style, network }: PrintProps): Promise<void>;
|
|
14
|
-
export declare function printInSystemStyle(systemScripts: SystemScriptsRecord, network: Network): void;
|
|
15
|
-
export declare function printInLumosConfigStyle(scripts: SystemScriptsRecord, network: Network): void;
|
|
16
|
-
export declare function printInCCCStyle(scripts: SystemScriptsRecord, network: Network): void;
|
|
17
|
-
export declare function getDevnetSystemScriptsFromListHashes(): SystemScriptsRecord | null;
|
|
18
|
-
export declare function systemCellToScriptInfo({ cell, depType, depGroup, extraCellDeps, }: {
|
|
19
|
-
cell: SystemCell;
|
|
20
|
-
depType: 'code' | 'depGroup';
|
|
21
|
-
depGroup?: {
|
|
22
|
-
txHash: string;
|
|
23
|
-
index: number;
|
|
24
|
-
};
|
|
25
|
-
extraCellDeps?: ScriptInfo['cellDeps'];
|
|
26
|
-
}): ScriptInfo;
|
|
27
|
-
export declare function toLumosConfig(scripts: SystemScriptsRecord, addressPrefix?: 'ckb' | 'ckt'): {
|
|
28
|
-
PREFIX: "ckb" | "ckt";
|
|
29
|
-
SCRIPTS: {
|
|
30
|
-
SECP256K1_BLAKE160: {
|
|
31
|
-
CODE_HASH: `0x${string}`;
|
|
32
|
-
HASH_TYPE: import("@ckb-ccc/core").HashType;
|
|
33
|
-
TX_HASH: `0x${string}`;
|
|
34
|
-
INDEX: string;
|
|
35
|
-
DEP_TYPE: import("@ckb-ccc/core").DepType;
|
|
36
|
-
SHORT_ID: number;
|
|
37
|
-
};
|
|
38
|
-
SECP256K1_BLAKE160_MULTISIG: {
|
|
39
|
-
CODE_HASH: `0x${string}`;
|
|
40
|
-
HASH_TYPE: import("@ckb-ccc/core").HashType;
|
|
41
|
-
TX_HASH: `0x${string}`;
|
|
42
|
-
INDEX: string;
|
|
43
|
-
DEP_TYPE: import("@ckb-ccc/core").DepType;
|
|
44
|
-
};
|
|
45
|
-
DAO: {
|
|
46
|
-
CODE_HASH: `0x${string}`;
|
|
47
|
-
HASH_TYPE: import("@ckb-ccc/core").HashType;
|
|
48
|
-
TX_HASH: `0x${string}`;
|
|
49
|
-
INDEX: string;
|
|
50
|
-
DEP_TYPE: import("@ckb-ccc/core").DepType;
|
|
51
|
-
SHORT_ID: number;
|
|
52
|
-
};
|
|
53
|
-
SUDT: {
|
|
54
|
-
CODE_HASH: `0x${string}`;
|
|
55
|
-
HASH_TYPE: import("@ckb-ccc/core").HashType;
|
|
56
|
-
TX_HASH: `0x${string}`;
|
|
57
|
-
INDEX: string;
|
|
58
|
-
DEP_TYPE: import("@ckb-ccc/core").DepType;
|
|
59
|
-
};
|
|
60
|
-
XUDT: {
|
|
61
|
-
CODE_HASH: `0x${string}`;
|
|
62
|
-
HASH_TYPE: import("@ckb-ccc/core").HashType;
|
|
63
|
-
TX_HASH: `0x${string}`;
|
|
64
|
-
INDEX: string;
|
|
65
|
-
DEP_TYPE: import("@ckb-ccc/core").DepType;
|
|
66
|
-
};
|
|
67
|
-
OMNILOCK: {
|
|
68
|
-
CODE_HASH: `0x${string}`;
|
|
69
|
-
HASH_TYPE: import("@ckb-ccc/core").HashType;
|
|
70
|
-
TX_HASH: `0x${string}`;
|
|
71
|
-
INDEX: string;
|
|
72
|
-
DEP_TYPE: import("@ckb-ccc/core").DepType;
|
|
73
|
-
};
|
|
74
|
-
ANYONE_CAN_PAY: {
|
|
75
|
-
CODE_HASH: `0x${string}`;
|
|
76
|
-
HASH_TYPE: import("@ckb-ccc/core").HashType;
|
|
77
|
-
TX_HASH: `0x${string}`;
|
|
78
|
-
INDEX: string;
|
|
79
|
-
DEP_TYPE: import("@ckb-ccc/core").DepType;
|
|
80
|
-
};
|
|
81
|
-
SPORE: {
|
|
82
|
-
CODE_HASH: `0x${string}`;
|
|
83
|
-
HASH_TYPE: import("@ckb-ccc/core").HashType;
|
|
84
|
-
TX_HASH: `0x${string}`;
|
|
85
|
-
INDEX: string;
|
|
86
|
-
DEP_TYPE: import("@ckb-ccc/core").DepType;
|
|
87
|
-
};
|
|
88
|
-
SPORE_CLUSTER: {
|
|
89
|
-
CODE_HASH: `0x${string}`;
|
|
90
|
-
HASH_TYPE: import("@ckb-ccc/core").HashType;
|
|
91
|
-
TX_HASH: `0x${string}`;
|
|
92
|
-
INDEX: string;
|
|
93
|
-
DEP_TYPE: import("@ckb-ccc/core").DepType;
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
};
|
|
97
|
-
export declare function toCCCKnownScripts(scripts: SystemScriptsRecord): Record<string, Pick<Script, "codeHash" | "hashType"> & {
|
|
98
|
-
cellDeps: CellDepInfoLike[];
|
|
99
|
-
}>;
|
|
@@ -1,301 +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.PrintStyle = void 0;
|
|
16
|
-
exports.printSystemScripts = printSystemScripts;
|
|
17
|
-
exports.printInSystemStyle = printInSystemStyle;
|
|
18
|
-
exports.printInLumosConfigStyle = printInLumosConfigStyle;
|
|
19
|
-
exports.printInCCCStyle = printInCCCStyle;
|
|
20
|
-
exports.getDevnetSystemScriptsFromListHashes = getDevnetSystemScriptsFromListHashes;
|
|
21
|
-
exports.systemCellToScriptInfo = systemCellToScriptInfo;
|
|
22
|
-
exports.toLumosConfig = toLumosConfig;
|
|
23
|
-
exports.toCCCKnownScripts = toCCCKnownScripts;
|
|
24
|
-
const setting_1 = require("../cfg/setting");
|
|
25
|
-
const list_hashes_1 = require("./list-hashes");
|
|
26
|
-
const toml_1 = __importDefault(require("@iarna/toml"));
|
|
27
|
-
const core_1 = require("@ckb-ccc/core");
|
|
28
|
-
const base_1 = require("../type/base");
|
|
29
|
-
const public_1 = require("../scripts/public");
|
|
30
|
-
var PrintStyle;
|
|
31
|
-
(function (PrintStyle) {
|
|
32
|
-
PrintStyle["system"] = "system";
|
|
33
|
-
PrintStyle["lumos"] = "lumos";
|
|
34
|
-
PrintStyle["ccc"] = "ccc";
|
|
35
|
-
})(PrintStyle || (exports.PrintStyle = PrintStyle = {}));
|
|
36
|
-
function printSystemScripts(_a) {
|
|
37
|
-
return __awaiter(this, arguments, void 0, function* ({ style = PrintStyle.system, network = base_1.Network.devnet }) {
|
|
38
|
-
const systemScripts = network === base_1.Network.mainnet
|
|
39
|
-
? public_1.MAINNET_SYSTEM_SCRIPTS
|
|
40
|
-
: network === base_1.Network.testnet
|
|
41
|
-
? public_1.TESTNET_SYSTEM_SCRIPTS
|
|
42
|
-
: getDevnetSystemScriptsFromListHashes();
|
|
43
|
-
if (!systemScripts)
|
|
44
|
-
return console.log(`SystemScripts is null, ${network}`);
|
|
45
|
-
if (style === PrintStyle.system) {
|
|
46
|
-
return printInSystemStyle(systemScripts, network);
|
|
47
|
-
}
|
|
48
|
-
if (style === PrintStyle.lumos) {
|
|
49
|
-
return printInLumosConfigStyle(systemScripts, network);
|
|
50
|
-
}
|
|
51
|
-
if (style === PrintStyle.ccc) {
|
|
52
|
-
return printInCCCStyle(systemScripts, network);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
function printInSystemStyle(systemScripts, network) {
|
|
57
|
-
console.log(`*** CKB ${network.toUpperCase()} System Scripts ***\n`);
|
|
58
|
-
for (const [name, script] of Object.entries(systemScripts)) {
|
|
59
|
-
console.log(`- name: ${name}`);
|
|
60
|
-
if (script == null) {
|
|
61
|
-
return console.log(` undefined\n`);
|
|
62
|
-
}
|
|
63
|
-
console.log(` file: ${script.file}`);
|
|
64
|
-
console.log(` code_hash: ${script.script.codeHash}`);
|
|
65
|
-
console.log(` hash_type: ${script.script.hashType}`);
|
|
66
|
-
console.log(` cellDeps: ${JSON.stringify(script.script.cellDeps, null, 2)}\n`);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
function printInLumosConfigStyle(scripts, network) {
|
|
70
|
-
const config = toLumosConfig(scripts, network === base_1.Network.mainnet ? 'ckb' : 'ckt');
|
|
71
|
-
console.log(`*** CKB ${network.toUpperCase()} System Scripts As LumosConfig ***\n`);
|
|
72
|
-
console.log(JSON.stringify(config, null, 2));
|
|
73
|
-
}
|
|
74
|
-
function printInCCCStyle(scripts, network) {
|
|
75
|
-
const knownsScripts = toCCCKnownScripts(scripts);
|
|
76
|
-
console.log(`*** CKB ${network.toUpperCase()} System Scripts As CCC KnownScripts ***\n`);
|
|
77
|
-
console.log(JSON.stringify(knownsScripts, null, 2));
|
|
78
|
-
}
|
|
79
|
-
function getDevnetSystemScriptsFromListHashes() {
|
|
80
|
-
var _a;
|
|
81
|
-
const settings = (0, setting_1.readSettings)();
|
|
82
|
-
const listHashesString = (0, list_hashes_1.getDevnetListHashes)(settings.bins.defaultCKBVersion);
|
|
83
|
-
if (!listHashesString) {
|
|
84
|
-
console.log(`list-hashes not found!`);
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
|
-
const listHashes = toml_1.default.parse(listHashesString);
|
|
88
|
-
const chainSpecHashes = Object.values(listHashes)[0];
|
|
89
|
-
if (chainSpecHashes == null) {
|
|
90
|
-
throw new Error(`invalid chain spec hashes file ${listHashesString}`);
|
|
91
|
-
}
|
|
92
|
-
const systemScriptArray = chainSpecHashes.system_cells
|
|
93
|
-
.map((cell) => {
|
|
94
|
-
var _a;
|
|
95
|
-
// Extract the file name
|
|
96
|
-
const name = ((_a = cell.path.split('/').pop()) === null || _a === void 0 ? void 0 : _a.replace(')', '')) || 'unknown script';
|
|
97
|
-
const depGroupIndex = chainSpecHashes.dep_groups.findIndex((depGroup) => depGroup.included_cells.includes(`Bundled(specs/cells/${name})`));
|
|
98
|
-
const depType = depGroupIndex === -1 ? 'code' : 'depGroup';
|
|
99
|
-
const depGroup = depGroupIndex === -1
|
|
100
|
-
? undefined
|
|
101
|
-
: {
|
|
102
|
-
txHash: chainSpecHashes.dep_groups[depGroupIndex].tx_hash,
|
|
103
|
-
index: chainSpecHashes.dep_groups[depGroupIndex].index,
|
|
104
|
-
};
|
|
105
|
-
const scriptInfo = systemCellToScriptInfo({ cell, depType, depGroup });
|
|
106
|
-
return {
|
|
107
|
-
name,
|
|
108
|
-
file: cell.path,
|
|
109
|
-
script: scriptInfo,
|
|
110
|
-
};
|
|
111
|
-
})
|
|
112
|
-
.filter((s) => s.name != 'secp256k1_data');
|
|
113
|
-
const systemScripts = systemScriptArray.reduce((acc, item) => {
|
|
114
|
-
const key = item.name;
|
|
115
|
-
acc[key] = item;
|
|
116
|
-
return acc;
|
|
117
|
-
}, {});
|
|
118
|
-
// some special case fixes
|
|
119
|
-
// eg: omnilock also requires the deps of secp256k1-sigHashAll
|
|
120
|
-
(_a = systemScripts.omnilock) === null || _a === void 0 ? void 0 : _a.script.cellDeps.push(systemScripts.secp256k1_blake160_sighash_all.script.cellDeps[0]);
|
|
121
|
-
return systemScripts;
|
|
122
|
-
}
|
|
123
|
-
function systemCellToScriptInfo({ cell, depType, depGroup, extraCellDeps, }) {
|
|
124
|
-
// todo: we left the type in cellDepsInfo since it requires async fetching and
|
|
125
|
-
// chain running to get the full type script of the type-id deps.
|
|
126
|
-
// Also, in devnet there is no real need to auto upgrade the system scripts with type-id
|
|
127
|
-
if (depType === 'code') {
|
|
128
|
-
let cellDeps = [
|
|
129
|
-
{
|
|
130
|
-
cellDep: {
|
|
131
|
-
outPoint: {
|
|
132
|
-
txHash: cell.tx_hash,
|
|
133
|
-
index: cell.index,
|
|
134
|
-
},
|
|
135
|
-
depType,
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
];
|
|
139
|
-
if (extraCellDeps && extraCellDeps.length > 0) {
|
|
140
|
-
cellDeps = [...extraCellDeps, ...cellDeps];
|
|
141
|
-
}
|
|
142
|
-
return {
|
|
143
|
-
codeHash: (cell.type_hash || cell.data_hash),
|
|
144
|
-
hashType: cell.type_hash ? 'type' : 'data1',
|
|
145
|
-
cellDeps,
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
if (depType === 'depGroup') {
|
|
149
|
-
if (!depGroup) {
|
|
150
|
-
throw new Error('require depGroup info since the dep type is depGroup');
|
|
151
|
-
}
|
|
152
|
-
let cellDeps = [
|
|
153
|
-
{
|
|
154
|
-
cellDep: {
|
|
155
|
-
outPoint: {
|
|
156
|
-
txHash: depGroup.txHash,
|
|
157
|
-
index: depGroup.index,
|
|
158
|
-
},
|
|
159
|
-
depType,
|
|
160
|
-
},
|
|
161
|
-
},
|
|
162
|
-
];
|
|
163
|
-
if (extraCellDeps && extraCellDeps.length > 0) {
|
|
164
|
-
cellDeps = [...extraCellDeps, ...cellDeps];
|
|
165
|
-
}
|
|
166
|
-
return {
|
|
167
|
-
codeHash: (cell.type_hash || cell.data_hash),
|
|
168
|
-
hashType: cell.type_hash ? 'type' : 'data1',
|
|
169
|
-
cellDeps,
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
throw new Error(`unknown DepType ${depType}`);
|
|
173
|
-
}
|
|
174
|
-
function toLumosConfig(scripts, addressPrefix = 'ckt') {
|
|
175
|
-
const config = {
|
|
176
|
-
PREFIX: addressPrefix,
|
|
177
|
-
SCRIPTS: {
|
|
178
|
-
SECP256K1_BLAKE160: {
|
|
179
|
-
CODE_HASH: scripts.secp256k1_blake160_sighash_all.script.codeHash,
|
|
180
|
-
HASH_TYPE: scripts.secp256k1_blake160_sighash_all.script.hashType,
|
|
181
|
-
TX_HASH: scripts.secp256k1_blake160_sighash_all.script.cellDeps[0].cellDep.outPoint.txHash,
|
|
182
|
-
INDEX: '0x' + scripts.secp256k1_blake160_sighash_all.script.cellDeps[0].cellDep.outPoint.index.toString(16),
|
|
183
|
-
DEP_TYPE: scripts.secp256k1_blake160_sighash_all.script.cellDeps[0].cellDep.depType,
|
|
184
|
-
SHORT_ID: 1,
|
|
185
|
-
},
|
|
186
|
-
SECP256K1_BLAKE160_MULTISIG: {
|
|
187
|
-
CODE_HASH: scripts.secp256k1_blake160_multisig_all.script.codeHash,
|
|
188
|
-
HASH_TYPE: scripts.secp256k1_blake160_multisig_all.script.hashType,
|
|
189
|
-
TX_HASH: scripts.secp256k1_blake160_multisig_all.script.cellDeps[0].cellDep.outPoint.txHash,
|
|
190
|
-
INDEX: '0x' + scripts.secp256k1_blake160_multisig_all.script.cellDeps[0].cellDep.outPoint.index.toString(16),
|
|
191
|
-
DEP_TYPE: scripts.secp256k1_blake160_multisig_all.script.cellDeps[0].cellDep.depType,
|
|
192
|
-
},
|
|
193
|
-
DAO: {
|
|
194
|
-
CODE_HASH: scripts.dao.script.codeHash,
|
|
195
|
-
HASH_TYPE: scripts.dao.script.hashType,
|
|
196
|
-
TX_HASH: scripts.dao.script.cellDeps[0].cellDep.outPoint.txHash,
|
|
197
|
-
INDEX: '0x' + scripts.dao.script.cellDeps[0].cellDep.outPoint.index.toString(16),
|
|
198
|
-
DEP_TYPE: scripts.dao.script.cellDeps[0].cellDep.depType,
|
|
199
|
-
SHORT_ID: 2,
|
|
200
|
-
},
|
|
201
|
-
SUDT: {
|
|
202
|
-
CODE_HASH: scripts.sudt.script.codeHash,
|
|
203
|
-
HASH_TYPE: scripts.sudt.script.hashType,
|
|
204
|
-
TX_HASH: scripts.sudt.script.cellDeps[0].cellDep.outPoint.txHash,
|
|
205
|
-
INDEX: '0x' + scripts.sudt.script.cellDeps[0].cellDep.outPoint.index.toString(16),
|
|
206
|
-
DEP_TYPE: scripts.sudt.script.cellDeps[0].cellDep.depType,
|
|
207
|
-
},
|
|
208
|
-
XUDT: {
|
|
209
|
-
CODE_HASH: scripts.xudt.script.codeHash,
|
|
210
|
-
HASH_TYPE: scripts.xudt.script.hashType,
|
|
211
|
-
TX_HASH: scripts.xudt.script.cellDeps[0].cellDep.outPoint.txHash,
|
|
212
|
-
INDEX: '0x' + scripts.xudt.script.cellDeps[0].cellDep.outPoint.index.toString(16),
|
|
213
|
-
DEP_TYPE: scripts.xudt.script.cellDeps[0].cellDep.depType,
|
|
214
|
-
},
|
|
215
|
-
OMNILOCK: {
|
|
216
|
-
CODE_HASH: scripts.omnilock.script.codeHash,
|
|
217
|
-
HASH_TYPE: scripts.omnilock.script.hashType,
|
|
218
|
-
TX_HASH: scripts.omnilock.script.cellDeps[0].cellDep.outPoint.txHash,
|
|
219
|
-
INDEX: '0x' + scripts.omnilock.script.cellDeps[0].cellDep.outPoint.index.toString(16),
|
|
220
|
-
DEP_TYPE: scripts.omnilock.script.cellDeps[0].cellDep.depType,
|
|
221
|
-
},
|
|
222
|
-
ANYONE_CAN_PAY: {
|
|
223
|
-
CODE_HASH: scripts.anyone_can_pay.script.codeHash,
|
|
224
|
-
HASH_TYPE: scripts.anyone_can_pay.script.hashType,
|
|
225
|
-
TX_HASH: scripts.anyone_can_pay.script.cellDeps[0].cellDep.outPoint.txHash,
|
|
226
|
-
INDEX: '0x' + scripts.anyone_can_pay.script.cellDeps[0].cellDep.outPoint.index.toString(16),
|
|
227
|
-
DEP_TYPE: scripts.anyone_can_pay.script.cellDeps[0].cellDep.depType,
|
|
228
|
-
},
|
|
229
|
-
SPORE: {
|
|
230
|
-
CODE_HASH: scripts.spore.script.codeHash,
|
|
231
|
-
HASH_TYPE: scripts.spore.script.hashType,
|
|
232
|
-
TX_HASH: scripts.spore.script.cellDeps[0].cellDep.outPoint.txHash,
|
|
233
|
-
INDEX: '0x' + scripts.spore.script.cellDeps[0].cellDep.outPoint.index.toString(16),
|
|
234
|
-
DEP_TYPE: scripts.spore.script.cellDeps[0].cellDep.depType,
|
|
235
|
-
},
|
|
236
|
-
SPORE_CLUSTER: {
|
|
237
|
-
CODE_HASH: scripts.spore_cluster.script.codeHash,
|
|
238
|
-
HASH_TYPE: scripts.spore_cluster.script.hashType,
|
|
239
|
-
TX_HASH: scripts.spore_cluster.script.cellDeps[0].cellDep.outPoint.txHash,
|
|
240
|
-
INDEX: '0x' + scripts.spore_cluster.script.cellDeps[0].cellDep.outPoint.index.toString(16),
|
|
241
|
-
DEP_TYPE: scripts.spore_cluster.script.cellDeps[0].cellDep.depType,
|
|
242
|
-
},
|
|
243
|
-
},
|
|
244
|
-
};
|
|
245
|
-
if (scripts.always_success) {
|
|
246
|
-
// @ts-expect-error we remove the lumos config type deps
|
|
247
|
-
config.SCRIPTS['ALWAYS_SUCCESS'] = {
|
|
248
|
-
CODE_HASH: scripts.always_success.script.codeHash,
|
|
249
|
-
HASH_TYPE: scripts.always_success.script.hashType,
|
|
250
|
-
TX_HASH: scripts.always_success.script.cellDeps[0].cellDep.outPoint.txHash,
|
|
251
|
-
INDEX: '0x' + scripts.always_success.script.cellDeps[0].cellDep.outPoint.index.toString(16),
|
|
252
|
-
DEP_TYPE: scripts.always_success.script.cellDeps[0].cellDep.depType,
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
if (scripts.spore_cluster_agent) {
|
|
256
|
-
// @ts-expect-error we remove the lumos config type deps
|
|
257
|
-
config.SCRIPTS['SPORE_CLUSTER_AGENT'] = {
|
|
258
|
-
CODE_HASH: scripts.spore_cluster_agent.script.codeHash,
|
|
259
|
-
HASH_TYPE: scripts.spore_cluster_agent.script.hashType,
|
|
260
|
-
TX_HASH: scripts.spore_cluster_agent.script.cellDeps[0].cellDep.outPoint.txHash,
|
|
261
|
-
INDEX: '0x' + scripts.spore_cluster_agent.script.cellDeps[0].cellDep.outPoint.index.toString(16),
|
|
262
|
-
DEP_TYPE: scripts.spore_cluster_agent.script.cellDeps[0].cellDep.depType,
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
if (scripts.spore_cluster_proxy) {
|
|
266
|
-
// @ts-expect-error we remove the lumos config type deps
|
|
267
|
-
config.SCRIPTS['SPORE_CLUSTER_PROXY'] = {
|
|
268
|
-
CODE_HASH: scripts.spore_cluster_proxy.script.codeHash,
|
|
269
|
-
HASH_TYPE: scripts.spore_cluster_proxy.script.hashType,
|
|
270
|
-
TX_HASH: scripts.spore_cluster_proxy.script.cellDeps[0].cellDep.outPoint.txHash,
|
|
271
|
-
INDEX: '0x' + scripts.spore_cluster_proxy.script.cellDeps[0].cellDep.outPoint.index.toString(16),
|
|
272
|
-
DEP_TYPE: scripts.spore_cluster_proxy.script.cellDeps[0].cellDep.depType,
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
if (scripts.spore_extension_lua) {
|
|
276
|
-
// @ts-expect-error we remove the lumos config type deps
|
|
277
|
-
config.SCRIPTS['SPORE_LUA'] = {
|
|
278
|
-
CODE_HASH: scripts.spore_extension_lua.script.codeHash,
|
|
279
|
-
HASH_TYPE: scripts.spore_extension_lua.script.hashType,
|
|
280
|
-
TX_HASH: scripts.spore_extension_lua.script.cellDeps[0].cellDep.outPoint.txHash,
|
|
281
|
-
INDEX: '0x' + scripts.spore_extension_lua.script.cellDeps[0].cellDep.outPoint.index.toString(16),
|
|
282
|
-
DEP_TYPE: scripts.spore_extension_lua.script.cellDeps[0].cellDep.depType,
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
return config;
|
|
286
|
-
}
|
|
287
|
-
function toCCCKnownScripts(scripts) {
|
|
288
|
-
const DEVNET_SCRIPTS = {
|
|
289
|
-
[core_1.KnownScript.Secp256k1Blake160]: scripts.secp256k1_blake160_sighash_all.script,
|
|
290
|
-
[core_1.KnownScript.Secp256k1Multisig]: scripts.secp256k1_blake160_multisig_all.script,
|
|
291
|
-
[core_1.KnownScript.AnyoneCanPay]: scripts.anyone_can_pay.script,
|
|
292
|
-
[core_1.KnownScript.OmniLock]: scripts.omnilock.script,
|
|
293
|
-
[core_1.KnownScript.XUdt]: scripts.xudt.script,
|
|
294
|
-
[core_1.KnownScript.TypeId]: {
|
|
295
|
-
codeHash: '0x00000000000000000000000000000000000000000000000000545950455f4944',
|
|
296
|
-
hashType: 'type',
|
|
297
|
-
cellDeps: [],
|
|
298
|
-
},
|
|
299
|
-
};
|
|
300
|
-
return DEVNET_SCRIPTS;
|
|
301
|
-
}
|
package/dist/cmd/transfer-all.js
DELETED
|
@@ -1,37 +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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.transferAll = transferAll;
|
|
13
|
-
const ckb_1 = require("../sdk/ckb");
|
|
14
|
-
const base_1 = require("../type/base");
|
|
15
|
-
const link_1 = require("../util/link");
|
|
16
|
-
const validator_1 = require("../util/validator");
|
|
17
|
-
function transferAll(toAddress_1) {
|
|
18
|
-
return __awaiter(this, arguments, void 0, function* (toAddress, opt = { network: base_1.Network.devnet, proxyRpc: false }) {
|
|
19
|
-
const network = opt.network;
|
|
20
|
-
(0, validator_1.validateNetworkOpt)(network);
|
|
21
|
-
if (opt.privkey == null) {
|
|
22
|
-
throw new Error('--privkey is required!');
|
|
23
|
-
}
|
|
24
|
-
const isEnableProxyRpc = opt.proxyRpc;
|
|
25
|
-
const privateKey = opt.privkey;
|
|
26
|
-
const ckb = new ckb_1.CKB({ network, isEnableProxyRpc });
|
|
27
|
-
const txHash = yield ckb.transferAll({
|
|
28
|
-
toAddress,
|
|
29
|
-
privateKey,
|
|
30
|
-
});
|
|
31
|
-
if (network === 'testnet') {
|
|
32
|
-
console.log(`Successfully transfer, check ${(0, link_1.buildTestnetTxLink)(txHash)} for details.`);
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
console.log('Successfully transfer, txHash:', txHash);
|
|
36
|
-
});
|
|
37
|
-
}
|
package/dist/cmd/transfer.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { NetworkOption } from '../type/base';
|
|
2
|
-
export interface TransferOptions extends NetworkOption {
|
|
3
|
-
privkey?: string | null;
|
|
4
|
-
proxyRpc?: boolean;
|
|
5
|
-
}
|
|
6
|
-
export declare function transfer(toAddress: string, amountInCKB: string, opt?: TransferOptions): Promise<void>;
|
package/dist/cmd/transfer.js
DELETED
|
@@ -1,38 +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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.transfer = transfer;
|
|
13
|
-
const ckb_1 = require("../sdk/ckb");
|
|
14
|
-
const base_1 = require("../type/base");
|
|
15
|
-
const link_1 = require("../util/link");
|
|
16
|
-
const validator_1 = require("../util/validator");
|
|
17
|
-
function transfer(toAddress_1, amountInCKB_1) {
|
|
18
|
-
return __awaiter(this, arguments, void 0, function* (toAddress, amountInCKB, opt = { network: base_1.Network.devnet, proxyRpc: false }) {
|
|
19
|
-
const network = opt.network;
|
|
20
|
-
(0, validator_1.validateNetworkOpt)(network);
|
|
21
|
-
if (opt.privkey == null) {
|
|
22
|
-
throw new Error('--privkey is required!');
|
|
23
|
-
}
|
|
24
|
-
const isEnableProxyRpc = opt.proxyRpc;
|
|
25
|
-
const privateKey = opt.privkey;
|
|
26
|
-
const ckb = new ckb_1.CKB({ network, isEnableProxyRpc });
|
|
27
|
-
const txHash = yield ckb.transfer({
|
|
28
|
-
toAddress,
|
|
29
|
-
amountInCKB,
|
|
30
|
-
privateKey,
|
|
31
|
-
});
|
|
32
|
-
if (network === 'testnet') {
|
|
33
|
-
console.log(`Successfully transfer, check ${(0, link_1.buildTestnetTxLink)(txHash)} for details.`);
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
console.log('Successfully transfer, txHash:', txHash);
|
|
37
|
-
});
|
|
38
|
-
}
|
package/dist/deploy/index.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { DeploymentOptions } from '../deploy/toml';
|
|
2
|
-
import { DeploymentRecipe } from '../deploy/migration';
|
|
3
|
-
import { Network } from '../type/base';
|
|
4
|
-
import { CKB } from '../sdk/ckb';
|
|
5
|
-
import { HexString } from '../type/base';
|
|
6
|
-
export type DeployBinaryReturnType = ReturnType<typeof deployBinary>;
|
|
7
|
-
export type UnwrapPromise<T> = T extends Promise<infer U> ? U : T;
|
|
8
|
-
export type DeployedInterfaceType = UnwrapPromise<DeployBinaryReturnType>;
|
|
9
|
-
export declare function getToDeployBinsPath(userOffCKBConfigPath: string): string[];
|
|
10
|
-
export declare function recordDeployResult(results: DeployedInterfaceType[], network: Network, userOffCKBConfigPath?: string): Promise<void>;
|
|
11
|
-
export declare function deployBinaries(binPaths: string[], privateKey: HexString, enableTypeId: boolean, ckb: CKB): Promise<{
|
|
12
|
-
deploymentRecipe: DeploymentRecipe;
|
|
13
|
-
deploymentOptions: DeploymentOptions;
|
|
14
|
-
}[]>;
|
|
15
|
-
export declare function deployBinary(binPath: string, privateKey: HexString, enableTypeId: boolean, ckb: CKB): Promise<{
|
|
16
|
-
deploymentRecipe: DeploymentRecipe;
|
|
17
|
-
deploymentOptions: DeploymentOptions;
|
|
18
|
-
}>;
|