@lavarage/sdk 6.9.0 → 6.9.1

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 (2) hide show
  1. package/lending.ts +36 -0
  2. package/package.json +1 -1
package/lending.ts CHANGED
@@ -567,3 +567,39 @@ export async function updateOffer(
567
567
 
568
568
  return new VersionedTransaction(messageV0);
569
569
  }
570
+
571
+ export async function updateMaxBorrow(
572
+ lavarageProgram: Program<Lavarage> | Program<LavarageV2>,
573
+ params: {
574
+ tradingPool: PublicKey;
575
+ nodeWallet: string;
576
+ oracle: PublicKey;
577
+ maxBorrow: number;
578
+ computeBudgetMicroLamports?: number;
579
+ }
580
+ ): Promise<VersionedTransaction> {
581
+ const { blockhash } =
582
+ await lavarageProgram.provider.connection.getLatestBlockhash("finalized");
583
+
584
+ const instruction = await lavarageProgram.methods
585
+ .lpOperatorUpdateMaxBorrow(new BN(params.maxBorrow))
586
+ .accounts({
587
+ tradingPool: params.tradingPool,
588
+ nodeWallet: new PublicKey(params.nodeWallet),
589
+ operator: params.oracle,
590
+ systemProgram: SystemProgram.programId,
591
+ })
592
+ .instruction();
593
+
594
+ const computeFeeIx = ComputeBudgetProgram.setComputeUnitPrice({
595
+ microLamports: params.computeBudgetMicroLamports ?? 150000,
596
+ });
597
+
598
+ const messageV0 = new TransactionMessage({
599
+ payerKey: lavarageProgram.provider.publicKey!,
600
+ recentBlockhash: blockhash,
601
+ instructions: [instruction, computeFeeIx],
602
+ }).compileToV0Message();
603
+
604
+ return new VersionedTransaction(messageV0);
605
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lavarage/sdk",
3
- "version": "6.9.0",
3
+ "version": "6.9.1",
4
4
  "description": "Lavarage SDK",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",