@lavarage/sdk 6.0.3 → 6.1.3

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
@@ -46,7 +46,7 @@ var __async = (__this, __arguments, generator) => {
46
46
  import { BN } from "@coral-xyz/anchor";
47
47
  import bs58 from "bs58";
48
48
  import { AddressLookupTableAccount, ComputeBudgetProgram, PublicKey, SystemProgram, SYSVAR_CLOCK_PUBKEY, SYSVAR_INSTRUCTIONS_PUBKEY, Transaction, TransactionInstruction, TransactionMessage, VersionedTransaction } from "@solana/web3.js";
49
- import { ASSOCIATED_TOKEN_PROGRAM_ID, createAssociatedTokenAccountInstruction, createTransferInstruction, getAccount, getAssociatedTokenAddressSync, TokenAccountNotFoundError, TokenInvalidAccountOwnerError } from "@solana/spl-token";
49
+ import { ASSOCIATED_TOKEN_PROGRAM_ID, createAssociatedTokenAccountInstruction, createTransferInstruction, getAccount, getAssociatedTokenAddressSync, TOKEN_PROGRAM_ID, TokenAccountNotFoundError, TokenInvalidAccountOwnerError } from "@solana/spl-token";
50
50
 
51
51
  // idl/lavarage.ts
52
52
  var IDL = {
@@ -2771,6 +2771,52 @@ var removeTpDelegate = (lavarageProgram, position, prioFee) => __async(void 0, n
2771
2771
  }).compileToV0Message();
2772
2772
  return new VersionedTransaction(messageV0);
2773
2773
  });
2774
+ var partialRepayV1 = (lavarageProgram, position, repaymentBps) => __async(void 0, null, function* () {
2775
+ const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
2776
+ const pool = yield lavarageProgram.account.pool.fetch(position.account.pool);
2777
+ const positionAccountPDA = position.publicKey;
2778
+ const ix = yield lavarageProgram.methods.tradingClosePartialRepaySol(new BN(repaymentBps)).accountsStrict({
2779
+ systemProgram: SystemProgram.programId,
2780
+ positionAccount: positionAccountPDA,
2781
+ tradingPool: position.account.pool,
2782
+ nodeWallet: pool.nodeWallet,
2783
+ trader: lavarageProgram.provider.publicKey,
2784
+ clock: SYSVAR_CLOCK_PUBKEY,
2785
+ randomAccountAsId: position.account.seed,
2786
+ feeReceipient: "6JfTobDvwuwZxZP6FR5JPmjdvQ4h4MovkEVH2FPsMSrF"
2787
+ }).instruction();
2788
+ const messageV0 = new TransactionMessage({
2789
+ payerKey: lavarageProgram.provider.publicKey,
2790
+ recentBlockhash: blockhash,
2791
+ instructions: [ix]
2792
+ }).compileToV0Message();
2793
+ return new VersionedTransaction(messageV0);
2794
+ });
2795
+ var partialRepayV2 = (lavarageProgram, position, repaymentBps) => __async(void 0, null, function* () {
2796
+ const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
2797
+ const pool = yield lavarageProgram.account.pool.fetch(position.account.pool);
2798
+ const positionAccountPDA = position.publicKey;
2799
+ const ix = yield lavarageProgram.methods.tradingPartialRepaySol(new BN(repaymentBps)).accountsStrict({
2800
+ systemProgram: SystemProgram.programId,
2801
+ positionAccount: positionAccountPDA,
2802
+ tradingPool: position.account.pool,
2803
+ nodeWallet: pool.nodeWallet,
2804
+ trader: lavarageProgram.provider.publicKey,
2805
+ clock: SYSVAR_CLOCK_PUBKEY,
2806
+ randomAccountAsId: position.account.seed,
2807
+ fromTokenAccount: getAssociatedTokenAddressSync(pool.qtType, lavarageProgram.provider.publicKey),
2808
+ toTokenAccount: getAssociatedTokenAddressSync(pool.qtType, pool.nodeWallet),
2809
+ mint: pool.qtType,
2810
+ feeTokenAccount: getAssociatedTokenAddressSync(pool.qtType, new PublicKey("6JfTobDvwuwZxZP6FR5JPmjdvQ4h4MovkEVH2FPsMSrF")),
2811
+ tokenProgram: TOKEN_PROGRAM_ID
2812
+ }).instruction();
2813
+ const messageV0 = new TransactionMessage({
2814
+ payerKey: lavarageProgram.provider.publicKey,
2815
+ recentBlockhash: blockhash,
2816
+ instructions: [ix]
2817
+ }).compileToV0Message();
2818
+ return new VersionedTransaction(messageV0);
2819
+ });
2774
2820
  var closeTradeV1 = (lavarageProgram, position, offer, jupInstruction, partnerFeeRecipient, profitFeeMarkup) => __async(void 0, null, function* () {
2775
2821
  if (position.account.pool.toBase58() != offer.publicKey.toBase58()) throw "Mismatch offer";
2776
2822
  const pool = offer;
@@ -3039,6 +3085,8 @@ export {
3039
3085
  modifyTpDelegate,
3040
3086
  openTradeV1,
3041
3087
  openTradeV2,
3088
+ partialRepayV1,
3089
+ partialRepayV2,
3042
3090
  removeTpDelegate
3043
3091
  };
3044
3092
  //# sourceMappingURL=index.mjs.map