@jup-ag/lend 0.1.5 → 0.1.7

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.
@@ -1,5 +1,5 @@
1
- import { g as getLiquidateIx, a as getVaultsProgram } from '../shared/lend.aTMYZYEH.mjs';
2
- export { I as INIT_TICK, p as MAX_TICK, M as MIN_TICK, q as TICKS_PER_TICK_HAS_DEBT, T as TICK_HAS_DEBT_ARRAY_SIZE, s as TICK_HAS_DEBT_CHILDREN_SIZE, t as TICK_HAS_DEBT_CHILDREN_SIZE_IN_BITS, u as TOTAL_INDICES_NEEDED, Z as ZERO_TICK_SCALED_RATIO, A as findNextTickWithDebt, h as getAccountOwner, i as getCurrentPosition, j as getCurrentPositionState, k as getFinalPosition, x as getFirstTickForIndex, d as getInitPositionContext, c as getInitPositionIx, f as getLiquidateContext, b as getOperateContext, e as getOperateIx, v as getRatioAtTick, w as getTickAtRatio, y as getTickIndices, l as loadRelevantBranches, o as loadRelevantBranchesForLiquidate, m as loadRelevantTicksHasDebtArrays, n as loadRelevantTicksHasDebtArraysLiquidate, r as readOraclePrice, z as readTickHasDebtArray } from '../shared/lend.aTMYZYEH.mjs';
1
+ import { g as getLiquidateIx, a as getVaultsProgram } from '../shared/lend.Bh9Wk7OH.mjs';
2
+ export { I as INIT_TICK, p as MAX_TICK, M as MIN_TICK, q as TICKS_PER_TICK_HAS_DEBT, T as TICK_HAS_DEBT_ARRAY_SIZE, s as TICK_HAS_DEBT_CHILDREN_SIZE, t as TICK_HAS_DEBT_CHILDREN_SIZE_IN_BITS, u as TOTAL_INDICES_NEEDED, Z as ZERO_TICK_SCALED_RATIO, A as findNextTickWithDebt, h as getAccountOwner, i as getCurrentPosition, j as getCurrentPositionState, k as getFinalPosition, x as getFirstTickForIndex, d as getInitPositionContext, c as getInitPositionIx, f as getLiquidateContext, b as getOperateContext, e as getOperateIx, v as getRatioAtTick, w as getTickAtRatio, y as getTickIndices, l as loadRelevantBranches, o as loadRelevantBranchesForLiquidate, m as loadRelevantTicksHasDebtArrays, n as loadRelevantTicksHasDebtArraysLiquidate, r as readOraclePrice, z as readTickHasDebtArray } from '../shared/lend.Bh9Wk7OH.mjs';
3
3
  import { PublicKey, TransactionMessage, ComputeBudgetProgram, VersionedTransaction } from '@solana/web3.js';
4
4
  import BN from 'bn.js';
5
5
  import { g as getVaultAdmin } from '../shared/lend.CsYeVtpe.mjs';
@@ -28,9 +28,12 @@ const getOrCreateATAInstruction = async (owner, mint, connection) => {
28
28
  // allowOwnerOffCurve - supports PDA owners
29
29
  tokenProgram
30
30
  );
31
- const account = await getAccount(connection, associatedTokenAccount).catch(
32
- () => null
33
- );
31
+ const account = await getAccount(
32
+ connection,
33
+ associatedTokenAccount,
34
+ "confirmed",
35
+ tokenProgram
36
+ ).catch(() => null);
34
37
  const ixs = [];
35
38
  if (!account) {
36
39
  ixs.push(
package/dist/index.mjs CHANGED
@@ -8,6 +8,6 @@ import './shared/lend.CioR9-te.mjs';
8
8
  import '@solana/spl-token';
9
9
  import 'bn.js';
10
10
 
11
- const version = "0.1.5";
11
+ const version = "0.1.7";
12
12
 
13
13
  export { version };
@@ -1,5 +1,5 @@
1
1
  import { v as vaultsIdl } from '../shared/lend.CsYeVtpe.mjs';
2
- import { e as getOperateIx } from '../shared/lend.aTMYZYEH.mjs';
2
+ import { e as getOperateIx } from '../shared/lend.Bh9Wk7OH.mjs';
3
3
  import { PublicKey } from '@solana/web3.js';
4
4
  import { Program } from '@coral-xyz/anchor';
5
5
  import '../shared/lend.CioR9-te.mjs';
@@ -1957,11 +1957,11 @@ const getOperateIx = async ({
1957
1957
  recipient,
1958
1958
  program
1959
1959
  });
1960
- if (accounts.borrowToken.toString() !== NATIVE_MINT.toString()) {
1960
+ if (accounts.borrowToken.toString() !== NATIVE_MINT.toString() && debtAmount.lt(new BN(0))) {
1961
1961
  const userDebtTokenBalance = await connection.getTokenAccountBalance(
1962
1962
  accounts.signerBorrowTokenAccount
1963
1963
  );
1964
- if (debtAmount.lt(new BN(0)) && userDebtTokenBalance.value.amount === debtAmount.abs().toString()) {
1964
+ if (userDebtTokenBalance.value.amount === debtAmount.abs().toString()) {
1965
1965
  debtAmount = debtAmount.add(new BN(1));
1966
1966
  }
1967
1967
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jup-ag/lend",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "type": "module",