NWC: the wallet balance is read once at connect and never refreshed
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- backend-api-design, mobile
Research direction
Start with lib/features/settings/providers/nwc_provider.dart and the Rust bridge at lib/src/rust/api/nwc.dart; trace connectWallet, payInvoice, trade success, wallet screen opening, and app resume to find the refresh points. Treat failed refreshes as unknown without displaying zero. Add the provider and widget tests described in the issue; done means the wallet screen shows the updated balance after each refresh trigger and the tests pass.
Written by the indexing model from the issue text.
Description
Context
NwcNotifier keeps balanceSats in NwcWalletState, and the connected wallet screen shows it (nwcBalanceSats). It has an updateBalance(int? sats) method "from a get_balance result" (lib/features/settings/providers/nwc_provider.dart:66), and the Rust bridge exposes getBalance() (lib/src/rust/api/nwc.dart:37).
What happens
Nothing calls updateBalance, and nothing calls getBalance(). The balance shown is the one read once in connectWallet (at connect, or when reconnecting at startup). After the wallet pays a hold invoice, or receives a payout from a make_invoice it generated, the settings screen keeps showing the old balance until the app restarts. That figure can be off by the whole trade amount, and the user may decide whether to pay with the wallet based on it.
How to fix
- Refresh the balance (
getBalance()→updateBalance) when the wallet screen opens, after a successfulpayInvoice, after a trade where the wallet generated the payout invoice reaches success, and on app resume. - Treat a failed refresh as "unknown" (keep the last value and mark it stale, or hide it). Don't show 0.
- Add a provider test: after
updateBalanceis wired to a fakegetBalance, the state changes. Add a widget test that the wallet screen shows the refreshed figure.
- Dominant language
- Dart
- Stars
- 11
- Forks
- 9
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 16
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from MostroP2P/app
-
documentation priority: low
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Maintainers usually reply within 1 day
-
area: ui bug priority: medium
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
area: ui bug priority: high
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Bug: Button "Share logs" does nothingPossibly taken @Luquitasjeffrey claimed this 7 days ago. Open
Difficulty 2/5 Half a day Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
area: rust-core bug priority: low
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
Similar issues
-
Python example: list a model's scenes and their camerasPossibly taken @rudraparmar76 claimed this today. Opendocumentation good first issue python
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
iamahsanmehmood/openskp#796 · 1 comment ·
Maintainers usually reply within 1 day
-
needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Plural rendering: first matching part wins, but gen-l10n lets the last one win (=1 shadows one)Openbug help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
crowdin/flutter-sdk#97 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
MrSpideyNihal/lockfeed#16 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
InlitX/GymMane#529 · 1 comment ·
Maintainers usually reply within 1 day