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

@agenticwallet/js

v0.1.0

Published

AgentWallet TypeScript/React SDK

Readme

@agenticwallet/js

TypeScript/React SDK for AgentWallet — a metered proxy to the Anthropic API with multi-tenant support, JWT auth, and credit-based billing.

Install

npm install @agenticwallet/js

Browser Usage

AgentWalletProvider

Wrap your app with the provider to access wallet functionality:

import { AgentWalletClient, AgentWalletProvider } from '@agenticwallet/js';

const client = new AgentWalletClient('https://wallet.example.com', token);

export function App() {
  return (
    <AgentWalletProvider client={client}>
      <YourApp />
    </AgentWalletProvider>
  );
}

BalanceBadge

Display the current balance. Refreshes automatically on window focus:

import { BalanceBadge } from '@agenticwallet/js';

export function Header() {
  return <BalanceBadge />;
}

BuyCreditsButton

Open Stripe Checkout for credit purchases. Balance updates automatically after redirect:

import { BuyCreditsButton } from '@agenticwallet/js';

export function CreditShop() {
  return (
    <BuyCreditsButton
      pack={{ price_cents: 9999, points: 1000 }}
      successUrl={window.location.href}
      cancelUrl={window.location.href}
    />
  );
}

createWalletedAnthropic

Wrap the Anthropic SDK to route messages through AgentWallet:

import { createWalletedAnthropic, useAgentWallet } from '@agenticwallet/js';

export function ChatComponent() {
  const { client } = useAgentWallet();
  const anthropic = createWalletedAnthropic(client);

  const handleSend = async (message: string) => {
    const response = await anthropic.messages.create({
      model: 'claude-3-5-sonnet-20241022',
      max_tokens: 1024,
      messages: [{ role: 'user', content: message }],
    });
    // Balance updates after response is processed
  };

  return <div>Chat UI</div>;
}

Node.js Usage

The Node.js build includes mintUserJwt for server-side token generation (e.g., Firebase Cloud Functions):

import { mintUserJwt } from '@agenticwallet/js';

export const mintAgentWalletToken = async (sharedSecret: string, tenantId: string, userId: string) => {
  const token = mintUserJwt(sharedSecret, tenantId, userId, 900); // 15-min TTL
  return { token };
};

Firebase Functions example:

import * as functions from 'firebase-functions';
import { mintUserJwt } from '@agenticwallet/js';

export const mintAgentWalletToken = functions.https.onCall(async (data, context) => {
  if (!context.auth) {
    throw new functions.https.HttpsError('unauthenticated', 'Must be authenticated');
  }
  const sharedSecret = functions.config().agentwallet.shared_secret;
  const tenantId = functions.config().agentwallet.tenant_id;
  const token = mintUserJwt(sharedSecret, tenantId, context.auth.uid, 900);
  return { token };
});

API Reference

  • AgentWalletClient(baseUrl, token) — Create a client. Update token via client.setToken(newToken) for JWT refresh.
  • AgentWalletProvider — React context provider. Exposes useAgentWallet() hook.
  • BalanceBadge — Component displaying current balance. Requires AgentWalletProvider.
  • BuyCreditsButton — Component for Stripe Checkout. Requires AgentWalletProvider.
  • createWalletedAnthropic(client) — Returns an Anthropic SDK instance routed through AgentWallet.
  • mintUserJwt(sharedSecret, tenantId, userId, ttlSeconds?) — Generate HS256 JWT (Node only).

More Info

See the AgentWallet service documentation for complete architecture and integration guides.