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

@tipchatteam/react

v0.1.4

Published

React hooks and context for TipChat integration

Downloads

58

Readme

@tipchatteam/react

npm version License: MIT Bundle Size

React hooks and context provider for integrating TipChat into React applications.

Installation

npm install @tipchatteam/react @tipchat/core

react and react-dom (>=18.0.0) are required as peer dependencies.

Quick Start

1. Create a client and wrap your app

import { TipChatClient } from '@tipchat/core';
import { TipChatProvider } from '@tipchatteam/react';

const client = new TipChatClient({
  baseUrl: 'https://tipchat-api.onrender.com',
  tenantId: 'your-tenant-id',
  walletProvider: {
    getAddress: () => wallet.address,
    signMessage: (msg) => wallet.signMessage(msg),
  },
});

function App() {
  return (
    <TipChatProvider value={client}>
      <ChatPage />
    </TipChatProvider>
  );
}

2. Use hooks in your components

import { useChat } from '@tipchatteam/react';

function ChatRoom({ conversationId }: { conversationId: string }) {
  const {
    messages,
    loading,
    send,
    retry,
    dismiss,
    sending,
    typingUsers,
    sendTyping,
  } = useChat(conversationId, {
    cache: true,       // localStorage caching with stale-while-revalidate
    optimistic: true,  // instant UI feedback before server confirms
    realtime: true,    // SSE subscription with polling fallback
  });

  const handleSend = async (text: string) => {
    await send({ content: text, messageType: 'text' });
  };

  return (
    <div>
      {messages.map((msg) => (
        <div key={msg.id}>{msg.content}</div>
      ))}
      {typingUsers.length > 0 && (
        <p>{typingUsers.map(u => u.displayName || u.walletAddress).join(', ')} typing...</p>
      )}
      <input
        onChange={() => sendTyping()}
        onKeyDown={(e) => {
          if (e.key === 'Enter') handleSend(e.currentTarget.value);
        }}
      />
    </div>
  );
}

Hooks

useChat(conversationId, options?) -- Recommended

The all-in-one chat hook. Combines messages, sending, optimistic updates, caching, real-time subscription, and typing indicators into a single hook.

| Return Value | Type | Description | |-------------|------|-------------| | messages | (Message \| OptimisticMessage)[] | All messages sorted chronologically, including pending optimistic ones | | loading | boolean | Whether the initial fetch is in progress | | error | string \| null | Current error message, if any | | send | (payload) => Promise<Message> | Send a message (optimistic if enabled) | | retry | (localId) => Promise<Message> | Retry a failed optimistic message | | dismiss | (localId) => void | Remove a failed optimistic message from the list | | sending | boolean | Whether a message is currently being sent | | pendingCount | number | Number of pending optimistic messages | | typingUsers | TypingUser[] | Users currently typing (excludes self) | | sendTyping | () => void | Broadcast typing status (debounced internally) | | refresh | () => Promise<void> | Force re-fetch messages from server | | walletAddress | string | Current user's resolved wallet address |

Options:

| Option | Type | Default | Description | |--------|------|---------|-------------| | cache | boolean | true | Enable localStorage caching | | optimistic | boolean | true | Enable optimistic message updates | | realtime | boolean | true | Enable SSE/polling real-time subscription | | pollMs | number | 1500 | Polling interval fallback in milliseconds | | limit | number | 100 | Number of messages to fetch initially |

useConversations(limit?, offset?)

Fetch the list of conversations for the current wallet.

| Return Value | Type | Description | |-------------|------|-------------| | data | ListConversationsResponse \| null | Conversations with metadata | | loading | boolean | Loading state | | error | string \| null | Error message | | refresh | () => Promise<void> | Re-fetch conversations |

useMessages(conversationId, options?)

Fetch messages for a conversation with optional polling.

| Return Value | Type | Description | |-------------|------|-------------| | data | ListMessagesResponse \| null | Messages with pagination | | loading | boolean | Loading state | | error | string \| null | Error message | | refresh | () => Promise<void> | Re-fetch messages |

useSendMessage()

Send a message to a conversation.

| Return Value | Type | Description | |-------------|------|-------------| | send | (conversationId, payload) => Promise<Message> | Send function | | sending | boolean | Whether a send is in flight | | error | string \| null | Error message |

useSendTipMessage()

Execute an on-chain tip and post the corresponding tip message.

| Return Value | Type | Description | |-------------|------|-------------| | sendTipMessage | (input) => Promise<{ txHash?, messageId }> | Send tip function | | sending | boolean | Whether a tip is in flight | | error | string \| null | Error message |

useRealtimeMessages(conversationId, onMessage, intervalMs?)

Subscribe to real-time messages via SSE/polling. Automatically cleans up on unmount.

useTypingIndicator(conversationId, options?)

Standalone typing indicator hook for when you want typing indicators without the full useChat hook.

| Return Value | Type | Description | |-------------|------|-------------| | typingUsers | TypingUser[] | Users currently typing | | sendTyping | () => void | Broadcast typing (debounced) |

TipChatProvider

React context provider that makes the TipChatClient available to all hooks.

useTipChatClient()

Access the TipChatClient instance from context. Throws if no provider is found.

Documentation

Full documentation and guides are available at tipchat.dev.

License

MIT