Calling getPayout(<keyword>) before getOfferResult(): does it ever make sense? #5720
-
it's actually possible to call My question is this. Does it ever make sense to call If not: would it make sense for Either way it would be great to have guidance in docs on this |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
I'm updating this comment to reflect new understanding from the code.
So it would seem that a standard sequence should be (assuming contract exists the seat in the handler on success): const result = await E(seat).getOfferResult()
if (isSuccessful(result)) {
// make sure seat has actually exited
assert(await E(seat).hasExited())
// only now retrieve payouts
const payouts = await E(seat).getPayouts()
} Is this correct? Obviously whether we should expect the seat to be exited depends on the contract. We may have to wait and check multiple times (or get notified), however those are more complex flows that aren't part of this issue. |
Beta Was this translation helpful? Give feedback.
-
@Chris-Hibbert tells me: It's completely plausible to call |
Beta Was this translation helpful? Give feedback.
-
Also, while some seats exit during their offer handler, others may stay open for, for example, the duration of an auction. So |
Beta Was this translation helpful? Give feedback.
@Chris-Hibbert tells me:
It's completely plausible to call
E.when(getPayout(), ...)
, without callinggetOfferResult()
. Zoe explicitly returns a promise there, and doesn't resolve the promise until the seat is exited.