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

Commit

Permalink
throw on non matching trade types
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongeric committed Apr 2, 2024
1 parent 47b75c8 commit f0b7a06
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
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.9.0",
"version": "1.9.1",
"description": "sdk for integrating with the Universal Router contracts",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down
8 changes: 8 additions & 0 deletions src/entities/protocols/uniswap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ function addV2Swap<TInput extends Currency, TOutput extends Currency>(
route.path.map((pool) => pool.address),
payerIsUser,
])
} else {
throw new Error('TRADE_TYPE')
}
}

Expand Down Expand Up @@ -234,6 +236,8 @@ function addV3Swap<TInput extends Currency, TOutput extends Currency>(
path,
payerIsUser,
])
} else {
throw new Error('TRADE_TYPE')
}
}

Expand All @@ -260,6 +264,10 @@ function addMixedSwap<TInput extends Currency, TOutput extends Currency>(
}
}

if(tradeType !== TradeType.EXACT_INPUT) {
throw new Error('TRADE_TYPE')
}

const trade = MixedRouteTrade.createUncheckedTrade({
route: route as MixedRoute<TInput, TOutput>,
inputAmount,
Expand Down

0 comments on commit f0b7a06

Please sign in to comment.