impermax-sdk 2.1.155 → 2.1.157

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.
@@ -51,7 +51,6 @@ export declare class UniswapV3Position implements Position {
51
51
  /**
52
52
  * PUBLIC SETTERS
53
53
  */
54
- setLiquidity(_liquidity: number): void;
55
54
  setRealXRealY(amountX: number, amountY: number): void;
56
55
  setRealX(amountX: number): void;
57
56
  setRealY(amountY: number): void;
@@ -155,30 +155,42 @@ class UniswapV3Position {
155
155
  * PUBLIC SETTERS
156
156
  */
157
157
  // Setters
158
- setLiquidity(_liquidity) {
159
- this.checkLock();
160
- this.liquidity = _liquidity;
161
- }
158
+ /*public setLiquidity(_liquidity: number) {
159
+ this.checkLock();
160
+ this.liquidity = _liquidity;
161
+ }*/
162
162
  setRealXRealY(amountX, amountY) {
163
+ if (Number.isNaN(amountX))
164
+ return;
165
+ if (Number.isNaN(amountY))
166
+ return;
163
167
  this.checkLock();
164
168
  const { liquidity } = this.getOptimalLiquidity(amountX, amountY);
165
169
  this.liquidity = liquidity;
166
170
  }
167
171
  setRealX(amountX) {
172
+ if (Number.isNaN(amountX))
173
+ return;
168
174
  this.checkLock();
169
175
  const { liquidity } = this.getOptimalLiquidity(amountX, Infinity);
170
176
  this.liquidity = liquidity;
171
177
  }
172
178
  setRealY(amountY) {
179
+ if (Number.isNaN(amountY))
180
+ return;
173
181
  this.checkLock();
174
182
  const { liquidity } = this.getOptimalLiquidity(Infinity, amountY);
175
183
  this.liquidity = liquidity;
176
184
  }
177
185
  setDebtX(_debtX) {
186
+ if (Number.isNaN(_debtX))
187
+ return;
178
188
  this.checkLock();
179
189
  this.debtX = _debtX;
180
190
  }
181
191
  setDebtY(_debtY) {
192
+ if (Number.isNaN(_debtY))
193
+ return;
182
194
  this.checkLock();
183
195
  this.debtY = _debtY;
184
196
  }
@@ -243,7 +255,13 @@ class UniswapV3Position {
243
255
  }
244
256
  getLeverage() {
245
257
  const leverage = this.getCollateralValue() / this.getEquityValue();
246
- return leverage ?? 1;
258
+ if (!leverage)
259
+ return 1;
260
+ if (Number.isNaN(leverage))
261
+ return 1;
262
+ if (leverage < 1)
263
+ return 1;
264
+ return leverage;
247
265
  }
248
266
  // amountX and amountY are expected to have the same sign
249
267
  getOptimalLiquidity(amountX, amountY) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impermax-sdk",
3
- "version": "2.1.155",
3
+ "version": "2.1.157",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",