UserSeat<OR>: {
    getExitSubscriber: (() => Subscriber<Completion>);
    getFinalAllocation: (() => Promise<Allocation>);
    getOfferResult: (() => Promise<OR>);
    getPayout: ((keyword: Keyword) => Promise<Payment<any, any>>);
    getPayouts: (() => Promise<PaymentPKeywordRecord>);
    getProposal: (() => Promise<ProposalRecord>);
    hasExited: (() => Promise<boolean>);
    numWantsSatisfied: (() => Promise<0 | 1>);
    tryExit?: (() => void);
}

Zoe uses seats to access or manipulate offers. They let contracts and users interact with them. Zoe has two kinds of seats. ZCFSeats are used within contracts and with zcf methods. UserSeats represent offers external to Zoe and the contract. The party who exercises an invitation and sends the offer() message to Zoe gets a UserSeat that can check payouts' status or retrieve the result of processing the offer in the contract. This varies, but examples are a string and an invitation for another seat.

Also, a UserSeat can be handed to an agent outside Zoe and the contract, letting them query or monitor the current state, access the payouts and result, and, if it's allowed for this seat, call tryExit().

Since anyone can attempt to exit the seat if they have a reference to it, you should only share a UserSeat with trusted parties.

UserSeat includes queries for the associated offer's current state and an operation to request that the offer exit, as follows:

Type Parameters

  • OR = unknown

Type declaration

  • getExitSubscriber: (() => Subscriber<Completion>)

    returns a subscriber that will be notified when the seat has exited or failed.

  • getFinalAllocation: (() => Promise<Allocation>)

    return a promise for the final allocation. The promise will resolve after the seat has exited.

  • getOfferResult: (() => Promise<OR>)
      • (): Promise<OR>
      • Returns Promise<OR>

  • getPayout: ((keyword: Keyword) => Promise<Payment<any, any>>)

    returns a promise for the Payment corresponding to the indicated keyword. The promise will resolve after the seat has exited. If there is no payment corresponding to the keyword, an error will be thrown. (It used to return undefined.)

  • getPayouts: (() => Promise<PaymentPKeywordRecord>)

    returns a promise for a KeywordPaymentRecord containing all the payouts from this seat. The promise will resolve after the seat has exited.

  • getProposal: (() => Promise<ProposalRecord>)
  • hasExited: (() => Promise<boolean>)

    Returns true if the seat has exited, false if it is still active.

      • (): Promise<boolean>
      • Returns Promise<boolean>

  • numWantsSatisfied: (() => Promise<0 | 1>)

    returns 1 if the proposal's want clause was satisfied by the final allocation, otherwise 0. This is numeric to support a planned enhancement called "multiples" which will allow the return value to be any non-negative number. The promise will resolve after the seat has exited.

      • (): Promise<0 | 1>
      • Returns Promise<0 | 1>

  • OptionaltryExit?: (() => void)

    Note: Only works if the seat's proposal has an OnDemand exit clause. Zoe's offer-safety guarantee applies no matter how a seat's interaction with a contract ends. Under normal circumstances, the participant might be able to call tryExit(), or the contract might do something explicitly. On exiting, the seat holder gets its current allocation and the seat can no longer interact with the contract.

      • (): void
      • Returns void