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

@cavos/reserve

v0.1.3

Published

Pay Stellar reserves and fees with any token, from any wallet.

Readme

@cavos/reserve

Pay Stellar reserves and fees with any token, from any wallet.

npm install @cavos/reserve @stellar/stellar-sdk
import { Reserve } from "@cavos/reserve";

const reserve = new Reserve("testnet");
// Mainnet: new Reserve("mainnet")
// Pin the sponsor from /health: await Reserve.connect("testnet")

const { hash } = await reserve.pay({
  source: address,
  destination,
  amount: "10",
  token: "USDC:GA5ZSEJ…",
  maxSend: "0.05",
}, (xdr, { networkPassphrase }) =>
  wallet.signTransaction(xdr, { networkPassphrase }),
);

The signer is whatever your wallet already exposes — Freighter, Albedo, a bare Keypair. Nothing in this package is specific to any wallet or to any account type: any G… address works.

pay looks at the destination. If it can receive a Payment, that is what is built. If there is no account, or no trustline, the money is left as a claimable balance the recipient opens with activate. The sender stays a claimant: if nobody claims it, they can take it back after seven days.

Verification is the point

The service builds the bytes a wallet is asked to sign. Comparing those bytes only against the quote the service just sealed proves nothing: a compromised server can make the two agree. quote therefore keeps the request you made, and build / send refuse anything that does not match it.

That check needs three things the request used to omit:

  • maxSendStroops — the fee payment is not one of ops, so without a ceiling a quote for any amount at all would verify cleanly.
  • the operations and fee token you asked for — not the ones the payload claims you asked for.
  • networkPassphrase and sponsor, when you set them on the client — neither is inside the envelope a wallet signs.

The path of the fee payment is compared hop for hop against the quote. A hostile route cannot spend more than maxSendStroops; that ceiling, not a local path finder, is what bounds the loss.

Calling the HTTP endpoints directly gives this up. Use send, or call verifyTransaction yourself with the request you made:

import { verifyTransaction, readQuote } from "@cavos/reserve";

verifyTransaction(xdr, readQuote(quoteToken), {
  source,
  feeToken: "USDC:GA5ZSEJ…",
  maxSendStroops: 500_000,
  ops,
});

Onboarding someone with no account

An account is created in the same transaction that funds it — never emptily, because reserves handed to an address that never comes back cannot be recovered. Stellar's mechanism for paying someone who has no account yet is a claimable balance; the recipient's first transaction does everything at once:

await reserve.activate({
  address: newAddress,
  token: "USDC:GA5ZSEJ…",
  balanceId,
  maxSend: "5",
}, sign);

The reserves (1.5 XLM for an account with one trustline) and the fees come out of the claimed funds. npm run example does exactly this against testnet.

Accepted tokens

const { known } = await reserve.tokens();
// [{ asset: "USDC:GA5ZSEJ…", code: "USDC", domain: "circle.com", … }]

Only allowlisted assets are accepted as payment. Show the issuer or its domain in your UI, never the code alone: mainnet has hundreds of accounts issuing something called "USDC".

API

| | | |---|---| | new Reserve("testnet" \| "mainnet") | hosted URL + pinned passphrase | | Reserve.connect(network) | same, plus sponsor pinned from /health | | pay({ source, destination, amount, token, maxSend }) | Payment, or a claimable if the dest is not ready | | activate({ address, token, balanceId, maxSend }) | create + trust + claim | | quote({ source, ops, feeToken?, maxSend }) | price classic operations | | send(quote \| request, signer) | build → verify → sign → submit | | build(quote) | fetch the transaction and verify it against the held request | | submit(quote, signedXdr) | submit an already-signed transaction | | tokens() | the assets this deployment accepts, with issuer and domain | | readQuote(token) | decode a quote payload | | verifyQuote(payload, request, expected?) | is this quote an answer to the request | | verifyTransaction(xdr, payload, request, expected?) | the check, on its own |

Run npm run example against a local service to create an account that holds no XLM at all.