fix: sorting of transactions (#3494)

* fix: zcash address for exchange * fix: honour the restore height the user entered - Make Zcash rescan work in both directions by resetting sync from the new birth height - Keep the entered height when restoring a wallet from keys - Tolerate grouping separators in typed restore heights * fix: sorting of transactions fix: tx fee for outgoing transactions --------- Co-authored-by: Vik Sharma <vik@cakewallet.com> Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>

cyan committed Aug 11, 2026 at 03:18 UTC 19653afeab11df3f9ffa87662c228db4fe028f1f
3 files changed +15 -6
cw_zcash/lib/src/zcash_wallet.dart
+4 -1
@@ -622,7 +622,10 @@ abstract class ZcashWalletBase
622 final info = ZcashTransactionInfo(
623 id: tx.txHash,
624 amount: Money(amount, currency),
625 - fee: Money.zero(currency),
625 + fee: Money(
626 + direction == TransactionDirection.outgoing ? tx.fee : BigInt.zero,
627 + currency,
628 + ),
629 direction: direction,
630 isPending: tx.height == 0,
631 date: tx.time,
cw_zcash/lib/src/zkooltx.dart
+10 -4
@@ -33,10 +33,13 @@ class ZkoolTx {
33
34 DateTime get time {
35 final ts = max(_tx.time, _txAccount.time) * 1000;
36 - if (ts == 0) {
37 - return ZcashHeight.getTimeByBlockHeight(height);
36 + if (ts != 0) {
37 + return DateTime.fromMillisecondsSinceEpoch(ts);
38 }
39 - return DateTime.fromMillisecondsSinceEpoch(ts);
39 + if (height == 0) {
40 + return DateTime.now();
41 + }
42 + return ZcashHeight.getTimeByBlockHeight(height);
43 }
44
45 String? get to => _txAccount.outputs.firstOrNull?.address;
@@ -96,7 +99,8 @@ class ZkoolTx {
99
100 BigInt get value => _value.abs();
101
99 - BigInt get fee => value - _calcValue;
102 + BigInt get fee => BigInt.from(_tx.fee);
103 +
104
105 BigInt get _value {
106 if (_tx.value != 0) {
@@ -166,6 +170,7 @@ class ZkoolTx {
170 "height": _tx.height,
171 "time": _tx.time,
172 "value": value.toInt(),
173 +
174 "tpe": _tx.tpe,
175 "zsaValue": _tx.zsaValue,
176 "assetDisplay": _tx.assetDisplay,
@@ -277,6 +282,7 @@ class ZkoolTx {
282 height: _asInt(txJson["height"]),
283 time: _asInt(txJson["time"]),
284 value: _asInt(txJson["value"]),
285 + fee: _asInt(txJson["fee"]),
286 tpe: txJson["tpe"] == null ? null : _asInt(txJson["tpe"]),
287 zsaValue: _asInt(txJson["zsaValue"]),
288 assetDisplay: txJson["assetDisplay"] as String? ?? "",
cw_zcash/pubspec.yaml
+1 -1
@@ -21,7 +21,7 @@ dependencies:
21 # path: ../../zkool2
22 git:
23 url: https://github.com/cake-tech/zkool2.git
24 - ref: 16fd3d11575f850939f498c3ea75d391915456d1
24 + ref: 36e72b530c274c4a54a6127aadb94886e84d67bf
25
26 path_provider: any
27 sqflite_common_ffi: any