Graz

October 8, 2025 ยท View on GitHub

graz

npm/v npm/dt stars

graz is a collection of React hooks containing everything you need to start working with the Cosmos ecosystem.

Features

  • ๐Ÿช 20+ hooks for interfacing with wallets, clients, signers, etc. (connecting, view balances, send tokens, etc.)
  • ๐Ÿ’ณ Multiple wallet supports (Keplr, Leap, Cosmostation, Vectis, Station, XDefi, Metamask Snap, WalletConnect, Compass, Initia, OKX, Para)
  • โš™๏ธ Generate mainnet & testnet ChainInfo
  • ๐Ÿ“š Built-in caching, request deduplication, and all the good stuff from @tanstack/react-query and zustand
  • ๐Ÿ”„ Auto refresh on wallet and network change
  • ๐Ÿ‘ Fully typed and tree-shakeable
  • ๐Ÿ“ฆ Lightweight and optimized (only ~220 KB package size)
  • โšก๏ธ Optimized build system for fast development and production builds
  • ...and many more โœจ

Requirements

graz requires react@>=17 due to using function components and hooks and the new JSX transform.

Installing

Install graz using npm, yarn, or pnpm:

# using npm
npm install graz

# using yarn
yarn add graz

# using pnpm
pnpm add graz

Install peer dependencies

To avoid version missmatch we dcided to make these packages as peer dependencies

# using npm
npm install @cosmjs/cosmwasm-stargate @cosmjs/proto-signing @cosmjs/stargate @cosmjs/encoding

# using yarn
yarn add @cosmjs/cosmwasm-stargate @cosmjs/proto-signing @cosmjs/stargate @cosmjs/encoding

# using pnpm
pnpm add @cosmjs/cosmwasm-stargate @cosmjs/proto-signing @cosmjs/stargate @cosmjs/encoding

Quick start

Wrap your React app with <QueryClientProvider /> and <GrazProvider />, and use available graz hooks anywhere:

import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { GrazProvider } from "graz";

const queryClient = new QueryClient();

const cosmoshub: ChainInfo = {
  chainId: "cosmoshub-4",
  chainName: "Cosmos Hub",
  //... rest of cosmoshub ChainInfo
}

function App() {
  return (
    <QueryClientProvider queryClient={queryClient}>
      <GrazProvider grazOptions={{
        chains: [cosmoshub]
      }}>
        <Wallet />
      </GrazProvider>
    </QueryClientProvider>
  );
}
import { mainnetChains, useAccount, useConnect, useDisconnect } from "graz";

function Wallet() {
  const { connect, status } = useConnect();
  const { data: account, isConnected } = useAccount();
  const { disconnect } = useDisconnect();

  function handleConnect() {
    return isConnected ? disconnect() : connect();
  }

  return (
    <div>
      {account ? `Connected to ${account.bech32Address}` : status}
      <button onClick={handleConnect}>{isConnected ? "Disconnect" : "Connect"}</button>
    </div>
  );
}

Examples

  • Playground (Next.js + Multi-Chain) - Full-featured demo with multi-chain support and modern UI (source code)
  • Vite - Simple Vite app showcasing core functionality (source code)

Why Developers Love Graz

  • ๐ŸŽฏ Simple & Intuitive API - Get started in minutes with well-designed hooks that follow React best practices
  • ๐Ÿš€ Production Ready - Battle-tested in production apps across the Cosmos ecosystem
  • ๐Ÿ“– Excellent Documentation - Comprehensive guides, examples, and API references to help you build faster
  • ๐Ÿ”ง Developer Experience - TypeScript support, autocomplete, and helpful error messages make development a breeze
  • ๐Ÿค Active Maintenance - Regular updates, bug fixes, and new features based on community feedback
  • ๐ŸŒŸ Ecosystem Integration - Built on proven tools like TanStack Query and Zustand for reliability
  • โšก๏ธ Performance Focused - Optimized for speed with smart caching, request deduplication, and minimal re-renders
  • ๐Ÿ”„ Multi-Chain First - Designed from the ground up to support multi-chain applications seamlessly

Graz powers some of the most popular applications in the Cosmos ecosystem:

  • dYdX - Leading decentralized exchange for perpetual trading
  • Stargaze - The premier Cosmos NFT marketplace
  • Skip Go - Cross-chain swaps and bridging infrastructure

Want to add your project? Submit a PR or open an issue!

API

You can read more about available hooks and exports on Documentation Site or via paka.dev.

Maintainers

License

MIT License, Copyright (c) 2023 Graz