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

Expose WebLN interface via React Context #749

Merged
merged 77 commits into from
Feb 8, 2024
Merged

Expose WebLN interface via React Context #749

merged 77 commits into from
Feb 8, 2024

Commits on Feb 1, 2024

  1. Add LNbits card

    ekzyis committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    3177672 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3e8af2f View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    7ad058f View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    76ba4d7 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    8ef1159 View commit details
    Browse the repository at this point in the history
  6. Remove deprecated FIXME

    ekzyis committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    9cd32b5 View commit details
    Browse the repository at this point in the history
  7. Try WebLN provider first

    ekzyis committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    632b1bf View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    d62cfbe View commit details
    Browse the repository at this point in the history
  9. Fix this in sendPayment

    ekzyis committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    860c54a View commit details
    Browse the repository at this point in the history
  10. Be optimistic regarding WebLN zaps

    This wraps the WebLN payment promise with Apollo cache updates.
    
    We will be optimistics and assume that the payment will succeed and update the cache accordingly.
    
    When we notice that the payment failed, we undo this update.
    ekzyis committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    c9e7ba0 View commit details
    Browse the repository at this point in the history
  11. Bold strike on WebLN zap

    If lightning strike animation is disabled, toaster will be used.
    ekzyis committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    8f0e974 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    e93b9cb View commit details
    Browse the repository at this point in the history
  13. Fix zap undo

    ekzyis committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    c63b4a7 View commit details
    Browse the repository at this point in the history
  14. Add NWC card

    ekzyis committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    0f7f1a5 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    d659ff2 View commit details
    Browse the repository at this point in the history
  16. Fix NaN on zap

    Third argument of update is reserved for context
    ekzyis committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    19031bd View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    b7039f9 View commit details
    Browse the repository at this point in the history
  18. Add basic NWC payments

    ekzyis committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    1b4cf78 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    08d0dca View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    0951adc View commit details
    Browse the repository at this point in the history
  21. refactor: Wrap WebLN providers into own context

    I should have done this earlier
    ekzyis committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    bfdbe4e View commit details
    Browse the repository at this point in the history
  22. Show red indicator on error

    ekzyis committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    28c63f6 View commit details
    Browse the repository at this point in the history
  23. Fix useEffect return value

    ekzyis committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    408f20a View commit details
    Browse the repository at this point in the history
  24. Fix wrong usage of pubkey

    The event pubkey is derived from the secret. Doesn't make sense to manually set it. It's also the wrong pubkey: we're not the wallet service.
    ekzyis committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    2da2fc4 View commit details
    Browse the repository at this point in the history
  25. Use p tag in NWC request

    ekzyis committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    0b4684a View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    b3f3f96 View commit details
    Browse the repository at this point in the history
  27. Configuration menu
    Copy the full SHA
    0c01294 View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    e3d01b6 View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    d11d79b View commit details
    Browse the repository at this point in the history
  30. Fix undefined name

    ekzyis committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    335fc76 View commit details
    Browse the repository at this point in the history
  31. Add code to mock NWC relay

    ekzyis committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    7a063d7 View commit details
    Browse the repository at this point in the history
  32. Revert "Bold strike on WebLN zap"

    This reverts commit a9eb27d.
    ekzyis committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    7307217 View commit details
    Browse the repository at this point in the history
  33. Fix update undo

    ekzyis committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    5ce7912 View commit details
    Browse the repository at this point in the history
  34. Configuration menu
    Copy the full SHA
    2eca9eb View commit details
    Browse the repository at this point in the history
  35. WIP: Wrap WebLN payments with toasts

    * add toasts for pending, error, success
    * while pending, invoice can be canceled
    * there are still some race conditions between payiny the invoice / error on payment and invoice cancellation
    ekzyis committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    7c7f652 View commit details
    Browse the repository at this point in the history
  36. Configuration menu
    Copy the full SHA
    17c455a View commit details
    Browse the repository at this point in the history
  37. Remove unnecessary if

    ekzyis committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    ecbdec0 View commit details
    Browse the repository at this point in the history
  38. Configuration menu
    Copy the full SHA
    c479ca1 View commit details
    Browse the repository at this point in the history
  39. Configuration menu
    Copy the full SHA
    3fdd978 View commit details
    Browse the repository at this point in the history
  40. Fix bad retry

    If WebLN payments failed due to insufficient balances, the promise resolved and thus the action was retried but failed immediately since the invoice (still) wasn't paid.
    ekzyis committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    4239568 View commit details
    Browse the repository at this point in the history
  41. Fix cache undo update

    ekzyis committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    c23f7f1 View commit details
    Browse the repository at this point in the history
  42. Configuration menu
    Copy the full SHA
    477eb5c View commit details
    Browse the repository at this point in the history
  43. Configuration menu
    Copy the full SHA
    9f5dcb7 View commit details
    Browse the repository at this point in the history
  44. Remove console.log

    ekzyis committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    263a056 View commit details
    Browse the repository at this point in the history
  45. Configuration menu
    Copy the full SHA
    01de653 View commit details
    Browse the repository at this point in the history
  46. Configuration menu
    Copy the full SHA
    af733aa View commit details
    Browse the repository at this point in the history
  47. Configuration menu
    Copy the full SHA
    49abf98 View commit details
    Browse the repository at this point in the history
  48. Disable NWC mocking

    ekzyis committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    acf6135 View commit details
    Browse the repository at this point in the history
  49. Fix initialValue not set

    But following warning is now shown in console:
    
    """
    Warning: A component is changing a controlled input to be uncontrolled.
    This is likely caused by the value changing from a defined to undefined, which should not happen.
    Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components
    """
    ekzyis committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    7aef8c7 View commit details
    Browse the repository at this point in the history
  50. Configuration menu
    Copy the full SHA
    46ecb77 View commit details
    Browse the repository at this point in the history
  51. Remove TODO

    ekzyis committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    dcf4856 View commit details
    Browse the repository at this point in the history
  52. Fix duplicate cache update

    ekzyis committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    7d454ef View commit details
    Browse the repository at this point in the history
  53. Configuration menu
    Copy the full SHA
    036787b View commit details
    Browse the repository at this point in the history
  54. Ignore lnbits variable unused

    ekzyis committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    aac5d2e View commit details
    Browse the repository at this point in the history

