@getalby/bitcoin-connect
Advanced tools
Comparing version 1.1.2 to 1.2.0
@@ -326,6 +326,7 @@ import { BitcoinConnectElement } from './BitcoinConnectElement'; | ||
protected _closing: boolean; | ||
open?: boolean; | ||
constructor(); | ||
connectedCallback(): void; | ||
disconnectedCallback(): void; | ||
render(): import("lit-html").TemplateResult<1>; | ||
render(): import("lit-html").TemplateResult<1> | null; | ||
private _handleClose; | ||
@@ -332,0 +333,0 @@ } |
{ | ||
"name": "@getalby/bitcoin-connect", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "Web components to connect to a lightning wallet and power a website with WebLN", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -7,3 +7,3 @@ # Bitcoin Connect | ||
https://getalby.github.io/bitcoin-connect | ||
[Bitcoin Connect Landing](https://getalby.github.io/bitcoin-connect) | ||
@@ -26,8 +26,28 @@ ## π Quick Start | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/@getalby/bitcoin-connect@1.1.2/dist/index.browser.js"></script> | ||
``` | ||
<script src="https://cdn.jsdelivr.net/npm/@getalby/bitcoin-connect@1.1.0/dist/index.browser.js"></script> | ||
``` | ||
## π€ Usage | ||
### React | ||
```jsx | ||
import {Button, Modal, launchModal} from '@getalby/bitcoin-connect-react'; | ||
// render a button | ||
<Button onConnect={() => alert('Connected!')} /> | ||
// include the modal on the page (will not be rendered unless launchModal is called) | ||
<Modal onConnect={() => alert('Connected!')} /> | ||
// open modal programmatically | ||
<button onClick={launchModal}> | ||
Programmatically launch modal | ||
</button> | ||
``` | ||
### Pure HTML | ||
#### Components | ||
Bitcoin Connect exposes the following web components for allowing users to connect their desired Lightning wallet: | ||
@@ -39,6 +59,10 @@ | ||
- `disabled` - mark the button as disabled | ||
- `<bc-modal/>` - render the modal on its own | ||
- `<bc-modal/>` - render the modal on its own. | ||
- Optional Arguments: | ||
- `open` - make the modal appear | ||
- `<bc-connector-list/>` - render the list of connectors on their own | ||
- _more components coming soon_ | ||
#### Window Events | ||
Bitcoin Connect exposes the following events: | ||
@@ -52,11 +76,11 @@ | ||
Current wallets supported: | ||
#### Programmatically launching the modal | ||
- [Alby Browser extension](https://getalby.com) | ||
- [Alby NWC](https://nwc.getalby.com) | ||
- [Generic NWC URL](https://github.com/nostr-protocol/nips/blob/master/47.md) | ||
`<bc-modal/>` needs to be rendered somewhere on the page. The modal can then be launched with: | ||
`document.querySelector('bc-modal').setAttribute('open', true)` | ||
### Styling | ||
- the following CSS variables can be configured: | ||
The following CSS variables can be configured: | ||
@@ -75,15 +99,15 @@ ```css | ||
# Demos | ||
## Demos | ||
### Pure HTML | ||
### Pure HTML Demo | ||
See [Pure HTML](./demos/html/README.md) | ||
> Example codepen: https://codepen.io/rolznz/pen/ZEmXGLd | ||
> [Example codepen](https://codepen.io/rolznz/pen/ZEmXGLd) | ||
### React | ||
### React Demo | ||
See [React](./demos/react/README.md) | ||
> Example replit: https://replit.com/@rolznz/make-me-an-image-nwc-version | ||
> [Example replit](https://replit.com/@rolznz/make-me-an-image-nwc-version) | ||
@@ -94,17 +118,17 @@ ### More demos | ||
# π οΈ Development | ||
## π οΈ Development | ||
## Install | ||
### Install | ||
Run `yarn install && (cd dev/vite && yarn install)` | ||
## Run Vite | ||
### Run Vite | ||
Run `yarn dev` | ||
## Other dev options | ||
### Other dev options | ||
Open [dev](dev/README.md) | ||
## Production Build | ||
### Production Build | ||
@@ -121,7 +145,7 @@ `yarn build` | ||
## Testing | ||
### Testing | ||
`yarn test` | ||
# Need help? | ||
## Need help? | ||
@@ -138,2 +162,6 @@ We are happy to help, please contact us or create an issue. | ||
### How does it work? | ||
Bitcoin Connect provides multiple options to the user to connect to a lightning wallet, each compatible with WebLN. Any already-existing providers of WebLN (such as an installed WebLN extension like Alby) are detected and offered, as well as options to create a new WebLN provider through protocols such as NWC. No matter which option you choose, window.webln will become available for the website to use to interact with your lightning wallet. Similar to the Alby extension, new options (called Connectors) can be easily added as they all follow a common, simple interface. As long as there is a way to connect to a lightning wallet through Javascript, a connector can be created for it in Bitcoin Connect. We welcome any and all contributions for new connectors! | ||
### Does this work on mobile browsers and mobile PWAs, or desktop browsers without a WebLN extension? | ||
@@ -168,4 +196,10 @@ | ||
# π₯ Lit | ||
### What connectors are supported? | ||
- [Alby Browser extension](https://getalby.com) | ||
- [Alby NWC](https://nwc.getalby.com) | ||
- [Generic NWC URL](https://github.com/nostr-protocol/nips/blob/master/47.md) | ||
## π₯ Lit | ||
This project is powered by Lit. | ||
@@ -172,0 +206,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2600526
21081
203