You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: sdks/universal-router-sdk/README.md
+3-77
Original file line number
Diff line number
Diff line change
@@ -4,27 +4,7 @@ This SDK facilitates interactions with the contracts in [Universal Router](https
4
4
## Usage
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
-
### Trading NFTs
8
-
warning: `swapNFTCallParameters()` to be deprecated in favor of `swapCallParameters()`
9
-
```typescript
10
-
import {
11
-
LooksRareTrade,
12
-
LooksRareData,
13
-
SeaportTrade,
14
-
SeaportData
15
-
} from"@uniswap/universal-router-sdk";
16
-
17
-
// Each protocol data object contains 1 call to that protocol. Some protocols can fit
18
-
// many NFT purchase within 1 call, like seaport. Others require multiple calls per NFT (like LooksRare).
// Use the raw calldata and value returned to call into Universal Swap Router contracts
41
-
const { calldata, value } =SwapRouter.swapCallParameters(routerTrade)
42
-
```
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.
// 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.
0 commit comments