@@ -108,6 +108,7 @@ const cli = Cli.create('mppx', {
108108 . array ( z . string ( ) )
109109 . optional ( )
110110 . describe ( 'Method-specific option (key=value, repeatable)' ) ,
111+ network : z . enum ( [ 'mainnet' , 'testnet' ] ) . optional ( ) . describe ( 'Tempo network' ) ,
111112 rpcUrl : z
112113 . string ( )
113114 . optional ( )
@@ -274,7 +275,11 @@ const cli = Cli.create('mppx', {
274275 if ( plugin ) {
275276 pluginResult = await plugin . setup ( {
276277 challenge,
277- options : { account : c . options . account , rpcUrl : c . options . rpcUrl } ,
278+ options : {
279+ account : c . options . account ,
280+ network : c . options . network ,
281+ rpcUrl : c . options . rpcUrl ,
282+ } ,
278283 methodOpts : parseMethodOpts ( c . options . methodOpt ) ,
279284 } )
280285 tokenSymbol = pluginResult . tokenSymbol
@@ -542,6 +547,7 @@ const account = Cli.create('account', {
542547 description : 'Create new account' ,
543548 options : z . object ( {
544549 account : z . string ( ) . optional ( ) . describe ( 'Account name (env: MPPX_ACCOUNT)' ) ,
550+ network : z . enum ( [ 'mainnet' , 'testnet' ] ) . optional ( ) . describe ( 'Tempo network' ) ,
545551 rpcUrl : z . string ( ) . optional ( ) . describe ( 'RPC endpoint (env: MPPX_RPC_URL)' ) ,
546552 } ) ,
547553 output : z . object ( { address : z . string ( ) , name : z . string ( ) } ) ,
@@ -587,8 +593,8 @@ const account = Cli.create('account', {
587593 const addrDisplay = explorerUrl
588594 ? link ( `${ explorerUrl } /address/${ acct . address } ` , acct . address )
589595 : acct . address
590- const rpcUrl = resolveRpcUrl ( c . options . rpcUrl )
591- resolveChain ( { rpcUrl } )
596+ const rpcUrl = resolveRpcUrl ( c . options . rpcUrl , { network : c . options . network } )
597+ resolveChain ( { network : c . options . network , rpcUrl } )
592598 . then ( ( chain ) => createClient ( { chain, transport : http ( rpcUrl ) } ) )
593599 . then ( ( client ) =>
594600 import ( 'viem/tempo' ) . then ( ( { Actions } ) =>
@@ -702,6 +708,7 @@ const account = Cli.create('account', {
702708 description : 'Fund account with testnet tokens' ,
703709 options : z . object ( {
704710 account : z . string ( ) . optional ( ) . describe ( 'Account name (env: MPPX_ACCOUNT)' ) ,
711+ network : z . enum ( [ 'mainnet' , 'testnet' ] ) . optional ( ) . describe ( 'Tempo network' ) ,
705712 rpcUrl : z . string ( ) . optional ( ) . describe ( 'RPC endpoint (env: MPPX_RPC_URL)' ) ,
706713 } ) ,
707714 output : z . object ( { account : z . string ( ) , chain : z . string ( ) , transactions : z . array ( z . string ( ) ) } ) ,
@@ -722,8 +729,8 @@ const account = Cli.create('account', {
722729 return c . error ( { code : 'ACCOUNT_NOT_FOUND' , message : 'No account found.' , exitCode : 69 } )
723730 }
724731 const acct = privateKeyToAccount ( key as `0x${string } `)
725- const rpcUrl = resolveRpcUrl ( c . options . rpcUrl )
726- const chain = await resolveChain ( { rpcUrl } )
732+ const rpcUrl = resolveRpcUrl ( c . options . rpcUrl , { network : c . options . network } )
733+ const chain = await resolveChain ( { network : c . options . network , rpcUrl } )
727734 const client = createClient ( { chain, transport : http ( rpcUrl ) } )
728735 if ( ! structured ) console . log ( `Funding "${ accountName } " on ${ chainName ( chain ) } ` )
729736 try {
@@ -852,6 +859,7 @@ const account = Cli.create('account', {
852859 description : 'View account address' ,
853860 options : z . object ( {
854861 account : z . string ( ) . optional ( ) . describe ( 'Account name (env: MPPX_ACCOUNT)' ) ,
862+ network : z . enum ( [ 'mainnet' , 'testnet' ] ) . optional ( ) . describe ( 'Tempo network' ) ,
855863 rpcUrl : z . string ( ) . optional ( ) . describe ( 'RPC endpoint (env: MPPX_RPC_URL)' ) ,
856864 } ) ,
857865 output : accountViewSchema ,
@@ -869,8 +877,8 @@ const account = Cli.create('account', {
869877 } )
870878 }
871879 const address = tempoEntry . wallet_address as Address
872- const rpcUrl = resolveRpcUrl ( c . options . rpcUrl )
873- const chain = await resolveChain ( { rpcUrl } )
880+ const rpcUrl = resolveRpcUrl ( c . options . rpcUrl , { network : c . options . network } )
881+ const chain = await resolveChain ( { network : c . options . network , rpcUrl } )
874882 const explorerUrl = chain . blockExplorers ?. default ?. url
875883 const addrDisplay = explorerUrl
876884 ? link ( `${ explorerUrl } /address/${ address } ` , address )
@@ -913,8 +921,8 @@ const account = Cli.create('account', {
913921 return c . error ( { code : 'ACCOUNT_NOT_FOUND' , message : 'No account found.' , exitCode : 69 } )
914922 }
915923 const acct = privateKeyToAccount ( key as `0x${string } `)
916- const rpcUrl = resolveRpcUrl ( c . options . rpcUrl )
917- const chain = await resolveChain ( { rpcUrl } )
924+ const rpcUrl = resolveRpcUrl ( c . options . rpcUrl , { network : c . options . network } )
925+ const chain = await resolveChain ( { network : c . options . network , rpcUrl } )
918926 const explorerUrl = chain . blockExplorers ?. default ?. url
919927 const addrDisplay = explorerUrl
920928 ? link ( `${ explorerUrl } /address/${ acct . address } ` , acct . address )
@@ -952,6 +960,7 @@ const sign = Cli.create('sign', {
952960 . array ( z . string ( ) )
953961 . optional ( )
954962 . describe ( 'Method-specific option (key=value, repeatable)' ) ,
963+ network : z . enum ( [ 'mainnet' , 'testnet' ] ) . optional ( ) . describe ( 'Tempo network' ) ,
955964 rpcUrl : z
956965 . string ( )
957966 . optional ( )
@@ -1029,7 +1038,11 @@ const sign = Cli.create('sign', {
10291038 if ( plugin ) {
10301039 const result = await plugin . setup ( {
10311040 challenge,
1032- options : { account : c . options . account , rpcUrl : c . options . rpcUrl } ,
1041+ options : {
1042+ account : c . options . account ,
1043+ network : c . options . network ,
1044+ rpcUrl : c . options . rpcUrl ,
1045+ } ,
10331046 methodOpts,
10341047 } )
10351048 if ( result . createCredential ) {
0 commit comments