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

@sip402/core

v0.1.2

Published

sip402 core — chain config, sip accounting, settlement rail (DirectRedeem/1Shot relayer), and ERC-7710 redemption primitives.

Downloads

236

Readme

@sip402/core

npm · repo · SPEC

The on-chain / settlement half of sip402 — the capital-backed, ERC-7710 binding of x402's batch-settlement scheme. This package holds the pieces both the seller and the demo need: network config, off-chain draw accounting, the Settler that redeems commitments, and the 1Shot gasless-relayer client.

npm i @sip402/core

What's inside

| Module | Exports | Purpose | |---|---|---| | chain | SIP_NETWORK, IS_MAINNET, CHAIN, CHAIN_ID, USDC, toUsdcAtoms() | Network + USDC config, selected once from SIP_NETWORK (base | base-sepolia). | | session | SipMeter | Pure, off-chain mirror of the on-chain period cap — accrues token costs and decides when to draw. | | settle | Settler, createDirectRedeemSettler(), createOneShotSettler(), buildTransferExecution() | Redeem one commitment (settle) or N in one redeemDelegations (settleBatch). | | oneshot | getCapabilities(), estimate7710Transaction(), send7710Transaction(), pollUntilTerminal() | JSON-RPC client for the 1Shot permissionless relayer (gasless, gas paid in USDC, EIP-7702). |

The two settlers

Both implement the same Settler interface; pick by network.

import { createDirectRedeemSettler, createOneShotSettler, toUsdcAtoms } from "@sip402/core";
import { privateKeyToAccount } from "viem/accounts";

// TESTNET — the delegate EOA redeems directly through the Delegation Manager (pays gas).
const settler = createDirectRedeemSettler({ delegateAccount: privateKeyToAccount(SESSION_KEY) });

// MAINNET — gasless: the 1Shot relayer redeems and takes its fee in USDC (EIP-7702).
const settler = createOneShotSettler({ ownerAccount: privateKeyToAccount(OWNER_KEY) });

// Settle ONE sip…
await settler.settle({ signedDelegation, payTo: SELLER, atoms: toUsdcAtoms("0.04") });

// …or BATCH many commitments into ONE redeemDelegations (the batch-settlement scheme).
// The on-chain period enforcer accumulates across the batch, so an over-cap batch
// reverts atomically — the "dry tab".
const { txHash, count, totalAtoms } = await settler.settleBatch({
  signedDelegation,
  payTo: SELLER,
  atomsList: [toUsdcAtoms("0.04"), toUsdcAtoms("0.04"), toUsdcAtoms("0.04")],
});

SipMeter — off-chain accounting

SipMeter tracks cumulative draws against a session cap so the seller knows when to flush a batch, without a chain round-trip per token. The on-chain ERC20PeriodTransferEnforcer is the source of truth; SipMeter is its fast, local mirror.

Configuration

SIP_NETWORK selects the network at module load (base-sepolia by default). BASE_RPC_URL / BASE_SEPOLIA_RPC_URL override the RPC; the 1Shot relayer URL and target/fee addresses are wired automatically per network.

License

MIT