Skip to content

Commit

Permalink
getChainDataByChainId accept BigInt
Browse files Browse the repository at this point in the history
  • Loading branch information
clbrge committed Apr 18, 2023
1 parent db88cba commit 9c8cd56
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion src/stores.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down

0 comments on commit 9c8cd56

Please sign in to comment.