Skip to content

feat: add refresh balance to the API#369

Merged
rolznz merged 1 commit intomasterfrom
feat/refresh-balance
Feb 5, 2026
Merged

feat: add refresh balance to the API#369
rolznz merged 1 commit intomasterfrom
feat/refresh-balance

Conversation

@rolznz
Copy link
Collaborator

@rolznz rolznz commented Feb 5, 2026

Summary by CodeRabbit

  • New Features

    • Added refreshBalance function to manually trigger balance updates for bc-balance components.
  • Documentation

    • Added "Refresh balance" section to README with usage instructions.
  • Chores

    • Bumped package version to 3.12.0.
    • Updated @getalby/bitcoin-connect dependency to ^3.12.0 across all packages and demo files.

@socket-security
Copy link

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn Critical
Critical CVE: Babel vulnerable to arbitrary code execution when compiling specifically crafted malicious code in npm @babel/traverse

CVE: GHSA-67hx-6x53-jw92 Babel vulnerable to arbitrary code execution when compiling specifically crafted malicious code (CRITICAL)

Affected versions: < 7.23.2; >= 8.0.0-alpha.0 < 8.0.0-alpha.4

Patched version: 7.23.2

From: ?npm/microbundle@0.15.1npm/@babel/traverse@7.22.8

ℹ Read more on: This package | This alert | What is a critical CVE?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Remove or replace dependencies that include known critical CVEs. Consumers can use dependency overrides or npm audit fix --force to remove vulnerable dependencies.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@babel/traverse@7.22.8. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@coderabbitai
Copy link

coderabbitai bot commented Feb 5, 2026

📝 Walkthrough

Walkthrough

Release version 3.12.0 bumps the bitcoin-connect library across demo files and package manifests. Adds a refreshBalance function that emits a custom event to trigger wallet balance updates, with corresponding event listener added to the balance component.

Changes

Cohort / File(s) Summary
Version Bumps
package.json, react/package.json, demos/html/bc-*.html
Updated package version and dependency references from 3.11.5/3.11.0 to 3.12.0/3.12.0 across main and React package manifests and HTML demo files.
Balance Refresh Feature
src/api.ts, src/components/bc-balance.ts
Added refreshBalance() function that emits a custom 'bc:balancerefresh' event; balance component now listens for this event to trigger balance reload via _loadBalance().
React Package Exports
react/src/index.ts
Added re-export of refreshBalance from @getalby/bitcoin-connect to the public API.
Documentation
README.md
Documented CDN import updates to 3.12.0 and new "Refresh balance" section explaining refreshBalance function usage with bc-balance components.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Client Code
    participant Window as Window/DOM
    participant API as refreshBalance API
    participant Event as Custom Event
    participant Balance as bc-balance Component

    Client->>API: refreshBalance()
    API->>Event: Create 'bc:balancerefresh'
    Event->>Window: Dispatch CustomEvent
    Window->>Balance: Trigger event listener
    Balance->>Balance: _loadBalance()
    Balance->>Balance: Update balance state
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Poem

🐰 A fresh balance breeze now flows,
When refresh is called, the wallet knows,
Custom events hop through the DOM so bright,
Three-twelve brings updates just right! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the primary change: adding a new refreshBalance function to the public API for balance refresh functionality.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/refresh-balance

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@rolznz rolznz merged commit 517e16c into master Feb 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant