Skip to main content

Function: reserveSpend()

reserveSpend(store, admission): Promise<string>

Defined in: packages/agentos/src/safety/runtime/SpendReservations.ts:232

Reserves an admission's largest cost in the day it starts and answers the reservation's id, or throws CostCapExceededError (daily) reserving nothing. A cost that is not whole micro-dollars, zero or more, is a RangeError, and so is a start or an expiry that is not a valid date; a committed total the store does not answer as whole micro-dollars, zero or more, refuses the admission, since the day's spending is then not known, and so does a cap that is not whole micro-dollars, zero or more. An admission with requireFence is refused with an Error before the day is read on a store that does not hold fenced reservations, and is recorded through addFencedReservation.

Parameters​

store​

SpendDayStore

admission​

SpendAdmission

Returns​

Promise<string>