Skip to content

Commit

Permalink
Merge pull request #39 from getAlby/chore/rename
Browse files Browse the repository at this point in the history
Chore: Rename Package
  • Loading branch information
rolznz authored Aug 28, 2023
2 parents 0885362 + dccb6bd commit 9b14910
Show file tree
Hide file tree
Showing 47 changed files with 284 additions and 295 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
2 changes: 1 addition & 1 deletion demos/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"preview": "vite preview"
},
"dependencies": {
"@getalby/bitcoin-connect-react": "^1.0.0",
"@getalby/bitcoin-connect-react": "^1.0.1",
"alby-tools": "^3.2.1",
"react": "^18.2.0",
"react-dom": "^18.2.0"
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
18 changes: 9 additions & 9 deletions demos/react/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,17 @@
resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.46.0.tgz#3f7802972e8b6fe3f88ed1aabc74ec596c456db6"
integrity sha512-a8TLtmPi8xzPkCbp/OGFUo5yhRkHM2Ko9kOWP4znJr0WAhWyThaw3PnwX4vOTWOAMsV2uRt32PPDcEz63esSaA==

"@getalby/bitcoin-connect-react@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@getalby/bitcoin-connect-react/-/bitcoin-connect-react-1.0.0.tgz#c8124cc0d92c04a53d0b6e599dec7daf142c7cf0"
integrity sha512-64CYGkzy+7fazJbb7A+Y3tNTyUDH9yvVHlTfCL9g1gO1EMuASLIdSG6snToGZpbtkY+6sSOmD7scz0bSIUKtAw==
"@getalby/bitcoin-connect-react@^1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@getalby/bitcoin-connect-react/-/bitcoin-connect-react-1.0.1.tgz#f45f0f6f3e6a971b630df8e748a9fc12c1e47988"
integrity sha512-XNl1/ts62fvzCxKnMcETlCif861CP2kc2+w74GTGHpZDLIqSJmWO9WtGAzEi5C0s14//gGEzeuJc7Uvks2fsNw==
dependencies:
"@getalby/lightning-wallet-connect" "^1.0.14"
"@getalby/bitcoin-connect" "^1.0.0"

"@getalby/lightning-wallet-connect@^1.0.14":
version "1.0.14"
resolved "https://registry.yarnpkg.com/@getalby/lightning-wallet-connect/-/lightning-wallet-connect-1.0.14.tgz#9e9641a596bb478126a63acf55aca306465070af"
integrity sha512-9Xlk7L0qsZOSc6yXWn86QWbfVRV36dXIP+LWgIae4YA545WRlUwHe5z3dtOY+jEPkXBcF/70Kr4au9tk9jpcvQ==
"@getalby/bitcoin-connect@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@getalby/bitcoin-connect/-/bitcoin-connect-1.0.0.tgz#295471a408854cc8186225739d0637df19fca2d6"
integrity sha512-O40SvuQpf8cD5MblYwO8DcyC2P5ynMGhRksRB/wyhd4qemQQaiaFczfxwOOlvmUcEJKSdGJ8bYY1HaTOU54O5A==
dependencies:
"@getalby/sdk" "^2.2.3"
lit "^2.2.4"
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 9b14910

Please sign in to comment.