@@ -89,7 +89,7 @@ program
89
89
. option (
90
90
"-i, --is-active <true/false>" ,
91
91
"set the isActive field to this value" ,
92
- true
92
+ " true"
93
93
)
94
94
. action ( async ( options ) => {
95
95
const squad = await getSquadsClient (
@@ -99,7 +99,8 @@ program
99
99
options . ledgerDerivationChange ,
100
100
options . wallet
101
101
) ;
102
- const msAccount = await squad . getMultisig ( options . vaultAddress ) ;
102
+ const msAccount = await squad . getMultisig ( new PublicKey ( options . vaultAddress ) ) ;
103
+
103
104
const vaultAuthority = squad . getAuthorityPDA (
104
105
msAccount . publicKey ,
105
106
msAccount . authorityIndex
@@ -110,13 +111,23 @@ program
110
111
options . ledger ,
111
112
new PublicKey ( options . vaultAddress )
112
113
) ;
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
+
113
124
const squadIxs : SquadInstruction [ ] = [
114
125
{
115
126
instruction : await setIsActiveIx (
116
127
vaultAuthority ,
117
128
vaultAuthority ,
118
129
attesterProgramId ,
119
- options . active
130
+ isActive
120
131
) ,
121
132
} ,
122
133
] ;
@@ -282,10 +293,11 @@ async function setIsActiveIx(
282
293
attesterProgramId : PublicKey ,
283
294
isActive : boolean
284
295
) : Promise < TransactionInstruction > {
285
- const configKey = PublicKey . createProgramAddressSync (
296
+ const [ configKey , _bump ] = PublicKey . findProgramAddressSync (
286
297
[ Buffer . from ( "pyth2wormhole-config-v3" ) ] ,
287
298
attesterProgramId
288
299
) ;
300
+
289
301
const config : AccountMeta = {
290
302
pubkey : configKey ,
291
303
isSigner : false ,
@@ -303,7 +315,7 @@ async function setIsActiveIx(
303
315
isWritable : true ,
304
316
} ;
305
317
306
- const isActiveInt = isActive === true ? 1 : 0 ;
318
+ const isActiveInt = isActive ? 1 : 0 ;
307
319
// first byte is the isActive instruction, second byte is true/false
308
320
const data = Buffer . from ( [ 4 , isActiveInt ] ) ;
309
321
0 commit comments