pkg:clod/com.clodhub/chip-ledger 0.12.0 Whole-number chip accounting for games with stacks and bets: commits, uncalled excess, pots and side pots, odd-chip rule, settlement, and a balance audit. Chip arithmetic that cannot lose a chip. A `Ledger` holds one stake per player (stack, chips in front of them this round, chips in total this hand, folded) plus the total ever issued. Operations commit chips, return an uncalled excess, build one pot per contribution level (side pots; `displayPots` gives the pots as shown mid-round), split each pot among winners the caller names with odd chips handed out by a stated rule, settle the awards into the stacks, void a hand, credit outside chips (rebuy), and audit that stacks plus wagers equal chips issued. It knows nothing about cards or who has the best hand. One ledger can serve a whole game: players are added as chips are issued to them (`create`, `issue`), `balance` reads a stack and `issued` the chips ever made. Examples A hold'em tournament table with a 5000 chip stack and side pots. A cash game with a 25 chip minimum unit. A house game with a single pot (side pots off). A table moved between hosts by export and import. Package URL: pkg:clod/com.clodhub/chip-ledger@0.12.0 Class: Chip ledger (pkg:clod/com.clodhub/chip-ledger-class@1.1.0): Wagers, pots, side pots and settlement with every chip accounted for. Any component of this class can fill a recipe slot that asks for it. Category games/chips-and-scoring; https://clodhub.com/classes/chip-ledger-class.txt; 0 other components of this class: https://clodhub.com/components.txt?class=pkg%3Aclod%2Fcom.clodhub%2Fchip-ledger-class Provides (1) - chip-ledger (com.clodhub/chip-ledger 1.0.0): Whole-number chip accounting: stacks, bets, pots and side pots, odd chips. No game rules and no card knowledge: callers say who won each pot. Every function returns a new ledger and never changes its input. TypeScript, `implementation/server/ledger.ts`. Methods named `LedgerApi.` are members of the object createLedgerApi returns (the operations a tournament calls, with the settings bound). components that use it: https://clodhub.com/components.txt?requires=com.clodhub%2Fchip-ledger Requires (0) - none Settings (5) The installer collects five settings. `startingStack` is the chips each player begins with when the ledger is opened with `openLedger` (whole number, default 5000); with `issue` the caller gives every amount, so a tournament that issues its own starting stack and rebuys does not use this setting. `minimumUnit` is the smallest chip; bets are multiples of it unless they put the whole stack in (default 1). `oddChipRule` is `clockwise-after-button` (odd chips go one each to tied winners clockwise from the seat after the button; default) or `first-listed` (in the order the caller lists the winners). `sidePots` builds one pot per contribution level when true (default); when false everything goes in one pot. `seats` is the number of seats at the table, used to count clockwise from the button when odd chips are handed out (whole number of at least 2, default 9). - startingStack: integer; optional, default 5000 - minimumUnit: integer; optional, default 1 - oddChipRule: string (slug); optional, default "clockwise-after-button" - sidePots: boolean; optional, default true - seats: integer; optional, default 9 Depends on components: none How to use in a recipe A recipe uses it through a slot of class Chip ledger (pkg:clod/com.clodhub/chip-ledger-class 1.1.0), naming pkg:clod/com.clodhub/chip-ledger as the slot's preferred component or substituting it for another component of the class. The recipe connects what it provides (chip-ledger) to the slots that use it. The recipe sets startingStack, minimumUnit, oddChipRule, sidePots and seats; any it leaves out takes its default. - as a slot in recipe.json components: {"id":"chip-ledger","class":{"name":"pkg:clod/com.clodhub/chip-ledger-class","version":"1.1.0","digest":"4d3593e1cb989daeb4b66be3ed953661b41b7d5b70468b21154f06e193778d96"},"preferred":{"name":"pkg:clod/com.clodhub/chip-ledger","version":"0.12.0"}} - in place of another component of the class: clod fetch chip-ledger@0.12.0 --store store --from https://clodhub.com, then clod design RECIPE@VERSION --store store --answers answers.json --substitute SLOT=chip-ledger@0.12.0 --out definition.json Used by recipes: pkg:clod/com.clodhub/ourpoker-recipe 0.13.0 (slot chip-ledger) For developers: how an application uses it A rules component calls `commit` for blinds, calls, bets and raises (`commitTo` for a raise to a total), `fold`, `endRound` between streets, then at the end `returnUncalled`, `buildPots`, decides who won each pot from card strength, `awardPot` for each pot and `settle`. `voidHand` is the cancel path. `credit` adds rebuy chips and keeps `audit` balanced. `exportLedger` and `importLedger` move a table's chips in and out as ndjson. Every function returns a new ledger, so a game can keep earlier states. Single platform: server TypeScript (uses `node:crypto` for export checksums). A tournament keeps one ledger for the whole game: `create()` (or `createLedgerApi(settings).create()` with the settings bound), `issue(ledger, id, amount)` for each starting stack and rebuy, `balance(ledger, id)` and `issued(ledger)` to read it. `setSeats` tells the ledger where players sit (for the odd chip); `setStacks(ledger, stacks)` takes the stacks back from a game that kept its own, refusing any change in the total. Accounts and services No deployed service and no accounts. The ledger is plain data the host stores wherever it stores game state; the ndjson export is how it moves between hosts. How it is checked `tests/web.test.ts` checks settings validation, commit limits and the minimum unit, the pot layers and uncalled-excess cases in `tests/fixtures/pots.json`, the single-pot mode, the odd-chip rule both ways, a loop proving `splitAmount` never loses a chip for many amounts, winner counts and units, settle and void balancing, credit and audit, and the ndjson round trip with a tampered line rejected. It also checks the book (create, issue, balance, issued, a rebuy, three hands on one ledger with the audit balanced after each, bound settings, seats and the odd chip by seat, `setStacks` conserving chips, and export and import of an issued ledger). It checks the `seats` setting: default 9, validation, the odd chip going to a different winner on a 6-seat table than on a 9-seat one, the setting carried through export and import, and an export without `seats` refused. - `node --test tests/web.test.ts` (web, required-local; tools: node 26.5) Updates Patch updates replace the files only. The ndjson record layout is described in `interfaces/ledger.schema.json` and `migration.json`. An export must carry every ledger setting, `seats` included. After removal, exported ndjson files are described by the schema. Tags: chip, chips-and-scoring, games, ledger Targets: client none; server none Publisher: George McIntyre (george-mcintyre) Guardians: Level N Ltd (guardian key 08775f20) Source: clodhub/chip-ledger release v0.12.0; digest sha256:6d1ec4c8151af3c20a06694050779fd5a86bb2844ca8b9ab743c747e83199895 Release: features Line 0.12: no security releases Quality: Integration-tested, certified Known vulnerabilities: none known (checked 2026-11-26 at OSV); https://clodhub.com/api/components/chip-ledger/0.12.0/vulnerabilities Downloads: 1 in 30 days; 1 of this version Classes: https://clodhub.com/classes.txt; this component as JSON: https://clodhub.com/api/components/chip-ledger/0.12.0 Bundle download: GET https://clodhub.com/api/components/chip-ledger/0.12.0/bundle returns a link valid for one hour Implements: pkg:clod/com.clodhub/chip-ledger-class@1.1.0 4d3593e1cb989daeb4b66be3ed953661b41b7d5b70468b21154f06e193778d96 com.clodhub/chip-ledger 1.0.0 entry modules: server server/index.ts shared behaviour suites: shared Platforms: server Toolchains: node >=26.5.0 <27.0.0 Frameworks: none Styles: scope none; 0 namespaces; 0 conflicts Licence: Apache-2.0; 0 upstream sources, 0 exact dependencies, 24 files (listed on the details page) Suitable for jobs: chip-ledger profile any: cost none; load none; regions any; compliance none Notes: Pure library; no provider limits apply. Ledger data is small: a nine-player table exports as ten short lines. Data migration: stores ledger (com.clodhub/chip-ledger-records 1.0.0); formats ndjson; requires stop no; retention 30 days Maintainers: Level N Ltd; https://github.com/clodhub/chip-ledger/issues; updates https://github.com/clodhub/chip-ledger/releases (manual) What you download chip-ledger-0.12.0.tar, from release v0.12.0 of clodhub/chip-ledger: 24 files - Documents and manifests (9): CONTRACT.md, INSTRUCTIONS.md, LICENCE, NOTICE, PROVENANCE.md, SOURCE.md, ... - Source code (2): server/ (2) - Tests (2): fixtures/ (1), web.test.ts - Interface documents (2): chip-ledger.json, ledger.schema.json - Class files: the class's interfaces and shared checks (3): chip-ledger-class/ (3) - Examples (1): consumer.ts - Diagrams (5): definition.json, examples/ (1), output/ (3) Installing copies 2 of them into the application under components/chip-ledger/: server 2 Not included: the values of its settings, which the recipe writes; any secret The archive is a release file on the publisher's public GitHub repository; ClodHub keeps this page and a pointer to the release, not the code. clod checks the archive's sha256 fingerprint before anything is copied, and installing runs none of the package's code. Versions - 0.12.0 features (2026-11-26T11:25:25.673Z) sha256:6d1ec4c8151af3c20a06694050779fd5a86bb2844ca8b9ab743c747e83199895 Links Details (package foundations, upstream sources, exact dependencies, styles, class inventories, files): https://clodhub.com/components/chip-ledger/details.txt?version=0.12.0 Page: https://clodhub.com/components/chip-ledger; JSON: https://clodhub.com/api/components/chip-ledger/0.12.0; connections diagram: https://clodhub.com/api/components/chip-ledger/0.12.0/connections.svg Copyright Level N Ltd 2026