small updates to token withdraw script

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2024-04-24 11:29:46 +02:00
parent 88451debed
commit f4c6a086c1
2 changed files with 5 additions and 11 deletions

View File

@ -38,16 +38,6 @@ async function forceWithdrawTokens(): Promise<void> {
const group = await client.getGroup(new PublicKey(GROUP_PK));
const forceWithdrawBank = group.getFirstBankByTokenIndex(TOKEN_INDEX);
if (forceWithdrawBank.reduceOnly != 2) {
throw new Error(
`Unexpected reduce only state ${forceWithdrawBank.reduceOnly}`,
);
}
if (!forceWithdrawBank.forceWithdraw) {
throw new Error(
`Unexpected force withdraw state ${forceWithdrawBank.forceWithdraw}`,
);
}
// Get all mango accounts with deposits for given token
const mangoAccountsWithDeposits = (

View File

@ -725,7 +725,11 @@ export class MangoClient {
vault: bank.vault,
oracle: bank.oracle,
ownerAtaTokenAccount,
alternateOwnerTokenAccount,
alternateOwnerTokenAccount: alternateOwnerTokenAccount.equals(
PublicKey.default,
)
? ownerAtaTokenAccount
: alternateOwnerTokenAccount,
})
.instruction();
return await this.sendAndConfirmTransactionForGroup(group, [