• Core
  • Actions
  • watchWalletClient

watchWalletClient

Action for subscribing to Wallet Client changes.

import { watchWalletClient } from '@wagmi/core'

Usage

By default, the callback will be invoked when Wallet Client changes.

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

Return Value

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

Configuration

chainId (optional)

Force a specific chain id for the Wallet Client.

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