From 644d4d22eae0d033200fae49770c3aba2905644c Mon Sep 17 00:00:00 2001 From: Roland Bewick Date: Thu, 5 Feb 2026 23:00:14 +0700 Subject: [PATCH] feat: add refresh balance to the API --- README.md | 14 ++++++++++++-- demos/html/bc-api-usage.html | 2 +- demos/html/bc-button.html | 2 +- demos/html/bc-pay-button.html | 2 +- package.json | 2 +- react/package.json | 4 ++-- react/src/index.ts | 1 + react/yarn.lock | 8 ++++---- src/api.ts | 8 ++++++++ src/components/bc-balance.ts | 4 ++++ 10 files changed, 35 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 5a04dd5..82a3c0a 100644 --- a/README.md +++ b/README.md @@ -36,13 +36,13 @@ You can use Bitcoin Connect without any build tools: ```html @@ -356,6 +356,16 @@ if (connectorConfig) { } ``` +#### Refresh balance + +Programmatically trigger a balance refresh for all `` components on the page. Useful after making a payment or receiving funds to update the displayed balance. + +```ts +import {refreshBalance} from '@getalby/bitcoin-connect'; + +refreshBalance(); +``` + #### Events ##### onConnected diff --git a/demos/html/bc-api-usage.html b/demos/html/bc-api-usage.html index 220521e..4ab4497 100644 --- a/demos/html/bc-api-usage.html +++ b/demos/html/bc-api-usage.html @@ -65,7 +65,7 @@

Programmatic Access Demo

launchPaymentModal, requestProvider, disconnect, - } from 'https://esm.sh/@getalby/bitcoin-connect@^3.11.0'; + } from 'https://esm.sh/@getalby/bitcoin-connect@^3.12.0'; import {LightningAddress} from 'https://esm.sh/@getalby/lightning-tools@^5.2.0'; // Initialize Bitcoin Connect with your app name diff --git a/demos/html/bc-button.html b/demos/html/bc-button.html index 3bfca99..469d83d 100644 --- a/demos/html/bc-button.html +++ b/demos/html/bc-button.html @@ -5,7 +5,7 @@ bc-button Demo