@jup-ag/lend 0.0.67 → 0.0.69
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 +18 -17
- package/dist/earn/index.mjs +3 -2
- package/dist/flashloan/index.d.mts +46 -0
- package/dist/flashloan/index.d.ts +46 -0
- package/dist/flashloan/index.mjs +87 -0
- package/dist/index.d.mts +35 -14
- package/dist/index.d.ts +35 -14
- package/dist/index.mjs +6 -4
- package/dist/shared/{lend.DQdZyKrA.mjs → lend.BqYn-LEf.mjs} +1 -1
- package/dist/shared/{lend.BpBbTaiH.mjs → lend.BzG5ldOV.mjs} +2 -5
- package/dist/shared/lend.CioR9-te.mjs +5 -0
- package/dist/shared/lend.hlqlrp9r.mjs +661 -0
- package/dist/shared/{lend.BlSi5eLr.mjs → lend.uRnzld7B.mjs} +1 -1
- package/package.json +5 -1
package/dist/borrow/index.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Transaction, PublicKey, SystemProgram, SYSVAR_RENT_PUBKEY, SYSVAR_INSTRUCTIONS_PUBKEY, TransactionMessage, ComputeBudgetProgram, VersionedTransaction } from '@solana/web3.js';
|
|
2
2
|
import BN from 'bn.js';
|
|
3
3
|
import { Program } from '@coral-xyz/anchor';
|
|
4
|
-
import {
|
|
4
|
+
import { l as liquidity } from '../shared/lend.CioR9-te.mjs';
|
|
5
5
|
import { getAssociatedTokenAddressSync, ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from '@solana/spl-token';
|
|
6
|
-
import { g as getTickHasDebt, v as vaults, a as getPosition, c as getTick, d as getTickIdLiquidation, e as getVaultConfig, f as getBranch, h as getVaultState, i as getVaultMetadata, j as getLiquidity, k as getClaimAccount, l as getRateModel, m as getUserBorrowPosition, n as getUserSupplyPosition, o as getLiquidityReserve, p as getPositionTokenAccount, q as getPositionMetadata, r as getPositionMint, s as getVaultAdmin } from '../shared/lend.
|
|
6
|
+
import { g as getTickHasDebt, v as vaults, a as getPosition, c as getTick, d as getTickIdLiquidation, e as getVaultConfig, f as getBranch, h as getVaultState, i as getVaultMetadata, j as getLiquidity, k as getClaimAccount, l as getRateModel, m as getUserBorrowPosition, n as getUserSupplyPosition, o as getLiquidityReserve, p as getPositionTokenAccount, q as getPositionMetadata, r as getPositionMint, s as getVaultAdmin } from '../shared/lend.uRnzld7B.mjs';
|
|
7
|
+
import { e as getReserve } from '../shared/lend.BzG5ldOV.mjs';
|
|
7
8
|
|
|
8
9
|
const address = "jupnw4B6Eqs7ft6rxpzYLJZYSnrpRgPcr589n5Kv4oc";
|
|
9
10
|
const metadata = {
|
|
@@ -1288,12 +1289,12 @@ async function getOtherInstructionsOperate(vaultId, vaultState, currentPosition,
|
|
|
1288
1289
|
tickToRead.push(currentPosition.tick);
|
|
1289
1290
|
tickToRead.push(finalPosition.tick);
|
|
1290
1291
|
if (tickToRead.length > 0) {
|
|
1291
|
-
const
|
|
1292
|
+
const tickData = await program.account.tick.fetchMultiple(
|
|
1292
1293
|
tickToRead.map((tick) => getTick(vaultId, tick))
|
|
1293
1294
|
);
|
|
1294
|
-
currentTickData =
|
|
1295
|
-
finalTickData =
|
|
1296
|
-
for (const [i, tickDatum] of
|
|
1295
|
+
currentTickData = tickData[0];
|
|
1296
|
+
finalTickData = tickData[2];
|
|
1297
|
+
for (const [i, tickDatum] of tickData.entries()) {
|
|
1297
1298
|
if (!tickDatum) {
|
|
1298
1299
|
const ix = await program.methods.initTick(vaultId, tickToRead[i]).accounts(getInitTickContext(vaultId, tickToRead[i], signer)).instruction();
|
|
1299
1300
|
otherIxs.push(ix);
|
|
@@ -1681,8 +1682,8 @@ function getInitTickContext(vaultId, tick, signer) {
|
|
|
1681
1682
|
};
|
|
1682
1683
|
}
|
|
1683
1684
|
async function getInitTickIdLiquidationContext(vaultId, tick, signer, program) {
|
|
1684
|
-
const
|
|
1685
|
-
if (!
|
|
1685
|
+
const tickData = await program.account.tick.fetch(getTick(vaultId, tick)).catch(() => null);
|
|
1686
|
+
if (!tickData) {
|
|
1686
1687
|
return {
|
|
1687
1688
|
signer,
|
|
1688
1689
|
vaultConfig: getVaultConfig(vaultId),
|
|
@@ -1697,7 +1698,7 @@ async function getInitTickIdLiquidationContext(vaultId, tick, signer, program) {
|
|
|
1697
1698
|
tickIdLiquidation: getTickIdLiquidation(
|
|
1698
1699
|
vaultId,
|
|
1699
1700
|
tick,
|
|
1700
|
-
|
|
1701
|
+
tickData.totalIds
|
|
1701
1702
|
),
|
|
1702
1703
|
tickData: getTick(vaultId, tick),
|
|
1703
1704
|
systemProgram: SystemProgram.programId
|
|
@@ -1867,7 +1868,7 @@ async function getOtherInstructionsLiquidate(vaultId, vaultState, program, signe
|
|
|
1867
1868
|
const otherIxs = [];
|
|
1868
1869
|
let newBranchId = vaultState.branchLiquidated === 1 ? vaultState.totalBranchId + 1 : vaultState.currentBranchId;
|
|
1869
1870
|
let newBranchPda = getBranch(vaultId, newBranchId);
|
|
1870
|
-
const [newBranchData] = await Promise.all([
|
|
1871
|
+
const [newBranchData, tickData] = await Promise.all([
|
|
1871
1872
|
program.account.branch.fetch(newBranchPda).catch(() => null),
|
|
1872
1873
|
// might be possible that liquidation ends on a tick that is not initialized
|
|
1873
1874
|
program.account.tick.fetch(getTick(vaultId, vaultState.topmostTick)).catch(() => null)
|
|
@@ -1948,15 +1949,15 @@ async function getRemainingAccountsLiquidate(vaultId, vaultState, otherIxs, orac
|
|
|
1948
1949
|
const tickToInit = [];
|
|
1949
1950
|
const existingTicks = await Promise.all(
|
|
1950
1951
|
tickAccounts.map(
|
|
1951
|
-
(
|
|
1952
|
+
(tickData) => program.account.tick.fetch(getTick(vaultId, tickData.tick)).catch(() => null)
|
|
1952
1953
|
)
|
|
1953
1954
|
);
|
|
1954
1955
|
const initInstructions = await Promise.all(
|
|
1955
|
-
tickAccounts.map(async (
|
|
1956
|
+
tickAccounts.map(async (tickData, index) => {
|
|
1956
1957
|
const existingTick = existingTicks[index];
|
|
1957
|
-
if (!existingTick && !tickToInit.includes(
|
|
1958
|
-
tickToInit.push(
|
|
1959
|
-
return program.methods.initTick(vaultId,
|
|
1958
|
+
if (!existingTick && !tickToInit.includes(tickData.tick)) {
|
|
1959
|
+
tickToInit.push(tickData.tick);
|
|
1960
|
+
return program.methods.initTick(vaultId, tickData.tick).accounts(getInitTickContext(vaultId, tickData.tick, signer)).instruction();
|
|
1960
1961
|
}
|
|
1961
1962
|
return null;
|
|
1962
1963
|
})
|
|
@@ -1966,9 +1967,9 @@ async function getRemainingAccountsLiquidate(vaultId, vaultState, otherIxs, orac
|
|
|
1966
1967
|
otherIxs.push(ix);
|
|
1967
1968
|
}
|
|
1968
1969
|
}
|
|
1969
|
-
for (const
|
|
1970
|
+
for (const tickData of tickAccounts) {
|
|
1970
1971
|
remainingAccounts.push({
|
|
1971
|
-
pubkey: getTick(vaultId,
|
|
1972
|
+
pubkey: getTick(vaultId, tickData.tick),
|
|
1972
1973
|
isWritable: true,
|
|
1973
1974
|
isSigner: false
|
|
1974
1975
|
});
|
package/dist/earn/index.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { SYSVAR_INSTRUCTIONS_PUBKEY, SystemProgram, PublicKey } from '@solana/web3.js';
|
|
2
2
|
import { ASSOCIATED_TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync } from '@solana/spl-token';
|
|
3
3
|
import { Program } from '@coral-xyz/anchor';
|
|
4
|
-
import { g as getLendingToken, b as getLending, c as getLendingRewardsRateModel, d as getClaimAccount, e as getLendingAdmin, f as lending } from '../shared/lend.
|
|
5
|
-
import {
|
|
4
|
+
import { g as getLendingToken, b as getLending, c as getLendingRewardsRateModel, d as getClaimAccount, e as getLendingAdmin, f as lending } from '../shared/lend.BqYn-LEf.mjs';
|
|
5
|
+
import { l as liquidity } from '../shared/lend.CioR9-te.mjs';
|
|
6
|
+
import { g as getLiquidity, a as getRateModel, b as getUserBorrowPosition, c as getUserSupplyPosition, d as getTokenReserveFromAsset } from '../shared/lend.BzG5ldOV.mjs';
|
|
6
7
|
|
|
7
8
|
const LIQUIDITY_PROGRAM_ID = new PublicKey(liquidity.address);
|
|
8
9
|
const getLendingProgram = ({
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as _solana_web3_js from '@solana/web3.js';
|
|
2
|
+
import { Connection, PublicKey } from '@solana/web3.js';
|
|
3
|
+
import BN from 'bn.js';
|
|
4
|
+
|
|
5
|
+
type ConnectionParams = {
|
|
6
|
+
connection: Connection;
|
|
7
|
+
signer: PublicKey;
|
|
8
|
+
};
|
|
9
|
+
type FlashloanContextParams = {
|
|
10
|
+
asset: PublicKey;
|
|
11
|
+
signer: PublicKey;
|
|
12
|
+
} & ConnectionParams;
|
|
13
|
+
type FlashloanParams = {
|
|
14
|
+
amount: BN;
|
|
15
|
+
} & FlashloanContextParams;
|
|
16
|
+
type FlashPaybackParams = {
|
|
17
|
+
amount: BN;
|
|
18
|
+
} & FlashloanContextParams;
|
|
19
|
+
type FlashBorrowParams = {
|
|
20
|
+
amount: BN;
|
|
21
|
+
} & FlashloanContextParams;
|
|
22
|
+
declare function getFlashloanContext({ signer, asset, connection, }: FlashloanContextParams): Promise<{
|
|
23
|
+
signer: PublicKey;
|
|
24
|
+
flashloanAdmin: PublicKey;
|
|
25
|
+
signerBorrowTokenAccount: PublicKey;
|
|
26
|
+
mint: PublicKey;
|
|
27
|
+
flashloanTokenReservesLiquidity: PublicKey;
|
|
28
|
+
flashloanBorrowPositionOnLiquidity: PublicKey;
|
|
29
|
+
rateModel: PublicKey;
|
|
30
|
+
vault: PublicKey;
|
|
31
|
+
liquidity: PublicKey;
|
|
32
|
+
liquidityProgram: PublicKey;
|
|
33
|
+
tokenProgram: PublicKey;
|
|
34
|
+
associatedTokenProgram: PublicKey;
|
|
35
|
+
systemProgram: PublicKey;
|
|
36
|
+
instructionSysvar: PublicKey;
|
|
37
|
+
}>;
|
|
38
|
+
declare function getFlashBorrowIx(params: FlashBorrowParams): Promise<_solana_web3_js.TransactionInstruction>;
|
|
39
|
+
declare function getFlashPaybackIx(params: FlashPaybackParams): Promise<_solana_web3_js.TransactionInstruction>;
|
|
40
|
+
declare function getFlashloanIx(params: FlashloanParams): Promise<{
|
|
41
|
+
borrowIx: _solana_web3_js.TransactionInstruction;
|
|
42
|
+
paybackIx: _solana_web3_js.TransactionInstruction;
|
|
43
|
+
}>;
|
|
44
|
+
|
|
45
|
+
export { getFlashBorrowIx, getFlashPaybackIx, getFlashloanContext, getFlashloanIx };
|
|
46
|
+
export type { ConnectionParams, FlashBorrowParams, FlashPaybackParams, FlashloanContextParams, FlashloanParams };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as _solana_web3_js from '@solana/web3.js';
|
|
2
|
+
import { Connection, PublicKey } from '@solana/web3.js';
|
|
3
|
+
import BN from 'bn.js';
|
|
4
|
+
|
|
5
|
+
type ConnectionParams = {
|
|
6
|
+
connection: Connection;
|
|
7
|
+
signer: PublicKey;
|
|
8
|
+
};
|
|
9
|
+
type FlashloanContextParams = {
|
|
10
|
+
asset: PublicKey;
|
|
11
|
+
signer: PublicKey;
|
|
12
|
+
} & ConnectionParams;
|
|
13
|
+
type FlashloanParams = {
|
|
14
|
+
amount: BN;
|
|
15
|
+
} & FlashloanContextParams;
|
|
16
|
+
type FlashPaybackParams = {
|
|
17
|
+
amount: BN;
|
|
18
|
+
} & FlashloanContextParams;
|
|
19
|
+
type FlashBorrowParams = {
|
|
20
|
+
amount: BN;
|
|
21
|
+
} & FlashloanContextParams;
|
|
22
|
+
declare function getFlashloanContext({ signer, asset, connection, }: FlashloanContextParams): Promise<{
|
|
23
|
+
signer: PublicKey;
|
|
24
|
+
flashloanAdmin: PublicKey;
|
|
25
|
+
signerBorrowTokenAccount: PublicKey;
|
|
26
|
+
mint: PublicKey;
|
|
27
|
+
flashloanTokenReservesLiquidity: PublicKey;
|
|
28
|
+
flashloanBorrowPositionOnLiquidity: PublicKey;
|
|
29
|
+
rateModel: PublicKey;
|
|
30
|
+
vault: PublicKey;
|
|
31
|
+
liquidity: PublicKey;
|
|
32
|
+
liquidityProgram: PublicKey;
|
|
33
|
+
tokenProgram: PublicKey;
|
|
34
|
+
associatedTokenProgram: PublicKey;
|
|
35
|
+
systemProgram: PublicKey;
|
|
36
|
+
instructionSysvar: PublicKey;
|
|
37
|
+
}>;
|
|
38
|
+
declare function getFlashBorrowIx(params: FlashBorrowParams): Promise<_solana_web3_js.TransactionInstruction>;
|
|
39
|
+
declare function getFlashPaybackIx(params: FlashPaybackParams): Promise<_solana_web3_js.TransactionInstruction>;
|
|
40
|
+
declare function getFlashloanIx(params: FlashloanParams): Promise<{
|
|
41
|
+
borrowIx: _solana_web3_js.TransactionInstruction;
|
|
42
|
+
paybackIx: _solana_web3_js.TransactionInstruction;
|
|
43
|
+
}>;
|
|
44
|
+
|
|
45
|
+
export { getFlashBorrowIx, getFlashPaybackIx, getFlashloanContext, getFlashloanIx };
|
|
46
|
+
export type { ConnectionParams, FlashBorrowParams, FlashPaybackParams, FlashloanContextParams, FlashloanParams };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { SYSVAR_INSTRUCTIONS_PUBKEY, SystemProgram, PublicKey } from '@solana/web3.js';
|
|
2
|
+
import BN from 'bn.js';
|
|
3
|
+
import { ASSOCIATED_TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync } from '@solana/spl-token';
|
|
4
|
+
import { g as getLiquidity, a as getRateModel, b as getFlashloanBorrowPosition, c as getLiquidityReserve, d as getFlashloanAdmin, e as flashloan } from '../shared/lend.hlqlrp9r.mjs';
|
|
5
|
+
import { l as liquidity } from '../shared/lend.CioR9-te.mjs';
|
|
6
|
+
import { Program } from '@coral-xyz/anchor';
|
|
7
|
+
|
|
8
|
+
const LIQUIDITY_PROGRAM_ID = new PublicKey(liquidity.address);
|
|
9
|
+
const getAccountOwner = async (account, connection) => {
|
|
10
|
+
const info = await connection.getAccountInfo(account);
|
|
11
|
+
if (!info)
|
|
12
|
+
throw new Error(`Account info not found for ${account.toString()}`);
|
|
13
|
+
return info.owner;
|
|
14
|
+
};
|
|
15
|
+
async function getFlashloanContext({
|
|
16
|
+
signer,
|
|
17
|
+
asset,
|
|
18
|
+
connection
|
|
19
|
+
}) {
|
|
20
|
+
const tokenProgram = await getAccountOwner(asset, connection);
|
|
21
|
+
const liquidityKey = getLiquidity();
|
|
22
|
+
return {
|
|
23
|
+
signer,
|
|
24
|
+
flashloanAdmin: getFlashloanAdmin(),
|
|
25
|
+
signerBorrowTokenAccount: getAssociatedTokenAddressSync(
|
|
26
|
+
asset,
|
|
27
|
+
signer,
|
|
28
|
+
false,
|
|
29
|
+
tokenProgram
|
|
30
|
+
),
|
|
31
|
+
mint: asset,
|
|
32
|
+
flashloanTokenReservesLiquidity: getLiquidityReserve(asset),
|
|
33
|
+
flashloanBorrowPositionOnLiquidity: getFlashloanBorrowPosition(asset),
|
|
34
|
+
rateModel: getRateModel(asset),
|
|
35
|
+
vault: getAssociatedTokenAddressSync(
|
|
36
|
+
asset,
|
|
37
|
+
liquidityKey,
|
|
38
|
+
true,
|
|
39
|
+
tokenProgram
|
|
40
|
+
),
|
|
41
|
+
liquidity: getLiquidity(),
|
|
42
|
+
liquidityProgram: new PublicKey(LIQUIDITY_PROGRAM_ID),
|
|
43
|
+
tokenProgram,
|
|
44
|
+
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
45
|
+
systemProgram: SystemProgram.programId,
|
|
46
|
+
instructionSysvar: SYSVAR_INSTRUCTIONS_PUBKEY
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
async function getFlashBorrowIx(params) {
|
|
50
|
+
const { connection, signer } = params;
|
|
51
|
+
const program = new Program(flashloan, {
|
|
52
|
+
connection,
|
|
53
|
+
publicKey: signer
|
|
54
|
+
});
|
|
55
|
+
const context = await getFlashloanContext(params);
|
|
56
|
+
return await program.methods.flashloanBorrow(params.amount).accounts(context).instruction();
|
|
57
|
+
}
|
|
58
|
+
async function getFlashPaybackIx(params) {
|
|
59
|
+
const { connection, signer } = params;
|
|
60
|
+
const program = new Program(flashloan, {
|
|
61
|
+
connection,
|
|
62
|
+
publicKey: signer
|
|
63
|
+
});
|
|
64
|
+
const context = await getFlashloanContext(params);
|
|
65
|
+
return await program.methods.flashloanPayback(params.amount).accounts(context).instruction();
|
|
66
|
+
}
|
|
67
|
+
async function getFlashloanIx(params) {
|
|
68
|
+
const { connection, signer } = params;
|
|
69
|
+
const program = new Program(flashloan, {
|
|
70
|
+
connection,
|
|
71
|
+
publicKey: signer
|
|
72
|
+
});
|
|
73
|
+
const flashloanAdmin = await program.account.flashloanAdmin.fetch(
|
|
74
|
+
getFlashloanAdmin()
|
|
75
|
+
);
|
|
76
|
+
const borrowIx = await getFlashBorrowIx(params);
|
|
77
|
+
const paybackAmount = params.amount.mul(
|
|
78
|
+
new BN(1e4 + flashloanAdmin.flashloanFee).div(new BN(1e4))
|
|
79
|
+
);
|
|
80
|
+
const paybackIx = await getFlashPaybackIx({
|
|
81
|
+
...params,
|
|
82
|
+
amount: paybackAmount
|
|
83
|
+
});
|
|
84
|
+
return { borrowIx, paybackIx };
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export { getFlashBorrowIx, getFlashPaybackIx, getFlashloanContext, getFlashloanIx };
|
package/dist/index.d.mts
CHANGED
|
@@ -21,17 +21,17 @@ declare const getSupportedTokenList: () => PublicKey;
|
|
|
21
21
|
declare const getTokenReserveFromAsset: (asset: PublicKey) => PublicKey;
|
|
22
22
|
declare const getUserSupplyPosition$1: (asset: PublicKey, protocol: PublicKey) => PublicKey;
|
|
23
23
|
declare const getUserBorrowPosition$1: (asset: PublicKey, protocol: PublicKey) => PublicKey;
|
|
24
|
-
declare const getRateModel$
|
|
24
|
+
declare const getRateModel$2: (asset: PublicKey) => PublicKey;
|
|
25
25
|
declare const getReserve: (asset: PublicKey) => PublicKey;
|
|
26
|
-
declare const getLiquidity$
|
|
26
|
+
declare const getLiquidity$2: () => PublicKey;
|
|
27
27
|
|
|
28
28
|
declare const liquidity_getReserve: typeof getReserve;
|
|
29
29
|
declare const liquidity_getSupportedTokenList: typeof getSupportedTokenList;
|
|
30
30
|
declare const liquidity_getTokenReserveFromAsset: typeof getTokenReserveFromAsset;
|
|
31
31
|
declare namespace liquidity {
|
|
32
32
|
export {
|
|
33
|
-
getLiquidity$
|
|
34
|
-
getRateModel$
|
|
33
|
+
getLiquidity$2 as getLiquidity,
|
|
34
|
+
getRateModel$2 as getRateModel,
|
|
35
35
|
liquidity_getReserve as getReserve,
|
|
36
36
|
liquidity_getSupportedTokenList as getSupportedTokenList,
|
|
37
37
|
liquidity_getTokenReserveFromAsset as getTokenReserveFromAsset,
|
|
@@ -53,7 +53,7 @@ declare const getVaultConfig: (vaultId: number) => PublicKey;
|
|
|
53
53
|
declare const getVaultMetadata: (vaultId: number) => PublicKey;
|
|
54
54
|
declare const getVaultAdmin: () => PublicKey;
|
|
55
55
|
declare const getVaultState: (vaultId: number) => PublicKey;
|
|
56
|
-
declare const getLiquidity: () => PublicKey;
|
|
56
|
+
declare const getLiquidity$1: () => PublicKey;
|
|
57
57
|
declare const getBranch: (vaultId: number, branchId: number) => PublicKey;
|
|
58
58
|
declare const getPositionMetadata: (vaultId: number, positionId: number) => PublicKey;
|
|
59
59
|
declare const getPosition: (vaultId: number, positionId: number) => PublicKey;
|
|
@@ -61,8 +61,8 @@ declare const getTick: (vaultId: number, tick: number) => PublicKey;
|
|
|
61
61
|
declare const getTickIdLiquidation: (vaultId: number, tick: number, totalIds: number) => PublicKey;
|
|
62
62
|
declare const getPositionMint: (vaultId: number, positionId: number) => PublicKey;
|
|
63
63
|
declare const getPositionTokenAccount: (vaultId: number, positionId: number, user: PublicKey) => PublicKey;
|
|
64
|
-
declare const getLiquidityReserve: (asset: PublicKey) => PublicKey;
|
|
65
|
-
declare const getRateModel: (asset: PublicKey) => PublicKey;
|
|
64
|
+
declare const getLiquidityReserve$1: (asset: PublicKey) => PublicKey;
|
|
65
|
+
declare const getRateModel$1: (asset: PublicKey) => PublicKey;
|
|
66
66
|
declare const getClaimAccount: (asset: PublicKey, user: PublicKey) => PublicKey;
|
|
67
67
|
declare const getUserSupplyPosition: (asset: PublicKey, protocol: PublicKey) => PublicKey;
|
|
68
68
|
declare const getUserBorrowPosition: (asset: PublicKey, protocol: PublicKey) => PublicKey;
|
|
@@ -70,13 +70,10 @@ declare const getTickHasDebt: (vaultId: number, index: number) => PublicKey;
|
|
|
70
70
|
|
|
71
71
|
declare const borrow_getBranch: typeof getBranch;
|
|
72
72
|
declare const borrow_getClaimAccount: typeof getClaimAccount;
|
|
73
|
-
declare const borrow_getLiquidity: typeof getLiquidity;
|
|
74
|
-
declare const borrow_getLiquidityReserve: typeof getLiquidityReserve;
|
|
75
73
|
declare const borrow_getPosition: typeof getPosition;
|
|
76
74
|
declare const borrow_getPositionMetadata: typeof getPositionMetadata;
|
|
77
75
|
declare const borrow_getPositionMint: typeof getPositionMint;
|
|
78
76
|
declare const borrow_getPositionTokenAccount: typeof getPositionTokenAccount;
|
|
79
|
-
declare const borrow_getRateModel: typeof getRateModel;
|
|
80
77
|
declare const borrow_getTick: typeof getTick;
|
|
81
78
|
declare const borrow_getTickHasDebt: typeof getTickHasDebt;
|
|
82
79
|
declare const borrow_getTickIdLiquidation: typeof getTickIdLiquidation;
|
|
@@ -90,13 +87,13 @@ declare namespace borrow {
|
|
|
90
87
|
export {
|
|
91
88
|
borrow_getBranch as getBranch,
|
|
92
89
|
borrow_getClaimAccount as getClaimAccount,
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
getLiquidity$1 as getLiquidity,
|
|
91
|
+
getLiquidityReserve$1 as getLiquidityReserve,
|
|
95
92
|
borrow_getPosition as getPosition,
|
|
96
93
|
borrow_getPositionMetadata as getPositionMetadata,
|
|
97
94
|
borrow_getPositionMint as getPositionMint,
|
|
98
95
|
borrow_getPositionTokenAccount as getPositionTokenAccount,
|
|
99
|
-
|
|
96
|
+
getRateModel$1 as getRateModel,
|
|
100
97
|
borrow_getTick as getTick,
|
|
101
98
|
borrow_getTickHasDebt as getTickHasDebt,
|
|
102
99
|
borrow_getTickIdLiquidation as getTickIdLiquidation,
|
|
@@ -109,6 +106,30 @@ declare namespace borrow {
|
|
|
109
106
|
};
|
|
110
107
|
}
|
|
111
108
|
|
|
109
|
+
declare const getFlashloanAdmin: () => PublicKey;
|
|
110
|
+
declare const getLiquidityReserve: (asset: PublicKey) => PublicKey;
|
|
111
|
+
declare const getLiquidity: () => PublicKey;
|
|
112
|
+
declare const getRateModel: (asset: PublicKey) => PublicKey;
|
|
113
|
+
declare const getFlashloanSupplyPosition: (asset: PublicKey) => PublicKey;
|
|
114
|
+
declare const getFlashloanBorrowPosition: (asset: PublicKey) => PublicKey;
|
|
115
|
+
|
|
116
|
+
declare const flashloan_getFlashloanAdmin: typeof getFlashloanAdmin;
|
|
117
|
+
declare const flashloan_getFlashloanBorrowPosition: typeof getFlashloanBorrowPosition;
|
|
118
|
+
declare const flashloan_getFlashloanSupplyPosition: typeof getFlashloanSupplyPosition;
|
|
119
|
+
declare const flashloan_getLiquidity: typeof getLiquidity;
|
|
120
|
+
declare const flashloan_getLiquidityReserve: typeof getLiquidityReserve;
|
|
121
|
+
declare const flashloan_getRateModel: typeof getRateModel;
|
|
122
|
+
declare namespace flashloan {
|
|
123
|
+
export {
|
|
124
|
+
flashloan_getFlashloanAdmin as getFlashloanAdmin,
|
|
125
|
+
flashloan_getFlashloanBorrowPosition as getFlashloanBorrowPosition,
|
|
126
|
+
flashloan_getFlashloanSupplyPosition as getFlashloanSupplyPosition,
|
|
127
|
+
flashloan_getLiquidity as getLiquidity,
|
|
128
|
+
flashloan_getLiquidityReserve as getLiquidityReserve,
|
|
129
|
+
flashloan_getRateModel as getRateModel,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
112
133
|
declare const version: string;
|
|
113
134
|
|
|
114
|
-
export { borrow as borrowPda, lending as lendingPda, lendingRewardRateModel as lendingRewardRateModelPda, liquidity as liquidityPda, version };
|
|
135
|
+
export { borrow as borrowPda, flashloan as flashloanPda, lending as lendingPda, lendingRewardRateModel as lendingRewardRateModelPda, liquidity as liquidityPda, version };
|
package/dist/index.d.ts
CHANGED
|
@@ -21,17 +21,17 @@ declare const getSupportedTokenList: () => PublicKey;
|
|
|
21
21
|
declare const getTokenReserveFromAsset: (asset: PublicKey) => PublicKey;
|
|
22
22
|
declare const getUserSupplyPosition$1: (asset: PublicKey, protocol: PublicKey) => PublicKey;
|
|
23
23
|
declare const getUserBorrowPosition$1: (asset: PublicKey, protocol: PublicKey) => PublicKey;
|
|
24
|
-
declare const getRateModel$
|
|
24
|
+
declare const getRateModel$2: (asset: PublicKey) => PublicKey;
|
|
25
25
|
declare const getReserve: (asset: PublicKey) => PublicKey;
|
|
26
|
-
declare const getLiquidity$
|
|
26
|
+
declare const getLiquidity$2: () => PublicKey;
|
|
27
27
|
|
|
28
28
|
declare const liquidity_getReserve: typeof getReserve;
|
|
29
29
|
declare const liquidity_getSupportedTokenList: typeof getSupportedTokenList;
|
|
30
30
|
declare const liquidity_getTokenReserveFromAsset: typeof getTokenReserveFromAsset;
|
|
31
31
|
declare namespace liquidity {
|
|
32
32
|
export {
|
|
33
|
-
getLiquidity$
|
|
34
|
-
getRateModel$
|
|
33
|
+
getLiquidity$2 as getLiquidity,
|
|
34
|
+
getRateModel$2 as getRateModel,
|
|
35
35
|
liquidity_getReserve as getReserve,
|
|
36
36
|
liquidity_getSupportedTokenList as getSupportedTokenList,
|
|
37
37
|
liquidity_getTokenReserveFromAsset as getTokenReserveFromAsset,
|
|
@@ -53,7 +53,7 @@ declare const getVaultConfig: (vaultId: number) => PublicKey;
|
|
|
53
53
|
declare const getVaultMetadata: (vaultId: number) => PublicKey;
|
|
54
54
|
declare const getVaultAdmin: () => PublicKey;
|
|
55
55
|
declare const getVaultState: (vaultId: number) => PublicKey;
|
|
56
|
-
declare const getLiquidity: () => PublicKey;
|
|
56
|
+
declare const getLiquidity$1: () => PublicKey;
|
|
57
57
|
declare const getBranch: (vaultId: number, branchId: number) => PublicKey;
|
|
58
58
|
declare const getPositionMetadata: (vaultId: number, positionId: number) => PublicKey;
|
|
59
59
|
declare const getPosition: (vaultId: number, positionId: number) => PublicKey;
|
|
@@ -61,8 +61,8 @@ declare const getTick: (vaultId: number, tick: number) => PublicKey;
|
|
|
61
61
|
declare const getTickIdLiquidation: (vaultId: number, tick: number, totalIds: number) => PublicKey;
|
|
62
62
|
declare const getPositionMint: (vaultId: number, positionId: number) => PublicKey;
|
|
63
63
|
declare const getPositionTokenAccount: (vaultId: number, positionId: number, user: PublicKey) => PublicKey;
|
|
64
|
-
declare const getLiquidityReserve: (asset: PublicKey) => PublicKey;
|
|
65
|
-
declare const getRateModel: (asset: PublicKey) => PublicKey;
|
|
64
|
+
declare const getLiquidityReserve$1: (asset: PublicKey) => PublicKey;
|
|
65
|
+
declare const getRateModel$1: (asset: PublicKey) => PublicKey;
|
|
66
66
|
declare const getClaimAccount: (asset: PublicKey, user: PublicKey) => PublicKey;
|
|
67
67
|
declare const getUserSupplyPosition: (asset: PublicKey, protocol: PublicKey) => PublicKey;
|
|
68
68
|
declare const getUserBorrowPosition: (asset: PublicKey, protocol: PublicKey) => PublicKey;
|
|
@@ -70,13 +70,10 @@ declare const getTickHasDebt: (vaultId: number, index: number) => PublicKey;
|
|
|
70
70
|
|
|
71
71
|
declare const borrow_getBranch: typeof getBranch;
|
|
72
72
|
declare const borrow_getClaimAccount: typeof getClaimAccount;
|
|
73
|
-
declare const borrow_getLiquidity: typeof getLiquidity;
|
|
74
|
-
declare const borrow_getLiquidityReserve: typeof getLiquidityReserve;
|
|
75
73
|
declare const borrow_getPosition: typeof getPosition;
|
|
76
74
|
declare const borrow_getPositionMetadata: typeof getPositionMetadata;
|
|
77
75
|
declare const borrow_getPositionMint: typeof getPositionMint;
|
|
78
76
|
declare const borrow_getPositionTokenAccount: typeof getPositionTokenAccount;
|
|
79
|
-
declare const borrow_getRateModel: typeof getRateModel;
|
|
80
77
|
declare const borrow_getTick: typeof getTick;
|
|
81
78
|
declare const borrow_getTickHasDebt: typeof getTickHasDebt;
|
|
82
79
|
declare const borrow_getTickIdLiquidation: typeof getTickIdLiquidation;
|
|
@@ -90,13 +87,13 @@ declare namespace borrow {
|
|
|
90
87
|
export {
|
|
91
88
|
borrow_getBranch as getBranch,
|
|
92
89
|
borrow_getClaimAccount as getClaimAccount,
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
getLiquidity$1 as getLiquidity,
|
|
91
|
+
getLiquidityReserve$1 as getLiquidityReserve,
|
|
95
92
|
borrow_getPosition as getPosition,
|
|
96
93
|
borrow_getPositionMetadata as getPositionMetadata,
|
|
97
94
|
borrow_getPositionMint as getPositionMint,
|
|
98
95
|
borrow_getPositionTokenAccount as getPositionTokenAccount,
|
|
99
|
-
|
|
96
|
+
getRateModel$1 as getRateModel,
|
|
100
97
|
borrow_getTick as getTick,
|
|
101
98
|
borrow_getTickHasDebt as getTickHasDebt,
|
|
102
99
|
borrow_getTickIdLiquidation as getTickIdLiquidation,
|
|
@@ -109,6 +106,30 @@ declare namespace borrow {
|
|
|
109
106
|
};
|
|
110
107
|
}
|
|
111
108
|
|
|
109
|
+
declare const getFlashloanAdmin: () => PublicKey;
|
|
110
|
+
declare const getLiquidityReserve: (asset: PublicKey) => PublicKey;
|
|
111
|
+
declare const getLiquidity: () => PublicKey;
|
|
112
|
+
declare const getRateModel: (asset: PublicKey) => PublicKey;
|
|
113
|
+
declare const getFlashloanSupplyPosition: (asset: PublicKey) => PublicKey;
|
|
114
|
+
declare const getFlashloanBorrowPosition: (asset: PublicKey) => PublicKey;
|
|
115
|
+
|
|
116
|
+
declare const flashloan_getFlashloanAdmin: typeof getFlashloanAdmin;
|
|
117
|
+
declare const flashloan_getFlashloanBorrowPosition: typeof getFlashloanBorrowPosition;
|
|
118
|
+
declare const flashloan_getFlashloanSupplyPosition: typeof getFlashloanSupplyPosition;
|
|
119
|
+
declare const flashloan_getLiquidity: typeof getLiquidity;
|
|
120
|
+
declare const flashloan_getLiquidityReserve: typeof getLiquidityReserve;
|
|
121
|
+
declare const flashloan_getRateModel: typeof getRateModel;
|
|
122
|
+
declare namespace flashloan {
|
|
123
|
+
export {
|
|
124
|
+
flashloan_getFlashloanAdmin as getFlashloanAdmin,
|
|
125
|
+
flashloan_getFlashloanBorrowPosition as getFlashloanBorrowPosition,
|
|
126
|
+
flashloan_getFlashloanSupplyPosition as getFlashloanSupplyPosition,
|
|
127
|
+
flashloan_getLiquidity as getLiquidity,
|
|
128
|
+
flashloan_getLiquidityReserve as getLiquidityReserve,
|
|
129
|
+
flashloan_getRateModel as getRateModel,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
112
133
|
declare const version: string;
|
|
113
134
|
|
|
114
|
-
export { borrow as borrowPda, lending as lendingPda, lendingRewardRateModel as lendingRewardRateModelPda, liquidity as liquidityPda, version };
|
|
135
|
+
export { borrow as borrowPda, flashloan as flashloanPda, lending as lendingPda, lendingRewardRateModel as lendingRewardRateModelPda, liquidity as liquidityPda, version };
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
export { l as lendingPda, a as lendingRewardRateModelPda } from './shared/lend.
|
|
2
|
-
export { l as liquidityPda } from './shared/lend.
|
|
3
|
-
export { b as borrowPda } from './shared/lend.
|
|
1
|
+
export { l as lendingPda, a as lendingRewardRateModelPda } from './shared/lend.BqYn-LEf.mjs';
|
|
2
|
+
export { l as liquidityPda } from './shared/lend.BzG5ldOV.mjs';
|
|
3
|
+
export { b as borrowPda } from './shared/lend.uRnzld7B.mjs';
|
|
4
|
+
export { f as flashloanPda } from './shared/lend.hlqlrp9r.mjs';
|
|
4
5
|
import '@solana/web3.js';
|
|
6
|
+
import './shared/lend.CioR9-te.mjs';
|
|
5
7
|
import '@solana/spl-token';
|
|
6
8
|
import 'bn.js';
|
|
7
9
|
|
|
8
|
-
const version = "0.0.
|
|
10
|
+
const version = "0.0.69";
|
|
9
11
|
|
|
10
12
|
export { version };
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { PublicKey } from '@solana/web3.js';
|
|
2
|
-
|
|
3
|
-
const address = "jupeiUmn818Jg1ekPURTpr4mFo29p46vygyykFJ3wZC";
|
|
4
|
-
const liquidity$1 = {
|
|
5
|
-
address: address};
|
|
2
|
+
import { a as address } from './lend.CioR9-te.mjs';
|
|
6
3
|
|
|
7
4
|
const LIQUIDITY_PROGRAM_ID = new PublicKey(address);
|
|
8
5
|
const getSupportedTokenList = () => {
|
|
@@ -67,4 +64,4 @@ const liquidity = {
|
|
|
67
64
|
getUserSupplyPosition: getUserSupplyPosition
|
|
68
65
|
};
|
|
69
66
|
|
|
70
|
-
export { getRateModel as a, getUserBorrowPosition as b, getUserSupplyPosition as c, getTokenReserveFromAsset as d,
|
|
67
|
+
export { getRateModel as a, getUserBorrowPosition as b, getUserSupplyPosition as c, getTokenReserveFromAsset as d, getReserve as e, getLiquidity as g, liquidity as l };
|
|
@@ -0,0 +1,661 @@
|
|
|
1
|
+
import { PublicKey } from '@solana/web3.js';
|
|
2
|
+
import { a as address$1 } from './lend.CioR9-te.mjs';
|
|
3
|
+
|
|
4
|
+
const address = "jupgfSgfuAXv4B6R2Uxu85Z1qdzgju79s6MfZekN6XS";
|
|
5
|
+
const metadata = {
|
|
6
|
+
name: "flashloan",
|
|
7
|
+
version: "0.1.0",
|
|
8
|
+
spec: "0.1.0",
|
|
9
|
+
description: "Created with Anchor"
|
|
10
|
+
};
|
|
11
|
+
const instructions = [
|
|
12
|
+
{
|
|
13
|
+
name: "activate_protocol",
|
|
14
|
+
discriminator: [
|
|
15
|
+
230,
|
|
16
|
+
235,
|
|
17
|
+
188,
|
|
18
|
+
19,
|
|
19
|
+
120,
|
|
20
|
+
91,
|
|
21
|
+
11,
|
|
22
|
+
94
|
|
23
|
+
],
|
|
24
|
+
accounts: [
|
|
25
|
+
{
|
|
26
|
+
name: "authority",
|
|
27
|
+
signer: true
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: "flashloan_admin",
|
|
31
|
+
writable: true
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
args: [
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: "flashloan_borrow",
|
|
39
|
+
discriminator: [
|
|
40
|
+
103,
|
|
41
|
+
19,
|
|
42
|
+
78,
|
|
43
|
+
24,
|
|
44
|
+
240,
|
|
45
|
+
9,
|
|
46
|
+
135,
|
|
47
|
+
63
|
|
48
|
+
],
|
|
49
|
+
accounts: [
|
|
50
|
+
{
|
|
51
|
+
name: "signer",
|
|
52
|
+
writable: true,
|
|
53
|
+
signer: true
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "flashloan_admin",
|
|
57
|
+
writable: true
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "signer_borrow_token_account",
|
|
61
|
+
writable: true,
|
|
62
|
+
pda: {
|
|
63
|
+
seeds: [
|
|
64
|
+
{
|
|
65
|
+
kind: "account",
|
|
66
|
+
path: "signer"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
kind: "account",
|
|
70
|
+
path: "token_program"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
kind: "account",
|
|
74
|
+
path: "mint"
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
program: {
|
|
78
|
+
kind: "const",
|
|
79
|
+
value: [
|
|
80
|
+
140,
|
|
81
|
+
151,
|
|
82
|
+
37,
|
|
83
|
+
143,
|
|
84
|
+
78,
|
|
85
|
+
36,
|
|
86
|
+
137,
|
|
87
|
+
241,
|
|
88
|
+
187,
|
|
89
|
+
61,
|
|
90
|
+
16,
|
|
91
|
+
41,
|
|
92
|
+
20,
|
|
93
|
+
142,
|
|
94
|
+
13,
|
|
95
|
+
131,
|
|
96
|
+
11,
|
|
97
|
+
90,
|
|
98
|
+
19,
|
|
99
|
+
153,
|
|
100
|
+
218,
|
|
101
|
+
255,
|
|
102
|
+
16,
|
|
103
|
+
132,
|
|
104
|
+
4,
|
|
105
|
+
142,
|
|
106
|
+
123,
|
|
107
|
+
216,
|
|
108
|
+
219,
|
|
109
|
+
233,
|
|
110
|
+
248,
|
|
111
|
+
89
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: "mint"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: "flashloan_token_reserves_liquidity",
|
|
121
|
+
writable: true
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
name: "flashloan_borrow_position_on_liquidity",
|
|
125
|
+
writable: true
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: "rate_model"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: "vault",
|
|
132
|
+
writable: true
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: "liquidity"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: "liquidity_program"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
name: "token_program"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: "associated_token_program",
|
|
145
|
+
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: "system_program",
|
|
149
|
+
address: "11111111111111111111111111111111"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: "instruction_sysvar",
|
|
153
|
+
address: "Sysvar1nstructions1111111111111111111111111"
|
|
154
|
+
}
|
|
155
|
+
],
|
|
156
|
+
args: [
|
|
157
|
+
{
|
|
158
|
+
name: "amount",
|
|
159
|
+
type: "u64"
|
|
160
|
+
}
|
|
161
|
+
]
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
name: "flashloan_payback",
|
|
165
|
+
discriminator: [
|
|
166
|
+
213,
|
|
167
|
+
47,
|
|
168
|
+
153,
|
|
169
|
+
137,
|
|
170
|
+
84,
|
|
171
|
+
243,
|
|
172
|
+
94,
|
|
173
|
+
232
|
|
174
|
+
],
|
|
175
|
+
accounts: [
|
|
176
|
+
{
|
|
177
|
+
name: "signer",
|
|
178
|
+
writable: true,
|
|
179
|
+
signer: true
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
name: "flashloan_admin",
|
|
183
|
+
writable: true
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
name: "signer_borrow_token_account",
|
|
187
|
+
writable: true,
|
|
188
|
+
pda: {
|
|
189
|
+
seeds: [
|
|
190
|
+
{
|
|
191
|
+
kind: "account",
|
|
192
|
+
path: "signer"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
kind: "account",
|
|
196
|
+
path: "token_program"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
kind: "account",
|
|
200
|
+
path: "mint"
|
|
201
|
+
}
|
|
202
|
+
],
|
|
203
|
+
program: {
|
|
204
|
+
kind: "const",
|
|
205
|
+
value: [
|
|
206
|
+
140,
|
|
207
|
+
151,
|
|
208
|
+
37,
|
|
209
|
+
143,
|
|
210
|
+
78,
|
|
211
|
+
36,
|
|
212
|
+
137,
|
|
213
|
+
241,
|
|
214
|
+
187,
|
|
215
|
+
61,
|
|
216
|
+
16,
|
|
217
|
+
41,
|
|
218
|
+
20,
|
|
219
|
+
142,
|
|
220
|
+
13,
|
|
221
|
+
131,
|
|
222
|
+
11,
|
|
223
|
+
90,
|
|
224
|
+
19,
|
|
225
|
+
153,
|
|
226
|
+
218,
|
|
227
|
+
255,
|
|
228
|
+
16,
|
|
229
|
+
132,
|
|
230
|
+
4,
|
|
231
|
+
142,
|
|
232
|
+
123,
|
|
233
|
+
216,
|
|
234
|
+
219,
|
|
235
|
+
233,
|
|
236
|
+
248,
|
|
237
|
+
89
|
|
238
|
+
]
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
name: "mint"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
name: "flashloan_token_reserves_liquidity",
|
|
247
|
+
writable: true
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
name: "flashloan_borrow_position_on_liquidity",
|
|
251
|
+
writable: true
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
name: "rate_model"
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
name: "vault",
|
|
258
|
+
writable: true
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
name: "liquidity"
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
name: "liquidity_program"
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
name: "token_program"
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
name: "associated_token_program",
|
|
271
|
+
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
name: "system_program",
|
|
275
|
+
address: "11111111111111111111111111111111"
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
name: "instruction_sysvar",
|
|
279
|
+
address: "Sysvar1nstructions1111111111111111111111111"
|
|
280
|
+
}
|
|
281
|
+
],
|
|
282
|
+
args: [
|
|
283
|
+
{
|
|
284
|
+
name: "amount",
|
|
285
|
+
type: "u64"
|
|
286
|
+
}
|
|
287
|
+
]
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
name: "init_flashloan_admin",
|
|
291
|
+
discriminator: [
|
|
292
|
+
185,
|
|
293
|
+
117,
|
|
294
|
+
154,
|
|
295
|
+
56,
|
|
296
|
+
95,
|
|
297
|
+
12,
|
|
298
|
+
187,
|
|
299
|
+
139
|
|
300
|
+
],
|
|
301
|
+
accounts: [
|
|
302
|
+
{
|
|
303
|
+
name: "signer",
|
|
304
|
+
writable: true,
|
|
305
|
+
signer: true
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
name: "flashloan_admin",
|
|
309
|
+
writable: true,
|
|
310
|
+
pda: {
|
|
311
|
+
seeds: [
|
|
312
|
+
{
|
|
313
|
+
kind: "const",
|
|
314
|
+
value: [
|
|
315
|
+
102,
|
|
316
|
+
108,
|
|
317
|
+
97,
|
|
318
|
+
115,
|
|
319
|
+
104,
|
|
320
|
+
108,
|
|
321
|
+
111,
|
|
322
|
+
97,
|
|
323
|
+
110,
|
|
324
|
+
95,
|
|
325
|
+
97,
|
|
326
|
+
100,
|
|
327
|
+
109,
|
|
328
|
+
105,
|
|
329
|
+
110
|
|
330
|
+
]
|
|
331
|
+
}
|
|
332
|
+
]
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
name: "system_program",
|
|
337
|
+
address: "11111111111111111111111111111111"
|
|
338
|
+
}
|
|
339
|
+
],
|
|
340
|
+
args: [
|
|
341
|
+
{
|
|
342
|
+
name: "authority",
|
|
343
|
+
type: "pubkey"
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
name: "flashloan_fee",
|
|
347
|
+
type: "u16"
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
name: "liquidity_program",
|
|
351
|
+
type: "pubkey"
|
|
352
|
+
}
|
|
353
|
+
]
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
name: "pause_protocol",
|
|
357
|
+
discriminator: [
|
|
358
|
+
144,
|
|
359
|
+
95,
|
|
360
|
+
0,
|
|
361
|
+
107,
|
|
362
|
+
119,
|
|
363
|
+
39,
|
|
364
|
+
248,
|
|
365
|
+
141
|
|
366
|
+
],
|
|
367
|
+
accounts: [
|
|
368
|
+
{
|
|
369
|
+
name: "authority",
|
|
370
|
+
signer: true
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
name: "flashloan_admin",
|
|
374
|
+
writable: true
|
|
375
|
+
}
|
|
376
|
+
],
|
|
377
|
+
args: [
|
|
378
|
+
]
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
name: "set_flashloan_fee",
|
|
382
|
+
discriminator: [
|
|
383
|
+
120,
|
|
384
|
+
248,
|
|
385
|
+
221,
|
|
386
|
+
70,
|
|
387
|
+
84,
|
|
388
|
+
216,
|
|
389
|
+
0,
|
|
390
|
+
149
|
|
391
|
+
],
|
|
392
|
+
accounts: [
|
|
393
|
+
{
|
|
394
|
+
name: "authority",
|
|
395
|
+
signer: true
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
name: "flashloan_admin",
|
|
399
|
+
writable: true
|
|
400
|
+
}
|
|
401
|
+
],
|
|
402
|
+
args: [
|
|
403
|
+
{
|
|
404
|
+
name: "flashloan_fee",
|
|
405
|
+
type: "u16"
|
|
406
|
+
}
|
|
407
|
+
]
|
|
408
|
+
}
|
|
409
|
+
];
|
|
410
|
+
const accounts = [
|
|
411
|
+
{
|
|
412
|
+
name: "FlashloanAdmin",
|
|
413
|
+
discriminator: [
|
|
414
|
+
162,
|
|
415
|
+
161,
|
|
416
|
+
45,
|
|
417
|
+
28,
|
|
418
|
+
131,
|
|
419
|
+
91,
|
|
420
|
+
202,
|
|
421
|
+
88
|
|
422
|
+
]
|
|
423
|
+
}
|
|
424
|
+
];
|
|
425
|
+
const events = [
|
|
426
|
+
{
|
|
427
|
+
name: "ActivateProtocol",
|
|
428
|
+
discriminator: [
|
|
429
|
+
70,
|
|
430
|
+
178,
|
|
431
|
+
173,
|
|
432
|
+
151,
|
|
433
|
+
180,
|
|
434
|
+
166,
|
|
435
|
+
68,
|
|
436
|
+
102
|
|
437
|
+
]
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
name: "PauseProtocol",
|
|
441
|
+
discriminator: [
|
|
442
|
+
66,
|
|
443
|
+
229,
|
|
444
|
+
166,
|
|
445
|
+
147,
|
|
446
|
+
152,
|
|
447
|
+
13,
|
|
448
|
+
42,
|
|
449
|
+
29
|
|
450
|
+
]
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
name: "SetFlashloanFee",
|
|
454
|
+
discriminator: [
|
|
455
|
+
112,
|
|
456
|
+
164,
|
|
457
|
+
66,
|
|
458
|
+
251,
|
|
459
|
+
191,
|
|
460
|
+
56,
|
|
461
|
+
0,
|
|
462
|
+
47
|
|
463
|
+
]
|
|
464
|
+
}
|
|
465
|
+
];
|
|
466
|
+
const errors = [
|
|
467
|
+
{
|
|
468
|
+
code: 6000,
|
|
469
|
+
name: "FlashloanInvalidAuthority",
|
|
470
|
+
msg: "FLASHLOAN_INVALID_AUTHORITY"
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
code: 6001,
|
|
474
|
+
name: "FlashloanFeeTooHigh",
|
|
475
|
+
msg: "FLASHLOAN_FEE_TOO_HIGH"
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
code: 6002,
|
|
479
|
+
name: "FlashloanInvalidParams",
|
|
480
|
+
msg: "FLASHLOAN_INVALID_PARAMS"
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
code: 6003,
|
|
484
|
+
name: "FlashloanAlreadyActive",
|
|
485
|
+
msg: "FLASHLOAN_ALREADY_ACTIVE"
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
code: 6004,
|
|
489
|
+
name: "FlashloanAlreadyInactive",
|
|
490
|
+
msg: "FLASHLOAN_ALREADY_INACTIVE"
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
code: 6005,
|
|
494
|
+
name: "FlashloanCpiToLiquidityFailed",
|
|
495
|
+
msg: "FLASHLOAN_CPI_TO_LIQUIDITY_FAILED"
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
code: 6006,
|
|
499
|
+
name: "FlashloanNotAllowedInThisSlot",
|
|
500
|
+
msg: "FLASHLOAN_NOT_ALLOWED_IN_THIS_SLOT"
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
code: 6007,
|
|
504
|
+
name: "FlashloanInvalidInstructionSysvar",
|
|
505
|
+
msg: "FLASHLOAN_INVALID_INSTRUCTION_SYSVAR"
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
code: 6008,
|
|
509
|
+
name: "FlashloanInvalidInstructionData",
|
|
510
|
+
msg: "FLASHLOAN_INVALID_INSTRUCTION_DATA"
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
code: 6009,
|
|
514
|
+
name: "FlashloanPaybackNotFound",
|
|
515
|
+
msg: "FLASHLOAN_PAYBACK_NOT_FOUND"
|
|
516
|
+
}
|
|
517
|
+
];
|
|
518
|
+
const types = [
|
|
519
|
+
{
|
|
520
|
+
name: "ActivateProtocol",
|
|
521
|
+
type: {
|
|
522
|
+
kind: "struct",
|
|
523
|
+
fields: [
|
|
524
|
+
]
|
|
525
|
+
}
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
name: "FlashloanAdmin",
|
|
529
|
+
type: {
|
|
530
|
+
kind: "struct",
|
|
531
|
+
fields: [
|
|
532
|
+
{
|
|
533
|
+
name: "authority",
|
|
534
|
+
type: "pubkey"
|
|
535
|
+
},
|
|
536
|
+
{
|
|
537
|
+
name: "liquidity_program",
|
|
538
|
+
type: "pubkey"
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
name: "status",
|
|
542
|
+
type: "bool"
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
name: "flashloan_fee",
|
|
546
|
+
type: "u16"
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
name: "flashloan_timestamp",
|
|
550
|
+
type: "u64"
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
name: "is_flashloan_active",
|
|
554
|
+
type: "bool"
|
|
555
|
+
},
|
|
556
|
+
{
|
|
557
|
+
name: "active_flashloan_amount",
|
|
558
|
+
type: "u64"
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
name: "bump",
|
|
562
|
+
type: "u8"
|
|
563
|
+
}
|
|
564
|
+
]
|
|
565
|
+
}
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
name: "PauseProtocol",
|
|
569
|
+
type: {
|
|
570
|
+
kind: "struct",
|
|
571
|
+
fields: [
|
|
572
|
+
]
|
|
573
|
+
}
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
name: "SetFlashloanFee",
|
|
577
|
+
type: {
|
|
578
|
+
kind: "struct",
|
|
579
|
+
fields: [
|
|
580
|
+
{
|
|
581
|
+
name: "flashloan_fee",
|
|
582
|
+
type: "u16"
|
|
583
|
+
}
|
|
584
|
+
]
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
];
|
|
588
|
+
const flashloan$1 = {
|
|
589
|
+
address: address,
|
|
590
|
+
metadata: metadata,
|
|
591
|
+
instructions: instructions,
|
|
592
|
+
accounts: accounts,
|
|
593
|
+
events: events,
|
|
594
|
+
errors: errors,
|
|
595
|
+
types: types
|
|
596
|
+
};
|
|
597
|
+
|
|
598
|
+
const FLASHLOAN_PROGRAM_ID = new PublicKey(address);
|
|
599
|
+
const LIQUIDITY_PROGRAM_ID = new PublicKey(address$1);
|
|
600
|
+
const getFlashloanAdmin = () => {
|
|
601
|
+
const [pda] = PublicKey.findProgramAddressSync(
|
|
602
|
+
[Buffer.from("flashloan_admin")],
|
|
603
|
+
FLASHLOAN_PROGRAM_ID
|
|
604
|
+
);
|
|
605
|
+
return pda;
|
|
606
|
+
};
|
|
607
|
+
const getLiquidityReserve = (asset) => {
|
|
608
|
+
const [pda] = PublicKey.findProgramAddressSync(
|
|
609
|
+
[Buffer.from("reserve"), asset.toBuffer()],
|
|
610
|
+
LIQUIDITY_PROGRAM_ID
|
|
611
|
+
);
|
|
612
|
+
return pda;
|
|
613
|
+
};
|
|
614
|
+
const getLiquidity = () => {
|
|
615
|
+
const [pda] = PublicKey.findProgramAddressSync(
|
|
616
|
+
[Buffer.from("liquidity")],
|
|
617
|
+
LIQUIDITY_PROGRAM_ID
|
|
618
|
+
);
|
|
619
|
+
return pda;
|
|
620
|
+
};
|
|
621
|
+
const getRateModel = (asset) => {
|
|
622
|
+
const [pda] = PublicKey.findProgramAddressSync(
|
|
623
|
+
[Buffer.from("rate_model"), asset.toBuffer()],
|
|
624
|
+
LIQUIDITY_PROGRAM_ID
|
|
625
|
+
);
|
|
626
|
+
return pda;
|
|
627
|
+
};
|
|
628
|
+
const getFlashloanSupplyPosition = (asset) => {
|
|
629
|
+
const [pda] = PublicKey.findProgramAddressSync(
|
|
630
|
+
[
|
|
631
|
+
Buffer.from("user_supply_position"),
|
|
632
|
+
asset.toBuffer(),
|
|
633
|
+
getFlashloanAdmin().toBuffer()
|
|
634
|
+
],
|
|
635
|
+
LIQUIDITY_PROGRAM_ID
|
|
636
|
+
);
|
|
637
|
+
return pda;
|
|
638
|
+
};
|
|
639
|
+
const getFlashloanBorrowPosition = (asset) => {
|
|
640
|
+
const [pda] = PublicKey.findProgramAddressSync(
|
|
641
|
+
[
|
|
642
|
+
Buffer.from("user_borrow_position"),
|
|
643
|
+
asset.toBuffer(),
|
|
644
|
+
getFlashloanAdmin().toBuffer()
|
|
645
|
+
],
|
|
646
|
+
LIQUIDITY_PROGRAM_ID
|
|
647
|
+
);
|
|
648
|
+
return pda;
|
|
649
|
+
};
|
|
650
|
+
|
|
651
|
+
const flashloan = {
|
|
652
|
+
__proto__: null,
|
|
653
|
+
getFlashloanAdmin: getFlashloanAdmin,
|
|
654
|
+
getFlashloanBorrowPosition: getFlashloanBorrowPosition,
|
|
655
|
+
getFlashloanSupplyPosition: getFlashloanSupplyPosition,
|
|
656
|
+
getLiquidity: getLiquidity,
|
|
657
|
+
getLiquidityReserve: getLiquidityReserve,
|
|
658
|
+
getRateModel: getRateModel
|
|
659
|
+
};
|
|
660
|
+
|
|
661
|
+
export { getRateModel as a, getFlashloanBorrowPosition as b, getLiquidityReserve as c, getFlashloanAdmin as d, flashloan$1 as e, flashloan as f, getLiquidity as g };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jup-ag/lend",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.69",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
"types": "./dist/borrow/index.d.mts",
|
|
19
19
|
"default": "./dist/borrow/index.mjs"
|
|
20
20
|
},
|
|
21
|
+
"./flashloan": {
|
|
22
|
+
"types": "./dist/flashloan/index.d.mts",
|
|
23
|
+
"default": "./dist/flashloan/index.mjs"
|
|
24
|
+
},
|
|
21
25
|
"./api": {
|
|
22
26
|
"types": "./dist/api/index.d.mts",
|
|
23
27
|
"default": "./dist/api/index.mjs"
|