getChain
Get the chain information of the Safe connected to the SafeProvider
.
Usage
_17import { useSafe } from '@safe-global/safe-react-hooks'_17_17function ChainInfo() {_17 const { getChain } = useSafe()_17 const {_17 name,_17 // ..._17 } = getChain()_17_17 return (_17 <>_17 {name}_17 </>_17 )_17}_17_17export default ChainInfo
Parameters
UseChainParams
Parameters to customize the hook behavior.
_10import { UseChainParams } from '@safe-global/safe-react-hooks'
config
(Optional)
- Type:
SafeConfig
The configuration used instead of the one from the nearest SafeProvider
.
_10import { config } from './config.ts'_10_10const result = getChain({_10 config_10})
Returns
UseChainReturnType
Returns UseChainReturnType = SafeConfig['chain']
being SafeConfig['chain']
the viem's Chain Type (opens in a new tab).
_10import { UseChainReturnType } from '@safe-global/safe-react-hooks'