From e18c06fbcd3af550903de430380777ea05fe25ec Mon Sep 17 00:00:00 2001 From: likho Date: Fri, 6 Oct 2023 11:55:24 +0200 Subject: [PATCH] Fix missing receiving address for incoming transactions --- lib/services/coins/epiccash/epiccash_wallet.dart | 8 +++++--- lib/wallets/example/libepiccash.dart | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/services/coins/epiccash/epiccash_wallet.dart b/lib/services/coins/epiccash/epiccash_wallet.dart index c162a1420..129fd2f95 100644 --- a/lib/services/coins/epiccash/epiccash_wallet.dart +++ b/lib/services/coins/epiccash/epiccash_wallet.dart @@ -1485,7 +1485,7 @@ class EpicCashWallet extends CoinServiceAPI DateTime dt = DateTime.parse(tx.creationTs); - String? slateId = tx.txSlateId; + String? slateId = tx.txSlateId == "null" ? null : tx.txSlateId; String address = slatesToCommits[slateId] ?[tx.txType == EpicTransactionType.TxReceived ? "from" : "to"] as String? ?? ""; @@ -1537,11 +1537,13 @@ class EpicCashWallet extends CoinServiceAPI .valueEqualTo(address) .findFirst(); - if (transactionAddress == null) { + if (transactionAddress!.value.isEmpty) { if (isIncoming) { + //Use current receiving address as address + String receivingAddress = await currentReceivingAddress; transactionAddress = isar_models.Address( walletId: walletId, - value: address, + value: receivingAddress, publicKey: [], derivationIndex: 0, derivationPath: null, diff --git a/lib/wallets/example/libepiccash.dart b/lib/wallets/example/libepiccash.dart index f6cb1d913..28619e94a 100644 --- a/lib/wallets/example/libepiccash.dart +++ b/lib/wallets/example/libepiccash.dart @@ -277,14 +277,15 @@ abstract class LibEpiccash { if (result.toUpperCase().contains("ERROR")) { throw Exception("Error getting epic transactions ${result.toString()}"); } + //Parse the returned data as an EpicTransaction List finalResult = []; var jsonResult = json.decode(result) as List; + for (var tx in jsonResult) { EpicTransaction itemTx = EpicTransaction.fromJson(tx); finalResult.add(itemTx); } - return finalResult; } catch (e) { throw ("Error getting epic transactions : ${e.toString()}");