Catalog npm
PACKAGE EXPLORERView in registry

@0xkinno/kernel

npm

Exact-arithmetic kernel for tokenized-stock statements: replays Token-2022 ScaledUiAmount and ERC-8056 multiplier history and resolves what a wallet held at any instant. Zero dependencies.

erc-8056proofrobinhood-chainscaled-ui-amountsolanastatementstoken-2022tokenized-stocks
Versions collected2
Direct dependencies0From release 0.1.0
Last observed21 Oct, 09:01 UTC

README

Current package documentation

@0xkinno/kernel

Exact-arithmetic kernel behind Colophon: what a wallet actually held in tokenized stocks, on any date.

Tokenized stocks keep a raw balance that never moves and a multiplier that does. The chain stores only the current multiplier, so a balance is true only relative to a clock. This package replays recovered multiplier updates, resolves the multiplier in force at an instant, and does all arithmetic with integers (no floats). Zero dependencies. Runs in Node, browsers and edge runtimes.

npm i @0xkinno/kernel
import { parseDecimal, formatUiAmount, replayScaledUiAmount, resolveReplayAt } from "@0xkinno/kernel";

// 1.486 shares per token unit after a change took effect
const multiplier = parseDecimal("1.4861347");
formatUiAmount(1_000_000_000n, 9, multiplier, 9); // "1.486134700"

const state = { multiplier: parseDecimal("1"), newMultiplier: parseDecimal("1"), newMultiplierEffectiveTimestamp: 0n };
const updates = [
  {
    signature: "S1", slot: 10n, blockTime: 1_000n, mint: "M",
    newMultiplier: parseDecimal("5"), newMultiplierTimestamp: 2_000n,
  },
];
const { intervals } = replayScaledUiAmount(updates, state);
resolveReplayAt(intervals, 2_000n)?.multiplier; // 5 (the boundary is inclusive)

What is inside

  • parseDecimal, scaleRaw, formatUiAmount: exact rational arithmetic
  • replayScaledUiAmount, resolveReplayAt, buildEvidenceTimeline, multiplierAt: history replay with the rules measured on Solana devnet
  • computeRawBalanceAnchored, generateStatement, computeStatementHash: balance reconstruction and deterministic statements
  • Invariant checks I1 to I10

Rules the replay encodes (measured on devnet): the stored multiplier does not roll forward by itself, a second update submitted before the first takes effect erases the first from state, and the effective instant is inclusive.

MIT licensed. Source and evidence: https://github.com/0xkinno/colophon_

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 2

Collected releases
VersionPublishedDirect dependenciesOpen version
0.1.0Registry latest11 Oct 20260
0.0.0-stage11 Oct 20260

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
0xkinno/colophon_

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 09:01 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:b1cda322e3705a5db927b743696a37fdd94bd5799a44f4f4d1b9fd92353d44e1