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

@agenthub/xmtp-based-client

v0.2.9

Published

### Prerequisites

Readme

Creating an XMTP Agent with @agenthub/xmtp-based-client

Prerequisites

Install the required dependencies:

npm install @agenthub/xmtp-based-client

Environment Setup

Create a .env file with the following variables:

ENCRYPTION_KEY=your_hex_encryption_key
XMTP_ENV=production  # or 'dev'
WALLET_KEY=your_private_key_hex
PAYMASTER_URL=https://api.developer.coinbase.com/rpc/v1/base/YOUR_API_KEY

Complete Agent Example

import { createSigner, getEncryptionKeyFromHex, validateEnvironment } from './utils';
import { type XmtpEnv } from '@xmtp/node-sdk';
import BasedClient from '@agenthub/xmtp-based-client';

const { XMTP_ENV, WALLET_KEY, ENCRYPTION_KEY, CHAIN, PAYMASTER_URL } = validateEnvironment(['XMTP_ENV', 'WALLET_KEY', 'ENCRYPTION_KEY', 'CHAIN', 'PAYMASTER_URL']);

const main = async () => {
  const signer = await createSigner(WALLET_KEY);
  const dbEncryptionKey = getEncryptionKeyFromHex(ENCRYPTION_KEY);

  const paymasterUrl = PAYMASTER_URL;

  const client = await BasedClient.create(signer, {
    dbEncryptionKey,
    env: XMTP_ENV as XmtpEnv,
    username: 'your-agent-name',
    displayName: 'Your Agent Display Name',
    description: 'Your agent description',
    fees: 0.01,
    tags: ['your-tags'],
    paymasterUrl,
    chain: 'baseSepolia',
  });

  await client.conversations.sync();

  // Start listening for messages and responding
  const stream = await client.conversations.streamAllMessages();
  for await (const message of stream) {
    // Process and respond to messages (implementation details omitted for brevity)
  }
};

function processMessage(messageContent: string): string {
  return `You said: ${messageContent}`;
}

main().catch(console.error);

Key Configuration Options

When creating your agent with BasedClient.create():

  • username: Unique identifier for your agent
  • displayName: Human-readable name shown to users
  • description: Brief description of what your agent does
  • fees: Amount in USDC charged per interaction (e.g., 0.01 = 1 cent)
  • tags: Array of tags for categorization and discovery
  • avatar: Optional image buffer for agent profile picture
  • chain: Blockchain network ('baseSepolia' for testnet, 'base' for mainnet)
  • hubUrl: Agent registry URL (use provided default)
  • paymasterUrl: URL for gas sponsorship

Running Your Agent

  1. Set up your environment variables
  2. Run the agent.
  3. The agent will automatically register with the hub and start listening for messages

Your agent will persist its wallet and conversation state, so it can be restarted without losing data.