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

feat: add sendMultiPayment function and example #190

Merged
merged 3 commits into from
Jan 23, 2024

Conversation

rolznz
Copy link
Contributor

@rolznz rolznz commented Jan 22, 2024

This adds a dependency on lightning-tools to decode invoices, since the current spec returns payment hashes by default.
Or we could remove the dependency and generate ids and pass them to do the mapping, maybe that's better.
UPDATE: using id field of nwc to map instead of payment hash

The idea is that you can pay multiple invoices in a single request, but you need to know which ones succeeded and which ones failed. I was thinking an object like:

{
  payments: [
    {
      paymentRequest: 'lnbc...',
      preimage: '7c2c....'
    },
    ...,
  ],
  errors: [{
     paymentRequest: 'lnbc...',
     message: "Insufficient balance".
     code: 1234
  }]
}

Note: the error handling isn't done yet

Copy link

socket-security bot commented Jan 22, 2024

New dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@getalby/[email protected] network 0 134 kB reneaaron

View full report↗︎

@rolznz
Copy link
Contributor Author

rolznz commented Jan 23, 2024

Update: we need to work on some other things like splitting the NWC client from the WebLN client. I will mark this method as unconfirmed until it is properly added to WebLN and the Alby extension

@rolznz rolznz merged commit 87b8e2d into master Jan 23, 2024
3 checks passed
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.

2 participants