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

@basecred/agent-sdk

v0.1.0

Published

BaseCred Agent SDK — type-safe client for the BaseCred reputation API

Readme

@basecred/agent-sdk

Type-safe SDK for the BaseCred reputation API. Zero dependencies — uses global fetch (Node 18+).

Installation

npm install @basecred/agent-sdk
# or
pnpm add @basecred/agent-sdk

Quick Start

Check Owner Reputation (3 lines)

import { BasecredAgent } from "@basecred/agent-sdk"

const agent = new BasecredAgent({ apiKey: "bc_..." })
const result = await agent.checkOwner()
console.log(result.summary)
// "Your reputation is strong. You have high trust on Ethos, ..."

Full Registration Flow

import { BasecredAgent } from "@basecred/agent-sdk"

// 1. Register your agent (no API key needed)
const registration = await BasecredAgent.register({
  agentName: "MyBot",
  telegramId: "@mybot",
  ownerAddress: "0x...",
})

// 2. SAVE THE API KEY — it will not be shown again
console.log("API Key:", registration.apiKey)
console.log("Send to owner:", registration.claimUrl)

// 3. Wait for owner verification (polls every 5s, up to 1 hour)
const status = await registration.waitUntilVerified()
console.log("Verified!", status)

// 4. Or submit the tweet URL programmatically
await registration.verify("https://x.com/user/status/123456789")

Error Handling

import { BasecredAgent, RateLimitError, AuthError } from "@basecred/agent-sdk"

try {
  const agent = new BasecredAgent({ apiKey: "bc_..." })
  const result = await agent.checkOwner()
} catch (error) {
  if (error instanceof RateLimitError) {
    console.log(`Rate limited. Retry in ${error.retryAfter}s`)
  } else if (error instanceof AuthError) {
    console.log("Invalid API key")
  }
}

Public Endpoints (No Auth)

const agent = new BasecredAgent({ apiKey: "bc_..." })

const contexts = await agent.getContexts()
const policies = await agent.getPolicies()
const feed = await agent.getFeed()
const stats = await agent.getStats()

API Reference

new BasecredAgent(config)

| Option | Type | Default | Description | |--------|------|---------|-------------| | apiKey | string | required | API key (starts with bc_) | | baseUrl | string | https://www.zkbasecred.xyz | API base URL | | fetch | typeof fetch | globalThis.fetch | Custom fetch implementation | | timeoutMs | number | 120000 | Request timeout in ms |

Instance Methods

| Method | Auth | Description | |--------|------|-------------| | checkOwner() | Yes | Check owner's reputation (ZK proofs + on-chain) | | getContexts() | No | List decision contexts | | getPolicies() | No | List policies with hashes | | getFeed(limit?) | No | Get global activity feed | | getStats() | No | Get protocol statistics |

Static Methods

| Method | Description | |--------|-------------| | BasecredAgent.register(input, options?) | Register a new agent | | BasecredAgent.checkRegistration(claimId, options?) | Check registration status |

Registration

Returned by BasecredAgent.register().

| Property | Type | Description | |----------|------|-------------| | apiKey | string | The API key (save this!) | | claimId | string | Claim ID for polling | | claimUrl | string | URL for owner to verify | | verificationCode | string | Code for the verification tweet |

| Method | Description | |--------|-------------| | poll(options?) | Async generator yielding status updates | | waitUntilVerified(options?) | Resolves when verified, rejects on timeout/expire/revoke | | verify(tweetUrl) | Submit tweet URL for verification |

Error Classes

All errors extend BasecredError:

| Class | Status | When | |-------|--------|------| | AuthError | 401 | Invalid/missing API key | | RateLimitError | 429 | Rate limit exceeded (has retryAfter) | | ValidationError | 400 | Bad request parameters | | NotFoundError | 404 | Resource not found | | ServiceUnavailableError | 503 | Service temporarily down | | ServerError | 5xx | Unexpected server error | | NetworkError | — | Fetch failed, timeout |

Runtime Requirements

  • Node.js 18+ (uses global fetch)
  • Server-side only — API keys are visible in browser DevTools. Use this SDK in server runtimes, background agents, or serverless functions.

License

MIT