Skip to content

Commit

Permalink
fix: remove unused account fetch in swapWithPriceImpact
Browse files Browse the repository at this point in the history
  • Loading branch information
codewithgun committed Jan 3, 2025
1 parent d91573b commit 01ffd5a
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions ts-client/src/dlmm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3393,9 +3393,6 @@ export class DLMM {
priceImpact,
binArraysPubkey,
}: SwapWithPriceImpactParams): Promise<Transaction> {
const { tokenXMint, tokenYMint, reserveX, reserveY, activeId, oracle } =
await this.program.account.lbPair.fetch(lbPair);

const preInstructions: TransactionInstruction[] = [];
const postInstructions: Array<TransactionInstruction> = [];

Expand Down Expand Up @@ -3434,9 +3431,6 @@ export class DLMM {
closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
}

let swapForY = true;
if (outToken.equals(tokenXMint)) swapForY = false;

// TODO: needs some refinement in case binArray not yet initialized
const binArrays: AccountMeta[] = binArraysPubkey.map((pubkey) => {
return {
Expand All @@ -3454,10 +3448,10 @@ export class DLMM {
)
.accounts({
lbPair,
reserveX,
reserveY,
tokenXMint,
tokenYMint,
reserveX: this.lbPair.reserveX,
reserveY: this.lbPair.reserveY,
tokenXMint: this.lbPair.tokenXMint,
tokenYMint: this.lbPair.tokenYMint,
tokenXProgram: TOKEN_PROGRAM_ID,
tokenYProgram: TOKEN_PROGRAM_ID,
user,
Expand All @@ -3466,7 +3460,7 @@ export class DLMM {
binArrayBitmapExtension: this.binArrayBitmapExtension
? this.binArrayBitmapExtension.publicKey
: null,
oracle,
oracle: this.lbPair.oracle,
hostFeeIn: null,
})
.remainingAccounts(binArrays)
Expand Down

0 comments on commit 01ffd5a

Please sign in to comment.