support passing ALT in marginTrade client fn

This commit is contained in:
tjs 2022-12-15 17:22:10 -05:00
parent 5c329f8800
commit 237ecd3847
1 changed files with 4 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import {
import { TOKEN_PROGRAM_ID } from '@solana/spl-token';
import {
AccountMeta,
AddressLookupTableAccount,
Cluster,
Keypair,
MemcmpFilter,
@ -2132,6 +2133,7 @@ export class MangoClient {
amountIn,
outputMintPk,
userDefinedInstructions,
userDefinedAlts = [],
// 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,
@ -2142,6 +2144,7 @@ export class MangoClient {
amountIn: number;
outputMintPk: PublicKey;
userDefinedInstructions: TransactionInstruction[];
userDefinedAlts: AddressLookupTableAccount[];
flashLoanType: FlashLoanType;
}): Promise<TransactionSignature> {
const inputBank: Bank = group.getFirstBankByMint(inputMintPk);
@ -2290,7 +2293,7 @@ export class MangoClient {
...userDefinedInstructions.filter((ix) => ix.keys.length > 2),
flashLoanEndIx,
],
group.addressLookupTablesList,
[...group.addressLookupTablesList, ...userDefinedAlts],
{
postSendTxCallback: this.postSendTxCallback,
},