@alcorexchange/alcor-swap-sdk 1.0.25 → 1.0.26
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/build/entities/position.js +10 -2
- package/package.json +1 -1
- package/src/entities/position.ts +13 -2
|
@@ -364,8 +364,16 @@ class Position {
|
|
|
364
364
|
getFees() {
|
|
365
365
|
return __awaiter(this, void 0, void 0, function* () {
|
|
366
366
|
const { liquidity, tickLower, tickUpper, feeGrowthInsideALastX64, feeGrowthInsideBLastX64, pool } = this;
|
|
367
|
-
|
|
368
|
-
|
|
367
|
+
if (jsbi_1.default.equal(liquidity, internalConstants_2.ZERO) &&
|
|
368
|
+
jsbi_1.default.equal(this.feesA, internalConstants_2.ZERO) &&
|
|
369
|
+
jsbi_1.default.equal(this.feesB, internalConstants_2.ZERO)) {
|
|
370
|
+
return {
|
|
371
|
+
feesA: fractions_1.CurrencyAmount.fromRawAmount(this.pool.tokenA, internalConstants_2.ZERO),
|
|
372
|
+
feesB: fractions_1.CurrencyAmount.fromRawAmount(this.pool.tokenB, internalConstants_2.ZERO)
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
const lower = this.pool.tickDataProvider.getTick(tickLower);
|
|
376
|
+
const upper = this.pool.tickDataProvider.getTick(tickUpper);
|
|
369
377
|
const { feeGrowthGlobalAX64, feeGrowthGlobalBX64 } = pool;
|
|
370
378
|
const [feeGrowthInsideAX64, feeGrowthInsideBX64] = utils_1.TickLibrary.getFeeGrowthInside(lower, upper, tickLower, tickUpper, pool.tickCurrent, feeGrowthGlobalAX64, feeGrowthGlobalBX64);
|
|
371
379
|
const tokensOwedA = jsbi_1.default.divide(jsbi_1.default.multiply((0, utils_1.subIn128)(feeGrowthInsideAX64, feeGrowthInsideALastX64), liquidity), internalConstants_1.Q64);
|
package/package.json
CHANGED
package/src/entities/position.ts
CHANGED
|
@@ -586,9 +586,20 @@ export class Position {
|
|
|
586
586
|
*/
|
|
587
587
|
public async getFees(): Promise<Fees> {
|
|
588
588
|
const { liquidity, tickLower, tickUpper, feeGrowthInsideALastX64, feeGrowthInsideBLastX64, pool } = this
|
|
589
|
+
|
|
590
|
+
if (
|
|
591
|
+
JSBI.equal(liquidity, ZERO) &&
|
|
592
|
+
JSBI.equal(this.feesA, ZERO) &&
|
|
593
|
+
JSBI.equal(this.feesB, ZERO)
|
|
594
|
+
) {
|
|
595
|
+
return {
|
|
596
|
+
feesA: CurrencyAmount.fromRawAmount(this.pool.tokenA, ZERO),
|
|
597
|
+
feesB: CurrencyAmount.fromRawAmount(this.pool.tokenB, ZERO)
|
|
598
|
+
}
|
|
599
|
+
}
|
|
589
600
|
|
|
590
|
-
const lower =
|
|
591
|
-
const upper =
|
|
601
|
+
const lower = this.pool.tickDataProvider.getTick(tickLower)
|
|
602
|
+
const upper = this.pool.tickDataProvider.getTick(tickUpper)
|
|
592
603
|
|
|
593
604
|
const { feeGrowthGlobalAX64, feeGrowthGlobalBX64 } = pool
|
|
594
605
|
|