@lavarage/sdk 6.4.5 → 6.4.6

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
@@ -3160,7 +3160,7 @@ var partialRepayV2 = (lavarageProgram, position, repaymentBps) => __async(void 0
3160
3160
  return new import_web3.VersionedTransaction(messageV0);
3161
3161
  });
3162
3162
  var closeTradeV1 = (lavarageProgram, position, offer, jupInstruction, partnerFeeRecipient, partnerFeeMarkup) => __async(void 0, null, function* () {
3163
- var _a;
3163
+ var _a, _b;
3164
3164
  let partnerFeeMarkupAsPkey;
3165
3165
  if (partnerFeeMarkup) {
3166
3166
  const feeBuffer = Buffer.alloc(8);
@@ -3268,8 +3268,16 @@ var closeTradeV1 = (lavarageProgram, position, offer, jupInstruction, partnerFee
3268
3268
  addressLookupTableAccounts.push(...yield getAddressLookupTableAccounts(["5LEAB3owNUSKvECm7vkr58tDtQpzbngQ2NYpc7qmRFdi", ...addressLookupTableAddresses]));
3269
3269
  }
3270
3270
  const profit = new import_anchor.BN(jupInstruction.quoteResponse.outAmount).sub(position.account.amount).sub(position.account.userPaid);
3271
+ let createAssociatedTokenAccountInstruction2 = (0, import_spl_token.createAssociatedTokenAccountIdempotentInstruction)(
3272
+ lavarageProgram.provider.publicKey,
3273
+ toTokenAccount.account.address,
3274
+ lavarageProgram.provider.publicKey,
3275
+ offer.account.collateralType,
3276
+ tokenProgram
3277
+ );
3271
3278
  const allInstructions = [
3272
- ((_a = jupInstruction.instructions) == null ? void 0 : _a.tokenLedgerInstruction) ? deserializeInstruction(jupInstruction.instructions.tokenLedgerInstruction) : null,
3279
+ ((_a = jupInstruction.instructions) == null ? void 0 : _a.tokenLedgerInstruction) ? createAssociatedTokenAccountInstruction2 : null,
3280
+ ((_b = jupInstruction.instructions) == null ? void 0 : _b.tokenLedgerInstruction) ? deserializeInstruction(jupInstruction.instructions.tokenLedgerInstruction) : null,
3273
3281
  toTokenAccount.instruction,
3274
3282
  closePositionIx,
3275
3283
  ...jupiterIxs,
@@ -3284,7 +3292,7 @@ var closeTradeV1 = (lavarageProgram, position, offer, jupInstruction, partnerFee
3284
3292
  return tx;
3285
3293
  });
3286
3294
  var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken, partnerFeeRecipient, partnerFeeMarkup) => __async(void 0, null, function* () {
3287
- var _a;
3295
+ var _a, _b;
3288
3296
  let partnerFeeMarkupAsPkey;
3289
3297
  if (partnerFeeMarkup) {
3290
3298
  const feeBuffer = Buffer.alloc(8);
@@ -3402,8 +3410,16 @@ var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken
3402
3410
  addressLookupTableAccounts.push(...yield getAddressLookupTableAccounts([...addressLookupTableAddresses, getQuoteCurrencySpecificAddressLookupTable(quoteToken.toBase58()), "5LEAB3owNUSKvECm7vkr58tDtQpzbngQ2NYpc7qmRFdi"]));
3403
3411
  }
3404
3412
  const profit = new import_anchor.BN(jupInstruction.quoteResponse.outAmount).sub(position.account.amount).sub(position.account.userPaid);
3413
+ let createAssociatedTokenAccountInstruction2 = (0, import_spl_token.createAssociatedTokenAccountIdempotentInstruction)(
3414
+ lavarageProgram.provider.publicKey,
3415
+ toTokenAccount.account.address,
3416
+ lavarageProgram.provider.publicKey,
3417
+ offer.account.collateralType,
3418
+ tokenProgram
3419
+ );
3405
3420
  const allInstructions = [
3406
- ((_a = jupInstruction.instructions) == null ? void 0 : _a.tokenLedgerInstruction) ? deserializeInstruction(jupInstruction.instructions.tokenLedgerInstruction) : null,
3421
+ ((_a = jupInstruction.instructions) == null ? void 0 : _a.tokenLedgerInstruction) ? createAssociatedTokenAccountInstruction2 : null,
3422
+ ((_b = jupInstruction.instructions) == null ? void 0 : _b.tokenLedgerInstruction) ? deserializeInstruction(jupInstruction.instructions.tokenLedgerInstruction) : null,
3407
3423
  toTokenAccount.instruction,
3408
3424
  closePositionIx,
3409
3425
  ...jupiterIxs,