Updates
This commit is contained in:
@@ -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`
|
||||
|
||||
Reference in New Issue
Block a user