Optionaloptions: SessionOptions// In the economy service, keyed by (not owned by) a world instance, epoch-rotated. A
// purchase movement carries the same fee split a main-lane sale posts: buyer debit,
// seller's net credit, REVENUE's fee credit.
const ports = await openPorts(process.env, init);
const reservations = createReservations(); // one per process
const session = openInstanceSession(ports, `sess:${worldInstanceId}:0`, { reservations });
const price = decodeAmount('5.00', 'CREDIT');
const fee = decodeAmount('1.50', 'CREDIT');
await session.record({
idempotencyKey: orderId,
legs: [
debit(spendable(buyerId), price),
credit(earned(creatorId), subtract(price, fee)),
credit(SYSTEM.REVENUE, fee),
],
});
await session.settle(); // this tier's schedule: cadence, backlog, timeout, or scope close
Opens a netting session.
recordaccepts or rejects movements (idempotent per key, affordable per the reservation registry, durable per journal batch);flushforces the pending batch out;settlederives the net from the journal, verifies the chain, and posts it in clearing chunks — once per session id; rotate epochs to keep a long-lived scope settling on cadence.depsis a structural subset ofPorts, so a host composed viaopenPortspasses its ports straight through. Share ONEreservationsregistry across every session in the process (see Reservations).