start of close

This commit is contained in:
Adrian Brzeziński 2023-01-12 22:34:48 +01:00
parent 4f0b4da26d
commit f5cb67fb3b
1 changed files with 22 additions and 0 deletions

View File

@ -829,6 +829,28 @@ export class MangoClient {
);
}
//withdraw all assets, close oo, deactivating perp positions, close account
public async totalCloseMangoAccount(
group: Group,
mangoAccount: MangoAccount,
forceClose = false,
): Promise<TransactionSignature> {
const ix = await this.program.methods
.accountClose(forceClose)
.accounts({
group: group.publicKey,
account: mangoAccount.publicKey,
owner: (this.program.provider as AnchorProvider).wallet.publicKey,
solDestination: mangoAccount.owner,
})
.instruction();
return await this.sendAndConfirmTransaction(
[ix],
group.addressLookupTablesList,
);
}
public async tokenDeposit(
group: Group,
mangoAccount: MangoAccount,