@jup-ag/lend 0.1.0 → 0.1.2

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.yP9-PjAh.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.yP9-PjAh.mjs';
1
+ import { g as getLiquidateIx, a as getVaultsProgram } from '../shared/lend.B4vivzkS.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.B4vivzkS.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.C2-jCLFw.mjs';
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.0";
11
+ const version = "0.1.2";
12
12
 
13
13
  export { version };
@@ -71,6 +71,7 @@ async function getClaimIx({
71
71
  cumulativeAmount,
72
72
  positionType,
73
73
  positionId,
74
+ distributorId,
74
75
  cycle,
75
76
  merkleProof.map((proof) => [...proof]),
76
77
  metadata
@@ -1,5 +1,5 @@
1
1
  import { v as vaultsIdl } from '../shared/lend.C2-jCLFw.mjs';
2
- import { e as getOperateIx } from '../shared/lend.yP9-PjAh.mjs';
2
+ import { e as getOperateIx } from '../shared/lend.B4vivzkS.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';
@@ -1545,10 +1545,9 @@ const MPL_TOKEN_METADATA_PROGRAM_ID = new PublicKey(
1545
1545
  );
1546
1546
  const LIQUIDITY_PROGRAM_ID = new PublicKey(liquidity.address);
1547
1547
  const MIN_I128 = new BN("170141183460469231731687303715884105728").neg();
1548
- async function getOtherInstructionsOperate(vaultId, vaultState, currentPosition, finalPosition, currentTick, program, signer) {
1548
+ async function getOtherInstructionsOperate(vaultId, vaultState, currentPosition, finalPosition, currentTick, currentTickId, program, signer) {
1549
1549
  const otherIxs = [];
1550
1550
  const tickToRead = [currentTick];
1551
- let currentTickData;
1552
1551
  let finalTickData;
1553
1552
  tickToRead.push(currentPosition.tick);
1554
1553
  tickToRead.push(finalPosition.tick);
@@ -1556,7 +1555,7 @@ async function getOtherInstructionsOperate(vaultId, vaultState, currentPosition,
1556
1555
  const tickData = await program.account.tick.fetchMultiple(
1557
1556
  tickToRead.map((tick) => getTick(vaultId, tick))
1558
1557
  );
1559
- currentTickData = tickData[0];
1558
+ tickData[0];
1560
1559
  finalTickData = tickData[2];
1561
1560
  for (const [i, tickDatum] of tickData.entries()) {
1562
1561
  if (!tickDatum) {
@@ -1582,12 +1581,14 @@ async function getOtherInstructionsOperate(vaultId, vaultState, currentPosition,
1582
1581
  const currentTickIdDataPda = getTickIdLiquidation(
1583
1582
  vaultId,
1584
1583
  currentTick,
1585
- currentTickData ? currentTickData.totalIds : 0
1584
+ // Position tick
1585
+ currentTickId
1586
+ // Position tick ID
1586
1587
  );
1587
1588
  const tickIdsToRead = [
1588
1589
  {
1589
1590
  tick: currentTick,
1590
- totalIds: currentTickData ? currentTickData.totalIds : 0
1591
+ totalIds: currentTickId
1591
1592
  }
1592
1593
  ];
1593
1594
  const finalTickIdDataPda = getTickIdLiquidation(
@@ -1741,6 +1742,7 @@ async function getOperateContext({
1741
1742
  getPosition(vaultId, positionId)
1742
1743
  );
1743
1744
  let existingPositionTick = positionData.tick;
1745
+ let existingPositionTickId = positionData.tickId;
1744
1746
  const currentPosition = await getCurrentPositionState({
1745
1747
  vaultId,
1746
1748
  position: positionData,
@@ -1768,6 +1770,7 @@ async function getOperateContext({
1768
1770
  currentPosition,
1769
1771
  finalPosition,
1770
1772
  existingPositionTick,
1773
+ existingPositionTickId,
1771
1774
  program,
1772
1775
  signer
1773
1776
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jup-ag/lend",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "type": "module",
@@ -38,6 +38,16 @@
38
38
  "files": [
39
39
  "dist"
40
40
  ],
41
+ "scripts": {
42
+ "build": "unbuild",
43
+ "dev": "vitest dev",
44
+ "lint": "eslint . && prettier -c .",
45
+ "lint:fix": "automd && eslint . --fix && prettier -w .",
46
+ "prepack": "pnpm build",
47
+ "release": "pnpm test && changelogen --release && npm publish && git push --follow-tags",
48
+ "test": "pnpm test:types && vitest run --coverage",
49
+ "test:types": "tsc --noEmit --skipLibCheck"
50
+ },
41
51
  "devDependencies": {
42
52
  "@types/bn.js": "^5.1.6",
43
53
  "@types/node": "^22.13.13",
@@ -51,20 +61,12 @@
51
61
  "unbuild": "^3.5.0",
52
62
  "vitest": "^3.0.9"
53
63
  },
64
+ "packageManager": "pnpm@10.7.0",
54
65
  "dependencies": {
55
66
  "@coral-xyz/anchor": "^0.31.1",
56
67
  "@solana/spl-token": "^0.4.13",
57
68
  "@solana/web3.js": "^1.98.2",
58
69
  "axios": "^1.11.0",
59
70
  "bn.js": "^5.2.2"
60
- },
61
- "scripts": {
62
- "build": "unbuild",
63
- "dev": "vitest dev",
64
- "lint": "eslint . && prettier -c .",
65
- "lint:fix": "automd && eslint . --fix && prettier -w .",
66
- "release": "pnpm test && changelogen --release && npm publish && git push --follow-tags",
67
- "test": "pnpm test:types && vitest run --coverage",
68
- "test:types": "tsc --noEmit --skipLibCheck"
69
71
  }
70
- }
72
+ }