@offckb/cli 0.3.0-canary-5750e85.0 → 0.3.0-canary-34f0d45.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/dist/cmd/create.js +3 -3
- package/dist/cmd/deploy.js +2 -2
- package/dist/cmd/inject-config.js +5 -4
- package/dist/cmd/sync-config.js +2 -2
- package/package.json +2 -3
- package/templates/v3/offckb.config.example.ts +144 -0
- package/dist/template/offckb.config.d.ts +0 -69
- package/dist/template/offckb.config.js +0 -79
- package/templates/offckb.config.ts +0 -220
- package/templates/template.json +0 -16
- /package/dist/template/{config.d.ts → offckb-config.d.ts} +0 -0
- /package/dist/template/{config.js → offckb-config.js} +0 -0
package/dist/cmd/create.js
CHANGED
|
@@ -21,7 +21,7 @@ const child_process_1 = require("child_process");
|
|
|
21
21
|
const gen_1 = require("../scripts/gen");
|
|
22
22
|
const setting_1 = require("../cfg/setting");
|
|
23
23
|
const option_1 = require("../template/option");
|
|
24
|
-
const
|
|
24
|
+
const offckb_config_1 = require("../template/offckb-config");
|
|
25
25
|
const version = require('../../package.json').version;
|
|
26
26
|
function createScriptProject(name) {
|
|
27
27
|
const cmd = `cargo generate gh:cryptape/ckb-script-templates workspace --name ${name}`;
|
|
@@ -43,8 +43,8 @@ function create(name, template) {
|
|
|
43
43
|
const projectFolder = path_1.default.resolve(process.cwd(), name);
|
|
44
44
|
const targetConfigPath = (0, fs_1.findFileInFolder)(projectFolder, 'offckb.config.ts');
|
|
45
45
|
if (targetConfigPath) {
|
|
46
|
-
|
|
47
|
-
const contractInfoFolder =
|
|
46
|
+
offckb_config_1.OffCKBConfigFile.updateVersion(version, targetConfigPath);
|
|
47
|
+
const contractInfoFolder = offckb_config_1.OffCKBConfigFile.readContractInfoFolder(targetConfigPath);
|
|
48
48
|
if (!contractInfoFolder) {
|
|
49
49
|
throw new Error('No contract info folder found in offckb.config.ts!');
|
|
50
50
|
}
|
package/dist/cmd/deploy.js
CHANGED
|
@@ -25,7 +25,7 @@ const toml_1 = require("../deploy/toml");
|
|
|
25
25
|
const migration_1 = require("../deploy/migration");
|
|
26
26
|
const utils_1 = require("@ckb-lumos/lumos/utils");
|
|
27
27
|
const gen_1 = require("../scripts/gen");
|
|
28
|
-
const
|
|
28
|
+
const offckb_config_1 = require("../template/offckb-config");
|
|
29
29
|
function deploy(opt = { network: type_1.Network.devnet, target: null }) {
|
|
30
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
31
|
const network = opt.network;
|
|
@@ -89,7 +89,7 @@ function recordDeployResult(results, network, updateMyScriptsJsonFile = true) {
|
|
|
89
89
|
// update my-scripts.json
|
|
90
90
|
if (updateMyScriptsJsonFile) {
|
|
91
91
|
const userOffCKBConfigPath = path_1.default.resolve(process.cwd(), 'offckb.config.ts');
|
|
92
|
-
const folder =
|
|
92
|
+
const folder = offckb_config_1.OffCKBConfigFile.readContractInfoFolder(userOffCKBConfigPath);
|
|
93
93
|
if (folder) {
|
|
94
94
|
const myScriptsFilePath = path_1.default.resolve(folder, 'my-scripts.json');
|
|
95
95
|
(0, gen_1.genMyScriptsJsonFile)(myScriptsFilePath);
|
|
@@ -8,18 +8,19 @@ const fs_1 = require("fs");
|
|
|
8
8
|
const validator_1 = require("../util/validator");
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
10
|
const gen_1 = require("../scripts/gen");
|
|
11
|
-
const
|
|
11
|
+
const offckb_config_1 = require("../template/offckb-config");
|
|
12
|
+
const setting_1 = require("../cfg/setting");
|
|
12
13
|
const version = require('../../package.json').version;
|
|
13
14
|
function injectConfig() {
|
|
14
15
|
(0, validator_1.validateTypescriptWorkspace)();
|
|
15
16
|
// inject the offckb.config.ts file into users workspace
|
|
16
17
|
// copy config template
|
|
17
|
-
const predefinedOffCKBConfigTsPath = path_1.default.resolve(
|
|
18
|
+
const predefinedOffCKBConfigTsPath = path_1.default.resolve(setting_1.packageRootPath, 'templates/v3/offckb.config.example.ts');
|
|
18
19
|
const userOffCKBConfigPath = path_1.default.resolve(process.cwd(), 'offckb.config.ts');
|
|
19
20
|
(0, fs_1.copyFileSync)(predefinedOffCKBConfigTsPath, userOffCKBConfigPath);
|
|
20
21
|
// update the version in the offckb.config.ts
|
|
21
|
-
|
|
22
|
-
const contractInfoFolder =
|
|
22
|
+
offckb_config_1.OffCKBConfigFile.updateVersion(version, userOffCKBConfigPath);
|
|
23
|
+
const contractInfoFolder = offckb_config_1.OffCKBConfigFile.readContractInfoFolder(userOffCKBConfigPath);
|
|
23
24
|
if (!contractInfoFolder) {
|
|
24
25
|
throw new Error('No contract info folder found in offckb.config.ts!');
|
|
25
26
|
}
|
package/dist/cmd/sync-config.js
CHANGED
|
@@ -7,11 +7,11 @@ exports.syncConfig = void 0;
|
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const validator_1 = require("../util/validator");
|
|
9
9
|
const gen_1 = require("../scripts/gen");
|
|
10
|
-
const
|
|
10
|
+
const offckb_config_1 = require("../template/offckb-config");
|
|
11
11
|
function syncConfig() {
|
|
12
12
|
(0, validator_1.validateExecDappEnvironment)();
|
|
13
13
|
const userOffCKBConfigPath = path_1.default.resolve(process.cwd(), 'offckb.config.ts');
|
|
14
|
-
const contractInfoFolder =
|
|
14
|
+
const contractInfoFolder = offckb_config_1.OffCKBConfigFile.readContractInfoFolder(userOffCKBConfigPath);
|
|
15
15
|
if (!contractInfoFolder) {
|
|
16
16
|
throw new Error('No contract info folder found in offckb.config.ts!');
|
|
17
17
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@offckb/cli",
|
|
3
|
-
"version": "0.3.0-canary-
|
|
3
|
+
"version": "0.3.0-canary-34f0d45.0",
|
|
4
4
|
"description": "ckb development network for your first try",
|
|
5
5
|
"author": "Retric Su <retric@cryptape.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -16,8 +16,7 @@
|
|
|
16
16
|
"dist",
|
|
17
17
|
"account",
|
|
18
18
|
"ckb",
|
|
19
|
-
"templates/offckb.config.ts"
|
|
20
|
-
"templates/template.json"
|
|
19
|
+
"templates/v3/offckb.config.example.ts"
|
|
21
20
|
],
|
|
22
21
|
"private": false,
|
|
23
22
|
"publishConfig": {
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
// this file is generated by offckb-cli
|
|
2
|
+
|
|
3
|
+
export type Network = 'devnet' | 'testnet' | 'mainnet';
|
|
4
|
+
export type AddressPrefix = 'ckb' | 'ckt';
|
|
5
|
+
|
|
6
|
+
export enum SystemScriptName {
|
|
7
|
+
secp256k1_blake160_sighash_all = 'secp256k1_blake160_sighash_all',
|
|
8
|
+
secp256k1_blake160_multisig_all = 'secp256k1_blake160_multisig_all',
|
|
9
|
+
dao = 'dao',
|
|
10
|
+
sudt = 'sudt',
|
|
11
|
+
xudt = 'xudt',
|
|
12
|
+
omnilock = 'omnilock',
|
|
13
|
+
anyone_can_pay = 'anyone_can_pay',
|
|
14
|
+
always_success = 'always_success',
|
|
15
|
+
spore = 'spore',
|
|
16
|
+
spore_cluster = 'spore_cluster',
|
|
17
|
+
spore_cluster_agent = 'spore_cluster_agent',
|
|
18
|
+
spore_cluster_proxy = 'spore_cluster_proxy',
|
|
19
|
+
spore_extension_lua = 'spore_extension_lua',
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface ScriptInfo {
|
|
23
|
+
codeHash: `0x${string}`;
|
|
24
|
+
hashType: 'type' | 'data';
|
|
25
|
+
cellDeps: {
|
|
26
|
+
cellDep: {
|
|
27
|
+
outPoint: {
|
|
28
|
+
txHash: `0x${string}`;
|
|
29
|
+
index: number;
|
|
30
|
+
};
|
|
31
|
+
depType: 'code' | 'dep_group';
|
|
32
|
+
};
|
|
33
|
+
}[];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface SystemScript {
|
|
37
|
+
name: string;
|
|
38
|
+
file?: string;
|
|
39
|
+
script: ScriptInfo;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type SystemScriptsRecord = Record<SystemScriptName, SystemScript | undefined>;
|
|
43
|
+
|
|
44
|
+
export interface NetworkSystemScripts {
|
|
45
|
+
devnet: SystemScriptsRecord;
|
|
46
|
+
testnet: SystemScriptsRecord;
|
|
47
|
+
mainnet: SystemScriptsRecord;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type MyScriptsRecord = Record<string, ScriptInfo | undefined>;
|
|
51
|
+
|
|
52
|
+
export interface NetworkMyScripts {
|
|
53
|
+
devnet: MyScriptsRecord;
|
|
54
|
+
testnet: MyScriptsRecord;
|
|
55
|
+
mainnet: MyScriptsRecord;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface NetworkConfig {
|
|
59
|
+
rpc_url: string;
|
|
60
|
+
addressPrefix: AddressPrefix;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface OffCKBConfig {
|
|
64
|
+
readonly version: string;
|
|
65
|
+
readonly contractBinFolder: string;
|
|
66
|
+
readonly contractInfoFolder: string;
|
|
67
|
+
readonly networks: {
|
|
68
|
+
devnet: NetworkConfig;
|
|
69
|
+
testnet: NetworkConfig;
|
|
70
|
+
mainnet: NetworkConfig;
|
|
71
|
+
};
|
|
72
|
+
readonly currentNetwork: Network;
|
|
73
|
+
readonly addressPrefix: AddressPrefix;
|
|
74
|
+
readonly rpcUrl: string;
|
|
75
|
+
readonly systemScripts: SystemScriptsRecord;
|
|
76
|
+
readonly myScripts: MyScriptsRecord;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function readEnvNetwork(): Network {
|
|
80
|
+
// you may need to update the env method
|
|
81
|
+
// according to your frontend framework
|
|
82
|
+
const network = process.env.NETWORK;
|
|
83
|
+
const defaultNetwork = 'devnet';
|
|
84
|
+
if (!network) return defaultNetwork;
|
|
85
|
+
|
|
86
|
+
if (!['devnet', 'testnet', 'mainnet'].includes(network)) {
|
|
87
|
+
return defaultNetwork;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return network as Network;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const offCKBConfig: OffCKBConfig = {
|
|
94
|
+
version: '@offckb-update-version',
|
|
95
|
+
contractBinFolder: '../build/release',
|
|
96
|
+
// this folder record the script deployment information
|
|
97
|
+
// If you change this folder, you need to update the following get systemScripts and get myScripts method
|
|
98
|
+
contractInfoFolder: './offckb',
|
|
99
|
+
networks: {
|
|
100
|
+
devnet: {
|
|
101
|
+
rpc_url: 'http://127.0.0.1:9000', // 9000 is the default proxy port for CKB node rpc, if you don't need proxy, you can change it to 'https://localhost:8114'
|
|
102
|
+
addressPrefix: 'ckt',
|
|
103
|
+
},
|
|
104
|
+
testnet: {
|
|
105
|
+
rpc_url: 'https://testnet.ckb.dev/rpc',
|
|
106
|
+
addressPrefix: 'ckt',
|
|
107
|
+
},
|
|
108
|
+
mainnet: {
|
|
109
|
+
rpc_url: 'https://mainnet.ckb.dev/rpc',
|
|
110
|
+
addressPrefix: 'ckb',
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
get currentNetwork() {
|
|
115
|
+
const network = readEnvNetwork();
|
|
116
|
+
return network;
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
get addressPrefix() {
|
|
120
|
+
const network = readEnvNetwork();
|
|
121
|
+
return this.networks[network].addressPrefix;
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
get rpcUrl() {
|
|
125
|
+
const network = readEnvNetwork();
|
|
126
|
+
return this.networks[network].rpc_url;
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
get systemScripts() {
|
|
130
|
+
const network = readEnvNetwork();
|
|
131
|
+
const networkSystemScripts: NetworkSystemScripts = require('./offckb/system-scripts.json');
|
|
132
|
+
const systemScripts = networkSystemScripts[network];
|
|
133
|
+
return systemScripts;
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
get myScripts() {
|
|
137
|
+
const network = readEnvNetwork();
|
|
138
|
+
const networkMyScripts: NetworkMyScripts = require('./offckb/my-scripts.json');
|
|
139
|
+
const myScripts = networkMyScripts[network];
|
|
140
|
+
return myScripts;
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export default offCKBConfig;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
export type Network = 'devnet' | 'testnet' | 'mainnet';
|
|
2
|
-
export type AddressPrefix = 'ckb' | 'ckt';
|
|
3
|
-
export declare enum SystemScriptName {
|
|
4
|
-
secp256k1_blake160_sighash_all = "secp256k1_blake160_sighash_all",
|
|
5
|
-
secp256k1_blake160_multisig_all = "secp256k1_blake160_multisig_all",
|
|
6
|
-
dao = "dao",
|
|
7
|
-
sudt = "sudt",
|
|
8
|
-
xudt = "xudt",
|
|
9
|
-
omnilock = "omnilock",
|
|
10
|
-
anyone_can_pay = "anyone_can_pay",
|
|
11
|
-
always_success = "always_success",
|
|
12
|
-
spore = "spore",
|
|
13
|
-
spore_cluster = "spore_cluster",
|
|
14
|
-
spore_cluster_agent = "spore_cluster_agent",
|
|
15
|
-
spore_cluster_proxy = "spore_cluster_proxy",
|
|
16
|
-
spore_extension_lua = "spore_extension_lua"
|
|
17
|
-
}
|
|
18
|
-
export interface ScriptInfo {
|
|
19
|
-
codeHash: `0x${string}`;
|
|
20
|
-
hashType: 'type' | 'data';
|
|
21
|
-
cellDeps: {
|
|
22
|
-
cellDep: {
|
|
23
|
-
outPoint: {
|
|
24
|
-
txHash: `0x${string}`;
|
|
25
|
-
index: number;
|
|
26
|
-
};
|
|
27
|
-
depType: 'code' | 'dep_group';
|
|
28
|
-
};
|
|
29
|
-
}[];
|
|
30
|
-
}
|
|
31
|
-
export interface SystemScript {
|
|
32
|
-
name: string;
|
|
33
|
-
file?: string;
|
|
34
|
-
script: ScriptInfo;
|
|
35
|
-
}
|
|
36
|
-
export type SystemScriptsRecord = Record<SystemScriptName, SystemScript | undefined>;
|
|
37
|
-
export interface NetworkSystemScripts {
|
|
38
|
-
devnet: SystemScriptsRecord;
|
|
39
|
-
testnet: SystemScriptsRecord;
|
|
40
|
-
mainnet: SystemScriptsRecord;
|
|
41
|
-
}
|
|
42
|
-
export type MyScriptsRecord = Record<string, ScriptInfo | undefined>;
|
|
43
|
-
export interface NetworkMyScripts {
|
|
44
|
-
devnet: MyScriptsRecord;
|
|
45
|
-
testnet: MyScriptsRecord;
|
|
46
|
-
mainnet: MyScriptsRecord;
|
|
47
|
-
}
|
|
48
|
-
export interface NetworkConfig {
|
|
49
|
-
rpc_url: string;
|
|
50
|
-
addressPrefix: AddressPrefix;
|
|
51
|
-
}
|
|
52
|
-
export interface OffCKBConfig {
|
|
53
|
-
readonly version: string;
|
|
54
|
-
readonly contractBinFolder: string;
|
|
55
|
-
readonly contractInfoFolder: string;
|
|
56
|
-
readonly networks: {
|
|
57
|
-
devnet: NetworkConfig;
|
|
58
|
-
testnet: NetworkConfig;
|
|
59
|
-
mainnet: NetworkConfig;
|
|
60
|
-
};
|
|
61
|
-
readonly currentNetwork: Network;
|
|
62
|
-
readonly addressPrefix: AddressPrefix;
|
|
63
|
-
readonly rpcUrl: string;
|
|
64
|
-
readonly systemScripts: SystemScriptsRecord;
|
|
65
|
-
readonly myScripts: MyScriptsRecord;
|
|
66
|
-
}
|
|
67
|
-
export declare function readEnvNetwork(): Network;
|
|
68
|
-
declare const offCKBConfig: OffCKBConfig;
|
|
69
|
-
export default offCKBConfig;
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// this file is generated by offckb-cli
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.readEnvNetwork = exports.SystemScriptName = void 0;
|
|
5
|
-
var SystemScriptName;
|
|
6
|
-
(function (SystemScriptName) {
|
|
7
|
-
SystemScriptName["secp256k1_blake160_sighash_all"] = "secp256k1_blake160_sighash_all";
|
|
8
|
-
SystemScriptName["secp256k1_blake160_multisig_all"] = "secp256k1_blake160_multisig_all";
|
|
9
|
-
SystemScriptName["dao"] = "dao";
|
|
10
|
-
SystemScriptName["sudt"] = "sudt";
|
|
11
|
-
SystemScriptName["xudt"] = "xudt";
|
|
12
|
-
SystemScriptName["omnilock"] = "omnilock";
|
|
13
|
-
SystemScriptName["anyone_can_pay"] = "anyone_can_pay";
|
|
14
|
-
SystemScriptName["always_success"] = "always_success";
|
|
15
|
-
SystemScriptName["spore"] = "spore";
|
|
16
|
-
SystemScriptName["spore_cluster"] = "spore_cluster";
|
|
17
|
-
SystemScriptName["spore_cluster_agent"] = "spore_cluster_agent";
|
|
18
|
-
SystemScriptName["spore_cluster_proxy"] = "spore_cluster_proxy";
|
|
19
|
-
SystemScriptName["spore_extension_lua"] = "spore_extension_lua";
|
|
20
|
-
})(SystemScriptName || (exports.SystemScriptName = SystemScriptName = {}));
|
|
21
|
-
function readEnvNetwork() {
|
|
22
|
-
// you may need to update the env method
|
|
23
|
-
// according to your frontend framework
|
|
24
|
-
const network = process.env.NETWORK;
|
|
25
|
-
const defaultNetwork = 'devnet';
|
|
26
|
-
if (!network)
|
|
27
|
-
return defaultNetwork;
|
|
28
|
-
if (!['devnet', 'testnet', 'mainnet'].includes(network)) {
|
|
29
|
-
return defaultNetwork;
|
|
30
|
-
}
|
|
31
|
-
return network;
|
|
32
|
-
}
|
|
33
|
-
exports.readEnvNetwork = readEnvNetwork;
|
|
34
|
-
const offCKBConfig = {
|
|
35
|
-
version: '@offckb-update-version',
|
|
36
|
-
contractBinFolder: '../build/release',
|
|
37
|
-
// this folder record the script deployment information
|
|
38
|
-
// If you change this folder, you need to update the following get systemScripts and get myScripts method
|
|
39
|
-
contractInfoFolder: './offckb',
|
|
40
|
-
networks: {
|
|
41
|
-
devnet: {
|
|
42
|
-
rpc_url: 'http://127.0.0.1:8114',
|
|
43
|
-
addressPrefix: 'ckt',
|
|
44
|
-
},
|
|
45
|
-
testnet: {
|
|
46
|
-
rpc_url: 'https://testnet.ckb.dev/rpc',
|
|
47
|
-
addressPrefix: 'ckt',
|
|
48
|
-
},
|
|
49
|
-
mainnet: {
|
|
50
|
-
rpc_url: 'https://mainnet.ckb.dev/rpc',
|
|
51
|
-
addressPrefix: 'ckb',
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
get currentNetwork() {
|
|
55
|
-
const network = readEnvNetwork();
|
|
56
|
-
return network;
|
|
57
|
-
},
|
|
58
|
-
get addressPrefix() {
|
|
59
|
-
const network = readEnvNetwork();
|
|
60
|
-
return this.networks[network].addressPrefix;
|
|
61
|
-
},
|
|
62
|
-
get rpcUrl() {
|
|
63
|
-
const network = readEnvNetwork();
|
|
64
|
-
return this.networks[network].rpc_url;
|
|
65
|
-
},
|
|
66
|
-
get systemScripts() {
|
|
67
|
-
const network = readEnvNetwork();
|
|
68
|
-
const networkSystemScripts = require('./offckb/system-scripts.json');
|
|
69
|
-
const systemScripts = networkSystemScripts[network];
|
|
70
|
-
return systemScripts;
|
|
71
|
-
},
|
|
72
|
-
get myScripts() {
|
|
73
|
-
const network = readEnvNetwork();
|
|
74
|
-
const networkMyScripts = require('./offckb/my-scripts.json');
|
|
75
|
-
const myScripts = networkMyScripts[network];
|
|
76
|
-
return myScripts;
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
exports.default = offCKBConfig;
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
import { Indexer, RPC, config } from '@ckb-lumos/lumos';
|
|
2
|
-
|
|
3
|
-
export type Network = 'devnet' | 'testnet' | 'mainnet';
|
|
4
|
-
export type AddressPrefix = 'ckb' | 'ckt';
|
|
5
|
-
|
|
6
|
-
export interface NetworkConfig {
|
|
7
|
-
lumosConfig: config.Config;
|
|
8
|
-
rpc_url: string;
|
|
9
|
-
rpc: RPC;
|
|
10
|
-
indexer: Indexer;
|
|
11
|
-
addressPrefix: AddressPrefix;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface OffCKBConfig {
|
|
15
|
-
readonly version: string;
|
|
16
|
-
readonly lumosVersion: string;
|
|
17
|
-
readonly contractBinFolder: string;
|
|
18
|
-
readonly networks: {
|
|
19
|
-
devnet: NetworkConfig;
|
|
20
|
-
testnet: NetworkConfig;
|
|
21
|
-
mainnet: NetworkConfig;
|
|
22
|
-
};
|
|
23
|
-
initializeLumosConfig: () => void;
|
|
24
|
-
readonly currentNetwork: Network;
|
|
25
|
-
readonly rpc: RPC;
|
|
26
|
-
readonly rpcUrl: string;
|
|
27
|
-
readonly indexer: Indexer;
|
|
28
|
-
readonly lumosConfig: config.Config;
|
|
29
|
-
readonly addressPrefix: AddressPrefix;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function readEnvNetwork(): Network {
|
|
33
|
-
// you may need to update the env method
|
|
34
|
-
// according to your frontend framework
|
|
35
|
-
const network = process.env.NETWORK;
|
|
36
|
-
const defaultNetwork = 'devnet';
|
|
37
|
-
if (!network) return defaultNetwork;
|
|
38
|
-
|
|
39
|
-
if (!['devnet', 'testnet', 'mainnet'].includes(network)) {
|
|
40
|
-
return defaultNetwork;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return network as Network;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// please do not alter the following structure
|
|
47
|
-
// we use it as a check point in offCKB
|
|
48
|
-
// ---devnet lumos config---
|
|
49
|
-
const lumosConfig: config.Config = {
|
|
50
|
-
PREFIX: 'ckt',
|
|
51
|
-
SCRIPTS: {
|
|
52
|
-
SECP256K1_BLAKE160: {
|
|
53
|
-
CODE_HASH: '0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8',
|
|
54
|
-
HASH_TYPE: 'type',
|
|
55
|
-
TX_HASH: '0x75be96e1871693f030db27ddae47890a28ab180e88e36ebb3575d9f1377d3da7',
|
|
56
|
-
INDEX: '0x0',
|
|
57
|
-
DEP_TYPE: 'depGroup',
|
|
58
|
-
SHORT_ID: 1,
|
|
59
|
-
},
|
|
60
|
-
SECP256K1_BLAKE160_MULTISIG: {
|
|
61
|
-
CODE_HASH: '0x5c5069eb0857efc65e1bca0c07df34c31663b3622fd3876c876320fc9634e2a8',
|
|
62
|
-
HASH_TYPE: 'type',
|
|
63
|
-
TX_HASH: '0x75be96e1871693f030db27ddae47890a28ab180e88e36ebb3575d9f1377d3da7',
|
|
64
|
-
INDEX: '0x1',
|
|
65
|
-
DEP_TYPE: 'depGroup',
|
|
66
|
-
},
|
|
67
|
-
DAO: {
|
|
68
|
-
CODE_HASH: '0x82d76d1b75fe2fd9a27dfbaa65a039221a380d76c926f378d3f81cf3e7e13f2e',
|
|
69
|
-
HASH_TYPE: 'type',
|
|
70
|
-
TX_HASH: '0x1dbed8dcfe0f18359c65c5e9546fd15cd69de73ea0a502345be30180649c9467',
|
|
71
|
-
INDEX: '0x2',
|
|
72
|
-
DEP_TYPE: 'code',
|
|
73
|
-
SHORT_ID: 2,
|
|
74
|
-
},
|
|
75
|
-
SUDT: {
|
|
76
|
-
CODE_HASH: '0x6283a479a3cf5d4276cd93594de9f1827ab9b55c7b05b3d28e4c2e0a696cfefd',
|
|
77
|
-
HASH_TYPE: 'type',
|
|
78
|
-
TX_HASH: '0x1dbed8dcfe0f18359c65c5e9546fd15cd69de73ea0a502345be30180649c9467',
|
|
79
|
-
INDEX: '0x5',
|
|
80
|
-
DEP_TYPE: 'code',
|
|
81
|
-
},
|
|
82
|
-
XUDT: {
|
|
83
|
-
CODE_HASH: '0x1a1e4fef34f5982906f745b048fe7b1089647e82346074e0f32c2ece26cf6b1e',
|
|
84
|
-
HASH_TYPE: 'type',
|
|
85
|
-
TX_HASH: '0x1dbed8dcfe0f18359c65c5e9546fd15cd69de73ea0a502345be30180649c9467',
|
|
86
|
-
INDEX: '0x6',
|
|
87
|
-
DEP_TYPE: 'code',
|
|
88
|
-
},
|
|
89
|
-
OMNILOCK: {
|
|
90
|
-
CODE_HASH: '0x9c6933d977360f115a3e9cd5a2e0e475853681b80d775d93ad0f8969da343e56',
|
|
91
|
-
HASH_TYPE: 'type',
|
|
92
|
-
TX_HASH: '0x1dbed8dcfe0f18359c65c5e9546fd15cd69de73ea0a502345be30180649c9467',
|
|
93
|
-
INDEX: '0x7',
|
|
94
|
-
DEP_TYPE: 'code',
|
|
95
|
-
},
|
|
96
|
-
ANYONE_CAN_PAY: {
|
|
97
|
-
CODE_HASH: '0xe09352af0066f3162287763ce4ddba9af6bfaeab198dc7ab37f8c71c9e68bb5b',
|
|
98
|
-
HASH_TYPE: 'type',
|
|
99
|
-
TX_HASH: '0x1dbed8dcfe0f18359c65c5e9546fd15cd69de73ea0a502345be30180649c9467',
|
|
100
|
-
INDEX: '0x8',
|
|
101
|
-
DEP_TYPE: 'code',
|
|
102
|
-
},
|
|
103
|
-
ALWAYS_SUCCESS: {
|
|
104
|
-
CODE_HASH: '0xbb4469004225b39e983929db71fe2253cba1d49a76223e9e1d212cdca1f79f28',
|
|
105
|
-
HASH_TYPE: 'type',
|
|
106
|
-
TX_HASH: '0x1dbed8dcfe0f18359c65c5e9546fd15cd69de73ea0a502345be30180649c9467',
|
|
107
|
-
INDEX: '0x9',
|
|
108
|
-
DEP_TYPE: 'code',
|
|
109
|
-
},
|
|
110
|
-
SPORE: {
|
|
111
|
-
CODE_HASH: '0x7e8bf78a62232caa2f5d47e691e8db1a90d05e93dc6828ad3cb935c01ec6d208',
|
|
112
|
-
HASH_TYPE: 'data1',
|
|
113
|
-
TX_HASH: '0x1dbed8dcfe0f18359c65c5e9546fd15cd69de73ea0a502345be30180649c9467',
|
|
114
|
-
INDEX: '0xa',
|
|
115
|
-
DEP_TYPE: 'code',
|
|
116
|
-
},
|
|
117
|
-
SPORE_CLUSTER: {
|
|
118
|
-
CODE_HASH: '0x7366a61534fa7c7e6225ecc0d828ea3b5366adec2b58206f2ee84995fe030075',
|
|
119
|
-
HASH_TYPE: 'data1',
|
|
120
|
-
TX_HASH: '0x1dbed8dcfe0f18359c65c5e9546fd15cd69de73ea0a502345be30180649c9467',
|
|
121
|
-
INDEX: '0xb',
|
|
122
|
-
DEP_TYPE: 'code',
|
|
123
|
-
},
|
|
124
|
-
SPORE_CLUSTER_AGENT: {
|
|
125
|
-
CODE_HASH: '0xc986099b41d79ca1b2a56ce5874bcda8175440a17298ea5e2bbc3897736b8c21',
|
|
126
|
-
HASH_TYPE: 'data1',
|
|
127
|
-
TX_HASH: '0x1dbed8dcfe0f18359c65c5e9546fd15cd69de73ea0a502345be30180649c9467',
|
|
128
|
-
INDEX: '0xc',
|
|
129
|
-
DEP_TYPE: 'code',
|
|
130
|
-
},
|
|
131
|
-
SPORE_CLUSTER_PROXY: {
|
|
132
|
-
CODE_HASH: '0xbe8b9ce3d05a32c4bb26fe71cd5fc1407ce91e3a8b9e8719be2ab072cef1454b',
|
|
133
|
-
HASH_TYPE: 'data1',
|
|
134
|
-
TX_HASH: '0x1dbed8dcfe0f18359c65c5e9546fd15cd69de73ea0a502345be30180649c9467',
|
|
135
|
-
INDEX: '0xd',
|
|
136
|
-
DEP_TYPE: 'code',
|
|
137
|
-
},
|
|
138
|
-
SPORE_LUA: {
|
|
139
|
-
CODE_HASH: '0x94a9b875911ace20f1f0d063a26495d14e4b04e32fd218261bb747f34e71ae47',
|
|
140
|
-
HASH_TYPE: 'data1',
|
|
141
|
-
TX_HASH: '0x1dbed8dcfe0f18359c65c5e9546fd15cd69de73ea0a502345be30180649c9467',
|
|
142
|
-
INDEX: '0xe',
|
|
143
|
-
DEP_TYPE: 'code',
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
} as config.Config;
|
|
147
|
-
// ---end of devnet lumos config---
|
|
148
|
-
// ---testnet lumos config---
|
|
149
|
-
const testnetLumosConfig: config.Config = { ...config.TESTNET, ...{} } as config.Config;
|
|
150
|
-
// ---end of testnet lumos config---
|
|
151
|
-
// ---mainnet lumos config---
|
|
152
|
-
const mainnetLumosConfig: config.Config = { ...config.MAINNET, ...{} } as config.Config;
|
|
153
|
-
// ---end of mainnet lumos config---
|
|
154
|
-
|
|
155
|
-
const offCKBConfig: OffCKBConfig = {
|
|
156
|
-
version: 'update-me-offckb-config-version',
|
|
157
|
-
lumosVersion: '0.23.0',
|
|
158
|
-
contractBinFolder: '../build/release',
|
|
159
|
-
networks: {
|
|
160
|
-
devnet: {
|
|
161
|
-
lumosConfig,
|
|
162
|
-
rpc_url: 'http://127.0.0.1:8114',
|
|
163
|
-
rpc: new RPC('http://127.0.0.1:8114'),
|
|
164
|
-
indexer: new Indexer('http://127.0.0.1:8114'),
|
|
165
|
-
addressPrefix: 'ckt',
|
|
166
|
-
},
|
|
167
|
-
testnet: {
|
|
168
|
-
lumosConfig: testnetLumosConfig,
|
|
169
|
-
rpc_url: 'https://testnet.ckb.dev/rpc',
|
|
170
|
-
rpc: new RPC('https://testnet.ckb.dev/rpc'),
|
|
171
|
-
indexer: new Indexer('https://testnet.ckb.dev/rpc'),
|
|
172
|
-
addressPrefix: 'ckt',
|
|
173
|
-
},
|
|
174
|
-
mainnet: {
|
|
175
|
-
lumosConfig: mainnetLumosConfig,
|
|
176
|
-
rpc_url: 'https://mainnet.ckb.dev/rpc',
|
|
177
|
-
rpc: new RPC('https://mainnet.ckb.dev/rpc'),
|
|
178
|
-
indexer: new Indexer('https://mainnet.ckb.dev/rpc'),
|
|
179
|
-
addressPrefix: 'ckb',
|
|
180
|
-
},
|
|
181
|
-
},
|
|
182
|
-
|
|
183
|
-
initializeLumosConfig() {
|
|
184
|
-
const network = readEnvNetwork();
|
|
185
|
-
const lumosConfig = this.networks[network].lumosConfig;
|
|
186
|
-
return config.initializeConfig(lumosConfig);
|
|
187
|
-
},
|
|
188
|
-
|
|
189
|
-
get currentNetwork() {
|
|
190
|
-
const network = readEnvNetwork();
|
|
191
|
-
return network;
|
|
192
|
-
},
|
|
193
|
-
|
|
194
|
-
get addressPrefix() {
|
|
195
|
-
const network = readEnvNetwork();
|
|
196
|
-
return this.networks[network].addressPrefix;
|
|
197
|
-
},
|
|
198
|
-
|
|
199
|
-
get rpcUrl() {
|
|
200
|
-
const network = readEnvNetwork();
|
|
201
|
-
return this.networks[network].rpc_url;
|
|
202
|
-
},
|
|
203
|
-
|
|
204
|
-
get rpc() {
|
|
205
|
-
const network = readEnvNetwork();
|
|
206
|
-
return this.networks[network].rpc;
|
|
207
|
-
},
|
|
208
|
-
|
|
209
|
-
get indexer() {
|
|
210
|
-
const network = readEnvNetwork();
|
|
211
|
-
return this.networks[network].indexer;
|
|
212
|
-
},
|
|
213
|
-
|
|
214
|
-
get lumosConfig() {
|
|
215
|
-
const network = readEnvNetwork();
|
|
216
|
-
return this.networks[network].lumosConfig;
|
|
217
|
-
},
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
export default offCKBConfig;
|
package/templates/template.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"name": "Remix-Vite Bare Templates",
|
|
4
|
-
"value": "remix-vite-template",
|
|
5
|
-
"description": "A full-stack template with Remix-vite and ckb-script-templates",
|
|
6
|
-
"tag": ["remix", "vite", "tailwindcss", "ckb-script-templates", "typescript", "rust"],
|
|
7
|
-
"author": "retric@cryptape.com"
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
"name": "Next.js Bare Templates",
|
|
11
|
-
"value": "next-js-template",
|
|
12
|
-
"description": "A full-stack template with Next.js framework and ckb-script-templates",
|
|
13
|
-
"tag": ["next.js", "tailwindcss", "ckb-script-templates", "typescript", "rust"],
|
|
14
|
-
"author": "retric@cryptape.com"
|
|
15
|
-
}
|
|
16
|
-
]
|
|
File without changes
|
|
File without changes
|