Skip to content

Commit

Permalink
chore: release version 2.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
rolznz committed Oct 20, 2023
1 parent d503ae4 commit dee99ed
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 27 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ https://bitcoin-connect.com

You can use Bitcoin Connect without any build tools:

> NOTE: LNC connector is not supported!
```html
<script src="https://cdn.jsdelivr.net/npm/@getalby/bitcoin-connect@2.0.0/dist/index.browser.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@getalby/bitcoin-connect@2.1.3/dist/index.browser.js"></script>
```

## 🤙 Usage
Expand Down
2 changes: 1 addition & 1 deletion demos/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta charset="utf-8" />
<title>Bitcoin Connect</title>
<script src="https://cdn.jsdelivr.net/npm/@getalby/bitcoin-connect@2.0.0/dist/index.browser.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@getalby/bitcoin-connect@2.1.3/dist/index.browser.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion demos/html/minimal.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta charset="utf-8" />
<title>Bitcoin Connect</title>
<script src="https://cdn.jsdelivr.net/npm/@getalby/bitcoin-connect@2.0.0/dist/index.browser.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@getalby/bitcoin-connect@2.1.3/dist/index.browser.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/confetti.browser.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
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": "^2.0.0",
"@getalby/bitcoin-connect-react": "^2.1.3",
"@getalby/lightning-tools": "^4.0.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
34 changes: 24 additions & 10 deletions demos/react/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -149,19 +149,20 @@
resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.46.0.tgz#3f7802972e8b6fe3f88ed1aabc74ec596c456db6"
integrity sha512-a8TLtmPi8xzPkCbp/OGFUo5yhRkHM2Ko9kOWP4znJr0WAhWyThaw3PnwX4vOTWOAMsV2uRt32PPDcEz63esSaA==

"@getalby/bitcoin-connect-react@^2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@getalby/bitcoin-connect-react/-/bitcoin-connect-react-2.0.0.tgz#f99f78754b1627619b511760274efb40f9723c92"
integrity sha512-PlpXDk/p3y+2zyWRlgkKc+t5XN6wbJr9xZSWYayYFs+i988lrE1BqcydGAoYI6SotoaYpt3FDyOKgGfB4dyzsw==
"@getalby/bitcoin-connect-react@^2.1.3":
version "2.1.3"
resolved "https://registry.yarnpkg.com/@getalby/bitcoin-connect-react/-/bitcoin-connect-react-2.1.3.tgz#0a072964b5807f34b8c86cad5f40747887f9dade"
integrity sha512-uEJW4Y2p9YEYfxZgL7v/57C+GElV1IWv/6q5AQyPLi6udgJugeU8vU1pcYefV7CeLvobROA7E+jf2Kn/Hj9pkA==
dependencies:
"@getalby/bitcoin-connect" "^2.0.0"
"@getalby/bitcoin-connect" "^2.1.3"

"@getalby/bitcoin-connect@^2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@getalby/bitcoin-connect/-/bitcoin-connect-2.0.0.tgz#9ae7f139a616a65a55008d8b8d808ebd6fc316c6"
integrity sha512-cLtEHenPiF8n/gbC8jG81D8lgPgRhSsNM3TeIBHbMQComyciuB2/Yth6sh4CNUefAbAN5Br97guaNGur4umBZg==
"@getalby/bitcoin-connect@^2.1.3":
version "2.1.3"
resolved "https://registry.yarnpkg.com/@getalby/bitcoin-connect/-/bitcoin-connect-2.1.3.tgz#7485ad3279f7800b0f924d63658adcef371ee6e0"
integrity sha512-kX93lJUemFWcwkgXbXJHi9mj3uyyXhlQLwt2/x3Pi29RKzU2rmXocdxZqP6SfwWxtFwuwAfmMRqmxusUbVurTQ==
dependencies:
"@getalby/sdk" "^2.4.0"
"@lightninglabs/lnc-web" "^0.2.6-alpha"
lit "^2.2.4"
zustand "^4.4.1"

Expand Down Expand Up @@ -201,6 +202,19 @@
resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45"
integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==

