Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Commit

Permalink
2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ewilz committed Sep 29, 2023
1 parent d52ed08 commit b9f5fb0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const { calldata, value } = SwapRouter.swapCallParameters([unwrapWETH, seaportTr
```
### Trading stETH
To trade stETH as an input token, you can make sure the router automatically wraps stETH to wstETH before trading across a wstETH route.
To trade stETH as an input token, you can make sure the router automatically wraps stETH to wstETH before trading across a wstETH route. Make sure to specify the router is the payer of the swap (since it's in custody of wSTETH after wrapping)
If this is an exactOut trade, we'll need to wrap the maximumAmountIn of steth, and therefore should add an unwrap command at the end of the transaction to account for any leftover steth that didn't get traded. `amountMinimum` can be set to 0 in this scenario for the unwrapSteth commmand.
```typescript
Expand All @@ -107,19 +107,19 @@ import {
} from "@uniswap/universal-router-sdk";

// EXACT INPUT
// including optional permit2 parameter will transfer STETH amount using permit2
const wrapSTETH = new WrapSTETH(inputSTETH, 1, WrapSTETHPermitData?, wrapAmountOtherThanContractBalance?)
// including optional permit2 parameter will transfer STETH amount using permit2
const wrapSTETH = new WrapSTETH(inputSTETH, chainId, WrapSTETHPermitData?, wrapAmountOtherThanContractBalance?)
const uniswapWstethTrade = new UniswapTrade(
new RouterTrade({ v2Routes, v3Routes, mixedRoutes, tradeType: TradeType.EXACT_INPUT }),
{ slippageTolerance}
{ slippageTolerance, payerIsRouter: true }
)
const { calldata, value } = SwapRouter.swapCallParameters([wrapSTETH, uniswapWstethTrade])

// EXACT OUTPUT
const wrapSTETH = new WrapSTETH(maximumInputSTETH, 1, WrapSTETHPermitData?, wrapAmountOtherThanContractBalance?)
const wrapSTETH = new WrapSTETH(maximumInputSTETH, chainId, WrapSTETHPermitData?, wrapAmountOtherThanContractBalance?)
const uniswapWstethTrade = new UniswapTrade(
new RouterTrade({ v2Routes, v3Routes, mixedRoutes, tradeType: TradeType.EXACT_OUTPUT }),
{ slippageTolerance}
{ slippageTolerance, payerIsRouter: true }
)
const unwrapSTETH = new UnwrapSTETH(recipient, amountMinimum = 0, chainId)

Expand All @@ -142,7 +142,7 @@ import {
// return trade to the router instead of the recipient using the ROUTER_AS_RECIPIENT constant so that the router may custody tokens to unwrap
const uniswapWstethTrade = new UniswapTrade(
new RouterTrade({ v2Routes, v3Routes, mixedRoutes, tradeType: TradeType.EXACT_INPUT }),
{ slippageTolerance, ROUTER_AS_RECIPIENT}
{ slippageTolerance, recipient: ROUTER_AS_RECIPIENT}
)
const unwrapSTETH = new UnwrapSTETH(recipient, amountMinimum, chainId)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@uniswap/universal-router-sdk",
"version": "1.5.8",
"version": "2.0.0",
"description": "sdk for integrating with the Universal Router contracts",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down

0 comments on commit b9f5fb0

Please sign in to comment.