@jup-ag/lend 0.0.39 → 0.0.41
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.d.mts +11 -4
- package/dist/borrow/index.d.ts +11 -4
- package/dist/borrow/index.mjs +42 -36
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.mjs +2 -2
- package/dist/shared/{lend.OZiWki0F.mjs → lend.CovuIMuS.mjs} +16 -1
- package/package.json +1 -1
package/dist/borrow/index.d.mts
CHANGED
|
@@ -4381,15 +4381,18 @@ declare function getOperateContext({ vaultId, positionId, program, connection, s
|
|
|
4381
4381
|
lookupTable: PublicKey;
|
|
4382
4382
|
}>;
|
|
4383
4383
|
declare function getInitPositionContext(vaultId: number, positionId: number, signer: PublicKey): {
|
|
4384
|
-
signer: PublicKey;
|
|
4385
4384
|
vaultAdmin: PublicKey;
|
|
4386
4385
|
vaultState: PublicKey;
|
|
4387
4386
|
position: PublicKey;
|
|
4388
4387
|
positionMint: PublicKey;
|
|
4389
4388
|
positionTokenAccount: PublicKey;
|
|
4390
4389
|
tokenProgram: PublicKey;
|
|
4390
|
+
metadataAccount: PublicKey;
|
|
4391
4391
|
associatedTokenProgram: PublicKey;
|
|
4392
4392
|
systemProgram: PublicKey;
|
|
4393
|
+
sysvarInstruction: PublicKey;
|
|
4394
|
+
metadataProgram: PublicKey;
|
|
4395
|
+
rent: PublicKey;
|
|
4393
4396
|
};
|
|
4394
4397
|
declare const getOperateIx: ({ vaultId, positionId, colAmount, debtAmount, connection, signer, positionOwner, }: OperateParams) => Promise<{
|
|
4395
4398
|
nftId: number;
|
|
@@ -4453,6 +4456,10 @@ type GetCurrentPositionStateParams = {
|
|
|
4453
4456
|
position: PositionData;
|
|
4454
4457
|
program: Program<Vaults>;
|
|
4455
4458
|
};
|
|
4459
|
+
declare const getVaultsProgram: ({ connection, signer, }: {
|
|
4460
|
+
connection: Connection;
|
|
4461
|
+
signer: PublicKey;
|
|
4462
|
+
}) => Program<Vaults>;
|
|
4456
4463
|
declare const getCurrentPosition: ({ vaultId, positionId, connection, }: GetCurrentPositionParams) => Promise<{
|
|
4457
4464
|
tick: number;
|
|
4458
4465
|
tickId: number;
|
|
@@ -4471,12 +4478,12 @@ declare const getCurrentPositionState: ({ vaultId, position, program, }: GetCurr
|
|
|
4471
4478
|
dustDebtRaw: BN;
|
|
4472
4479
|
isSupplyOnlyPosition: boolean;
|
|
4473
4480
|
}>;
|
|
4474
|
-
declare const
|
|
4481
|
+
declare const getFinalPosition: ({ vaultId, currentPosition, newColAmount, newDebtAmount, program, connection, signer, }: {
|
|
4475
4482
|
vaultId: number;
|
|
4476
4483
|
currentPosition: Awaited<ReturnType<typeof getCurrentPositionState>>;
|
|
4477
4484
|
newColAmount: BN;
|
|
4478
4485
|
newDebtAmount: BN;
|
|
4479
|
-
program
|
|
4486
|
+
program?: Program<Vaults>;
|
|
4480
4487
|
connection: Connection;
|
|
4481
4488
|
signer: PublicKey;
|
|
4482
4489
|
}) => Promise<{
|
|
@@ -4519,5 +4526,5 @@ declare function loadRelevantTicksHasDebtArrays(vaultId: number, program: Progra
|
|
|
4519
4526
|
declare function getRatioAtTick(tick: number): BN;
|
|
4520
4527
|
declare function getTickAtRatio(ratioX48: BN): number;
|
|
4521
4528
|
|
|
4522
|
-
export {
|
|
4529
|
+
export { getCurrentPosition, getCurrentPositionState, getFinalPosition, getInitPositionContext, getOperateContext, getOperateIx, getRatioAtTick, getTickAtRatio, getVaultsProgram, loadRelevantBranches, loadRelevantTicksHasDebtArrays };
|
|
4523
4530
|
export type { ConnectionParams, OperateContextParams, OperateParams };
|
package/dist/borrow/index.d.ts
CHANGED
|
@@ -4381,15 +4381,18 @@ declare function getOperateContext({ vaultId, positionId, program, connection, s
|
|
|
4381
4381
|
lookupTable: PublicKey;
|
|
4382
4382
|
}>;
|
|
4383
4383
|
declare function getInitPositionContext(vaultId: number, positionId: number, signer: PublicKey): {
|
|
4384
|
-
signer: PublicKey;
|
|
4385
4384
|
vaultAdmin: PublicKey;
|
|
4386
4385
|
vaultState: PublicKey;
|
|
4387
4386
|
position: PublicKey;
|
|
4388
4387
|
positionMint: PublicKey;
|
|
4389
4388
|
positionTokenAccount: PublicKey;
|
|
4390
4389
|
tokenProgram: PublicKey;
|
|
4390
|
+
metadataAccount: PublicKey;
|
|
4391
4391
|
associatedTokenProgram: PublicKey;
|
|
4392
4392
|
systemProgram: PublicKey;
|
|
4393
|
+
sysvarInstruction: PublicKey;
|
|
4394
|
+
metadataProgram: PublicKey;
|
|
4395
|
+
rent: PublicKey;
|
|
4393
4396
|
};
|
|
4394
4397
|
declare const getOperateIx: ({ vaultId, positionId, colAmount, debtAmount, connection, signer, positionOwner, }: OperateParams) => Promise<{
|
|
4395
4398
|
nftId: number;
|
|
@@ -4453,6 +4456,10 @@ type GetCurrentPositionStateParams = {
|
|
|
4453
4456
|
position: PositionData;
|
|
4454
4457
|
program: Program<Vaults>;
|
|
4455
4458
|
};
|
|
4459
|
+
declare const getVaultsProgram: ({ connection, signer, }: {
|
|
4460
|
+
connection: Connection;
|
|
4461
|
+
signer: PublicKey;
|
|
4462
|
+
}) => Program<Vaults>;
|
|
4456
4463
|
declare const getCurrentPosition: ({ vaultId, positionId, connection, }: GetCurrentPositionParams) => Promise<{
|
|
4457
4464
|
tick: number;
|
|
4458
4465
|
tickId: number;
|
|
@@ -4471,12 +4478,12 @@ declare const getCurrentPositionState: ({ vaultId, position, program, }: GetCurr
|
|
|
4471
4478
|
dustDebtRaw: BN;
|
|
4472
4479
|
isSupplyOnlyPosition: boolean;
|
|
4473
4480
|
}>;
|
|
4474
|
-
declare const
|
|
4481
|
+
declare const getFinalPosition: ({ vaultId, currentPosition, newColAmount, newDebtAmount, program, connection, signer, }: {
|
|
4475
4482
|
vaultId: number;
|
|
4476
4483
|
currentPosition: Awaited<ReturnType<typeof getCurrentPositionState>>;
|
|
4477
4484
|
newColAmount: BN;
|
|
4478
4485
|
newDebtAmount: BN;
|
|
4479
|
-
program
|
|
4486
|
+
program?: Program<Vaults>;
|
|
4480
4487
|
connection: Connection;
|
|
4481
4488
|
signer: PublicKey;
|
|
4482
4489
|
}) => Promise<{
|
|
@@ -4519,5 +4526,5 @@ declare function loadRelevantTicksHasDebtArrays(vaultId: number, program: Progra
|
|
|
4519
4526
|
declare function getRatioAtTick(tick: number): BN;
|
|
4520
4527
|
declare function getTickAtRatio(ratioX48: BN): number;
|
|
4521
4528
|
|
|
4522
|
-
export {
|
|
4529
|
+
export { getCurrentPosition, getCurrentPositionState, getFinalPosition, getInitPositionContext, getOperateContext, getOperateIx, getRatioAtTick, getTickAtRatio, getVaultsProgram, loadRelevantBranches, loadRelevantTicksHasDebtArrays };
|
|
4523
4530
|
export type { ConnectionParams, OperateContextParams, OperateParams };
|
package/dist/borrow/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Transaction, PublicKey, SystemProgram } from '@solana/web3.js';
|
|
1
|
+
import { Transaction, PublicKey, SystemProgram, SYSVAR_RENT_PUBKEY, SYSVAR_INSTRUCTIONS_PUBKEY } from '@solana/web3.js';
|
|
2
2
|
import BN from 'bn.js';
|
|
3
3
|
import { Program } from '@coral-xyz/anchor';
|
|
4
|
-
import { v as vaults, g as getPosition, a as getTick, c as getTickIdLiquidation, d as getVaultConfig, e as getBranch, f as getTickHasDebt, 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 getPositionMint, r as getVaultAdmin } from '../shared/lend.OZiWki0F.mjs';
|
|
5
4
|
import { h as getReserve, e as liquidity } from '../shared/lend.BpBbTaiH.mjs';
|
|
6
5
|
import { getAssociatedTokenAddressSync, TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID } from '@solana/spl-token';
|
|
6
|
+
import { v as vaults, g as getPosition, a as getTick, c as getTickIdLiquidation, d as getVaultConfig, e as getBranch, f as getTickHasDebt, 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.CovuIMuS.mjs';
|
|
7
7
|
|
|
8
8
|
const address = "jupnw4B6Eqs7ft6rxpzYLJZYSnrpRgPcr589n5Kv4oc";
|
|
9
9
|
const metadata = {
|
|
@@ -668,6 +668,13 @@ function mulBigNumber(bigNumber1, bigNumber2) {
|
|
|
668
668
|
return adjustedCoefficient.shln(EXPONENT_SIZE_DEBT_FACTOR).or(finalExponent);
|
|
669
669
|
}
|
|
670
670
|
|
|
671
|
+
const getVaultsProgram = ({
|
|
672
|
+
connection,
|
|
673
|
+
signer
|
|
674
|
+
}) => new Program(vaults, {
|
|
675
|
+
connection,
|
|
676
|
+
publicKey: signer
|
|
677
|
+
});
|
|
671
678
|
const INIT_TICK = -2147483648;
|
|
672
679
|
const MIN_TICK = -16383;
|
|
673
680
|
const MAX_TICK = 16383;
|
|
@@ -712,8 +719,8 @@ const getCurrentPositionState = async ({
|
|
|
712
719
|
isSupplyOnlyPosition: true
|
|
713
720
|
};
|
|
714
721
|
}
|
|
715
|
-
|
|
716
|
-
|
|
722
|
+
const colRaw = new BN(position.supplyAmount.toString());
|
|
723
|
+
const dustDebtRaw = new BN(position.dustDebtAmount.toString());
|
|
717
724
|
let debtRaw = new BN(0);
|
|
718
725
|
if (positionTick > MIN_TICK) {
|
|
719
726
|
const collateralForDebtCalc = colRaw.add(new BN(1));
|
|
@@ -804,20 +811,23 @@ function getLiquidationStatus(positionTickId, tickData, tickIdData) {
|
|
|
804
811
|
} else {
|
|
805
812
|
const setIndex = (positionTickId + 2) % 3;
|
|
806
813
|
switch (setIndex) {
|
|
807
|
-
case 0:
|
|
814
|
+
case 0: {
|
|
808
815
|
isFullyLiquidated = tickIdData.isFullyLiquidated1 === 1;
|
|
809
816
|
branchId = tickIdData.liquidationBranchId1;
|
|
810
817
|
connectionFactor = tickIdData.debtFactor1;
|
|
811
818
|
break;
|
|
812
|
-
|
|
819
|
+
}
|
|
820
|
+
case 1: {
|
|
813
821
|
isFullyLiquidated = tickIdData.isFullyLiquidated2 === 1;
|
|
814
822
|
branchId = tickIdData.liquidationBranchId2;
|
|
815
823
|
connectionFactor = tickIdData.debtFactor2;
|
|
816
824
|
break;
|
|
817
|
-
|
|
825
|
+
}
|
|
826
|
+
default: {
|
|
818
827
|
isFullyLiquidated = tickIdData.isFullyLiquidated3 === 1;
|
|
819
828
|
branchId = tickIdData.liquidationBranchId3;
|
|
820
829
|
connectionFactor = tickIdData.debtFactor3;
|
|
830
|
+
}
|
|
821
831
|
}
|
|
822
832
|
}
|
|
823
833
|
return { isFullyLiquidated, branchId, connectionFactor };
|
|
@@ -863,11 +873,7 @@ async function processLiquidatedPosition({
|
|
|
863
873
|
currentBranch.debtFactor,
|
|
864
874
|
currentConnectionFactor
|
|
865
875
|
);
|
|
866
|
-
|
|
867
|
-
positionDebtRaw = positionDebtRaw.mul(new BN(9999)).div(new BN(1e4));
|
|
868
|
-
} else {
|
|
869
|
-
positionDebtRaw = new BN(0);
|
|
870
|
-
}
|
|
876
|
+
positionDebtRaw = positionDebtRaw.gt(initialDebtRaw.div(new BN(100))) ? positionDebtRaw.mul(new BN(9999)).div(new BN(1e4)) : new BN(0);
|
|
871
877
|
if (positionDebtRaw.gt(new BN(0))) {
|
|
872
878
|
finalTick = currentBranch.minimaTick;
|
|
873
879
|
const ratioAtTick = getRatioAtTick(finalTick);
|
|
@@ -885,7 +891,7 @@ async function processLiquidatedPosition({
|
|
|
885
891
|
finalDebtRaw: positionDebtRaw
|
|
886
892
|
};
|
|
887
893
|
}
|
|
888
|
-
const
|
|
894
|
+
const getFinalPosition = async ({
|
|
889
895
|
vaultId,
|
|
890
896
|
currentPosition,
|
|
891
897
|
newColAmount,
|
|
@@ -894,6 +900,7 @@ const calculateFinalPosition = async ({
|
|
|
894
900
|
connection,
|
|
895
901
|
signer
|
|
896
902
|
}) => {
|
|
903
|
+
program = program ?? getVaultsProgram({ connection, signer });
|
|
897
904
|
const [vaultConfig] = await Promise.all([
|
|
898
905
|
program.account.vaultConfig.fetch(getVaultConfig(vaultId))
|
|
899
906
|
]);
|
|
@@ -930,7 +937,7 @@ const calculateFinalPosition = async ({
|
|
|
930
937
|
debtRaw = debtRaw.add(borrowAmountWithFee);
|
|
931
938
|
} else if (newDebtAmount.lt(new BN(0))) {
|
|
932
939
|
if (newDebtAmount.gt(MIN_I128$1)) {
|
|
933
|
-
|
|
940
|
+
const payback_amount = newDebtAmount.abs().mul(EXCHANGE_PRICES_PRECISION).div(borrowExPrice).add(new BN(1));
|
|
934
941
|
debtRaw = debtRaw.sub(payback_amount);
|
|
935
942
|
} else if (newDebtAmount.eq(MIN_I128$1)) {
|
|
936
943
|
debtRaw.mul(borrowExPrice).div(EXCHANGE_PRICES_PRECISION).mul(new BN(-1)).sub(new BN(1));
|
|
@@ -1019,7 +1026,7 @@ async function loadRelevantBranches(vaultId, vaultState, program) {
|
|
|
1019
1026
|
if (branch) {
|
|
1020
1027
|
branches.push(branch);
|
|
1021
1028
|
}
|
|
1022
|
-
} catch
|
|
1029
|
+
} catch {
|
|
1023
1030
|
}
|
|
1024
1031
|
}
|
|
1025
1032
|
}
|
|
@@ -1089,14 +1096,10 @@ async function getExchangePrices({
|
|
|
1089
1096
|
};
|
|
1090
1097
|
}
|
|
1091
1098
|
|
|
1099
|
+
const MPL_TOKEN_METADATA_PROGRAM_ID = new PublicKey(
|
|
1100
|
+
"metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
|
|
1101
|
+
);
|
|
1092
1102
|
const LIQUIDITY_PROGRAM_ID = new PublicKey(liquidity.address);
|
|
1093
|
-
const getVaultsProgram = ({
|
|
1094
|
-
connection,
|
|
1095
|
-
signer
|
|
1096
|
-
}) => new Program(vaults, {
|
|
1097
|
-
connection,
|
|
1098
|
-
publicKey: signer
|
|
1099
|
-
});
|
|
1100
1103
|
const MIN_I128 = new BN("170141183460469231731687303715884105728").neg();
|
|
1101
1104
|
async function getOtherInstructionsOperate(vaultId, vaultState, currentPosition, finalPosition, currentTick, program, signer) {
|
|
1102
1105
|
const otherIxs = [];
|
|
@@ -1111,8 +1114,8 @@ async function getOtherInstructionsOperate(vaultId, vaultState, currentPosition,
|
|
|
1111
1114
|
);
|
|
1112
1115
|
currentTickData = tickData[0];
|
|
1113
1116
|
finalTickData = tickData[2];
|
|
1114
|
-
for (
|
|
1115
|
-
if (!
|
|
1117
|
+
for (const [i, tickDatum] of tickData.entries()) {
|
|
1118
|
+
if (!tickDatum) {
|
|
1116
1119
|
const ix = await program.methods.initTick(vaultId, tickToRead[i]).accounts(getInitTickContext(vaultId, tickToRead[i], signer)).instruction();
|
|
1117
1120
|
otherIxs.push(ix);
|
|
1118
1121
|
}
|
|
@@ -1132,7 +1135,7 @@ async function getOtherInstructionsOperate(vaultId, vaultState, currentPosition,
|
|
|
1132
1135
|
newBranchId = vaultState.currentBranchId;
|
|
1133
1136
|
}
|
|
1134
1137
|
const newBranchPda = getBranch(vaultId, newBranchId);
|
|
1135
|
-
|
|
1138
|
+
const currentTickIdDataPda = getTickIdLiquidation(
|
|
1136
1139
|
vaultId,
|
|
1137
1140
|
currentTick,
|
|
1138
1141
|
currentTickData ? currentTickData.totalIds : 0
|
|
@@ -1143,7 +1146,7 @@ async function getOtherInstructionsOperate(vaultId, vaultState, currentPosition,
|
|
|
1143
1146
|
totalIds: currentTickData ? currentTickData.totalIds : 0
|
|
1144
1147
|
}
|
|
1145
1148
|
];
|
|
1146
|
-
|
|
1149
|
+
const finalTickIdDataPda = getTickIdLiquidation(
|
|
1147
1150
|
vaultId,
|
|
1148
1151
|
finalPosition.tick,
|
|
1149
1152
|
finalTickData ? finalTickData.totalIds : 0
|
|
@@ -1170,8 +1173,8 @@ async function getOtherInstructionsOperate(vaultId, vaultState, currentPosition,
|
|
|
1170
1173
|
)
|
|
1171
1174
|
);
|
|
1172
1175
|
if (tickIdData.length > 0) {
|
|
1173
|
-
for (
|
|
1174
|
-
if (!
|
|
1176
|
+
for (const [i, tickIdDatum] of tickIdData.entries()) {
|
|
1177
|
+
if (!tickIdDatum) {
|
|
1175
1178
|
const ix = await program.methods.initTickIdLiquidation(
|
|
1176
1179
|
vaultId,
|
|
1177
1180
|
tickIdsToRead[i].tick,
|
|
@@ -1201,7 +1204,7 @@ async function getRemainingAccountsOperate(vaultId, vaultState, vaultConfig, pro
|
|
|
1201
1204
|
const oracleData = await oracleProgram.account.oracle.fetch(
|
|
1202
1205
|
new PublicKey(vaultConfig.oracle)
|
|
1203
1206
|
);
|
|
1204
|
-
|
|
1207
|
+
const sourceLength = oracleData.sources.length;
|
|
1205
1208
|
for (const source of oracleData.sources)
|
|
1206
1209
|
remainingAccounts.push({
|
|
1207
1210
|
pubkey: new PublicKey(source.source),
|
|
@@ -1209,7 +1212,7 @@ async function getRemainingAccountsOperate(vaultId, vaultState, vaultConfig, pro
|
|
|
1209
1212
|
isSigner: false
|
|
1210
1213
|
});
|
|
1211
1214
|
const branches = await loadRelevantBranches(vaultId, vaultState, program);
|
|
1212
|
-
|
|
1215
|
+
const branchLength = branches.length;
|
|
1213
1216
|
for (const branch of branches) {
|
|
1214
1217
|
if (!branch) continue;
|
|
1215
1218
|
remainingAccounts.push({
|
|
@@ -1219,7 +1222,7 @@ async function getRemainingAccountsOperate(vaultId, vaultState, vaultConfig, pro
|
|
|
1219
1222
|
});
|
|
1220
1223
|
}
|
|
1221
1224
|
const tickHasDebt = await loadRelevantTicksHasDebtArrays(vaultId, program);
|
|
1222
|
-
|
|
1225
|
+
const tickHasDebtLength = tickHasDebt.length;
|
|
1223
1226
|
for (const tickHasDebtArray of tickHasDebt)
|
|
1224
1227
|
remainingAccounts.push({
|
|
1225
1228
|
pubkey: getTickHasDebt(vaultId, tickHasDebtArray.index),
|
|
@@ -1282,11 +1285,11 @@ async function getOperateContext({
|
|
|
1282
1285
|
if (existingPositionTick === -2147483648) {
|
|
1283
1286
|
existingPositionTick = currentPosition.tick;
|
|
1284
1287
|
}
|
|
1285
|
-
|
|
1288
|
+
const currentPositionTickPda = getTick(
|
|
1286
1289
|
vaultId,
|
|
1287
1290
|
existingPositionTick
|
|
1288
1291
|
);
|
|
1289
|
-
const finalPosition = await
|
|
1292
|
+
const finalPosition = await getFinalPosition({
|
|
1290
1293
|
vaultId,
|
|
1291
1294
|
currentPosition,
|
|
1292
1295
|
newColAmount: newCol,
|
|
@@ -1403,7 +1406,6 @@ async function getOperateContext({
|
|
|
1403
1406
|
}
|
|
1404
1407
|
function getInitPositionContext(vaultId, positionId, signer) {
|
|
1405
1408
|
return {
|
|
1406
|
-
signer,
|
|
1407
1409
|
vaultAdmin: getVaultAdmin(),
|
|
1408
1410
|
vaultState: getVaultState(vaultId),
|
|
1409
1411
|
position: getPosition(vaultId, positionId),
|
|
@@ -1414,8 +1416,12 @@ function getInitPositionContext(vaultId, positionId, signer) {
|
|
|
1414
1416
|
signer
|
|
1415
1417
|
),
|
|
1416
1418
|
tokenProgram: TOKEN_PROGRAM_ID,
|
|
1419
|
+
metadataAccount: getPositionMetadata(vaultId, positionId),
|
|
1417
1420
|
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
1418
|
-
systemProgram: SystemProgram.programId
|
|
1421
|
+
systemProgram: SystemProgram.programId,
|
|
1422
|
+
sysvarInstruction: SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
1423
|
+
metadataProgram: MPL_TOKEN_METADATA_PROGRAM_ID,
|
|
1424
|
+
rent: SYSVAR_RENT_PUBKEY
|
|
1419
1425
|
};
|
|
1420
1426
|
}
|
|
1421
1427
|
const getOperateIx = async ({
|
|
@@ -1505,4 +1511,4 @@ async function getInitTickIdLiquidationContext(vaultId, tick, signer, program) {
|
|
|
1505
1511
|
};
|
|
1506
1512
|
}
|
|
1507
1513
|
|
|
1508
|
-
export {
|
|
1514
|
+
export { getCurrentPosition, getCurrentPositionState, getFinalPosition, getInitPositionContext, getOperateContext, getOperateIx, getRatioAtTick, getTickAtRatio, getVaultsProgram, loadRelevantBranches, loadRelevantTicksHasDebtArrays };
|
package/dist/index.d.mts
CHANGED
|
@@ -55,6 +55,7 @@ declare const getVaultAdmin: () => PublicKey;
|
|
|
55
55
|
declare const getVaultState: (vaultId: number) => PublicKey;
|
|
56
56
|
declare const getLiquidity: () => PublicKey;
|
|
57
57
|
declare const getBranch: (vaultId: number, branchId: number) => PublicKey;
|
|
58
|
+
declare const getPositionMetadata: (vaultId: number, positionId: number) => PublicKey;
|
|
58
59
|
declare const getPosition: (vaultId: number, positionId: number) => PublicKey;
|
|
59
60
|
declare const getTick: (vaultId: number, tick: number) => PublicKey;
|
|
60
61
|
declare const getTickIdLiquidation: (vaultId: number, tick: number, totalIds: number) => PublicKey;
|
|
@@ -72,6 +73,7 @@ declare const borrow_getClaimAccount: typeof getClaimAccount;
|
|
|
72
73
|
declare const borrow_getLiquidity: typeof getLiquidity;
|
|
73
74
|
declare const borrow_getLiquidityReserve: typeof getLiquidityReserve;
|
|
74
75
|
declare const borrow_getPosition: typeof getPosition;
|
|
76
|
+
declare const borrow_getPositionMetadata: typeof getPositionMetadata;
|
|
75
77
|
declare const borrow_getPositionMint: typeof getPositionMint;
|
|
76
78
|
declare const borrow_getPositionTokenAccount: typeof getPositionTokenAccount;
|
|
77
79
|
declare const borrow_getRateModel: typeof getRateModel;
|
|
@@ -91,6 +93,7 @@ declare namespace borrow {
|
|
|
91
93
|
borrow_getLiquidity as getLiquidity,
|
|
92
94
|
borrow_getLiquidityReserve as getLiquidityReserve,
|
|
93
95
|
borrow_getPosition as getPosition,
|
|
96
|
+
borrow_getPositionMetadata as getPositionMetadata,
|
|
94
97
|
borrow_getPositionMint as getPositionMint,
|
|
95
98
|
borrow_getPositionTokenAccount as getPositionTokenAccount,
|
|
96
99
|
borrow_getRateModel as getRateModel,
|
package/dist/index.d.ts
CHANGED
|
@@ -55,6 +55,7 @@ declare const getVaultAdmin: () => PublicKey;
|
|
|
55
55
|
declare const getVaultState: (vaultId: number) => PublicKey;
|
|
56
56
|
declare const getLiquidity: () => PublicKey;
|
|
57
57
|
declare const getBranch: (vaultId: number, branchId: number) => PublicKey;
|
|
58
|
+
declare const getPositionMetadata: (vaultId: number, positionId: number) => PublicKey;
|
|
58
59
|
declare const getPosition: (vaultId: number, positionId: number) => PublicKey;
|
|
59
60
|
declare const getTick: (vaultId: number, tick: number) => PublicKey;
|
|
60
61
|
declare const getTickIdLiquidation: (vaultId: number, tick: number, totalIds: number) => PublicKey;
|
|
@@ -72,6 +73,7 @@ declare const borrow_getClaimAccount: typeof getClaimAccount;
|
|
|
72
73
|
declare const borrow_getLiquidity: typeof getLiquidity;
|
|
73
74
|
declare const borrow_getLiquidityReserve: typeof getLiquidityReserve;
|
|
74
75
|
declare const borrow_getPosition: typeof getPosition;
|
|
76
|
+
declare const borrow_getPositionMetadata: typeof getPositionMetadata;
|
|
75
77
|
declare const borrow_getPositionMint: typeof getPositionMint;
|
|
76
78
|
declare const borrow_getPositionTokenAccount: typeof getPositionTokenAccount;
|
|
77
79
|
declare const borrow_getRateModel: typeof getRateModel;
|
|
@@ -91,6 +93,7 @@ declare namespace borrow {
|
|
|
91
93
|
borrow_getLiquidity as getLiquidity,
|
|
92
94
|
borrow_getLiquidityReserve as getLiquidityReserve,
|
|
93
95
|
borrow_getPosition as getPosition,
|
|
96
|
+
borrow_getPositionMetadata as getPositionMetadata,
|
|
94
97
|
borrow_getPositionMint as getPositionMint,
|
|
95
98
|
borrow_getPositionTokenAccount as getPositionTokenAccount,
|
|
96
99
|
borrow_getRateModel as getRateModel,
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export { l as lendingPda, a as lendingRewardRateModelPda } from './shared/lend.CYujcG7Z.mjs';
|
|
2
2
|
export { l as liquidityPda } from './shared/lend.BpBbTaiH.mjs';
|
|
3
|
-
export { b as borrowPda } from './shared/lend.
|
|
3
|
+
export { b as borrowPda } from './shared/lend.CovuIMuS.mjs';
|
|
4
4
|
import '@solana/web3.js';
|
|
5
5
|
import '@solana/spl-token';
|
|
6
6
|
import 'bn.js';
|
|
7
7
|
|
|
8
|
-
const version = "0.0.
|
|
8
|
+
const version = "0.0.41";
|
|
9
9
|
|
|
10
10
|
export { version };
|
|
@@ -4315,6 +4315,9 @@ const vaults = {
|
|
|
4315
4315
|
types: types
|
|
4316
4316
|
};
|
|
4317
4317
|
|
|
4318
|
+
const MPL_TOKEN_METADATA_PROGRAM_ID = new PublicKey(
|
|
4319
|
+
"metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
|
|
4320
|
+
);
|
|
4318
4321
|
const VAULTS_PROGRAM_ID = new PublicKey(address);
|
|
4319
4322
|
const LIQUIDITY_PROGRAM_ID = new PublicKey(address$1);
|
|
4320
4323
|
const getVaultConfig = (vaultId) => {
|
|
@@ -4366,6 +4369,17 @@ const getBranch = (vaultId, branchId) => {
|
|
|
4366
4369
|
);
|
|
4367
4370
|
return pda;
|
|
4368
4371
|
};
|
|
4372
|
+
const getPositionMetadata = (vaultId, positionId) => {
|
|
4373
|
+
const [pda] = PublicKey.findProgramAddressSync(
|
|
4374
|
+
[
|
|
4375
|
+
Buffer.from("metadata"),
|
|
4376
|
+
new PublicKey(MPL_TOKEN_METADATA_PROGRAM_ID).toBuffer(),
|
|
4377
|
+
getPositionMint(vaultId, positionId).toBuffer()
|
|
4378
|
+
],
|
|
4379
|
+
new PublicKey(MPL_TOKEN_METADATA_PROGRAM_ID)
|
|
4380
|
+
);
|
|
4381
|
+
return pda;
|
|
4382
|
+
};
|
|
4369
4383
|
const getPosition = (vaultId, positionId) => {
|
|
4370
4384
|
const [pda] = PublicKey.findProgramAddressSync(
|
|
4371
4385
|
[
|
|
@@ -4481,6 +4495,7 @@ const borrow = {
|
|
|
4481
4495
|
getLiquidity: getLiquidity,
|
|
4482
4496
|
getLiquidityReserve: getLiquidityReserve,
|
|
4483
4497
|
getPosition: getPosition,
|
|
4498
|
+
getPositionMetadata: getPositionMetadata,
|
|
4484
4499
|
getPositionMint: getPositionMint,
|
|
4485
4500
|
getPositionTokenAccount: getPositionTokenAccount,
|
|
4486
4501
|
getRateModel: getRateModel,
|
|
@@ -4495,4 +4510,4 @@ const borrow = {
|
|
|
4495
4510
|
getVaultState: getVaultState
|
|
4496
4511
|
};
|
|
4497
4512
|
|
|
4498
|
-
export { getTick as a, borrow as b, getTickIdLiquidation as c, getVaultConfig as d, getBranch as e, getTickHasDebt as f, getPosition as g, getVaultState as h, getVaultMetadata as i, getLiquidity as j, getClaimAccount as k, getRateModel as l, getUserBorrowPosition as m, getUserSupplyPosition as n, getLiquidityReserve as o, getPositionTokenAccount as p,
|
|
4513
|
+
export { getTick as a, borrow as b, getTickIdLiquidation as c, getVaultConfig as d, getBranch as e, getTickHasDebt as f, getPosition as g, getVaultState as h, getVaultMetadata as i, getLiquidity as j, getClaimAccount as k, getRateModel as l, getUserBorrowPosition as m, getUserSupplyPosition as n, getLiquidityReserve as o, getPositionTokenAccount as p, getPositionMetadata as q, getPositionMint as r, getVaultAdmin as s, vaults as v };
|