Expand economy, autobase, network, observability, and scheduling modules.

Add auction withdraw/cancel, marketplace search helpers, update gossip history, autobase fork/lease/indexer/view APIs, link-probe and circuit-loom utilities, trace trees, pheromone ranking, and scheduling/measurement helpers with tests.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Raven Scott
2026-05-21 01:09:29 -04:00
co-authored by Cursor
parent b8b815fce6
commit 44b8a80907
36 changed files with 508 additions and 4 deletions
@@ -64,6 +64,18 @@ class HyperP2PCreditLedger extends EventEmitter {
return sum
}
topBalances (limit = 5) {
return [...this._accounts.values()]
.sort((a, b) => b.balance - a.balance)
.slice(0, Math.max(0, limit | 0))
.map((a) => ({ id: a.id, balance: a.balance }))
}
accountSnapshot (accountId) {
const a = this._accounts.get(accountId)
return a ? { id: a.id, balance: a.balance, updatedAt: a.updatedAt } : null
}
_apply (accountId, delta, kind, reason) {
assertNonEmpty(accountId, 'accountId')
const acct = this._accounts.get(accountId)
@@ -48,3 +48,12 @@ test('totalSupply and listAccounts', async (t) => {
t.alike(m.listAccounts().sort(), ['a', 'b'])
await m.close()
})
test('topBalances accountSnapshot', async (t) => {
const m = new HyperP2PCreditLedger()
m.openAccount('a', 5)
m.openAccount('b', 50)
t.is(m.topBalances(1)[0].id, 'b')
t.is(m.accountSnapshot('a').balance, 5)
await m.close()
})