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

@0xdivyanshh/tab-money

v0.1.1

Published

Integer money for Hedera USDC — bigint micro-units, basis points, zero floating point.

Readme

@0xdivyanshh/tab-money

Tier 0 · zero runtime dependencies · zero I/O · no floating point

Every monetary amount in Tab, and every rate applied to one.

Why this is its own package

verify-tab claims the ledger reconciles to the cent. Tab also multiplies amounts by fractions repeatedly — a 0.6 unattested-revenue weight, tier multiples, a ramp stepping ±15%/30%, interest accrual per window. Many small numbers, repeated fractional multiplication, exact reconciliation required: that is the exact shape of problem where doubles produce a ledger a few micro-USDC out that nobody can explain at 2am.

Zero runtime dependencies means this package is auditable in one sitting, and everything else rests on it. See ADR-0006.

Contents

| File | Holds | |---|---| | src/micro-usdc.ts | the MicroUsdc branded type, parsing, arithmetic | | src/basis-points.ts | integer-bp rates, mulBp with explicit rounding | | src/format.ts | display and wire formatting — the only file allowed to touch decimals | | src/micro-usdc.test.ts | 13 tests, node --test |

The rules

  • No number ever holds an amount. MicroUsdc is bigint branded, so a raw bigint — a timestamp, a sequence number, a hop count — cannot be passed where an amount belongs. This has already caught two real slips in apps/web.

  • Rates are integer basis points. A 0.6 weight is bp(6000). A 40% concentration cap is bp(4000).

    This is not cosmetic. share > 0.4 in floats can flip at exactly 40% depending on how the ratio was derived, because 0.4 is not representable. shareBp > 4000 cannot. The concentration cap is a spend decision, so that difference is a refusal that should have fired and didn't.

  • mulBp requires a rounding direction. mulBp(amount, rate, 'down'), never a default. Rounding is a decision; a default is an accident, and interest and the ramp both compound.

  • Display truncates, never rounds up. The docs promise "truncated, not rounded", so the code means it: 0.999999 shows as 0.9999, never 1.0000.

  • Display uses U+2212 MINUS, not a hyphen — same width as a digit in tabular figures, so signed columns stay aligned.

  • Wire form keeps all six decimals (toWire). JSON.stringify cannot handle bigint, so amounts cross every boundary as decimal strings. This is also what makes the HCS ceiling input hash byte-stable.

Consumers

apps/web imports it through @/lib/money, which re-exports this package and adds one presentation-only helper. There is exactly one money implementation in the repo; a second would drift, and a display layer that rounds differently from the ledger is how "reconciles to the cent" stops being true on screen.

Still to do

  • formatBpMultiple is written but unused; the tier display in the landing playground uses it.
  • No property-based tests yet. The invariants worth generating over: mulBp never leaves [0, amount] for bp ≤ 10000, parse(format(x)) === x, and summing is associative. The first and third have example-based coverage; the second needs toWire round-tripping.
  • Interest accrual and ramp rounding directions must be pinned in @0xdivyanshh/tab-params when that package is written, not chosen at each call site.
node --experimental-strip-types --test src/*.test.ts