Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom offers #678

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add custom offers #678

wants to merge 1 commit into from

Conversation

thomash-acinq
Copy link
Member

Allow creating more offers with customizable amount and description.

@thomash-acinq thomash-acinq requested a review from pm47 July 4, 2024 08:52
@pm47
Copy link
Member

pm47 commented Jul 4, 2024

The catch here is that the invoice is not persisted and would need to be recreated after startup though IIUC.

@thomash-acinq
Copy link
Member Author

Correct

* @param secret A random private key for creating the blinded path of the offer. Must be unique to this offer.
* The offer returned is deterministic, if you need to persist you just need to save the parameters used to create it.
*/
fun createOffer(secret: PrivateKey, amount: MilliSatoshi?, description: String?): OfferTypes.Offer {

This comment was marked as resolved.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noted that this is done inside OfferTypes :)

Copy link
Contributor

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I left some comments for improving my understanding.

I am building on top of this PR to allow phoenixd to create offers with descriptions.

Following the comments inside the PR storing inside the db the secret: PrivateKey, amount: MilliSatoshi?, description: String? should be enough to recreate the offers right?

Allow creating more offers with customizable amount and description.
@robbiehanson
Copy link
Contributor

I need this for a feature I'm working on in Phoenix (PR #665)

Here's the use case:

  • A merchant scans a Bolt Card (v2) with Phoenix app
  • The card outputs:
    • encrypted data (for card holder's wallet to decrypt)
    • a method to contact the card holder's wallet directly over the lightning network
  • Next the merchant generates a temporary offer (with an amount)
  • And then he sends an onion message to the card holder's wallet (which contains his offer, and the card's encrypted data)

So Peer.createOffer is exactly what I need. And for my use case, it doesn't matter if the offer is not persisted.

@vincenzopalazzo
Copy link
Contributor

vincenzopalazzo commented Mar 2, 2025

Hi @robbiehanson I wrote a PR that should be doing this exactly and also working on persistence in #743

Let me know if I need to do something on it that it is not right with the work hat you are doing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants