@uniswap/router-sdk 2.7.3 → 2.9.0

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 (113) hide show
  1. package/dist/{approveAndCall.d.ts → cjs/src/approveAndCall.d.ts} +33 -33
  2. package/dist/cjs/src/approveAndCall.js +111 -0
  3. package/dist/cjs/src/approveAndCall.js.map +1 -0
  4. package/dist/{constants.d.ts → cjs/src/constants.d.ts} +13 -13
  5. package/dist/cjs/src/constants.js +22 -0
  6. package/dist/cjs/src/constants.js.map +1 -0
  7. package/dist/{entities → cjs/src/entities}/mixedRoute/route.d.ts +29 -29
  8. package/dist/cjs/src/entities/mixedRoute/route.js +119 -0
  9. package/dist/cjs/src/entities/mixedRoute/route.js.map +1 -0
  10. package/dist/{entities → cjs/src/entities}/mixedRoute/trade.d.ts +183 -183
  11. package/dist/cjs/src/entities/mixedRoute/trade.js +354 -0
  12. package/dist/cjs/src/entities/mixedRoute/trade.js.map +1 -0
  13. package/dist/{entities → cjs/src/entities}/protocol.d.ts +6 -6
  14. package/dist/cjs/src/entities/protocol.js +11 -0
  15. package/dist/cjs/src/entities/protocol.js.map +1 -0
  16. package/dist/{entities → cjs/src/entities}/route.d.ts +40 -40
  17. package/dist/cjs/src/entities/route.js +63 -0
  18. package/dist/cjs/src/entities/route.js.map +1 -0
  19. package/dist/{entities → cjs/src/entities}/trade.d.ts +136 -127
  20. package/dist/cjs/src/entities/trade.js +370 -0
  21. package/dist/cjs/src/entities/trade.js.map +1 -0
  22. package/dist/{index.d.ts → cjs/src/index.d.ts} +14 -14
  23. package/dist/cjs/src/index.js +18 -0
  24. package/dist/cjs/src/index.js.map +1 -0
  25. package/dist/{multicallExtended.d.ts → cjs/src/multicallExtended.d.ts} +11 -11
  26. package/dist/cjs/src/multicallExtended.js +44 -0
  27. package/dist/cjs/src/multicallExtended.js.map +1 -0
  28. package/dist/{paymentsExtended.d.ts → cjs/src/paymentsExtended.d.ts} +15 -15
  29. package/dist/cjs/src/paymentsExtended.js +66 -0
  30. package/dist/cjs/src/paymentsExtended.js.map +1 -0
  31. package/dist/{swapRouter.d.ts → cjs/src/swapRouter.d.ts} +95 -95
  32. package/dist/cjs/src/swapRouter.js +439 -0
  33. package/dist/cjs/src/swapRouter.js.map +1 -0
  34. package/dist/{utils → cjs/src/utils}/TPool.d.ts +4 -4
  35. package/dist/cjs/src/utils/TPool.js +3 -0
  36. package/dist/cjs/src/utils/TPool.js.map +1 -0
  37. package/dist/{utils → cjs/src/utils}/encodeMixedRouteToPath.d.ts +10 -10
  38. package/dist/cjs/src/utils/encodeMixedRouteToPath.js +91 -0
  39. package/dist/cjs/src/utils/encodeMixedRouteToPath.js.map +1 -0
  40. package/dist/{utils → cjs/src/utils}/index.d.ts +16 -16
  41. package/dist/cjs/src/utils/index.js +51 -0
  42. package/dist/cjs/src/utils/index.js.map +1 -0
  43. package/dist/{utils → cjs/src/utils}/pathCurrency.d.ts +4 -4
  44. package/dist/cjs/src/utils/pathCurrency.js +35 -0
  45. package/dist/cjs/src/utils/pathCurrency.js.map +1 -0
  46. package/dist/esm/src/approveAndCall.d.ts +33 -0
  47. package/dist/esm/src/approveAndCall.js +105 -0
  48. package/dist/esm/src/approveAndCall.js.map +1 -0
  49. package/dist/esm/src/constants.d.ts +13 -0
  50. package/dist/esm/src/constants.js +18 -0
  51. package/dist/esm/src/constants.js.map +1 -0
  52. package/dist/esm/src/entities/mixedRoute/route.d.ts +29 -0
  53. package/dist/esm/src/entities/mixedRoute/route.js +114 -0
  54. package/dist/esm/src/entities/mixedRoute/route.js.map +1 -0
  55. package/dist/esm/src/entities/mixedRoute/trade.d.ts +183 -0
  56. package/dist/esm/src/entities/mixedRoute/trade.js +348 -0
  57. package/dist/esm/src/entities/mixedRoute/trade.js.map +1 -0
  58. package/dist/esm/src/entities/protocol.d.ts +6 -0
  59. package/dist/esm/src/entities/protocol.js +8 -0
  60. package/dist/esm/src/entities/protocol.js.map +1 -0
  61. package/dist/esm/src/entities/route.d.ts +40 -0
  62. package/dist/esm/src/entities/route.js +55 -0
  63. package/dist/esm/src/entities/route.js.map +1 -0
  64. package/dist/esm/src/entities/trade.d.ts +136 -0
  65. package/dist/esm/src/entities/trade.js +365 -0
  66. package/dist/esm/src/entities/trade.js.map +1 -0
  67. package/dist/esm/src/index.d.ts +14 -0
  68. package/dist/esm/src/index.js +15 -0
  69. package/dist/esm/src/index.js.map +1 -0
  70. package/dist/esm/src/multicallExtended.d.ts +11 -0
  71. package/dist/esm/src/multicallExtended.js +39 -0
  72. package/dist/esm/src/multicallExtended.js.map +1 -0
  73. package/dist/esm/src/paymentsExtended.d.ts +15 -0
  74. package/dist/esm/src/paymentsExtended.js +61 -0
  75. package/dist/esm/src/paymentsExtended.js.map +1 -0
  76. package/dist/esm/src/swapRouter.d.ts +95 -0
  77. package/dist/esm/src/swapRouter.js +434 -0
  78. package/dist/esm/src/swapRouter.js.map +1 -0
  79. package/dist/esm/src/utils/TPool.d.ts +4 -0
  80. package/dist/esm/src/utils/TPool.js +2 -0
  81. package/dist/esm/src/utils/TPool.js.map +1 -0
  82. package/dist/esm/src/utils/encodeMixedRouteToPath.d.ts +10 -0
  83. package/dist/esm/src/utils/encodeMixedRouteToPath.js +87 -0
  84. package/dist/esm/src/utils/encodeMixedRouteToPath.js.map +1 -0
  85. package/dist/esm/src/utils/index.d.ts +16 -0
  86. package/dist/esm/src/utils/index.js +46 -0
  87. package/dist/esm/src/utils/index.js.map +1 -0
  88. package/dist/esm/src/utils/pathCurrency.d.ts +4 -0
  89. package/dist/esm/src/utils/pathCurrency.js +30 -0
  90. package/dist/esm/src/utils/pathCurrency.js.map +1 -0
  91. package/dist/types/src/approveAndCall.d.ts +33 -0
  92. package/dist/types/src/constants.d.ts +13 -0
  93. package/dist/types/src/entities/mixedRoute/route.d.ts +29 -0
  94. package/dist/types/src/entities/mixedRoute/trade.d.ts +183 -0
  95. package/dist/types/src/entities/protocol.d.ts +6 -0
  96. package/dist/types/src/entities/route.d.ts +40 -0
  97. package/dist/types/src/entities/trade.d.ts +136 -0
  98. package/dist/types/src/index.d.ts +14 -0
  99. package/dist/types/src/multicallExtended.d.ts +11 -0
  100. package/dist/types/src/paymentsExtended.d.ts +15 -0
  101. package/dist/types/src/swapRouter.d.ts +95 -0
  102. package/dist/types/src/utils/TPool.d.ts +4 -0
  103. package/dist/types/src/utils/encodeMixedRouteToPath.d.ts +10 -0
  104. package/dist/types/src/utils/index.d.ts +16 -0
  105. package/dist/types/src/utils/pathCurrency.d.ts +4 -0
  106. package/package.json +31 -12
  107. package/dist/index.js +0 -8
  108. package/dist/router-sdk.cjs.development.js +0 -2250
  109. package/dist/router-sdk.cjs.development.js.map +0 -1
  110. package/dist/router-sdk.cjs.production.min.js +0 -2
  111. package/dist/router-sdk.cjs.production.min.js.map +0 -1
  112. package/dist/router-sdk.esm.js +0 -2217
  113. package/dist/router-sdk.esm.js.map +0 -1
