Files
modules/applications-economy/hyper-p2p-credit-ledger/docs/api.md
T
Raven ScottandCursor f1536f9b6b Expand pubsub, economy, routing-advanced, and platform categories.
Manual pass adds listChannels, totalSupply, openCount, listSessionIds, new api.md files, corrected trust/reactive/conflict getStats docs, and category README hubs for routing-advanced, measurement, pear-platform, and trust-security.

Co-authored-by: Cursor <[email protected]>
2026-05-21 00:58:14 -04:00

30 lines
716 B
Markdown

# API: hyper-p2p-credit-ledger
**Protocol:** `credit-ledger/v1` · **Export:** `HyperP2PCreditLedger`
## Methods
### `openAccount(accountId, initial?) → account`
### `credit(accountId, amount, reason?)` / `debit(accountId, amount, reason?)`
### `transfer(fromId, toId, amount) → { from, to, amount, at }`
### `balance(accountId) → number | null`
### `listAccounts() → string[]` / `hasAccount(accountId) → boolean`
### `totalSupply() → number`
Sum of all account balances.
### `getStats() → { credits, debits, accounts, gossipIn, gossipOut, protocol }`
### `async ready()` / `async close()`
## Wire
| type | behavior |
|------|----------|
| `ledger-entry` | Open or update remote balance |