@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.
Files changed (59) hide show
  1. package/build/dex/balancer-v1/balancer-v1.d.ts +2 -2
  2. package/build/dex/balancer-v1/balancer-v1.js +2 -2
  3. package/build/dex/balancer-v1/balancer-v1.js.map +1 -1
  4. package/build/dex/balancer-v2/balancer-v2.d.ts +2 -2
  5. package/build/dex/balancer-v2/balancer-v2.js +2 -2
  6. package/build/dex/balancer-v2/balancer-v2.js.map +1 -1
  7. package/build/dex/camelot/camelot.d.ts +2 -2
  8. package/build/dex/camelot/camelot.js +4 -4
  9. package/build/dex/camelot/camelot.js.map +1 -1
  10. package/build/dex/curve-v1/curve-v1.d.ts +1 -1
  11. package/build/dex/curve-v1/curve-v1.js +2 -2
  12. package/build/dex/curve-v1/curve-v1.js.map +1 -1
  13. package/build/dex/curve-v1-factory/curve-v1-factory.d.ts +1 -1
  14. package/build/dex/curve-v1-factory/curve-v1-factory.js +4 -5
  15. package/build/dex/curve-v1-factory/curve-v1-factory.js.map +1 -1
  16. package/build/dex/gmx/gmx.d.ts +2 -2
  17. package/build/dex/gmx/gmx.js +2 -2
  18. package/build/dex/gmx/gmx.js.map +1 -1
  19. package/build/dex/gmx/pool.d.ts +2 -2
  20. package/build/dex/gmx/pool.js +7 -3
  21. package/build/dex/gmx/pool.js.map +1 -1
  22. package/build/dex/idex.d.ts +1 -1
  23. package/build/dex/infusion/infusion.d.ts +2 -2
  24. package/build/dex/infusion/infusion.js +4 -4
  25. package/build/dex/infusion/infusion.js.map +1 -1
  26. package/build/dex/oswap/oswap-pool.d.ts +1 -1
  27. package/build/dex/oswap/oswap-pool.js +3 -1
  28. package/build/dex/oswap/oswap-pool.js.map +1 -1
  29. package/build/dex/oswap/oswap.d.ts +1 -1
  30. package/build/dex/oswap/oswap.js +6 -2
  31. package/build/dex/oswap/oswap.js.map +1 -1
  32. package/build/dex/solidly/solidly.d.ts +2 -2
  33. package/build/dex/solidly/solidly.js +4 -4
  34. package/build/dex/solidly/solidly.js.map +1 -1
  35. package/build/dex/uniswap-v2/uniswap-v2.d.ts +2 -2
  36. package/build/dex/uniswap-v2/uniswap-v2.js +4 -4
  37. package/build/dex/uniswap-v2/uniswap-v2.js.map +1 -1
  38. package/build/dex/uniswap-v3/uniswap-v3.d.ts +2 -2
  39. package/build/dex/uniswap-v3/uniswap-v3.js +4 -2
  40. package/build/dex/uniswap-v3/uniswap-v3.js.map +1 -1
  41. package/build/pricing-helper.d.ts +1 -1
  42. package/build/pricing-helper.js +8 -4
  43. package/build/pricing-helper.js.map +1 -1
  44. package/package.json +1 -1
  45. package/src/dex/balancer-v1/balancer-v1.ts +5 -1
  46. package/src/dex/balancer-v2/balancer-v2.ts +5 -1
  47. package/src/dex/camelot/camelot.ts +9 -3
  48. package/src/dex/curve-v1/curve-v1.ts +3 -1
  49. package/src/dex/curve-v1-factory/curve-v1-factory.ts +5 -4
  50. package/src/dex/gmx/gmx.ts +5 -0
  51. package/src/dex/gmx/pool.ts +8 -2
  52. package/src/dex/idex.ts +1 -0
  53. package/src/dex/infusion/infusion.ts +9 -3
  54. package/src/dex/oswap/oswap-pool.ts +3 -1
  55. package/src/dex/oswap/oswap.ts +8 -2
  56. package/src/dex/solidly/solidly.ts +9 -3
  57. package/src/dex/uniswap-v2/uniswap-v2.ts +9 -3
  58. package/src/dex/uniswap-v3/uniswap-v3.ts +14 -8
  59. 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 = this.getPricingFromRpc(
741
- _srcToken,
742
- _destToken,
743
- amounts,
744
- side,
745
- this.network === Network.ZKEVM ? [] : poolsToUse.poolWithoutState,
746
- this.network === Network.ZKEVM ? [] : states,
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,
@@ -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
- () => reject(new Error(`Timeout`)),
122
- overrideTimeout ?? FETCH_POOL_IDENTIFIER_TIMEOUT,
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
- () => reject(new Error(`Timeout`)),
209
- overrideTimeout ?? FETCH_POOL_PRICES_TIMEOUT,
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 {