combined fees and pnl settle tx

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2023-03-30 10:30:15 +02:00
parent 1d8569b2cd
commit 612595b246
1 changed files with 26 additions and 0 deletions

View File

@ -2341,6 +2341,32 @@ export class MangoClient {
.instruction();
}
async perpSettlePnlAndFees(
group: Group,
profitableAccount: MangoAccount,
unprofitableAccount: MangoAccount,
accountToSettleFeesFor: MangoAccount,
settler: MangoAccount,
perpMarketIndex: PerpMarketIndex,
maxSettleAmount?: number,
): Promise<TransactionSignature> {
return await this.sendAndConfirmTransactionForGroup(group, [
await this.perpSettlePnlIx(
group,
profitableAccount,
unprofitableAccount,
settler,
perpMarketIndex,
),
await this.perpSettleFeesIx(
group,
accountToSettleFeesFor,
perpMarketIndex,
maxSettleAmount,
),
]);
}
async perpSettlePnl(
group: Group,
profitableAccount: MangoAccount,