@jup-ag/lend 0.0.25 → 0.0.26
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/borrow/index.mjs +15 -9
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/borrow/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Transaction, PublicKey, SystemProgram } from '@solana/web3.js';
|
|
2
2
|
import BN from 'bn.js';
|
|
3
|
-
import { Program
|
|
3
|
+
import { Program } from '@coral-xyz/anchor';
|
|
4
4
|
import { g as getTick, a as getTickIdLiquidation, c as getVaultConfig, d as getBranch, e as getTickHasDebt, f as getVaultState, v as vaults, h as getVaultMetadata, i as getPosition, j as getLiquidity, k as getClaimAccount, l as getRateModel, m as getUserBorrowPosition, n as getUserSupplyPosition, o as getLiquidityReserve, p as getPositionTokenAccount, q as getPositionMint, r as getVaultAdmin } from '../shared/lend.ByEareGr.mjs';
|
|
5
5
|
import { h as getReserve, e as liquidity } from '../shared/lend.Byg4n7y5.mjs';
|
|
6
6
|
import { getMint, getAssociatedTokenAddressSync, TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID } from '@solana/spl-token';
|
|
@@ -1035,17 +1035,23 @@ async function getExchangePrices({
|
|
|
1035
1035
|
vaultConfig,
|
|
1036
1036
|
connection
|
|
1037
1037
|
}) {
|
|
1038
|
-
const program = new Program(
|
|
1039
|
-
|
|
1040
|
-
new AnchorProvider(connection, new Wallet(Keypair.generate()))
|
|
1041
|
-
);
|
|
1042
|
-
const { raw } = await program.methods.getExchangePrices().accounts({
|
|
1038
|
+
const program = new Program(vaults, { connection });
|
|
1039
|
+
const ix = await program.methods.getExchangePrices().accounts({
|
|
1043
1040
|
vaultState: getVaultState(vaultId),
|
|
1044
1041
|
vaultConfig: getVaultConfig(vaultId),
|
|
1045
1042
|
supplyTokenReserves: getReserve(vaultConfig.supplyToken),
|
|
1046
1043
|
borrowTokenReserves: getReserve(vaultConfig.borrowToken)
|
|
1047
|
-
}).
|
|
1048
|
-
const
|
|
1044
|
+
}).instruction();
|
|
1045
|
+
const transaction = new Transaction().add(ix);
|
|
1046
|
+
const latestBlockHash = await connection.getLatestBlockhash();
|
|
1047
|
+
transaction.recentBlockhash = latestBlockHash.blockhash;
|
|
1048
|
+
transaction.feePayer = new PublicKey(
|
|
1049
|
+
"7ty28gFJMqjxz3YxAY3uBZs7vYXU7rcM8j7F96Akx9tQ"
|
|
1050
|
+
);
|
|
1051
|
+
const raw = await connection.simulateTransaction(transaction);
|
|
1052
|
+
const returnLog = raw.value.logs?.find(
|
|
1053
|
+
(log) => log.startsWith("Program return:")
|
|
1054
|
+
);
|
|
1049
1055
|
if (!returnLog) {
|
|
1050
1056
|
throw new Error("No return data found in logs");
|
|
1051
1057
|
}
|
package/dist/index.mjs
CHANGED