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

Bitcoin Connect Version 3 #138

Closed
14 tasks
rolznz opened this issue Nov 29, 2023 · 0 comments · Fixed by #140
Closed
14 tasks

Bitcoin Connect Version 3 #138

rolznz opened this issue Nov 29, 2023 · 0 comments · Fixed by #140
Assignees

Comments

@rolznz
Copy link
Collaborator

rolznz commented Nov 29, 2023

We have some improvements we could make which involve breaking changes, with the reasoning why:

  • As much as possible configuration should be done in pure JS. This is so attributes do not need to be passed through HTML attributes which are limited in what types can be used and require additional boilerplate to update the state (and then conflicts between attributes and state variables). It's also unclear where you pass them if you do not actually render any HTML elements, which will now be possible.
    • Only pass invoice to launchModal - do not allow passing it to the modal component itself
    • core configuration will be possible through a new init function exposed by the BC api (where you can pass things like showBalance: false, filters: ["nwc"], appName: "Zap.stream") etc.
    • Only retain attributes on elements that only apply to that specific element - like the title field on bc-button.
  • bc-modal will now be automatically injected into the DOM by launchModal. This reduces a line of code and simplifies for the developer (they don't need to consider where it should be rendered)
  • the provider will not be injected into the window by default. Global state should be avoided, and the provider can be accessed through connected callbacks. Note: we still need to show somewhere on the README how the provider can be set so that BC can be easily integrated into existing apps which rely on window.webln. WebLN.guide and webln-types currently assumes WebLN exists in the window.
  • Init() is explicitly called. Multiple devs have run into the issue where Bitcoin Connect is not available globally.
  • WebLN provider internal implementation will be able to be easily accessed through Typescript
  • WebLN provider is now exposed in nice callback methods rather than using window events (e.g. onConnect: provider => provider.nwc && provider.nwc.connectionString))
  • Add a new requestProvider function, that after executing the function the app can know they have a usable webln provider instance.
  • No longer rely on esbuild for usage in pure html. Use <script type="module">

TODO

  • Upgrade guide
  • Link to version 2 docs from README
  • List breaking changes in release notes
@rolznz rolznz mentioned this issue Dec 1, 2023
21 tasks
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 a pull request may close this issue.

3 participants