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

orra-sdk

v1.0.1

Published

SDK for AgentPay - Payment infrastructure for AI agents

Readme

AgentPay SDK ⚡

Official SDK for AgentPay - Payment infrastructure for AI agents.

Installation

npm install orra-sdk

Quick Start

import { AgentWallet } from 'orra-sdk'

const wallet = new AgentWallet({
  apiKey: process.env.AGENTPAY_KEY
})

// Check balance
const balance = await wallet.getBalance()
console.log(`Available: $${balance.remaining}`)

// Make a payment
const tx = await wallet.pay({
  to: '0xRecipientAddress...',
  amount: 0.50,
  reason: 'OpenAI API call'
})

console.log(`Transaction: ${tx.explorerUrl}`)

Features

  • Simple API - Three methods: getBalance(), pay(), payBatch()
  • TypeScript - Full type definitions included
  • Policy Aware - canPay() checks budget, daily limit, and per-tx max
  • Analytics - Track spending by category
  • Batch Payments - Pay multiple recipients at once

API Reference

Constructor

const wallet = new AgentWallet({
  apiKey: 'agp_your_key_here',      // Required
  baseUrl: 'https://...'            // Optional, for self-hosted
})

Methods

getBalance(): Promise<BalanceResponse>

Get wallet balance and status.

const balance = await wallet.getBalance()

console.log(balance)
// {
//   name: "Research Agent",
//   address: "0x...",
//   balance: 8.19,
//   budget: 100,
//   spent: 1.80,
//   remaining: 98.20,
//   dailyLimit: 20,
//   spentToday: 1.80,
//   maxPerTransaction: 5,
//   status: "active"
// }

canPay(amount: number): Promise<boolean>

Check if wallet can afford a specific amount (respects all policies).

if (await wallet.canPay(5.00)) {
  await wallet.pay({ to, amount: 5.00, reason: 'Purchase' })
} else {
  console.log('Cannot afford this payment')
}

pay(payment: PaymentRequest): Promise<PaymentResponse>

Make a single payment.

const tx = await wallet.pay({
  to: '0xRecipientAddress',
  amount: 0.50,
  reason: 'Market data API'  // Stored on-chain as memo
})

console.log(tx)
// {
//   success: true,
//   txHash: "0x...",
//   amount: 0.50,
//   to: "0x...",
//   reason: "Market data API",
//   category: "api",
//   memo: "ResearchA:Market data API",
//   explorerUrl: "https://explore.tempo.xyz/tx/0x..."
// }

payBatch(payments: PaymentRequest[]): Promise<BatchPaymentResponse>

Make multiple payments in one batch (up to 10).

const result = await wallet.payBatch([
  { to: addr1, amount: 0.30, reason: 'Pricing API' },
  { to: addr2, amount: 0.25, reason: 'Reviews API' },
  { to: addr3, amount: 0.50, reason: 'Market data' },
])

console.log(`${result.batch.successful}/${result.batch.total} succeeded`)
console.log(`Total spent: $${result.batch.totalAmount}`)

getAnalytics(): Promise<AnalyticsResponse>

Get spending analytics and transaction history.

const analytics = await wallet.getAnalytics()

// Spending by category
analytics.analytics.topCategories.forEach(cat => {
  console.log(`${cat.category}: $${cat.amount} (${cat.percentage}%)`)
})

// Recent transactions
analytics.recentTransactions.forEach(tx => {
  console.log(`${tx.reason}: -$${tx.amount}`)
})

Error Handling

import { AgentWallet, AgentPayError } from 'agentpay-sdk'

try {
  await wallet.pay({ to, amount: 1000 })
} catch (error) {
  if (error instanceof AgentPayError) {
    console.log(`Error: ${error.message}`)
    console.log(`Code: ${error.code}`)
    console.log(`Status: ${error.statusCode}`)
    
    // Common errors:
    // - "Would exceed daily limit ($20)"
    // - "Amount exceeds max per transaction ($5)"
    // - "Would exceed total budget ($100)"
  }
}

Use with AI Agents

LangChain Tool

import { AgentWallet } from 'agentpay-sdk'
import { Tool } from 'langchain/tools'

const wallet = new AgentWallet({ apiKey: process.env.AGENTPAY_KEY })

const paymentTool = new Tool({
  name: 'make_payment',
  description: 'Pay for a service or API. Input: JSON with to, amount, reason',
  func: async (input) => {
    const { to, amount, reason } = JSON.parse(input)
    
    if (!await wallet.canPay(amount)) {
      return 'Payment denied: exceeds spending policy'
    }
    
    const tx = await wallet.pay({ to, amount, reason })
    return `Payment successful: ${tx.explorerUrl}`
  }
})

OpenAI Function Calling

const functions = [
  {
    name: 'check_balance',
    description: 'Check the agent wallet balance',
    parameters: { type: 'object', properties: {} }
  },
  {
    name: 'make_payment',
    description: 'Make a payment from the agent wallet',
    parameters: {
      type: 'object',
      properties: {
        to: { type: 'string', description: 'Recipient address' },
        amount: { type: 'number', description: 'Amount in USD' },
        reason: { type: 'string', description: 'Reason for payment' }
      },
      required: ['to', 'amount']
    }
  }
]

// Handle function calls
async function handleFunction(name, args) {
  if (name === 'check_balance') {
    const balance = await wallet.getBalance()
    return `Balance: $${balance.balance}, Remaining budget: $${balance.remaining}`
  }
  
  if (name === 'make_payment') {
    const tx = await wallet.pay(args)
    return `Payment of $${tx.amount} successful. TX: ${tx.txHash}`
  }
}

Links

License

MIT