@@ -89,7 +89,7 @@ program
8989 . option (
9090 "-i, --is-active <true/false>" ,
9191 "set the isActive field to this value" ,
92- true
92+ " true"
9393 )
9494 . action ( async ( options ) => {
9595 const squad = await getSquadsClient (
@@ -99,7 +99,8 @@ program
9999 options . ledgerDerivationChange ,
100100 options . wallet
101101 ) ;
102- const msAccount = await squad . getMultisig ( options . vaultAddress ) ;
102+ const msAccount = await squad . getMultisig ( new PublicKey ( options . vaultAddress ) ) ;
103+
103104 const vaultAuthority = squad . getAuthorityPDA (
104105 msAccount . publicKey ,
105106 msAccount . authorityIndex
@@ -110,13 +111,23 @@ program
110111 options . ledger ,
111112 new PublicKey ( options . vaultAddress )
112113 ) ;
114+
115+ let isActive = undefined ;
116+ if ( options . isActive === 'true' ) {
117+ isActive = true ;
118+ } else if ( options . isActive === 'false' ) {
119+ isActive = false ;
120+ } else {
121+ throw new Error ( `Illegal argument for --is-active. Expected "true" or "false", got "${ options . isActive } "` )
122+ }
123+
113124 const squadIxs : SquadInstruction [ ] = [
114125 {
115126 instruction : await setIsActiveIx (
116127 vaultAuthority ,
117128 vaultAuthority ,
118129 attesterProgramId ,
119- options . active
130+ isActive
120131 ) ,
121132 } ,
122133 ] ;
@@ -282,10 +293,11 @@ async function setIsActiveIx(
282293 attesterProgramId : PublicKey ,
283294 isActive : boolean
284295) : Promise < TransactionInstruction > {
285- const configKey = PublicKey . createProgramAddressSync (
296+ const [ configKey , _bump ] = PublicKey . findProgramAddressSync (
286297 [ Buffer . from ( "pyth2wormhole-config-v3" ) ] ,
287298 attesterProgramId
288299 ) ;
300+
289301 const config : AccountMeta = {
290302 pubkey : configKey ,
291303 isSigner : false ,
@@ -303,7 +315,7 @@ async function setIsActiveIx(
303315 isWritable : true ,
304316 } ;
305317
306- const isActiveInt = isActive === true ? 1 : 0 ;
318+ const isActiveInt = isActive ? 1 : 0 ;
307319 // first byte is the isActive instruction, second byte is true/false
308320 const data = Buffer . from ( [ 4 , isActiveInt ] ) ;
309321
0 commit comments