useSigner
Hook for accessing ethers.js Signer object for connected account.
import { useSigner } from 'wagmi'
Usage
The following examples use the ENS Registry Contract.
import { useContract, useSigner } from 'wagmi'
const App = () => { const [{ data, error, loading }, getSigner] = useSigner()
const contract = useContract({ addressOrName: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', contractInterface: ensRegistryABI, signerOrProvider: data, })
return ...}
Return Values
result
{ data?: ethers.Signer error?: Error loading?: boolean}
getSigner
() => Promise<ethers.Signer>
Configuration
skip (optional)
Skips automatically loading signer on mount. Defaults to false
. Useful if you want to call getSigner
manually at some other point.
import { useSigner } from 'wagmi'
const App = () => { const [{ data, error, loading }, getSigner] = useSigner({ skip: true, })
return ...}