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

@kaspacom/mpp-payer

v0.1.2

Published

Client-side Kaspa MPP helpers for API payers and wallets.

Readme

@kaspacom/mpp-payer

Client-side helpers for wallets and API clients.

Current starter surface:

  • read provider pricing
  • fetch and verify signed provider manifests
  • fetch provider contract artifacts and verify their hash
  • open an ApiPaymentChannel from a prepared contract script
  • call paid API routes with signed channel vouchers
  • request channel close/finalization with a payer-signed close request
  • build payer-signed settlement artifacts for the provider close/finalize path
  • build and submit expired channel refunds

Channel Open

openApiPaymentChannel() builds the genesis covenant channel-open transaction from an already prepared ApiPaymentChannel contract script. The package does not shell out to silverc; wallets or build tooling should provide the script artifact that matches the channel constructor values.

The helper validates deposit/reserve/max-spend sizing, builds the indexer payload, populates the genesis covenant group, and returns the channel-open artifact with the canonical covenant id when the Kaspa runtime supplies it. providerPayoutPubkey is optional and defaults to providerPubkey; set it to a colder receiver pubkey when the provider wants the settlement signer to be a hot operational key but settled funds to land on a different key.

openApiPaymentChannelFromManifest() is the wallet bootstrap path. It consumes the signed provider manifest, applies provider policy defaults, and calls the same lower-level open helper:

import {
  fetchProviderContractArtifact,
  fetchProviderManifest,
  openApiPaymentChannelFromManifest,
  syncOpenedChannelFromManifest,
} from "@kaspacom/mpp-payer";

const manifest = await fetchProviderManifest("https://api.example.test", {
  expectedNetworkId: "testnet-10",
});
const artifact = await fetchProviderContractArtifact(manifest);
const open = await openApiPaymentChannelFromManifest({
  manifest,
  contractArtifact: artifact,
  kaspa,
  payerPrivateKey,
  payerPubkey,
  fundingEntry,
  submit: true,
});
await syncOpenedChannelFromManifest({ manifest, openArtifact: open });

The helper rejects expired or tampered manifests, artifact hash mismatches, deposits below provider minimum, and refund windows outside provider policy. If the payer needs more capacity, call buildChannelContinueTransaction() with the live channel state. The helper preserves channelId, spends currentTxid/currentVout when present, increases channel value/max spend, and renews refundAfterMs. By default it rejects top-ups inside the refund safety window; use allowUnsafeRefundWindowTopUp only for controlled recovery or negative-proof tests.

Settlement Artifacts

buildSettlementArtifact() promotes the wallet-side close-on-settle signing path into the payer package. It resolves the current channel UTXO from an injected UTXO, callback, or Kaspa wRPC endpoint, builds the unsigned settlement transaction template, signs input 0 with the payer key, and returns the ApiPaymentChannel artifact that a provider can store and later redeem.

The helper enforces:

  • the authorization expiry must be before refundAfterMs
  • provider/refund outputs must meet the practical minimum unless explicitly overridden for proof tests
  • txid, template hash, metadata digest, and payer settlement signature are bound into the returned artifact

Refunds

buildChannelRefundTransaction() and submitChannelRefund() cover the payer escape path after refundAfterMs. They resolve the live channel UTXO, enforce the refund lock time, sign the refund branch, and return the refund artifact.

The package still expects the application to supply the Kaspa runtime, payer key, and node/RPC hooks. It does not own wallet material or node access.