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

hosannaith-client

v0.4.1

Published

Tiny client for the Hosannaith x402 reliability oracle on Algorand — pay-per-call endpoint reliability scores.

Readme

hosannaith-client

A tiny client for the Hosannaith x402 reliability oracle on Algorand. Get a verified reliability score (uptime, correct-402 behaviour, latency) for any x402 endpoint — before you route real USDC to it. The client handles the full x402 pay-per-call handshake for you.

TL;DR — stop paying dead endpoints. Wrap your x402 paying fetch once and every endpoint is vetted before a cent moves: wrapFetchWithReliabilityGuard(payingFetch, { mnemonic, minScore }). Jump to the guard ↓

Install

npm i hosannaith-client @x402/core @x402/fetch @x402/avm

The @x402/* packages are peer dependencies — install them alongside. algosdk is a regular dependency and is pulled in automatically.

Use

import { getReliability } from 'hosannaith-client';

const result = await getReliability('https://some-x402-endpoint/api', {
  mnemonic: process.env.AVM_MNEMONIC!,   // 25-word Algorand mnemonic, funded with USDC
});

console.log(result.score, result.detail.confidence);
// 98.7 "history"

Scoring several endpoints? Reuse one client (builds the signer once):

import { HosannaithClient } from 'hosannaith-client';

const oracle = new HosannaithClient({ mnemonic: process.env.AVM_MNEMONIC! });
for (const url of endpoints) {
  const r = await oracle.getReliability(url);
  if (r.score !== null && r.score < 60) console.warn(`${url} looks unreliable (${r.score})`);
}

Score a whole watchlist in one call (batch)

Scoring many endpoints? One paid batch call ($7 flat) scores up to 50 at once, instead of 50 separate payments. Monitored targets return a full score; a target with no history yet comes back unknown and is enrolled for monitoring.

import { getReliabilityBatch } from 'hosannaith-client';

const batch = await getReliabilityBatch(
  ['https://a.example/x402', 'https://b.example/x402', 'https://c.example/x402'],
  { mnemonic: process.env.AVM_MNEMONIC! },
);

console.log(`${batch.count} scored`);
const trustworthy = batch.results.filter((r) => r.status === 'pass').map((r) => r.target);

Guard every payment automatically

Don't want to remember to check? Wrap your paying fetch once, and every endpoint is vetted before any USDC moves — a low-scoring endpoint is refused (or warned on) automatically. Scores are cached per endpoint, so repeated payments to the same endpoint reuse one check.

import { wrapFetchWithReliabilityGuard } from 'hosannaith-client';
import { wrapFetchWithPayment, x402Client } from '@x402/fetch';

const paying = wrapFetchWithPayment(fetch, x402client);          // your x402 payer
const safe = wrapFetchWithReliabilityGuard(paying, {
  mnemonic: process.env.AVM_MNEMONIC!,   // funds the reliability checks
  minScore: 90,                          // refuse anything below this
  // mode: 'warn',                       // or just log and proceed (default: 'block')
  // cacheTtlMs: 15 * 60 * 1000,         // reuse a score for 15 min (default)
  onDecision: (d) => console.log(`[guard] ${d.url}: ${d.reason}`),
});

// From here on, every call is checked, then paid. A failing endpoint throws
// ReliabilityGuardError (in block mode) before a cent leaves your wallet.
await safe('https://some-x402-endpoint/api');

Options: minScore (default 90), mode ('block' | 'warn', default 'block'), cacheTtlMs (default 15 min), onUnknown/onError ('allow' | 'block' — both default 'allow', so an oracle outage never breaks your payments), shouldGuard (filter which requests to check), and onDecision (observe every verdict — handy for metrics or chaining another check like identity).

The guard's own checks are paid via x402, so mnemonic must be a funded, USDC-opted-in account.

What you get back

{
  "target": "https://some-x402-endpoint/api",
  "status": "pass",
  "score": 98.7,
  "detail": {
    "observations": 1439,
    "uptimePct": 100,
    "correct402Pct": 100,
    "p50LatencyMs": 88,
    "p95LatencyMs": 127,
    "p99LatencyMs": 210,
    "confidence": "history",
    "availability_pct": 100,
    "error_rate_pct": 0,
    "protocol_conformance_pct": 100,
    "score_normalized": 0.987
  }
}

availability_pct, error_rate_pct, protocol_conformance_pct and score_normalized are the same measurements in OpenEAGO SLO terms; see the field reference.

confidence is "history" when the score is backed by accumulated monitoring, or "one-shot" for a target queried for the first time (a single live probe, score: null).

Signed results are verified for you

Every Hosannaith result is signed with the oracle's published key. The client checks that signature before it returns anything, so an altered or forged score never reaches your code.

import { getReliability, getVerification, HosannaithVerificationError } from 'hosannaith-client';

try {
  const r = await getReliability(url, { mnemonic });
  getVerification(r); // 'verified' (or 'jwks_unavailable' if the key list couldn't be fetched)
} catch (err) {
  if (err instanceof HosannaithVerificationError) {
    // err.reason: 'signature_invalid' | 'signature_missing' | 'unknown_kid' | 'revoked_kid' | ...
  }
}

| verify | Bad, missing or revoked signature | Key list unreachable | |---|---|---| | 'auto' (default) | throws HosannaithVerificationError | result returned, marked jwks_unavailable | | 'strict' | throws | throws | | 'off' | not checked | not checked |

The result object is never modified, so you can store or forward it and anyone can verify it again later. In the guard, a score whose signature fails is always refused, whatever onError says: a forged "pass" is exactly the attack signing exists to stop. Each GuardDecision records how its score was verified in decision.verification.

Requirements

  • An Algorand MainNet account funded with USDC (each check is $1.00, or $7.00 for a batch of up to 50) and ALGO for fees.
  • Its 25-word mnemonic, passed as mnemonic. Never commit it — load it from an env var or a secret store.

Live service: https://hosannaith.com · Endpoint: https://api.hosannaith.com/reliability?target=<url>

License

Licensed under the Apache License, Version 2.0. See NOTICE.

Earlier releases were published under the MIT License and remain available under its terms: hosannaith-client 0.3.0 and earlier.