diff --git a/README.md b/README.md index 9853620..d1ba8f0 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ import { - connected: store value is true if a connection has been set up. - provider: store value is an Ethers.js Provider instance when connected. -- chainId: store value is the current chainId when connected (always BigInt) +- chainId: store value is the current chainId when connected (** always a BigInt **) - chainData: store value is the current blokchain CAIP-2 data (when connected), see below. - signer: store value is an Ethers.js Signer instance when connected. - signerAddress: store value is a shortcut to get `$signer.getAddress()` when connected. diff --git a/src/stores.js b/src/stores.js index 55d2c12..8efb41b 100644 --- a/src/stores.js +++ b/src/stores.js @@ -303,8 +303,9 @@ export const getChainStore = (name) => { export { chains as allChainsData }; +// chains.js only support number chainId export const getChainDataByChainId = (id) => - (chains.filter((o) => o.chainId === id) || [{}])[0]; +(chains.filter((o) => o.chainId === Number(BigInt(id))) || [{}])[0]; export const defaultEvmStores = makeEvmStores("default");