Wallet Client
A Wallet Client is an interface provided by viem to interact with Ethereum Account(s) and provides the ability to retrieve accounts, execute transactions, sign messages, etc through Wallet Actions.
You can read more about Wallet Client here.
In the comp-kit
library, you're provided with the useWalletClient
hook that you can use in any file of your dapp.
Usage
In order to use walletClient
, import useWalletClient
from "@nazeeh2000/comp-kit"
. The return value of this hook will be walletClient
that you can use in any part of your dapp.
You can use walletClient
in your component as per the below example.
You can apply all the methods to the walletClient
that are applicable to the walletClient
of viem
mentioned here.
Note: You need to add
use client
at the top of the component accessing these hooks as these hooks cant be run on server side because they've React Context in the background.
Last updated