Commits on Feb 2, 2024

  1. Configuration menu
    Copy the full SHA
    c91f9f2 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    2865ca4 View commit details
    Browse the repository at this point in the history
  3. Remove TODO

    Confirmed that nostr-tools verifies events and filters for us.
    
    See https://github.com/nbd-wtf/nostr-tools/blob/master/abstract-relay.ts#L161
    ekzyis committed Feb 2, 2024
    Configuration menu
    Copy the full SHA
    c106eaa View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    a2f6181 View commit details
    Browse the repository at this point in the history
  5. Show 'configure' on error

    ekzyis committed Feb 2, 2024
    Configuration menu
    Copy the full SHA
    c1f41c5 View commit details
    Browse the repository at this point in the history

Commits on Feb 3, 2024

  1. Configuration menu
    Copy the full SHA
    4a084c1 View commit details
    Browse the repository at this point in the history

Commits on Feb 4, 2024

  1. Remove EOSE listener

    Only nostr.mutinywallet.com didn't respond with info events due to implementation-specific reasons. This is no longer the case.
    ekzyis committed Feb 4, 2024
    Configuration menu
    Copy the full SHA
    8db4cd1 View commit details
    Browse the repository at this point in the history

Commits on Feb 5, 2024

  1. Use invoice expiry for NWC timeout

    I don't think there was a specific reason why I used 60 seconds initially.
    ekzyis committed Feb 5, 2024
    Configuration menu
    Copy the full SHA
    1664450 View commit details
    Browse the repository at this point in the history

Commits on Feb 6, 2024

  1. Configuration menu
    Copy the full SHA
    a330f93 View commit details
    Browse the repository at this point in the history

Commits on Feb 7, 2024

  1. Configuration menu
    Copy the full SHA
    6252b25 View commit details
    Browse the repository at this point in the history
  2. Validate NWC config on save

    ekzyis committed Feb 7, 2024
    Configuration menu
    Copy the full SHA
    1046116 View commit details
    Browse the repository at this point in the history
  3. Also show unattach if configuration is invalid

    If unattach is only shown if configuration is valid, resetting the configuration is not possible while it's invalid. So we're stuck with a red wallet indicator.
    ekzyis committed Feb 7, 2024
    Configuration menu
    Copy the full SHA
    b38377b View commit details
    Browse the repository at this point in the history
  4. Fix detection of WebLN payment

    It depended on a Apollo cache update function being available. But that is not the case for every WebLN payment.
    ekzyis committed Feb 7, 2024
    Configuration menu
    Copy the full SHA
    19c725e View commit details
    Browse the repository at this point in the history
  5. Fix formik bag lost

    ekzyis committed Feb 7, 2024
    Configuration menu
    Copy the full SHA
    cc6c460 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    ac347c7 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    08401e9 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    838fab2 View commit details
    Browse the repository at this point in the history

Commits on Feb 8, 2024

  1. Configuration menu
    Copy the full SHA
    f397352 View commit details
    Browse the repository at this point in the history
  2. Rename configJSON to config

    Naming of config object was inconsistent with saveConfig function which was annoying.
    
    Also fixed other inconsistencies between LNbits and NWC provider.
    ekzyis committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    4873c2f View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    4b95add View commit details
    Browse the repository at this point in the history
  4. Update TODO comment about provider priority

    The list 'paymentMethods' is not used yet but is already implemented for future iterations.
    ekzyis committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    998a600 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    7a55913 View commit details
    Browse the repository at this point in the history
  6. Update labels

    ekzyis committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    4c0aa5a View commit details
    Browse the repository at this point in the history