|
|
@@ -89,7 +89,7 @@ program
|
|
|
.option(
|
|
|
"-i, --is-active <true/false>",
|
|
|
"set the isActive field to this value",
|
|
|
- true
|
|
|
+ "true"
|
|
|
)
|
|
|
.action(async (options) => {
|
|
|
const squad = await getSquadsClient(
|
|
|
@@ -99,7 +99,8 @@ program
|
|
|
options.ledgerDerivationChange,
|
|
|
options.wallet
|
|
|
);
|
|
|
- const msAccount = await squad.getMultisig(options.vaultAddress);
|
|
|
+ const msAccount = await squad.getMultisig(new PublicKey(options.vaultAddress));
|
|
|
+
|
|
|
const vaultAuthority = squad.getAuthorityPDA(
|
|
|
msAccount.publicKey,
|
|
|
msAccount.authorityIndex
|
|
|
@@ -110,13 +111,23 @@ program
|
|
|
options.ledger,
|
|
|
new PublicKey(options.vaultAddress)
|
|
|
);
|
|
|
+
|
|
|
+ let isActive = undefined;
|
|
|
+ if (options.isActive === 'true') {
|
|
|
+ isActive = true;
|
|
|
+ } else if (options.isActive === 'false') {
|
|
|
+ isActive = false;
|
|
|
+ } else {
|
|
|
+ throw new Error(`Illegal argument for --is-active. Expected "true" or "false", got "${options.isActive}"`)
|
|
|
+ }
|
|
|
+
|
|
|
const squadIxs: SquadInstruction[] = [
|
|
|
{
|
|
|
instruction: await setIsActiveIx(
|
|
|
vaultAuthority,
|
|
|
vaultAuthority,
|
|
|
attesterProgramId,
|
|
|
- options.active
|
|
|
+ isActive
|
|
|
),
|
|
|
},
|
|
|
];
|
|
|
@@ -282,10 +293,11 @@ async function setIsActiveIx(
|
|
|
attesterProgramId: PublicKey,
|
|
|
isActive: boolean
|
|
|
): Promise<TransactionInstruction> {
|
|
|
- const configKey = PublicKey.createProgramAddressSync(
|
|
|
+ const [configKey, _bump] = PublicKey.findProgramAddressSync(
|
|
|
[Buffer.from("pyth2wormhole-config-v3")],
|
|
|
attesterProgramId
|
|
|
);
|
|
|
+
|
|
|
const config: AccountMeta = {
|
|
|
pubkey: configKey,
|
|
|
isSigner: false,
|
|
|
@@ -303,7 +315,7 @@ async function setIsActiveIx(
|
|
|
isWritable: true,
|
|
|
};
|
|
|
|
|
|
- const isActiveInt = isActive === true ? 1 : 0;
|
|
|
+ const isActiveInt = isActive ? 1 : 0;
|
|
|
// first byte is the isActive instruction, second byte is true/false
|
|
|
const data = Buffer.from([4, isActiveInt]);
|
|
|
|