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
In applications using the wagmi framework, it's currently possible to perform basic chain management in read-only mode using switchChain to change the active chain and useChainId to retrieve the current chain ID. However, there is no native method to retrieve the full details of a chain, such as its name or symbol, without relying on external mappings or additional custom logic.
Current Problem:
To display useful information about the active chain, such as its name or symbol, developers need to maintain a local list of supported chains or implement additional logic. This adds unnecessary complexity and reduces the simplicity of using wagmi.
Proposed Solution:
Introduce a new feature to directly retrieve the full Chain object for the active chain. This could be implemented as a hook or a method, extending the functionality of useChainId or switchChain. For example:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
In applications using the wagmi framework, it's currently possible to perform basic chain management in read-only mode using switchChain to change the active chain and useChainId to retrieve the current chain ID. However, there is no native method to retrieve the full details of a chain, such as its name or symbol, without relying on external mappings or additional custom logic.
Current Problem:
To display useful information about the active chain, such as its name or symbol, developers need to maintain a local list of supported chains or implement additional logic. This adds unnecessary complexity and reduces the simplicity of using wagmi.
Proposed Solution:
Introduce a new feature to directly retrieve the full Chain object for the active chain. This could be implemented as a hook or a method, extending the functionality of useChainId or switchChain. For example:
const { chain } = useChain();
console.log(chain.name, chain.symbol); // Ethereum, ETH
Enhancement of Existing useChainId:
Allow useChainId to return both the ID and the full Chain object.
Integration with useSwitchChain:
Extend the functionality to add current Chain
Beta Was this translation helpful? Give feedback.
All reactions