@lavarage/sdk 7.5.9 → 7.5.11

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.
Files changed (75) hide show
  1. package/.github/workflows/npm-publish.yml +33 -0
  2. package/dist/index.d.mts +18 -0
  3. package/dist/index.d.ts +18 -0
  4. package/dist/index.js +12 -12
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +12 -12
  7. package/dist/index.mjs.map +1 -1
  8. package/docs/functions/borrowV1.html +1 -1
  9. package/docs/functions/borrowV2.html +1 -1
  10. package/docs/functions/closePositionEvm.html +2 -2
  11. package/docs/functions/closeTradeV1.html +7 -3
  12. package/docs/functions/closeTradeV2.html +7 -3
  13. package/docs/functions/createTpDelegate.html +2 -2
  14. package/docs/functions/getActiveLoanCountEvm.html +2 -2
  15. package/docs/functions/getActiveLoansBatchEvm.html +2 -2
  16. package/docs/functions/getAllPositions.html +2 -2
  17. package/docs/functions/getAvailableExposureEvm.html +2 -2
  18. package/docs/functions/getClosedPositions.html +2 -2
  19. package/docs/functions/getClosedPositionsEvm.html +2 -2
  20. package/docs/functions/getCollateralExposureEvm.html +2 -2
  21. package/docs/functions/getCollateralInfoEvm.html +2 -2
  22. package/docs/functions/getDelegateAccounts.html +2 -2
  23. package/docs/functions/getLiquidatedPositions.html +2 -2
  24. package/docs/functions/getLiquidatedPositionsEvm.html +2 -2
  25. package/docs/functions/getLoanEvm.html +2 -2
  26. package/docs/functions/getLoansByBorrowerEvm.html +2 -2
  27. package/docs/functions/getOffers.html +2 -2
  28. package/docs/functions/getOffersEvm.html +2 -2
  29. package/docs/functions/getOpenPositions.html +2 -2
  30. package/docs/functions/getOpeningFeeEvm.html +2 -2
  31. package/docs/functions/getPda.html +2 -2
  32. package/docs/functions/getPositionAccountPDA.html +2 -2
  33. package/docs/functions/getPositionsEvm.html +2 -2
  34. package/docs/functions/getProfitFeeEvm.html +2 -2
  35. package/docs/functions/getTokenBalanceEvm.html +2 -2
  36. package/docs/functions/getUserLoansEvm.html +2 -2
  37. package/docs/functions/lending.addToWithdrawalAccessList.html +1 -1
  38. package/docs/functions/lending.createOffer.html +2 -2
  39. package/docs/functions/lending.depositFunds.html +2 -2
  40. package/docs/functions/lending.getNodeWalletPDA.html +2 -2
  41. package/docs/functions/lending.getTradingPoolPDA.html +2 -2
  42. package/docs/functions/lending.getWithdrawalAccessList.html +1 -1
  43. package/docs/functions/lending.getWithdrawalAccessListPDA.html +1 -1
  44. package/docs/functions/lending.removeFromWithdrawalAccessList.html +1 -1
  45. package/docs/functions/lending.updateInterestRate.html +2 -2
  46. package/docs/functions/lending.updateMaxBorrow.html +2 -2
  47. package/docs/functions/lending.updateMaxExposure.html +2 -2
  48. package/docs/functions/lending.updateOffer.html +2 -2
  49. package/docs/functions/lending.withdrawFunds.html +2 -2
  50. package/docs/functions/lending.withdrawFundsV1.html +2 -2
  51. package/docs/functions/lending.withdrawFundsV2.html +2 -2
  52. package/docs/functions/liquidatePositionEvm.html +2 -2
  53. package/docs/functions/mergePositionV2.html +2 -2
  54. package/docs/functions/modifyTpDelegate.html +2 -2
  55. package/docs/functions/openPositionEvm.html +2 -2
  56. package/docs/functions/openTradeV1.html +8 -3
  57. package/docs/functions/openTradeV2.html +8 -3
  58. package/docs/functions/partialRepayV1.html +2 -2
  59. package/docs/functions/partialRepayV2.html +2 -2
  60. package/docs/functions/removeTpDelegate.html +2 -2
  61. package/docs/functions/splitPositionV2.html +2 -2
  62. package/docs/functions/updateMaxLendPerTokenBatchEvm.html +2 -2
  63. package/docs/hierarchy.html +1 -1
  64. package/docs/index.html +2 -2
  65. package/docs/modules/IDLV2.html +2 -2
  66. package/docs/modules/lending.html +1 -1
  67. package/docs/modules.html +2 -2
  68. package/docs/types/IDLV2.Lavarage.html +2 -2
  69. package/docs/types/Lavarage.html +2 -2
  70. package/docs/variables/IDL.html +1 -1
  71. package/docs/variables/IDLV2.IDL.html +1 -1
  72. package/index.ts +27 -7
  73. package/lending.ts +4 -4
  74. package/package.json +1 -1
  75. package/.DS_Store +0 -0