"@lightninglabs/[email protected]":
version "0.2.6-alpha"
resolved "https://registry.yarnpkg.com/@lightninglabs/lnc-core/-/lnc-core-0.2.6-alpha.tgz#1b93d5aeefb09bb3dedcb82988368b15e223f8fd"
integrity sha512-bw2EQG78pPKMZMFwV+TR99RUbYgPVUKQYMLGGKIOvhPds3dBWSDZpMoqOyW/WidWGXF/ugPHzud8lDbKKhNXgA==

"@lightninglabs/lnc-web@^0.2.6-alpha":
version "0.2.6-alpha"
resolved "https://registry.yarnpkg.com/@lightninglabs/lnc-web/-/lnc-web-0.2.6-alpha.tgz#34f54f65691ff8cdef6eb159321b70c94f198f9e"
integrity sha512-SrqR8xaDnFLgNzPe5om7REOAhSOP95jQNIHP0GY0Lv895eDjrI6CPkfCFcX97INoDWYHBvDT8DZeYkBvlznVNA==
dependencies:
"@lightninglabs/lnc-core" "0.2.6-alpha"
crypto-js "4.1.1"

"@lit-labs/ssr-dom-shim@^1.0.0", "@lit-labs/ssr-dom-shim@^1.1.0":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.1.1.tgz#64df34e2f12e68e78ac57e571d25ec07fa460ca9"
Expand Down Expand Up @@ -584,7 +598,7 @@ cross-spawn@^7.0.2:
shebang-command "^2.0.0"
which "^2.0.1"

