From 6e073486959c0def55551dacd7a596dc0e7eae82 Mon Sep 17 00:00:00 2001 From: Satoshi Qazi Muhammed Date: Wed, 15 Jul 2026 09:33:53 -0700 Subject: [PATCH] Bridge: clear entered amount after a successful origin-chain submit The origin transfer already happened once submitBridgeTransfer's dispatch result comes back success, so the amount input still holding the just-spent value made the live balance-vs-amount check flag a false "insufficient balance" error right next to the real success/waiting state - reading as if the transfer failed or was retried, when it had already gone through once. Clearing the field via the existing fillAmountEvent mechanism removes the stale comparison instead of adding new state. --- .../feature_assets/presentation/bridge/BridgeViewModel.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/feature-assets/src/main/java/io/novafoundation/nova/feature_assets/presentation/bridge/BridgeViewModel.kt b/feature-assets/src/main/java/io/novafoundation/nova/feature_assets/presentation/bridge/BridgeViewModel.kt index 1433643e..442a6197 100644 --- a/feature-assets/src/main/java/io/novafoundation/nova/feature_assets/presentation/bridge/BridgeViewModel.kt +++ b/feature-assets/src/main/java/io/novafoundation/nova/feature_assets/presentation/bridge/BridgeViewModel.kt @@ -322,6 +322,13 @@ class BridgeViewModel( submissionResult.fold( onSuccess = { + // The origin transfer already happened - clear the stale entered amount so the + // live balance-vs-amount check (updateInsufficientBalanceState/updateButtonState) + // doesn't flag the now-lower post-transfer balance against an amount that was + // already spent. Without this, a real successful transfer and a false "insufficient + // balance" error appear side by side, which reads as if something failed twice. + _fillAmountEvent.postValue(Event("0")) + // Real on-chain dispatch confirmed on the origin chain - now (and only now) wait // for the bridge to actually credit the destination. observeDepositCompletion(destChainId, destAssetId, amount)