@@ -0,0 +1,136 @@
1
+ import { Currency, CurrencyAmount, Percent, Price, TradeType } from '@uniswap/sdk-core';
2
+ import { Pair, Route as V2RouteSDK } from '@uniswap/v2-sdk';
3
+ import { Pool as V3Pool, Route as V3RouteSDK } from '@uniswap/v3-sdk';
4
+ import { Pool as V4Pool, Route as V4RouteSDK } from '@uniswap/v4-sdk';
5
+ import { MixedRouteSDK } from './mixedRoute/route';
6
+ import { IRoute } from './route';
7
+ export declare class Trade<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType> {
8
+ readonly routes: IRoute<TInput, TOutput, Pair | V3Pool | V4Pool>[];
9
+ readonly tradeType: TTradeType;
10
+ private _outputAmount;
11
+ private _inputAmount;
12
+ private _nativeInputRoutes;
13
+ private _wethInputRoutes;
14
+ /**
15
+ * The swaps of the trade, i.e. which routes and how much is swapped in each that
16
+ * make up the trade. May consist of swaps in v2 or v3.
17
+ */
18
+ readonly swaps: {
19
+ route: IRoute<TInput, TOutput, Pair | V3Pool | V4Pool>;
20
+ inputAmount: CurrencyAmount<TInput>;
21
+ outputAmount: CurrencyAmount<TOutput>;
22
+ maxHopSlippage?: bigint[];
23
+ }[];
24
+ constructor({ v2Routes, v3Routes, v4Routes, mixedRoutes, tradeType, }: {
25
+ v2Routes?: {
26
+ routev2: V2RouteSDK<TInput, TOutput>;
27
+ inputAmount: CurrencyAmount<TInput>;
28
+ outputAmount: CurrencyAmount<TOutput>;
29
+ maxHopSlippage?: bigint[];
30
+ }[];
31
+ v3Routes?: {
32
+ routev3: V3RouteSDK<TInput, TOutput>;
33
+ inputAmount: CurrencyAmount<TInput>;
34
+ outputAmount: CurrencyAmount<TOutput>;
35
+ maxHopSlippage?: bigint[];
36
+ }[];
37
+ v4Routes?: {
38
+ routev4: V4RouteSDK<TInput, TOutput>;
39
+ inputAmount: CurrencyAmount<TInput>;
40
+ outputAmount: CurrencyAmount<TOutput>;
41
+ maxHopSlippage?: bigint[];
42
+ }[];
43
+ mixedRoutes?: {
44
+ mixedRoute: MixedRouteSDK<TInput, TOutput>;
45
+ inputAmount: CurrencyAmount<TInput>;
46
+ outputAmount: CurrencyAmount<TOutput>;
47
+ maxHopSlippage?: bigint[];
48
+ }[];
49
+ tradeType: TTradeType;
50
+ });
51
+ get inputAmount(): CurrencyAmount<TInput>;
52
+ get outputAmount(): CurrencyAmount<TOutput>;
53
+ /**
54
+ * Returns the sum of all swaps within the trade
55
+ * @returns
56
+ * inputAmount: total input amount
57
+ * inputAmountNative: total amount of native currency required for ETH input paths
58
+ * - 0 if inputAmount is native but no native input paths
59
+ * - undefined if inputAmount is not native
60
+ * outputAmount: total output amount
61
+ * outputAmountNative: total amount of native currency returned from ETH output paths
62
+ * - 0 if outputAmount is native but no native output paths
63
+ * - undefined if outputAmount is not native
64
+ */
65
+ get amounts(): {
66
+ inputAmount: CurrencyAmount<TInput>;
67
+ inputAmountNative: CurrencyAmount<TInput> | undefined;
68
+ outputAmount: CurrencyAmount<TOutput>;
69
+ outputAmountNative: CurrencyAmount<TOutput> | undefined;
70
+ };
71
+ get numberOfInputWraps(): number;
72
+ get numberOfInputUnwraps(): number;
73
+ get nativeInputRoutes(): IRoute<TInput, TOutput, Pair | V3Pool | V4Pool>[];
74
+ get wethInputRoutes(): IRoute<TInput, TOutput, Pair | V3Pool | V4Pool>[];
75
+ private _executionPrice;
76
+ /**
77
+ * The price expressed in terms of output amount/input amount.
78
+ */
79
+ get executionPrice(): Price<TInput, TOutput>;
80
+ /**
81
+ * Returns the sell tax of the input token
82
+ */
83
+ get inputTax(): Percent;
84
+ /**
85
+ * Returns the buy tax of the output token
86
+ */
87
+ get outputTax(): Percent;
88
+ private isWrappedNative;
89
+ /**
90
+ * The cached result of the price impact computation
91
+ * @private
92
+ */
93
+ private _priceImpact;
94
+ /**
95
+ * Returns the percent difference between the route's mid price and the expected execution price
96
+ * In order to exclude token taxes from the price impact calculation, the spot price is calculated
97
+ * using a ratio of values that go into the pools, which are the post-tax input amount and pre-tax output amount.
98
+ */
99
+ get priceImpact(): Percent;
100
+ /**
101
+ * Get the minimum amount that must be received from this trade for the given slippage tolerance
102
+ * @param slippageTolerance The tolerance of unfavorable slippage from the execution price of this trade
103
+ * @returns The amount out
104
+ */
105
+ minimumAmountOut(slippageTolerance: Percent, amountOut?: CurrencyAmount<TOutput>): CurrencyAmount<TOutput>;
106
+ /**
107
+ * Get the maximum amount in that can be spent via this trade for the given slippage tolerance
108
+ * @param slippageTolerance The tolerance of unfavorable slippage from the execution price of this trade
109
+ * @returns The amount in
110
+ */
111
+ maximumAmountIn(slippageTolerance: Percent, amountIn?: CurrencyAmount<TInput>): CurrencyAmount<TInput>;
112
+ /**
113
+ * Return the execution price after accounting for slippage tolerance
114
+ * @param slippageTolerance the allowed tolerated slippage
115
+ * @returns The execution price
116
+ */
117
+ worstExecutionPrice(slippageTolerance: Percent): Price<TInput, TOutput>;
118
+ static fromRoutes<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType>(v2Routes: {
119
+ routev2: V2RouteSDK<TInput, TOutput>;
120
+ amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>;
121
+ maxHopSlippage?: bigint[];
122
+ }[], v3Routes: {
123
+ routev3: V3RouteSDK<TInput, TOutput>;
124
+ amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>;
125
+ maxHopSlippage?: bigint[];
126
+ }[], tradeType: TTradeType, mixedRoutes?: {
127
+ mixedRoute: MixedRouteSDK<TInput, TOutput>;
128
+ amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>;
129
+ maxHopSlippage?: bigint[];
130
+ }[], v4Routes?: {
131
+ routev4: V4RouteSDK<TInput, TOutput>;
132
+ amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>;
133
+ maxHopSlippage?: bigint[];
134
+ }[]): Promise<Trade<TInput, TOutput, TTradeType>>;
135
+ static fromRoute<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType>(route: V2RouteSDK<TInput, TOutput> | V3RouteSDK<TInput, TOutput> | V4RouteSDK<TInput, TOutput> | MixedRouteSDK<TInput, TOutput>, amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>, tradeType: TTradeType): Promise<Trade<TInput, TOutput, TTradeType>>;
136
+ }
@@ -0,0 +1,14 @@
1
+ export * from './constants';
2
+ export * from './approveAndCall';
3
+ export * from './multicallExtended';
4
+ export * from './paymentsExtended';
5
+ export * from './swapRouter';
6
+ export * from './entities/trade';
7
+ export * from './entities/protocol';
8
+ export * from './entities/route';
9
+ export * from './entities/mixedRoute/route';
10
+ export * from './entities/mixedRoute/trade';
11
+ export * from './utils/encodeMixedRouteToPath';
12
+ export * from './utils/TPool';
13
+ export * from './utils/pathCurrency';
14
+ export * from './utils';
@@ -0,0 +1,11 @@
1
+ import { Interface } from '@ethersproject/abi';
2
+ import { BigintIsh } from '@uniswap/sdk-core';
3
+ export type Validation = BigintIsh | string;
4
+ export declare abstract class MulticallExtended {
5
+ static INTERFACE: Interface;
6
+ /**
7
+ * Cannot be constructed.
8
+ */
9
+ private constructor();
10
+ static encodeMulticall(calldatas: string | string[], validation?: Validation): string;
11
+ }
@@ -0,0 +1,15 @@
1
+ import { Interface } from '@ethersproject/abi';
2
+ import { Token } from '@uniswap/sdk-core';
3
+ import { FeeOptions } from '@uniswap/v3-sdk';
4
+ import JSBI from 'jsbi';
5
+ export declare abstract class PaymentsExtended {
6
+ static INTERFACE: Interface;
7
+ /**
8
+ * Cannot be constructed.
9
+ */
10
+ private constructor();
11
+ static encodeUnwrapWETH9(amountMinimum: JSBI, recipient?: string, feeOptions?: FeeOptions): string;
12
+ static encodeSweepToken(token: Token, amountMinimum: JSBI, recipient?: string, feeOptions?: FeeOptions): string;
13
+ static encodePull(token: Token, amount: JSBI): string;
14
+ static encodeWrapETH(amount: JSBI): string;
15
+ }
@@ -0,0 +1,95 @@
1
+ import { Interface } from '@ethersproject/abi';
2
+ import { Currency, Percent, TradeType } from '@uniswap/sdk-core';
3
+ import { Trade as V2Trade } from '@uniswap/v2-sdk';
4
+ import { FeeOptions, MethodParameters, PermitOptions, Position, Trade as V3Trade } from '@uniswap/v3-sdk';
5
+ import { ApprovalTypes, CondensedAddLiquidityOptions } from './approveAndCall';
6
+ import { Trade } from './entities/trade';
7
+ import { Validation } from './multicallExtended';
8
+ import { MixedRouteTrade } from './entities/mixedRoute/trade';
9
+ /**
10
+ * Options for producing the arguments to send calls to the router.
11
+ */
12
+ export interface SwapOptions {
13
+ /**
14
+ * How much the execution price is allowed to move unfavorably from the trade execution price.
15
+ */
16
+ slippageTolerance: Percent;
17
+ /**
18
+ * The account that should receive the output. If omitted, output is sent to msg.sender.
19
+ */
20
+ recipient?: string;
21
+ /**
22
+ * Either deadline (when the transaction expires, in epoch seconds), or previousBlockhash.
23
+ */
24
+ deadlineOrPreviousBlockhash?: Validation;
25
+ /**
26
+ * The optional permit parameters for spending the input.
27
+ */
28
+ inputTokenPermit?: PermitOptions;
29
+ /**
30
+ * Optional information for taking a fee on output.
31
+ */
32
+ fee?: FeeOptions;
33
+ }
34
+ export interface SwapAndAddOptions extends SwapOptions {
35
+ /**
36
+ * The optional permit parameters for pulling in remaining output token.
37
+ */
38
+ outputTokenPermit?: PermitOptions;
39
+ }
40
+ type AnyTradeType = Trade<Currency, Currency, TradeType> | V2Trade<Currency, Currency, TradeType> | V3Trade<Currency, Currency, TradeType> | MixedRouteTrade<Currency, Currency, TradeType> | (V2Trade<Currency, Currency, TradeType> | V3Trade<Currency, Currency, TradeType> | MixedRouteTrade<Currency, Currency, TradeType>)[];
41
+ /**
42
+ * Represents the Uniswap V2 + V3 SwapRouter02, and has static methods for helping execute trades.
43
+ */
44
+ export declare abstract class SwapRouter {
45
+ static INTERFACE: Interface;
46
+ /**
47
+ * Cannot be constructed.
48
+ */
49
+ private constructor();
50
+ /**
51
+ * @notice Generates the calldata for a Swap with a V2 Route.
52
+ * @param trade The V2Trade to encode.
53
+ * @param options SwapOptions to use for the trade.
54
+ * @param routerMustCustody Flag for whether funds should be sent to the router
55
+ * @param performAggregatedSlippageCheck Flag for whether we want to perform an aggregated slippage check
56
+ * @returns A string array of calldatas for the trade.
57
+ */
58
+ private static encodeV2Swap;
59
+ /**
60
+ * @notice Generates the calldata for a Swap with a V3 Route.
61
+ * @param trade The V3Trade to encode.
62
+ * @param options SwapOptions to use for the trade.
63
+ * @param routerMustCustody Flag for whether funds should be sent to the router
64
+ * @param performAggregatedSlippageCheck Flag for whether we want to perform an aggregated slippage check
65
+ * @returns A string array of calldatas for the trade.
66
+ */
67
+ private static encodeV3Swap;
68
+ /**
69
+ * @notice Generates the calldata for a MixedRouteSwap. Since single hop routes are not MixedRoutes, we will instead generate
70
+ * them via the existing encodeV3Swap and encodeV2Swap methods.
71
+ * @param trade The MixedRouteTrade to encode.
72
+ * @param options SwapOptions to use for the trade.
73
+ * @param routerMustCustody Flag for whether funds should be sent to the router
74
+ * @param performAggregatedSlippageCheck Flag for whether we want to perform an aggregated slippage check
75
+ * @returns A string array of calldatas for the trade.
76
+ */
77
+ private static encodeMixedRouteSwap;
78
+ private static encodeSwaps;
79
+ /**
80
+ * Produces the on-chain method name to call and the hex encoded parameters to pass as arguments for a given trade.
81
+ * @param trades to produce call parameters for
82
+ * @param options options for the call parameters
83
+ */
84
+ static swapCallParameters(trades: Trade<Currency, Currency, TradeType> | V2Trade<Currency, Currency, TradeType> | V3Trade<Currency, Currency, TradeType> | MixedRouteTrade<Currency, Currency, TradeType> | (V2Trade<Currency, Currency, TradeType> | V3Trade<Currency, Currency, TradeType> | MixedRouteTrade<Currency, Currency, TradeType>)[], options: SwapOptions): MethodParameters;
85
+ /**
86
+ * Produces the on-chain method name to call and the hex encoded parameters to pass as arguments for a given trade.
87
+ * @param trades to produce call parameters for
88
+ * @param options options for the call parameters
89
+ */
90
+ static swapAndAddCallParameters(trades: AnyTradeType, options: SwapAndAddOptions, position: Position, addLiquidityOptions: CondensedAddLiquidityOptions, tokenInApprovalType: ApprovalTypes, tokenOutApprovalType: ApprovalTypes): MethodParameters;
91
+ private static riskOfPartialFill;
92
+ private static v3TradeWithHighPriceImpact;
93
+ private static getPositionAmounts;
94
+ }
95
+ export {};
@@ -0,0 +1,4 @@
1
+ import { Pool as V4Pool } from '@uniswap/v4-sdk';
2
+ import { Pair } from '@uniswap/v2-sdk';
3
+ import { Pool as V3Pool } from '@uniswap/v3-sdk';
4
+ export type TPool = Pair | V3Pool | V4Pool;
@@ -0,0 +1,10 @@
1
+ import { Currency } from '@uniswap/sdk-core';
2
+ import { MixedRouteSDK } from '../entities/mixedRoute/route';
3
+ /**
4
+ * Converts a route to a hex encoded path
5
+ * @notice only supports exactIn route encodings
6
+ * @param route the mixed path to convert to an encoded path
7
+ * @param useMixedRouterQuoteV2 if true, uses the Mixed Quoter V2 encoding for v4 pools. By default, we do not set it. This is only used in SOR for explicit setting during onchain quoting.
8
+ * @returns the exactIn encoded path
9
+ */
10
+ export declare function encodeMixedRouteToPath(route: MixedRouteSDK<Currency, Currency>, useMixedRouterQuoteV2?: boolean): string;
@@ -0,0 +1,16 @@
1
+ import { Currency } from '@uniswap/sdk-core';
2
+ import { MixedRouteSDK } from '../entities/mixedRoute/route';
3
+ import { TPool } from './TPool';
4
+ /**
5
+ * Utility function to return each consecutive section of Pools or Pairs in a MixedRoute
6
+ * @param route
7
+ * @returns a nested array of Pools or Pairs in the order of the route
8
+ */
9
+ export declare const partitionMixedRouteByProtocol: (route: MixedRouteSDK<Currency, Currency>) => TPool[][];
10
+ /**
11
+ * Simple utility function to get the output of an array of Pools or Pairs
12
+ * @param pools
13
+ * @param firstInputToken
14
+ * @returns the output token of the last pool in the array
15
+ */
16
+ export declare const getOutputOfPools: (pools: TPool[], firstInputToken: Currency) => Currency;
@@ -0,0 +1,4 @@
1
+ import { Currency, CurrencyAmount } from '@uniswap/sdk-core';
2
+ import { TPool } from './TPool';
3
+ export declare function amountWithPathCurrency(amount: CurrencyAmount<Currency>, pool: TPool): CurrencyAmount<Currency>;
4
+ export declare function getPathCurrency(currency: Currency, pool: TPool): Currency;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniswap/router-sdk",
3
- "version": "2.7.3",
3
+ "version": "2.9.0",
4
4
  "description": "An sdk for routing swaps using Uniswap v2 and Uniswap v3.",
