diff --git a/README.md b/README.md
index 125e471..36a6307 100644
--- a/README.md
+++ b/README.md
@@ -36,13 +36,13 @@ You can use Bitcoin Connect without any build tools:
```html
@@ -204,6 +204,7 @@ Bitcoin Connect exposes the following web components for allowing users to conne
- `` - launches the Bitcoin Connect Payment Modal on click
- Arguments:
- `invoice` - BOLT11 invoice. Modal will only open if an invoice is set
+ - `payment-methods` (optional) "all" | "external" | "internal"
- `title` - (optional) change the title of the button
- `preimage` - (optional) set this if you received an external payment
- Events:
@@ -213,6 +214,7 @@ Bitcoin Connect exposes the following web components for allowing users to conne
- `` - render a payment request UI without modal
- Arguments:
- `invoice` - BOLT11 invoice
+ - `payment-methods` (optional) "all" | "external" | "internal"
- `paid` - **Experimental** set to true to mark payment was made externally (This will change to `preimage` in v4)
- Events:
- `bc:onpaid` - fires event with WebLN payment response in `event.detail` (contains `preimage`)
@@ -274,6 +276,7 @@ import {launchPaymentModal} from '@getalby/bitcoin-connect';
const {setPaid} = launchPaymentModal({
invoice: 'lnbc...',
+ //paymentMethods: "all" // "all" | "external" | "internal"
onPaid: (response) => {
clearInterval(checkPaymentInterval);
alert('Received payment! ' + response.preimage);
diff --git a/demos/react/package.json b/demos/react/package.json
index 0113eed..ab7eecf 100644
--- a/demos/react/package.json
+++ b/demos/react/package.json
@@ -10,7 +10,7 @@
"preview": "vite preview"
},
"dependencies": {
- "@getalby/bitcoin-connect-react": "^3.2.2",
+ "@getalby/bitcoin-connect-react": "^3.3.0-beta.3",
"@getalby/lightning-tools": "^5.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
diff --git a/demos/react/yarn.lock b/demos/react/yarn.lock
index 85fb698..b1fd9ba 100644
--- a/demos/react/yarn.lock
+++ b/demos/react/yarn.lock
@@ -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@^3.2.2":
- version "3.2.2"
- resolved "https://registry.yarnpkg.com/@getalby/bitcoin-connect-react/-/bitcoin-connect-react-3.2.2.tgz#536c4c94437f2c2c105517510c324a10b629f882"
- integrity sha512-JLJBJgYySr7LDIfycDum/pNdqKxKr81Rw+iidO6CW45N3XGyVLEHLMDZI1ZfwV1i/nsOiqL65BUICGXrBSBnHA==
+"@getalby/bitcoin-connect-react@^3.3.0-beta.3":
+ version "3.3.0-beta.3"
+ resolved "https://registry.yarnpkg.com/@getalby/bitcoin-connect-react/-/bitcoin-connect-react-3.3.0-beta.3.tgz#480a0729bb826f6ec474cb202e1ef96ffb08cf94"
+ integrity sha512-MnYF3Xl0LlOyDBL/U+pZOLpUVO7wJnJeY2dXHOrqFJDgM+P3Bce29QbL0FWZiIxSRvnwZzMHAMHK/xs/D0nPwA==
dependencies:
- "@getalby/bitcoin-connect" "^3.2.2"
+ "@getalby/bitcoin-connect" "^3.3.0-beta.1"
-"@getalby/bitcoin-connect@^3.2.2":
- version "3.2.2"
- resolved "https://registry.yarnpkg.com/@getalby/bitcoin-connect/-/bitcoin-connect-3.2.2.tgz#961374b8a7b91dd6310e714c9c9cc8c87dbc438a"
- integrity sha512-hqsnTVNojTmLDXhhkJvs1RDFKZIFEQDD4UWNlB/hIV3Bx4INxRZzeOi8SOG7idjGF3ix7I8hpG3zeeJCZWNByQ==
+"@getalby/bitcoin-connect@^3.3.0-beta.1":
+ version "3.3.0-beta.1"
+ resolved "https://registry.yarnpkg.com/@getalby/bitcoin-connect/-/bitcoin-connect-3.3.0-beta.1.tgz#b3e217b7066840c654b20bf3b5e73604ea7f9515"
+ integrity sha512-fx8rFSV6de4oFlJRSVRnGK7BzwmNiwMfQTu2DB5Fkpcu9IJtmKSPvGw4Wh6+2vxgG/OPAxgS9tMPRk3izQynmg==
dependencies:
"@getalby/lightning-tools" "^5.0.1"
"@getalby/sdk" "^3.2.3"
diff --git a/dev/vite/index.html b/dev/vite/index.html
index 2f81ed9..c022bcb 100644
--- a/dev/vite/index.html
+++ b/dev/vite/index.html
@@ -153,6 +153,11 @@
Settings
id="invoice"
onchange="localStorage.setItem('invoice', document.getElementById('invoice').value); window.location.reload()"
/>
+ Payment methods (all, external, internal)
+
Show Balance
Router outlet
Request Payment Screen
+
+ Note: connect button will do nothing because requires higher component.
+ Use "Payment Flow" above instead.
+
Start screen
@@ -272,6 +282,9 @@ Try it yourself
const invoice = localStorage.getItem('invoice');
document.getElementById('invoice').value = invoice;
+ const paymentMethods = localStorage.getItem('payment-methods');
+ document.getElementById('payment-methods').value = paymentMethods;
+
const showBalance =
localStorage.getItem('show-balance') !== false.toString();
document.getElementById('show-balance').checked = showBalance;
@@ -316,6 +329,7 @@ Try it yourself
}
launchPaymentModal({
invoice: invoiceToPay,
+ paymentMethods,
onPaid: (response) => {
alert('Paid! ' + response.preimage);
},
@@ -334,6 +348,7 @@ Try it yourself
const {setPaid} = launchPaymentModal({
invoice: invoice.paymentRequest,
+ paymentMethods,
onPaid: (response) => {
clearInterval(checkPaymentInterval);
alert('Received payment! ' + response.preimage);
@@ -396,6 +411,18 @@ Try it yourself
});
document.addEventListener('bc:onpaid', (e) => console.log('PAID!', e));
+
+ if (paymentMethods) {
+ document
+ .getElementById('send-payment')
+ .setAttribute('payment-methods', paymentMethods);
+ document
+ .getElementById('payment-flow')
+ .setAttribute('payment-methods', paymentMethods);
+ document
+ .getElementById('pay-button')
+ .setAttribute('payment-methods', paymentMethods);
+ }