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

@tuwaio/pulsar-react

v0.2.4

Published

Provides React bindings for the Pulsar Engine, including the essential `useInitializeTransactionsPool` hook to resume tracking pending transactions after a page reload.

Readme

Pulsar React

NPM Version License Build Status

Official React bindings for the Pulsar Engine. This package provides the essential useInitializeTransactionsPool hook to seamlessly integrate Pulsar's state with your application's lifecycle.


🏛️ What is @tuwaio/pulsar-react?

This package is the official bridge between the framework-agnostic @tuwaio/pulsar-core and a React application. It provides hooks and utilities that simplify the process of connecting Pulsar's state management to the React component lifecycle.

Its primary role is to ensure that transaction tracking can resume reliably after a page reload.


💾 Installation

To use this package, you need the complete Pulsar stack, including @wagmi/core for EVM interactions.

# Using pnpm
pnpm add @tuwaio/pulsar-react react

# Using npm
npm install @tuwaio/pulsar-react react

# Using yarn
yarn add @tuwaio/pulsar-react react

🚀 Getting Started

The recommended way to integrate Pulsar with React is to create a vanilla store instance, create a bounded hook for it, and then use useInitializeTransactionsPool in your main layout component.

Here is a complete step-by-step example:

Step 1: Create the Pulsar Store and Hook

First, create your vanilla Pulsar store and a reusable, bounded hook to access it. This pattern is recommended by Zustand for type safety and ease of use.

// src/hooks/txTrackingHooks.ts
import { createBoundedUseStore, createPulsarStore, Transaction } from '@tuwaio/pulsar-core';
import { evmAdapter } from '@tuwaio/pulsar-evm';

import { appChains, config } from '@/configs/wagmiConfig';

const storageName = 'transactions-tracking-storage';

export enum TxType {
  example = 'example',
}

type ExampleTx = Transaction & {
  type: TxType.example;
  payload: {
    value: number;
  };
};

export type TransactionUnion = ExampleTx;

export const usePulsarStore = createBoundedUseStore(
  createPulsarStore<TransactionUnion>({
    name: storageName,
    adapter: evmAdapter(config, appChains),
  }),
);

Step 2: Initialize the Store in Your App

Create a small, client-side component that uses the useInitializeTransactionsPool hook. This component's job is to re-activate trackers for pending transactions when the app loads.

// src/components/PulsarInitializer.tsx
'use client';

import { useInitializeTransactionsPool } from '@tuwaio/pulsar-react';
import { usePulsarStore } from '../hooks/txTrackingHooks';

export const PulsarInitializer = () => {
  // Get the initialization function from the store via our custom hook
  const initializeTransactionsPool = usePulsar((state) => state.initializeTransactionsPool);

  // Pass the function to the hook from this package
  useInitializeTransactionsPool({ initializeTransactionsPool });

  return null; // This component renders nothing to the DOM
};

Step 3: Add the Initializer to Your Root Layout

Finally, place the PulsarInitializer component at a high level in your application tree (e.g., in your root layout or providers component) so it runs on every page load.

// src/app/layout.tsx (Next.js example)
import { WagmiProvider } from 'wagmi';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { wagmiConfig } from '../configs/wagmi';
import { PulsarInitializer } from '../components/PulsarInitializer';

const queryClient = new QueryClient();

export default function RootLayout({ children }) {
  return (
    <html lang="en">
      <body>
        <WagmiProvider config={wagmiConfig}>
          <QueryClientProvider client={queryClient}>
            <PulsarInitializer />
            {children}
          </QueryClientProvider>
        </WagmiProvider>
      </body>
    </html>
  );
}

With this setup, your application is now fully configured to track transactions and resume tracking across page reloads.


📖 API Reference

useInitializeTransactionsPool(params)

This is the primary hook exported by this package. Its sole purpose is to re-initialize the transaction store on component mount.

Parameters

The hook accepts a single object with the following properties:

  • initializeTransactionsPool: () => Promise<void>: (Required) The initialization function obtained from your Pulsar store.
  • onError?: (error: Error) => void: (Optional) A callback function to handle any errors that occur during initialization. If not provided, errors will be logged to the console.

🤝 Contributing & Support

Contributions are welcome! Please read our main Contribution Guidelines.

If you find this library useful, please consider supporting its development. Every contribution helps!

➡️ View Support Options

📄 License

This project is licensed under the Apache-2.0 License - see the LICENSE file for details.