From 5934744884705c0e91184eae6478acae296663ec Mon Sep 17 00:00:00 2001
From: poka <poka@p2p.legal>
Date: Wed, 3 Feb 2021 20:59:12 +0100
Subject: [PATCH] Refix transcation history amount parsing

---
 lib/models/history.dart | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lib/models/history.dart b/lib/models/history.dart
index 9442e6bd..59d268ce 100644
--- a/lib/models/history.dart
+++ b/lib/models/history.dart
@@ -64,6 +64,7 @@ class HistoryProvider with ChangeNotifier {
   }
 
 // Boris: JE6mkuzSpT3ePciCPRTpuMT9fqPUVVLJz2618d33p7tn
+// Matograine portefeuille: 9p5nHsES6xujFR7pw2yGy4PLKKHgWsMvsDHaHF64Uj25
 
   List parseHistory(txs, _pubkey) {
     var transBC = [];
@@ -76,10 +77,14 @@ class HistoryProvider with ChangeNotifier {
       var direction = trans['direction'];
       final transaction = trans['node'];
       var output;
-      for (String line in transaction['outputs']) {
-        if (line.contains(_pubkey)) {
-          output = line;
+      if (direction == "RECEIVED") {
+        for (String line in transaction['outputs']) {
+          if (line.contains(_pubkey)) {
+            output = line;
+          }
         }
+      } else {
+        output = transaction['outputs'][0];
       }
       if (output == null) {
         continue;
-- 
GitLab