5
5
  "repository": "https://github.com/Uniswap/sdks.git",
6
6
  "keywords": [
@@ -8,32 +8,51 @@
8
8
  "ethereum"
9
9
  ],
10
10
  "license": "MIT",
11
- "main": "dist/index.js",
12
- "typings": "dist/index.d.ts",
11
+ "main": "./dist/cjs/src/index.js",
12
+ "typings": "./dist/types/src/index.d.ts",
13
+ "module": "./dist/esm/src/index.js",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/types/src/index.d.ts",
17
+ "import": "./dist/esm/src/index.js",
18
+ "require": "./dist/cjs/src/index.js"
19
+ }
20
+ },
21
+ "sideEffects": false,
13
22
  "files": [
14
23
  "dist"
15
24
  ],
25
+ "engines": {
26
+ "node": ">=18"
27
+ },
16
28
  "scripts": {
17
- "build": "tsdx build",
29
+ "build": "bun run clean && tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json && tsc -p tsconfig.types.json",
30
+ "clean": "rm -rf dist",
18
31
  "lint": "eslint 'src/**/*.{js,ts,tsx}' --max-warnings 0",
19
32
  "release": "changeset publish",
20
- "start": "tsdx watch",
21
- "test": "tsdx test"
33
+ "test": "bun test"
22
34
  },
