@0xobelisk/sui-cli 1.2.0-pre.4 → 1.2.0-pre.41

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xobelisk/sui-cli",
3
- "version": "1.2.0-pre.4",
3
+ "version": "1.2.0-pre.41",
4
4
  "description": "Tookit for interacting with move eps framework",
5
5
  "keywords": [
6
6
  "sui",
@@ -37,10 +37,13 @@
37
37
  "chalk": "^5.0.1",
38
38
  "child_process": "^1.0.2",
39
39
  "chokidar": "^3.5.3",
40
+ "cli-progress": "^3.12.0",
41
+ "cli-table3": "^0.6.5",
40
42
  "dotenv": "^16.0.3",
41
43
  "ejs": "^3.1.8",
42
44
  "execa": "^7.0.0",
43
45
  "glob": "^8.0.3",
46
+ "inquirer": "^9.2.15",
44
47
  "ora": "^5.4.1",
45
48
  "path": "^0.12.7",
46
49
  "sqlite": "^5.1.1",
@@ -50,12 +53,14 @@
50
53
  "yargs": "^17.7.1",
51
54
  "zod": "^3.22.3",
52
55
  "zod-validation-error": "^1.3.0",
53
- "@0xobelisk/sui-client": "1.2.0-pre.4",
54
- "@0xobelisk/sui-common": "1.2.0-pre.4"
56
+ "@0xobelisk/sui-client": "1.2.0-pre.41",
57
+ "@0xobelisk/sui-common": "1.2.0-pre.41"
55
58
  },
