impermax-sdk 2.1.296 → 2.1.298

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.
@@ -40,7 +40,9 @@ exports.IMPERMAX_VAULT_API = {
40
40
  [types_1.Networks.Polygon]: {
41
41
  [types_1.VaultType.LENDING]: "https://polygon-lendingvaults-production.up.railway.app/"
42
42
  },
43
- [types_1.Networks.Arbitrum]: {},
43
+ [types_1.Networks.Arbitrum]: {
44
+ [types_1.VaultType.LENDING]: "https://arbitrum-lendingvaults-production.up.railway.app/"
45
+ },
44
46
  [types_1.Networks.Avalanche]: {},
45
47
  [types_1.Networks.Moonriver]: {},
46
48
  [types_1.Networks.Aurora]: {},
@@ -165,6 +165,7 @@ exports.VAULT_SUBGRAPH_URL = {
165
165
  [types_1.Networks.Arbitrum]: {
166
166
  [types_1.VaultType.LENDING]: [
167
167
  "https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/BhmcL1CZmw9hftXPviiTeMY7kghbbkpHZtpiHXWVhNNN",
168
+ "https://arbitrum-lendingvaults-production.up.railway.app/"
168
169
  ],
169
170
  [types_1.VaultType.HEDGED]: [],
170
171
  [types_1.VaultType.LEVERAGED]: [],
@@ -29,8 +29,8 @@ export default class OnchainAccountNftlpUniswapV3 extends OnchainAccountNftlp {
29
29
  getPriceB(tokenId: number): Promise<number>;
30
30
  getLiquidity(tokenId: number): Promise<number>;
31
31
  getCurrentFeeGrowthInsideX128(tokenId: number): Promise<{
32
- currentFeeGrowthInside0X128: number;
33
- currentFeeGrowthInside1X128: number;
32
+ currentFeeGrowthInside0X128: bigint;
33
+ currentFeeGrowthInside1X128: bigint;
34
34
  }>;
35
35
  getCurrentUnclaimedFeesRaw(tokenId: number): Promise<{
36
36
  unclaimedFees0: number;
@@ -8,6 +8,7 @@ const uniswapV3_1 = __importDefault(require("../../../../utils/position/uniswapV
8
8
  const uniswapV3General_1 = require("../../../../utils/nftlpMath/uniswapV3General");
9
9
  const REINVESTOR = '0x000000000000000000000000000000000000dead';
10
10
  const Q128 = 2 ** 128;
11
+ const Q256 = BigInt(2) ** BigInt(256);
11
12
  class OnchainAccountNftlpUniswapV3 extends onchainAccountNftlp_1.default {
12
13
  constructor() {
13
14
  super(...arguments);
@@ -56,8 +57,8 @@ class OnchainAccountNftlpUniswapV3 extends onchainAccountNftlp_1.default {
56
57
  ]);
57
58
  console.log("getCurrentFeeGrowthInsideX128", position);
58
59
  return {
59
- currentFeeGrowthInside0X128: parseInt(position[4]),
60
- currentFeeGrowthInside1X128: parseInt(position[5]),
60
+ currentFeeGrowthInside0X128: BigInt(position[4]),
61
+ currentFeeGrowthInside1X128: BigInt(position[5]),
61
62
  };
62
63
  }
63
64
  catch (e) {
@@ -65,26 +66,29 @@ class OnchainAccountNftlpUniswapV3 extends onchainAccountNftlp_1.default {
65
66
  // nothing to reinvest
66
67
  const positionData = await this.getPositionData(tokenId);
67
68
  return {
68
- currentFeeGrowthInside0X128: parseInt(positionData.feeGrowthInside0LastX128),
69
- currentFeeGrowthInside1X128: parseInt(positionData.feeGrowthInside1LastX128),
69
+ currentFeeGrowthInside0X128: BigInt(positionData.feeGrowthInside0LastX128),
70
+ currentFeeGrowthInside1X128: BigInt(positionData.feeGrowthInside1LastX128),
70
71
  };
71
72
  }
72
73
  }
73
74
  async getCurrentUnclaimedFeesRaw(tokenId) {
74
75
  const { currentFeeGrowthInside0X128, currentFeeGrowthInside1X128 } = await this.getCurrentFeeGrowthInsideX128(tokenId);
75
76
  const positionData = await this.getPositionData(tokenId);
76
- const delta0 = currentFeeGrowthInside0X128 - parseInt(positionData.feeGrowthInside0LastX128);
77
- const delta1 = currentFeeGrowthInside1X128 - parseInt(positionData.feeGrowthInside1LastX128);
77
+ let delta0 = currentFeeGrowthInside0X128 - BigInt(positionData.feeGrowthInside0LastX128);
78
+ let delta1 = currentFeeGrowthInside1X128 - BigInt(positionData.feeGrowthInside1LastX128);
79
+ if (delta0 < 0)
80
+ delta0 += Q256;
81
+ if (delta1 < 0)
82
+ delta1 += Q256;
83
+ console.log("Q256", Q256.toString());
78
84
  console.log("positionData", positionData);
79
85
  console.log("currentFeeGrowthInside0X128", currentFeeGrowthInside0X128);
80
86
  console.log("currentFeeGrowthInside1X128", currentFeeGrowthInside1X128);
81
87
  console.log("delta0", delta0);
82
88
  console.log("delta1", delta1);
83
- console.log("unclaimedFees0", parseInt(positionData.unclaimedFees0) + delta0 * parseInt(positionData.liquidity) / Q128, parseInt(positionData.unclaimedFees0), delta0 * parseInt(positionData.liquidity) / Q128);
84
- console.log("unclaimedFees1", parseInt(positionData.unclaimedFees1) + delta1 * parseInt(positionData.liquidity) / Q128, parseInt(positionData.unclaimedFees1), delta1 * parseInt(positionData.liquidity) / Q128);
85
89
  return {
86
- unclaimedFees0: parseInt(positionData.unclaimedFees0) + delta0 * parseInt(positionData.liquidity) / Q128,
87
- unclaimedFees1: parseInt(positionData.unclaimedFees1) + delta1 * parseInt(positionData.liquidity) / Q128,
90
+ unclaimedFees0: parseInt(positionData.unclaimedFees0) + Number(delta0) * parseInt(positionData.liquidity) / Q128,
91
+ unclaimedFees1: parseInt(positionData.unclaimedFees1) + Number(delta1) * parseInt(positionData.liquidity) / Q128,
88
92
  };
89
93
  }
90
94
  async getCurrentUnclaimedFees(tokenId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impermax-sdk",
3
- "version": "2.1.296",
3
+ "version": "2.1.298",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",