23
35
  "dependencies": {
24
36
  "@ethersproject/abi": "^5.5.0",
25
- "@uniswap/sdk-core": "workspace:*",
37
+ "@ethersproject/solidity": "^5.0.9",
38
+ "@uniswap/sdk-core": "^7.13.0",
26
39
  "@uniswap/swap-router-contracts": "^1.3.0",
27
- "@uniswap/v2-sdk": "workspace:*",
28
- "@uniswap/v3-sdk": "workspace:*",
29
- "@uniswap/v4-sdk": "workspace:*"
40
+ "@uniswap/v2-sdk": "^4.20.0",
41
+ "@uniswap/v3-sdk": "^3.30.0",
42
+ "@uniswap/v4-sdk": "^2.0.0",
43
+ "jsbi": "^3.1.4",
44
+ "tiny-invariant": "^1.1.0",
45
+ "tslib": "^2.3.0"
30
46
  },
31
47
  "devDependencies": {
32
- "@types/jest": "^24.0.25",
48
+ "@ethersproject/bignumber": "^5.5.0",
49
+ "@typescript-eslint/parser": "^5.0.0",
50
+ "eslint": "^8.57.0",
33
51
  "eslint-config-prettier": "^9.1.0",
52
+ "eslint-config-react-app": "7.0.1",
34
53
  "eslint-plugin-prettier": "^3.4.1",
35
54
  "prettier": "^2.4.1",
36
- "tsdx": "^0.14.1"
55
+ "typescript": "^4.3.3"
37
56
  },
38
57
  "prettier": {
39
58
  "printWidth": 120,
package/dist/index.js DELETED
@@ -1,8 +0,0 @@
1
-
2
- 'use strict'
3
-
4
- if (process.env.NODE_ENV === 'production') {
5
- module.exports = require('./router-sdk.cjs.production.min.js')
6
- } else {
7
- module.exports = require('./router-sdk.cjs.development.js')
8
- }