@lavarage/sdk 6.0.0 → 6.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -2806,7 +2806,7 @@ var closeTradeV1 = (lavarageProgram, position, offer, jupInstruction, partnerFee
2806
2806
  }).instruction();
2807
2807
  let repaySolIx = null;
2808
2808
  let jupiterIxs = [];
2809
- if (jupInstruction.instructions == null) {
2809
+ if (jupInstruction.instructions == void 0) {
2810
2810
  repaySolIx = yield lavarageProgram.methods.tradingCloseRepaySol(new BN(jupInstruction.quoteResponse.outAmount), new BN(9997)).accountsStrict({
2811
2811
  nodeWallet: pool.account.nodeWallet,
2812
2812
  positionAccount: positionAccountPDA,
@@ -2921,7 +2921,7 @@ var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken
2921
2921
  }).instruction();
2922
2922
  let repaySolIx = null;
2923
2923
  let jupiterIxs = [];
2924
- if (jupInstruction.instructions == null) {
2924
+ if (jupInstruction.instructions == void 0) {
2925
2925
  repaySolIx = yield lavarageProgram.methods.tradingCloseRepaySol(new BN(jupInstruction.quoteResponse.outAmount), new BN(9997)).accountsStrict({
2926
2926
  nodeWallet: pool.account.nodeWallet,
2927
2927
  positionAccount: positionAccountPDA,
@@ -2961,10 +2961,10 @@ var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken
2961
2961
  }] : []).instruction();
2962
2962
  const { setupInstructions, swapInstruction: swapInstructionPayload, cleanupInstruction, addressLookupTableAddresses } = jupiterSellIx;
2963
2963
  jupiterIxs = [
2964
- ...setupInstructions.map(deserializeInstruction),
2965
- deserializeInstruction(swapInstructionPayload),
2966
- deserializeInstruction(cleanupInstruction)
2967
- ];
2964
+ ...setupInstructions.filter((i) => !!i).map(deserializeInstruction),
2965
+ swapInstructionPayload ? deserializeInstruction(swapInstructionPayload) : null,
2966
+ cleanupInstruction ? deserializeInstruction(cleanupInstruction) : null
2967
+ ].filter((i) => !!i);
2968
2968
  addressLookupTableAccounts.push(...yield getAddressLookupTableAccounts(addressLookupTableAddresses));
2969
2969
  }
2970
2970
  const profit = new BN(jupInstruction.quoteResponse.outAmount).sub(position.account.amount).sub(position.account.userPaid);