• Core
  • Actions
  • watchSigner

watchSigner

Action for subscribing to Signer changes.

import { watchSigner } from '@wagmi/core'

Usage

By default, the callback will be invoked when Provider changes.

import { watchSigner } from '@wagmi/core'
 
const unwatch = watchSigner(
  {
    chainId: 1,
  },
  (provider) => console.log(provider),
)

Return Value

unwatch is a function that can be called to unsubscribe from the Signer change event.

Configuration

chainId (optional)

Force a specific chain id for the Signer.

import { watchSigner } from '@wagmi/core'
 
const unwatch = watchSigner(
  {
    chainId: 1,
  },
  (provider) => console.log(provider),
)