@@ -2906,7 +2906,7 @@ async function deploySui<N extends Network, C extends Chain>(
29062906 console . log ( "No wormhole state ID provided, will skip wormhole transceiver setup" ) ;
29072907 }
29082908
2909- // 4. Call setup::complete to initialize the NTT manager state
2909+ // 4. Call setup::complete_burning or setup::complete_locking to initialize the NTT manager state
29102910 const chainId = ch . config . chainId ; // Get numeric chain ID from config
29112911 const modeArg = mode === "locking" ? "Locking" : "Burning" ;
29122912
@@ -2915,23 +2915,46 @@ async function deploySui<N extends Network, C extends Chain>(
29152915 // Build the transaction using Sui SDK
29162916 const tx = new Transaction ( ) ;
29172917
2918- // Call setup::complete with simplified bool parameter
2919- console . log ( "Attempting to call setup::complete..." ) ;
2920- console . log ( "Package ID:" , nttPackageId ) ;
2921- console . log ( "Function target:" , `${ nttPackageId } ::setup::complete` ) ;
2922- console . log ( "Token type:" , token ) ;
2923- console . log ( "Mode (burning):" , mode === "burning" ) ;
2924-
2925- tx . moveCall ( {
2926- target : `${ nttPackageId } ::setup::complete` ,
2927- typeArguments : [ token ] , // Use the original token format
2928- arguments : [
2929- tx . object ( nttDeployerCapId ) ,
2930- tx . object ( nttUpgradeCapId ) ,
2931- tx . pure . u16 ( chainId ) ,
2932- tx . pure . bool ( mode === "burning" ) // Use actual mode from CLI parameter
2933- ] ,
2934- } ) ;
2918+ if ( mode === "burning" ) {
2919+ // Call setup::complete_burning (which now requires treasury cap)
2920+ console . log ( "Attempting to call setup::complete_burning..." ) ;
2921+ console . log ( "Package ID:" , nttPackageId ) ;
2922+ console . log ( "Function target:" , `${ nttPackageId } ::setup::complete_burning` ) ;
2923+ console . log ( "Token type:" , token ) ;
2924+
2925+ // For burning mode, we need to get the treasury cap for the token
2926+ // The treasury cap should be passed as a parameter or obtained from the token
2927+ // For now, we'll throw an error as burning mode requires additional setup
2928+ throw new Error ( "Burning mode deployment requires a treasury cap. This is not yet implemented in the CLI." ) ;
2929+
2930+ // TODO: Implement treasury cap handling for burning mode
2931+ // tx.moveCall({
2932+ // target: `${nttPackageId}::setup::complete_burning`,
2933+ // typeArguments: [token],
2934+ // arguments: [
2935+ // tx.object(nttDeployerCapId),
2936+ // tx.object(nttUpgradeCapId),
2937+ // tx.pure.u16(chainId),
2938+ // tx.object(treasuryCapId) // Need to obtain this
2939+ // ],
2940+ // });
2941+ } else {
2942+ // Call setup::complete_locking (note the typo in the contract function name)
2943+ console . log ( "Attempting to call setup::complete_locking..." ) ;
2944+ console . log ( "Package ID:" , nttPackageId ) ;
2945+ console . log ( "Function target:" , `${ nttPackageId } ::setup::complete_locking` ) ;
2946+ console . log ( "Token type:" , token ) ;
2947+
2948+ tx . moveCall ( {
2949+ target : `${ nttPackageId } ::setup::complete_locking` , // Note: function has typo in contract
2950+ typeArguments : [ token ] , // Use the original token format
2951+ arguments : [
2952+ tx . object ( nttDeployerCapId ) ,
2953+ tx . object ( nttUpgradeCapId ) ,
2954+ tx . pure . u16 ( chainId )
2955+ ] ,
2956+ } ) ;
2957+ }
29352958
29362959 // Set gas budget
29372960 tx . setGasBudget ( finalGasBudget ) ;
0 commit comments