stargaze-studio/utils/wallet.ts
2023-12-31 20:48:41 +03:00

19 lines
483 B
TypeScript

import { useChain as useCosmosKitChain } from '@cosmos-kit/react'
import { chains } from 'chain-registry'
import { getConfig } from 'config'
import { NETWORK } from './constants'
/**
* Hook to retrieve the wallet for the current chain.
*/
export const useWallet = () => {
const { chainId } = getConfig(NETWORK)
const chain = chains.find((c) => c.chain_id === chainId)
if (!chain) {
throw new Error('Chain not found')
}
return useCosmosKitChain(chain.chain_name)
}