@jup-ag/lend 0.0.67 → 0.0.68
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 -15
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/borrow/index.mjs
CHANGED
|
@@ -1288,12 +1288,12 @@ async function getOtherInstructionsOperate(vaultId, vaultState, currentPosition,
|
|
|
1288
1288
|
tickToRead.push(currentPosition.tick);
|
|
1289
1289
|
tickToRead.push(finalPosition.tick);
|
|
1290
1290
|
if (tickToRead.length > 0) {
|
|
1291
|
-
const
|
|
1291
|
+
const tickData = await program.account.tick.fetchMultiple(
|
|
1292
1292
|
tickToRead.map((tick) => getTick(vaultId, tick))
|
|
1293
1293
|
);
|
|
1294
|
-
currentTickData =
|
|
1295
|
-
finalTickData =
|
|
1296
|
-
for (const [i, tickDatum] of
|
|
1294
|
+
currentTickData = tickData[0];
|
|
1295
|
+
finalTickData = tickData[2];
|
|
1296
|
+
for (const [i, tickDatum] of tickData.entries()) {
|
|
1297
1297
|
if (!tickDatum) {
|
|
1298
1298
|
const ix = await program.methods.initTick(vaultId, tickToRead[i]).accounts(getInitTickContext(vaultId, tickToRead[i], signer)).instruction();
|
|
1299
1299
|
otherIxs.push(ix);
|
|
@@ -1681,8 +1681,8 @@ function getInitTickContext(vaultId, tick, signer) {
|
|
|
1681
1681
|
};
|
|
1682
1682
|
}
|
|
1683
1683
|
async function getInitTickIdLiquidationContext(vaultId, tick, signer, program) {
|
|
1684
|
-
const
|
|
1685
|
-
if (!
|
|
1684
|
+
const tickData = await program.account.tick.fetch(getTick(vaultId, tick)).catch(() => null);
|
|
1685
|
+
if (!tickData) {
|
|
1686
1686
|
return {
|
|
1687
1687
|
signer,
|
|
1688
1688
|
vaultConfig: getVaultConfig(vaultId),
|
|
@@ -1697,7 +1697,7 @@ async function getInitTickIdLiquidationContext(vaultId, tick, signer, program) {
|
|
|
1697
1697
|
tickIdLiquidation: getTickIdLiquidation(
|
|
1698
1698
|
vaultId,
|
|
1699
1699
|
tick,
|
|
1700
|
-
|
|
1700
|
+
tickData.totalIds
|
|
1701
1701
|
),
|
|
1702
1702
|
tickData: getTick(vaultId, tick),
|
|
1703
1703
|
systemProgram: SystemProgram.programId
|
|
@@ -1867,7 +1867,7 @@ async function getOtherInstructionsLiquidate(vaultId, vaultState, program, signe
|
|
|
1867
1867
|
const otherIxs = [];
|
|
1868
1868
|
let newBranchId = vaultState.branchLiquidated === 1 ? vaultState.totalBranchId + 1 : vaultState.currentBranchId;
|
|
1869
1869
|
let newBranchPda = getBranch(vaultId, newBranchId);
|
|
1870
|
-
const [newBranchData] = await Promise.all([
|
|
1870
|
+
const [newBranchData, tickData] = await Promise.all([
|
|
1871
1871
|
program.account.branch.fetch(newBranchPda).catch(() => null),
|
|
1872
1872
|
// might be possible that liquidation ends on a tick that is not initialized
|
|
1873
1873
|
program.account.tick.fetch(getTick(vaultId, vaultState.topmostTick)).catch(() => null)
|
|
@@ -1948,15 +1948,15 @@ async function getRemainingAccountsLiquidate(vaultId, vaultState, otherIxs, orac
|
|
|
1948
1948
|
const tickToInit = [];
|
|
1949
1949
|
const existingTicks = await Promise.all(
|
|
1950
1950
|
tickAccounts.map(
|
|
1951
|
-
(
|
|
1951
|
+
(tickData) => program.account.tick.fetch(getTick(vaultId, tickData.tick)).catch(() => null)
|
|
1952
1952
|
)
|
|
1953
1953
|
);
|
|
1954
1954
|
const initInstructions = await Promise.all(
|
|
1955
|
-
tickAccounts.map(async (
|
|
1955
|
+
tickAccounts.map(async (tickData, index) => {
|
|
1956
1956
|
const existingTick = existingTicks[index];
|
|
1957
|
-
if (!existingTick && !tickToInit.includes(
|
|
1958
|
-
tickToInit.push(
|
|
1959
|
-
return program.methods.initTick(vaultId,
|
|
1957
|
+
if (!existingTick && !tickToInit.includes(tickData.tick)) {
|
|
1958
|
+
tickToInit.push(tickData.tick);
|
|
1959
|
+
return program.methods.initTick(vaultId, tickData.tick).accounts(getInitTickContext(vaultId, tickData.tick, signer)).instruction();
|
|
1960
1960
|
}
|
|
1961
1961
|
return null;
|
|
1962
1962
|
})
|
|
@@ -1966,9 +1966,9 @@ async function getRemainingAccountsLiquidate(vaultId, vaultState, otherIxs, orac
|
|
|
1966
1966
|
otherIxs.push(ix);
|
|
1967
1967
|
}
|
|
1968
1968
|
}
|
|
1969
|
-
for (const
|
|
1969
|
+
for (const tickData of tickAccounts) {
|
|
1970
1970
|
remainingAccounts.push({
|
|
1971
|
-
pubkey: getTick(vaultId,
|
|
1971
|
+
pubkey: getTick(vaultId, tickData.tick),
|
|
1972
1972
|
isWritable: true,
|
|
1973
1973
|
isSigner: false
|
|
1974
1974
|
});
|
package/dist/index.mjs
CHANGED