NWC: the wallet balance is read once at connect and never refreshed

Abierto
#956 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
dart, flutter

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

area: ui bug priority: low

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

  1. Refresh the balance (getBalance() → updateBalance) when the wallet screen opens, after a successful payInvoice, after a trade where the wallet generated the payout invoice reaches success, and on app resume.
  2. Treat a failed refresh as "unknown" (keep the last value and mark it stale, or hide it). Don't show 0.
  3. Add a provider test: after updateBalance is wired to a fake getBalance, the state changes. Add a widget test that the wallet screen shows the refreshed figure.
Lenguaje dominante
Dart
Estrellas
11
Forks
9
Merge medio
2 d 1 h
PR fusionados (30 d)
16

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de MostroP2P/app

Todos los issues de MostroP2P/app

Issues similares

Más issues de Dart

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.