For use in contract upgrades to provide values that come from other vats. All vats must be able to finish their upgrade without contacting other vats, so whatever values an instance needs from other vats must be saved in the first incarnation and read from baggage in each subsequent.

This abstracts that condition so that the contract can convert a dictionary of thunks into a dictionary of values during its first prepare (start). Each subsequent prepare call will automatically read from the baggage and eschew remote calls.

The values are thunks instead of promises so that they don't start executing unnecessarily or induce failures.

For example,

const invitationIssuerP = E(zoe).getInvitationIssuer();
const {
  invitationIssuer,
  invitationBrand,
} = await provideAll(baggage, {
  invitationIssuer: () => invitationIssuerP,
  invitationBrand: () => E(invitationIssuerP).getBrand(),
});
  • Type Parameters

    • T extends Record<string, (() => any)>

      dict of thunks (promise makers)

    Parameters

    Returns Promise<{
        [K in string | number | symbol]: Awaited<ReturnType<T[K]>>
    }>