React Hooks Reference
getChain

getChain

Get the chain information of the Safe connected to the SafeProvider.

Usage


_17
import { useSafe } from '@safe-global/safe-react-hooks'
_17
_17
function ChainInfo() {
_17
const { getChain } = useSafe()
_17
const {
_17
name,
_17
// ...
_17
} = getChain()
_17
_17
return (
_17
<>
_17
{name}
_17
</>
_17
)
_17
}
_17
_17
export default ChainInfo

Parameters

UseChainParams

Parameters to customize the hook behavior.


_10
import { UseChainParams } from '@safe-global/safe-react-hooks'

config (Optional)

  • Type: SafeConfig

The configuration used instead of the one from the nearest SafeProvider.


_10
import { config } from './config.ts'
_10
_10
const result = getChain({
_10
config
_10
})

Returns

UseChainReturnType

Returns UseChainReturnType = SafeConfig['chain'] being SafeConfig['chain'] the viem's Chain Type (opens in a new tab).


_10
import { UseChainReturnType } from '@safe-global/safe-react-hooks'

Was this page helpful?