@lavarage/sdk 8.0.15 → 8.0.16

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.d.mts CHANGED
@@ -8814,7 +8814,7 @@ declare const borrowV2: (lavarageProgram: Program<Lavarage>, offer: ProgramAccou
8814
8814
  * @param computeBudgetMicroLamports - Optional compute budget for priority fees
8815
8815
  * @param platformFeeRecipient - Optional wallet to receive platform fees (jup, okx)
8816
8816
  * @param splitTransactions - Optional boolean to split the transaction into multiple transactions (jito bundle)
8817
- * @param discountBps - Optional discount basis points for the referral program
8817
+ * @param discountBps - Optional discount basis points for the referral program and discount program
8818
8818
  * @param referralBps - Optional referral basis points for the referral program
8819
8819
  * @param optionalRPCResults - Optional RPC results to use for the transaction (speeds up the transaction building)
8820
8820
  *
@@ -8883,7 +8883,7 @@ declare const openTradeV1: (lavarageProgram: Program<Lavarage$1>, offer: Program
8883
8883
  * @param computeBudgetMicroLamports - Optional compute budget for priority fees
8884
8884
  * @param platformFeeRecipient - Optional wallet to receive platform fees (jup, okx)
8885
8885
  * @param splitTransactions - Optional boolean to split the transaction into multiple transactions (jito bundle)
8886
- * @param discountBps - Optional discount basis points for the referral program
8886
+ * @param discountBps - Optional discount basis points for the referral program and discount program
8887
8887
  * @param referralBps - Optional referral basis points for the referral program
8888
8888
  * @param optionalRPCResults - Optional RPC results to use for the transaction (speeds up the transaction building)
8889
8889
  *
@@ -9126,7 +9126,7 @@ declare const partialRepayV2: (lavarageProgram: Program<Lavarage>, position: Pro
9126
9126
  * @param computeBudgetMicroLamports - Optional compute budget for priority fees
9127
9127
  * @param platformFeeRecipient - Optional wallet to receive platform fees (jup, okx)
9128
9128
  * @param splitTransactions - Optional boolean to split the transaction into multiple transactions (jito bundle)
9129
- * @param discountBps - Optional discount basis points for the referral program
9129
+ * @param discountBps - Optional discount basis points for the referral program and discount program
9130
9130
  * @param referralBps - Optional referral basis points for the referral program
9131
9131
  *
9132
9132
  * @returns Transaction to close the position
@@ -9184,7 +9184,7 @@ declare const closeTradeV1: (lavarageProgram: Program<Lavarage$1>, position: Pro
9184
9184
  * @param computeBudgetMicroLamports - Optional compute budget for priority fees
9185
9185
  * @param platformFeeRecipient - Optional wallet to receive platform fees (jup, okx)
9186
9186
  * @param splitTransactions - Optional boolean to split the transaction into multiple transactions (jito bundle)
9187
- * @param discountBps - Optional discount basis points for the referral program
9187
+ * @param discountBps - Optional discount basis points for the referral program and discount program
9188
9188
  * @param referralBps - Optional referral basis points for the referral program
9189
9189
  *
9190
9190
  * @returns Transaction to close the position
package/dist/index.d.ts CHANGED
@@ -8814,7 +8814,7 @@ declare const borrowV2: (lavarageProgram: Program<Lavarage>, offer: ProgramAccou
8814
8814
  * @param computeBudgetMicroLamports - Optional compute budget for priority fees
8815
8815
  * @param platformFeeRecipient - Optional wallet to receive platform fees (jup, okx)
8816
8816
  * @param splitTransactions - Optional boolean to split the transaction into multiple transactions (jito bundle)
8817
- * @param discountBps - Optional discount basis points for the referral program
8817
+ * @param discountBps - Optional discount basis points for the referral program and discount program
8818
8818
  * @param referralBps - Optional referral basis points for the referral program
8819
8819
  * @param optionalRPCResults - Optional RPC results to use for the transaction (speeds up the transaction building)
8820
8820
  *
@@ -8883,7 +8883,7 @@ declare const openTradeV1: (lavarageProgram: Program<Lavarage$1>, offer: Program
8883
8883
  * @param computeBudgetMicroLamports - Optional compute budget for priority fees
8884
8884
  * @param platformFeeRecipient - Optional wallet to receive platform fees (jup, okx)
8885
8885
  * @param splitTransactions - Optional boolean to split the transaction into multiple transactions (jito bundle)
8886
- * @param discountBps - Optional discount basis points for the referral program
8886
+ * @param discountBps - Optional discount basis points for the referral program and discount program
8887
8887
  * @param referralBps - Optional referral basis points for the referral program
8888
8888
  * @param optionalRPCResults - Optional RPC results to use for the transaction (speeds up the transaction building)
8889
8889
  *
@@ -9126,7 +9126,7 @@ declare const partialRepayV2: (lavarageProgram: Program<Lavarage>, position: Pro
9126
9126
  * @param computeBudgetMicroLamports - Optional compute budget for priority fees
9127
9127
  * @param platformFeeRecipient - Optional wallet to receive platform fees (jup, okx)
9128
9128
  * @param splitTransactions - Optional boolean to split the transaction into multiple transactions (jito bundle)
9129
- * @param discountBps - Optional discount basis points for the referral program
9129
+ * @param discountBps - Optional discount basis points for the referral program and discount program
9130
9130
  * @param referralBps - Optional referral basis points for the referral program
9131
9131
  *
9132
9132
  * @returns Transaction to close the position
@@ -9184,7 +9184,7 @@ declare const closeTradeV1: (lavarageProgram: Program<Lavarage$1>, position: Pro
9184
9184
  * @param computeBudgetMicroLamports - Optional compute budget for priority fees
9185
9185
  * @param platformFeeRecipient - Optional wallet to receive platform fees (jup, okx)
9186
9186
  * @param splitTransactions - Optional boolean to split the transaction into multiple transactions (jito bundle)
9187
- * @param discountBps - Optional discount basis points for the referral program
9187
+ * @param discountBps - Optional discount basis points for the referral program and discount program
9188
9188
  * @param referralBps - Optional referral basis points for the referral program
9189
9189
  *
9190
9190
  * @returns Transaction to close the position
package/dist/index.js CHANGED
@@ -9788,7 +9788,7 @@ var openTradeV1 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
9788
9788
  ])
9789
9789
  );
9790
9790
  const blockhash = (_a = optionalRPCResults == null ? void 0 : optionalRPCResults.latestBlockhash) != null ? _a : (yield lavarageProgram.provider.connection.getLatestBlockhash("finalized")).blockhash;
9791
- const useReferral = discountBps !== void 0 && referralBps !== void 0;
9791
+ const shouldUseDiscountProgram = discountBps !== void 0 && discountBps > 0 || referralBps !== void 0;
9792
9792
  let partnerFeeRecipientCreateIx;
9793
9793
  let userVaultPda;
9794
9794
  if (partnerFeeRecipient && referralBps !== void 0 && referralVaultProgram) {
@@ -9806,11 +9806,11 @@ var openTradeV1 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
9806
9806
  }).instruction();
9807
9807
  }
9808
9808
  }
9809
- const tradingOpenBorrowInstruction = useReferral ? yield lavarageProgram.methods.tradingOpenBorrowWithReferral(
9809
+ const tradingOpenBorrowInstruction = shouldUseDiscountProgram ? yield lavarageProgram.methods.tradingOpenBorrowWithReferral(
9810
9810
  new import_anchor3.BN((marginSOL.toNumber() * leverage).toFixed(0)),
9811
9811
  marginSOL,
9812
- new import_anchor3.BN(discountBps),
9813
- new import_anchor3.BN(referralBps)
9812
+ new import_anchor3.BN(discountBps || 0),
9813
+ new import_anchor3.BN(referralBps || 0)
9814
9814
  ).accountsStrict({
9815
9815
  nodeWallet: offer.account.nodeWallet,
9816
9816
  instructions: import_web33.SYSVAR_INSTRUCTIONS_PUBKEY,
@@ -10027,7 +10027,7 @@ var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
10027
10027
  switchboardLookupTables
10028
10028
  );
10029
10029
  const { blockhash } = yield program.provider.connection.getLatestBlockhash("finalized");
10030
- const useReferral = discountBps !== void 0 && referralBps !== void 0;
10030
+ const shouldUseDiscountProgram = discountBps !== void 0 && discountBps > 0 || referralBps !== void 0;
10031
10031
  let partnerFeeRecipientVaultCreateIx;
10032
10032
  let partnerFeeRecipientTokenAccountCreateIx;
10033
10033
  let userVaultPda;
@@ -10086,11 +10086,11 @@ var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
10086
10086
  );
10087
10087
  }
10088
10088
  }
10089
- const tradingOpenBorrowInstruction = useReferral ? yield program.methods.tradingOpenBorrow(
10089
+ const tradingOpenBorrowInstruction = shouldUseDiscountProgram ? yield program.methods.tradingOpenBorrow(
10090
10090
  new import_anchor3.BN((marginSOL.toNumber() * leverage).toFixed(0)),
10091
10091
  marginSOL,
10092
- new import_anchor3.BN(discountBps),
10093
- new import_anchor3.BN(referralBps)
10092
+ new import_anchor3.BN(discountBps || 0),
10093
+ new import_anchor3.BN(referralBps || 0)
10094
10094
  ).accountsStrict({
10095
10095
  nodeWallet: offer.account.nodeWallet,
10096
10096
  instructions: import_web33.SYSVAR_INSTRUCTIONS_PUBKEY,
@@ -10496,7 +10496,7 @@ var closeTradeV1 = (lavarageProgram, position, offer, jupInstruction, partnerFee
10496
10496
  });
10497
10497
  const addressLookupTableAccounts = [];
10498
10498
  const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
10499
- const useReferral = discountBps !== void 0 && referralBps !== void 0;
10499
+ const shouldUseDiscountProgram = discountBps !== void 0 && discountBps > 0 || referralBps !== void 0;
10500
10500
  let partnerFeeRecipientCreateIx;
10501
10501
  let userVaultPda;
10502
10502
  if (partnerFeeRecipient && referralBps !== void 0 && referralVaultProgram) {
@@ -10531,11 +10531,11 @@ var closeTradeV1 = (lavarageProgram, position, offer, jupInstruction, partnerFee
10531
10531
  let repaySolIx = null;
10532
10532
  let jupiterIxs = [];
10533
10533
  if (jupInstruction.instructions == void 0) {
10534
- repaySolIx = useReferral ? yield lavarageProgram.methods.tradingCloseRepaySolWithReferral(
10534
+ repaySolIx = shouldUseDiscountProgram ? yield lavarageProgram.methods.tradingCloseRepaySolWithReferral(
10535
10535
  new import_anchor3.BN(jupInstruction.quoteResponse.outAmount),
10536
10536
  new import_anchor3.BN(9997),
10537
- new import_anchor3.BN(discountBps),
10538
- new import_anchor3.BN(referralBps)
10537
+ new import_anchor3.BN(discountBps || 0),
10538
+ new import_anchor3.BN(referralBps || 0)
10539
10539
  ).accountsStrict({
10540
10540
  nodeWallet: pool.account.nodeWallet,
10541
10541
  positionAccount: positionAccountPDA,
@@ -10580,11 +10580,11 @@ var closeTradeV1 = (lavarageProgram, position, offer, jupInstruction, partnerFee
10580
10580
  ] : []
10581
10581
  ).instruction();
10582
10582
  } else {
10583
- repaySolIx = useReferral ? yield lavarageProgram.methods.tradingCloseRepaySolWithReferral(
10583
+ repaySolIx = shouldUseDiscountProgram ? yield lavarageProgram.methods.tradingCloseRepaySolWithReferral(
10584
10584
  new import_anchor3.BN(jupInstruction.quoteResponse.outAmount),
10585
10585
  new import_anchor3.BN(9998),
10586
- new import_anchor3.BN(discountBps),
10587
- new import_anchor3.BN(referralBps)
10586
+ new import_anchor3.BN(discountBps || 0),
10587
+ new import_anchor3.BN(referralBps || 0)
10588
10588
  ).accountsStrict({
10589
10589
  nodeWallet: pool.account.nodeWallet,
10590
10590
  positionAccount: positionAccountPDA,
@@ -10777,7 +10777,7 @@ var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken
10777
10777
  });
10778
10778
  const addressLookupTableAccounts = [];
10779
10779
  const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
10780
- const useReferral = discountBps !== void 0 && referralBps !== void 0;
10780
+ const shouldUseDiscountProgram = discountBps !== void 0 && discountBps > 0 || referralBps !== void 0;
10781
10781
  let partnerFeeRecipientVaultCreateIx;
10782
10782
  let partnerFeeRecipientTokenAccountCreateIx;
10783
10783
  let userVaultPda;
@@ -10833,11 +10833,11 @@ var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken
10833
10833
  let repaySolIx = null;
10834
10834
  let jupiterIxs = [];
10835
10835
  if (jupInstruction.instructions == void 0) {
10836
- repaySolIx = useReferral ? yield lavarageProgram.methods.tradingCloseRepaySol(
10836
+ repaySolIx = shouldUseDiscountProgram ? yield lavarageProgram.methods.tradingCloseRepaySol(
10837
10837
  new import_anchor3.BN(jupInstruction.quoteResponse.outAmount),
10838
10838
  new import_anchor3.BN(9997),
10839
- new import_anchor3.BN(discountBps),
10840
- new import_anchor3.BN(referralBps)
10839
+ new import_anchor3.BN(discountBps || 0),
10840
+ new import_anchor3.BN(referralBps || 0)
10841
10841
  ).accountsStrict({
10842
10842
  nodeWallet: pool.account.nodeWallet,
10843
10843
  positionAccount: positionAccountPDA,
@@ -10933,11 +10933,11 @@ var closeTradeV2 = (lavarageProgram, position, offer, jupInstruction, quoteToken
10933
10933
  ] : []
10934
10934
  ).instruction();
10935
10935
  } else {
10936
- repaySolIx = useReferral ? yield lavarageProgram.methods.tradingCloseRepaySol(
10936
+ repaySolIx = shouldUseDiscountProgram ? yield lavarageProgram.methods.tradingCloseRepaySol(
10937
10937
  new import_anchor3.BN(jupInstruction.quoteResponse.outAmount),
10938
10938
  new import_anchor3.BN(9998),
10939
- new import_anchor3.BN(discountBps),
10940
- new import_anchor3.BN(referralBps)
10939
+ new import_anchor3.BN(discountBps || 0),
10940
+ new import_anchor3.BN(referralBps || 0)
10941
10941
  ).accountsStrict({
10942
10942
  nodeWallet: pool.account.nodeWallet,
10943
10943
  positionAccount: positionAccountPDA,