There are multiple hooks provided in CosmosKit. They all require ChainProvider from either @cosmos-kit/react
or @cosmos-kit/react-lite
to provide necessary information.
-
useChain
: Provide chainWallet related properties and methods, and support multiple chains connected at one time. WhenuseChain
is called, corresponding chainWallets will be activated. -
useChainWallet
: Provide chainWallet related properties and methods, and support multiple chains and wallets connected at one time. WhenuseChainWallet
is called, corresponding chainWallet will be activated.
See more information about Differences Between
useChain
AnduseChainWallet
-
useManager
: Manage all chains and wallets. -
useModalTheme
: Manage default modal themes. -
useNameService
: Get alias name of address from a particular name server. -
useWallet
: Manage all chainWallets and the global status for a particular wallet. -
useWalletClient
: Get the wallet client for a particular wallet. -
useIframe
: Set up an iframe that can access the currently connected wallet automatically.
Differences Between useChain
And useChainWallet
useChainWallet
requires an extra parameterwalletName
.useChain
will pop up a wallet modal to connect whileuseChainWallet
not.useChain
exposes extraopenView
andcloseView
methods andwalletRepo
property.- the return value of methods
getRpcEndpoint
,getRestEndpoint
,getStargateClient
,getCosmWasmClient
,getNameService
can be different betweenuseChain
anduseChainWallet
, becauseuseChain
explores allchainWallets
related to the parameterchainName
.