Introduce Future Streams for Payments and Minting Proofs #985

Merged
crodas merged 9 commits from feature/introduce-wallet-streams into main 2025-08-26 10:57:15 +00:00
crodas commented 2025-08-20 21:57:55 +00:00 (Migrated from github.com)

Description

Introduce Future Streams (ProofStream, PaymentStream) for Payments and Proofs, an easier to use interface, async friendly, to interact for the mint waiting for payments of mints for Bolt11 and Bolt12.


Notes to the reviewers


Suggested CHANGELOG Updates

CHANGED

ADDED

REMOVED

FIXED


Checklist

### Description Introduce Future Streams (`ProofStream`, `PaymentStream`) for Payments and Proofs, an easier to use interface, async friendly, to interact for the mint waiting for payments of mints for Bolt11 and Bolt12. ----- ### Notes to the reviewers <!-- In this section you can include notes directed to the reviewers, like explaining why some parts of the PR were done in a specific way --> ----- ### Suggested [CHANGELOG](https://github.com/cashubtc/cdk/blob/main/CHANGELOG.md) Updates <!-- Please do not edit the actual changelog but note what you changed here. --> #### CHANGED #### ADDED #### REMOVED #### FIXED ---- ### Checklist * [ ] I followed the [code style guidelines](https://github.com/cashubtc/cdk/blob/main/CODE_STYLE.md) * [ ] I ran `just final-check` before committing
thesimplekid (Migrated from github.com) requested changes 2025-08-21 15:40:05 +00:00
@ -107,3 +98,3 @@
.unwrap();
.expect("payment");
let invoice_amount = 9;
thesimplekid (Migrated from github.com) commented 2025-08-21 15:39:44 +00:00

Will just just keep the stream open for 60 seconds or because it bolt11 the stream ends after one? Either way I don't think we need the stream when we're just minting once.

Will just just keep the stream open for 60 seconds or because it bolt11 the stream ends after one? Either way I don't think we need the stream when we're just minting once.
thesimplekid (Migrated from github.com) commented 2025-08-21 15:38:19 +00:00

For the examples where using bolt12 we probably don't need the stream the stream is really for bolt12 keeping it open and re minting.

For the examples where using bolt12 we probably don't need the stream the stream is really for bolt12 keeping it open and re minting.
thesimplekid (Migrated from github.com) commented 2025-08-21 15:35:45 +00:00

We want this to be to be Amount::ZERO there is no issuing happening here we only got a payment.

We want this to be to be Amount::ZERO there is no issuing happening here we only got a payment.
thesimplekid (Migrated from github.com) commented 2025-08-21 15:36:38 +00:00
            Amount::ZERO,

We did not get a payment here we only issued so we do not need to update the amount payed.

```suggestion Amount::ZERO, ``` We did not get a payment here we only issued so we do not need to update the amount payed.
@ -0,0 +1,185 @@
//! Mint Stream
thesimplekid (Migrated from github.com) commented 2025-08-21 15:32:23 +00:00

Lets make this a cancel token instead of a duration. This gives the user more control of when they want to stop waiting on the stream.

Lets make this a cancel token instead of a duration. This gives the user more control of when they want to stop waiting on the stream.
davidcaseria (Migrated from github.com) reviewed 2025-08-22 10:41:29 +00:00
davidcaseria (Migrated from github.com) left a comment

This will be very helpful!

This will be very helpful!
@ -0,0 +1,122 @@
//! Wallet waiter APIn
davidcaseria (Migrated from github.com) commented 2025-08-22 10:40:49 +00:00

Would streaming the mint quote to get status updates be beneficial?

Would streaming the mint quote to get status updates be beneficial?
crodas (Migrated from github.com) reviewed 2025-08-22 14:51:19 +00:00
@ -0,0 +1,122 @@
//! Wallet waiter APIn
crodas (Migrated from github.com) commented 2025-08-22 14:51:19 +00:00

This would return the proofs already, meaning the quote would already be paid. Maybe it should also be useful to have a status update stream? So the UI/UX can be changed accordingly?

This would return the proofs already, meaning the quote would already be paid. Maybe it should also be useful to have a status update stream? So the UI/UX can be changed accordingly?
davidcaseria (Migrated from github.com) reviewed 2025-08-22 18:13:43 +00:00
@ -0,0 +1,122 @@
//! Wallet waiter APIn
davidcaseria (Migrated from github.com) commented 2025-08-22 18:13:43 +00:00

I don't have a strong opinion, but I wanted to raise the issue to consider whether returning the status is useful.

I don't have a strong opinion, but I wanted to raise the issue to consider whether returning the status is useful.
thesimplekid (Migrated from github.com) reviewed 2025-08-22 18:20:39 +00:00
@ -0,0 +1,122 @@
//! Wallet waiter APIn
thesimplekid (Migrated from github.com) commented 2025-08-22 18:20:39 +00:00

I think here since you're subscribing to one mint quote proofs is good. I think another fn to subscribe to many mint quotes you would want to return the proofs and the quote id then to know what proof has been paid. I think @crodas started on a wallet subscription method in another pr.

I think here since you're subscribing to one mint quote proofs is good. I think another fn to subscribe to many mint quotes you would want to return the proofs and the quote id then to know what proof has been paid. I think @crodas started on a wallet subscription method in another pr.
thesimplekid (Migrated from github.com) requested changes 2025-08-24 09:20:14 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cashubtc/cdk!985
No description provided.