npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wagmi-custome

v0.0.1

Published

<p align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/wevm/wagmi/main/.github/logo-dark.svg"> <img alt="wagmi logo" src="https://raw.githubusercontent.com/wevm/wagmi/main/.github/logo

Downloads

3

Readme

Features

  • 🚀 20+ hooks for working with wallets, ENS, contracts, transactions, signing, etc.
  • 💼 Built-in wallet connectors for MetaMask, WalletConnect, Coinbase Wallet, Injected, and more
  • 👟 Caching, request deduplication, multicall, batching, and persistence
  • 🌀 Auto-refresh data on wallet, block, and network changes
  • 🦄 TypeScript ready (infer types from ABIs and EIP-712 Typed Data)
  • 📦 Command-line interface for managing ABIs and code generation
  • 🌳 Test suite running against forked Ethereum network

...and a lot more.

Documentation

For full documentation and examples, visit wagmi.sh.

Installation

Install wagmi and its viem peer dependency.

npm install wagmi viem

Quick Start

Connect a wallet in under 60 seconds. LFG.

import { WagmiConfig, createConfig, mainnet } from 'wagmi'
import { createPublicClient, http } from 'viem'

const config = createConfig({
  autoConnect: true,
  publicClient: createPublicClient({
    chain: mainnet,
    transport: http(),
  }),
})

function App() {
  return (
    <WagmiConfig config={config}>
      <Profile />
    </WagmiConfig>
  )
}
import { useAccount, useConnect, useDisconnect } from 'wagmi'
import { InjectedConnector } from 'wagmi/connectors/injected'

function Profile() {
  const { address } = useAccount()
  const { connect } = useConnect({
    connector: new InjectedConnector(),
  })
  const { disconnect } = useDisconnect()

  if (address)
    return (
      <div>
        Connected to {address}
        <button onClick={() => disconnect()}>Disconnect</button>
      </div>
    )
  return <button onClick={() => connect()}>Connect Wallet</button>
}

In this example, we create a wagmi config and pass it to the WagmiConfig React Context. The config is set up to use viem's Public Client and automatically connect to previously connected wallets.

Next, we use the useConnect hook to connect an injected wallet (e.g. MetaMask) to the app. Finally, we show the connected account's address with useAccount and allow them to disconnect with useDisconnect.

We've only scratched the surface for what you can do with wagmi!

Check out RainbowKit, ConnectKit or Web3Modal to get started with pre-built interface on top of wagmi for managing wallet connections.

Community

Check out the following places for more wagmi-related content:

Support

If you find wagmi useful, please consider supporting development. Thank you 🙏

Sponsors

Contributing

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

Authors

Thanks to julianhutton.eth (@julianjhutton) for providing the awesome logo!

License

MIT License