smart-order-router
smart-order-router copied to clipboard
Cannot read properties of undefined (reading 'DAI_OPTIMISM_SEPOLIA')
-
I'm submitting a ... [X] bug report [ ] feature request [ ] question about the decisions made in the repository [ ] question about how to use this project
-
Summary On version 3.26.1 we are getting this error: Cannot read properties of undefined (reading 'DAI_OPTIMISM_SEPOLIA')
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.
- Other information (e.g. detailed explanation, stack traces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)
@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.
This issue is still around on version: '3.35.12' ... can't use the SDK at all
any update on this?
is it solved?
is it solved?
No.
For me SDK works when I don't use webpack. Webpack gives the error above.
@xrsv , @jsy1218 can you look at this please?