Hooks
Hooks are functions that will help you control the modal, subscribe to wallet events and interact with them and smart contracts.
useAppKit
Hook for controlling the modal.
Returns
open
: Function to open the modalclose
: Function to close the modal
Parameters
You can also select the modal’s view when calling the open
function
List of views you can select
useAppKitAccount
Hook for accessing account data and connection status.
Hook for accessing account data and connection status for each namespace when working in a multi-chain environment.
Returns
allAccounts
: A list of connected accountsaddress
: The current account addresscaipAddress
: The current account address in CAIP formatisConnected
: Boolean that indicates if the user is connectedstatus
: The current connection statusembeddedWalletInfo
: The current embedded wallet information
useAppKitNetwork
Hook for accessing network data and methods.
Returns
caipNetwork
: The current network objectcaipNetworkId
: The current network id in CAIP formatchainId
: The current chain idswitchNetwork
: Function to switch the network. Accepts acaipNetwork
object as argument.
See how to import or create a networks here.
useAppKitState
Hook for getting the current value of the modal’s state.
Returns
open
: Boolean that indicates if the modal is openselectedNetworkId
: The current chain id selected by the user
useAppKitTheme
Hook for controlling the modal’s theme.
useAppKitEvents
Hook for subscribing to modal events.
useDisconnect
Hook for disconnecting the session.
useWalletInfo
Hook for accessing wallet information.
useAppKitWallet
Using the wallet button hooks (Demo in our Lab), you can directly connect to the top 20 wallets, WalletConnect QR and also all the social logins. This hook allows to customize dApps, enabling users to connect their wallets effortlessly, all without the need to open the traditional modal. Execute this command to install the library for use it:
Then you have to import the hook in your project:
And finally, you can use the hook in your project:
Options for the connect parameter
Type | Options |
---|---|
QR Code | walletConnect |
Wallets | metamask , trust , coinbase , rainbow , jupiter , solflare , coin98 , magic-eden , backpack , frontier , xverse , okx , bitget , leather , binance , uniswap , safepal , bybit , phantom , ledger , timeless-x , safe , zerion , oneinch , crypto-com , imtoken , kraken , ronin , robinhood , exodus , argent , and tokenpocket |
Social logins | google , github , apple , facebook , x , discord , and farcaster |
Ethereum/Solana Library
useAppKitAccount
Hook that returns the client’s information.
useSignMessage
Hook for signing messages with connected account.
Learn More
useAppKitAccount
Hook that returns the client’s information.
useSignMessage
Hook for signing messages with connected account.
Learn More
useAppKitAccount
Hook that returns the client’s information.
switchNetwork
useAppKitProvider
Hook that returns the walletProvider
and the WalletProviderType
.
getError
Learn More About Ethers
switchNetwork
useAppKitProvider
Hook that returns the walletProvider
and the WalletProviderType
.
getError
Learn More About Ethers
useAppKitAccount
Hook that returns the client’s information.
useAppKitProvider
Hook that returns the walletProvider
and the WalletProviderType
.
useAppKitConnection
Hook that returns the connection object. More info about Connection Class
Was this page helpful?