Skip to content

Commit 663e058

Browse files
committed
small cli fixes
1 parent f2df20b commit 663e058

2 files changed

Lines changed: 19 additions & 15 deletions

File tree

cli/src/index.ts

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -491,15 +491,15 @@ yargs(hideBin(process.argv))
491491
.option("sui-gas-budget", {
492492
describe: "Gas budget for Sui deployment",
493493
type: "number",
494-
default: 100000000,
494+
default: 500000000,
495495
})
496496
.option("sui-package-path", {
497497
describe: "Path to Sui Move package directory (relative to project root)",
498498
type: "string",
499499
default: "sui",
500500
})
501501
.option("sui-wormhole-state", {
502-
describe: "Wormhole state object ID for Sui (required for wormhole transceiver setup)",
502+
describe: "Wormhole state object ID for Sui (optional, will lookup from SDK if not provided)",
503503
type: "string",
504504
})
505505
.option("sui-treasury-cap", {
@@ -2910,7 +2910,20 @@ async function deploySui<N extends Network, C extends Chain>(
29102910
wormholeStateObjectId = wormholeStateId;
29112911
console.log(`Using provided Wormhole State ID: ${wormholeStateObjectId}`);
29122912
} else {
2913-
console.log("No wormhole state ID provided, will skip wormhole transceiver setup");
2913+
// Try to get the Wormhole state from the SDK configuration
2914+
try {
2915+
console.log("No wormhole state ID provided, looking up from SDK configuration...");
2916+
const wormholeConfig = ch.config.contracts?.coreBridge;
2917+
if (wormholeConfig) {
2918+
wormholeStateObjectId = wormholeConfig;
2919+
console.log(`Using Wormhole State ID from SDK: ${wormholeStateObjectId}`);
2920+
} else {
2921+
console.log("No Wormhole core bridge contract found in SDK configuration, will skip wormhole transceiver setup");
2922+
}
2923+
} catch (error) {
2924+
console.log("Failed to lookup Wormhole state from SDK, will skip wormhole transceiver setup");
2925+
console.log("Error:", error instanceof Error ? error.message : String(error));
2926+
}
29142927
}
29152928

29162929
// 4. Call setup::complete_burning or setup::complete_locking to initialize the NTT manager state
@@ -3165,8 +3178,8 @@ async function deploySui<N extends Network, C extends Chain>(
31653178
throw error;
31663179
}
31673180
} else {
3168-
console.log("Skipping Wormhole Transceiver setup (no wormhole state ID provided)...");
3169-
console.log("Note: To use wormhole transceivers, provide --sui-wormhole-state parameter.");
3181+
console.log("Skipping Wormhole Transceiver setup (no wormhole state available)...");
3182+
console.log("Note: Wormhole state not found in SDK configuration. To manually specify, use --sui-wormhole-state parameter.");
31703183
}
31713184

31723185
console.log(chalk.green("Sui NTT deployment completed successfully!"));
@@ -3593,25 +3606,16 @@ async function nttFromManager<N extends Network, C extends Chain>(
35933606
ch: ChainContext<N, C>,
35943607
nativeManagerAddress: string,
35953608
): Promise<{ ntt: Ntt<N, C>; addresses: Partial<Ntt.Contracts> }> {
3596-
// For Sui, we need to set the token type to enable proper functionality
3597-
let token: string | null = null;
3598-
if (ch.chain === "Sui") {
3599-
// Extract the actual token type from the state object
3600-
token = await SuiNtt.extractTokenTypeFromSuiState(await ch.getRpc(), nativeManagerAddress);
3601-
}
3602-
36033609
const onlyManager = await ch.getProtocol("Ntt", {
36043610
ntt: {
36053611
manager: nativeManagerAddress,
3606-
token: token,
36073612
transceiver: {},
36083613
}
36093614
});
36103615
const diff = await onlyManager.verifyAddresses();
36113616

36123617
const addresses: Partial<Ntt.Contracts> = {
36133618
manager: nativeManagerAddress,
3614-
token: token || undefined,
36153619
...diff
36163620
};
36173621

sui/ts/src/ntt.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,7 @@ export class SuiNtt<N extends Network, C extends SuiChains> implements Ntt<N, C>
11591159

11601160
const result: Partial<Ntt.Contracts> = {
11611161
manager: this.contracts.ntt!["manager"],
1162-
token: this.contracts.ntt!["token"], // TODO: parse this from the state object generic parameter (that's the remote version)
1162+
token: await SuiNtt.extractTokenTypeFromSuiState(this.provider, this.contracts.ntt!["manager"]),
11631163
transceiver: {},
11641164
};
11651165

0 commit comments

Comments
 (0)