@@ -20,6 +20,7 @@ import readline from "readline";
2020import { ChainContext , UniversalAddress , Wormhole , assertChain , canonicalAddress , chainToPlatform , chains , isNetwork , networks , platforms , signSendWait , toUniversal , type AccountAddress , type Chain , type ChainAddress , type Network , type Platform } from "@wormhole-foundation/sdk" ;
2121import "@wormhole-foundation/sdk-evm-ntt" ;
2222import "@wormhole-foundation/sdk-solana-ntt" ;
23+ import "@wormhole-foundation/sdk-sui-ntt" ;
2324import "@wormhole-foundation/sdk-definitions-ntt" ;
2425import type { Ntt , NttTransceiver } from "@wormhole-foundation/sdk-definitions-ntt" ;
2526
@@ -335,6 +336,16 @@ yargs(hideBin(process.argv))
335336 type : "number" ,
336337 default : 50000 ,
337338 } )
339+ . option ( "sui-gas-budget" , {
340+ describe : "Gas budget for Sui deployment" ,
341+ type : "number" ,
342+ default : 100000000 ,
343+ } )
344+ . option ( "sui-package-path" , {
345+ describe : "Path to Sui Move package directory (relative to project root)" ,
346+ type : "string" ,
347+ default : "sui" ,
348+ } )
338349 . option ( "signer-type" , options . signerType )
339350 . option ( "skip-verify" , options . skipVerify )
340351 . option ( "ver" , options . version )
@@ -385,11 +396,11 @@ yargs(hideBin(process.argv))
385396 // let's deploy
386397
387398 // TODO: factor out to function to get chain context
388- const wh = new Wormhole ( network , [ solana . Platform , evm . Platform ] , overrides ) ;
399+ const wh = new Wormhole ( network , [ solana . Platform , evm . Platform ] , overrides ) ; // TODO: Add sui.Platform
389400 const ch = wh . getChain ( chain ) ;
390401
391402 // TODO: make manager configurable
392- const deployedManager = await deploy ( version , mode , ch , token , signerType , ! argv [ "skip-verify" ] , argv [ "yes" ] , argv [ "payer" ] , argv [ "program-key" ] , argv [ "binary" ] , argv [ "solana-priority-fee" ] ) ;
403+ const deployedManager = await deploy ( version , mode , ch , token , signerType , ! argv [ "skip-verify" ] , argv [ "yes" ] , argv [ "payer" ] , argv [ "program-key" ] , argv [ "binary" ] , argv [ "solana-priority-fee" ] , argv [ "sui-gas-budget" ] , argv [ "sui-package-path" ] ) ;
393404
394405 const [ config , _ctx , _ntt , decimals ] =
395406 await pullChainConfig ( network , deployedManager , overrides ) ;
@@ -463,7 +474,7 @@ yargs(hideBin(process.argv))
463474 await askForConfirmation ( ) ;
464475 }
465476
466- const wh = new Wormhole ( network , [ solana . Platform , evm . Platform ] , overrides ) ;
477+ const wh = new Wormhole ( network , [ solana . Platform , evm . Platform ] , overrides ) ; // TODO: Add sui.Platform
467478 const ch = wh . getChain ( chain ) ;
468479
469480 const [ _ , ctx , ntt ] = await pullChainConfig (
@@ -1459,7 +1470,9 @@ async function deploy<N extends Network, C extends Chain>(
14591470 solanaPayer ?: string ,
14601471 solanaProgramKeyPath ?: string ,
14611472 solanaBinaryPath ?: string ,
1462- solanaPriorityFee ?: number
1473+ solanaPriorityFee ?: number ,
1474+ suiGasBudget ?: number ,
1475+ suiPackagePath ?: string
14631476) : Promise < ChainAddress < C > > {
14641477 if ( version === null ) {
14651478 await warnLocalDeployment ( yes ) ;
@@ -1476,6 +1489,9 @@ async function deploy<N extends Network, C extends Chain>(
14761489 }
14771490 const solanaCtx = ch as ChainContext < N , SolanaChains > ;
14781491 return await deploySolana ( worktree , version , mode , solanaCtx , token , solanaPayer , true , solanaProgramKeyPath , solanaBinaryPath , solanaPriorityFee ) as ChainAddress < C > ;
1492+ case "Sui" :
1493+ const suiCtx = ch as ChainContext < N , Chain > ; // TODO: Use proper SuiChains type
1494+ return await deploySui ( worktree , version , mode , suiCtx , token , signerType , true , evmVerify , suiGasBudget , suiPackagePath ) as ChainAddress < C > ;
14791495 default :
14801496 throw new Error ( "Unsupported platform" ) ;
14811497 }
@@ -1826,6 +1842,56 @@ async function deploySolana<N extends Network, C extends SolanaChains>(
18261842 return { chain : ch . chain , address : toUniversal ( ch . chain , providedProgramId ) } ;
18271843}
18281844
1845+ async function deploySui < N extends Network , C extends Chain > (
1846+ pwd : string ,
1847+ version : string | null ,
1848+ mode : Ntt . Mode ,
1849+ ch : ChainContext < N , C > ,
1850+ token : string ,
1851+ signerType : SignerType ,
1852+ initialize : boolean ,
1853+ skipVerify ?: boolean ,
1854+ gasBudget ?: number ,
1855+ packagePath ?: string
1856+ ) : Promise < ChainAddress < C > > {
1857+ const finalPackagePath = packagePath || "sui" ;
1858+ const finalGasBudget = gasBudget || 100000000 ;
1859+
1860+ console . log ( `Deploying Sui NTT contracts in ${ mode } mode...` ) ;
1861+ console . log ( `Package path: ${ finalPackagePath } ` ) ;
1862+ console . log ( `Gas budget: ${ finalGasBudget } ` ) ;
1863+ console . log ( `Target chain: ${ ch . chain } ` ) ;
1864+ console . log ( `Token: ${ token } ` ) ;
1865+
1866+ // Build the Move packages
1867+ console . log ( "Building Move packages..." ) ;
1868+ try {
1869+ execSync ( `cd ${ pwd } /${ finalPackagePath } && sui move build` , { stdio : "inherit" } ) ;
1870+ } catch ( e ) {
1871+ console . error ( "Failed to build Move packages" ) ;
1872+ throw e ;
1873+ }
1874+
1875+ // TODO: Deploy the Move packages using sui client publish
1876+ // This is a placeholder implementation that shows the expected flow
1877+ console . log ( "TODO: Implement Sui package deployment" ) ;
1878+ console . log ( "Expected deployment steps:" ) ;
1879+ console . log ( "1. sui client publish --gas-budget " + finalGasBudget ) ;
1880+ console . log ( "2. Initialize NTT manager with token and mode" ) ;
1881+ console . log ( "3. Set up transceivers and configuration" ) ;
1882+ console . log ( "4. Return the deployed manager object ID" ) ;
1883+
1884+ // For now, return a placeholder address
1885+ // In a real implementation, this would:
1886+ // 1. Use sui client publish to deploy packages
1887+ // 2. Initialize the NTT manager with proper parameters
1888+ // 3. Return the actual manager address
1889+ const placeholderAddress = "0x0000000000000000000000000000000000000000000000000000000000000000" ;
1890+
1891+ console . log ( chalk . green ( "Deployment placeholder completed" ) ) ;
1892+ return { chain : ch . chain , address : toUniversal ( ch . chain , placeholderAddress ) } ;
1893+ }
1894+
18291895async function missingConfigs (
18301896 deps : Partial < { [ C in Chain ] : Deployment < Chain > } > ,
18311897 verbose : boolean ,
@@ -2092,7 +2158,7 @@ async function pullChainConfig<N extends Network, C extends Chain>(
20922158 manager : ChainAddress < C > ,
20932159 overrides ?: WormholeConfigOverrides < N >
20942160) : Promise < [ ChainConfig , ChainContext < typeof network , C > , Ntt < typeof network , C > , number ] > {
2095- const wh = new Wormhole ( network , [ solana . Platform , evm . Platform ] , overrides ) ;
2161+ const wh = new Wormhole ( network , [ solana . Platform , evm . Platform ] , overrides ) ; // TODO: Add sui.Platform
20962162 const ch = wh . getChain ( manager . chain ) ;
20972163
20982164 const nativeManagerAddress = canonicalAddress ( manager ) ;
0 commit comments