Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix native currency requests #65

Merged
merged 1 commit into from
Jul 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions lib/handlers/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
ChainId,
ITokenListProvider,
ITokenProvider,
NativeCurrencyName,
nativeOnChain,
NATIVE_NAMES_BY_ID,
} from '@uniswap/smart-order-router'
import Logger from 'bunyan'

Expand Down Expand Up @@ -102,12 +102,7 @@ export async function tokenStringToCurrency(

let token: Currency | undefined = undefined

if (
tokenRaw == NativeCurrencyName.ETHER ||
tokenRaw == NativeCurrencyName.MATIC ||
tokenRaw == NativeCurrencyName.CELO ||
tokenRaw.toLowerCase() == '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'
) {
if (NATIVE_NAMES_BY_ID[chainId]!.includes(tokenRaw)) {
token = nativeOnChain(chainId)
} else if (isAddress(tokenRaw)) {
token = await tokenListProvider.getTokenByAddress(tokenRaw)
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"@uniswap/default-token-list": "^4.1.0",
"@uniswap/router-sdk": "^1.0.5",
"@uniswap/sdk-core": "^3.0.1",
"@uniswap/smart-order-router": "^2.7.0",
"@uniswap/smart-order-router": "^2.8.0",
"@uniswap/token-lists": "^1.0.0-beta.24",
"@uniswap/v3-periphery": "^1.1.0",
"@uniswap/v3-sdk": "^3.7.1",
Expand Down