dcrwallet icon indicating copy to clipboard operation
dcrwallet copied to clipboard

Add a stream PurchaseTicket grpc call.

Open amass01 opened this issue 1 year ago • 3 comments

Currently the PurchaseTicket grpc returns one response when it's done. Because of this limitation the ticket purchase UX in decrediton is not smooth as users don't get any feedback during the process. See https://github.com/decred/decrediton/issues/3926.

We would like to add a stream grpc call, which will allow us return various statuses during the process and would make the call cancellable.

@alexlyp @jrick Any idea which statuses would be helpful here, I will inspect the current func flow and see at which stages it would make sense to return an update to the consumer.

amass01 avatar Nov 09 '23 21:11 amass01

The call should already be cancellable. Are you seeing otherwise?

I assume this request is mostly about mixed ticket buying, because of the potentially long wait period for a mix to occur? There is not much other information to provide during this.

jrick avatar Nov 09 '23 21:11 jrick

The call should already be cancellable. Are you seeing otherwise?

Oh yea haven't tried, probably it's cancellable, but not in the GUI, how does the cancel work ? is it by context cancellation ?

I assume this request is mostly about mixed ticket buying, because of the potentially long wait period for a mix to occur? There is not much other information to provide during this.

Yes, so probably we can return when mixing started and mixed balance / ticket price each time the mixed balance changes ?

amass01 avatar Nov 09 '23 22:11 amass01

The call should already be cancellable. Are you seeing otherwise?

Oh yea haven't tried, probably it's cancellable, but not in the GUI, how does the cancel work ? is it by context cancellation ?

Yep, with the context. I'm not sure how this works on the javascript side, but you should be able to cancel a specific ongoing request.

I assume this request is mostly about mixed ticket buying, because of the potentially long wait period for a mix to occur? There is not much other information to provide during this.

Yes, so probably we can return when mixing started and mixed balance / ticket price each time the mixed balance changes ?

I'm not sure what you mean by mixed balance. If you mean the ticket price it buys at, and the (slightly higher) value of the mixed outputs from the split tx, this doesn't change over the duration of the call. The request should error out if the ticket price changes because the window rolls over. I know the autobuyer does this, but I think calling PurchaseTickets directly might not (the mix might still complete, but the ticket purchase would fail).

jrick avatar Nov 10 '23 00:11 jrick