crypto-js@^4.1.1:
crypto-js@4.1.1, crypto-js@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/crypto-js/-/crypto-js-4.1.1.tgz#9e485bcf03521041bd85844786b83fb7619736cf"
integrity sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@getalby/bitcoin-connect",
"version": "2.0.0",
"version": "2.1.3",
"description": "Web components to connect to a lightning wallet and power a website with WebLN",
"type": "module",
"source": "src/index.ts",
Expand All @@ -19,7 +19,7 @@
"scripts": {
"prebuild": "yarn run clean",
"prepack": "yarn run build",
"build:browser": "esbuild dist/index.modern.js --bundle --outfile=dist/index.browser.js",
"build:browser": "esbuild dist/index.modern.js --bundle --external:@lightninglabs/lnc-web --outfile=dist/index.browser.js",
"build": "microbundle && yarn build:browser",
"clean": "rm -rf dist",
"dev": "yarn --cwd dev/vite dev",
Expand Down
4 changes: 2 additions & 2 deletions react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@getalby/bitcoin-connect-react",
"version": "2.0.0",
"version": "2.1.3",
"type": "module",
"source": "src/index.ts",
"main": "./dist/index.cjs",
Expand All @@ -21,7 +21,7 @@
"build": "microbundle --globals react=React --jsx React.createElement --jsxFragment React.Fragment --jsxImportSource react"
},
"dependencies": {
"@getalby/bitcoin-connect": "^2.0.0"
"@getalby/bitcoin-connect": "^2.1.3"
},
"devDependencies": {
"@types/react": "^18.2.21",
Expand Down
24 changes: 19 additions & 5 deletions react/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1018,12 +1018,13 @@
"@babel/helper-validator-identifier" "^7.22.5"
to-fast-properties "^2.0.0"

"@getalby/bitcoin-connect@^2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@getalby/bitcoin-connect/-/bitcoin-connect-2.0.0.tgz#9ae7f139a616a65a55008d8b8d808ebd6fc316c6"
integrity sha512-cLtEHenPiF8n/gbC8jG81D8lgPgRhSsNM3TeIBHbMQComyciuB2/Yth6sh4CNUefAbAN5Br97guaNGur4umBZg==
"@getalby/bitcoin-connect@^2.1.3":
version "2.1.3"
resolved "https://registry.yarnpkg.com/@getalby/bitcoin-connect/-/bitcoin-connect-2.1.3.tgz#7485ad3279f7800b0f924d63658adcef371ee6e0"
integrity sha512-kX93lJUemFWcwkgXbXJHi9mj3uyyXhlQLwt2/x3Pi29RKzU2rmXocdxZqP6SfwWxtFwuwAfmMRqmxusUbVurTQ==
dependencies:
"@getalby/sdk" "^2.4.0"
"@lightninglabs/lnc-web" "^0.2.6-alpha"
lit "^2.2.4"
zustand "^4.4.1"

Expand Down Expand Up @@ -1076,6 +1077,19 @@
"@jridgewell/resolve-uri" "^3.1.0"
"@jridgewell/sourcemap-codec" "^1.4.14"

"@lightninglabs/[email protected]":
version "0.2.6-alpha"
resolved "https://registry.yarnpkg.com/@lightninglabs/lnc-core/-/lnc-core-0.2.6-alpha.tgz#1b93d5aeefb09bb3dedcb82988368b15e223f8fd"
integrity sha512-bw2EQG78pPKMZMFwV+TR99RUbYgPVUKQYMLGGKIOvhPds3dBWSDZpMoqOyW/WidWGXF/ugPHzud8lDbKKhNXgA==

"@lightninglabs/lnc-web@^0.2.6-alpha":
version "0.2.6-alpha"
resolved "https://registry.yarnpkg.com/@lightninglabs/lnc-web/-/lnc-web-0.2.6-alpha.tgz#34f54f65691ff8cdef6eb159321b70c94f198f9e"
integrity sha512-SrqR8xaDnFLgNzPe5om7REOAhSOP95jQNIHP0GY0Lv895eDjrI6CPkfCFcX97INoDWYHBvDT8DZeYkBvlznVNA==
dependencies:
"@lightninglabs/lnc-core" "0.2.6-alpha"
crypto-js "4.1.1"

"@lit-labs/ssr-dom-shim@^1.0.0", "@lit-labs/ssr-dom-shim@^1.1.0":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.1.1.tgz#64df34e2f12e68e78ac57e571d25ec07fa460ca9"
Expand Down Expand Up @@ -1584,7 +1598,7 @@ cosmiconfig@^7.0.0:
path-type "^4.0.0"
yaml "^1.10.0"

crypto-js@^4.1.1:
crypto-js@4.1.1, crypto-js@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/crypto-js/-/crypto-js-4.1.1.tgz#9e485bcf03521041bd85844786b83fb7619736cf"
integrity sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==
Expand Down
8 changes: 6 additions & 2 deletions src/components/connectors/bc-lnc-connector.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
import {customElement} from 'lit/decorators.js';
import {ConnectorElement} from './ConnectorElement';
import {lnc} from '../../connectors/LNCConnector';
import {lncIcon} from '../icons/connectors/lncIcon';
import {getLNC} from '../../connectors/LNCConnector';

@customElement('bc-lnc-connector')
export class LNCConnector extends ConnectorElement {
constructor() {
super('lnc', 'LNC', '#101727', lncIcon);
}

protected _onClick() {
protected async _onClick() {
// TODO: improve UX for entering pairing phrase, allow scanning QR code?
const pairingPhrase = window.prompt('Enter pairing phrase');
if (!pairingPhrase) {
return;
}

const lnc = await getLNC();
if (!lnc) {
throw new Error('LNC not supported');
}
lnc.credentials.pairingPhrase = pairingPhrase;

this._connect({});
Expand Down
21 changes: 19 additions & 2 deletions src/connectors/LNCConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,27 @@ import {
WebLNProvider,
WebLNRequestMethod,
} from '@webbtc/webln-types';
import LNC from '@lightninglabs/lnc-web';
import type LNC from '@lightninglabs/lnc-web';
import {base64ToHex} from '../utils/base64ToHex';

// global instance of LNC
export const lnc = new LNC();
let lnc: LNC;

export async function getLNC() {
try {
if (lnc) {
return lnc;
}
const LNC = (await import('@lightninglabs/lnc-web')).default;
lnc = new LNC();
return lnc;
} catch (error) {
console.error(error);
throw new Error('LNC is not available');
}
}

export {lnc};
// NOTE: as per NWC and other connectors - the user must put trust in the website to not use funds
// without the user's permission.
const lncPassword = 'ONLY CONNECT TO TRUSTED WEBSITES';
Expand All @@ -28,6 +44,7 @@ export class LNCConnector extends Connector {
}

override async init() {
await getLNC();
window.webln = new LNCWebLNProvider();

try {
Expand Down

0 comments on commit dee99ed

Please sign in to comment.