clawchain/wagmi/site/solid/api/primitives/useConnectorClient.md

1.6 KiB

title, description
title description
useConnectorClient Primitive for getting Viem Wallet Client from the active connector.

useConnectorClient

Primitive for getting a Viem Wallet Client from the active connector.

Import

import { useConnectorClient } from '@wagmi/solid'

Usage

::: code-group

import { useConnectorClient } from '@wagmi/solid'

function App() {
  const client = useConnectorClient()
  
  // client() returns the Wallet Client when connected
}

<<< @/snippets/solid/config.ts[config.ts] :::

Parameters

import { useConnectorClient } from '@wagmi/solid'

useConnectorClient.Parameters
useConnectorClient.SolidParameters

Parameters are passed as a getter function to maintain Solid reactivity.

useConnectorClient(() => ({
  chainId: 1,
  connector: myConnector,
}))

account

Address | undefined

Account to use for the client.

chainId

config['chains'][number]['id'] | undefined

ID of chain to use for the client.

config

Config | undefined

Config to use instead of retrieving from the nearest WagmiProvider.

connector

Connector | undefined

Connector to get the client for. Defaults to the active connector.

Return Type

import { useConnectorClient } from '@wagmi/solid'

useConnectorClient.ReturnType

Action