@paraswap/dex-lib 3.8.28-fm.0 → 3.8.28-fm.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.
- package/build/dex/balancer-v1/balancer-v1.d.ts +2 -2
- package/build/dex/balancer-v1/balancer-v1.js +2 -2
- package/build/dex/balancer-v1/balancer-v1.js.map +1 -1
- package/build/dex/balancer-v2/balancer-v2.d.ts +2 -2
- package/build/dex/balancer-v2/balancer-v2.js +2 -2
- package/build/dex/balancer-v2/balancer-v2.js.map +1 -1
- package/build/dex/camelot/camelot.d.ts +2 -2
- package/build/dex/camelot/camelot.js +4 -4
- package/build/dex/camelot/camelot.js.map +1 -1
- package/build/dex/curve-v1/curve-v1.d.ts +1 -1
- package/build/dex/curve-v1/curve-v1.js +2 -2
- package/build/dex/curve-v1/curve-v1.js.map +1 -1
- package/build/dex/curve-v1-factory/curve-v1-factory.d.ts +1 -1
- package/build/dex/curve-v1-factory/curve-v1-factory.js +4 -5
- package/build/dex/curve-v1-factory/curve-v1-factory.js.map +1 -1
- package/build/dex/gmx/gmx.d.ts +2 -2
- package/build/dex/gmx/gmx.js +2 -2
- package/build/dex/gmx/gmx.js.map +1 -1
- package/build/dex/gmx/pool.d.ts +2 -2
- package/build/dex/gmx/pool.js +7 -3
- package/build/dex/gmx/pool.js.map +1 -1
- package/build/dex/idex.d.ts +1 -1
- package/build/dex/infusion/infusion.d.ts +2 -2
- package/build/dex/infusion/infusion.js +4 -4
- package/build/dex/infusion/infusion.js.map +1 -1
- package/build/dex/oswap/oswap-pool.d.ts +1 -1
- package/build/dex/oswap/oswap-pool.js +3 -1
- package/build/dex/oswap/oswap-pool.js.map +1 -1
- package/build/dex/oswap/oswap.d.ts +1 -1
- package/build/dex/oswap/oswap.js +6 -2
- package/build/dex/oswap/oswap.js.map +1 -1
- package/build/dex/solidly/solidly.d.ts +2 -2
- package/build/dex/solidly/solidly.js +4 -4
- package/build/dex/solidly/solidly.js.map +1 -1
- package/build/dex/uniswap-v2/uniswap-v2.d.ts +2 -2
- package/build/dex/uniswap-v2/uniswap-v2.js +4 -4
- package/build/dex/uniswap-v2/uniswap-v2.js.map +1 -1
- package/build/dex/uniswap-v3/uniswap-v3.d.ts +2 -2
- package/build/dex/uniswap-v3/uniswap-v3.js +4 -2
- package/build/dex/uniswap-v3/uniswap-v3.js.map +1 -1
- package/build/pricing-helper.d.ts +1 -1
- package/build/pricing-helper.js +8 -4
- package/build/pricing-helper.js.map +1 -1
- package/package.json +1 -1
- package/src/dex/balancer-v1/balancer-v1.ts +5 -1
- package/src/dex/balancer-v2/balancer-v2.ts +5 -1
- package/src/dex/camelot/camelot.ts +9 -3
- package/src/dex/curve-v1/curve-v1.ts +3 -1
- package/src/dex/curve-v1-factory/curve-v1-factory.ts +5 -4
- package/src/dex/gmx/gmx.ts +5 -0
- package/src/dex/gmx/pool.ts +8 -2
- package/src/dex/idex.ts +1 -0
- package/src/dex/infusion/infusion.ts +9 -3
- package/src/dex/oswap/oswap-pool.ts +3 -1
- package/src/dex/oswap/oswap.ts +8 -2
- package/src/dex/solidly/solidly.ts +9 -3
- package/src/dex/uniswap-v2/uniswap-v2.ts +9 -3
- package/src/dex/uniswap-v3/uniswap-v3.ts +14 -8
- package/src/pricing-helper.ts +25 -4
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
PreprocessTransactionOptions,
|
|
15
15
|
SimpleExchangeParam,
|
|
16
16
|
Token,
|
|
17
|
+
TransferFeeParams,
|
|
17
18
|
TxInfo,
|
|
18
19
|
} from '../../types';
|
|
19
20
|
import { CACHE_PREFIX, Network, SwapSide } from '../../constants';
|
|
@@ -661,6 +662,9 @@ export class UniswapV3
|
|
|
661
662
|
side: SwapSide,
|
|
662
663
|
blockNumber: number,
|
|
663
664
|
limitPools?: string[],
|
|
665
|
+
transferFees?: TransferFeeParams,
|
|
666
|
+
isFirstSwap?: boolean,
|
|
667
|
+
fmode?: boolean,
|
|
664
668
|
): Promise<null | ExchangePrices<UniswapV3Data>> {
|
|
665
669
|
try {
|
|
666
670
|
const _srcToken = this.dexHelper.config.wrapETH(srcToken);
|
|
@@ -737,14 +741,16 @@ export class UniswapV3
|
|
|
737
741
|
p => p.getState(blockNumber)!,
|
|
738
742
|
);
|
|
739
743
|
|
|
740
|
-
const rpcResultsPromise =
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
744
|
+
const rpcResultsPromise = fmode
|
|
745
|
+
? null
|
|
746
|
+
: this.getPricingFromRpc(
|
|
747
|
+
_srcToken,
|
|
748
|
+
_destToken,
|
|
749
|
+
amounts,
|
|
750
|
+
side,
|
|
751
|
+
this.network === Network.ZKEVM ? [] : poolsToUse.poolWithoutState,
|
|
752
|
+
this.network === Network.ZKEVM ? [] : states,
|
|
753
|
+
);
|
|
748
754
|
|
|
749
755
|
const unitAmount = getBigIntPow(
|
|
750
756
|
side == SwapSide.SELL ? _srcToken.decimals : _destToken.decimals,
|
package/src/pricing-helper.ts
CHANGED
|
@@ -117,9 +117,18 @@ export class PricingHelper {
|
|
|
117
117
|
dexKeys.map(async key => {
|
|
118
118
|
try {
|
|
119
119
|
return await new Promise<string[] | null>((resolve, reject) => {
|
|
120
|
+
const now = Date.now();
|
|
121
|
+
const timeout = overrideTimeout ?? FETCH_POOL_IDENTIFIER_TIMEOUT;
|
|
120
122
|
const timer = setTimeout(
|
|
121
|
-
() =>
|
|
122
|
-
|
|
123
|
+
() =>
|
|
124
|
+
reject(
|
|
125
|
+
new Error(
|
|
126
|
+
`Timeout of ${timeout}ms breached after ${
|
|
127
|
+
Date.now() - now
|
|
128
|
+
}ms for ${key}`,
|
|
129
|
+
),
|
|
130
|
+
),
|
|
131
|
+
timeout,
|
|
123
132
|
);
|
|
124
133
|
const dexInstance = this.dexAdapterService.getDexByKey(key);
|
|
125
134
|
|
|
@@ -194,6 +203,7 @@ export class PricingHelper {
|
|
|
194
203
|
},
|
|
195
204
|
rollupL1ToL2GasRatio?: number,
|
|
196
205
|
overrideTimeout?: number,
|
|
206
|
+
fmode?: boolean,
|
|
197
207
|
): Promise<PoolPrices<any>[]> {
|
|
198
208
|
const dexPoolPrices = await Promise.all(
|
|
199
209
|
dexKeys.map(async key => {
|
|
@@ -204,9 +214,18 @@ export class PricingHelper {
|
|
|
204
214
|
|
|
205
215
|
return await new Promise<PoolPrices<any>[] | null>(
|
|
206
216
|
(resolve, reject) => {
|
|
217
|
+
const now = Date.now();
|
|
218
|
+
const timeout = overrideTimeout ?? FETCH_POOL_PRICES_TIMEOUT;
|
|
207
219
|
const timer = setTimeout(
|
|
208
|
-
() =>
|
|
209
|
-
|
|
220
|
+
() =>
|
|
221
|
+
reject(
|
|
222
|
+
new Error(
|
|
223
|
+
`Timeout of ${timeout}ms breached after ${
|
|
224
|
+
Date.now() - now
|
|
225
|
+
}ms for ${key}`,
|
|
226
|
+
),
|
|
227
|
+
),
|
|
228
|
+
timeout,
|
|
210
229
|
);
|
|
211
230
|
|
|
212
231
|
const dexInstance = this.dexAdapterService.getDexByKey(key);
|
|
@@ -228,6 +247,8 @@ export class PricingHelper {
|
|
|
228
247
|
blockNumber,
|
|
229
248
|
limitPools ? limitPools : undefined,
|
|
230
249
|
transferFees,
|
|
250
|
+
false,
|
|
251
|
+
fmode,
|
|
231
252
|
)
|
|
232
253
|
.then(poolPrices => {
|
|
233
254
|
try {
|