Introduction

wankmi

React hooks for Solana. Inspired by wagmi (opens in a new tab), built for the Sealevel ecosystem.

wankmi gives you a set of composable, type-safe React hooks that make it easy to connect wallets, read on-chain data, and send transactions — all powered by TanStack Query (opens in a new tab) for caching and background refetching.

npm install @wankmi/wankmi

Features

  • 🔌 Wallet adapters for Phantom, Backpack, and Solflare
  • TanStack Query under the hood — automatic caching, refetching, and loading states
  • 🪝 Composable hooksuseWallet, useSolBalance, useTokenAccounts, and more
  • 🔒 Type-safe — full TypeScript support
  • 🌐 Devnet / Mainnet — configurable RPC endpoint

Quick example

import { WankmiProvider, useWallet, useSolBalance } from '@wankmi/wankmi'
 
function App() {
  return (
    <WankmiProvider endpoint="https://api.devnet.solana.com">
      <Wallet />
    </WankmiProvider>
  )
}
 
function Wallet() {
  const { connect, publicKey, connected } = useWallet()
  const { data: balance } = useSolBalance({ address: publicKey })
 
  if (!connected) return <button onClick={connect}>Connect</button>
 
  return (
    <p>
      {publicKey?.toBase58()} — {balance} SOL
    </p>
  )
}

wankmi is in active development. APIs may change before v1.0. Always check the changelog (opens in a new tab) when upgrading.


Package

npm@wankmi/wankmi
GitHubwank-mi/wankmi (opens in a new tab)
LicenseMIT