Fix missing receiving address for incoming transactions

This commit is contained in:
likho 2023-10-06 11:55:24 +02:00
parent c08bdd3c08
commit e18c06fbcd
2 changed files with 7 additions and 4 deletions

View file

@ -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,

View file

@ -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<EpicTransaction> 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()}");