@lavarage/sdk 7.1.1 → 7.2.0

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
@@ -3348,6 +3348,7 @@ declare function createOffer(lavarageProgram: Program<Lavarage$1> | Program<Lava
3348
3348
  interestRate: number;
3349
3349
  maxExposure: number;
3350
3350
  computeBudgetMicroLamports?: number;
3351
+ maxBorrow?: number;
3351
3352
  }): Promise<VersionedTransaction>;
3352
3353
  declare function updateMaxExposure(lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, params: {
3353
3354
  tradingPool: PublicKey;
@@ -3597,7 +3598,11 @@ declare const splitPositionV2: (lavarageProgram: Program<Lavarage> | Program<Lav
3597
3598
  nodeWallet: PublicKey;
3598
3599
  interestRate: number;
3599
3600
  collateralType: PublicKey;
3600
- }>, quoteToken: PublicKey, propotionBps: number, computeBudgetMicroLamports?: number) => Promise<VersionedTransaction>;
3601
+ }>, quoteToken: PublicKey, propotionBps: number, computeBudgetMicroLamports?: number) => Promise<{
3602
+ transaction: VersionedTransaction;
3603
+ newPositionAddresses: string[];
3604
+ newPositionSeeds: string[];
3605
+ }>;
3601
3606
  declare const mergePositionV2: (lavarageProgram: Program<Lavarage>, position1: ProgramAccount<{
3602
3607
  pool: PublicKey;
3603
3608
  seed: PublicKey;
package/dist/index.d.ts CHANGED
@@ -3348,6 +3348,7 @@ declare function createOffer(lavarageProgram: Program<Lavarage$1> | Program<Lava
3348
3348
  interestRate: number;
3349
3349
  maxExposure: number;
3350
3350
  computeBudgetMicroLamports?: number;
3351
+ maxBorrow?: number;
3351
3352
  }): Promise<VersionedTransaction>;
3352
3353
  declare function updateMaxExposure(lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, params: {
3353
3354
  tradingPool: PublicKey;
@@ -3597,7 +3598,11 @@ declare const splitPositionV2: (lavarageProgram: Program<Lavarage> | Program<Lav
3597
3598
  nodeWallet: PublicKey;
3598
3599
  interestRate: number;
3599
3600
  collateralType: PublicKey;
3600
- }>, quoteToken: PublicKey, propotionBps: number, computeBudgetMicroLamports?: number) => Promise<VersionedTransaction>;
3601
+ }>, quoteToken: PublicKey, propotionBps: number, computeBudgetMicroLamports?: number) => Promise<{
3602
+ transaction: VersionedTransaction;
3603
+ newPositionAddresses: string[];
3604
+ newPositionSeeds: string[];
3605
+ }>;
3601
3606
  declare const mergePositionV2: (lavarageProgram: Program<Lavarage>, position1: ProgramAccount<{
3602
3607
  pool: PublicKey;
3603
3608
  seed: PublicKey;
package/dist/index.js CHANGED
@@ -1338,7 +1338,7 @@ function withdrawFunds(lavarageProgram, params) {
1338
1338
  }
1339
1339
  function createOffer(lavarageProgram, params) {
1340
1340
  return __async(this, null, function* () {
1341
- var _a;
1341
+ var _a, _b;
1342
1342
  let nodeWalletAccount, nodeWalletSigner, createNodeWalletInstruction = [], nodeWalletPubKey;
1343
1343
  if (params.quoteMint === "So11111111111111111111111111111111111111112") {
1344
1344
  const nodeWallets = yield lavarageProgram.account.nodeWallet.all();
@@ -1400,6 +1400,12 @@ function createOffer(lavarageProgram, params) {
1400
1400
  toPubkey: new import_web3.PublicKey("BMME51pfWdBfakTEMuQbNP4NG3wCY4Fo47dKatThhXGQ"),
1401
1401
  lamports: 0.3 * import_web3.LAMPORTS_PER_SOL
1402
1402
  });
1403
+ const updateMaxBorrowInstruction = yield lavarageProgram.methods.lpOperatorUpdateMaxBorrow(new import_anchor.BN((_b = params.maxBorrow) != null ? _b : 0)).accountsStrict({
1404
+ tradingPool: params.tradingPool,
1405
+ nodeWallet: nodeWalletPubKey,
1406
+ operator: params.poolOwner,
1407
+ systemProgram: import_web3.SystemProgram.programId
1408
+ }).instruction();
1403
1409
  const messageV0 = new import_web3.TransactionMessage({
1404
1410
  payerKey: lavarageProgram.provider.publicKey,
1405
1411
  recentBlockhash: blockhash,
@@ -1408,6 +1414,7 @@ function createOffer(lavarageProgram, params) {
1408
1414
  instruction,
1409
1415
  updateMaxExposureInstruction,
1410
1416
  transferInstruction,
1417
+ params.maxBorrow ? updateMaxBorrowInstruction : void 0,
1411
1418
  computeFeeIx
1412
1419
  ].filter(Boolean)
1413
1420
  }).compileToV0Message();
@@ -5763,7 +5770,17 @@ var splitPositionV2 = (lavarageProgram, position, offer, quoteToken, propotionBp
5763
5770
  instructions: allInstructions
5764
5771
  }).compileToV0Message();
5765
5772
  const tx = new import_web32.VersionedTransaction(messageV0);
5766
- return tx;
5773
+ return {
5774
+ transaction: tx,
5775
+ newPositionAddresses: [
5776
+ newPosition1AccountPDA.toBase58(),
5777
+ newPosition2AccountPDA.toBase58()
5778
+ ],
5779
+ newPositionSeeds: [
5780
+ newPosition1Seed.toBase58(),
5781
+ newPosition2Seed.toBase58()
5782
+ ]
5783
+ };
5767
5784
  });
5768
5785
  var mergePositionV2 = (lavarageProgram, position1, position2, offer, quoteToken, computeBudgetMicroLamports) => __async(void 0, null, function* () {
5769
5786
  const positionAccountPDA1 = position1.publicKey;