@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.
- package/lending.ts +36 -0
- 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
|
+
}
|