@0xobelisk/sui-cli 1.2.0-pre.121 → 1.2.0-pre.123
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/dubhe.js +49 -49
- package/dist/dubhe.js.map +1 -1
- package/package.json +3 -3
- package/src/commands/convertJson.ts +11 -3
- package/src/commands/storeConfig.ts +1 -0
- package/src/utils/publishHandler.ts +6 -2
- package/src/utils/storeConfig.ts +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xobelisk/sui-cli",
|
|
3
|
-
"version": "1.2.0-pre.
|
|
3
|
+
"version": "1.2.0-pre.123",
|
|
4
4
|
"description": "Tookit for interacting with move eps framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sui",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"yargs": "^17.7.1",
|
|
48
48
|
"zod": "^3.22.3",
|
|
49
49
|
"zod-validation-error": "^1.3.0",
|
|
50
|
-
"@0xobelisk/sui-client": "1.2.0-pre.
|
|
51
|
-
"@0xobelisk/sui-common": "1.2.0-pre.
|
|
50
|
+
"@0xobelisk/sui-client": "1.2.0-pre.123",
|
|
51
|
+
"@0xobelisk/sui-common": "1.2.0-pre.123"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/cli-progress": "^3.11.5",
|
|
@@ -46,7 +46,7 @@ const commandModule: CommandModule<Options, Options> = {
|
|
|
46
46
|
'config-path': {
|
|
47
47
|
type: 'string',
|
|
48
48
|
default: 'dubhe.config.ts',
|
|
49
|
-
description: '
|
|
49
|
+
description: 'Path to the Dubhe config file'
|
|
50
50
|
},
|
|
51
51
|
'output-path': {
|
|
52
52
|
type: 'string',
|
|
@@ -63,7 +63,8 @@ const commandModule: CommandModule<Options, Options> = {
|
|
|
63
63
|
const schemaJson = JSON.parse(generateConfigJson(dubheConfig));
|
|
64
64
|
|
|
65
65
|
let existing: Record<string, unknown> = {};
|
|
66
|
-
|
|
66
|
+
const isUpdate = fs.existsSync(outputPath);
|
|
67
|
+
if (isUpdate) {
|
|
67
68
|
try {
|
|
68
69
|
existing = JSON.parse(fs.readFileSync(outputPath, 'utf-8'));
|
|
69
70
|
} catch {
|
|
@@ -72,10 +73,17 @@ const commandModule: CommandModule<Options, Options> = {
|
|
|
72
73
|
}
|
|
73
74
|
const merged = mergeConfigJsonRuntimeFields(schemaJson, existing);
|
|
74
75
|
|
|
76
|
+
// Log which runtime fields were preserved from the existing file
|
|
77
|
+
const preserved = RUNTIME_FIELDS.filter((f) => existing[f] !== undefined);
|
|
78
|
+
if (preserved.length > 0) {
|
|
79
|
+
console.log(chalk.gray(` preserved runtime fields: ${preserved.join(', ')}`));
|
|
80
|
+
}
|
|
81
|
+
|
|
75
82
|
fs.writeFileSync(outputPath, JSON.stringify(merged, null, 2));
|
|
83
|
+
console.log(chalk.green(`✅ ${isUpdate ? 'Updated' : 'Created'} ${outputPath}`));
|
|
76
84
|
} catch (error: any) {
|
|
77
85
|
console.error(chalk.red('Error executing convert json:'));
|
|
78
|
-
console.
|
|
86
|
+
if (error.message) console.error(error.message);
|
|
79
87
|
handlerExit(1);
|
|
80
88
|
}
|
|
81
89
|
handlerExit();
|
|
@@ -30,6 +30,7 @@ const commandModule: CommandModule<Options, Options> = {
|
|
|
30
30
|
},
|
|
31
31
|
'output-ts-path': {
|
|
32
32
|
type: 'string',
|
|
33
|
+
default: './deployment.ts',
|
|
33
34
|
desc: 'Specify the output path for the generated TypeScript configuration file (e.g., ./src/config/generated.ts)'
|
|
34
35
|
}
|
|
35
36
|
},
|
|
@@ -529,8 +529,12 @@ async function publishContract(
|
|
|
529
529
|
// When deploying the dubhe framework itself, the "original dubhe package ID" is
|
|
530
530
|
// the package we just published. For user packages, look up the well-known
|
|
531
531
|
// framework address for the target network from the client config.
|
|
532
|
-
|
|
533
|
-
|
|
532
|
+
// devnet has no fixed framework deployment so we skip this field.
|
|
533
|
+
if (dubheConfig.name === 'dubhe') {
|
|
534
|
+
config.original_dubhe_package_id = packageId;
|
|
535
|
+
} else if (network !== 'devnet') {
|
|
536
|
+
config.original_dubhe_package_id = await getOriginalDubhePackageId(network);
|
|
537
|
+
}
|
|
534
538
|
config.start_checkpoint = startCheckpoint;
|
|
535
539
|
// Canonical dapp_key type string: stable across upgrades, no "0x" prefix, padded to 64 hex chars.
|
|
536
540
|
// Matches the Move type_name::with_defining_ids<DappKey>().into_string() format.
|
package/src/utils/storeConfig.ts
CHANGED
|
@@ -23,17 +23,17 @@ async function storeConfig(
|
|
|
23
23
|
|
|
24
24
|
// Mirror getDubheDappHubId: for localnet the framework is deployed ephemerally so we
|
|
25
25
|
// read its package ID from src/dubhe/.history/sui_localnet/latest.json.
|
|
26
|
-
// For testnet/mainnet the
|
|
27
|
-
//
|
|
26
|
+
// For testnet/mainnet the hardcoded ID from @0xobelisk/sui-client defaultConfig is used.
|
|
27
|
+
// devnet has no fixed framework deployment, so frameworkPackageId stays undefined.
|
|
28
28
|
let frameworkPackageId: string | undefined;
|
|
29
|
-
if (network
|
|
29
|
+
if (network !== 'devnet') {
|
|
30
30
|
frameworkPackageId = await getOriginalDubhePackageId(network);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
const frameworkIdLine =
|
|
34
34
|
frameworkPackageId !== undefined
|
|
35
35
|
? `\n// Published package ID of the dubhe framework — required for proxy operations.\nexport const FrameworkPackageId: string | undefined = '${frameworkPackageId}';\n`
|
|
36
|
-
: `\n// Published package ID of the dubhe framework — required for proxy operations.\n//
|
|
36
|
+
: `\n// Published package ID of the dubhe framework — required for proxy operations.\n// Not available for devnet (no fixed framework deployment).\nexport const FrameworkPackageId: string | undefined = undefined;\n`;
|
|
37
37
|
|
|
38
38
|
const dappKey = buildDappKey(originalPackageId);
|
|
39
39
|
|