Uniswap / smart-order-router

GNU General Public License v3.0
400 stars 397 forks source link

Cannot read properties of undefined (reading 'DAI_OPTIMISM_SEPOLIA') #523

Open alicercedigital opened 5 months ago

alicercedigital commented 5 months ago

We are using Base Network and ethers.Web3Provider with MetaMask.

    "@uniswap/sdk": "^3.0.3",
    "@uniswap/sdk-core": "^4.2.0",
    "@uniswap/smart-order-router": "3.26.1",
    "@uniswap/v2-periphery": "1.1.0-beta.0",
    "@uniswap/v2-sdk": "^4.3.0",
    "@uniswap/v3-core": "^1.0.1",
    "@uniswap/v3-periphery": "^1.4.4",
    "@uniswap/v3-sdk": "^3.11.0",

On NextJS 14.1.4

This error is comming from:

get-candidate-pools.js

const baseTokensByChain = {
   ...
    [ChainId.OPTIMISM_SEPOLIA]: [
        DAI_OPTIMISM_SEPOLIA, <- When try to read this we have this error.
        USDC_OPTIMISM_SEPOLIA,
        USDT_OPTIMISM_SEPOLIA,
        WBTC_OPTIMISM_SEPOLIA,
    ],
   ...
};

_token_provider__WEBPACK_IMPORTED_MODULE_20__.DAI_OPTIMISM_SEPOLIA;

It Happens when we try to create alpha router:

 const router = new AlphaRouter({
  chainId: baseNetwork.chainId,
  provider: metaMaskProvider,
 });

On version 3.19 this error does not happens, but then we have another different error so we need to upgrade.

Akhilesh-solutelabs commented 4 months ago

@jsy1218 Reminder : We're unable to proceed with local development without manual fix in package, Would highly appreciate if you could spare some time this week and push the fix out on the minor import issue we discussed ( in https://github.com/Uniswap/smart-order-router/issues/518#issuecomment-2057985100 ) which fixes the above error of Cannot read properties of undefined (reading 'DAI_OPTIMISM_SEPOLIA') as shown above.

Rahat47 commented 2 months ago

This issue is still around on version: '3.35.12' ... can't use the SDK at all

Universal-Hacker commented 1 month ago

any update on this?

enghamzasalem commented 1 week ago

is it solved?