Skip to content

Commit

Permalink
ts: sequence check ix
Browse files Browse the repository at this point in the history
Signed-off-by: microwavedcola1 <[email protected]>
  • Loading branch information
microwavedcola1 committed Jun 11, 2024
1 parent 9119cc7 commit 7843aaa
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ts/client/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3738,6 +3738,7 @@ export class MangoClient {
// margin trade is a general function
// set flash_loan_type to FlashLoanType.swap if you desire the transaction to be recorded as a swap
flashLoanType,
sequenceCheck = false,
}: {
group: Group;
mangoAccount: MangoAccount;
Expand All @@ -3747,6 +3748,7 @@ export class MangoClient {
userDefinedInstructions: TransactionInstruction[];
userDefinedAlts: AddressLookupTableAccount[];
flashLoanType: FlashLoanType;
sequenceCheck: boolean;
}): Promise<MangoSignatureStatus> {
const isDelegate = (
this.program.provider as AnchorProvider
Expand Down Expand Up @@ -3872,6 +3874,8 @@ export class MangoClient {
])
.instruction();

const sequenceCheckIx = await this.sequenceCheckIx(group, mangoAccount);

const flashLoanBeginIx = await this.program.methods
.flashLoanBegin([
toNative(amountIn, inputBank.mintDecimals),
Expand Down Expand Up @@ -3899,6 +3903,7 @@ export class MangoClient {
group,
[
...preInstructions,
...(sequenceCheck ? [sequenceCheckIx] : []),
flashLoanBeginIx,
...userDefinedInstructions,
flashLoanEndIx,
Expand Down

0 comments on commit 7843aaa

Please sign in to comment.