Skip to content

Commit

Permalink
chore: rename package (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
rolznz committed Aug 26, 2023
1 parent d701d83 commit ac75ba7
Show file tree
Hide file tree
Showing 43 changed files with 266 additions and 275 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"files.exclude": {
"dist": true
"dist": true,
"react/dist": true
},
"editor.formatOnSave": true,
"tailwindCSS.experimental.configFile": {
Expand Down
52 changes: 26 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Lightning Wallet Connect
# Bitcoin Connect

This project includes web components for connecting to Lightning Wallets and enabling [WebLN](https://webln.guide). Websites only need to implement a single interface to connect with multiple wallets (WebLN), and users can connect from both desktop and mobile devices. These components work with pure HTML and all Javascript libraries frameworks such as React, Angular, Vue, Solid.js, etc.

Expand All @@ -10,17 +10,17 @@ This project includes web components for connecting to Lightning Wallets and ena

### Web Components Package

`npm install @getalby/lightning-wallet-connect` or `yarn add @getalby/lightning-wallet-connect`
`npm install @getalby/bitcoin-connect` or `yarn add @getalby/bitcoin-connect`

```
### HTML (CDN)
You can use Lightning Wallet Connect without any build tools:
You can use Bitcoin Connect without any build tools:
```

<script src="https://cdn.jsdelivr.net/npm/@getalby/lightning-wallet-connect@1.0.5/dist/index.browser.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@getalby/bitcoin-connect@1.0.5/dist/index.browser.js"></script>

````
Expand All @@ -30,23 +30,23 @@ https://user-images.githubusercontent.com/33993199/234830578-0baf25f9-0179-4244-
## 🤙 Usage
Lightning wallet connect exposes the following web components for allowing user to connect their desired Lightning wallet:
Bitcoin Connect exposes the following web components for allowing user to connect their desired Lightning wallet:
- `<lwc-button/>` - launches the LWC Modal on click
- `<bc-button/>` - launches the Bitcoin Connect Modal on click
- Optional Arguments:
- `icon-only` - display the button as an icon without "Connect wallet"
- `disabled` - mark the button as disabled. _NOTE: in react disabled={false} will not work - attribute must be omitted_
- `<lwc-modal/>` - render the modal on its own
- `<lwc-connector-list/>` - render the list of connectors on their own
- `disabled` - mark the button as disabled
- `<bc-modal/>` - render the modal on its own
- `<bc-connector-list/>` - render the list of connectors on their own
- _more components coming soon_
Lightning wallet connect exposes the following events:
Bitcoin Connect exposes the following events:
- `lwc:connected` window event which fires when a wallet is connected and window.webln is ready to use
- `lwc:connecting` window event which fires when LWC is connecting to a wallet
- `lwc:disconnected` window event which fires when user has disconnected from their wallet
- `lwc:modalopened` window event which fires when Lightning Wallet Connect modal is opened
- `lwc:modalclosed` window event which fires when Lightning Wallet Connect modal is closed
- `bc:connected` window event which fires when a wallet is connected and window.webln is ready to use
- `bc:connecting` window event which fires when a user is connecting to their wallet
- `bc:disconnected` window event which fires when user has disconnected from their wallet
- `bc:modalopened` window event which fires when Bitcoin Connect modal is opened
- `bc:modalclosed` window event which fires when Bitcoin Connect modal is closed
Current wallets supported:
Expand All @@ -60,13 +60,13 @@ Current wallets supported:
```css
html {
--lwc-color-primary: #21ecc7;
--lwc-color-secondary: #21ecc7;
--lwc-color-bg-primary: black;
--lwc-color-bg-secondary: black;
--lwc-color-text-primary: black;
--lwc-color-text-secondary: #f4f4f4;
--lwc-color-text-tertiary: white;
--bc-color-primary: #21ecc7;
--bc-color-secondary: #21ecc7;
--bc-color-bg-primary: black;
--bc-color-bg-secondary: black;
--bc-color-text-primary: black;
--bc-color-text-secondary: #f4f4f4;
--bc-color-text-tertiary: white;
}
````

Expand All @@ -77,10 +77,10 @@ html {
```html
<html>
<body>
<lwc-button></lwc-button>
<script src="https://cdn.jsdelivr.net/npm/@getalby/lightning-wallet-connect@1.0.5/dist/index.browser.js"></script>
<bc-button></bc-button>
<script src="https://cdn.jsdelivr.net/npm/@getalby/bitcoin-connect@1.0.5/dist/index.browser.js"></script>
<script>
window.addEventListener('lwc:connected', async () => {
window.addEventListener('bc:connected', async () => {
const invoice = // (...invoice generated by backend)
await window.webln.sendPayment(invoice);
confetti();
Expand All @@ -94,7 +94,7 @@ html {

#### Button

> Example replit: https://replit.com/@rolznz/make-me-an-image-lwc-version
> Example replit: https://replit.com/@rolznz/make-me-an-image-bc-version
```tsx
import {Button} from '@getalby/bitcoin-connect-react';
Expand Down
2 changes: 1 addition & 1 deletion demos/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Demos

Please note: these demos point at the production version of Lightning Wallet Connect.
Please note: these demos point at the production version of Bitcoin Connect.

- [React](react/README.md)
- [Pure HTML](html/README.md)
22 changes: 11 additions & 11 deletions demos/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
<html>
<head>
<meta charset="utf-8" />
<title>LWC Development</title>
<script src="https://cdn.jsdelivr.net/npm/@getalby/lightning-wallet-connect@1.0.5/dist/index.browser.js"></script>
<title>Bitcoin Connect</title>
<script src="https://cdn.jsdelivr.net/npm/@getalby/bitcoin-connect@1.0.5/dist/index.browser.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<div style="display: flex; flex-direction: column; gap: 1rem">
<code> &lt;lwc-button /&gt; </code>
<lwc-button></lwc-button>
<code> &lt;lwc-button disabled /&gt; </code>
<lwc-button disabled></lwc-button>
<code> &lt;lwc-button icon-only/&gt; </code>
<lwc-button icon-only></lwc-button>
<code> &lt;lwc-connector-list/&gt; </code>
<lwc-connector-list></lwc-connector-list>
<code> &lt;bc-button /&gt; </code>
<bc-button></bc-button>
<code> &lt;bc-button disabled /&gt; </code>
<bc-button disabled></bc-button>
<code> &lt;bc-button icon-only/&gt; </code>
<bc-button icon-only></bc-button>
<code> &lt;bc-connector-list/&gt; </code>
<bc-connector-list></bc-connector-list>
</div>
<script>
window.addEventListener('lwc:connected', async () => {
window.addEventListener('bc:connected', async () => {
alert('connected');
});
</script>
Expand Down
8 changes: 4 additions & 4 deletions demos/html/minimal.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
<html>
<head>
<meta charset="utf-8" />
<title>LWC Development</title>
<script src="https://cdn.jsdelivr.net/npm/@getalby/lightning-wallet-connect@1.0.7/dist/index.browser.js"></script>
<title>Bitcoin Connect</title>
<script src="https://cdn.jsdelivr.net/npm/@getalby/bitcoin-connect@1.0.7/dist/index.browser.js"></script>
<script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.5.1/dist/confetti.browser.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<div style="position: absolute; right: 16px; top: 16px">
<lwc-button></lwc-button>
<bc-button></bc-button>
</div>
<script>
window.addEventListener('lwc:connected', async () => {
window.addEventListener('bc:connected', async () => {
window.confetti();
});
</script>
Expand Down
2 changes: 1 addition & 1 deletion demos/react/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# demos/react

A simple example of how to add Lightning Wallet Connect to your react app
A simple example of how to add Bitcoin Connect to your react app

## Install

Expand Down
2 changes: 1 addition & 1 deletion demos/react/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>LWC React</title>
<title>Bitcoin Connect React</title>
</head>
<body>
<div id="root"></div>
Expand Down
4 changes: 2 additions & 2 deletions demos/react/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function App() {
(
await ln.requestInvoice({
satoshi: 1,
comment: 'Paid with LWC',
comment: 'Paid with Bitcoin Connect',
})
).paymentRequest
);
Expand All @@ -41,7 +41,7 @@ function App() {

return (
<>
<h1>LWC React</h1>
<h1>Bitcoin Connect React</h1>
<Button onConnect={() => alert('Connected!')} />
<div style={{marginTop: '16px'}}>
{preimage ? (
Expand Down
4 changes: 2 additions & 2 deletions dev/html/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# dev/browser

Develop Lightning Wallet Connect for pure html import (e.g. `<script src="index.browser.js"></script>`)
Develop Bitcoin Connect for pure html import (e.g. `<script src="index.browser.js"></script>`)

## Install

Expand All @@ -10,5 +10,5 @@ Run `yarn install` here and in the root directory.

**Please note:** compile speeds are slow due to the bundling of `index.browser.js`. use [vite](../vite/README.md) for improved developer experience.

1. Run `yarn dev:build:browser` in the parent directory. This will build Lightning Wallet Connect into a self-contained javascript file.
1. Run `yarn dev:build:browser` in the parent directory. This will build Bitcoin Connect into a self-contained javascript file.
2. Run `yarn dev` in this directory. This will serve the dev site and watch for changes.
20 changes: 10 additions & 10 deletions dev/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
<html>
<head>
<meta charset="utf-8" />
<title>LWC Development</title>
<title>Bitcoin Connect</title>
<script src="/dist/index.browser.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<div style="display: flex; flex-direction: column; gap: 1rem">
<code> &lt;lwc-button /&gt; </code>
<lwc-button></lwc-button>
<code> &lt;lwc-button disabled /&gt; </code>
<lwc-button disabled></lwc-button>
<code> &lt;lwc-button icon-only/&gt; </code>
<lwc-button icon-only></lwc-button>
<code> &lt;lwc-connector-list/&gt; </code>
<lwc-connector-list></lwc-connector-list>
<code> &lt;bc-button /&gt; </code>
<bc-button></bc-button>
<code> &lt;bc-button disabled /&gt; </code>
<bc-button disabled></bc-button>
<code> &lt;bc-button icon-only/&gt; </code>
<bc-button icon-only></bc-button>
<code> &lt;bc-connector-list/&gt; </code>
<bc-connector-list></bc-connector-list>
</div>
<script>
window.addEventListener('lwc:connected', async () => {
window.addEventListener('bc:connected', async () => {
alert('connected');
});
</script>
Expand Down
2 changes: 1 addition & 1 deletion dev/vite/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# dev/vite

Develop Lightning Wallet Connect components using [Vite](https://vitejs.dev/)
Develop Bitcoin Connect components using [Vite](https://vitejs.dev/)

## Install

Expand Down
Loading

0 comments on commit ac75ba7

Please sign in to comment.