Skip to content

Latest commit

 

History

History
67 lines (46 loc) · 1.92 KB

README.md

File metadata and controls

67 lines (46 loc) · 1.92 KB

kali dao logo

React Hooks for Ethereum and Kali DAO Apps


Kali Hooks is a Rect Hooks library that aims to simplify development of Kali DAO based web3 apps. Kali Hooks extends the wagmi hooks library and follows the wagmi best practices.

Features

  • 🚀 React hooks for working with Kali DAO EVM contracts.
  • 👟 Caching, request deduplication, multicall, batching, and persistence
  • 🦄 TypeScript ready

Hooks

useChainGuard

Checks if the user is connected to a target chain. Useful for preventing users from writing to contracts on the wrong chain.

Example React component snippet:

import { useChainGuard } from '@kalidao/hooks'

const daoHomeChain = chain.arbitrum
const { isUserOnCorrectChain, isUserConnected, userChain } = useChainGuard({ chainId: daoHomeChain.id })

let wrongChainWarning
if (!isUserOnCorrectChain) {
  wrongChainWarning = (!isUserConnected) ?
    wrongChainWarning = `Your Web3 wallet is disconnected. Please connect to ${daoHomeChain.name}.`
    :
    wrongChainWarning = `Your Web3 wallet is connected to ${userChain.name}. Please switch to ${daoHomeChain.name}.`
}

Installation

Install Kali Hooks and its peer dependencies.

npm install @kalidao/hooks wagmi ethers

Contributing

If you're interested in contributing, please read the contributing docs before submitting a pull request.

Contribute with Gitpod

License

MIT License