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. WhenuseChainis called, corresponding chainWallets will be activated. -
useChainWallet: Provide chainWallet related properties and methods, and support multiple chains and wallets connected at one time. WhenuseChainWalletis called, corresponding chainWallet will be activated.
See more information about Differences Between
useChainAnduseChainWallet
-
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
useChainWalletrequires an extra parameterwalletName.useChainwill pop up a wallet modal to connect whileuseChainWalletnot.useChainexposes extraopenViewandcloseViewmethods andwalletRepoproperty.- the return value of methods
getRpcEndpoint,getRestEndpoint,getStargateClient,getCosmWasmClient,getNameServicecan be different betweenuseChainanduseChainWallet, becauseuseChainexplores allchainWalletsrelated to the parameterchainName.