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]>
30 lines
716 B
Markdown
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 |
|