Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@getalby/bitcoin-connect

Package Overview
Dependencies
Maintainers
4
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@getalby/bitcoin-connect - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

dist/components/bc-help.d.ts

7

dist/components/bc-modal.d.ts
import { BitcoinConnectElement } from './BitcoinConnectElement';
import './bc-modal-content.js';
import './bc-router-outlet.js';
import './bc-modal-header';
declare const Modal_base: (new (...args: any[]) => {

@@ -10,5 +11,3 @@ readonly tw: import("@twind/core").Twind<any, CSSStyleSheet>;

autocapitalize: string;
dir: string; /**
* Called when modal is closed
*/
dir: string;
draggable: boolean;

@@ -15,0 +14,0 @@ hidden: boolean;

@@ -1,6 +0,6 @@

import { LitElement } from 'lit';
import { InternalElement } from './internal/InternalElement';
/**
* @fires bc:connected - Indicates a wallet has been connected and window.webln is now available and enabled
*/
export declare class BitcoinConnectElement extends LitElement {
export declare class BitcoinConnectElement extends InternalElement {
protected _connected: boolean;

@@ -13,4 +13,3 @@ protected _connecting: boolean;

connectedCallback(): void;
static styles: import("lit").CSSResult;
}
//# sourceMappingURL=BitcoinConnectElement.d.ts.map
import { ConnectorConfig } from '../types/ConnectorConfig';
import { Route as Route } from '../components/routes';
interface Store {
readonly route: Route;
readonly connected: boolean;

@@ -12,2 +14,3 @@ readonly connecting: boolean;

setBalance(balance: number | undefined): void;
setRoute(route: Route): void;
}

@@ -14,0 +17,0 @@ declare const store: import("zustand/vanilla").StoreApi<Store>;

{
"name": "@getalby/bitcoin-connect",
"version": "1.0.0",
"version": "1.1.0",
"description": "Web components to connect to a lightning wallet and power a website with WebLN",

@@ -5,0 +5,0 @@ "type": "module",

# 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.
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 or frameworks, such as React, Angular, Vue, Solid.js, etc.
## 🛝 Try it out here
https://getalby.github.io/bitcoin-connect
## 🚀 Quick Start

@@ -15,4 +19,2 @@

```
### HTML (CDN)

@@ -23,14 +25,8 @@

```
<script src="https://cdn.jsdelivr.net/npm/@getalby/bitcoin-connect@1.0.0/dist/index.browser.js"></script>
```
<script src="https://cdn.jsdelivr.net/npm/@getalby/bitcoin-connect@1.0.5/dist/index.browser.js"></script>
````
## 📽️ Demo
https://user-images.githubusercontent.com/33993199/234830578-0baf25f9-0179-4244-941c-0c558c613a7a.mov
## 🤙 Usage
Bitcoin Connect exposes the following web components for allowing user to connect their desired Lightning wallet:
Bitcoin Connect exposes the following web components for allowing users to connect their desired Lightning wallet:

@@ -55,3 +51,3 @@ - `<bc-button/>` - launches the Bitcoin Connect Modal on click

- [Alby Browser extension] (https://getalby.com)
- [Alby Browser extension](https://getalby.com)
- [Alby NWC](https://nwc.getalby.com)

@@ -62,3 +58,3 @@ - [Generic NWC URL](https://github.com/nostr-protocol/nips/blob/master/47.md)

- the following css variables can be configured as hex or rgb:
- the following CSS variables can be configured:

@@ -75,40 +71,20 @@ ```css

}
````
```
# Demos
### Pure HTML
See [Pure HTML](./demos/html/README.md)
> Example codepen: https://codepen.io/rolznz/pen/ZEmXGLd
```html
<html>
<body>
<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('bc:connected', async () => {
const invoice = // (...invoice generated by backend)
await window.webln.sendPayment(invoice);
confetti();
});
</script>
</body>
</html>
```
### React
#### Button
See [React](./demos/react/README.md)
> Example replit: https://replit.com/@rolznz/make-me-an-image-bc-version
> Example replit: https://replit.com/@rolznz/make-me-an-image-nwc-version
```tsx
import {Button} from '@getalby/bitcoin-connect-react';
### More demos
const invoice = // (...invoice generated by backend)
return <Button onConnect={() => window.webln.sendPayment(invoice)}/>
```
# Demos
Open [demos](demos/README.md)

@@ -158,28 +134,22 @@

- Does this work on mobile browsers and mobile PWAs, or desktop browsers without a WebLN extension?
### Does this work on mobile browsers and mobile PWAs, or desktop browsers without a WebLN extension?
Yes! that's the main benefit.
- Does it work with a desktop extension enabled?
### Does it work with a desktop extension enabled?
Yes. It will use the desktop extension as the default connector if it exists.
- Can I connect it to my mobile wallet?
### Can I connect it to my mobile wallet?
That depends. The connection to your lightning node / wallet needs to be asynchronous so that you can use Bitcoin Connect natively on mobile websites or PWAs.
- Can a user connect any lightning wallet?
### Can a user connect any lightning wallet?
It will only work for the connectors that are shown in the modal. Some of these connectors (e.g. the Alby Browser Extension) allow to connect multiple wallets themselves. Feel free to contribute to add a new connector.
- Does it "remember" the user if they leave the page or close the browser?
### Does it "remember" the user if they leave the page or close the browser?
Yes. Your connection is saved to localStorage
- Is this safe?
### Is this safe?
You should have a certain level of trust on the website you decide to connect your wallet with, and that they ensure there is no malicious third-party scripts which would intend to read the wallet connection configuration, either from memory or storage. Connectors with budget controls or confirmation dialogs (Alby extension or NWC) are recommend so you have full control over your connection.
- What are the high level things I need to do to add this to my site?
### What are the high level things I need to do to add this to my site?
1. add the "Connect Wallet" button

@@ -186,0 +156,0 @@ 2. wait for a connection event (using window.addEventListener) and then request to pay the invoice with window.webln

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 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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc