You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
useChains.js:15 Uncaught TypeError: Cannot read properties of undefined (reading 'chain_id')
at useChains.js:15:1
at Array.map (<anonymous>)
at useChains (useChains.js:15:1)
at DepositCard (DepositCard.tsx:71:1)
at renderWithHooks (react-dom.development.js:15486:1)
at mountIndeterminateComponent (react-dom.development.js:20103:1)
at beginWork (react-dom.development.js:21626:1)
at HTMLUnknownElement.callCallback (react-dom.development.js:4164:1)
at Object.invokeGuardedCallbackDev (react-dom.development.js:4213:1)
at invokeGuardedCallback (react-dom.development.js:4277:1)
My code:
// line that throws the error. defined in a component that exists within `ChainProvider`constchains=useChains(['cosmoshub']);
// Top level App component where I setup `ChainProvider`.importtypeReactfrom"react";import{Route,Routes}from"react-router-dom";import{ChainProvider}from"@cosmos-kit/react";import{assets}from"chain-registry";import{wallets}from"@cosmos-kit/keplr";import{getDefaultConfig,RainbowKitProvider}from"@rainbow-me/rainbowkit";import{QueryClient,QueryClientProvider}from"@tanstack/react-query";import{WagmiProvider}from"wagmi";import{evmChainsToRainbowKitChains,ibcChainInfosToCosmosChains,useConfig,}from"config";import{NotificationsContextProvider}from"features/Notifications";importBridgePagefrom"pages/BridgePage/BridgePage";importLayoutfrom"pages/Layout";// global stylesimport"styles/index.scss";// contrib stylesimport"@rainbow-me/rainbowkit/styles.css";import"@interchain-ui/react/styles";import{toCosmosChainNames}from"./config/chainConfigs/types.ts";/** * App component with routes. * Sets up the RainbowKitProvider and QueryClientProvider for tanstack/react-query. */exportdefaultfunctionApp(): React.ReactElement{const{ evmChains, ibcChains }=useConfig();constrainbowKitConfig=getDefaultConfig({appName: "Flame Bridge",projectId: "YOUR_PROJECT_ID",// TODOchains: evmChainsToRainbowKitChains(evmChains),});constqueryClient=newQueryClient();constcosmosWalletConnectOptions={signClient: {projectId: "YOUR_PROJECT_ID",// TODO},};return(<NotificationsContextProvider><WagmiProviderconfig={rainbowKitConfig}><QueryClientProviderclient={queryClient}><RainbowKitProvider><ChainProviderchains={['cosmoshub']}// supported chainsassetLists={assets}// supported asset listswallets={wallets}// supported walletswalletConnectOptions={cosmosWalletConnectOptions}// required if `wallets` contains mobile wallets><Routes><Routeelement={<Layout/>}><Routeindexelement={<BridgePage/>}/></Route></Routes></ChainProvider></RainbowKitProvider></QueryClientProvider></WagmiProvider></NotificationsContextProvider>);}
Relevant code from cosmos-kit showing that repo.chainRecord.chain is what is undefined.
I'm following the simple example from the docs here. useChain does not throw an error.
exportfunctionuseChains(chainNames,sync=true){constnames=Array.from(newSet(chainNames));constcontext=useContext(walletContext);if(!context){thrownewError('You have forgotten to use ChainProvider.');}const{ walletManager, modalProvided }=context;if(!modalProvided){thrownewError('You have to provide `walletModal` to use `useChains`, or use `useChainWallet` instead.');}constrepos=names.map(name=>walletManager.getWalletRepo(name));constids=repos.map(repo=>repo.chainRecord.chain.chain_id);// throws error here// ...}
The text was updated successfully, but these errors were encountered:
I'm experiencing an error when using
useChains
.My code:
Relevant code from cosmos-kit showing that
repo.chainRecord.chain
is what isundefined
.I'm following the simple example from the docs here.
useChain
does not throw an error.The text was updated successfully, but these errors were encountered: