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

rein-sdk

v0.2.0

Published

Bounded payments for AI agents. One API key, on-chain spend caps.

Readme

rein-sdk

Bounded payments for AI agents. One API key. On-chain spend caps the caller can't bypass.

Install

npm install rein-sdk

(Post-hackathon this goes live on npm. Today it lives in the Rein-Arc repo; point your package.json at the GitHub path if you want to try it before publish:)

npm install github:Shunsuke0401/Rein-Arc#main

Quickstart

Get an API key: create an agent in the Rein dashboard, save the REIN_API_KEY from the one-shot credentials modal.

import { Rein } from "rein-sdk";

const rein = new Rein({ apiKey: process.env.REIN_API_KEY! });

const payment = await rein.payments.create({
  to: "0x5D262Ad5F60189Bb21Eb6cF6BCA7Db04F2C01518", // 0x address of a saved payee
  amountUsd: 50,
});

console.log(payment.status); // "confirmed"

What the caps enforce

Every API key is scoped by the permission you set at creation:

  • Per-payment cap — a single call over this amount is rejected by the smart account.
  • Monthly cap — approximated as N calls × per-payment, reset every 30 days.
  • Payee allow-list — if you saved payees, the to address must match one of them. Over-list recipients revert on-chain.

A Rein server compromise cannot widen these. They're pinned in the permission validator on-chain.

API

rein.payments.create({ to, amountUsd, note? })

Sends USDC to a recipient. to must be a raw 0x… address — labels are not accepted. Returns { id, status, amountUsd, to, createdAt }.

rein.agent.status()

Returns agent-level view: name, balance, spent this month, caps, remaining monthly allowance, status.

rein.agent.payees()

Returns saved payees for this permission as [{ id, label }]. Addresses are never returned.

rein.agent.activity({ limit? })

Returns the most recent payment activity as [{ timestamp, direction, counterpartyLabel, amountUsd, status }].

Errors

All SDK errors are ReinError instances with a typed code:

| Code | Meaning | |---|---| | INVALID_API_KEY | Missing, malformed, or revoked key. | | PERMISSION_CAP_EXCEEDED | Amount exceeds the per-payment cap. | | PAYEE_NOT_ALLOWED | Recipient not on the permission's payee allow-list. | | NOT_FOUND | Payee label or resource doesn't exist. | | NETWORK_ERROR | Timeout or transport failure. | | INTERNAL | Server error. |

import { Rein, ReinError } from "rein-sdk";

try {
  await rein.payments.create({
    to: "0x5D262Ad5F60189Bb21Eb6cF6BCA7Db04F2C01518",
    amountUsd: 99,
  });
} catch (err) {
  if (err instanceof ReinError && err.code === "PERMISSION_CAP_EXCEEDED") {
    console.error("Over cap:", err.message);
  }
}

Self-hosted base URL

Override baseUrl if you run your own Rein instance:

const rein = new Rein({
  apiKey: process.env.REIN_API_KEY!,
  baseUrl: "https://my-rein.example.com",
});