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

@accord-protocol/rails-base

v0.4.1

Published

Accord rail adapter for the Base / EVM Note primitive (AgentPayReserveV0). verifyPayment fetches the Note from the Solidity contract, checks expiry / receiver binding / task-hash / value; settle calls redeemNote and emits a v0 Settlement Receipt with mode

Readme

@accord-protocol/rails-base

Accord rail adapter for the Base / EVM Note primitive, backed by the legacy AgentPayReserveV0 Solidity contract. Implements AccordRailAdapter by reading a Note from the Solidity contract, checking expiry / receiver binding / task-hash / value, then redeeming or refunding.

This is the canonical Accord-facing package for the Base rail. The underlying reference SDK is agentpay-base, which keeps its legacy npm name for bytecode/audit continuity; new integrations should import this package, not agentpay-base directly.

Install

npm install @accord-protocol/rails-base @accord-protocol/rails @accord-protocol/core
# plus the EVM Note SDK (peer dep):
npm install agentpay-base

Usage

import { BaseAgentPay } from "agentpay-base";
import { createBaseRailAdapter } from "@accord-protocol/rails-base";
import { accordGateway } from "@accord-protocol/gateway";

const baseAgent = new BaseAgentPay({
  reserveAddress: "0x…",
  network: "base-sepolia",
  walletClient,
});

const rail = createBaseRailAdapter({ ops: baseAgent });

app.post("/api/run", accordGateway({
  rail,
  resolveAgreement,
  buildAgreementTemplate,
  handler: async (req, { agreement, body }) => ({ /* … */ }),
}));

The adapter never imports agentpay-base directly — it expects a BaseNoteOps interface (network + checkNote + redeemNote + optional refundExpired). BaseAgentPay is shape-compatible. Tests pass an in-memory stub.

Buyer payment-proof shape

{
  "note_id": "0x<64 hex>",
  "task_output": "{\"word_count\":2}",
  "tx_hash": "0x<64 hex>"
}

task_output is the raw bytes the seller pre-committed to. keccak256(task_output) MUST equal the on-chain Note's taskHash.

verifyPayment checks (in order)

  1. Shapenote_id is 0x + 64 hex, task_output present.
  2. Note exists on chainnote.exists (rejection: NOTE_NOT_FOUND).
  3. Not already redeemed (rejection: NOTE_ALREADY_REDEEMED).
  4. Not expired (rejection: NOTE_EXPIRED).
  5. Currency — agreement asks for USDC or USDT (rejection: CURRENCY_NOT_SUPPORTED; for ERG use rails-ergo, for rsUSDT/rsUSDC/rsBTC use rails-rosen).
  6. Task-hash bindingnote.taskHash != 0x00… and equals keccak256(task_output) (rejections: TASK_HASH_MISSING, TASK_HASH_MISMATCH). Note: keccak256, not blake2b256 — Accord stays portable, the rail uses each chain's native hash.
  7. Valuenote.amount >= decimalToBaseUnits(price.amount, decimals) (rejection: INSUFFICIENT_VALUE).

On success: payment_id = tx_hash (preferred — anchors to a specific issuance tx), or note_id if tx_hash was absent.

settle / refund

  • settle — calls ops.redeemNote(noteId, taskOutput). Emits a v0 Settlement Receipt with mode: "redeemed", status: "settled".
  • refund — calls ops.refundExpired(noteId). Emits with mode: "refund_expired", status: "refunded". Required when the engagement fails past the deadline.

The Base rail's per-rail allow-list per ACCORD-003 is { "redeemed", "refund_expired" }; the adapter respects that.

Error codes

BASE_RAIL_ERROR_CODES:

INVALID_PAYMENT_SHAPE
NOTE_NOT_FOUND
NOTE_EXPIRED
NOTE_ALREADY_REDEEMED
TASK_HASH_MISSING
TASK_HASH_MISMATCH
INSUFFICIENT_VALUE
CURRENCY_NOT_SUPPORTED

License

MIT.