@@ -0,0 +1,33 @@
1
+ # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2
+ # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3
+
4
+ name: Node.js Package
5
+
6
+ on:
7
+ release:
8
+ types: [created]
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: actions/setup-node@v4
16
+ with:
17
+ node-version: 20
18
+ - run: npm ci
19
+ - run: npm test
20
+
21
+ publish-npm:
22
+ needs: build
23
+ runs-on: ubuntu-latest
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+ - uses: actions/setup-node@v4
27
+ with:
28
+ node-version: 20
29
+ registry-url: https://registry.npmjs.org/
30
+ - run: npm ci
31
+ - run: npm publish
32
+ env:
33
+ NODE_AUTH_TOKEN: ${{secrets.npm_token}}
package/dist/index.d.mts CHANGED
@@ -4847,6 +4847,11 @@ declare const borrowV2: (lavarageProgram: Program<Lavarage>, offer: ProgramAccou
4847
4847
  * @param partnerFeeRecipient - Optional wallet to receive partner fees
4848
4848
  * @param partnerFeeMarkup - Optional partner fee amount in basis points
4849
4849
  * @param computeBudgetMicroLamports - Optional compute budget for priority fees
4850
+ * @param platformFeeRecipient - Optional wallet to receive platform fees (jup, okx)
4851
+ * @param splitTransactions - Optional boolean to split the transaction into multiple transactions (jito bundle)
4852
+ * @param discountBps - Optional discount basis points for the referral program
4853
+ * @param referralBps - Optional referral basis points for the referral program
4854
+ * @param optionalRPCResults - Optional RPC results to use for the transaction (speeds up the transaction building)
4850
4855
  *
4851
4856
  * @returns A versioned transaction ready to be signed and sent
4852
4857
  *
@@ -4911,6 +4916,11 @@ declare const openTradeV1: (lavarageProgram: Program<Lavarage$1>, offer: Program
4911
4916
  * @param partnerFeeRecipient - Optional wallet to receive partner fees
4912
4917
  * @param partnerFeeMarkup - Optional partner fee amount in basis points
4913
4918
  * @param computeBudgetMicroLamports - Optional compute budget for priority fees
4919
+ * @param platformFeeRecipient - Optional wallet to receive platform fees (jup, okx)
4920
+ * @param splitTransactions - Optional boolean to split the transaction into multiple transactions (jito bundle)
4921
+ * @param discountBps - Optional discount basis points for the referral program
4922
+ * @param referralBps - Optional referral basis points for the referral program
4923
+ * @param optionalRPCResults - Optional RPC results to use for the transaction (speeds up the transaction building)
4914
4924
  *
4915
4925
  * @returns A versioned transaction ready to be signed and sent
4916
4926
  *
@@ -5148,6 +5158,10 @@ declare const partialRepayV2: (lavarageProgram: Program<Lavarage>, position: Pro
5148
5158
  * @param partnerFeeRecipient - Optional wallet to receive partner fees
5149
5159
  * @param partnerFeeMarkup - Optional partner fee amount in basis points
5150
5160
  * @param computeBudgetMicroLamports - Optional compute budget for priority fees
5161
+ * @param platformFeeRecipient - Optional wallet to receive platform fees (jup, okx)
5162
+ * @param splitTransactions - Optional boolean to split the transaction into multiple transactions (jito bundle)
5163
+ * @param discountBps - Optional discount basis points for the referral program
5164
+ * @param referralBps - Optional referral basis points for the referral program
5151
5165
  *
5152
5166
  * @returns Transaction to close the position
5153
5167
  *
@@ -5202,6 +5216,10 @@ declare const closeTradeV1: (lavarageProgram: Program<Lavarage$1>, position: Pro
5202
5216
  * @param partnerFeeRecipient - Optional wallet to receive partner fees
5203
5217
  * @param partnerFeeMarkup - Optional partner fee amount in basis points
5204
5218
  * @param computeBudgetMicroLamports - Optional compute budget for priority fees
5219
+ * @param platformFeeRecipient - Optional wallet to receive platform fees (jup, okx)
5220
+ * @param splitTransactions - Optional boolean to split the transaction into multiple transactions (jito bundle)
5221
+ * @param discountBps - Optional discount basis points for the referral program
5222
+ * @param referralBps - Optional referral basis points for the referral program
5205
5223
  *
5206
5224
  * @returns Transaction to close the position
5207
5225
  *
package/dist/index.d.ts CHANGED
@@ -4847,6 +4847,11 @@ declare const borrowV2: (lavarageProgram: Program<Lavarage>, offer: ProgramAccou
4847
4847
  * @param partnerFeeRecipient - Optional wallet to receive partner fees
4848
4848
  * @param partnerFeeMarkup - Optional partner fee amount in basis points
4849
4849
  * @param computeBudgetMicroLamports - Optional compute budget for priority fees
4850
+ * @param platformFeeRecipient - Optional wallet to receive platform fees (jup, okx)
4851
+ * @param splitTransactions - Optional boolean to split the transaction into multiple transactions (jito bundle)
4852
+ * @param discountBps - Optional discount basis points for the referral program
4853
+ * @param referralBps - Optional referral basis points for the referral program
4854
+ * @param optionalRPCResults - Optional RPC results to use for the transaction (speeds up the transaction building)
4850
4855
  *
4851
4856
  * @returns A versioned transaction ready to be signed and sent
4852
4857
  *
@@ -4911,6 +4916,11 @@ declare const openTradeV1: (lavarageProgram: Program<Lavarage$1>, offer: Program
4911
4916
  * @param partnerFeeRecipient - Optional wallet to receive partner fees
4912
4917
  * @param partnerFeeMarkup - Optional partner fee amount in basis points
4913
4918
  * @param computeBudgetMicroLamports - Optional compute budget for priority fees
4919
+ * @param platformFeeRecipient - Optional wallet to receive platform fees (jup, okx)
4920
+ * @param splitTransactions - Optional boolean to split the transaction into multiple transactions (jito bundle)
4921
+ * @param discountBps - Optional discount basis points for the referral program
4922
+ * @param referralBps - Optional referral basis points for the referral program
4923
+ * @param optionalRPCResults - Optional RPC results to use for the transaction (speeds up the transaction building)
4914
4924
  *
4915
4925
  * @returns A versioned transaction ready to be signed and sent
4916
4926
  *
@@ -5148,6 +5158,10 @@ declare const partialRepayV2: (lavarageProgram: Program<Lavarage>, position: Pro
5148
5158
  * @param partnerFeeRecipient - Optional wallet to receive partner fees
5149
5159
  * @param partnerFeeMarkup - Optional partner fee amount in basis points
5150
5160
  * @param computeBudgetMicroLamports - Optional compute budget for priority fees
5161
+ * @param platformFeeRecipient - Optional wallet to receive platform fees (jup, okx)
5162
+ * @param splitTransactions - Optional boolean to split the transaction into multiple transactions (jito bundle)
5163
+ * @param discountBps - Optional discount basis points for the referral program
5164
+ * @param referralBps - Optional referral basis points for the referral program
5151
5165
  *
5152
5166
  * @returns Transaction to close the position
5153
5167
  *
@@ -5202,6 +5216,10 @@ declare const closeTradeV1: (lavarageProgram: Program<Lavarage$1>, position: Pro
5202
5216
  * @param partnerFeeRecipient - Optional wallet to receive partner fees
5203
5217
  * @param partnerFeeMarkup - Optional partner fee amount in basis points
5204
5218
  * @param computeBudgetMicroLamports - Optional compute budget for priority fees
5219
+ * @param platformFeeRecipient - Optional wallet to receive platform fees (jup, okx)
5220
+ * @param splitTransactions - Optional boolean to split the transaction into multiple transactions (jito bundle)
5221
+ * @param discountBps - Optional discount basis points for the referral program
5222
+ * @param referralBps - Optional referral basis points for the referral program
5205
5223
  *
5206
5224
  * @returns Transaction to close the position
5207
5225
  *
package/dist/index.js CHANGED
@@ -1330,7 +1330,7 @@ function createNodeWallet(lavarageProgram, params) {
1330
1330
  new import_web3.PublicKey(params.mint),
1331
1331
  lavarageProgram.programId
1332
1332
  );
1333
- instructions.push(yield lavarageProgram.methods.lpOperatorCreateNodeWallet(new import_anchor.BN(params.liquidationLtv)).accounts({
1333
+ instructions.push(yield lavarageProgram.methods.lpOperatorCreateNodeWallet(params.liquidationLtv).accounts({
1334
1334
  nodeWallet,
1335
1335
  operator: new import_web3.PublicKey(params.operator),
1336
1336
  systemProgram: import_web3.SystemProgram.programId,
@@ -1549,7 +1549,7 @@ function createOffer(lavarageProgram, params) {
1549
1549
  nodeWalletPubKey = nodeWalletAccount.publicKey;
1550
1550
  }
1551
1551
  const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
1552
- const instruction = yield lavarageProgram.methods.lpOperatorCreateTradingPool(new import_anchor.BN(params.interestRate)).accounts({
1552
+ const instruction = yield lavarageProgram.methods.lpOperatorCreateTradingPool(params.interestRate).accounts({
1553
1553
  tradingPool: params.tradingPool,
1554
1554
  operator: params.poolOwner,
1555
1555
  nodeWallet: nodeWalletPubKey,
@@ -1616,7 +1616,7 @@ function updateInterestRate(lavarageProgram, params) {
1616
1616
  return __async(this, null, function* () {
1617
1617
  var _a;
1618
1618
  const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
1619
- const instruction = yield lavarageProgram.methods.lpOperatorUpdateInterestRate(new import_anchor.BN(params.interestRate)).accounts({
1619
+ const instruction = yield lavarageProgram.methods.lpOperatorUpdateInterestRate(params.interestRate).accounts({
1620
1620
  tradingPool: params.tradingPool,
1621
1621
  nodeWallet: new import_web3.PublicKey(params.nodeWallet),
1622
1622
  operator: params.poolOwner,
@@ -1644,7 +1644,7 @@ function updateOffer(lavarageProgram, params) {
1644
1644
  operator: params.poolOwner,
1645
1645
  systemProgram: import_web3.SystemProgram.programId
1646
1646
  }).instruction();
1647
- const updateInterestRateInstruction = yield lavarageProgram.methods.lpOperatorUpdateInterestRate(new import_anchor.BN(params.interestRate)).accounts({
1647
+ const updateInterestRateInstruction = yield lavarageProgram.methods.lpOperatorUpdateInterestRate(params.interestRate).accounts({
1648
1648
  tradingPool: params.tradingPool,
1649
1649
  nodeWallet: new import_web3.PublicKey(params.nodeWallet),
1650
1650
  operator: params.poolOwner,
@@ -5962,6 +5962,12 @@ var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
5962
5962
  );
5963
5963
  }
5964
5964
  }
5965
+ const partnerDirectAta = partnerFeeRecipient ? (0, import_spl_token2.getAssociatedTokenAddressSync)(
5966
+ quoteToken,
5967
+ partnerFeeRecipient,
5968
+ true,
5969
+ quoteTokenProgram
5970
+ ) : void 0;
5965
5971
  const tradingOpenBorrowInstruction = useReferral ? yield lavarageProgram.methods.tradingOpenBorrowWithReferral(
5966
5972
  new import_anchor2.BN((marginSOL.toNumber() * leverage).toFixed(0)),
5967
5973
  marginSOL,
@@ -6041,15 +6047,9 @@ var openTradeV2 = (lavarageProgram, offer, jupInstruction, marginSOL, leverage,
6041
6047
  quoteTokenProgram
6042
6048
  )
6043
6049
  }).remainingAccounts(
6044
- partnerFeeRecipient && partnerFeeMarkupAsPkey && userVaultPda ? [
6050
+ partnerFeeRecipient && partnerFeeMarkupAsPkey && partnerDirectAta ? [
6045
6051
  {
6046
- pubkey: (0, import_spl_token2.getAssociatedTokenAddressSync)(
6047
- quoteToken,
6048
- userVaultPda,
6049
- true,
6050
- // allowOwnerOffCurve for PDA
6051
- quoteTokenProgram
6052
- ),
6052
+ pubkey: partnerDirectAta,
6053
6053
  isSigner: false,
6054
6054
  isWritable: true
6055
6055
  },