useChain
Hook for getting the Chain
object of the network that the user is connected - but only if
it's a supported network (added in the ThirdwebProvider
's supportedChains
or one of default chains
Returns undefined
if the network is not supported or the user is not connected to a wallet. You can use the useConnectionStatus
hook to check if the user is connected to a wallet or not to differentiate between the two cases.
If you only want to get the chain id of the network the user is connected to regardless of whether it's supported or not, use useChainId
instead.
An object of type Chain
from @thirdweb-dev/chains
package containing various information about the network, or undefined
if the network is not supported or user is not connected to a wallet.