diff --git a/lib/handlers/shared.ts b/lib/handlers/shared.ts index 3035c50fb..9ee9f52c8 100644 --- a/lib/handlers/shared.ts +++ b/lib/handlers/shared.ts @@ -4,8 +4,8 @@ import { ChainId, ITokenListProvider, ITokenProvider, - NativeCurrencyName, nativeOnChain, + NATIVE_NAMES_BY_ID, } from '@uniswap/smart-order-router' import Logger from 'bunyan' @@ -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) diff --git a/package-lock.json b/package-lock.json index e6d6ecffa..b17690f2d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,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", @@ -2572,9 +2572,9 @@ } }, "node_modules/@uniswap/smart-order-router": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/@uniswap/smart-order-router/-/smart-order-router-2.7.0.tgz", - "integrity": "sha512-19U6sW5pqzkoCUJZknplmDbZRaYX8vve3rEGRChnK/qEFXKS4pm0Oz7fmtTL9rpDGeaxb2ebp+dlTbcPm/9yTw==", + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/@uniswap/smart-order-router/-/smart-order-router-2.8.0.tgz", + "integrity": "sha512-Yo3uuTZ75U564hQBwWzNsyrizQj9da27n1/0ffqFzU6JjGM0K7etq2PhYZP+50c0aGX1ajrisnfDYVxqjqtpJg==", "dependencies": { "@nomiclabs/hardhat-ethers": "^2.0.6", "@types/async-retry": "^1.4.2", @@ -22400,9 +22400,9 @@ } }, "@uniswap/smart-order-router": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/@uniswap/smart-order-router/-/smart-order-router-2.7.0.tgz", - "integrity": "sha512-19U6sW5pqzkoCUJZknplmDbZRaYX8vve3rEGRChnK/qEFXKS4pm0Oz7fmtTL9rpDGeaxb2ebp+dlTbcPm/9yTw==", + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/@uniswap/smart-order-router/-/smart-order-router-2.8.0.tgz", + "integrity": "sha512-Yo3uuTZ75U564hQBwWzNsyrizQj9da27n1/0ffqFzU6JjGM0K7etq2PhYZP+50c0aGX1ajrisnfDYVxqjqtpJg==", "requires": { "@nomiclabs/hardhat-ethers": "^2.0.6", "@types/async-retry": "^1.4.2", diff --git a/package.json b/package.json index 95a5b45d9..68ee564cf 100644 --- a/package.json +++ b/package.json @@ -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",