@synthra-swap/smart-order-router 3.15.33 → 3.16.1
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/README.md +21 -21
- package/build/main/providers/caching/route/model/cached-route.d.ts +5 -5
- package/build/main/providers/caching/route/model/cached-routes.d.ts +5 -5
- package/build/main/providers/caching/route/model/cached-routes.js +1 -1
- package/build/main/providers/caching/route/route-caching-provider.d.ts +2 -2
- package/build/main/providers/caching/route/route-caching-provider.js +3 -3
- package/build/main/providers/caching-gas-provider.d.ts +1 -1
- package/build/main/providers/caching-token-list-provider.d.ts +2 -2
- package/build/main/providers/caching-token-list-provider.js +3 -3
- package/build/main/providers/caching-token-provider.d.ts +1 -1
- package/build/main/providers/caching-token-provider.js +34 -34
- package/build/main/providers/eth-estimate-gas-provider.d.ts +2 -4
- package/build/main/providers/eth-estimate-gas-provider.js +4 -5
- package/build/main/providers/index.d.ts +1 -10
- package/build/main/providers/index.js +2 -11
- package/build/main/providers/multicall-uniswap-provider.d.ts +1 -1
- package/build/main/providers/multicall-uniswap-provider.js +2 -2
- package/build/main/providers/on-chain-gas-price-provider.d.ts +1 -1
- package/build/main/providers/on-chain-gas-price-provider.js +5 -5
- package/build/main/providers/on-chain-quote-provider.d.ts +11 -19
- package/build/main/providers/on-chain-quote-provider.js +18 -39
- package/build/main/providers/simulation-provider.d.ts +1 -1
- package/build/main/providers/simulation-provider.js +6 -6
- package/build/main/providers/swap-router-provider.d.ts +2 -2
- package/build/main/providers/tenderly-simulation-provider.d.ts +2 -4
- package/build/main/providers/tenderly-simulation-provider.js +13 -14
- package/build/main/providers/token-provider.d.ts +1 -1
- package/build/main/providers/token-provider.js +112 -112
- package/build/main/providers/token-validator-provider.d.ts +1 -1
- package/build/main/providers/uri-subgraph-provider.d.ts +3 -5
- package/build/main/providers/uri-subgraph-provider.js +2 -3
- package/build/main/providers/v3/caching-pool-provider.d.ts +2 -2
- package/build/main/providers/v3/caching-subgraph-provider.d.ts +1 -1
- package/build/main/providers/v3/gas-data-provider.d.ts +1 -1
- package/build/main/providers/v3/gas-data-provider.js +3 -3
- package/build/main/providers/v3/pool-provider.d.ts +2 -2
- package/build/main/providers/v3/pool-provider.js +15 -7
- package/build/main/providers/v3/static-subgraph-provider.d.ts +1 -1
- package/build/main/providers/v3/static-subgraph-provider.js +48 -47
- package/build/main/providers/v3/subgraph-provider-with-fallback.d.ts +1 -1
- package/build/main/providers/v3/subgraph-provider.d.ts +1 -3
- package/build/main/providers/v3/subgraph-provider.js +12 -14
- package/build/main/routers/alpha-router/alpha-router.d.ts +17 -54
- package/build/main/routers/alpha-router/alpha-router.js +92 -170
- package/build/main/routers/alpha-router/config.d.ts +1 -2
- package/build/main/routers/alpha-router/config.js +11 -39
- package/build/main/routers/alpha-router/entities/route-with-valid-quote.d.ts +5 -93
- package/build/main/routers/alpha-router/entities/route-with-valid-quote.js +5 -93
- package/build/main/routers/alpha-router/functions/best-swap-route.d.ts +1 -1
- package/build/main/routers/alpha-router/functions/best-swap-route.js +12 -39
- package/build/main/routers/alpha-router/functions/calculate-ratio-amount-in.d.ts +1 -1
- package/build/main/routers/alpha-router/functions/calculate-ratio-amount-in.js +3 -3
- package/build/main/routers/alpha-router/functions/compute-all-routes.d.ts +4 -7
- package/build/main/routers/alpha-router/functions/compute-all-routes.js +2 -28
- package/build/main/routers/alpha-router/functions/get-candidate-pools.d.ts +3 -39
- package/build/main/routers/alpha-router/functions/get-candidate-pools.js +28 -433
- package/build/main/routers/alpha-router/gas-models/gas-model.d.ts +8 -29
- package/build/main/routers/alpha-router/gas-models/gas-model.js +28 -39
- package/build/main/routers/alpha-router/gas-models/v3/gas-costs.d.ts +1 -1
- package/build/main/routers/alpha-router/gas-models/v3/gas-costs.js +75 -69
- package/build/main/routers/alpha-router/gas-models/v3/v3-heuristic-gas-model.d.ts +1 -1
- package/build/main/routers/alpha-router/gas-models/v3/v3-heuristic-gas-model.js +41 -42
- package/build/main/routers/alpha-router/quoters/base-quoter.d.ts +5 -6
- package/build/main/routers/alpha-router/quoters/base-quoter.js +1 -1
- package/build/main/routers/alpha-router/quoters/index.d.ts +1 -3
- package/build/main/routers/alpha-router/quoters/index.js +2 -4
- package/build/main/routers/alpha-router/quoters/model/results/get-routes-result.d.ts +2 -2
- package/build/main/routers/alpha-router/quoters/v3-quoter.d.ts +1 -1
- package/build/main/routers/alpha-router/quoters/v3-quoter.js +3 -3
- package/build/main/routers/index.d.ts +1 -1
- package/build/main/routers/index.js +2 -2
- package/build/main/routers/router.d.ts +4 -11
- package/build/main/routers/router.js +5 -20
- package/build/main/routers/synthra-router/config.d.ts +5 -0
- package/build/main/routers/synthra-router/config.js +30 -0
- package/build/main/routers/synthra-router/index.d.ts +3 -0
- package/build/main/routers/{legacy-router → synthra-router}/index.js +4 -2
- package/build/main/routers/synthra-router/synthra-router.d.ts +31 -0
- package/build/main/routers/synthra-router/synthra-router.js +437 -0
- package/build/main/routers/synthra-router/types.d.ts +158 -0
- package/build/main/routers/synthra-router/types.js +3 -0
- package/build/main/tsconfig.tsbuildinfo +1 -1
- package/build/main/types/v3/factories/{IUniswapV3PoolState__factory.d.ts → ISynthraV3PoolState__factory.d.ts} +4 -4
- package/build/main/types/v3/factories/{IUniswapV3PoolState__factory.js → ISynthraV3PoolState__factory.js} +5 -5
- package/build/main/types/v3/factories/{UniswapInterfaceMulticall__factory.d.ts → SynthraInterfaceMulticall__factory.d.ts} +7 -7
- package/build/main/types/v3/factories/{UniswapInterfaceMulticall__factory.js → SynthraInterfaceMulticall__factory.js} +8 -8
- package/build/main/util/addresses.d.ts +1 -4
- package/build/main/util/addresses.js +29 -53
- package/build/main/util/amounts.d.ts +3 -3
- package/build/main/util/amounts.js +12 -12
- package/build/main/util/chains.d.ts +2 -31
- package/build/main/util/chains.js +83 -511
- package/build/main/util/gas-factory-helpers.d.ts +8 -11
- package/build/main/util/gas-factory-helpers.js +57 -103
- package/build/main/util/index.d.ts +0 -1
- package/build/main/util/index.js +1 -2
- package/build/main/util/methodParameters.d.ts +2 -2
- package/build/main/util/methodParameters.js +10 -57
- package/build/main/util/router-sdk.d.ts +21 -0
- package/build/main/util/router-sdk.js +24 -0
- package/build/main/util/routes.d.ts +4 -5
- package/build/main/util/routes.js +9 -19
- package/build/main/util/token-list.d.ts +28 -0
- package/build/main/util/token-list.js +14 -0
- package/build/module/providers/caching/route/model/cached-route.d.ts +5 -5
- package/build/module/providers/caching/route/model/cached-routes.d.ts +5 -5
- package/build/module/providers/caching/route/model/cached-routes.js +1 -1
- package/build/module/providers/caching/route/route-caching-provider.d.ts +2 -2
- package/build/module/providers/caching/route/route-caching-provider.js +1 -1
- package/build/module/providers/caching-gas-provider.d.ts +1 -1
- package/build/module/providers/caching-token-list-provider.d.ts +2 -2
- package/build/module/providers/caching-token-list-provider.js +2 -2
- package/build/module/providers/caching-token-provider.d.ts +1 -1
- package/build/module/providers/caching-token-provider.js +1 -1
- package/build/module/providers/eth-estimate-gas-provider.d.ts +2 -4
- package/build/module/providers/eth-estimate-gas-provider.js +4 -5
- package/build/module/providers/index.d.ts +1 -10
- package/build/module/providers/index.js +2 -11
- package/build/module/providers/multicall-uniswap-provider.d.ts +1 -1
- package/build/module/providers/multicall-uniswap-provider.js +2 -2
- package/build/module/providers/on-chain-gas-price-provider.d.ts +1 -1
- package/build/module/providers/on-chain-gas-price-provider.js +1 -1
- package/build/module/providers/on-chain-quote-provider.d.ts +11 -19
- package/build/module/providers/on-chain-quote-provider.js +17 -38
- package/build/module/providers/simulation-provider.d.ts +1 -1
- package/build/module/providers/simulation-provider.js +3 -3
- package/build/module/providers/swap-router-provider.d.ts +2 -2
- package/build/module/providers/tenderly-simulation-provider.d.ts +2 -4
- package/build/module/providers/tenderly-simulation-provider.js +6 -7
- package/build/module/providers/token-provider.d.ts +1 -1
- package/build/module/providers/token-provider.js +3 -3
- package/build/module/providers/token-validator-provider.d.ts +1 -1
- package/build/module/providers/uri-subgraph-provider.d.ts +3 -5
- package/build/module/providers/uri-subgraph-provider.js +2 -3
- package/build/module/providers/v3/caching-pool-provider.d.ts +2 -2
- package/build/module/providers/v3/caching-subgraph-provider.d.ts +1 -1
- package/build/module/providers/v3/gas-data-provider.d.ts +1 -1
- package/build/module/providers/v3/gas-data-provider.js +1 -1
- package/build/module/providers/v3/pool-provider.d.ts +2 -2
- package/build/module/providers/v3/pool-provider.js +13 -5
- package/build/module/providers/v3/static-subgraph-provider.d.ts +1 -1
- package/build/module/providers/v3/static-subgraph-provider.js +5 -4
- package/build/module/providers/v3/subgraph-provider-with-fallback.d.ts +1 -1
- package/build/module/providers/v3/subgraph-provider.d.ts +1 -3
- package/build/module/providers/v3/subgraph-provider.js +2 -3
- package/build/module/routers/alpha-router/alpha-router.d.ts +17 -54
- package/build/module/routers/alpha-router/alpha-router.js +74 -145
- package/build/module/routers/alpha-router/config.d.ts +1 -2
- package/build/module/routers/alpha-router/config.js +2 -30
- package/build/module/routers/alpha-router/entities/route-with-valid-quote.d.ts +5 -93
- package/build/module/routers/alpha-router/entities/route-with-valid-quote.js +3 -89
- package/build/module/routers/alpha-router/functions/best-swap-route.d.ts +1 -1
- package/build/module/routers/alpha-router/functions/best-swap-route.js +8 -35
- package/build/module/routers/alpha-router/functions/calculate-ratio-amount-in.d.ts +1 -1
- package/build/module/routers/alpha-router/functions/calculate-ratio-amount-in.js +1 -1
- package/build/module/routers/alpha-router/functions/compute-all-routes.d.ts +4 -7
- package/build/module/routers/alpha-router/functions/compute-all-routes.js +2 -26
- package/build/module/routers/alpha-router/functions/get-candidate-pools.d.ts +3 -39
- package/build/module/routers/alpha-router/functions/get-candidate-pools.js +5 -418
- package/build/module/routers/alpha-router/gas-models/gas-model.d.ts +8 -29
- package/build/module/routers/alpha-router/gas-models/gas-model.js +7 -18
- package/build/module/routers/alpha-router/gas-models/v3/gas-costs.d.ts +1 -1
- package/build/module/routers/alpha-router/gas-models/v3/gas-costs.js +8 -2
- package/build/module/routers/alpha-router/gas-models/v3/v3-heuristic-gas-model.d.ts +1 -1
- package/build/module/routers/alpha-router/gas-models/v3/v3-heuristic-gas-model.js +27 -28
- package/build/module/routers/alpha-router/quoters/base-quoter.d.ts +5 -6
- package/build/module/routers/alpha-router/quoters/base-quoter.js +1 -1
- package/build/module/routers/alpha-router/quoters/index.d.ts +1 -3
- package/build/module/routers/alpha-router/quoters/index.js +2 -4
- package/build/module/routers/alpha-router/quoters/model/results/get-routes-result.d.ts +2 -2
- package/build/module/routers/alpha-router/quoters/v3-quoter.d.ts +1 -1
- package/build/module/routers/alpha-router/quoters/v3-quoter.js +1 -1
- package/build/module/routers/index.d.ts +1 -1
- package/build/module/routers/index.js +2 -2
- package/build/module/routers/router.d.ts +4 -11
- package/build/module/routers/router.js +3 -16
- package/build/module/routers/synthra-router/config.d.ts +5 -0
- package/build/module/routers/synthra-router/config.js +27 -0
- package/build/module/routers/synthra-router/index.d.ts +3 -0
- package/build/module/routers/synthra-router/index.js +4 -0
- package/build/module/routers/synthra-router/synthra-router.d.ts +31 -0
- package/build/module/routers/synthra-router/synthra-router.js +447 -0
- package/build/module/routers/synthra-router/types.d.ts +158 -0
- package/build/module/routers/synthra-router/types.js +2 -0
- package/build/module/tsconfig.module.tsbuildinfo +1 -1
- package/build/module/types/v3/factories/{IUniswapV3PoolState__factory.d.ts → ISynthraV3PoolState__factory.d.ts} +4 -4
- package/build/module/types/v3/factories/{IUniswapV3PoolState__factory.js → ISynthraV3PoolState__factory.js} +3 -3
- package/build/module/types/v3/factories/{UniswapInterfaceMulticall__factory.d.ts → SynthraInterfaceMulticall__factory.d.ts} +7 -7
- package/build/module/types/v3/factories/{UniswapInterfaceMulticall__factory.js → SynthraInterfaceMulticall__factory.js} +6 -6
- package/build/module/util/addresses.d.ts +1 -4
- package/build/module/util/addresses.js +7 -82
- package/build/module/util/amounts.d.ts +3 -3
- package/build/module/util/amounts.js +3 -3
- package/build/module/util/chains.d.ts +2 -31
- package/build/module/util/chains.js +3 -435
- package/build/module/util/gas-factory-helpers.d.ts +8 -11
- package/build/module/util/gas-factory-helpers.js +31 -76
- package/build/module/util/index.d.ts +0 -1
- package/build/module/util/index.js +1 -2
- package/build/module/util/methodParameters.d.ts +2 -2
- package/build/module/util/methodParameters.js +7 -54
- package/build/module/util/router-sdk.d.ts +21 -0
- package/build/module/util/router-sdk.js +19 -0
- package/build/module/util/routes.d.ts +4 -5
- package/build/module/util/routes.js +8 -18
- package/build/module/util/token-list.d.ts +28 -0
- package/build/module/util/token-list.js +11 -0
- package/package.json +13 -26
- package/build/main/providers/eth-gas-station-info-gas-price-provider.d.ts +0 -19
- package/build/main/providers/eth-gas-station-info-gas-price-provider.js +0 -37
- package/build/main/providers/v2/caching-pool-provider.d.ts +0 -33
- package/build/main/providers/v2/caching-pool-provider.js +0 -88
- package/build/main/providers/v2/caching-subgraph-provider.d.ts +0 -23
- package/build/main/providers/v2/caching-subgraph-provider.js +0 -34
- package/build/main/providers/v2/pool-provider.d.ts +0 -59
- package/build/main/providers/v2/pool-provider.js +0 -111
- package/build/main/providers/v2/quote-provider.d.ts +0 -33
- package/build/main/providers/v2/quote-provider.js +0 -91
- package/build/main/providers/v2/static-subgraph-provider.d.ts +0 -19
- package/build/main/providers/v2/static-subgraph-provider.js +0 -97
- package/build/main/providers/v2/subgraph-provider-with-fallback.d.ts +0 -19
- package/build/main/providers/v2/subgraph-provider-with-fallback.js +0 -35
- package/build/main/providers/v2/subgraph-provider.d.ts +0 -33
- package/build/main/providers/v2/subgraph-provider.js +0 -134
- package/build/main/providers/v2/uri-subgraph-provider.d.ts +0 -4
- package/build/main/providers/v2/uri-subgraph-provider.js +0 -8
- package/build/main/routers/alpha-router/gas-models/mixedRoute/mixed-route-heuristic-gas-model.d.ts +0 -25
- package/build/main/routers/alpha-router/gas-models/mixedRoute/mixed-route-heuristic-gas-model.js +0 -175
- package/build/main/routers/alpha-router/gas-models/v2/v2-heuristic-gas-model.d.ts +0 -29
- package/build/main/routers/alpha-router/gas-models/v2/v2-heuristic-gas-model.js +0 -167
- package/build/main/routers/alpha-router/quoters/mixed-quoter.d.ts +0 -20
- package/build/main/routers/alpha-router/quoters/mixed-quoter.js +0 -130
- package/build/main/routers/alpha-router/quoters/v2-quoter.d.ts +0 -21
- package/build/main/routers/alpha-router/quoters/v2-quoter.js +0 -122
- package/build/main/routers/legacy-router/bases.d.ts +0 -183
- package/build/main/routers/legacy-router/bases.js +0 -81
- package/build/main/routers/legacy-router/index.d.ts +0 -1
- package/build/main/routers/legacy-router/legacy-router.d.ts +0 -41
- package/build/main/routers/legacy-router/legacy-router.js +0 -289
- package/build/main/types/other/factories/IMixedRouteQuoterV1__factory.d.ts +0 -41
- package/build/main/types/other/factories/IMixedRouteQuoterV1__factory.js +0 -156
- package/build/main/types/v2/commons.d.ts +0 -16
- package/build/main/types/v2/commons.js +0 -6
- package/build/main/types/v2/factories/IUniswapV2Pair__factory.d.ts +0 -35
- package/build/main/types/v2/factories/IUniswapV2Pair__factory.js +0 -671
- package/build/main/util/protocols.d.ts +0 -2
- package/build/main/util/protocols.js +0 -18
- package/build/main/util/unsupported-tokens.d.ts +0 -37
- package/build/main/util/unsupported-tokens.js +0 -1119
- package/build/module/providers/eth-gas-station-info-gas-price-provider.d.ts +0 -19
- package/build/module/providers/eth-gas-station-info-gas-price-provider.js +0 -30
- package/build/module/providers/v2/caching-pool-provider.d.ts +0 -33
- package/build/module/providers/v2/caching-pool-provider.js +0 -81
- package/build/module/providers/v2/caching-subgraph-provider.d.ts +0 -23
- package/build/module/providers/v2/caching-subgraph-provider.js +0 -30
- package/build/module/providers/v2/pool-provider.d.ts +0 -59
- package/build/module/providers/v2/pool-provider.js +0 -104
- package/build/module/providers/v2/quote-provider.d.ts +0 -33
- package/build/module/providers/v2/quote-provider.js +0 -87
- package/build/module/providers/v2/static-subgraph-provider.d.ts +0 -19
- package/build/module/providers/v2/static-subgraph-provider.js +0 -90
- package/build/module/providers/v2/subgraph-provider-with-fallback.d.ts +0 -19
- package/build/module/providers/v2/subgraph-provider-with-fallback.js +0 -31
- package/build/module/providers/v2/subgraph-provider.d.ts +0 -33
- package/build/module/providers/v2/subgraph-provider.js +0 -135
- package/build/module/providers/v2/uri-subgraph-provider.d.ts +0 -4
- package/build/module/providers/v2/uri-subgraph-provider.js +0 -4
- package/build/module/routers/alpha-router/gas-models/mixedRoute/mixed-route-heuristic-gas-model.d.ts +0 -25
- package/build/module/routers/alpha-router/gas-models/mixedRoute/mixed-route-heuristic-gas-model.js +0 -168
- package/build/module/routers/alpha-router/gas-models/v2/v2-heuristic-gas-model.d.ts +0 -29
- package/build/module/routers/alpha-router/gas-models/v2/v2-heuristic-gas-model.js +0 -160
- package/build/module/routers/alpha-router/quoters/mixed-quoter.d.ts +0 -20
- package/build/module/routers/alpha-router/quoters/mixed-quoter.js +0 -123
- package/build/module/routers/alpha-router/quoters/v2-quoter.d.ts +0 -21
- package/build/module/routers/alpha-router/quoters/v2-quoter.js +0 -115
- package/build/module/routers/legacy-router/bases.d.ts +0 -183
- package/build/module/routers/legacy-router/bases.js +0 -87
- package/build/module/routers/legacy-router/index.d.ts +0 -1
- package/build/module/routers/legacy-router/index.js +0 -2
- package/build/module/routers/legacy-router/legacy-router.d.ts +0 -41
- package/build/module/routers/legacy-router/legacy-router.js +0 -290
- package/build/module/types/other/factories/IMixedRouteQuoterV1__factory.d.ts +0 -41
- package/build/module/types/other/factories/IMixedRouteQuoterV1__factory.js +0 -152
- package/build/module/types/v2/commons.d.ts +0 -16
- package/build/module/types/v2/commons.js +0 -5
- package/build/module/types/v2/factories/IUniswapV2Pair__factory.d.ts +0 -35
- package/build/module/types/v2/factories/IUniswapV2Pair__factory.js +0 -667
- package/build/module/util/protocols.d.ts +0 -2
- package/build/module/util/protocols.js +0 -14
- package/build/module/util/unsupported-tokens.d.ts +0 -37
- package/build/module/util/unsupported-tokens.js +0 -1116
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import { BaseProvider } from '@ethersproject/providers';
|
|
2
|
-
import { ChainId, Currency, TradeType } from '@synthra-swap/sdk
|
|
3
|
-
import { Protocol } from '
|
|
4
|
-
import { Position } from '@
|
|
5
|
-
import { IOnChainQuoteProvider, IRouteCachingProvider, ISwapRouterProvider,
|
|
2
|
+
import { ChainId, Currency, TradeType } from '@synthra-swap/sdk/core';
|
|
3
|
+
import { Protocol } from '../../util/router-sdk';
|
|
4
|
+
import { Position } from '@synthra-swap/sdk/v3';
|
|
5
|
+
import { IOnChainQuoteProvider, IRouteCachingProvider, ISwapRouterProvider, Simulator, UniswapMulticallProvider } from '../../providers';
|
|
6
6
|
import { ITokenListProvider } from '../../providers/caching-token-list-provider';
|
|
7
7
|
import { IGasPriceProvider } from '../../providers/gas-price-provider';
|
|
8
8
|
import { ITokenProvider } from '../../providers/token-provider';
|
|
9
9
|
import { ITokenValidatorProvider } from '../../providers/token-validator-provider';
|
|
10
|
-
import { IV2PoolProvider } from '../../providers/v2/pool-provider';
|
|
11
10
|
import { ArbitrumGasData, IL2GasDataProvider, OptimismGasData } from '../../providers/v3/gas-data-provider';
|
|
12
11
|
import { IV3PoolProvider } from '../../providers/v3/pool-provider';
|
|
13
12
|
import { IV3SubgraphProvider } from '../../providers/v3/subgraph-provider';
|
|
14
13
|
import { CurrencyAmount } from '../../util/amounts';
|
|
15
14
|
import { IRouter, ISwapToRatio, SwapAndAddConfig, SwapAndAddOptions, SwapOptions, SwapRoute, SwapToRatioResponse } from '../router';
|
|
16
|
-
import { IOnChainGasModelFactory
|
|
17
|
-
import {
|
|
15
|
+
import { IOnChainGasModelFactory } from './gas-models/gas-model';
|
|
16
|
+
import { V3Quoter } from './quoters';
|
|
18
17
|
export declare type AlphaRouterParams = {
|
|
19
18
|
/**
|
|
20
19
|
* The chain id for this instance of the Alpha Router.
|
|
@@ -42,19 +41,6 @@ export declare type AlphaRouterParams = {
|
|
|
42
41
|
* The provider for getting V3 quotes.
|
|
43
42
|
*/
|
|
44
43
|
onChainQuoteProvider?: IOnChainQuoteProvider;
|
|
45
|
-
/**
|
|
46
|
-
* The provider for getting all pools that exist on V2 from the Subgraph. The pools
|
|
47
|
-
* from this provider are filtered during the algorithm to a set of candidate pools.
|
|
48
|
-
*/
|
|
49
|
-
v2SubgraphProvider?: IV2SubgraphProvider;
|
|
50
|
-
/**
|
|
51
|
-
* The provider for getting data about V2 pools.
|
|
52
|
-
*/
|
|
53
|
-
v2PoolProvider?: IV2PoolProvider;
|
|
54
|
-
/**
|
|
55
|
-
* The provider for getting V3 quotes.
|
|
56
|
-
*/
|
|
57
|
-
v2QuoteProvider?: IV2QuoteProvider;
|
|
58
44
|
/**
|
|
59
45
|
* The provider for getting data about Tokens.
|
|
60
46
|
*/
|
|
@@ -70,18 +56,8 @@ export declare type AlphaRouterParams = {
|
|
|
70
56
|
*/
|
|
71
57
|
v3GasModelFactory?: IOnChainGasModelFactory;
|
|
72
58
|
/**
|
|
73
|
-
* A
|
|
74
|
-
*
|
|
75
|
-
*/
|
|
76
|
-
v2GasModelFactory?: IV2GasModelFactory;
|
|
77
|
-
/**
|
|
78
|
-
* A factory for generating a gas model that is used when estimating the gas used by
|
|
79
|
-
* V3 routes.
|
|
80
|
-
*/
|
|
81
|
-
mixedRouteGasModelFactory?: IOnChainGasModelFactory;
|
|
82
|
-
/**
|
|
83
|
-
* A token list that specifies Token that should be blocked from routing through.
|
|
84
|
-
* Defaults to Uniswap's unsupported token list.
|
|
59
|
+
* A token list that specifies tokens that should be blocked from routing through.
|
|
60
|
+
* Defaults to no blocklist so each deployment can own its chain-specific policy.
|
|
85
61
|
*/
|
|
86
62
|
blockedTokenListProvider?: ITokenListProvider;
|
|
87
63
|
/**
|
|
@@ -177,10 +153,6 @@ export declare type AlphaRouterConfig = {
|
|
|
177
153
|
* will be used.
|
|
178
154
|
*/
|
|
179
155
|
protocols?: Protocol[];
|
|
180
|
-
/**
|
|
181
|
-
* Config for selecting which pools to consider routing via on V2.
|
|
182
|
-
*/
|
|
183
|
-
v2PoolSelection: ProtocolPoolSelection;
|
|
184
156
|
/**
|
|
185
157
|
* Config for selecting which pools to consider routing via on V3.
|
|
186
158
|
*/
|
|
@@ -198,16 +170,6 @@ export declare type AlphaRouterConfig = {
|
|
|
198
170
|
* This parameters should always be set to 1. It is only included for testing purposes.
|
|
199
171
|
*/
|
|
200
172
|
minSplits: number;
|
|
201
|
-
/**
|
|
202
|
-
* Forces the returned swap to route across all protocols.
|
|
203
|
-
* This parameter should always be false. It is only included for testing purposes.
|
|
204
|
-
*/
|
|
205
|
-
forceCrossProtocol: boolean;
|
|
206
|
-
/**
|
|
207
|
-
* Force the alpha router to choose a mixed route swap.
|
|
208
|
-
* Default will be falsy. It is only included for testing purposes.
|
|
209
|
-
*/
|
|
210
|
-
forceMixedRoutes?: boolean;
|
|
211
173
|
/**
|
|
212
174
|
* The minimum percentage of the input token to use for each route in a split route.
|
|
213
175
|
* All routes will have a multiple of this value. For example is distribution percentage is 5,
|
|
@@ -218,6 +180,12 @@ export declare type AlphaRouterConfig = {
|
|
|
218
180
|
* 40% of input => Route 3
|
|
219
181
|
*/
|
|
220
182
|
distributionPercent: number;
|
|
183
|
+
/**
|
|
184
|
+
* Enables a low-latency first pass before the full route search. The fast pass
|
|
185
|
+
* quotes a smaller V3-only route universe and returns immediately when it finds
|
|
186
|
+
* a valid route. If it finds no route, the router falls back to the full search.
|
|
187
|
+
*/
|
|
188
|
+
enableFastQuote?: boolean;
|
|
221
189
|
};
|
|
222
190
|
export declare class AlphaRouter implements IRouter<AlphaRouterConfig>, ISwapToRatio<AlphaRouterConfig, SwapAndAddConfig> {
|
|
223
191
|
protected chainId: ChainId;
|
|
@@ -226,24 +194,17 @@ export declare class AlphaRouter implements IRouter<AlphaRouterConfig>, ISwapToR
|
|
|
226
194
|
protected v3SubgraphProvider: IV3SubgraphProvider;
|
|
227
195
|
protected v3PoolProvider: IV3PoolProvider;
|
|
228
196
|
protected onChainQuoteProvider: IOnChainQuoteProvider;
|
|
229
|
-
protected v2SubgraphProvider: IV2SubgraphProvider;
|
|
230
|
-
protected v2QuoteProvider: IV2QuoteProvider;
|
|
231
|
-
protected v2PoolProvider: IV2PoolProvider;
|
|
232
197
|
protected tokenProvider: ITokenProvider;
|
|
233
198
|
protected gasPriceProvider: IGasPriceProvider;
|
|
234
199
|
protected swapRouterProvider: ISwapRouterProvider;
|
|
235
200
|
protected v3GasModelFactory: IOnChainGasModelFactory;
|
|
236
|
-
protected v2GasModelFactory: IV2GasModelFactory;
|
|
237
|
-
protected mixedRouteGasModelFactory: IOnChainGasModelFactory;
|
|
238
201
|
protected tokenValidatorProvider?: ITokenValidatorProvider;
|
|
239
202
|
protected blockedTokenListProvider?: ITokenListProvider;
|
|
240
203
|
protected l2GasDataProvider?: IL2GasDataProvider<OptimismGasData> | IL2GasDataProvider<ArbitrumGasData>;
|
|
241
204
|
protected simulator?: Simulator;
|
|
242
|
-
protected v2Quoter: V2Quoter;
|
|
243
205
|
protected v3Quoter: V3Quoter;
|
|
244
|
-
protected mixedQuoter: MixedQuoter;
|
|
245
206
|
protected routeCachingProvider?: IRouteCachingProvider;
|
|
246
|
-
constructor({ chainId, provider, multicall2Provider, v3PoolProvider, onChainQuoteProvider,
|
|
207
|
+
constructor({ chainId, provider, multicall2Provider, v3PoolProvider, onChainQuoteProvider, tokenProvider, blockedTokenListProvider, v3SubgraphProvider, gasPriceProvider, v3GasModelFactory, swapRouterProvider, optimismGasDataProvider, tokenValidatorProvider, arbitrumGasDataProvider, simulator, routeCachingProvider, }: AlphaRouterParams);
|
|
247
208
|
routeToRatio(token0Balance: CurrencyAmount, token1Balance: CurrencyAmount, position: Position, swapAndAddConfig: SwapAndAddConfig, swapAndAddOptions?: SwapAndAddOptions, routingConfig?: Partial<AlphaRouterConfig>): Promise<SwapToRatioResponse>;
|
|
248
209
|
/**
|
|
249
210
|
* @inheritdoc IRouter
|
|
@@ -251,6 +212,8 @@ export declare class AlphaRouter implements IRouter<AlphaRouterConfig>, ISwapToR
|
|
|
251
212
|
route(amount: CurrencyAmount, quoteCurrency: Currency, tradeType: TradeType, swapConfig?: SwapOptions, partialRoutingConfig?: Partial<AlphaRouterConfig>): Promise<SwapRoute | null>;
|
|
252
213
|
private getSwapRouteFromCache;
|
|
253
214
|
private getSwapRouteFromChain;
|
|
215
|
+
private getFastSwapRouteFromChain;
|
|
216
|
+
private getFastRoutingConfig;
|
|
254
217
|
private tradeTypeStr;
|
|
255
218
|
private tokenPairSymbolTradeTypeChainId;
|
|
256
219
|
private determineCurrencyInOutFromTradeType;
|