@uniswap/universal-router-sdk 1.3.0 → 1.3.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/README.md +60 -3
- package/dist/entities/Command.d.ts +6 -0
- package/dist/entities/NFTTrade.d.ts +4 -3
- package/dist/entities/index.d.ts +1 -0
- package/dist/entities/protocols/UnwrapWETH.d.ts +13 -0
- package/dist/entities/protocols/cryptopunk.d.ts +2 -2
- package/dist/entities/protocols/foundation.d.ts +2 -2
- package/dist/entities/protocols/looksRare.d.ts +2 -2
- package/dist/entities/protocols/nft20.d.ts +2 -2
- package/dist/entities/protocols/nftx.d.ts +1 -1
- package/dist/entities/protocols/sudoswap.d.ts +2 -2
- package/dist/entities/protocols/uniswap.d.ts +2 -1
- package/dist/entities/protocols/x2y2.d.ts +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/swapRouter.d.ts +7 -1
- package/dist/test/forge/writeInterop.d.ts +1 -0
- package/dist/test/orders/looksRare.d.ts +12 -0
- package/dist/test/orders/seaport.d.ts +4 -0
- package/dist/test/orders/x2y2.d.ts +6 -0
- package/dist/test/utils/addresses.d.ts +2 -0
- package/dist/test/utils/hexToDecimalString.d.ts +2 -0
- package/dist/test/utils/permit2.d.ts +6 -0
- package/dist/test/utils/uniswapData.d.ts +24 -0
- package/dist/universal-router-sdk.cjs.development.js +133 -18
- package/dist/universal-router-sdk.cjs.development.js.map +1 -1
- package/dist/universal-router-sdk.cjs.production.min.js +1 -1
- package/dist/universal-router-sdk.cjs.production.min.js.map +1 -1
- package/dist/universal-router-sdk.esm.js +133 -19
- package/dist/universal-router-sdk.esm.js.map +1 -1
- package/dist/utils/constants.d.ts +3 -2
- package/package.json +5 -6
package/README.md
CHANGED
|
@@ -5,6 +5,7 @@ This SDK facilitates interactions with the contracts in [Universal Router](https
|
|
|
5
5
|
Install latest version of universal-router-sdk. Then import the corresponding Trade class and Data object for each protocol you'd like to interact with.
|
|
6
6
|
|
|
7
7
|
### Trading NFTs
|
|
8
|
+
warning: `swapNFTCallParameters()` to be deprecated in favor of `swapCallParameters()`
|
|
8
9
|
```typescript
|
|
9
10
|
import {
|
|
10
11
|
LooksRareTrade,
|
|
@@ -20,10 +21,11 @@ const seaportTrades = new SeaportTrade([seaportData1])
|
|
|
20
21
|
|
|
21
22
|
// Use the raw calldata and value returned to call into Universal Swap Router contracts
|
|
22
23
|
// Trades will happen in the order that they are handed in
|
|
23
|
-
const { calldata, value } = SwapRouter.
|
|
24
|
+
const { calldata, value } = SwapRouter.swapCallParameters([looksRareTrades, seaportTrades])
|
|
24
25
|
```
|
|
25
26
|
|
|
26
27
|
### Trading ERC20s on Uniswap
|
|
28
|
+
warning: `swapERC20CallParameters()` to be deprecated in favor of `swapCallParameters()`
|
|
27
29
|
```typescript
|
|
28
30
|
import { TradeType } from '@uniswap/sdk-core'
|
|
29
31
|
import { Trade as V2TradeSDK } from '@uniswap/v2-sdk'
|
|
@@ -31,11 +33,66 @@ import { Trade as V3TradeSDK } from '@uniswap/v3-sdk'
|
|
|
31
33
|
import { MixedRouteTrade, MixedRouteSDK, Trade as RouterTrade } from '@uniswap/router-sdk'
|
|
32
34
|
|
|
33
35
|
const options = { slippageTolerance, recipient }
|
|
34
|
-
const routerTrade = new
|
|
36
|
+
const routerTrade = new UniswapTrade(
|
|
37
|
+
new RouterTrade({ v2Routes, v3Routes, mixedRoutes, tradeType: TradeType.EXACT_INPUT },
|
|
38
|
+
options
|
|
39
|
+
)
|
|
35
40
|
// Use the raw calldata and value returned to call into Universal Swap Router contracts
|
|
36
|
-
const { calldata, value } = SwapRouter.
|
|
41
|
+
const { calldata, value } = SwapRouter.swapCallParameters(routerTrade)
|
|
37
42
|
```
|
|
38
43
|
|
|
44
|
+
### Using Uniswap for ERC20 NFT Trades
|
|
45
|
+
Send ETH to the router by trading an ERC20 for ETH with a Uniswap Trade and encoding the swap recipient as `ROUTER_AS_RECIPIENT` in the trade. Then subsequently list the NFT trades to use the ETH output to buy NFTs. Trades happen in the order they are listed.
|
|
46
|
+
|
|
47
|
+
Use `trade_type: TradeType.EXACT_OUTPUT` to cover the entire NFT price, alternatively the transaction will send supplemental ETH to fulfill the entire price if the swap does not cover it in full. Keep in mind that `TradeType.EXACT_INPUT` trades are subject to slippage on output, and ETH will be sent to cover potential slippage and any remaining ETH will be returned to sender.
|
|
48
|
+
```typescript
|
|
49
|
+
import { TradeType } from '@uniswap/sdk-core'
|
|
50
|
+
import { Trade as V2TradeSDK } from '@uniswap/v2-sdk'
|
|
51
|
+
import { Trade as V3TradeSDK } from '@uniswap/v3-sdk'
|
|
52
|
+
import { MixedRouteTrade, MixedRouteSDK, Trade as RouterTrade } from '@uniswap/router-sdk'
|
|
53
|
+
import {
|
|
54
|
+
ROUTER_AS_RECIPIENT,
|
|
55
|
+
UniswapTrade,
|
|
56
|
+
LooksRareTrade,
|
|
57
|
+
LooksRareData,
|
|
58
|
+
SeaportTrade,
|
|
59
|
+
SeaportData
|
|
60
|
+
} from "@uniswap/universal-router-sdk";
|
|
61
|
+
|
|
62
|
+
const looksRareTrades = new LooksRareTrade([looksrareData1, looksrareData2])
|
|
63
|
+
const seaportTrades = new SeaportTrade([seaportData1])
|
|
64
|
+
// WARNING: never send funds to ROUTER_AS_RECIPIENT unless it is ETH that will be used in NFT trades, otherwise funds are lost.
|
|
65
|
+
const uniswapTrade = new UniswapTrade(
|
|
66
|
+
new RouterTrade({ v2Routes, v3Routes, mixedRoutes, tradeType: TradeType.EXACT_OUTPUT }),
|
|
67
|
+
{ slippageTolerance, recipient: ROUTER_AS_RECIPIENT}
|
|
68
|
+
)
|
|
69
|
+
// Use the raw calldata and value returned to call into Universal Swap Router contracts
|
|
70
|
+
const { calldata, value } = SwapRouter.swapCallParameters([uniswapTrade, seaportTrades, looksRareTrades])
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Using WETH for NFT Trades
|
|
74
|
+
The current router purchases all NFTs with ETH, but you can send WETH to the router to be unwrapped for ETH right before the NFT commands. Similar to ERC20 Uniswap Trades for NFTs, supplemental ETH will be sent in the transaction if the WETH amount will not cover the NFT buys. You can also use ERC20s and WETH to cover the transaction by including both commands before the NFT purchase.
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
import {
|
|
78
|
+
ROUTER_AS_RECIPIENT,
|
|
79
|
+
UniswapTrade,
|
|
80
|
+
LooksRareTrade,
|
|
81
|
+
LooksRareData,
|
|
82
|
+
SeaportTrade,
|
|
83
|
+
SeaportData
|
|
84
|
+
} from "@uniswap/universal-router-sdk";
|
|
85
|
+
|
|
86
|
+
const looksRareTrades = new LooksRareTrade([looksrareData1, looksrareData2])
|
|
87
|
+
const seaportTrades = new SeaportTrade([seaportData1])
|
|
88
|
+
// if no Permit needed, omit the third var of type Permit2Permit
|
|
89
|
+
const unwrapWETH = new UnwrapWETH(amountWETH, chainId, optionalPermit2Params)
|
|
90
|
+
|
|
91
|
+
// Use the raw calldata and value returned to call into Universal Swap Router contracts
|
|
92
|
+
const { calldata, value } = SwapRouter.swapCallParameters([unwrapWETH, seaportTrades, looksRareTrades])
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
|
|
39
96
|
## Running this package
|
|
40
97
|
Make sure you are running `node v16`
|
|
41
98
|
Install dependencies and run typescript unit tests
|
|
@@ -2,6 +2,12 @@ import { RoutePlanner } from '../utils/routerCommands';
|
|
|
2
2
|
export declare type TradeConfig = {
|
|
3
3
|
allowRevert: boolean;
|
|
4
4
|
};
|
|
5
|
+
export declare enum RouterTradeType {
|
|
6
|
+
UniswapTrade = "UniswapTrade",
|
|
7
|
+
NFTTrade = "NFTTrade",
|
|
8
|
+
UnwrapWETH = "UnwrapWETH"
|
|
9
|
+
}
|
|
5
10
|
export interface Command {
|
|
11
|
+
tradeType: RouterTradeType;
|
|
6
12
|
encode(planner: RoutePlanner, config: TradeConfig): void;
|
|
7
13
|
}
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { BigNumberish } from 'ethers';
|
|
1
|
+
import { BigNumber, BigNumberish } from 'ethers';
|
|
2
2
|
import { SeaportData } from './protocols/seaport';
|
|
3
3
|
import { FoundationData } from './protocols/foundation';
|
|
4
4
|
import { NFTXData } from './protocols/nftx';
|
|
5
5
|
import { NFT20Data } from './protocols/nft20';
|
|
6
6
|
import { RoutePlanner } from '../utils/routerCommands';
|
|
7
|
-
import { Command, TradeConfig } from './Command';
|
|
7
|
+
import { Command, RouterTradeType, TradeConfig } from './Command';
|
|
8
8
|
import { LooksRareData } from './protocols/looksRare';
|
|
9
9
|
import { SudoswapData } from './protocols/sudoswap';
|
|
10
10
|
import { CryptopunkData } from './protocols/cryptopunk';
|
|
11
11
|
import { X2Y2Data } from './protocols/x2y2';
|
|
12
12
|
export declare type SupportedProtocolsData = SeaportData | FoundationData | NFTXData | LooksRareData | X2Y2Data | CryptopunkData | NFT20Data | SudoswapData;
|
|
13
13
|
export declare abstract class NFTTrade<T> implements Command {
|
|
14
|
+
readonly tradeType: RouterTradeType;
|
|
14
15
|
readonly orders: T[];
|
|
15
16
|
readonly market: Market;
|
|
16
17
|
constructor(market: Market, orders: T[]);
|
|
17
18
|
abstract encode(planner: RoutePlanner, config: TradeConfig): void;
|
|
18
19
|
abstract getBuyItems(): BuyItem[];
|
|
19
|
-
abstract getTotalPrice():
|
|
20
|
+
abstract getTotalPrice(): BigNumber;
|
|
20
21
|
}
|
|
21
22
|
export declare type BuyItem = {
|
|
22
23
|
tokenAddress: string;
|
package/dist/entities/index.d.ts
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BigNumberish } from 'ethers';
|
|
2
|
+
import { RoutePlanner } from '../../utils/routerCommands';
|
|
3
|
+
import { Permit2Permit } from '../../utils/permit2';
|
|
4
|
+
import { Command, RouterTradeType, TradeConfig } from '../Command';
|
|
5
|
+
export declare class UnwrapWETH implements Command {
|
|
6
|
+
readonly tradeType: RouterTradeType;
|
|
7
|
+
readonly permit2Data: Permit2Permit;
|
|
8
|
+
readonly wethAddress: string;
|
|
9
|
+
readonly routerAddress: string;
|
|
10
|
+
readonly amount: BigNumberish;
|
|
11
|
+
constructor(amount: BigNumberish, chainId: number, permit2?: Permit2Permit);
|
|
12
|
+
encode(planner: RoutePlanner, _: TradeConfig): void;
|
|
13
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TradeConfig } from '../Command';
|
|
2
2
|
import { NFTTrade, BuyItem } from '../NFTTrade';
|
|
3
3
|
import { RoutePlanner } from '../../utils/routerCommands';
|
|
4
|
-
import { BigNumberish } from 'ethers';
|
|
4
|
+
import { BigNumber, BigNumberish } from 'ethers';
|
|
5
5
|
export declare type CryptopunkData = {
|
|
6
6
|
tokenId: BigNumberish;
|
|
7
7
|
recipient: string;
|
|
@@ -12,5 +12,5 @@ export declare class CryptopunkTrade extends NFTTrade<CryptopunkData> {
|
|
|
12
12
|
constructor(orders: CryptopunkData[]);
|
|
13
13
|
encode(planner: RoutePlanner, config: TradeConfig): void;
|
|
14
14
|
getBuyItems(): BuyItem[];
|
|
15
|
-
getTotalPrice():
|
|
15
|
+
getTotalPrice(): BigNumber;
|
|
16
16
|
}
|
|
@@ -2,7 +2,7 @@ import { Interface } from '@ethersproject/abi';
|
|
|
2
2
|
import { BuyItem, NFTTrade } from '../NFTTrade';
|
|
3
3
|
import { TradeConfig } from '../Command';
|
|
4
4
|
import { RoutePlanner } from '../../utils/routerCommands';
|
|
5
|
-
import { BigNumberish } from 'ethers';
|
|
5
|
+
import { BigNumber, BigNumberish } from 'ethers';
|
|
6
6
|
export declare type FoundationData = {
|
|
7
7
|
recipient: string;
|
|
8
8
|
tokenAddress: string;
|
|
@@ -15,5 +15,5 @@ export declare class FoundationTrade extends NFTTrade<FoundationData> {
|
|
|
15
15
|
constructor(orders: FoundationData[]);
|
|
16
16
|
encode(planner: RoutePlanner, config: TradeConfig): void;
|
|
17
17
|
getBuyItems(): BuyItem[];
|
|
18
|
-
getTotalPrice():
|
|
18
|
+
getTotalPrice(): BigNumber;
|
|
19
19
|
}
|
|
@@ -2,7 +2,7 @@ import { Interface } from '@ethersproject/abi';
|
|
|
2
2
|
import { BuyItem, NFTTrade, TokenType } from '../NFTTrade';
|
|
3
3
|
import { TradeConfig } from '../Command';
|
|
4
4
|
import { RoutePlanner } from '../../utils/routerCommands';
|
|
5
|
-
import { BigNumberish } from 'ethers';
|
|
5
|
+
import { BigNumber, BigNumberish } from 'ethers';
|
|
6
6
|
export declare type MakerOrder = {
|
|
7
7
|
collection: string;
|
|
8
8
|
tokenId: BigNumberish;
|
|
@@ -40,5 +40,5 @@ export declare class LooksRareTrade extends NFTTrade<LooksRareData> {
|
|
|
40
40
|
constructor(orders: LooksRareData[]);
|
|
41
41
|
encode(planner: RoutePlanner, config: TradeConfig): void;
|
|
42
42
|
getBuyItems(): BuyItem[];
|
|
43
|
-
getTotalPrice():
|
|
43
|
+
getTotalPrice(): BigNumber;
|
|
44
44
|
}
|
|
@@ -2,7 +2,7 @@ import { Interface } from '@ethersproject/abi';
|
|
|
2
2
|
import { TradeConfig } from '../Command';
|
|
3
3
|
import { NFTTrade, BuyItem } from '../NFTTrade';
|
|
4
4
|
import { RoutePlanner } from '../../utils/routerCommands';
|
|
5
|
-
import { BigNumberish } from 'ethers';
|
|
5
|
+
import { BigNumber, BigNumberish } from 'ethers';
|
|
6
6
|
export declare type NFT20Data = {
|
|
7
7
|
tokenAddress: string;
|
|
8
8
|
tokenIds: BigNumberish[];
|
|
@@ -17,5 +17,5 @@ export declare class NFT20Trade extends NFTTrade<NFT20Data> {
|
|
|
17
17
|
constructor(orders: NFT20Data[]);
|
|
18
18
|
encode(planner: RoutePlanner, config: TradeConfig): void;
|
|
19
19
|
getBuyItems(): BuyItem[];
|
|
20
|
-
getTotalPrice():
|
|
20
|
+
getTotalPrice(): BigNumber;
|
|
21
21
|
}
|
|
@@ -2,7 +2,7 @@ import { Interface } from '@ethersproject/abi';
|
|
|
2
2
|
import { BuyItem, NFTTrade } from '../NFTTrade';
|
|
3
3
|
import { TradeConfig } from '../Command';
|
|
4
4
|
import { RoutePlanner } from '../../utils/routerCommands';
|
|
5
|
-
import { BigNumberish } from 'ethers';
|
|
5
|
+
import { BigNumber, BigNumberish } from 'ethers';
|
|
6
6
|
declare type PairSwap = {
|
|
7
7
|
swapInfo: {
|
|
8
8
|
pair: string;
|
|
@@ -22,6 +22,6 @@ export declare class SudoswapTrade extends NFTTrade<SudoswapData> {
|
|
|
22
22
|
constructor(orders: SudoswapData[]);
|
|
23
23
|
encode(planner: RoutePlanner, config: TradeConfig): void;
|
|
24
24
|
getBuyItems(): BuyItem[];
|
|
25
|
-
getTotalPrice():
|
|
25
|
+
getTotalPrice(): BigNumber;
|
|
26
26
|
}
|
|
27
27
|
export {};
|
|
@@ -2,13 +2,14 @@ import { RoutePlanner } from '../../utils/routerCommands';
|
|
|
2
2
|
import { Trade as RouterTrade, SwapOptions as RouterSwapOptions } from '@uniswap/router-sdk';
|
|
3
3
|
import { Permit2Permit } from '../../utils/permit2';
|
|
4
4
|
import { Currency, TradeType } from '@uniswap/sdk-core';
|
|
5
|
-
import { Command, TradeConfig } from '../Command';
|
|
5
|
+
import { Command, RouterTradeType, TradeConfig } from '../Command';
|
|
6
6
|
export declare type SwapOptions = Omit<RouterSwapOptions, 'inputTokenPermit'> & {
|
|
7
7
|
inputTokenPermit?: Permit2Permit;
|
|
8
8
|
};
|
|
9
9
|
export declare class UniswapTrade implements Command {
|
|
10
10
|
trade: RouterTrade<Currency, Currency, TradeType>;
|
|
11
11
|
options: SwapOptions;
|
|
12
|
+
readonly tradeType: RouterTradeType;
|
|
12
13
|
constructor(trade: RouterTrade<Currency, Currency, TradeType>, options: SwapOptions);
|
|
13
14
|
encode(planner: RoutePlanner, _config: TradeConfig): void;
|
|
14
15
|
}
|
|
@@ -2,7 +2,7 @@ import { Interface } from '@ethersproject/abi';
|
|
|
2
2
|
import { BuyItem, NFTTrade, TokenType } from '../NFTTrade';
|
|
3
3
|
import { TradeConfig } from '../Command';
|
|
4
4
|
import { RoutePlanner } from '../../utils/routerCommands';
|
|
5
|
-
import { BigNumberish } from 'ethers';
|
|
5
|
+
import { BigNumber, BigNumberish } from 'ethers';
|
|
6
6
|
declare type X2Y2PartialData = {
|
|
7
7
|
signedInput: string;
|
|
8
8
|
recipient: string;
|
|
@@ -23,6 +23,6 @@ export declare class X2Y2Trade extends NFTTrade<X2Y2Data> {
|
|
|
23
23
|
constructor(orders: X2Y2Data[]);
|
|
24
24
|
encode(planner: RoutePlanner, config: TradeConfig): void;
|
|
25
25
|
getBuyItems(): BuyItem[];
|
|
26
|
-
getTotalPrice():
|
|
26
|
+
getTotalPrice(): BigNumber;
|
|
27
27
|
}
|
|
28
28
|
export {};
|
package/dist/index.d.ts
CHANGED
package/dist/swapRouter.d.ts
CHANGED
|
@@ -3,20 +3,25 @@ import { BigNumberish } from 'ethers';
|
|
|
3
3
|
import { MethodParameters } from '@uniswap/v3-sdk';
|
|
4
4
|
import { Trade as RouterTrade } from '@uniswap/router-sdk';
|
|
5
5
|
import { Currency, TradeType } from '@uniswap/sdk-core';
|
|
6
|
+
import { Command } from './entities/Command';
|
|
6
7
|
import { NFTTrade, SupportedProtocolsData } from './entities/NFTTrade';
|
|
7
8
|
import { SwapOptions } from './entities/protocols/uniswap';
|
|
8
9
|
export declare type SwapRouterConfig = {
|
|
9
10
|
sender?: string;
|
|
10
11
|
deadline?: BigNumberish;
|
|
11
12
|
};
|
|
13
|
+
declare type SupportedNFTTrade = NFTTrade<SupportedProtocolsData>;
|
|
12
14
|
export declare abstract class SwapRouter {
|
|
13
15
|
static INTERFACE: Interface;
|
|
16
|
+
static swapCallParameters(trades: Command[] | Command, config?: SwapRouterConfig): MethodParameters;
|
|
14
17
|
/**
|
|
18
|
+
* @deprecated in favor of swapCallParameters. Update before next major version 2.0.0
|
|
15
19
|
* Produces the on-chain method name to call and the hex encoded parameters to pass as arguments for a given swap.
|
|
16
20
|
* @param trades to produce call parameters for
|
|
17
21
|
*/
|
|
18
|
-
static swapNFTCallParameters(trades:
|
|
22
|
+
static swapNFTCallParameters(trades: SupportedNFTTrade[], config?: SwapRouterConfig): MethodParameters;
|
|
19
23
|
/**
|
|
24
|
+
* @deprecated in favor of swapCallParameters. Update before next major version 2.0.0
|
|
20
25
|
* Produces the on-chain method name to call and the hex encoded parameters to pass as arguments for a given trade.
|
|
21
26
|
* @param trades to produce call parameters for
|
|
22
27
|
* @param options options for the call parameters
|
|
@@ -30,3 +35,4 @@ export declare abstract class SwapRouter {
|
|
|
30
35
|
*/
|
|
31
36
|
private static encodePlan;
|
|
32
37
|
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function registerFixture(key: string, data: any): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MakerOrder, TakerOrder } from '../../src/entities/protocols/looksRare';
|
|
2
|
+
import { BigNumber } from 'ethers';
|
|
3
|
+
export declare type APIOrder = Omit<MakerOrder, 'collection' | 'currency'> & {
|
|
4
|
+
collectionAddress: string;
|
|
5
|
+
currencyAddress: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function createLooksRareOrders(apiOrder: APIOrder, taker: string): {
|
|
8
|
+
makerOrder: MakerOrder;
|
|
9
|
+
takerOrder: TakerOrder;
|
|
10
|
+
value: BigNumber;
|
|
11
|
+
};
|
|
12
|
+
export declare const looksRareOrders: APIOrder[];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Wallet } from 'ethers';
|
|
2
|
+
import { PermitSingle } from '@uniswap/permit2-sdk';
|
|
3
|
+
import { Permit2Permit } from '../../src/utils/permit2';
|
|
4
|
+
export declare function generatePermitSignature(permit: PermitSingle, signer: Wallet, chainId: number, permitAddress?: string): Promise<string>;
|
|
5
|
+
export declare function toInputPermit(signature: string, permit: PermitSingle): Permit2Permit;
|
|
6
|
+
export declare function makePermit(token: string, amount?: string, nonce?: string, routerAddress?: string): PermitSingle;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { MixedRouteTrade, Trade as RouterTrade } from '@uniswap/router-sdk';
|
|
2
|
+
import { Trade as V2Trade, Pair } from '@uniswap/v2-sdk';
|
|
3
|
+
import { Trade as V3Trade, Pool, FeeAmount } from '@uniswap/v3-sdk';
|
|
4
|
+
import { SwapOptions } from '../../src';
|
|
5
|
+
import { TradeType, Ether, Token, Currency } from '@uniswap/sdk-core';
|
|
6
|
+
export declare const ETHER: Ether;
|
|
7
|
+
export declare const RECIPIENT = "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
|
|
8
|
+
export declare const WETH: Token;
|
|
9
|
+
export declare const DAI: Token;
|
|
10
|
+
export declare const USDC: Token;
|
|
11
|
+
export declare const FEE_AMOUNT = FeeAmount.MEDIUM;
|
|
12
|
+
declare type UniswapPools = {
|
|
13
|
+
WETH_USDC_V2: Pair;
|
|
14
|
+
USDC_DAI_V2: Pair;
|
|
15
|
+
WETH_USDC_V3: Pool;
|
|
16
|
+
WETH_USDC_V3_LOW_FEE: Pool;
|
|
17
|
+
USDC_DAI_V3: Pool;
|
|
18
|
+
};
|
|
19
|
+
export declare function getUniswapPools(forkBlock?: number): Promise<UniswapPools>;
|
|
20
|
+
export declare function getPair(tokenA: Token, tokenB: Token, blockNumber: number): Promise<Pair>;
|
|
21
|
+
export declare function getPool(tokenA: Token, tokenB: Token, feeAmount: FeeAmount, blockNumber: number): Promise<Pool>;
|
|
22
|
+
export declare function swapOptions(options: Partial<SwapOptions>): SwapOptions;
|
|
23
|
+
export declare function buildTrade(trades: (V2Trade<Currency, Currency, TradeType> | V3Trade<Currency, Currency, TradeType> | MixedRouteTrade<Currency, Currency, TradeType>)[]): RouterTrade<Currency, Currency, TradeType>;
|
|
24
|
+
export {};
|