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-rosen

v0.4.1

Published

Accord rail adapter for Rosen-bridged stablecoins on Ergo (rsUSDT, rsUSDC, rsBTC). Wraps the Ergo Note primitive with token-aware value lookups against a configurable token registry.

Readme

@accord-protocol/rails-rosen

Accord rail adapter for Rosen-bridged stablecoins on ErgorsUSDT, rsUSDC, rsBTC. Same on-chain primitive as rails-ergo (R4 reserve / R6 task-hash on an Ergo Note), but the value lives in a wrapped-token amount carried in the box's tokens[] array, not in the box's nanoERG value field.

Install

npm install @accord-protocol/rails-rosen @accord-protocol/rails @accord-protocol/core
# peer deps for non-mock use:
npm install ergo-agent-pay ergo-agent-rosen

Token registry — caller-supplied

Token ids differ by Rosen network, so the rail adapter does NOT bake constants in. Pass a RosenTokenRegistry for the network you are testing:

import { createRosenRailAdapter } from "@accord-protocol/rails-rosen";

const ROSEN_TOKENS = {
  rsUSDT: { tokenId: "<64 hex>", decimals: 6 },
  rsUSDC: { tokenId: "<64 hex>", decimals: 6 },
  rsBTC:  { tokenId: "<64 hex>", decimals: 8 },
};

const rail = createRosenRailAdapter({ ops: rosenAgent, tokens: ROSEN_TOKENS });

The agreement's price.currency must be one of { rsUSDT, rsUSDC, rsBTC }, AND the registry must have that currency, AND the registry's decimals must match agreement.price.decimals. All three rails-rosen-specific rejections — CURRENCY_NOT_SUPPORTED, CURRENCY_NOT_REGISTERED, INVALID_PAYMENT_SHAPE (decimals mismatch) — fire here.

Buyer payment-proof shape

{
  "note_box_id": "<64 hex>",
  "task_output": "{\"word_count\":2}",
  "receiver_address": "9XSeller..."
}

Same shape as rails-ergo. The on-chain Note's R4/R5/R6/R7 layout is identical; the wrapped-token value lookup happens against the box's tokens[] array.

verifyPayment checks (in order)

  1. Shapenote_box_id 64-hex, task_output present.
  2. Currency / registry — currency in {rsUSDT,rsUSDC,rsBTC}, registry has it, decimals match (rejections: CURRENCY_NOT_SUPPORTED, CURRENCY_NOT_REGISTERED, INVALID_PAYMENT_SHAPE).
  3. Note exists on chain (rejection: NOTE_NOT_FOUND).
  4. Not expired (rejection: NOTE_EXPIRED).
  5. Reserve binding (rejection: RESERVE_MISMATCH).
  6. Task-hash bindingblake2b256(task_output) === R6 (same as Ergo) (rejections: TASK_HASH_MISSING, TASK_HASH_MISMATCH).
  7. Token presencetokens[].tokenId == registry[currency].tokenId (rejection: TOKEN_NOT_PRESENT).
  8. Token amount — carried token amount ≥ decimalToBaseUnits(price.amount, decimals) (rejection: INSUFFICIENT_VALUE).

On success: payment_id = note.boxId.

settle

Calls ops.redeemNote(noteBoxId, taskOutput, receiverAddress?) and emits a Settlement Receipt with:

  • rail: "rosen"
  • mode: "note_redeemed" (per-rail allow-list per ACCORD-003: note_redeemed | reserve_refunded | batch_settled)
  • status: "settled" (or "pending" if redeemNote returns submitted: false)

Error codes (10)

INVALID_PAYMENT_SHAPE
NOTE_NOT_FOUND
NOTE_EXPIRED
RESERVE_MISMATCH
TASK_HASH_MISSING
TASK_HASH_MISMATCH
CURRENCY_NOT_SUPPORTED
CURRENCY_NOT_REGISTERED
TOKEN_NOT_PRESENT
INSUFFICIENT_VALUE

What's NOT here

  • Token-id constants for mainnet/testnet. Caller-supplied registry on purpose — Rosen Bridge updates these and we don't want stale constants baked in.
  • The bridge itself. This adapter assumes wrapped tokens are already on Ergo. The actual wrap (Ethereum/Bitcoin/Cardano → Ergo) flow lives in ergo-agent-rosen and is a separate concern.
  • Refunds. Rosen Notes self-refund through the Ergo predicate, same as plain Ergo Notes.

License

MIT.