Show reserved_balance_anchor_chan on On-chain section#3676
Show reserved_balance_anchor_chan on On-chain section#3676aryanraj45 wants to merge 1 commit intoZeusLN:masterfrom
Conversation
Summary of ChangesHello @aryanraj45, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the user interface by providing greater transparency into on-chain balances. It specifically addresses the display of funds reserved for anchor channels, making it clear to users which portion of their on-chain balance is not immediately spendable due to these commitments. This improves user understanding of their available funds and the implications of anchor channels. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds the display of reserved_balance_anchor_chan to the on-chain balance section. The changes in BalanceStore.ts correctly fetch and manage this new piece of data, and the locale update is appropriate. In LayerBalances/index.tsx, a small refinement is suggested to improve code clarity by removing a redundant type conversion. Overall, the implementation is solid and addresses the feature request effectively.
| ...(Number(reservedBalanceAnchorChan) > 0 && { | ||
| subtitle: `${localeString( | ||
| 'general.reservedBalanceAnchorChan' | ||
| )}: ${Number( | ||
| reservedBalanceAnchorChan | ||
| ).toLocaleString()} sats` | ||
| }) |
There was a problem hiding this comment.
Based on my analysis of BalanceStore.ts, the reservedBalanceAnchorChan property is always a number. The explicit Number() casting here is redundant. Removing it would improve code clarity and avoid confusion.
...(reservedBalanceAnchorChan > 0 && {
subtitle: `${localeString('general.reservedBalanceAnchorChan')}: ${reservedBalanceAnchorChan.toLocaleString()} sats`
})
There was a problem hiding this comment.
Pull request overview
Adds visibility into LND’s reserved_balance_anchor_chan by surfacing it in the UI under the On-chain balance row, so users can see how much of their on-chain balance is reserved for anchor channel commitments.
Changes:
- Added
reservedBalanceAnchorChantoBalanceStoreand populated it from the wallet balance API response. - Updated the On-chain row in
LayerBalancesto display a subtitle when the reserved amount is > 0. - Added an English locale string for the subtitle label.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
stores/BalanceStore.ts |
Stores and propagates reserved_balance_anchor_chan from the backend balance response. |
components/LayerBalances/index.tsx |
Renders a conditional subtitle under the On-chain row showing reserved sats. |
locales/en.json |
Adds general.reservedBalanceAnchorChan locale label used in the subtitle. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| subtitle: `${localeString( | ||
| 'general.reservedBalanceAnchorChan' | ||
| )}: ${Number( | ||
| reservedBalanceAnchorChan | ||
| ).toLocaleString()} sats` | ||
| }) |
There was a problem hiding this comment.
The subtitle hard-codes the unit label "sats". Elsewhere the app uses the localized unit string (e.g. localeString('general.sats')), so this new text will remain partially untranslated and inconsistent across locales. Consider using the existing locale key for the unit (and/or existing amount-formatting helpers) when building the subtitle.
c6d0c6b to
cd29b20
Compare
|
Hi @kaloudis @ajaysehwal @shubhamkmr04 please take a look whenever u get time. thank you |
|
Solid concept but not a fan of the UI here. Maybe it can just show below the main chain balance on the right side with an info icon to pop up a modal with an explainer. |
|
Closing in favor of #3799 |
Fixes #3092
Description
Relates to issue: ZEUS-3092
Displays
reserved_balance_anchor_chanfrom LND wallet balance API as a subtitle under the On-chain balance row. This makes it explicit to users how much of their on-chain balance is reserved for anchor channel commitments and cannot be spent.Changes:
reservedBalanceAnchorChanobservable toBalanceStoregeneral.reservedBalanceAnchorChanScreenshots:
Checklist
yarn run tscand made sure my code compiles correctlyyarn run lintand made sure my code didn’t contain any problematic patterns-[x] I’ve run
yarn run prettierand made sure my code is formatted correctlyyarn run testand made sure all of the tests passTesting
If you modified or added a utility file, did you add new unit tests?
I have tested this PR on the following platforms (please specify OS version and phone model/VM):
I have tested this PR with the following types of nodes (please specify node version and API version where appropriate):
Locales
Third Party Dependencies and Packages
yarnafter this PR is merged inpackage.jsonandyarn.lockhave been properly updatedOther: