@0xobelisk/sui-cli 1.2.0-pre.2 → 1.2.0-pre.21

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.2",
3
+ "version": "1.2.0-pre.21",
4
4
  "description": "Tookit for interacting with move eps framework",
5
5
  "keywords": [
6
6
  "sui",
@@ -50,8 +50,8 @@
50
50
  "yargs": "^17.7.1",
51
51
  "zod": "^3.22.3",
52
52
  "zod-validation-error": "^1.3.0",
53
- "@0xobelisk/sui-client": "1.2.0-pre.2",
54
- "@0xobelisk/sui-common": "1.2.0-pre.2"
53
+ "@0xobelisk/sui-client": "1.2.0-pre.21",
54
+ "@0xobelisk/sui-common": "1.2.0-pre.21"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@types/ejs": "^3.1.1",
@@ -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} ${
@@ -15,6 +15,8 @@ import query from './query';
15
15
  import call from './call';
16
16
  import watch from './watch';
17
17
  import wait from './wait';
18
+ import switchEnv from './switchEnv';
19
+ import info from './info';
18
20
 
19
21
  // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Each command has different options
20
22
  export const commands: CommandModule<any, any>[] = [
@@ -32,5 +34,7 @@ export const commands: CommandModule<any, any>[] = [
32
34
  checkBalance,
33
35
  configStore,
34
36
  watch,
35
- wait
37
+ wait,
38
+ switchEnv,
39
+ info
36
40
  ];
@@ -0,0 +1,49 @@
1
+ import { CommandModule } from 'yargs';
2
+ import { logError, initializeDubhe } from '../utils';
3
+ import dotenv from 'dotenv';
4
+ import chalk from 'chalk';
5
+ dotenv.config();
6
+
7
+ type Options = {
8
+ network: any;
9
+ };
10
+
11
+ const InfoCommand: CommandModule<Options, Options> = {
12
+ command: 'info',
13
+ describe: 'Get information about the current Sui node',
14
+ builder(yargs) {
15
+ return yargs.options({
16
+ network: {
17
+ type: 'string',
18
+ choices: ['mainnet', 'testnet', 'devnet', 'localnet'],
19
+ default: 'localnet',
20
+ desc: 'Node network (mainnet/testnet/devnet/localnet)'
21
+ }
22
+ });
23
+ },
24
+ handler: async ({ network }) => {
25
+ try {
26
+ const dubhe = initializeDubhe({ network });
27
+ const keypair = dubhe.getSigner();
28
+
29
+ console.log(chalk.blue('Account Information:'));
30
+ console.log(` Network: ${chalk.green(network)}`);
31
+ console.log(` Address: ${chalk.green(keypair.toSuiAddress())}`);
32
+
33
+ try {
34
+ const balance = await dubhe.getBalance('0x2::sui::SUI');
35
+ const suiBalance = (Number(balance.totalBalance) / 10 ** 9).toFixed(4);
36
+ console.log(` Balance: ${chalk.green(suiBalance)} SUI`);
37
+ } catch (error) {
38
+ console.log(
39
+ ` Balance: ${chalk.red('Failed to fetch balance')} ${chalk.gray('(Network error)')}`
40
+ );
41
+ }
42
+ } catch (error) {
43
+ logError(error);
44
+ process.exit(1);
45
+ }
46
+ }
47
+ };
48
+
49
+ export default InfoCommand;
@@ -8,17 +8,11 @@ const commandModule: CommandModule = {
8
8
 
9
9
  builder(yargs) {
10
10
  return yargs
11
- .option('force-regenesis', {
12
- alias: 'f',
13
- type: 'boolean',
14
- description: 'Force regenesis the local node',
15
- default: true
16
- });
17
11
  },
18
12
 
19
- async handler(argv) {
13
+ async handler() {
20
14
  try {
21
- await startLocalNode({ forceRegenesis: argv['force-regenesis'] as boolean });
15
+ await startLocalNode();
22
16
  } catch (error) {
23
17
  console.error('Error executing command:', error);
24
18
  process.exit(1);
@@ -0,0 +1,24 @@
1
+ import type { CommandModule, ArgumentsCamelCase } from 'yargs';
2
+ import { switchEnv } from '../utils';
3
+
4
+ type Options = {
5
+ network: 'mainnet' | 'testnet' | 'devnet' | 'localnet';
6
+ };
7
+
8
+ const commandModule: CommandModule<Options, Options> = {
9
+ command: 'switch-env',
10
+ describe: 'Switch environment',
11
+ builder(yargs) {
12
+ return yargs.option('network', {
13
+ type: 'string',
14
+ choices: ['mainnet', 'testnet', 'devnet', 'localnet'] as const,
15
+ default: 'localnet',
16
+ desc: 'Switch to node network (mainnet/testnet/devnet/localnet)'
17
+ }) as any;
18
+ },
19
+ async handler(argv: ArgumentsCamelCase<Options>) {
20
+ await switchEnv(argv.network as 'mainnet' | 'testnet' | 'devnet' | 'localnet');
21
+ }
22
+ };
23
+
24
+ export default commandModule;
@@ -38,7 +38,7 @@ const commandModule: CommandModule<Options, Options> = {
38
38
  console.log('šŸš€ Running move test');
39
39
  const dubheConfig = (await loadConfig(configPath)) as DubheConfig;
40
40
  const path = process.cwd();
41
- const projectPath = `${path}/contracts/${dubheConfig.name}`;
41
+ const projectPath = `${path}/src/${dubheConfig.name}`;
42
42
  const command = `sui move test --path ${projectPath} ${
43
43
  test ? ` --test ${test}` : ''
44
44
  } --gas-limit ${gasLimit}`;
package/src/dubhe.ts CHANGED
@@ -16,11 +16,14 @@ yargs(hideBin(process.argv))
16
16
  // Use the commands directory to scaffold
17
17
  // eslint-disable-next-line @typescript-eslint/no-explicit-any -- command array overload isn't typed, see https://github.com/yargs/yargs/blob/main/docs/advanced.md#esm-hierarchy
18
18
  .command(commands as any)
19
+ .demandCommand(1, 'Please provide a command')
20
+ .recommendCommands()
19
21
  // Enable strict mode.
20
22
  .strict()
21
23
  // Custom error handler
22
- .fail((msg, err) => {
24
+ .fail((msg, err, yargsInstance) => {
23
25
  console.error(chalk.red(msg));
26
+
24
27
  if (msg.includes('Missing required argument')) {
25
28
  console.log(
26
29
  chalk.yellow(
@@ -28,9 +31,14 @@ yargs(hideBin(process.argv))
28
31
  )
29
32
  );
30
33
  }
31
- console.log('');
32
- logError(err);
33
- console.log('');
34
+
35
+ if (err) {
36
+ console.log('');
37
+ logError(err);
38
+ console.log('');
39
+ }
40
+
41
+ yargsInstance.showHelp();
34
42
 
35
43
  process.exit(1);
36
44
  })
@@ -92,7 +92,7 @@ export async function callHandler({
92
92
  metadataFilePath?: string;
93
93
  }) {
94
94
  const path = process.cwd();
95
- const projectPath = `${path}/contracts/${dubheConfig.name}`;
95
+ const projectPath = `${path}/src/${dubheConfig.name}`;
96
96
 
97
97
  packageId = packageId || (await getOldPackageId(projectPath, network));
98
98
 
@@ -369,6 +369,8 @@ async function publishContract(
369
369
  let schemas = dubheConfig.schemas;
370
370
  let upgradeCapId = '';
371
371
 
372
+ let printObjects: any[] = [];
373
+
372
374
  result.objectChanges!.map((object: ObjectChange) => {
373
375
  if (object.type === 'published') {
374
376
  console.log(` ā”œā”€ Package ID: ${object.packageId}`);
@@ -382,6 +384,9 @@ async function publishContract(
382
384
  console.log(` ā”œā”€ Upgrade Cap: ${object.objectId}`);
383
385
  upgradeCapId = object.objectId || '';
384
386
  }
387
+ if (object.type === 'created') {
388
+ printObjects.push(object);
389
+ }
385
390
  });
386
391
 
387
392
  console.log(` └─ Transaction: ${result.digest}`);
@@ -416,7 +421,7 @@ async function publishContract(
416
421
  console.log(' ā”œā”€ Hook execution successful');
417
422
  console.log(` ā”œā”€ Transaction: ${deployHookResult.digest}`);
418
423
 
419
- console.log('\nšŸ“‹ Created Schemas:');
424
+ console.log('\nšŸ“‹ Created Objects:');
420
425
  deployHookResult.objectChanges?.map((object: ObjectChange) => {
421
426
  if (
422
427
  object.type === 'created' &&
@@ -431,11 +436,15 @@ async function publishContract(
431
436
  object.objectType.includes('schema') &&
432
437
  !object.objectType.includes('dynamic_field')
433
438
  ) {
434
- console.log(` ā”œā”€ Type: ${object.objectType}`);
435
- console.log(` └─ ID: ${object.objectId}`);
439
+ printObjects.push(object);
436
440
  }
437
441
  });
438
442
 
443
+ printObjects.map((object: ObjectChange) => {
444
+ console.log(` ā”œā”€ Type: ${object.objectType}`);
445
+ console.log(` └─ ID: ${object.objectId}`);
446
+ });
447
+
439
448
  saveContractData(
440
449
  dubheConfig.name,
441
450
  network,
@@ -460,14 +469,14 @@ async function checkDubheFramework(projectPath: string): Promise<boolean> {
460
469
  console.log(chalk.yellow('\nā„¹ļø Dubhe Framework Files Not Found'));
461
470
  console.log(chalk.yellow(' ā”œā”€ Expected Path:'), projectPath);
462
471
  console.log(chalk.yellow(' ā”œā”€ To set up Dubhe Framework:'));
463
- console.log(chalk.yellow(' │ 1. Create directory: mkdir -p contracts/dubhe-framework'));
472
+ console.log(chalk.yellow(' │ 1. Create directory: mkdir -p contracts/dubhe'));
464
473
  console.log(
465
474
  chalk.yellow(
466
- ' │ 2. Clone repository: git clone https://github.com/0xobelisk/dubhe-framework contracts/dubhe-framework'
475
+ ' │ 2. Clone repository: git clone https://github.com/0xobelisk/dubhe contracts/dubhe'
467
476
  )
468
477
  );
469
478
  console.log(
470
- chalk.yellow(' │ 3. Or download from: https://github.com/0xobelisk/dubhe-framework')
479
+ chalk.yellow(' │ 3. Or download from: https://github.com/0xobelisk/dubhe')
471
480
  );
472
481
  console.log(chalk.yellow(' └─ After setup, restart the local node'));
473
482
  return false;
@@ -480,7 +489,7 @@ export async function publishDubheFramework(
480
489
  network: 'mainnet' | 'testnet' | 'devnet' | 'localnet'
481
490
  ) {
482
491
  const path = process.cwd();
483
- const projectPath = `${path}/contracts/dubhe-framework`;
492
+ const projectPath = `${path}/src/dubhe`;
484
493
 
485
494
  if (!(await checkDubheFramework(projectPath))) {
486
495
  return;
@@ -596,7 +605,7 @@ export async function publishDubheFramework(
596
605
  });
597
606
  }
598
607
 
599
- saveContractData('dubhe-framework', network, packageId, schemaId, upgradeCapId, version, schemas);
608
+ saveContractData('dubhe', network, packageId, schemaId, upgradeCapId, version, schemas);
600
609
 
601
610
  updateEnvFile(`${projectPath}/Move.lock`, network, 'publish', chainId, packageId);
602
611
  await delay(1000);
@@ -618,7 +627,7 @@ export async function publishHandler(
618
627
  }
619
628
 
620
629
  const path = process.cwd();
621
- const projectPath = `${path}/contracts/${dubheConfig.name}`;
630
+ const projectPath = `${path}/src/${dubheConfig.name}`;
622
631
  await updateDubheDependency(`${projectPath}/Move.toml`, network);
623
632
  await publishContract(dubhe, dubheConfig, network, projectPath, gasBudget);
624
633
  }
@@ -51,7 +51,7 @@ export async function queryStorage({
51
51
  metadataFilePath?: string;
52
52
  }) {
53
53
  const path = process.cwd();
54
- const projectPath = `${path}/contracts/${dubheConfig.name}`;
54
+ const projectPath = `${path}/src/${dubheConfig.name}`;
55
55
 
56
56
  packageId = packageId || (await getOldPackageId(projectPath, network));
57
57
 
@@ -1,8 +1,8 @@
1
1
  import { execSync, spawn } from 'child_process';
2
2
  import chalk from 'chalk';
3
3
  import { printDubhe } from './printDubhe';
4
- import { existsSync, mkdirSync, appendFileSync } from 'fs';
5
- import { join } from 'path';
4
+ import { delay, DubheCliError, validatePrivateKey } from '../utils';
5
+ import { Dubhe } from '@0xobelisk/sui-client';
6
6
 
7
7
  function isSuiStartRunning(): boolean {
8
8
  try {
@@ -22,37 +22,39 @@ function isSuiStartRunning(): boolean {
22
22
 
23
23
  async function printAccounts() {
24
24
  // These private keys are used for testing purposes only, do not use them in production.
25
- const accounts = [
26
- {
27
- privateKey: 'suiprivkey1qq3ez3dje66l8pypgxynr7yymwps6uhn7vyczespj84974j3zya0wdpu76v',
28
- address: '0xe7f93ad7493035bcd674f287f78526091e195a6df9d64f23def61a7ce3adada9'
29
- },
30
- {
31
- privateKey: 'suiprivkey1qp6vcyg8r2x88fllmjmxtpzjl95gd9dugqrgz7xxf50w6rqdqzetg7x4d7s',
32
- address: '0x492404a537c32b46610bd6ae9f7f16ba16ff5a607d272543fe86cada69d8cf44'
33
- },
34
- {
35
- privateKey: 'suiprivkey1qpy3a696eh3m55fwa8h38ss063459u4n2dm9t24w2hlxxzjp2x34q8sdsnc',
36
- address: '0xd27e203483700d837a462d159ced6104619d8e36f737bf2a20c251153bf39f24'
37
- },
38
- {
39
- privateKey: 'suiprivkey1qzxwp29favhzrjd95f6uj9nskjwal6nh9g509jpun395y6g72d6jqlmps4c',
40
- address: '0x018f1f175c9b6739a14bc9c81e7984c134ebf9031015cf796fefcef04b8c4990'
41
- },
42
- {
43
- privateKey: 'suiprivkey1qzhq4lv38sesah4uzsqkkmeyjx860xqjdz8qgw36tmrdd5tnle3evxpng57',
44
- address: '0x932f6aab2bc636a25374f99794dc8451c4e27c91e87083e301816ed08bc98ed0'
45
- },
46
- {
47
- privateKey: 'suiprivkey1qzez45sjjsepjgtksqvpq6jw7dzw3zq0dx7a4sulfypd73acaynw5jl9x2c',
48
- address: '0x9a66b2da3036badd22529e3de8a00b0cd7dbbfe589873aa03d5f885f5f8c6501'
49
- }
25
+ const privateKeys = [
26
+ 'suiprivkey1qq3ez3dje66l8pypgxynr7yymwps6uhn7vyczespj84974j3zya0wdpu76v',
27
+ 'suiprivkey1qp6vcyg8r2x88fllmjmxtpzjl95gd9dugqrgz7xxf50w6rqdqzetg7x4d7s',
28
+ 'suiprivkey1qpy3a696eh3m55fwa8h38ss063459u4n2dm9t24w2hlxxzjp2x34q8sdsnc',
29
+ 'suiprivkey1qzxwp29favhzrjd95f6uj9nskjwal6nh9g509jpun395y6g72d6jqlmps4c',
30
+ 'suiprivkey1qzhq4lv38sesah4uzsqkkmeyjx860xqjdz8qgw36tmrdd5tnle3evxpng57',
31
+ 'suiprivkey1qzez45sjjsepjgtksqvpq6jw7dzw3zq0dx7a4sulfypd73acaynw5jl9x2c'
50
32
  ];
51
33
  console.log('šŸ“Accounts');
52
34
  console.log('==========');
53
- accounts.forEach((account, index) => {
54
- console.log(` ā”Œā”€ Account #${index}: ${account.address}(100000 SUI)`);
55
- console.log(` └─ Private Key: ${account.privateKey}`);
35
+ privateKeys.forEach((privateKey, index) => {
36
+ const dubhe = new Dubhe({ secretKey: privateKey });
37
+ const keypair = dubhe.getSigner();
38
+ spawn(
39
+ 'curl',
40
+ [
41
+ '--location',
42
+ '--request',
43
+ 'POST',
44
+ 'http://127.0.0.1:9123/gas',
45
+ '--header',
46
+ 'Content-Type: application/json',
47
+ '--data-raw',
48
+ `{"FixedAmountRequest": {"recipient": "${keypair.toSuiAddress()}"}}`
49
+ ],
50
+ {
51
+ env: { ...process.env },
52
+ stdio: 'ignore',
53
+ detached: true
54
+ }
55
+ );
56
+ console.log(` ā”Œā”€ Account #${index}: ${keypair.toSuiAddress()}(1000 SUI)`);
57
+ console.log(` └─ Private Key: ${privateKey}`);
56
58
  });
57
59
  console.log('==========');
58
60
  console.log(
@@ -63,51 +65,6 @@ async function printAccounts() {
63
65
  );
64
66
  }
65
67
 
66
- async function setupDirectories() {
67
- const nodeLogsDir = join(process.cwd(), 'node_logs');
68
- const logsDir = join(nodeLogsDir, 'logs');
69
-
70
- if (!existsSync(nodeLogsDir)) {
71
- mkdirSync(nodeLogsDir, { recursive: true });
72
- }
73
-
74
- if (!existsSync(logsDir)) {
75
- mkdirSync(logsDir, { recursive: true });
76
- }
77
-
78
- return { nodeLogsDir, logsDir };
79
- }
80
-
81
- async function generateGenesisConfig(nodeLogsDir: string, logsDir: string) {
82
- console.log(' ā”œā”€ Generating genesis configuration...');
83
- execSync(`sui genesis --write-config ${join(nodeLogsDir, 'sui.yaml')}`);
84
-
85
- const additionalConfig = `
86
- - address: "0xe7f93ad7493035bcd674f287f78526091e195a6df9d64f23def61a7ce3adada9"
87
- gas_amounts:
88
- - 100000000000000
89
- - address: "0x492404a537c32b46610bd6ae9f7f16ba16ff5a607d272543fe86cada69d8cf44"
90
- gas_amounts:
91
- - 100000000000000
92
- - address: "0xd27e203483700d837a462d159ced6104619d8e36f737bf2a20c251153bf39f24"
93
- gas_amounts:
94
- - 100000000000000
95
- - address: "0x018f1f175c9b6739a14bc9c81e7984c134ebf9031015cf796fefcef04b8c4990"
96
- gas_amounts:
97
- - 100000000000000
98
- - address: "0x932f6aab2bc636a25374f99794dc8451c4e27c91e87083e301816ed08bc98ed0"
99
- gas_amounts:
100
- - 100000000000000
101
- - address: "0x9a66b2da3036badd22529e3de8a00b0cd7dbbfe589873aa03d5f885f5f8c6501"
102
- gas_amounts:
103
- - 100000000000000
104
- `;
105
- appendFileSync(join(nodeLogsDir, 'sui.yaml'), additionalConfig);
106
-
107
- console.log(' ā”œā”€ Initializing genesis...');
108
- execSync(`sui genesis --working-dir ${logsDir} -f --from-config ${join(nodeLogsDir, 'sui.yaml')}`);
109
- }
110
-
111
68
  function handleProcessSignals(suiProcess: ReturnType<typeof spawn> | null) {
112
69
  const cleanup = () => {
113
70
  console.log(chalk.yellow('\nšŸ”” Stopping Local Node...'));
@@ -121,7 +78,7 @@ function handleProcessSignals(suiProcess: ReturnType<typeof spawn> | null) {
121
78
  process.on('SIGTERM', cleanup);
122
79
  }
123
80
 
124
- export async function startLocalNode(options: { forceRegenesis?: boolean } = {}) {
81
+ export async function startLocalNode() {
125
82
  if (isSuiStartRunning()) {
126
83
  console.log(chalk.yellow('\nāš ļø Warning: Local Node Already Running'));
127
84
  console.log(chalk.yellow(' ā”œā”€ Cannot start a new instance'));
@@ -131,34 +88,35 @@ export async function startLocalNode(options: { forceRegenesis?: boolean } = {})
131
88
 
132
89
  printDubhe();
133
90
  console.log('šŸš€ Starting Local Node...');
134
-
135
91
  let suiProcess: ReturnType<typeof spawn> | null = null;
136
-
137
92
  try {
138
- const { nodeLogsDir, logsDir } = await setupDirectories();
93
+ suiProcess = spawn('sui', ['start', '--with-faucet', '--force-regenesis'], {
94
+ env: { ...process.env, RUST_LOG: 'off,sui_node=info' },
95
+ stdio: 'ignore'
96
+ });
139
97
 
140
- if (options.forceRegenesis) {
141
- console.log(' ā”œā”€ Force Regenesis: Yes');
142
- await generateGenesisConfig(nodeLogsDir, logsDir);
143
- } else {
144
- console.log(' ā”œā”€ Force Regenesis: No');
145
- }
146
-
98
+ suiProcess.on('error', (error) => {
99
+ console.error(chalk.red('\nāŒ Failed to Start Local Node'));
100
+ console.error(chalk.red(` └─ Error: ${error.message}`));
101
+ });
102
+ await delay(5000);
147
103
  console.log(' ā”œā”€ Faucet: Enabled');
104
+ console.log(' └─ Force Regenesis: Yes');
148
105
  console.log(' └─ HTTP server: http://127.0.0.1:9000/');
149
106
  console.log(' └─ Faucet server: http://127.0.0.1:9123/');
107
+
150
108
  await printAccounts();
151
- console.log(chalk.green('šŸŽ‰ Local environment is ready!'));
152
109
 
153
- suiProcess = spawn('sui', [
154
- 'start',
155
- '--with-faucet',
156
- '--network.config',
157
- join(logsDir, 'network.yaml')
158
- ], {
159
- env: { ...process.env, RUST_LOG: 'off,sui_node=info' },
160
- stdio: 'ignore'
161
- });
110
+ await delay(2000);
111
+
112
+ const privateKeyFormat = validatePrivateKey(
113
+ 'suiprivkey1qzez45sjjsepjgtksqvpq6jw7dzw3zq0dx7a4sulfypd73acaynw5jl9x2c'
114
+ );
115
+ if (privateKeyFormat === false) {
116
+ throw new DubheCliError(`Please check your privateKey.`);
117
+ }
118
+
119
+ console.log(chalk.green('šŸŽ‰ Local environment is ready!'));
162
120
 
163
121
  handleProcessSignals(suiProcess);
164
122
 
@@ -173,4 +131,4 @@ export async function startLocalNode(options: { forceRegenesis?: boolean } = {})
173
131
  }
174
132
  process.exit(1);
175
133
  }
176
- }
134
+ }
@@ -40,7 +40,7 @@ export async function storeConfigHandler(
40
40
  outputPath: string
41
41
  ) {
42
42
  const path = process.cwd();
43
- const contractPath = `${path}/contracts/${dubheConfig.name}`;
43
+ const contractPath = `${path}/src/${dubheConfig.name}`;
44
44
  const deployment = await getDeploymentJson(contractPath, network);
45
45
  await storeConfig(deployment.network, deployment.packageId, deployment.schemaId, outputPath);
46
46
  }
@@ -10,6 +10,7 @@ import {
10
10
  getOnchainSchemas,
11
11
  switchEnv,
12
12
  getSchemaId,
13
+ getDubheSchemaId,
13
14
  initializeDubhe
14
15
  } from './utils';
15
16
  import * as fs from 'fs';
@@ -96,7 +97,7 @@ export async function upgradeHandler(
96
97
  await switchEnv(network);
97
98
 
98
99
  const path = process.cwd();
99
- const projectPath = `${path}/contracts/${name}`;
100
+ const projectPath = `${path}/src/${name}`;
100
101
 
101
102
  const dubhe = initializeDubhe({
102
103
  network
@@ -131,7 +132,7 @@ export async function upgradeHandler(
131
132
  dependencies: extractedDependencies,
132
133
  digest: extractedDigest
133
134
  } = JSON.parse(
134
- execSync(`sui move build --dump-bytecode-as-base64 --path ${path}/contracts/${name}`, {
135
+ execSync(`sui move build --dump-bytecode-as-base64 --path ${path}/src/${name}`, {
135
136
  encoding: 'utf-8'
136
137
  })
137
138
  );
@@ -219,7 +220,7 @@ export async function upgradeHandler(
219
220
  const newVersion = oldVersion + 1;
220
221
  let args = [];
221
222
  if (name !== 'dubhe') {
222
- let dubheSchemaId = await getSchemaId(`${process.cwd()}/contracts/dubhe-framework`, network);
223
+ let dubheSchemaId = await getDubheSchemaId(network);
223
224
  args.push(migrateTx.object(dubheSchemaId));
224
225
  }
225
226
  args.push(migrateTx.object(schemaId));