Skip to content

graz-sh/graz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Graz

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

Featured Projects Using Graz

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