This commit is contained in:
Raven Scott
2026-05-20 22:56:32 -04:00
parent b8c335adee
commit dd384eb944
321 changed files with 7484 additions and 3793 deletions
@@ -1,23 +1,26 @@
# hyper-p2p-credit-ledger API
# API: hyper-p2p-credit-ledger
**Status:** scaffold · **Protocol:** `credit-ledger/v1`
**Protocol:** `credit-ledger/v1`
## Class `HyperP2PCreditLedger`
## Constructor
Scaffold stub — methods throw `not implemented: scaffold` until promoted to production tier.
`new HyperP2PCreditLedger(opts?)``topic`, `keyPair` optional.
### `constructor(opts?)`
## Methods
### `getStats()`
| Method | Description |
|--------|-------------|
| `openAccount(accountId, initial?)` | Create account |
| `credit(accountId, amount, reason?)` | Add balance |
| `debit(accountId, amount, reason?)` | Subtract balance |
| `transfer(fromId, toId, amount)` | Move credits |
| `balance(accountId)` | number \| null |
| `ready()` / `close()` / `getStats()` | Lifecycle |
Returns `{ created, errors, protocol, tier: 'scaffold' }`.
## Events
### `ready()`
`account`, `credit`, `debit`, `remote-entry`
Resolves immediately (no-op).
## Errors
## Wire (planned)
| Message | Direction | Notes |
|---------|-----------|-------|
| TBD | gossip | Defined in implementation pass |
`account exists`, `unknown account`, `insufficient balance`