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

@boltzpay/core

v0.3.2

Published

Core domain types and value objects for BoltzPay SDK

Readme

@boltzpay/core

Domain primitives for the BoltzPay SDK — value objects, protocol interfaces, chain types, and error hierarchy. Zero I/O, zero dependencies.

Install

npm install @boltzpay/core

Most users should install @boltzpay/sdk instead. This package is for custom protocol adapters or when you need the domain types without the full SDK.

Value Objects

Money — Immutable monetary value object. All arithmetic is bigint-based (no floating-point).

import { Money } from "@boltzpay/core";

Static constructors: fromCents, fromDollars, fromSatoshis, fromJSON, zero. Methods: add, subtract, multiply, isZero, greaterThan, greaterThanOrEqual, equals, toDisplayString, toJSON.

Protocol Interfaces

import type {
  ProtocolAdapter,
  ProtocolQuote,
  ProtocolResult,
  EndpointInputHints,
  MppMethodQuote,
  SessionAdapter,
  ManagedSession,
  SessionCloseResult,
  SessionOptions,
} from "@boltzpay/core";
  • ProtocolAdapterdetect, quote, execute lifecycle for a payment protocol.
  • ProtocolQuote / ProtocolResult — Quote and execution result returned by adapters.
  • EndpointInputHints — Hints extracted from 402 metadata (method, query params, body fields).
  • MppMethodQuote — Per-method quote for MPP endpoints.
  • SessionAdapteropenSession(url, options) returns a ManagedSession.
  • ManagedSession — Long-lived payment channel with fetch, close, spent tracking.
  • SessionCloseResult — Final settlement: channelId, totalSpent, refunded.
  • SessionOptionsmaxDeposit cap and AbortSignal support.

Protocol Types

import { isProtocolType, type ProtocolType } from "@boltzpay/core";
  • ProtocolType — Branded non-empty string identifying a protocol (x402, L402, MPP, ...).
  • isProtocolType — Type guard validating non-empty strings.

Chain Types

import type {
  ChainNamespace,
  NetworkIdentifier,
  WalletInfo,
  AcceptOption,
} from "@boltzpay/core";
import { parseNetworkIdentifier, formatNetworkIdentifier } from "@boltzpay/core";
  • ChainNamespace"evm" | "svm" | "stellar".
  • NetworkIdentifier — Parsed CAIP-2 chain identifier ({ namespace, reference }).
  • WalletInfo — Wallet addresses and balances per namespace.
  • AcceptOption — Accepted payment option from a 402 response.
  • parseNetworkIdentifier / formatNetworkIdentifier — CAIP-2 string conversion (e.g. "eip155:8453" for Base).

Errors

import {
  DomainError,
  NegativeMoneyError,
  InvalidMoneyFormatError,
  CurrencyMismatchError,
  NoCompatibleChainError,
  ProtocolDetectionFailedError,
  InvalidNetworkIdentifierError,
} from "@boltzpay/core";

| Error | Code | When | |---|---|---| | DomainError | — | Base class for all domain errors | | NegativeMoneyError | — | Negative amount or subtraction underflow | | InvalidMoneyFormatError | — | Unparseable dollar string | | CurrencyMismatchError | — | Arithmetic across USD / SATS | | NoCompatibleChainError | no_compatible_chain | Wallet does not support the required chain | | ProtocolDetectionFailedError | protocol_detection_failed | No adapter recognized the 402 response | | InvalidNetworkIdentifierError | invalid_network_identifier | Malformed CAIP-2 string |

License

MIT