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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dngbuilds/zapkit-react

v0.1.6

Published

React hooks and provider for Starknet — wallet connection in minutes, not hours.

Readme


Overview

@dngbuilds/zapkit-react provides a <ZapProvider> context and a set of React hooks for connecting wallets, fetching balances, staking, swapping, and bridging on Starknet. It builds on top of @dngbuilds/zapkit-core and uses TanStack Query for data fetching.

Installation

npm install @dngbuilds/zapkit-react

@dngbuilds/zapkit-core is included as a dependency — you don't need to install it separately.

Quick Start

1. Wrap your app with <ZapProvider>

import { ZapProvider } from "@dngbuilds/zapkit-react";

function App() {
  return (
    <ZapProvider config={{ network: "mainnet" }}>
      <YourApp />
    </ZapProvider>
  );
}

2. Connect a wallet

import { useWallet, OnboardStrategy } from "@dngbuilds/zapkit-react";

function ConnectButton() {
  const { address, status, connect, disconnect } = useWallet();

  if (status === "connected") {
    return (
      <div>
        <p>{address}</p>
        <button onClick={disconnect}>Disconnect</button>
      </div>
    );
  }

  return (
    <button
      disabled={status === "connecting"}
      onClick={() => connect({ strategy: OnboardStrategy.Cartridge })}
    >
      {status === "connecting" ? "Connecting…" : "Connect Wallet"}
    </button>
  );
}

3. Fetch balances

import { useBalance } from "@dngbuilds/zapkit-react";

function Balance() {
  const { data, isLoading } = useBalance({
    token: { symbol: "ETH", address: "0x049d…" },
  });

  if (isLoading) return <p>Loading…</p>;
  return <p>ETH: {data?.toString()}</p>;
}

Provider

<ZapProvider>

Wraps your application and initializes ZapKit + TanStack Query.

<ZapProvider
  config={{ network: "mainnet" }}
  queryClient={customQueryClient} // optional — bring your own
  showDevPanel={false} // optional — error overlay for dev
>
  <App />
</ZapProvider>

| Prop | Type | Default | Description | | -------------- | -------------- | ------- | ----------------------------- | | config | ZapKitConfig | — | Network and SDK configuration | | queryClient | QueryClient | auto | Custom TanStack Query client | | showDevPanel | boolean | false | Show developer error panel |

Hooks

useWallet()

Returns wallet connection state and actions.

const {
  address, // string | null — connected wallet address
  ens, // string | null — resolved StarkNet ID
  status, // "idle" | "connecting" | "connected" | "error"
  balances, // Record<string, string>
  loading, // boolean
  error, // Error | null
  connect, // (options: OnboardOptions) => Promise<void>
  disconnect, // () => void
  ensureReady, // () => Promise<void>
} = useWallet();

useZapKit()

Returns the raw ZapKit instance for advanced use cases.

const zapkit = useZapKit();
await zapkit?.stake({ poolAddress: "0x…", amount });

Query Hooks (TanStack Query)

| Hook | Description | | --------------------- | ------------------------------ | | useBalance() | Fetch token balance | | useStakingPools() | List available staking pools | | useBridgingTokens() | List available bridging tokens |

Mutation Hooks (TanStack Query)

| Hook | Description | | -------------- | ------------------------------- | | useSwap() | Execute a token swap | | useStaking() | Stake / unstake / claim rewards | | useLending() | Lending protocol interactions |

Pre-built UI Components

ZapKit also provides a set of ready-to-use shadcn components you can install directly into your project:

npx shadcn@latest add "https://zapkit.vercel.app/r/connect-wallet-button.json"
npx shadcn@latest add "https://zapkit.vercel.app/r/wallet-card.json"

Available components: connect-wallet-button, address-badge, network-badge, wallet-card, token-amount, transaction-status.

Browse the full registry at zapkit.vercel.app.

Re-exported from Core

For convenience, the following are re-exported from @dngbuilds/zapkit-core:

// Values
export { OnboardStrategy, Amount, fromAddress, StarkSigner };
export { Tx, TxBuilder, ChainId, ExternalChain, BridgeToken };
export { getPresets, accountPresets };

// Types
export type { OnboardOptions, OnboardResult, Token, Pool, Address, Wallet };
export type { CartridgeWalletInterface, ConnectCartridgeOptions };
export type { EnsureReadyOptions, ExecuteOptions, RpcProvider, Call };

Wallet Strategies

| Strategy | Import | Description | | --------- | --------------------------- | ----------------------------- | | Cartridge | OnboardStrategy.Cartridge | Social login & passkeys | | Signer | OnboardStrategy.Signer | Direct private-key signing | | Privy | OnboardStrategy.Privy | Email & social auth via Privy |

Vite Configuration

Add the ZapKit Vite plugin to resolve optional peer dependencies:

// vite.config.ts
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { zapkitPlugin } from "@dngbuilds/zapkit-core/vite";

export default defineConfig({
  plugins: [react(), zapkitPlugin()],
});

License

MIT