@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.js CHANGED
@@ -2849,7 +2849,7 @@ var closeTradeV1 = (lavarageProgram, position, offer, jupInstruction, partnerFee
2849
2849
  }).instruction();
2850
2850
  let repaySolIx = null;
2851
2851
  let jupiterIxs = [];
2852
- if (jupInstruction.instructions == null) {
2852
+ if (jupInstruction.instructions == void 0) {
2853
2853
  repaySolIx = yield lavarageProgram.methods.tradingCloseRepaySol(new import_anchor.BN(jupInstruction.quoteResponse.outAmount), new import_anchor.BN(9997)).accountsStrict({
2854
2854
  nodeWallet: pool.account.nodeWallet,
2855
2855
  positionAccount: positionAccountPDA,
@@ -2964,7 +2964,7 @@ var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken
2964
2964
  }).instruction();
2965
2965
  let repaySolIx = null;
2966
2966
  let jupiterIxs = [];
2967
- if (jupInstruction.instructions == null) {
2967
+ if (jupInstruction.instructions == void 0) {
2968
2968
  repaySolIx = yield lavarageProgram.methods.tradingCloseRepaySol(new import_anchor.BN(jupInstruction.quoteResponse.outAmount), new import_anchor.BN(9997)).accountsStrict({
2969
2969
  nodeWallet: pool.account.nodeWallet,
2970
2970
  positionAccount: positionAccountPDA,
@@ -3004,10 +3004,10 @@ var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken
3004
3004
  }] : []).instruction();
3005
3005
  const { setupInstructions, swapInstruction: swapInstructionPayload, cleanupInstruction, addressLookupTableAddresses } = jupiterSellIx;
3006
3006
  jupiterIxs = [
3007
- ...setupInstructions.map(deserializeInstruction),
3008
- deserializeInstruction(swapInstructionPayload),
3009
- deserializeInstruction(cleanupInstruction)
3010
- ];
3007
+ ...setupInstructions.filter((i) => !!i).map(deserializeInstruction),
3008
+ swapInstructionPayload ? deserializeInstruction(swapInstructionPayload) : null,
3009
+ cleanupInstruction ? deserializeInstruction(cleanupInstruction) : null
3010
+ ].filter((i) => !!i);
3011
3011
  addressLookupTableAccounts.push(...yield getAddressLookupTableAccounts(addressLookupTableAddresses));
3012
3012
  }
3013
3013
  const profit = new import_anchor.BN(jupInstruction.quoteResponse.outAmount).sub(position.account.amount).sub(position.account.userPaid);