Alchemy Logo

useSigner

const useSigner: <T>(override?) => T | null;

Defined in: account-kit/react/dist/types/hooks/useSigner.d.ts:18

Hook for accessing the current Alchemy signer within a React component. It uses a synchronous external store for updates. This is a good use case if you want to use the signer as an EOA, giving you direct access to it. The signer returned from useSigner just does a personal_sign or eth_signTypedData without any additional logic, but a smart contract account might have additional logic for creating signatures for 1271 validation so useSignMessage or useSignTypeData instead.

import { useSigner } from "@account-kit/react";
import type { AlchemyWebSigner } from "@account-kit/signer";
 
const signer: AlchemyWebSigner | null = useSigner();

Type Parameter

T extends AlchemySigner

ParameterTypeDescription

override?

AlchemyAccountContextProps

optional configuration to override the default context. ref

T | null

The current Alchemy signer or null if none is available. ref

Was this page helpful?