56
59
  "devDependencies": {
60
+ "@types/cli-progress": "^3.11.5",
57
61
  "@types/ejs": "^3.1.1",
58
62
  "@types/glob": "^7.2.0",
63
+ "@types/inquirer": "^9.0.7",
59
64
  "@types/node": "^18.15.11",
60
65
  "@types/yargs": "^17.0.10",
61
66
  "eslint": "^8.56.0",
@@ -1,5 +1,5 @@
1
1
  import type { CommandModule } from 'yargs';
2
- import { execSync } from 'child_process';
2
+ import { execSync, exec } from 'child_process';
3
3
  import chalk from 'chalk';
4
4
  import { DubheConfig, loadConfig } from '@0xobelisk/sui-common';
5
5
  import { switchEnv, updateDubheDependency } from '../utils';
@@ -44,7 +44,7 @@ const commandModule: CommandModule<Options, Options> = {
44
44
  console.log('🚀 Running move build');
45
45
  const dubheConfig = (await loadConfig(configPath)) as DubheConfig;
46
46
  const path = process.cwd();
47
- const projectPath = `${path}/contracts/${dubheConfig.name}`;
47
+ const projectPath = `${path}/src/${dubheConfig.name}`;
48
48
  await switchEnv(network);
49
49
  await updateDubheDependency(projectPath + '/Move.toml', network);
50
50
  const command = `sui move build --path ${projectPath} ${
@@ -52,6 +52,7 @@ const commandModule: CommandModule<Options, Options> = {
52
52
  }`;
53
53
  const output = execSync(command, { encoding: 'utf-8' });
54
54
  console.log(output);
55
+ exec(`pnpm dubhe convert-json --config-path ${configPath}`)
55
56
  } catch (error: any) {
56
57
  console.error(chalk.red('Error executing sui move build:'));
57
58
  console.log(error.stdout);
@@ -1,90 +1,90 @@
1
- import type { CommandModule } from 'yargs';
2
- import { logError } from '../utils/errors';
3
- import { callHandler } from '../utils';
4
- import { loadConfig, DubheConfig } from '@0xobelisk/sui-common';
1
+ // import type { CommandModule } from 'yargs';
2
+ // import { logError } from '../utils/errors';
3
+ // import { callHandler } from '../utils';
4
+ // import { loadConfig, DubheConfig } from '@0xobelisk/sui-common';
5
5
 
6
- type Options = {
7
- network: 'mainnet' | 'testnet' | 'devnet' | 'localnet';
8
- module: string;
9
- function: string;
10
- 'config-path'?: string;
11
- 'package-id'?: string;
12
- 'metadata-path'?: string;
13
- params?: any[];
14
- };
6
+ // type Options = {
7
+ // network: 'mainnet' | 'testnet' | 'devnet' | 'localnet';
8
+ // module: string;
9
+ // function: string;
10
+ // 'config-path'?: string;
11
+ // 'package-id'?: string;
12
+ // 'metadata-path'?: string;
13
+ // params?: any[];
14
+ // };
15
15
 
16
- /**
17
- * CLI command for calling a function in a module
18
- */
19
- const commandModule: CommandModule<Options, Options> = {
20
- command: 'call',
16
+ // /**
17
+ // * CLI command for calling a function in a module
18
+ // */
19
+ // const commandModule: CommandModule<Options, Options> = {
20
+ // command: 'call',
21
21
 
22
- describe: 'Call a function in a module',
22
+ // describe: 'Call a function in a module',
23
23
 
24
- builder: {
25
- network: {
26
- type: 'string',
27
- choices: ['mainnet', 'testnet', 'devnet', 'localnet'],
28
- desc: 'Node network (mainnet/testnet/devnet/localnet)',
29
- default: 'localnet'
30
- },
31
- module: {
32
- type: 'string',
33
- desc: 'Module name',
34
- demandOption: true
35
- },
36
- function: {
37
- type: 'string',
38
- desc: 'Function name',
39
- demandOption: true
40
- },
41
- 'config-path': {
42
- type: 'string',
43
- default: 'dubhe.config.ts',
44
- desc: 'Configuration file path'
45
- },
46
- 'package-id': {
47
- type: 'string',
48
- desc: 'Package ID (optional)'
49
- },
50
- 'metadata-path': {
51
- type: 'string',
52
- desc: 'Path to metadata JSON file (optional)'
53
- },
54
- params: {
55
- type: 'array',
56
- desc: 'Params for the function',
57
- string: true
58
- }
59
- },
24
+ // builder: {
25
+ // network: {
26
+ // type: 'string',
27
+ // choices: ['mainnet', 'testnet', 'devnet', 'localnet'],
28
+ // desc: 'Node network (mainnet/testnet/devnet/localnet)',
29
+ // default: 'localnet'
30
+ // },
31
+ // module: {
32
+ // type: 'string',
33
+ // desc: 'Module name',
34
+ // demandOption: true
35
+ // },
36
+ // function: {
37
+ // type: 'string',
38
+ // desc: 'Function name',
39
+ // demandOption: true
40
+ // },
41
+ // 'config-path': {
42
+ // type: 'string',
43
+ // default: 'dubhe.config.ts',
44
+ // desc: 'Configuration file path'
45
+ // },
46
+ // 'package-id': {
47
+ // type: 'string',
48
+ // desc: 'Package ID (optional)'
49
+ // },
50
+ // 'metadata-path': {
51
+ // type: 'string',
52
+ // desc: 'Path to metadata JSON file (optional)'
53
+ // },
54
+ // params: {
55
+ // type: 'array',
56
+ // desc: 'Params for the function',
57
+ // string: true
58
+ // }
59
+ // },
60
60
 
61
- async handler({
62
- network,
63
- 'config-path': configPath,
64
- module: moduleName,
65
- function: funcName,
66
- 'package-id': packageId,
67
- 'metadata-path': metadataPath,
68
- params
69
- }) {
70
- try {
71
- const dubheConfig = (await loadConfig(configPath)) as DubheConfig;
61
+ // async handler({
62
+ // network,
63
+ // 'config-path': configPath,
64
+ // module: moduleName,
65
+ // function: funcName,
66
+ // 'package-id': packageId,
67
+ // 'metadata-path': metadataPath,
68
+ // params
69
+ // }) {
70
+ // try {
71
+ // const dubheConfig = (await loadConfig(configPath)) as DubheConfig;
72
72
 
73
- await callHandler({
74
- dubheConfig,
75
- moduleName,
76
- funcName,
77
- network,
78
- packageId,
79
- metadataFilePath: metadataPath,
80
- params
81
- });
82
- } catch (error: any) {
83
- logError(error);
84
- process.exit(1);
85
- }
86
- process.exit(0);
87
- }
88
- };
73
+ // await callHandler({
74
+ // dubheConfig,
75
+ // moduleName,
76
+ // funcName,
77
+ // network,
78
+ // packageId,
79
+ // metadataFilePath: metadataPath,
80
+ // params
81
+ // });
82
+ // } catch (error: any) {
83
+ // logError(error);
84
+ // process.exit(1);
85
+ // }
86
+ // process.exit(0);
87
+ // }
88
+ // };
89
89
 
90
- export default commandModule;
90
+ // export default commandModule;
@@ -0,0 +1,49 @@
1
+ import type { CommandModule } from 'yargs';
2
+ import chalk from 'chalk';
3
+ import { DubheConfig, loadConfig } from '@0xobelisk/sui-common';
4
+ import { generateConfigJson } from '../utils';
5
+ import fs from 'fs';
6
+
7
+ type Options = {
8
+ 'config-path': string;
9
+ 'output-path': string;
10
+ };
11
+
12
+ const commandModule: CommandModule<Options, Options> = {
13
+ command: 'convert-json',
14
+ describe: 'Convert JSON from Dubhe config to config.json',
15
+ builder(yargs) {
16
+ return yargs.options({
17
+ 'config-path': {
18
+ type: 'string',
19
+ default: 'dubhe.config.ts',
20
+ description: 'Options to pass to forge test'
21
+ },
22
+ 'output-path': {
23
+ type: 'string',
24
+ default: 'dubhe.config.json',
25
+ description: 'Output path for the config.json file'
26
+ }
27
+ });
28
+ },
29
+
30
+ async handler({
31
+ 'config-path': configPath,
32
+ 'output-path': outputPath
33
+ }) {
34
+ // Start an internal anvil process if no world address is provided
35
+ try {
36
+ console.log('🚀 Running convert json');
37
+ const dubheConfig = (await loadConfig(configPath)) as DubheConfig;
38
+ const json = generateConfigJson(dubheConfig);
39
+ // write to file
40
+ fs.writeFileSync(outputPath, json);
41
+ } catch (error: any) {
42
+ console.error(chalk.red('Error executing convert json:'));
43
+ console.log(error.stdout);
44
+ process.exit(0);
45
+ }
46
+ }
47
+ };
48
+
49
+ export default commandModule;