useSigner
Defined in: account-kit/react/src/hooks/useSigner.ts:23
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.
Example
import { const useSigner: <T extends AlchemySigner>() => T | nullHook 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.
useSigner } from "@account-kit/react";
import type { class AlchemyWebSignerA SmartAccountSigner that can be used with any SmartContractAccount
AlchemyWebSigner } from "@account-kit/signer";
const const signer: AlchemyWebSigner | nullsigner: class AlchemyWebSignerA SmartAccountSigner that can be used with any SmartContractAccount
AlchemyWebSigner | null = useSigner<AlchemyWebSigner>(): AlchemyWebSigner | nullHook 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.
useSigner();Type Parameters
Parameters
Returns
null | T
The current Alchemy signer or null if none is available. ref