CW 781 replace all print statements with printV (#1733)
* replace all print statements with printV * restore backup error message * missing print statements, error fixes * Update cw_core/lib/utils/print_verbose.dart [skip ci] * Update cw_core/lib/utils/print_verbose.dart [skip ci] * CW-846: Correctly display balance (#1848) * Correctly display balance even with frozen coins * remove package= from AndroidMainfest.xml * update namespace * print -> printV --------- Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
cyan committed
Dec 9, 2024 at 12:23 UTC
c78662fbfe2903a5aae560ebadc6b7e5583ef0fd
124 files changed
+578
-343
.github/workflows/no_print_in_dart.yaml
new
+21
@@ -0,0 +1,21 @@
1
+name: No print statements in dart files
2
+
3
+on:
4
+ pull_request:
5
+ branches: [main]
6
+
7
+jobs:
8
+ PR_test_build:
9
+ runs-on: ubuntu-20.04
10
+
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - name: Check for print() statements in dart code (use printV() instead)
14
+ if: github.event_name == 'pull_request'
15
+ run: |
16
+ GIT_GREP_OUT="$(git grep ' print(' | (grep .dart: || test $? = 1) | (grep -v print_verbose.dart || test $? = 1) || true)"
17
+ [[ "x$GIT_GREP_OUT" == "x" ]] && exit 0
18
+ echo "$GIT_GREP_OUT"
19
+ echo "There are .dart files which use print() statements"
20
+ echo "Please use printV from package: cw_core/utils/print_verbose.dart"
21
+ exit 1
cw_bitcoin/lib/bitcoin_hardware_wallet_service.dart
+1
@@ -6,6 +6,7 @@ import 'package:cw_bitcoin/utils.dart';
6
import 'package:cw_core/hardware/hardware_account_data.dart';
7
import 'package:ledger_bitcoin/ledger_bitcoin.dart';
8
import 'package:ledger_flutter_plus/ledger_flutter_plus.dart';
9
+import 'package:cw_core/utils/print_verbose.dart';
10
11
class BitcoinHardwareWalletService {
12
BitcoinHardwareWalletService(this.ledgerConnection);
cw_bitcoin/lib/electrum.dart
+9
-8
@@ -4,6 +4,7 @@ import 'dart:io';
4
import 'dart:typed_data';
5
import 'package:bitcoin_base/bitcoin_base.dart';
6
import 'package:cw_bitcoin/bitcoin_amount_format.dart';
7
+import 'package:cw_core/utils/print_verbose.dart';
8
import 'package:flutter/foundation.dart';
9
import 'package:rxdart/rxdart.dart';
10
@@ -117,17 +118,17 @@ class ElectrumClient {
118
_parseResponse(message);
119
}
120
} catch (e) {
120
- print("socket.listen: $e");
121
+ printV("socket.listen: $e");
122
}
123
},
124
onError: (Object error) {
125
final errorMsg = error.toString();
125
- print(errorMsg);
126
+ printV(errorMsg);
127
unterminatedString = '';
128
socket = null;
129
},
130
onDone: () {
130
- print("SOCKET CLOSED!!!!!");
131
+ printV("SOCKET CLOSED!!!!!");
132
unterminatedString = '';
133
try {
134
if (host == socket?.address.host || socket == null) {
@@ -136,7 +137,7 @@ class ElectrumClient {
137
socket = null;
138
}
139
} catch (e) {
139
- print("onDone: $e");
140
+ printV("onDone: $e");
141
}
142
},
143
cancelOnError: true,
@@ -181,7 +182,7 @@ class ElectrumClient {
182
unterminatedString = '';
183
}
184
} catch (e) {
184
- print("parse $e");
185
+ printV("parse $e");
186
}
187
}
188
@@ -403,7 +404,7 @@ class ElectrumClient {
404
} on RequestFailedTimeoutException catch (_) {
405
return null;
406
} catch (e) {
406
- print("getCurrentBlockChainTip: ${e.toString()}");
407
+ printV("getCurrentBlockChainTip: ${e.toString()}");
408
return null;
409
}
410
}
@@ -434,7 +435,7 @@ class ElectrumClient {
435
436
return subscription;
437
} catch (e) {
437
- print("subscribe $e");
438
+ printV("subscribe $e");
439
return null;
440
}
441
}
@@ -473,7 +474,7 @@ class ElectrumClient {
474
475
return completer.future;
476
} catch (e) {
476
- print("callWithTimeout $e");
477
+ printV("callWithTimeout $e");
478
rethrow;
479
}
480
}
cw_bitcoin/lib/electrum_transaction_history.dart
+3
-2
@@ -5,6 +5,7 @@ import 'package:cw_bitcoin/electrum_transaction_info.dart';
5
import 'package:cw_core/pathForWallet.dart';
6
import 'package:cw_core/transaction_history.dart';
7
import 'package:cw_core/utils/file.dart';
8
+import 'package:cw_core/utils/print_verbose.dart';
9
import 'package:cw_core/wallet_info.dart';
10
import 'package:mobx/mobx.dart';
11
import 'package:cw_core/transaction_history.dart';
@@ -51,7 +52,7 @@ abstract class ElectrumTransactionHistoryBase
52
final data = json.encode({'height': _height, 'transactions': txjson});
53
await encryptionFileUtils.write(path: path, password: _password, data: data);
54
} catch (e) {
54
- print('Error while save bitcoin transaction history: ${e.toString()}');
55
+ printV('Error while save bitcoin transaction history: ${e.toString()}');
56
}
57
}
58
@@ -88,7 +89,7 @@ abstract class ElectrumTransactionHistoryBase
89
90
_height = content['height'] as int;
91
} catch (e) {
91
- print(e);
92
+ printV(e);
93
}
94
}
95
cw_bitcoin/lib/electrum_wallet.dart
+19
-17
@@ -4,6 +4,8 @@ import 'dart:io';
4
import 'dart:isolate';
5
6
import 'package:bitcoin_base/bitcoin_base.dart';
7
+import 'package:cw_bitcoin/litecoin_wallet_addresses.dart';
8
+import 'package:cw_core/utils/print_verbose.dart';
9
import 'package:cw_bitcoin/bitcoin_wallet.dart';
10
import 'package:cw_bitcoin/litecoin_wallet.dart';
11
import 'package:shared_preferences/shared_preferences.dart';
@@ -479,8 +481,8 @@ abstract class ElectrumWalletBase
481
syncStatus = SyncedSyncStatus();
482
}
483
} catch (e, stacktrace) {
482
- print(stacktrace);
483
- print("startSync $e");
484
+ printV(stacktrace);
485
+ printV("startSync $e");
486
syncStatus = FailedSyncStatus();
487
}
488
}
@@ -506,7 +508,7 @@ abstract class ElectrumWalletBase
508
_feeRates = [slowFee, mediumFee, fastFee];
509
return;
510
} catch (e) {
509
- print(e);
511
+ printV(e);
512
}
513
}
514
@@ -588,8 +590,8 @@ abstract class ElectrumWalletBase
590
591
await electrumClient.connectToUri(node.uri, useSSL: node.useSSL);
592
} catch (e, stacktrace) {
591
- print(stacktrace);
592
- print("connectToNode $e");
593
+ printV(stacktrace);
594
+ printV("connectToNode $e");
595
syncStatus = FailedSyncStatus();
596
}
597
}
@@ -1492,7 +1494,7 @@ abstract class ElectrumWalletBase
1494
await unspentCoinsInfo.deleteAll(keys);
1495
}
1496
} catch (e) {
1495
- print("refreshUnspentCoinsInfo $e");
1497
+ printV("refreshUnspentCoinsInfo $e");
1498
}
1499
}
1500
@@ -1935,7 +1937,7 @@ abstract class ElectrumWalletBase
1937
1938
return historiesWithDetails;
1939
} catch (e) {
1938
- print("fetchTransactions $e");
1940
+ printV("fetchTransactions $e");
1941
return {};
1942
}
1943
}
@@ -2059,7 +2061,7 @@ abstract class ElectrumWalletBase
2061
}
2062
2063
Future<void> updateTransactions() async {
2062
- print("updateTransactions() called!");
2064
+ printV("updateTransactions() called!");
2065
try {
2066
if (_isTransactionUpdating) {
2067
return;
@@ -2091,8 +2093,8 @@ abstract class ElectrumWalletBase
2093
walletAddresses.updateReceiveAddresses();
2094
_isTransactionUpdating = false;
2095
} catch (e, stacktrace) {
2094
- print(stacktrace);
2095
- print(e);
2096
+ printV(stacktrace);
2097
+ printV(e);
2098
_isTransactionUpdating = false;
2099
}
2100
}
@@ -2110,13 +2112,13 @@ abstract class ElectrumWalletBase
2112
try {
2113
await _scripthashesUpdateSubject[sh]?.close();
2114
} catch (e) {
2113
- print("failed to close: $e");
2115
+ printV("failed to close: $e");
2116
}
2117
}
2118
try {
2119
_scripthashesUpdateSubject[sh] = await electrumClient.scripthashUpdate(sh);
2120
} catch (e) {
2119
- print("failed scripthashUpdate: $e");
2121
+ printV("failed scripthashUpdate: $e");
2122
}
2123
_scripthashesUpdateSubject[sh]?.listen((event) async {
2124
try {
@@ -2126,7 +2128,7 @@ abstract class ElectrumWalletBase
2128
2129
await _fetchAddressHistory(address, await getCurrentChainTip());
2130
} catch (e, s) {
2129
- print("sub error: $e");
2131
+ printV("sub error: $e");
2132
_onError?.call(FlutterErrorDetails(
2133
exception: e,
2134
stack: s,
@@ -2134,7 +2136,7 @@ abstract class ElectrumWalletBase
2136
));
2137
}
2138
}, onError: (e, s) {
2137
- print("sub_listen error: $e $s");
2139
+ printV("sub_listen error: $e $s");
2140
});
2141
}));
2142
}
@@ -2186,7 +2188,7 @@ abstract class ElectrumWalletBase
2188
2189
if (balances.isNotEmpty && balances.first['confirmed'] == null) {
2190
// if we got null balance responses from the server, set our connection status to lost and return our last known balance:
2189
- print("got null balance responses from the server, setting connection status to lost");
2191
+ printV("got null balance responses from the server, setting connection status to lost");
2192
syncStatus = LostConnectionSyncStatus();
2193
return balance[currency] ?? ElectrumBalance(confirmed: 0, unconfirmed: 0, frozen: 0);
2194
}
@@ -2213,7 +2215,7 @@ abstract class ElectrumWalletBase
2215
}
2216
2217
Future<void> updateBalance() async {
2216
- print("updateBalance() called!");
2218
+ printV("updateBalance() called!");
2219
balance[currency] = await fetchBalances();
2220
await save();
2221
}
@@ -2353,7 +2355,7 @@ abstract class ElectrumWalletBase
2355
}
2356
2357
void _syncStatusReaction(SyncStatus syncStatus) async {
2356
- print("SYNC_STATUS_CHANGE: ${syncStatus}");
2358
+ printV("SYNC_STATUS_CHANGE: ${syncStatus}");
2359
if (syncStatus is SyncingSyncStatus) {
2360
return;
2361
}
cw_bitcoin/lib/electrum_wallet_addresses.dart
+4
-2
@@ -3,6 +3,8 @@ import 'dart:io' show Platform;
3
import 'package:bitcoin_base/bitcoin_base.dart';
4
import 'package:blockchain_utils/blockchain_utils.dart';
5
import 'package:cw_bitcoin/bitcoin_address_record.dart';
6
+import 'package:cw_bitcoin/electrum_wallet.dart';
7
+import 'package:cw_core/utils/print_verbose.dart';
8
import 'package:cw_bitcoin/bitcoin_unspent.dart';
9
import 'package:cw_core/wallet_addresses.dart';
10
import 'package:cw_core/wallet_info.dart';
@@ -193,7 +195,7 @@ abstract class ElectrumWalletAddressesBase extends WalletAddresses with Store {
195
receiveAddresses.remove(addressRecord);
196
receiveAddresses.insert(0, addressRecord);
197
} catch (e) {
196
- print("ElectrumWalletAddressBase: set address ($addr): $e");
198
+ printV("ElectrumWalletAddressBase: set address ($addr): $e");
199
}
200
}
201
@@ -483,7 +485,7 @@ abstract class ElectrumWalletAddressesBase extends WalletAddresses with Store {
485
486
await saveAddressesInBox();
487
} catch (e) {
486
- print("updateAddresses $e");
488
+ printV("updateAddresses $e");
489
}
490
}
491
cw_bitcoin/lib/litecoin_wallet.dart
+31
-30
@@ -9,6 +9,7 @@ import 'package:crypto/crypto.dart';
9
import 'package:cw_bitcoin/bitcoin_transaction_credentials.dart';
10
import 'package:cw_core/cake_hive.dart';
11
import 'package:cw_core/mweb_utxo.dart';
12
+import 'package:cw_core/utils/print_verbose.dart';
13
import 'package:cw_core/node.dart';
14
import 'package:cw_mweb/mwebd.pbgrpc.dart';
15
import 'package:fixnum/fixnum.dart';
@@ -283,7 +284,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
284
}
285
286
Future<void> waitForMwebAddresses() async {
286
- print("waitForMwebAddresses() called!");
287
+ printV("waitForMwebAddresses() called!");
288
// ensure that we have the full 1000 mweb addresses generated before continuing:
289
// should no longer be needed, but leaving here just in case
290
await (walletAddresses as LitecoinWalletAddresses).ensureMwebAddressUpToIndexExists(1020);
@@ -302,8 +303,8 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
303
@action
304
@override
305
Future<void> startSync() async {
305
- print("startSync() called!");
306
- print("STARTING SYNC - MWEB ENABLED: $mwebEnabled");
306
+ printV("startSync() called!");
307
+ printV("STARTING SYNC - MWEB ENABLED: $mwebEnabled");
308
if (!mwebEnabled) {
309
try {
310
// in case we're switching from a litecoin wallet that had mweb enabled
@@ -317,33 +318,33 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
318
return;
319
}
320
320
- print("STARTING SYNC - MWEB ENABLED: $mwebEnabled");
321
+ printV("STARTING SYNC - MWEB ENABLED: $mwebEnabled");
322
_syncTimer?.cancel();
323
try {
324
mwebSyncStatus = SyncronizingSyncStatus();
325
try {
326
await subscribeForUpdates();
327
} catch (e) {
327
- print("failed to subcribe for updates: $e");
328
+ printV("failed to subcribe for updates: $e");
329
}
330
updateFeeRates();
331
_feeRatesTimer?.cancel();
332
_feeRatesTimer =
333
Timer.periodic(const Duration(minutes: 1), (timer) async => await updateFeeRates());
334
334
- print("START SYNC FUNCS");
335
+ printV("START SYNC FUNCS");
336
await waitForMwebAddresses();
337
await processMwebUtxos();
338
await updateTransactions();
339
await updateUnspent();
340
await updateBalance();
340
- print("DONE SYNC FUNCS");
341
- } catch (e, s) {
342
- print("mweb sync failed: $e $s");
343
- mwebSyncStatus = FailedSyncStatus(error: "mweb sync failed: $e");
341
+ } catch (e) {
342
+ printV("failed to start mweb sync: $e");
343
+ syncStatus = FailedSyncStatus();
344
return;
345
}
346
347
+ _syncTimer?.cancel();
348
_syncTimer = Timer.periodic(const Duration(milliseconds: 3000), (timer) async {
349
if (mwebSyncStatus is FailedSyncStatus) {
350
_syncTimer?.cancel();
@@ -401,7 +402,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
402
for (var coin in tx.unspents!) {
403
final utxo = mwebUtxosBox.get(coin.address);
404
if (utxo != null) {
404
- print("deleting utxo ${coin.address} @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
405
+ printV("deleting utxo ${coin.address} @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
406
await mwebUtxosBox.delete(coin.address);
407
}
408
}
@@ -428,7 +429,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
429
return;
430
}
431
} catch (e) {
431
- print("error syncing: $e");
432
+ printV("error syncing: $e");
433
mwebSyncStatus = FailedSyncStatus(error: e.toString());
434
}
435
});
@@ -437,12 +438,12 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
438
@action
439
@override
440
Future<void> stopSync() async {
440
- print("stopSync() called!");
441
+ printV("stopSync() called!");
442
_syncTimer?.cancel();
443
_utxoStream?.cancel();
444
_feeRatesTimer?.cancel();
445
await CwMweb.stop();
445
- print("stopped syncing!");
446
+ printV("stopped syncing!");
447
}
448
449
Future<void> initMwebUtxosBox() async {
@@ -514,7 +515,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
515
}
516
517
Future<void> handleIncoming(MwebUtxo utxo) async {
517
- print("handleIncoming() called!");
518
+ printV("handleIncoming() called!");
519
final status = await CwMweb.status(StatusRequest());
520
var date = DateTime.now();
521
var confirmations = 0;
@@ -559,7 +560,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
560
final addressRecord = walletAddresses.allAddresses
561
.firstWhereOrNull((addressRecord) => addressRecord.address == utxo.address);
562
if (addressRecord == null) {
562
- print("we don't have this address in the wallet! ${utxo.address}");
563
+ printV("we don't have this address in the wallet! ${utxo.address}");
564
return;
565
}
566
@@ -580,13 +581,13 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
581
}
582
583
Future<void> processMwebUtxos() async {
583
- print("processMwebUtxos() called!");
584
+ printV("processMwebUtxos() called!");
585
if (!mwebEnabled) {
586
return;
587
}
588
589
int restoreHeight = walletInfo.restoreHeight;
589
- print("SCANNING FROM HEIGHT: $restoreHeight");
590
+ printV("SCANNING FROM HEIGHT: $restoreHeight");
591
final req = UtxosRequest(scanSecret: scanSecret, fromHeight: restoreHeight);
592
593
// process new utxos as they come in:
@@ -621,7 +622,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
622
// but do update the utxo height if it's somehow different:
623
final existingUtxo = mwebUtxosBox.get(utxo.outputId);
624
if (existingUtxo!.height != utxo.height) {
624
- print(
625
+ printV(
626
"updating utxo height for $utxo.outputId: ${existingUtxo.height} -> ${utxo.height}");
627
existingUtxo.height = utxo.height;
628
await mwebUtxosBox.put(utxo.outputId, existingUtxo);
@@ -644,7 +645,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
645
await handleIncoming(utxo);
646
},
647
onError: (error) {
647
- print("error in utxo stream: $error");
648
+ printV("error in utxo stream: $error");
649
mwebSyncStatus = FailedSyncStatus(error: error.toString());
650
},
651
cancelOnError: true,
@@ -652,7 +653,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
653
}
654
655
Future<void> deleteSpentUtxos() async {
655
- print("deleteSpentUtxos() called!");
656
+ printV("deleteSpentUtxos() called!");
657
final chainHeight = await electrumClient.getCurrentBlockChainTip();
658
final status = await CwMweb.status(StatusRequest());
659
if (chainHeight == null || status.blockHeaderHeight != chainHeight) return;
@@ -676,7 +677,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
677
}
678
679
Future<void> checkMwebUtxosSpent() async {
679
- print("checkMwebUtxosSpent() called!");
680
+ printV("checkMwebUtxosSpent() called!");
681
if (!mwebEnabled) {
682
return;
683
}
@@ -791,7 +792,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
792
}
793
794
Future<void> updateUnspent() async {
794
- print("updateUnspent() called!");
795
+ printV("updateUnspent() called!");
796
await checkMwebUtxosSpent();
797
await updateAllUnspents();
798
}
@@ -822,7 +823,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
823
.firstWhereOrNull((addressRecord) => addressRecord.address == utxo.address);
824
825
if (addressRecord == null) {
825
- print("utxo contains an address that is not in the wallet: ${utxo.address}");
826
+ printV("utxo contains an address that is not in the wallet: ${utxo.address}");
827
return;
828
}
829
final unspent = BitcoinUnspent(
@@ -863,7 +864,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
864
mwebUtxosBox.values.forEach((utxo) {
865
bool isConfirmed = utxo.height > 0;
866
866
- print(
867
+ printV(
868
"utxo: ${isConfirmed ? "confirmed" : "unconfirmed"} ${utxo.spent ? "spent" : "unspent"} ${utxo.outputId} ${utxo.height} ${utxo.value}");
869
870
if (isConfirmed) {
@@ -1001,7 +1002,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
1002
final sum1 = _sumOutputAmounts(outputs.map((e) => e.toOutput).toList()) + fee;
1003
final sum2 = utxos.sumOfUtxosValue();
1004
if (sum1 != sum2) {
1004
- print("@@@@@ WE HAD TO ADJUST THE FEE! @@@@@@@@");
1005
+ printV("@@@@@ WE HAD TO ADJUST THE FEE! @@@@@@@@");
1006
final diff = sum2 - sum1;
1007
// add the difference to the fee (abs value):
1008
fee += diff.abs();
@@ -1166,7 +1167,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
1167
addressRecord.balance -= utxo.value.toInt();
1168
});
1169
transaction.inputAddresses?.addAll(addresses);
1169
- print("isPegIn: $isPegIn, isPegOut: $isPegOut");
1170
+ printV("isPegIn: $isPegIn, isPegOut: $isPegOut");
1171
transaction.additionalInfo["isPegIn"] = isPegIn;
1172
transaction.additionalInfo["isPegOut"] = isPegOut;
1173
transactionHistory.addOne(transaction);
@@ -1174,10 +1175,10 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
1175
await updateBalance();
1176
});
1177
} catch (e, s) {
1177
- print(e);
1178
- print(s);
1178
+ printV(e);
1179
+ printV(s);
1180
if (e.toString().contains("commit failed")) {
1180
- print(e);
1181
+ printV(e);
1182
throw Exception("Transaction commit failed (no peers responded), please try again.");
1183
}
1184
rethrow;
cw_bitcoin/lib/litecoin_wallet_addresses.dart
+7
-6
@@ -9,6 +9,7 @@ import 'package:cw_bitcoin/bitcoin_unspent.dart';
9
import 'package:cw_bitcoin/electrum_wallet.dart';
10
import 'package:cw_bitcoin/utils.dart';
11
import 'package:cw_bitcoin/electrum_wallet_addresses.dart';
12
+import 'package:cw_core/utils/print_verbose.dart';
13
import 'package:cw_core/wallet_info.dart';
14
import 'package:cw_mweb/cw_mweb.dart';
15
import 'package:flutter/foundation.dart';
@@ -35,7 +36,7 @@ abstract class LitecoinWalletAddressesBase extends ElectrumWalletAddresses with
36
for (int i = 0; i < mwebAddresses.length; i++) {
37
mwebAddrs.add(mwebAddresses[i].address);
38
}
38
- print("initialized with ${mwebAddrs.length} mweb addresses");
39
+ printV("initialized with ${mwebAddrs.length} mweb addresses");
40
}
41
42
final Bip32Slip10Secp256k1? mwebHd;
@@ -73,25 +74,25 @@ abstract class LitecoinWalletAddressesBase extends ElectrumWalletAddresses with
74
}
75
76
while (generating) {
76
- print("generating.....");
77
+ printV("generating.....");
78
// this function was called multiple times in multiple places:
79
await Future.delayed(const Duration(milliseconds: 100));
80
}
81
81
- print("Generating MWEB addresses up to index $index");
82
+ printV("Generating MWEB addresses up to index $index");
83
generating = true;
84
try {
85
while (mwebAddrs.length <= (index + 1)) {
86
final addresses =
87
await CwMweb.addresses(scan, spend, mwebAddrs.length, mwebAddrs.length + 50);
87
- print("generated up to index ${mwebAddrs.length}");
88
+ printV("generated up to index ${mwebAddrs.length}");
89
// sleep for a bit to avoid making the main thread unresponsive:
90
await Future.delayed(Duration(milliseconds: 200));
91
mwebAddrs.addAll(addresses!);
92
}
93
} catch (_) {}
94
generating = false;
94
- print("Done generating MWEB addresses len: ${mwebAddrs.length}");
95
+ printV("Done generating MWEB addresses len: ${mwebAddrs.length}");
96
97
// ensure mweb addresses are up to date:
98
// This is the Case if the Litecoin Wallet is a hardware Wallet
@@ -109,7 +110,7 @@ abstract class LitecoinWalletAddressesBase extends ElectrumWalletAddresses with
110
))
111
.toList();
112
addMwebAddresses(addressRecords);
112
- print("set ${addressRecords.length} mweb addresses");
113
+ printV("set ${addressRecords.length} mweb addresses");
114
}
115
}
116
cw_bitcoin/lib/psbt_transaction_builder.dart
+5
@@ -2,6 +2,7 @@ import 'dart:typed_data';
2
3
import 'package:bitcoin_base/bitcoin_base.dart';
4
import 'package:convert/convert.dart';
5
+import 'package:cw_core/utils/print_verbose.dart';
6
import 'package:ledger_bitcoin/psbt.dart';
7
8
class PSBTTransactionBuild {
@@ -16,6 +17,10 @@ class PSBTTransactionBuild {
17
for (var i = 0; i < inputs.length; i++) {
18
final input = inputs[i];
19
20
+ printV(input.utxo.isP2tr());
21
+ printV(input.utxo.isSegwit());
22
+ printV(input.utxo.isP2shSegwit());
23
+
24
psbt.setInputPreviousTxId(i, Uint8List.fromList(hex.decode(input.utxo.txHash).reversed.toList()));
25
psbt.setInputOutputIndex(i, input.utxo.vout);
26
psbt.setInputSequence(i, enableRBF ? 0x1 : 0xffffffff);
cw_core/lib/battery_optimization_native.dart
+4
-3
@@ -1,3 +1,4 @@
1
+import 'package:cw_core/utils/print_verbose.dart';
2
import 'package:flutter/services.dart';
3
4
const MethodChannel _channel = MethodChannel('com.cake_wallet/native_utils');
@@ -6,17 +7,17 @@ Future<void> requestDisableBatteryOptimization() async {
7
try {
8
await _channel.invokeMethod('disableBatteryOptimization');
9
} on PlatformException catch (e) {
9
- print("Failed to disable battery optimization: '${e.message}'.");
10
+ printV("Failed to disable battery optimization: '${e.message}'.");
11
}
12
}
13
14
Future<bool> isBatteryOptimizationDisabled() async {
15
try {
16
final bool isDisabled = await _channel.invokeMethod('isBatteryOptimizationDisabled') as bool;
16
- print('It\'s actually disabled? $isDisabled');
17
+ printV('It\'s actually disabled? $isDisabled');
18
return isDisabled;
19
} on PlatformException catch (e) {
19
- print("Failed to check battery optimization status: '${e.message}'.");
20
+ printV("Failed to check battery optimization status: '${e.message}'.");
21
return false;
22
}
23
}
cw_core/lib/get_height_by_date.dart
+2
-1
@@ -1,3 +1,4 @@
1
+import 'package:cw_core/utils/print_verbose.dart';
2
import 'package:intl/intl.dart';
3
import 'dart:convert';
4
import 'package:http/http.dart' as http;
@@ -152,7 +153,7 @@ int getMoneroHeigthByDate({required DateTime date}) {
153
height = startHeight + daysHeight - heightPerDay;
154
}
155
} catch (e) {
155
- print(e.toString());
156
+ printV(e.toString());
157
}
158
159
return height;
cw_core/lib/utils/print_verbose.dart
new
+84
@@ -0,0 +1,84 @@
1
+void printV(dynamic content) {
2
+ CustomTrace programInfo = CustomTrace(StackTrace.current);
3
+ print("${programInfo.fileName}#${programInfo.lineNumber}:${programInfo.columnNumber} ${programInfo.callerFunctionName}: $content");
4
+}
5
+
6
+// https://stackoverflow.com/a/59386101
7
+
8
+class CustomTrace {
9
+ final StackTrace _trace;
10
+
11
+ String? fileName;
12
+ String? functionName;
13
+ String? callerFunctionName;
14
+ int? lineNumber;
15
+ int? columnNumber;
16
+
17
+ CustomTrace(this._trace) {
18
+ try {
19
+ _parseTrace();
20
+ } catch (e) {
21
+ print("Unable to parse trace (printV): $e");
22
+ }
23
+ }
24
+
25
+ String _getFunctionNameFromFrame(String frame) {
26
+ /* Just giving another nickname to the frame */
27
+ var currentTrace = frame;
28
+ /* To get rid off the #number thing, get the index of the first whitespace */
29
+ var indexOfWhiteSpace = currentTrace.indexOf(' ');
30
+
31
+ /* Create a substring from the first whitespace index till the end of the string */
32
+ var subStr = currentTrace.substring(indexOfWhiteSpace);
33
+
34
+ /* Grab the function name using reg expr */
35
+ var indexOfFunction = subStr.indexOf(RegExp(r'[A-Za-z0-9_]'));
36
+
37
+ /* Create a new substring from the function name index till the end of string */
38
+ subStr = subStr.substring(indexOfFunction);
39
+
40
+ indexOfWhiteSpace = subStr.indexOf(RegExp(r'[ .]'));
41
+
42
+ /* Create a new substring from start to the first index of a whitespace. This substring gives us the function name */
43
+ subStr = subStr.substring(0, indexOfWhiteSpace);
44
+
45
+ return subStr;
46
+ }
47
+
48
+ void _parseTrace() {
49
+ /* The trace comes with multiple lines of strings, (each line is also known as a frame), so split the trace's string by lines to get all the frames */
50
+ var frames = this._trace.toString().split("\n");
51
+
52
+ /* The first frame is the current function */
53
+ this.functionName = _getFunctionNameFromFrame(frames[0]);
54
+
55
+ /* The second frame is the caller function */
56
+ this.callerFunctionName = _getFunctionNameFromFrame(frames[1]);
57
+
58
+ /* The first frame has all the information we need */
59
+ var traceString = frames[1];
60
+
61
+ /* Search through the string and find the index of the file name by looking for the '.dart' regex */
62
+ var indexOfFileName = traceString.indexOf(RegExp(r'[/A-Za-z_]+.dart'), 1); // 1 to offest and not print the printV function name
63
+
64
+ var fileInfo = traceString.substring(indexOfFileName);
65
+
66
+ var listOfInfos = fileInfo.split(":");
67
+
68
+ /* Splitting fileInfo by the character ":" separates the file name, the line number and the column counter nicely.
69
+ Example: main.dart:5:12
70
+ To get the file name, we split with ":" and get the first index
71
+ To get the line number, we would have to get the second index
72
+ To get the column number, we would have to get the third index
73
+ */
74
+ try {
75
+ this.fileName = listOfInfos[0];
76
+ this.lineNumber = int.tryParse(listOfInfos[1]);
77
+ var columnStr = listOfInfos[2];
78
+ columnStr = columnStr.replaceFirst(")", "");
79
+ this.columnNumber = int.tryParse(columnStr);
80
+ } catch (e) {
81
+
82
+ }
83
+ }
84
+}
cw_core/lib/wallet_addresses.dart
+2
-1
@@ -1,4 +1,5 @@
1
import 'package:cw_core/address_info.dart';
2
+import 'package:cw_core/utils/print_verbose.dart';
3
import 'package:cw_core/wallet_info.dart';
4
import 'package:cw_core/wallet_type.dart';
5
@@ -71,7 +72,7 @@ abstract class WalletAddresses {
72
await walletInfo.save();
73
}
74
} catch (e) {
74
- print(e.toString());
75
+ printV(e.toString());
76
}
77
}
78
cw_core/lib/window_size.dart
+3
-2
@@ -1,5 +1,6 @@
1
import 'dart:io';
2
3
+import 'package:cw_core/utils/print_verbose.dart';
4
import 'package:flutter/services.dart';
5
6
const MethodChannel _channel = MethodChannel('com.cake_wallet/native_utils');
@@ -14,9 +15,9 @@ Future<void> setDefaultMinimumWindowSize() async {
15
) as bool;
16
17
if (!result) {
17
- print("Failed to set minimum window size.");
18
+ printV("Failed to set minimum window size.");
19
}
20
} on PlatformException catch (e) {
20
- print("Failed to set minimum window size: '${e.message}'.");
21
+ printV("Failed to set minimum window size: '${e.message}'.");
22
}
23
}
cw_evm/lib/evm_chain_wallet.dart
+2
-1
@@ -14,6 +14,7 @@ import 'package:cw_core/pathForWallet.dart';
14
import 'package:cw_core/pending_transaction.dart';
15
import 'package:cw_core/sync_status.dart';
16
import 'package:cw_core/transaction_priority.dart';
17
+import 'package:cw_core/utils/print_verbose.dart';
18
import 'package:cw_core/wallet_addresses.dart';
19
import 'package:cw_core/wallet_base.dart';
20
import 'package:cw_core/wallet_info.dart';
@@ -200,7 +201,7 @@ abstract class EVMChainWalletBase
201
} else {
202
// MaxFeePerGas with gasPrice;
203
maxFeePerGas = gasPrice;
203
- debugPrint('MaxFeePerGas with gasPrice: $maxFeePerGas');
204
+ printV('MaxFeePerGas with gasPrice: $maxFeePerGas');
205
}
206
207
final totalGasFee = estimatedGasUnits * maxFeePerGas;
cw_evm/lib/evm_ledger_credentials.dart
+2
-1
@@ -3,6 +3,7 @@ import 'dart:typed_data';
3
4
import 'package:cw_core/hardware/device_not_connected_exception.dart'
5
as exception;
6
+import 'package:cw_core/utils/print_verbose.dart';
7
import 'package:ledger_ethereum/ledger_ethereum.dart';
8
import 'package:ledger_flutter_plus/ledger_flutter_plus.dart';
9
import 'package:web3dart/crypto.dart';
@@ -96,7 +97,7 @@ class EvmLedgerCredentials extends CredentialsWithKnownAddress {
97
await ethereumLedgerApp!.getAndProvideERC20TokenInformation(
98
erc20ContractAddress: erc20ContractAddress, chainId: chainId);
99
} catch (e) {
99
- print(e);
100
+ printV(e);
101
rethrow;
102
// if (e.errorCode != -28672) rethrow;
103
}
cw_haven/lib/haven_account_list.dart
+2
-1
@@ -1,3 +1,4 @@
1
+import 'package:cw_core/utils/print_verbose.dart';
2
import 'package:mobx/mobx.dart';
3
import 'package:cw_core/account.dart';
4
import 'package:cw_core/account_list.dart';
@@ -77,7 +78,7 @@ abstract class HavenAccountListBase extends AccountList<Account> with Store {
78
_isRefreshing = false;
79
} catch (e) {
80
_isRefreshing = false;
80
- print(e);
81
+ printV(e);
82
rethrow;
83
}
84
}
cw_haven/lib/haven_subaddress_list.dart
+2
-1
@@ -1,3 +1,4 @@
1
+import 'package:cw_core/utils/print_verbose.dart';
2
import 'package:cw_haven/api/structs/subaddress_row.dart';
3
import 'package:flutter/services.dart';
4
import 'package:mobx/mobx.dart';
@@ -79,7 +80,7 @@ abstract class HavenSubaddressListBase with Store {
80
_isRefreshing = false;
81
} on PlatformException catch (e) {
82
_isRefreshing = false;
82
- print(e);
83
+ printV(e);
84
rethrow;
85
}
86
}
cw_haven/lib/haven_wallet.dart
+6
-5
@@ -3,6 +3,7 @@ import 'dart:io';
3
import 'package:cw_core/crypto_currency.dart';
4
import 'package:cw_core/pathForWallet.dart';
5
import 'package:cw_core/transaction_priority.dart';
6
+import 'package:cw_core/utils/print_verbose.dart';
7
import 'package:cw_haven/haven_transaction_creation_credentials.dart';
8
import 'package:cw_core/monero_amount_format.dart';
9
import 'package:cw_haven/haven_transaction_creation_exception.dart';
@@ -130,7 +131,7 @@ abstract class HavenWalletBase
131
syncStatus = ConnectedSyncStatus();
132
} catch (e) {
133
syncStatus = FailedSyncStatus();
133
- print(e);
134
+ printV(e);
135
}
136
}
137
@@ -147,7 +148,7 @@ abstract class HavenWalletBase
148
_listener?.start();
149
} catch (e) {
150
syncStatus = FailedSyncStatus();
150
- print(e);
151
+ printV(e);
152
rethrow;
153
}
154
}
@@ -324,7 +325,7 @@ abstract class HavenWalletBase
325
await transactionHistory.save();
326
_isTransactionUpdating = false;
327
} catch (e) {
327
- print(e);
328
+ printV(e);
329
_isTransactionUpdating = false;
330
}
331
}
@@ -403,7 +404,7 @@ abstract class HavenWalletBase
404
syncStatus = SyncingSyncStatus(blocksLeft, ptc);
405
}
406
} catch (e) {
406
- print(e.toString());
407
+ printV(e.toString());
408
}
409
}
410
@@ -413,7 +414,7 @@ abstract class HavenWalletBase
414
_askForUpdateBalance();
415
await Future<void>.delayed(Duration(seconds: 1));
416
} catch (e) {
416
- print(e.toString());
417
+ printV(e.toString());
418
}
419
}
420
cw_haven/lib/haven_wallet_addresses.dart
+2
-1
@@ -1,3 +1,4 @@
1
+import 'package:cw_core/utils/print_verbose.dart';
2
import 'package:cw_core/wallet_addresses_with_account.dart';
3
import 'package:cw_core/wallet_info.dart';
4
import 'package:cw_core/account.dart';
@@ -60,7 +61,7 @@ abstract class HavenWalletAddressesBase extends WalletAddressesWithAccount<Accou
61
62
await saveAddressesInBox();
63
} catch (e) {
63
- print(e.toString());
64
+ printV(e.toString());
65
}
66
}
67
cw_haven/lib/haven_wallet_service.dart
+6
-5
@@ -1,5 +1,6 @@
1
import 'dart:io';
2
import 'package:collection/collection.dart';
3
+import 'package:cw_core/utils/print_verbose.dart';
4
import 'package:cw_core/wallet_base.dart';
5
import 'package:cw_core/monero_wallet_utils.dart';
6
import 'package:hive/hive.dart';
@@ -81,7 +82,7 @@ class HavenWalletService extends WalletService<
82
return wallet;
83
} catch (e) {
84
// TODO: Implement Exception for wallet list service.
84
- print('HavenWalletsManager Error: ${e.toString()}');
85
+ printV('HavenWalletsManager Error: ${e.toString()}');
86
rethrow;
87
}
88
}
@@ -93,7 +94,7 @@ class HavenWalletService extends WalletService<
94
return haven_wallet_manager.isWalletExist(path: path);
95
} catch (e) {
96
// TODO: Implement Exception for wallet list service.
96
- print('HavenWalletsManager Error: $e');
97
+ printV('HavenWalletsManager Error: $e');
98
rethrow;
99
}
100
}
@@ -197,7 +198,7 @@ class HavenWalletService extends WalletService<
198
return wallet;
199
} catch (e) {
200
// TODO: Implement Exception for wallet list service.
200
- print('HavenWalletsManager Error: $e');
201
+ printV('HavenWalletsManager Error: $e');
202
rethrow;
203
}
204
}
@@ -218,7 +219,7 @@ class HavenWalletService extends WalletService<
219
return wallet;
220
} catch (e) {
221
// TODO: Implement Exception for wallet list service.
221
- print('HavenWalletsManager Error: $e');
222
+ printV('HavenWalletsManager Error: $e');
223
rethrow;
224
}
225
}
@@ -252,7 +253,7 @@ class HavenWalletService extends WalletService<
253
newFile.writeAsBytesSync(file.readAsBytesSync());
254
});
255
} catch (e) {
255
- print(e.toString());
256
+ printV(e.toString());
257
}
258
}
259
}
cw_monero/lib/api/transaction_history.dart
+2
-2
@@ -171,8 +171,8 @@ PendingTransactionDescription createTransactionMultDestSync(
171
final dstAddrs = outputs.map((e) => e.address).toList();
172
final amounts = outputs.map((e) => monero.Wallet_amountFromString(e.amount)).toList();
173
174
- // print("multDest: dstAddrs: $dstAddrs");
175
- // print("multDest: amounts: $amounts");
174
+ // printV("multDest: dstAddrs: $dstAddrs");
175
+ // printV("multDest: amounts: $amounts");
176
177
final txptr = monero.Wallet_createTransactionMultDest(
178
wptr!,
cw_monero/lib/api/wallet.dart
+6
-5
@@ -2,6 +2,7 @@ import 'dart:async';
2
import 'dart:ffi';
3
import 'dart:isolate';
4
5
+import 'package:cw_core/utils/print_verbose.dart';
6
import 'package:cw_monero/api/account_list.dart';
7
import 'package:cw_monero/api/exceptions/setup_wallet_exception.dart';
8
import 'package:flutter/foundation.dart';
@@ -11,7 +12,7 @@ import 'package:mutex/mutex.dart';
12
int getSyncingHeight() {
13
// final height = monero.MONERO_cw_WalletListener_height(getWlptr());
14
final h2 = monero.Wallet_blockChainHeight(wptr!);
14
- // print("height: $height / $h2");
15
+ // printV("height: $height / $h2");
16
return h2;
17
}
18
@@ -70,9 +71,9 @@ String getSeedLegacy(String? language) {
71
Map<int, Map<int, Map<int, String>>> addressCache = {};
72
73
String getAddress({int accountIndex = 0, int addressIndex = 0}) {
73
- // print("getaddress: ${accountIndex}/${addressIndex}: ${monero.Wallet_numSubaddresses(wptr!, accountIndex: accountIndex)}: ${monero.Wallet_address(wptr!, accountIndex: accountIndex, addressIndex: addressIndex)}");
74
+ // printV("getaddress: ${accountIndex}/${addressIndex}: ${monero.Wallet_numSubaddresses(wptr!, accountIndex: accountIndex)}: ${monero.Wallet_address(wptr!, accountIndex: accountIndex, addressIndex: addressIndex)}");
75
while (monero.Wallet_numSubaddresses(wptr!, accountIndex: accountIndex)-1 < addressIndex) {
75
- print("adding subaddress");
76
+ printV("adding subaddress");
77
monero.Wallet_addSubaddress(wptr!, accountIndex: accountIndex);
78
}
79
addressCache[wptr!.address] ??= {};
@@ -101,7 +102,7 @@ Future<bool> setupNodeSync(
102
bool useSSL = false,
103
bool isLightWallet = false,
104
String? socksProxyAddress}) async {
104
- print('''
105
+ printV('''
106
{
107
wptr!,
108
daemonAddress: $address,
@@ -126,7 +127,7 @@ Future<bool> setupNodeSync(
127
128
if (status != 0) {
129
final error = monero.Wallet_errorString(wptr!);
129
- print("error: $error");
130
+ printV("error: $error");
131
throw SetupWalletException(message: error);
132
}
133
cw_monero/lib/api/wallet_manager.dart
+6
-5
@@ -2,6 +2,7 @@ import 'dart:ffi';
2
import 'dart:io';
3
import 'dart:isolate';
4
5
+import 'package:cw_core/utils/print_verbose.dart';
6
import 'package:cw_monero/api/account_list.dart';
7
import 'package:cw_monero/api/exceptions/wallet_creation_exception.dart';
8
import 'package:cw_monero/api/exceptions/wallet_opening_exception.dart';
@@ -50,9 +51,9 @@ final monero.WalletManager wmPtr = Pointer.fromAddress((() {
51
// than plugging gdb in. Especially on windows/android.
52
monero.printStarts = false;
53
_wmPtr ??= monero.WalletManagerFactory_getWalletManager();
53
- print("ptr: $_wmPtr");
54
+ printV("ptr: $_wmPtr");
55
} catch (e) {
55
- print(e);
56
+ printV(e);
57
rethrow;
58
}
59
return _wmPtr!.address;
@@ -223,7 +224,7 @@ void restoreWalletFromSpendKeySync(
224
225
if (status != 0) {
226
final err = monero.Wallet_errorString(newWptr);
226
- print("err: $err");
227
+ printV("err: $err");
228
throw WalletRestoreFromKeysException(message: err);
229
}
230
@@ -301,7 +302,7 @@ Future<void> loadWallet(
302
);
303
final status = monero.WalletManager_errorString(wmPtr);
304
if (status != "") {
304
- print("loadWallet:"+status);
305
+ printV("loadWallet:"+status);
306
throw WalletOpeningException(message: status);
307
}
308
} else {
@@ -326,7 +327,7 @@ Future<void> loadWallet(
327
final status = monero.Wallet_status(newWptr);
328
if (status != 0) {
329
final err = monero.Wallet_errorString(newWptr);
329
- print("loadWallet:"+err);
330
+ printV("loadWallet:"+err);
331
throw WalletOpeningException(message: err);
332
}
333
cw_monero/lib/ledger.dart
+2
-2
@@ -28,9 +28,9 @@ void enableLedgerExchange(monero.wallet ptr, LedgerConnection connection) {
28
ptr, emptyPointer.cast<UnsignedChar>(), 0);
29
malloc.free(emptyPointer);
30
31
- // print("> ${ledgerRequest.toHexString()}");
31
+ // printV("> ${ledgerRequest.toHexString()}");
32
final response = await exchange(connection, ledgerRequest);
33
- // print("< ${response.toHexString()}");
33
+ // printV("< ${response.toHexString()}");
34
35
final Pointer<Uint8> result = malloc<Uint8>(response.length);
36
for (var i = 0; i < response.length; i++) {
cw_monero/lib/monero_account_list.dart
+2
-1
@@ -1,4 +1,5 @@
1
import 'package:cw_core/monero_amount_format.dart';
2
+import 'package:cw_core/utils/print_verbose.dart';
3
import 'package:mobx/mobx.dart';
4
import 'package:cw_core/account.dart';
5
import 'package:cw_monero/api/account_list.dart' as account_list;
@@ -74,7 +75,7 @@ abstract class MoneroAccountListBase with Store {
75
_isRefreshing = false;
76
} catch (e) {
77
_isRefreshing = false;
77
- print(e);
78
+ printV(e);
79
rethrow;
80
}
81
}
cw_monero/lib/monero_subaddress_list.dart
+2
-1
@@ -1,4 +1,5 @@
1
import 'package:cw_core/subaddress.dart';
2
+import 'package:cw_core/utils/print_verbose.dart';
3
import 'package:cw_monero/api/coins_info.dart';
4
import 'package:cw_monero/api/subaddress_list.dart' as subaddress_list;
5
import 'package:cw_monero/api/wallet.dart';
@@ -87,7 +88,7 @@ abstract class MoneroSubaddressListBase with Store {
88
_isRefreshing = false;
89
} on PlatformException catch (e) {
90
_isRefreshing = false;
90
- print(e);
91
+ printV(e);
92
rethrow;
93
}
94
}
cw_monero/lib/monero_unspent.dart
+3
-2
@@ -1,4 +1,5 @@
1
import 'package:cw_core/unspent_transaction_output.dart';
2
+import 'package:cw_core/utils/print_verbose.dart';
3
import 'package:cw_monero/api/coins_info.dart';
4
import 'package:monero/monero.dart' as monero;
5
@@ -10,7 +11,7 @@ class MoneroUnspent extends Unspent {
11
12
@override
13
set isFrozen(bool freeze) {
13
- print("set isFrozen: $freeze ($keyImage): $freeze");
14
+ printV("set isFrozen: $freeze ($keyImage): $freeze");
15
final coinId = getCoinByKeyImage(keyImage!);
16
if (coinId == null) throw Exception("Unable to find a coin for address $address");
17
if (freeze) {
@@ -22,7 +23,7 @@ class MoneroUnspent extends Unspent {
23
24
@override
25
bool get isFrozen {
25
- print("get isFrozen");
26
+ printV("get isFrozen");
27
final coinId = getCoinByKeyImage(keyImage!);
28
if (coinId == null) throw Exception("Unable to find a coin for address $address");
29
final coin = getCoin(coinId);
cw_monero/lib/monero_wallet.dart
+12
-11
@@ -17,6 +17,7 @@ import 'package:cw_core/pending_transaction.dart';
17
import 'package:cw_core/sync_status.dart';
18
import 'package:cw_core/transaction_direction.dart';
19
import 'package:cw_core/unspent_coins_info.dart';
20
+import 'package:cw_core/utils/print_verbose.dart';
21
import 'package:cw_core/wallet_base.dart';
22
import 'package:cw_core/wallet_info.dart';
23
import 'package:cw_monero/api/account_list.dart';
@@ -198,7 +199,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
199
syncStatus = ConnectedSyncStatus();
200
} catch (e) {
201
syncStatus = FailedSyncStatus();
201
- print(e);
202
+ printV(e);
203
}
204
}
205
@@ -229,7 +230,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
230
_listener?.start();
231
} catch (e) {
232
syncStatus = FailedSyncStatus();
232
- print(e);
233
+ printV(e);
234
rethrow;
235
}
236
}
@@ -399,8 +400,8 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
400
try {
401
await backupWalletFiles(name);
402
} catch (e) {
402
- print("¯\\_(ツ)_/¯");
403
- print(e);
403
+ printV("¯\\_(ツ)_/¯");
404
+ printV(e);
405
}
406
}
407
@@ -409,7 +410,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
410
final currentWalletDirPath = await pathForWalletDir(name: name, type: type);
411
if (openedWalletsByPath["$currentWalletDirPath/$name"] != null) {
412
// NOTE: this is realistically only required on windows.
412
- print("closing wallet");
413
+ printV("closing wallet");
414
final wmaddr = wmPtr.address;
415
final waddr = openedWalletsByPath["$currentWalletDirPath/$name"]!.address;
416
await Isolate.run(() {
@@ -417,7 +418,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
418
Pointer.fromAddress(wmaddr), Pointer.fromAddress(waddr), true);
419
});
420
openedWalletsByPath.remove("$currentWalletDirPath/$name");
420
- print("wallet closed");
421
+ printV("wallet closed");
422
}
423
try {
424
// -- rename the waller folder --
@@ -555,7 +556,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
556
await _refreshUnspentCoinsInfo();
557
_askForUpdateBalance();
558
} catch (e, s) {
558
- print(e.toString());
559
+ printV(e.toString());
560
onError?.call(FlutterErrorDetails(
561
exception: e,
562
stack: s,
@@ -604,7 +605,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
605
await unspentCoinsInfo.deleteAll(keys);
606
}
607
} catch (e) {
607
- print(e.toString());
608
+ printV(e.toString());
609
}
610
}
611
@@ -637,7 +638,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
638
await transactionHistory.save();
639
_isTransactionUpdating = false;
640
} catch (e) {
640
- print(e);
641
+ printV(e);
642
_isTransactionUpdating = false;
643
}
644
}
@@ -784,7 +785,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
785
syncStatus = SyncingSyncStatus(blocksLeft, ptc);
786
}
787
} catch (e) {
787
- print(e.toString());
788
+ printV(e.toString());
789
}
790
}
791
@@ -794,7 +795,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
795
_askForUpdateBalance();
796
await Future<void>.delayed(Duration(seconds: 1));
797
} catch (e) {
797
- print(e.toString());
798
+ printV(e.toString());
799
}
800
}
801
cw_monero/lib/monero_wallet_addresses.dart
+2
-1
@@ -1,6 +1,7 @@
1
import 'package:cw_core/account.dart';
2
import 'package:cw_core/address_info.dart';
3
import 'package:cw_core/subaddress.dart';
4
+import 'package:cw_core/utils/print_verbose.dart';
5
import 'package:cw_core/wallet_addresses.dart';
6
import 'package:cw_core/wallet_info.dart';
7
import 'package:cw_monero/api/subaddress_list.dart' as subaddress_list;
@@ -96,7 +97,7 @@ abstract class MoneroWalletAddressesBase extends WalletAddresses with Store {
97
98
await saveAddressesInBox();
99
} catch (e) {
99
- print(e.toString());
100
+ printV(e.toString());
101
}
102
}
103
cw_monero/lib/monero_wallet_service.dart
+10
-9
@@ -3,6 +3,7 @@ import 'dart:io';
3
import 'package:cw_core/monero_wallet_utils.dart';
4
import 'package:cw_core/pathForWallet.dart';
5
import 'package:cw_core/unspent_coins_info.dart';
6
+import 'package:cw_core/utils/print_verbose.dart';
7
import 'package:cw_core/wallet_base.dart';
8
import 'package:cw_core/wallet_credentials.dart';
9
import 'package:cw_core/wallet_info.dart';
@@ -110,7 +111,7 @@ class MoneroWalletService extends WalletService<
111
return wallet;
112
} catch (e) {
113
// TODO: Implement Exception for wallet list service.
113
- print('MoneroWalletsManager Error: ${e.toString()}');
114
+ printV('MoneroWalletsManager Error: ${e.toString()}');
115
rethrow;
116
}
117
}
@@ -122,7 +123,7 @@ class MoneroWalletService extends WalletService<
123
return monero_wallet_manager.isWalletExist(path: path);
124
} catch (e) {
125
// TODO: Implement Exception for wallet list service.
125
- print('MoneroWalletsManager Error: $e');
126
+ printV('MoneroWalletsManager Error: $e');
127
rethrow;
128
}
129
}
@@ -177,7 +178,7 @@ class MoneroWalletService extends WalletService<
178
final path = await pathForWalletDir(name: wallet, type: getType());
179
if (openedWalletsByPath["$path/$wallet"] != null) {
180
// NOTE: this is realistically only required on windows.
180
- print("closing wallet");
181
+ printV("closing wallet");
182
final wmaddr = wmPtr.address;
183
final waddr = openedWalletsByPath["$path/$wallet"]!.address;
184
// await Isolate.run(() {
@@ -185,7 +186,7 @@ class MoneroWalletService extends WalletService<
186
Pointer.fromAddress(wmaddr), Pointer.fromAddress(waddr), false);
187
// });
188
openedWalletsByPath.remove("$path/$wallet");
188
- print("wallet closed");
189
+ printV("wallet closed");
190
}
191
192
final file = Directory(path);
@@ -241,7 +242,7 @@ class MoneroWalletService extends WalletService<
242
return wallet;
243
} catch (e) {
244
// TODO: Implement Exception for wallet list service.
244
- print('MoneroWalletsManager Error: $e');
245
+ printV('MoneroWalletsManager Error: $e');
246
rethrow;
247
}
248
}
@@ -272,7 +273,7 @@ class MoneroWalletService extends WalletService<
273
return wallet;
274
} catch (e) {
275
// TODO: Implement Exception for wallet list service.
275
- print('MoneroWalletsManager Error: $e');
276
+ printV('MoneroWalletsManager Error: $e');
277
rethrow;
278
}
279
}
@@ -301,7 +302,7 @@ class MoneroWalletService extends WalletService<
302
return wallet;
303
} catch (e) {
304
// TODO: Implement Exception for wallet list service.
304
- print('MoneroWalletsManager Error: $e');
305
+ printV('MoneroWalletsManager Error: $e');
306
rethrow;
307
}
308
}
@@ -318,7 +319,7 @@ class MoneroWalletService extends WalletService<
319
path, credentials.password!, polyseed, credentials.walletInfo!, lang);
320
} catch (e) {
321
// TODO: Implement Exception for wallet list service.
321
- print('MoneroWalletsManager Error: $e');
322
+ printV('MoneroWalletsManager Error: $e');
323
rethrow;
324
}
325
}
@@ -381,7 +382,7 @@ class MoneroWalletService extends WalletService<
382
newFile.writeAsBytesSync(file.readAsBytesSync());
383
});
384
} catch (e) {
384
- print(e.toString());
385
+ printV(e.toString());
386
}
387
}
388
cw_mweb/lib/cw_mweb.dart
+23
-22
@@ -4,6 +4,7 @@ import 'dart:developer';
4
import 'dart:io';
5
import 'dart:typed_data';
6
7
+import 'package:cw_core/utils/print_verbose.dart';
8
import 'package:grpc/grpc.dart';
9
import 'package:path_provider/path_provider.dart';
10
import 'cw_mweb_platform_interface.dart';
@@ -39,18 +40,18 @@ class CwMweb {
40
final fileStream = file.openRead(lastLength, currentLength);
41
final newLines = await fileStream.transform(utf8.decoder).join();
42
lastLength = currentLength;
42
- log(newLines);
43
+ printV(newLines);
44
}
45
} on GrpcError catch (e) {
45
- log('Caught grpc error: ${e.message}');
46
+ printV('Caught grpc error: ${e.message}');
47
} catch (e) {
47
- log('The mwebd debug log probably is not initialized yet.');
48
+ printV('The mwebd debug log probably is not initialized yet.');
49
}
50
});
51
}
52
53
static Future<void> _initializeClient() async {
53
- print("_initializeClient() called!");
54
+ printV("_initializeClient() called!");
55
final appDir = await getApplicationSupportDirectory();
56
const ltcNodeUri = "ltc-electrum.cakewallet.com:9333";
57
@@ -61,14 +62,14 @@ class CwMweb {
62
if (_port == null || _port == 0) {
63
throw Exception("Failed to start server");
64
}
64
- log("Attempting to connect to server on port: $_port");
65
+ printV("Attempting to connect to server on port: $_port");
66
67
// wait for the server to finish starting up before we try to connect to it:
68
await Future.delayed(const Duration(seconds: 8));
69
70
_clientChannel = ClientChannel('127.0.0.1', port: _port!, channelShutdownHandler: () {
71
_rpcClient = null;
71
- log("Channel is shutting down!");
72
+ printV("Channel is shutting down!");
73
},
74
options: const ChannelOptions(
75
credentials: ChannelCredentials.insecure(),
@@ -90,14 +91,14 @@ class CwMweb {
91
}
92
return _rpcClient!;
93
} on GrpcError catch (e) {
93
- log("Attempt $i failed: $e");
94
- log('Caught grpc error: ${e.message}');
94
+ printV("Attempt $i failed: $e");
95
+ printV('Caught grpc error: ${e.message}');
96
_rpcClient = null;
97
// necessary if the database isn't open:
98
await stop();
99
await Future.delayed(const Duration(seconds: 3));
100
} catch (e) {
100
- log("Attempt $i failed: $e");
101
+ printV("Attempt $i failed: $e");
102
_rpcClient = null;
103
await stop();
104
await Future.delayed(const Duration(seconds: 3));
@@ -111,9 +112,9 @@ class CwMweb {
112
await CwMwebPlatform.instance.stop();
113
await cleanup();
114
} on GrpcError catch (e) {
114
- log('Caught grpc error: ${e.message}');
115
+ printV('Caught grpc error: ${e.message}');
116
} catch (e) {
116
- log("Error stopping server: $e");
117
+ printV("Error stopping server: $e");
118
}
119
}
120
@@ -123,9 +124,9 @@ class CwMweb {
124
?.split(',')
125
.first;
126
} on GrpcError catch (e) {
126
- log('Caught grpc error: ${e.message}');
127
+ printV('Caught grpc error: ${e.message}');
128
} catch (e) {
128
- log("Error getting address: $e");
129
+ printV("Error getting address: $e");
130
}
131
return null;
132
}
@@ -159,9 +160,9 @@ class CwMweb {
160
_rpcClient = await stub();
161
return await _rpcClient!.spent(request, options: CallOptions(timeout: TIMEOUT_DURATION));
162
} on GrpcError catch (e) {
162
- log('Caught grpc error: ${e.message}');
163
+ printV('Caught grpc error: ${e.message}');
164
} catch (e) {
164
- log("Error getting spent: $e");
165
+ printV("Error getting spent: $e");
166
}
167
return SpentResponse();
168
}
@@ -172,9 +173,9 @@ class CwMweb {
173
_rpcClient = await stub();
174
return await _rpcClient!.status(request, options: CallOptions(timeout: TIMEOUT_DURATION));
175
} on GrpcError catch (e) {
175
- log('Caught grpc error: ${e.message}');
176
+ printV('Caught grpc error: ${e.message}');
177
} catch (e) {
177
- log("Error getting status: $e");
178
+ printV("Error getting status: $e");
179
}
180
return StatusResponse();
181
}
@@ -185,9 +186,9 @@ class CwMweb {
186
_rpcClient = await stub();
187
return await _rpcClient!.create(request, options: CallOptions(timeout: TIMEOUT_DURATION));
188
} on GrpcError catch (e) {
188
- log('Caught grpc error: ${e.message}');
189
+ printV('Caught grpc error: ${e.message}');
190
} catch (e) {
190
- log("Error getting create: $e");
191
+ printV("Error getting create: $e");
192
}
193
return CreateResponse();
194
}
@@ -201,9 +202,9 @@ class CwMweb {
202
log("got utxo stream");
203
return resp;
204
} on GrpcError catch (e) {
204
- log('Caught grpc error: ${e.message}');
205
+ printV('Caught grpc error: ${e.message}');
206
} catch (e) {
206
- log("Error getting utxos: $e");
207
+ printV("Error getting utxos: $e");
208
}
209
return null;
210
}
@@ -217,7 +218,7 @@ class CwMweb {
218
log('Caught grpc error: ${e.message}');
219
throw "error from broadcast mweb: $e";
220
} catch (e) {
220
- log("Error getting create: $e");
221
+ printV("Error getting utxos: $e");
222
rethrow;
223
}
224
}
cw_mweb/pubspec.yaml
+2
@@ -13,6 +13,8 @@ dependencies:
13
grpc: ^3.2.4
14
path_provider: ^2.1.2
15
plugin_platform_interface: ^2.0.2
16
+ cw_core:
17
+ path: ../cw_core
18
19
dev_dependencies:
20
flutter_test:
cw_nano/lib/nano_client.dart
+4
-3
@@ -2,6 +2,7 @@ import 'dart:async';
2
import 'dart:convert';
3
4
import 'package:cw_core/nano_account_info_response.dart';
5
+import 'package:cw_core/utils/print_verbose.dart';
6
import 'package:cw_nano/nano_block_info_response.dart';
7
import 'package:cw_core/n2_node.dart';
8
import 'package:cw_nano/nano_balance.dart';
@@ -106,7 +107,7 @@ class NanoClient {
107
final data = await jsonDecode(response.body);
108
return AccountInfoResponse.fromJson(data as Map<String, dynamic>);
109
} catch (e) {
109
- print("error while getting account info $e");
110
+ printV("error while getting account info $e");
111
return null;
112
}
113
}
@@ -127,7 +128,7 @@ class NanoClient {
128
final data = await jsonDecode(response.body);
129
return BlockContentsResponse.fromJson(data["contents"] as Map<String, dynamic>);
130
} catch (e) {
130
- print("error while getting block info $e");
131
+ printV("error while getting block info $e");
132
return null;
133
}
134
}
@@ -508,7 +509,7 @@ class NanoClient {
509
.map<NanoTransactionModel>((transaction) => NanoTransactionModel.fromJson(transaction))
510
.toList();
511
} catch (e) {
511
- print(e);
512
+ printV(e);
513
return [];
514
}
515
}
cw_nano/lib/nano_transaction_history.dart
+3
-2
@@ -1,6 +1,7 @@
1
import 'dart:convert';
2
import 'dart:core';
3
import 'package:cw_core/pathForWallet.dart';
4
+import 'package:cw_core/utils/print_verbose.dart';
5
import 'package:cw_core/wallet_info.dart';
6
import 'package:cw_core/encryption_file_utils.dart';
7
import 'package:mobx/mobx.dart';
@@ -37,7 +38,7 @@ abstract class NanoTransactionHistoryBase extends TransactionHistoryBase<NanoTra
38
final data = json.encode({'transactions': transactions});
39
await encryptionFileUtils.write(path: path, password: _password, data: data);
40
} catch (e) {
40
- print('Error while save nano transaction history: ${e.toString()}');
41
+ printV('Error while save nano transaction history: ${e.toString()}');
42
}
43
}
44
@@ -72,7 +73,7 @@ abstract class NanoTransactionHistoryBase extends TransactionHistoryBase<NanoTra
73
}
74
});
75
} catch (e) {
75
- print(e);
76
+ printV(e);
77
}
78
}
79
cw_nano/lib/nano_wallet.dart
+5
-4
@@ -15,6 +15,7 @@ import 'package:cw_core/pending_transaction.dart';
15
import 'package:cw_core/sync_status.dart';
16
import 'package:cw_core/transaction_direction.dart';
17
import 'package:cw_core/transaction_priority.dart';
18
+import 'package:cw_core/utils/print_verbose.dart';
19
import 'package:cw_core/wallet_base.dart';
20
import 'package:cw_core/wallet_info.dart';
21
import 'package:cw_core/wallet_keys_file.dart';
@@ -170,12 +171,12 @@ abstract class NanoWalletBase
171
await _updateRep();
172
await _receiveAll();
173
} catch (e) {
173
- print(e);
174
+ printV(e);
175
}
176
177
syncStatus = ConnectedSyncStatus();
178
} catch (e) {
178
- print(e);
179
+ printV(e);
180
syncStatus = FailedSyncStatus();
181
}
182
}
@@ -367,7 +368,7 @@ abstract class NanoWalletBase
368
369
syncStatus = SyncedSyncStatus();
370
} catch (e) {
370
- print(e);
371
+ printV(e);
372
syncStatus = FailedSyncStatus();
373
rethrow;
374
}
@@ -444,7 +445,7 @@ abstract class NanoWalletBase
445
try {
446
balance[currency] = await _client.getBalance(_publicAddress!);
447
} catch (e) {
447
- print("Failed to get balance $e");
448
+ printV("Failed to get balance $e");
449
// if we don't have a balance, we should at least create one, since it's a late binding
450
// otherwise, it's better to just leave it as whatever it was before:
451
if (balance[currency] == null) {
cw_nano/lib/nano_wallet_addresses.dart
+2
-1
@@ -1,4 +1,5 @@
1
import 'package:cw_core/cake_hive.dart';
2
+import 'package:cw_core/utils/print_verbose.dart';
3
import 'package:cw_core/wallet_addresses.dart';
4
import 'package:cw_core/wallet_info.dart';
5
import 'package:cw_core/nano_account.dart';
@@ -47,7 +48,7 @@ abstract class NanoWalletAddressesBase extends WalletAddresses with Store {
48
addressesMap[address] = '';
49
await saveAddressesInBox();
50
} catch (e) {
50
- print(e.toString());
51
+ printV(e.toString());
52
}
53
}
54
}
cw_solana/lib/solana_client.dart
+3
-2
@@ -4,6 +4,7 @@ import 'dart:math';
4
5
import 'package:cw_core/crypto_currency.dart';
6
import 'package:cw_core/node.dart';
7
+import 'package:cw_core/utils/print_verbose.dart';
8
import 'package:cw_solana/pending_solana_transaction.dart';
9
import 'package:cw_solana/solana_balance.dart';
10
import 'package:cw_solana/solana_transaction_model.dart';
@@ -529,7 +530,7 @@ class SolanaWalletClient {
530
531
return signature;
532
} catch (e) {
532
- print('Error while sending transaction: ${e.toString()}');
533
+ printV('Error while sending transaction: ${e.toString()}');
534
throw Exception(e);
535
}
536
}
@@ -546,7 +547,7 @@ class SolanaWalletClient {
547
return null;
548
}
549
} catch (e) {
549
- print('Error occurred while fetching token image: \n${e.toString()}');
550
+ printV('Error occurred while fetching token image: \n${e.toString()}');
551
return null;
552
}
553
}
cw_solana/lib/solana_transaction_history.dart
+4
-3
@@ -2,6 +2,7 @@ import 'dart:convert';
2
import 'dart:core';
3
import 'package:cw_core/encryption_file_utils.dart';
4
import 'package:cw_core/pathForWallet.dart';
5
+import 'package:cw_core/utils/print_verbose.dart';
6
import 'package:cw_core/wallet_info.dart';
7
import 'package:cw_solana/solana_transaction_info.dart';
8
import 'package:mobx/mobx.dart';
@@ -36,8 +37,8 @@ abstract class SolanaTransactionHistoryBase extends TransactionHistoryBase<Solan
37
final data = json.encode({'transactions': transactionMaps});
38
await encryptionFileUtils.write(path: path, password: _password, data: data);
39
} catch (e, s) {
39
- print('Error while saving solana transaction history: ${e.toString()}');
40
- print(s);
40
+ printV('Error while saving solana transaction history: ${e.toString()}');
41
+ printV(s);
42
}
43
}
44
@@ -72,7 +73,7 @@ abstract class SolanaTransactionHistoryBase extends TransactionHistoryBase<Solan
73
}
74
});
75
} catch (e) {
75
- print(e);
76
+ printV(e);
77
}
78
}
79
cw_solana/lib/solana_wallet.dart
+2
-1
@@ -11,6 +11,7 @@ import 'package:cw_core/pending_transaction.dart';
11
import 'package:cw_core/sync_status.dart';
12
import 'package:cw_core/transaction_direction.dart';
13
import 'package:cw_core/transaction_priority.dart';
14
+import 'package:cw_core/utils/print_verbose.dart';
15
import 'package:cw_core/wallet_addresses.dart';
16
import 'package:cw_core/wallet_base.dart';
17
import 'package:cw_core/wallet_info.dart';
@@ -454,7 +455,7 @@ abstract class SolanaWalletBase
455
SolanaBalance(0.0);
456
balance[token] = tokenBalance;
457
} catch (e) {
457
- print('Error fetching spl token (${token.symbol}) balance ${e.toString()}');
458
+ printV('Error fetching spl token (${token.symbol}) balance ${e.toString()}');
459
}
460
} else {
461
balance.remove(token);
cw_solana/lib/solana_wallet_addresses.dart
+2
-1
@@ -1,3 +1,4 @@
1
+import 'package:cw_core/utils/print_verbose.dart';
2
import 'package:cw_core/wallet_addresses.dart';
3
import 'package:cw_core/wallet_info.dart';
4
import 'package:mobx/mobx.dart';
@@ -30,7 +31,7 @@ abstract class SolanaWalletAddressesBase extends WalletAddresses with Store {
31
addressesMap[address] = '';
32
await saveAddressesInBox();
33
} catch (e) {
33
- print(e.toString());
34
+ printV(e.toString());
35
}
36
}
37
}
cw_wownero/lib/api/wallet.dart
+5
-4
@@ -2,6 +2,7 @@ import 'dart:async';
2
import 'dart:ffi';
3
import 'dart:isolate';
4
5
+import 'package:cw_core/utils/print_verbose.dart';
6
import 'package:cw_wownero/api/account_list.dart';
7
import 'package:cw_wownero/api/exceptions/setup_wallet_exception.dart';
8
import 'package:monero/wownero.dart' as wownero;
@@ -10,7 +11,7 @@ import 'package:mutex/mutex.dart';
11
int getSyncingHeight() {
12
// final height = wownero.WOWNERO_cw_WalletListener_height(getWlptr());
13
final h2 = wownero.Wallet_blockChainHeight(wptr!);
13
- // print("height: $height / $h2");
14
+ // printV("height: $height / $h2");
15
return h2;
16
}
17
@@ -71,7 +72,7 @@ Map<int, Map<int, Map<int, String>>> addressCache = {};
72
73
String getAddress({int accountIndex = 0, int addressIndex = 1}) {
74
while (wownero.Wallet_numSubaddresses(wptr!, accountIndex: accountIndex)-1 < addressIndex) {
74
- print("adding subaddress");
75
+ printV("adding subaddress");
76
wownero.Wallet_addSubaddress(wptr!, accountIndex: accountIndex);
77
}
78
addressCache[wptr!.address] ??= {};
@@ -100,7 +101,7 @@ Future<bool> setupNodeSync(
101
bool useSSL = false,
102
bool isLightWallet = false,
103
String? socksProxyAddress}) async {
103
- print('''
104
+ printV('''
105
{
106
wptr!,
107
daemonAddress: $address,
@@ -125,7 +126,7 @@ Future<bool> setupNodeSync(
126
127
if (status != 0) {
128
final error = wownero.Wallet_errorString(wptr!);
128
- print("error: $error");
129
+ printV("error: $error");
130
throw SetupWalletException(message: error);
131
}
132
cw_wownero/lib/api/wallet_manager.dart
+5
-4
@@ -2,6 +2,7 @@ import 'dart:ffi';
2
import 'dart:io';
3
import 'dart:isolate';
4
5
+import 'package:cw_core/utils/print_verbose.dart';
6
import 'package:cw_wownero/api/account_list.dart';
7
import 'package:cw_wownero/api/exceptions/wallet_creation_exception.dart';
8
import 'package:cw_wownero/api/exceptions/wallet_opening_exception.dart';
@@ -53,9 +54,9 @@ final wownero.WalletManager wmPtr = Pointer.fromAddress((() {
54
// than plugging gdb in. Especially on windows/android.
55
wownero.printStarts = false;
56
_wmPtr ??= wownero.WalletManagerFactory_getWalletManager();
56
- print("ptr: $_wmPtr");
57
+ printV("ptr: $_wmPtr");
58
} catch (e) {
58
- print(e);
59
+ printV(e);
60
rethrow;
61
}
62
return _wmPtr!.address;
@@ -230,7 +231,7 @@ void restoreWalletFromSpendKeySync(
231
232
if (status != 0) {
233
final err = wownero.Wallet_errorString(newWptr);
233
- print("err: $err");
234
+ printV("err: $err");
235
throw WalletRestoreFromKeysException(message: err);
236
}
237
@@ -299,7 +300,7 @@ void loadWallet(
300
final status = wownero.Wallet_status(newWptr);
301
if (status != 0) {
302
final err = wownero.Wallet_errorString(newWptr);
302
- print(err);
303
+ printV(err);
304
throw WalletOpeningException(message: err);
305
}
306
wptr = newWptr;
cw_wownero/lib/mywownero.dart
+4
-2
@@ -1,3 +1,5 @@
1
+import 'package:cw_core/utils/print_verbose.dart';
2
+
3
const prefixLength = 3;
4
5
String swapEndianBytes(String original) {
@@ -37,14 +39,14 @@ String mnemonicDecode(String seed) {
39
.indexOf(wlist[i + 2].substring(0, prefixLength));
40
41
if (w1 == -1 || w2 == -1 || w3 == -1) {
40
- print("invalid word in mnemonic");
42
+ printV("invalid word in mnemonic");
43
return '';
44
}
45
46
final x = w1 + n * (((n - w1) + w2) % n) + n * n * (((n - w2) + w3) % n);
47
48
if (x % n != w1) {
47
- print("Something went wrong when decoding your private key, please try again");
49
+ printV("Something went wrong when decoding your private key, please try again");
50
return '';
51
}
52
cw_wownero/lib/wownero_account_list.dart
+2
-1
@@ -1,3 +1,4 @@
1
+import 'package:cw_core/utils/print_verbose.dart';
2
import 'package:cw_core/wownero_amount_format.dart';
3
import 'package:mobx/mobx.dart';
4
import 'package:cw_core/account.dart';
@@ -74,7 +75,7 @@ abstract class WowneroAccountListBase with Store {
75
_isRefreshing = false;
76
} catch (e) {
77
_isRefreshing = false;
77
- print(e);
78
+ printV(e);
79
rethrow;
80
}
81
}
cw_wownero/lib/wownero_subaddress_list.dart
+2
-1
@@ -1,4 +1,5 @@
1
import 'package:cw_core/subaddress.dart';
2
+import 'package:cw_core/utils/print_verbose.dart';
3
import 'package:cw_wownero/api/coins_info.dart';
4
import 'package:cw_wownero/api/subaddress_list.dart' as subaddress_list;
5
import 'package:cw_wownero/api/wallet.dart';
@@ -95,7 +96,7 @@ abstract class WowneroSubaddressListBase with Store {
96
_isRefreshing = false;
97
} on PlatformException catch (e) {
98
_isRefreshing = false;
98
- print(e);
99
+ printV(e);
100
rethrow;
101
}
102
}
cw_wownero/lib/wownero_wallet.dart
+12
-11
@@ -15,6 +15,7 @@ import 'package:cw_core/sync_status.dart';
15
import 'package:cw_core/transaction_direction.dart';
16
import 'package:cw_core/transaction_priority.dart';
17
import 'package:cw_core/unspent_coins_info.dart';
18
+import 'package:cw_core/utils/print_verbose.dart';
19
import 'package:cw_core/wallet_base.dart';
20
import 'package:cw_core/wallet_info.dart';
21
import 'package:cw_core/wownero_amount_format.dart';
@@ -185,7 +186,7 @@ abstract class WowneroWalletBase
186
syncStatus = ConnectedSyncStatus();
187
} catch (e) {
188
syncStatus = FailedSyncStatus();
188
- print(e);
189
+ printV(e);
190
}
191
}
192
@@ -216,7 +217,7 @@ abstract class WowneroWalletBase
217
_listener?.start();
218
} catch (e) {
219
syncStatus = FailedSyncStatus();
219
- print(e);
220
+ printV(e);
221
rethrow;
222
}
223
}
@@ -349,8 +350,8 @@ abstract class WowneroWalletBase
350
try {
351
await backupWalletFiles(name);
352
} catch (e) {
352
- print("¯\\_(ツ)_/¯");
353
- print(e);
353
+ printV("¯\\_(ツ)_/¯");
354
+ printV(e);
355
}
356
}
357
@@ -359,7 +360,7 @@ abstract class WowneroWalletBase
360
final currentWalletDirPath = await pathForWalletDir(name: name, type: type);
361
if (openedWalletsByPath["$currentWalletDirPath/$name"] != null) {
362
// NOTE: this is realistically only required on windows.
362
- print("closing wallet");
363
+ printV("closing wallet");
364
final wmaddr = wmPtr.address;
365
final waddr = openedWalletsByPath["$currentWalletDirPath/$name"]!.address;
366
await Isolate.run(() {
@@ -367,7 +368,7 @@ abstract class WowneroWalletBase
368
Pointer.fromAddress(wmaddr), Pointer.fromAddress(waddr), true);
369
});
370
openedWalletsByPath.remove("$currentWalletDirPath/$name");
370
- print("wallet closed");
371
+ printV("wallet closed");
372
}
373
try {
374
// -- rename the waller folder --
@@ -499,7 +500,7 @@ abstract class WowneroWalletBase
500
await _refreshUnspentCoinsInfo();
501
_askForUpdateBalance();
502
} catch (e, s) {
502
- print(e.toString());
503
+ printV(e.toString());
504
onError?.call(FlutterErrorDetails(
505
exception: e,
506
stack: s,
@@ -546,7 +547,7 @@ abstract class WowneroWalletBase
547
await unspentCoinsInfo.deleteAll(keys);
548
}
549
} catch (e) {
549
- print(e.toString());
550
+ printV(e.toString());
551
}
552
}
553
@@ -577,7 +578,7 @@ abstract class WowneroWalletBase
578
await transactionHistory.save();
579
_isTransactionUpdating = false;
580
} catch (e) {
580
- print(e);
581
+ printV(e);
582
_isTransactionUpdating = false;
583
}
584
}
@@ -717,7 +718,7 @@ abstract class WowneroWalletBase
718
syncStatus = SyncingSyncStatus(blocksLeft, ptc);
719
}
720
} catch (e) {
720
- print(e.toString());
721
+ printV(e.toString());
722
}
723
}
724
@@ -727,7 +728,7 @@ abstract class WowneroWalletBase
728
_askForUpdateBalance();
729
await Future<void>.delayed(Duration(seconds: 1));
730
} catch (e) {
730
- print(e.toString());
731
+ printV(e.toString());
732
}
733
}
734
cw_wownero/lib/wownero_wallet_addresses.dart
+2
-1
@@ -1,6 +1,7 @@
1
import 'package:cw_core/account.dart';
2
import 'package:cw_core/address_info.dart';
3
import 'package:cw_core/subaddress.dart';
4
+import 'package:cw_core/utils/print_verbose.dart';
5
import 'package:cw_core/wallet_addresses.dart';
6
import 'package:cw_core/wallet_info.dart';
7
import 'package:cw_wownero/api/transaction_history.dart';
@@ -94,7 +95,7 @@ abstract class WowneroWalletAddressesBase extends WalletAddresses with Store {
95
96
await saveAddressesInBox();
97
} catch (e) {
97
- print(e.toString());
98
+ printV(e.toString());
99
}
100
}
101
cw_wownero/lib/wownero_wallet_service.dart
+9
-8
@@ -3,6 +3,7 @@ import 'dart:io';
3
import 'package:cw_core/monero_wallet_utils.dart';
4
import 'package:cw_core/pathForWallet.dart';
5
import 'package:cw_core/unspent_coins_info.dart';
6
+import 'package:cw_core/utils/print_verbose.dart';
7
import 'package:cw_core/wallet_base.dart';
8
import 'package:cw_core/wallet_credentials.dart';
9
import 'package:cw_core/wallet_info.dart';
@@ -99,7 +100,7 @@ class WowneroWalletService extends WalletService<
100
return wallet;
101
} catch (e) {
102
// TODO: Implement Exception for wallet list service.
102
- print('WowneroWalletsManager Error: ${e.toString()}');
103
+ printV('WowneroWalletsManager Error: ${e.toString()}');
104
rethrow;
105
}
106
}
@@ -111,7 +112,7 @@ class WowneroWalletService extends WalletService<
112
return wownero_wallet_manager.isWalletExist(path: path);
113
} catch (e) {
114
// TODO: Implement Exception for wallet list service.
114
- print('WowneroWalletsManager Error: $e');
115
+ printV('WowneroWalletsManager Error: $e');
116
rethrow;
117
}
118
}
@@ -182,7 +183,7 @@ class WowneroWalletService extends WalletService<
183
final path = await pathForWalletDir(name: wallet, type: getType());
184
if (openedWalletsByPath["$path/$wallet"] != null) {
185
// NOTE: this is realistically only required on windows.
185
- print("closing wallet");
186
+ printV("closing wallet");
187
final wmaddr = wmPtr.address;
188
final waddr = openedWalletsByPath["$path/$wallet"]!.address;
189
// await Isolate.run(() {
@@ -190,7 +191,7 @@ class WowneroWalletService extends WalletService<
191
Pointer.fromAddress(wmaddr), Pointer.fromAddress(waddr), false);
192
// });
193
openedWalletsByPath.remove("$path/$wallet");
193
- print("wallet closed");
194
+ printV("wallet closed");
195
}
196
197
final file = Directory(path);
@@ -241,7 +242,7 @@ class WowneroWalletService extends WalletService<
242
return wallet;
243
} catch (e) {
244
// TODO: Implement Exception for wallet list service.
244
- print('WowneroWalletsManager Error: $e');
245
+ printV('WowneroWalletsManager Error: $e');
246
rethrow;
247
}
248
}
@@ -274,7 +275,7 @@ class WowneroWalletService extends WalletService<
275
return wallet;
276
} catch (e) {
277
// TODO: Implement Exception for wallet list service.
277
- print('WowneroWalletsManager Error: $e');
278
+ printV('WowneroWalletsManager Error: $e');
279
rethrow;
280
}
281
}
@@ -291,7 +292,7 @@ class WowneroWalletService extends WalletService<
292
path, credentials.password!, polyseed, credentials.walletInfo!, lang);
293
} catch (e) {
294
// TODO: Implement Exception for wallet list service.
294
- print('WowneroWalletsManager Error: $e');
295
+ printV('WowneroWalletsManager Error: $e');
296
rethrow;
297
}
298
}
@@ -348,7 +349,7 @@ class WowneroWalletService extends WalletService<
349
newFile.writeAsBytesSync(file.readAsBytesSync());
350
});
351
} catch (e) {
351
- print(e.toString());
352
+ printV(e.toString());
353
}
354
}
355
}
ios/ZanoWallet.framework/ZanoWallet
Binary files /dev/null and b/ios/ZanoWallet.framework/ZanoWallet differ
ios/zano_libwallet2_api_c.dylib
new
+1
@@ -0,0 +1 @@
1
+../scripts/monero_c/release/zano/host-apple-ios_libwallet2_api_c.dylib
\ No newline at end of file
lib/bitcoin/cw_bitcoin.dart
+4
-4
@@ -404,8 +404,8 @@ class CWBitcoin extends Bitcoin {
404
405
list.add(dInfoCopy);
406
} catch (e, s) {
407
- print("derivationInfoError: $e");
408
- print("derivationInfoStack: $s");
407
+ printV("derivationInfoError: $e");
408
+ printV("derivationInfoStack: $s");
409
}
410
}
411
}
@@ -498,7 +498,7 @@ class CWBitcoin extends Bitcoin {
498
try {
499
return hardwareWalletService.getAvailableAccounts(index: index, limit: limit);
500
} catch (err) {
501
- print(err);
501
+ printV(err);
502
throw err;
503
}
504
}
@@ -510,7 +510,7 @@ class CWBitcoin extends Bitcoin {
510
try {
511
return hardwareWalletService.getAvailableAccounts(index: index, limit: limit);
512
} catch (err) {
513
- print(err);
513
+ printV(err);
514
throw err;
515
}
516
}
lib/buy/dfx/dfx_buy_provider.dart
+6
-5
@@ -12,6 +12,7 @@ import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
12
import 'package:cake_wallet/utils/show_pop_up.dart';
13
import 'package:cake_wallet/view_model/hardware_wallet/ledger_view_model.dart';
14
import 'package:cw_core/crypto_currency.dart';
15
+import 'package:cw_core/utils/print_verbose.dart';
16
import 'package:cw_core/wallet_base.dart';
17
import 'package:cw_core/wallet_type.dart';
18
import 'package:flutter/material.dart';
@@ -136,7 +137,7 @@ class DFXBuyProvider extends BuyProvider {
137
return {};
138
}
139
} catch (e) {
139
- print('DFX Error fetching fiat currencies: $e');
140
+ printV('DFX Error fetching fiat currencies: $e');
141
return {};
142
}
143
}
@@ -266,19 +267,19 @@ class DFXBuyProvider extends BuyProvider {
267
quote.setCryptoCurrency = cryptoCurrency;
268
return [quote];
269
} else {
269
- print('DFX: Unexpected data type: ${responseData.runtimeType}');
270
+ printV('DFX: Unexpected data type: ${responseData.runtimeType}');
271
return null;
272
}
273
} else {
274
if (responseData is Map<String, dynamic> && responseData.containsKey('message')) {
274
- print('DFX Error: ${responseData['message']}');
275
+ printV('DFX Error: ${responseData['message']}');
276
} else {
276
- print('DFX Failed to fetch buy quote: ${response.statusCode}');
277
+ printV('DFX Failed to fetch buy quote: ${response.statusCode}');
278
}
279
return null;
280
}
281
} catch (e) {
281
- print('DFX Error fetching buy quote: $e');
282
+ printV('DFX Error fetching buy quote: $e');
283
return null;
284
}
285
}
lib/buy/meld/meld_buy_provider.dart
+4
-3
@@ -9,6 +9,7 @@ import 'package:cake_wallet/generated/i18n.dart';
9
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
10
import 'package:cake_wallet/utils/show_pop_up.dart';
11
import 'package:cw_core/crypto_currency.dart';
12
+import 'package:cw_core/utils/print_verbose.dart';
13
import 'package:cw_core/wallet_base.dart';
14
import 'package:flutter/material.dart';
15
import 'dart:developer';
@@ -75,11 +76,11 @@ class MeldBuyProvider extends BuyProvider {
76
data.map((e) => PaymentMethod.fromMeldJson(e as Map<String, dynamic>)).toList();
77
return paymentMethods;
78
} else {
78
- print('Meld: Failed to fetch payment types');
79
+ printV('Meld: Failed to fetch payment types');
80
return List<PaymentMethod>.empty();
81
}
82
} catch (e) {
82
- print('Meld: Failed to fetch payment types: $e');
83
+ printV('Meld: Failed to fetch payment types: $e');
84
return List<PaymentMethod>.empty();
85
}
86
}
@@ -132,7 +133,7 @@ class MeldBuyProvider extends BuyProvider {
133
return null;
134
}
135
} catch (e) {
135
- print('Error fetching buy quote: $e');
136
+ printV('Error fetching buy quote: $e');
137
return null;
138
}
139
}
lib/buy/moonpay/moonpay_provider.dart
+5
-4
@@ -18,6 +18,7 @@ import 'package:cake_wallet/themes/theme_base.dart';
18
import 'package:cw_core/crypto_currency.dart';
19
import 'package:cw_core/wallet_base.dart';
20
import 'package:cw_core/wallet_type.dart';
21
+import 'package:cw_core/utils/print_verbose.dart';
22
import 'package:flutter/material.dart';
23
import 'package:http/http.dart';
24
import 'package:url_launcher/url_launcher.dart';
@@ -113,11 +114,11 @@ class MoonPayProvider extends BuyProvider {
114
if (response.statusCode == 200) {
115
return jsonDecode(response.body) as Map<String, dynamic>;
116
} else {
116
- print('MoonPay does not support fiat: $fiatCurrency');
117
+ printV('MoonPay does not support fiat: $fiatCurrency');
118
return {};
119
}
120
} catch (e) {
120
- print('MoonPay Error fetching fiat currencies: $e');
121
+ printV('MoonPay Error fetching fiat currencies: $e');
122
return {};
123
}
124
}
@@ -204,11 +205,11 @@ class MoonPayProvider extends BuyProvider {
205
206
return [quote];
207
} else {
207
- print('Moon Pay: Error fetching buy quote: ');
208
+ printV('Moon Pay: Error fetching buy quote: ');
209
return null;
210
}
211
} catch (e) {
211
- print('Moon Pay: Error fetching buy quote: $e');
212
+ printV('Moon Pay: Error fetching buy quote: $e');
213
return null;
214
}
215
}
lib/buy/onramper/onramper_buy_provider.dart
+7
-6
@@ -11,6 +11,7 @@ import 'package:cake_wallet/store/settings_store.dart';
11
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
12
import 'package:cw_core/crypto_currency.dart';
13
import 'package:cw_core/currency.dart';
14
+import 'package:cw_core/utils/print_verbose.dart';
15
import 'package:cw_core/wallet_base.dart';
16
import 'package:flutter/material.dart';
17
import 'package:http/http.dart' as http;
@@ -67,11 +68,11 @@ class OnRamperBuyProvider extends BuyProvider {
68
.map((item) => PaymentMethod.fromOnramperJson(item as Map<String, dynamic>))
69
.toList();
70
} else {
70
- print('Failed to fetch available payment types');
71
+ printV('Failed to fetch available payment types');
72
return [];
73
}
74
} catch (e) {
74
- print('Failed to fetch available payment types: $e');
75
+ printV('Failed to fetch available payment types: $e');
76
return [];
77
}
78
}
@@ -98,11 +99,11 @@ class OnRamperBuyProvider extends BuyProvider {
99
100
return result;
101
} else {
101
- print('Failed to fetch onramp metadata');
102
+ printV('Failed to fetch onramp metadata');
103
return {};
104
}
105
} catch (e) {
105
- print('Error occurred: $e');
106
+ printV('Error occurred: $e');
107
return {};
108
}
109
}
@@ -178,11 +179,11 @@ class OnRamperBuyProvider extends BuyProvider {
179
180
return validQuotes;
181
} else {
181
- print('Onramper: Failed to fetch rate');
182
+ printV('Onramper: Failed to fetch rate');
183
return null;
184
}
185
} catch (e) {
185
- print('Onramper: Failed to fetch rate $e');
186
+ printV('Onramper: Failed to fetch rate $e');
187
return null;
188
}
189
}
lib/buy/robinhood/robinhood_buy_provider.dart
+2
-1
@@ -13,6 +13,7 @@ import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
13
import 'package:cake_wallet/utils/show_pop_up.dart';
14
import 'package:cake_wallet/view_model/hardware_wallet/ledger_view_model.dart';
15
import 'package:cw_core/crypto_currency.dart';
16
+import 'package:cw_core/utils/print_verbose.dart';
17
import 'package:cw_core/wallet_base.dart';
18
import 'package:cw_core/wallet_type.dart';
19
import 'package:flutter/material.dart';
@@ -176,7 +177,7 @@ class RobinhoodBuyProvider extends BuyProvider {
177
if (responseData.containsKey('message')) {
178
log('Robinhood Error: ${responseData['message']}');
179
} else {
179
- print('Robinhood Failed to fetch $action quote: ${response.statusCode}');
180
+ printV('Robinhood Failed to fetch $action quote: ${response.statusCode}');
181
}
182
return null;
183
}
lib/cake_pay/cake_pay_api.dart
+3
-2
@@ -3,6 +3,7 @@ import 'dart:convert';
3
import 'package:cake_wallet/cake_pay/cake_pay_order.dart';
4
import 'package:cake_wallet/cake_pay/cake_pay_user_credentials.dart';
5
import 'package:cake_wallet/cake_pay/cake_pay_vendor.dart';
6
+import 'package:cw_core/utils/print_verbose.dart';
7
import 'package:cake_wallet/entities/country.dart';
8
import 'package:http/http.dart' as http;
9
@@ -140,7 +141,7 @@ class CakePayApi {
141
142
final response = await http.get(uri, headers: headers);
143
143
- print('Response: ${response.statusCode}');
144
+ printV('Response: ${response.statusCode}');
145
146
if (response.statusCode != 200) {
147
throw Exception('Unexpected http status: ${response.statusCode}');
@@ -167,7 +168,7 @@ class CakePayApi {
168
throw Exception('Unexpected http status: ${response.statusCode}');
169
}
170
} catch (e) {
170
- print('Caught exception: $e');
171
+ printV('Caught exception: $e');
172
}
173
}
174
lib/core/auth_service.dart
+2
-1
@@ -4,6 +4,7 @@ import 'package:cake_wallet/core/secure_storage.dart';
4
import 'package:cake_wallet/core/totp_request_details.dart';
5
import 'package:cake_wallet/routes.dart';
6
import 'package:cake_wallet/src/screens/auth/auth_page.dart';
7
+import 'package:cw_core/utils/print_verbose.dart';
8
import 'package:flutter/material.dart';
9
import 'package:mobx/mobx.dart';
10
import 'package:shared_preferences/shared_preferences.dart';
@@ -51,7 +52,7 @@ class AuthService with Store {
52
try {
53
password = await secureStorage.read(key: key) ?? '';
54
} catch (e) {
54
- print(e);
55
+ printV(e);
56
}
57
58
return walletName.isNotEmpty && password.isNotEmpty;
lib/core/backup_service.dart
+6
-5
@@ -7,6 +7,7 @@ import 'package:cake_wallet/entities/transaction_description.dart';
7
import 'package:cake_wallet/themes/theme_list.dart';
8
import 'package:cw_core/root_dir.dart';
9
import 'package:cake_wallet/utils/device_info.dart';
10
+import 'package:cw_core/utils/print_verbose.dart';
11
import 'package:cw_core/wallet_type.dart';
12
import 'package:flutter/foundation.dart';
13
import 'package:hive/hive.dart';
@@ -110,11 +111,11 @@ class BackupService {
111
for (var ignore in ignoreFiles) {
112
final filename = entity.absolute.path;
113
if (filename.endsWith(ignore) && !filename.contains("wallets/")) {
113
- print("ignoring backup file: $filename");
114
+ printV("ignoring backup file: $filename");
115
return;
116
}
117
}
117
- print("restoring: $filename");
118
+ printV("restoring: $filename");
119
if (entity.statSync().type == FileSystemEntityType.directory) {
120
zipEncoder.addDirectory(Directory(entity.path));
121
} else {
@@ -175,11 +176,11 @@ class BackupService {
176
final filename = file.name;
177
for (var ignore in ignoreFiles) {
178
if (filename.endsWith(ignore) && !filename.contains("wallets/")) {
178
- print("ignoring backup file: $filename");
179
+ printV("ignoring backup file: $filename");
180
continue outer;
181
}
182
}
182
- print("restoring: $filename");
183
+ printV("restoring: $filename");
184
if (file.isFile) {
185
final content = file.content as List<int>;
186
File('${appDir.path}/' + filename)
@@ -193,7 +194,7 @@ class BackupService {
194
await _verifyWallets();
195
await _importKeychainDumpV2(password);
196
await _importPreferencesDump();
196
- await _importTransactionDescriptionDump();
197
+ await _importTransactionDescriptionDump(); // HiveError: Box has already been closed
198
}
199
200
Future<void> _verifyWallets() async {
lib/core/wallet_connect/chain_service/solana/solana_chain_service.dart
+3
-2
@@ -8,6 +8,7 @@ import 'package:cake_wallet/src/screens/wallet_connect/widgets/message_display_w
8
import 'package:cake_wallet/core/wallet_connect/models/connection_model.dart';
9
import 'package:cake_wallet/src/screens/wallet_connect/widgets/connection_widget.dart';
10
import 'package:cake_wallet/src/screens/wallet_connect/widgets/modals/web3_request_modal.dart';
11
+import 'package:cw_core/utils/print_verbose.dart';
12
import 'package:solana/base58.dart';
13
import 'package:solana/solana.dart';
14
import 'package:walletconnect_flutter_v2/walletconnect_flutter_v2.dart';
@@ -127,7 +128,7 @@ class SolanaChainServiceImpl implements ChainService {
128
commitment: Commitment.confirmed,
129
);
130
130
- print(signature);
131
+ printV(signature);
132
133
bottomSheetService.queueBottomSheet(
134
isModalDismissible: true,
@@ -165,7 +166,7 @@ class SolanaChainServiceImpl implements ChainService {
166
try {
167
sign = await ownerKeyPair?.sign(base58decode(solanaSignMessage.message));
168
} catch (e) {
168
- print(e);
169
+ printV(e);
170
}
171
172
if (sign == null) {
lib/core/wallet_connect/web3wallet_service.dart
+4
-3
@@ -17,6 +17,7 @@ import 'package:cake_wallet/src/screens/wallet_connect/widgets/connection_reques
17
import 'package:cake_wallet/src/screens/wallet_connect/widgets/message_display_widget.dart';
18
import 'package:cake_wallet/src/screens/wallet_connect/widgets/modals/web3_request_modal.dart';
19
import 'package:cake_wallet/store/app_store.dart';
20
+import 'package:cw_core/utils/print_verbose.dart';
21
import 'package:cw_core/wallet_type.dart';
22
import 'package:eth_sig_util/eth_sig_util.dart';
23
import 'package:flutter/material.dart';
@@ -260,7 +261,7 @@ abstract class Web3WalletServiceBase with Store {
261
262
@action
263
void _refreshPairings() {
263
- print('Refreshing pairings');
264
+ printV('Refreshing pairings');
265
pairings.clear();
266
267
final allPairings = _web3Wallet.pairings.getAll();
@@ -397,10 +398,10 @@ abstract class Web3WalletServiceBase with Store {
398
// Get all pairing topics attached to this key
399
final pairingTopicsForWallet = getPairingTopicsForWallet(key);
400
400
- print(pairingTopicsForWallet);
401
+ printV(pairingTopicsForWallet);
402
403
bool isPairingTopicAlreadySaved = pairingTopicsForWallet.contains(pairingTopic);
403
- print('Is Pairing Topic Saved: $isPairingTopicAlreadySaved');
404
+ printV('Is Pairing Topic Saved: $isPairingTopicAlreadySaved');
405
406
if (!isPairingTopicAlreadySaved) {
407
// Update the list with the most recent pairing topic
lib/core/wallet_loading_service.dart
+2
-1
@@ -12,6 +12,7 @@ import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
12
import 'package:cake_wallet/utils/exception_handler.dart';
13
import 'package:cake_wallet/utils/show_pop_up.dart';
14
import 'package:cw_core/cake_hive.dart';
15
+import 'package:cw_core/utils/print_verbose.dart';
16
import 'package:cw_core/wallet_base.dart';
17
import 'package:cw_core/wallet_info.dart';
18
import 'package:cw_core/wallet_service.dart';
@@ -97,7 +98,7 @@ class WalletLoadingService {
98
// if found a wallet that is not corrupted, then still display the seeds of the corrupted ones
99
authenticatedErrorStreamController.add(corruptedWalletsSeeds);
100
} catch (e) {
100
- print(e);
101
+ printV(e);
102
// save seeds and show corrupted wallets' seeds to the user
103
try {
104
final seeds = await _getCorruptedWalletSeeds(walletInfo.name, walletInfo.type);
lib/entities/background_tasks.dart
+7
-6
@@ -8,6 +8,7 @@ import 'package:cake_wallet/utils/feature_flag.dart';
8
import 'package:cake_wallet/view_model/settings/sync_mode.dart';
9
import 'package:cake_wallet/view_model/wallet_list/wallet_list_item.dart';
10
import 'package:cake_wallet/view_model/wallet_list/wallet_list_view_model.dart';
11
+import 'package:cw_core/utils/print_verbose.dart';
12
import 'package:cw_core/wallet_base.dart';
13
import 'package:cw_core/wallet_type.dart';
14
import 'package:flutter/foundation.dart';
@@ -83,8 +84,8 @@ void callbackDispatcher() {
84
85
return Future.value(true);
86
} catch (error, stackTrace) {
86
- print(error);
87
- print(stackTrace);
87
+ printV(error);
88
+ printV(stackTrace);
89
return Future.error(error);
90
}
91
});
@@ -149,8 +150,8 @@ class BackgroundTasks {
150
constraints: constraints,
151
);
152
} catch (error, stackTrace) {
152
- print(error);
153
- print(stackTrace);
153
+ printV(error);
154
+ printV(stackTrace);
155
}
156
}
157
@@ -158,8 +159,8 @@ class BackgroundTasks {
159
try {
160
Workmanager().cancelByUniqueName(moneroSyncTaskKey);
161
} catch (error, stackTrace) {
161
- print(error);
162
- print(stackTrace);
162
+ printV(error);
163
+ printV(stackTrace);
164
}
165
}
166
}
lib/entities/biometric_auth.dart
+3
-2
@@ -1,3 +1,4 @@
1
+import 'package:cw_core/utils/print_verbose.dart';
2
import 'package:flutter/services.dart';
3
import 'package:flutter_local_authentication/flutter_local_authentication.dart';
4
@@ -9,7 +10,7 @@ class BiometricAuth {
10
final authenticated = await _flutterLocalAuthenticationPlugin.authenticate();
11
return authenticated;
12
} catch (e) {
12
- print(e);
13
+ printV(e);
14
}
15
return false;
16
}
@@ -20,7 +21,7 @@ class BiometricAuth {
21
canAuthenticate = await _flutterLocalAuthenticationPlugin.canAuthenticate();
22
await _flutterLocalAuthenticationPlugin.setTouchIDAuthenticationAllowableReuseDuration(0);
23
} catch (error) {
23
- print("Exception checking support. $error");
24
+ printV("Exception checking support. $error");
25
canAuthenticate = false;
26
}
27
lib/entities/default_settings_migration.dart
+4
-3
@@ -7,6 +7,7 @@ import 'package:cake_wallet/entities/fiat_api_mode.dart';
7
import 'package:cw_core/pathForWallet.dart';
8
import 'package:cake_wallet/entities/secret_store_key.dart';
9
import 'package:cw_core/root_dir.dart';
10
+import 'package:cw_core/utils/print_verbose.dart';
11
import 'package:hive/hive.dart';
12
import 'package:shared_preferences/shared_preferences.dart';
13
import 'package:cake_wallet/entities/preferences_key.dart';
@@ -296,7 +297,7 @@ Future<void> defaultSettingsMigration(
297
await sharedPreferences.setInt(
298
PreferencesKey.currentDefaultSettingsMigrationVersion, version);
299
} catch (e) {
299
- print('Migration error: ${e.toString()}');
300
+ printV('Migration error: ${e.toString()}');
301
}
302
});
303
@@ -714,7 +715,7 @@ Future<void> insecureStorageMigration({
715
await secureStorage.write(
716
key: SecureKey.lastAuthTimeMilliseconds, value: lastAuthTimeMilliseconds.toString());
717
} catch (e) {
717
- print("Error migrating shared preferences to secure storage!: $e");
718
+ printV("Error migrating shared preferences to secure storage!: $e");
719
// this actually shouldn't be that big of a problem since we don't delete the old keys in this update
720
// and we read and write to the new locations when loading storage, the migration is just for extra safety
721
}
@@ -870,7 +871,7 @@ Future<void> addAddressesForMoneroWallets(Box<WalletInfo> walletInfoSource) asyn
871
info.address = addressText;
872
await info.save();
873
} catch (e) {
873
- print(e.toString());
874
+ printV(e.toString());
875
}
876
});
877
}
lib/entities/ens_record.dart
+2
-1
@@ -1,5 +1,6 @@
1
import 'package:cake_wallet/ethereum/ethereum.dart';
2
import 'package:cake_wallet/polygon/polygon.dart';
3
+import 'package:cw_core/utils/print_verbose.dart';
4
import 'package:cw_core/wallet_base.dart';
5
import 'package:cw_core/wallet_type.dart';
6
import 'package:ens_dart/ens_dart.dart';
@@ -45,7 +46,7 @@ class EnsRecord {
46
final addr = await ens.withName(name).getAddress();
47
return addr.hex;
48
} catch (e) {
48
- print(e);
49
+ printV(e);
50
return "";
51
}
52
}
lib/entities/fs_migration.dart
+6
-5
@@ -2,6 +2,7 @@ import 'dart:io';
2
import 'dart:convert';
3
import 'package:cake_wallet/core/secure_storage.dart';
4
import 'package:collection/collection.dart';
5
+import 'package:cw_core/utils/print_verbose.dart';
6
import 'package:shared_preferences/shared_preferences.dart';
7
import 'package:hive/hive.dart';
8
import 'package:path_provider/path_provider.dart';
@@ -171,7 +172,7 @@ Future<void> ios_migrate_wallet_passwords() async {
172
await keyService.saveWalletPassword(walletName: name, password: password!);
173
}
174
} catch (e) {
174
- print(e.toString());
175
+ printV(e.toString());
176
}
177
});
178
@@ -326,7 +327,7 @@ Future<void> ios_migrate_wallet_info(Box<WalletInfo> walletsInfoSource) async {
327
return walletInfo;
328
}
329
} catch (e) {
329
- print(e.toString());
330
+ printV(e.toString());
331
return null;
332
}
333
})
@@ -336,7 +337,7 @@ Future<void> ios_migrate_wallet_info(Box<WalletInfo> walletsInfoSource) async {
337
await walletsInfoSource.addAll(infoRecords);
338
await prefs.setBool('ios_migration_wallet_info_completed', true);
339
} catch (e) {
339
- print(e.toString());
340
+ printV(e.toString());
341
}
342
}
343
@@ -403,7 +404,7 @@ Future<void> ios_migrate_trades_list(Box<Trade> tradeSource) async {
404
await tradeSource.addAll(trades);
405
await prefs.setBool('ios_migration_trade_list_completed', true);
406
} catch (e) {
406
- print(e.toString());
407
+ printV(e.toString());
408
}
409
}
410
@@ -437,6 +438,6 @@ Future<void> ios_migrate_address_book(Box<Contact> contactSource) async {
438
await contactSource.addAll(contacts);
439
await prefs.setBool('ios_migration_address_book_completed', true);
440
} catch (e) {
440
- print(e.toString());
441
+ printV(e.toString());
442
}
443
}
lib/entities/openalias_record.dart
+2
-1
@@ -1,4 +1,5 @@
1
import 'package:basic_utils/basic_utils.dart';
2
+import 'package:cw_core/utils/print_verbose.dart';
3
4
class OpenaliasRecord {
5
OpenaliasRecord({
@@ -27,7 +28,7 @@ class OpenaliasRecord {
28
29
return txtRecord;
30
} catch (e) {
30
- print("${e.toString()}");
31
+ printV("${e.toString()}");
32
return null;
33
}
34
}
lib/entities/parse_address_from_domain.dart
+2
-1
@@ -11,6 +11,7 @@ import 'package:cake_wallet/nostr/nostr_api.dart';
11
import 'package:cake_wallet/store/settings_store.dart';
12
import 'package:cake_wallet/twitter/twitter_api.dart';
13
import 'package:cw_core/crypto_currency.dart';
14
+import 'package:cw_core/utils/print_verbose.dart';
15
import 'package:cw_core/wallet_base.dart';
16
import 'package:cw_core/wallet_type.dart';
17
import 'package:cake_wallet/entities/fio_address_provider.dart';
@@ -283,7 +284,7 @@ class AddressResolver {
284
}
285
}
286
} catch (e) {
286
- print(e.toString());
287
+ printV(e.toString());
288
}
289
290
return ParsedAddress(addresses: [text]);
lib/entities/qr_scanner.dart
+2
-1
@@ -5,6 +5,7 @@ import 'package:cake_wallet/main.dart';
5
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
6
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
7
import 'package:cake_wallet/utils/show_pop_up.dart';
8
+import 'package:cw_core/utils/print_verbose.dart';
9
import 'package:fast_scanner/fast_scanner.dart';
10
import 'package:flutter/material.dart';
11
import 'package:flutter/scheduler.dart';
@@ -61,7 +62,7 @@ class _BarcodeScannerSimpleState extends State<BarcodeScannerSimple> {
62
);
63
},
64
);
64
- print(e);
65
+ printV(e);
66
}
67
}
68
lib/entities/unstoppable_domain_address.dart
+2
-1
@@ -1,5 +1,6 @@
1
import 'dart:convert';
2
3
+import 'package:cw_core/utils/print_verbose.dart';
4
import 'package:http/http.dart' as http;
5
6
Future<String> fetchUnstoppableDomainAddress(String domain, String ticker) async {
@@ -20,7 +21,7 @@ Future<String> fetchUnstoppableDomainAddress(String domain, String ticker) async
21
22
return records[key] as String? ?? '';
23
} catch (e) {
23
- print('Unstoppable domain error: ${e.toString()}');
24
+ printV('Unstoppable domain error: ${e.toString()}');
25
address = '';
26
}
27
lib/ethereum/cw_ethereum.dart
+1
-1
@@ -205,7 +205,7 @@ class CWEthereum extends Ethereum {
205
try {
206
return await hardwareWalletService.getAvailableAccounts(index: index, limit: limit);
207
} catch (err) {
208
- print(err);
208
+ printV(err);
209
throw err;
210
}
211
}
lib/exchange/provider/changenow_exchange_provider.dart
+2
-1
@@ -15,6 +15,7 @@ import 'package:cake_wallet/utils/device_info.dart';
15
import 'package:cake_wallet/utils/distribution_info.dart';
16
import 'package:cake_wallet/wallet_type_utils.dart';
17
import 'package:cw_core/crypto_currency.dart';
18
+import 'package:cw_core/utils/print_verbose.dart';
19
import 'package:http/http.dart';
20
21
class ChangeNowExchangeProvider extends ExchangeProvider {
@@ -127,7 +128,7 @@ class ChangeNowExchangeProvider extends ExchangeProvider {
128
129
return isReverse ? (amount / fromAmount) : (toAmount / amount);
130
} catch (e) {
130
- print(e.toString());
131
+ printV(e.toString());
132
return 0.0;
133
}
134
}
lib/exchange/provider/exolix_exchange_provider.dart
+2
-1
@@ -10,6 +10,7 @@ import 'package:cake_wallet/exchange/trade_request.dart';
10
import 'package:cake_wallet/exchange/trade_state.dart';
11
import 'package:cake_wallet/exchange/utils/currency_pairs_utils.dart';
12
import 'package:cw_core/crypto_currency.dart';
13
+import 'package:cw_core/utils/print_verbose.dart';
14
import 'package:http/http.dart';
15
16
class ExolixExchangeProvider extends ExchangeProvider {
@@ -124,7 +125,7 @@ class ExolixExchangeProvider extends ExchangeProvider {
125
126
return responseJSON['rate'] as double;
127
} catch (e) {
127
- print(e.toString());
128
+ printV(e.toString());
129
return 0.0;
130
}
131
}
lib/exchange/provider/quantex_exchange_provider.dart
+5
-4
@@ -11,6 +11,7 @@ import 'package:cake_wallet/exchange/trade_request.dart';
11
import 'package:cake_wallet/exchange/trade_state.dart';
12
import 'package:cake_wallet/exchange/utils/currency_pairs_utils.dart';
13
import 'package:cw_core/crypto_currency.dart';
14
+import 'package:cw_core/utils/print_verbose.dart';
15
import 'package:http/http.dart';
16
17
class QuantexExchangeProvider extends ExchangeProvider {
@@ -86,7 +87,7 @@ class QuantexExchangeProvider extends ExchangeProvider {
87
// coin not found:
88
return Limits(min: 0, max: 0);
89
} catch (e) {
89
- print(e.toString());
90
+ printV(e.toString());
91
return Limits(min: 0, max: 0);
92
}
93
}
@@ -121,7 +122,7 @@ class QuantexExchangeProvider extends ExchangeProvider {
122
double rate = double.parse(data['price'].toString());
123
return rate;
124
} catch (e) {
124
- print("error fetching rate: ${e.toString()}");
125
+ printV("error fetching rate: ${e.toString()}");
126
return 0.0;
127
}
128
}
@@ -178,7 +179,7 @@ class QuantexExchangeProvider extends ExchangeProvider {
179
isSendAll: isSendAll,
180
);
181
} catch (e) {
181
- print("error creating trade: ${e.toString()}");
182
+ printV("error creating trade: ${e.toString()}");
183
throw TradeNotCreatedException(description, description: e.toString());
184
}
185
}
@@ -225,7 +226,7 @@ class QuantexExchangeProvider extends ExchangeProvider {
226
state: state,
227
);
228
} catch (e) {
228
- print("error getting trade: ${e.toString()}");
229
+ printV("error getting trade: ${e.toString()}");
230
throw TradeNotFoundException(
231
id,
232
provider: description,
lib/exchange/provider/thorchain_exchange.provider.dart
+2
-1
@@ -8,6 +8,7 @@ import 'package:cake_wallet/exchange/trade_request.dart';
8
import 'package:cake_wallet/exchange/trade_state.dart';
9
import 'package:cake_wallet/exchange/utils/currency_pairs_utils.dart';
10
import 'package:cw_core/crypto_currency.dart';
11
+import 'package:cw_core/utils/print_verbose.dart';
12
import 'package:hive/hive.dart';
13
import 'package:http/http.dart' as http;
14
@@ -86,7 +87,7 @@ class ThorChainExchangeProvider extends ExchangeProvider {
87
88
return _thorChainAmountToDouble(expectedAmountOut) / amount;
89
} catch (e) {
89
- print(e.toString());
90
+ printV(e.toString());
91
return 0.0;
92
}
93
}
lib/exchange/provider/trocador_exchange_provider.dart
+2
-1
@@ -9,6 +9,7 @@ import 'package:cake_wallet/exchange/trade_request.dart';
9
import 'package:cake_wallet/exchange/trade_state.dart';
10
import 'package:cake_wallet/exchange/utils/currency_pairs_utils.dart';
11
import 'package:cw_core/crypto_currency.dart';
12
+import 'package:cw_core/utils/print_verbose.dart';
13
import 'package:http/http.dart';
14
15
class TrocadorExchangeProvider extends ExchangeProvider {
@@ -148,7 +149,7 @@ class TrocadorExchangeProvider extends ExchangeProvider {
149
150
return isReceiveAmount ? (amount / fromAmount) : (toAmount / amount);
151
} catch (e) {
151
- print(e.toString());
152
+ printV(e.toString());
153
return 0.0;
154
}
155
}
lib/mastodon/mastodon_api.dart
+3
-2
@@ -1,4 +1,5 @@
1
import 'dart:convert';
2
+import 'package:cw_core/utils/print_verbose.dart';
3
import 'package:http/http.dart' as http;
4
import 'package:cake_wallet/mastodon/mastodon_user.dart';
5
@@ -27,7 +28,7 @@ class MastodonAPI {
28
29
return MastodonUser.fromJson(responseJSON);
30
} catch (e) {
30
- print('Error in lookupUserByUserName: $e');
31
+ printV('Error in lookupUserByUserName: $e');
32
return null;
33
}
34
}
@@ -56,7 +57,7 @@ class MastodonAPI {
57
58
return responseJSON.map((json) => PinnedPost.fromJson(json as Map<String, dynamic>)).toList();
59
} catch (e) {
59
- print('Error in getPinnedPosts: $e');
60
+ printV('Error in getPinnedPosts: $e');
61
throw e;
62
}
63
}
lib/nano/cw_nano.dart
+2
-2
@@ -249,7 +249,7 @@ class CWNanoUtil extends NanoUtil {
249
try {
250
mnemonic = NanoDerivations.standardSeedToMnemonic(seedKey);
251
} catch (e) {
252
- print("not a valid 'nano' seed key");
252
+ printV("not a valid 'nano' seed key");
253
}
254
}
255
if (derivationType == DerivationType.bip39) {
@@ -306,7 +306,7 @@ class CWNanoUtil extends NanoUtil {
306
try {
307
mnemonic = NanoDerivations.standardSeedToMnemonic(seedKey!);
308
} catch (e) {
309
- print("not a valid 'nano' seed key");
309
+ printV("not a valid 'nano' seed key");
310
}
311
}
312
lib/nostr/nostr_api.dart
+3
-2
@@ -5,6 +5,7 @@ import 'package:cake_wallet/nostr/nostr_user.dart';
5
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
6
import 'package:cake_wallet/src/widgets/picker.dart';
7
import 'package:cake_wallet/utils/show_pop_up.dart';
8
+import 'package:cw_core/utils/print_verbose.dart';
9
import 'package:flutter/material.dart';
10
import 'package:nostr_tools/nostr_tools.dart';
11
@@ -83,7 +84,7 @@ class NostrProfileHandler {
84
relay.close();
85
return null;
86
} catch (e) {
86
- print('[!] Error with relay $relayUrl: $e');
87
+ printV('[!] Error with relay $relayUrl: $e');
88
return null;
89
}
90
}
@@ -115,7 +116,7 @@ class NostrProfileHandler {
116
var uri = Uri.parse(relayUrl);
117
return uri.host;
118
} catch (e) {
118
- print('Error parsing URL: $e');
119
+ printV('Error parsing URL: $e');
120
return '';
121
}
122
}
lib/polygon/cw_polygon.dart
+1
-1
@@ -204,7 +204,7 @@ class CWPolygon extends Polygon {
204
try {
205
return await hardwareWalletService.getAvailableAccounts(index: index, limit: limit);
206
} catch (err) {
207
- print(err);
207
+ printV(err);
208
throw err;
209
}
210
}
lib/reactions/check_connection.dart
+2
-1
@@ -1,6 +1,7 @@
1
import 'dart:async';
2
3
import 'package:connectivity_plus/connectivity_plus.dart';
4
+import 'package:cw_core/utils/print_verbose.dart';
5
import 'package:cw_core/wallet_base.dart';
6
import 'package:cw_core/sync_status.dart';
7
import 'package:cw_core/wallet_type.dart';
@@ -36,7 +37,7 @@ void startCheckConnectionReaction(WalletBase wallet, SettingsStore settingsStore
37
}
38
}
39
} catch (e) {
39
- print(e.toString());
40
+ printV(e.toString());
41
}
42
});
43
}
lib/reactions/fiat_rate_update.dart
+2
-1
@@ -11,6 +11,7 @@ import 'package:cake_wallet/store/settings_store.dart';
11
import 'package:cake_wallet/tron/tron.dart';
12
import 'package:cw_core/crypto_currency.dart';
13
import 'package:cw_core/erc20_token.dart';
14
+import 'package:cw_core/utils/print_verbose.dart';
15
import 'package:cw_core/wallet_type.dart';
16
import 'package:mobx/mobx.dart';
17
@@ -71,7 +72,7 @@ Future<void> startFiatRateUpdate(
72
}
73
}
74
} catch (e) {
74
- print(e);
75
+ printV(e);
76
}
77
};
78
lib/reactions/on_current_node_change.dart
+3
-2
@@ -1,3 +1,4 @@
1
+import 'package:cw_core/utils/print_verbose.dart';
2
import 'package:mobx/mobx.dart';
3
import 'package:cw_core/node.dart';
4
import 'package:cake_wallet/store/app_store.dart';
@@ -10,14 +11,14 @@ void startOnCurrentNodeChangeReaction(AppStore appStore) {
11
try {
12
await appStore.wallet!.connectToNode(node: change.newValue!);
13
} catch (e) {
13
- print(e.toString());
14
+ printV(e.toString());
15
}
16
});
17
appStore.settingsStore.powNodes.observe((change) async {
18
try {
19
await appStore.wallet!.connectToPowNode(node: change.newValue!);
20
} catch (e) {
20
- print(e.toString());
21
+ printV(e.toString());
22
}
23
});
24
}
lib/reactions/on_current_wallet_change.dart
+4
-3
@@ -9,6 +9,7 @@ import 'package:cw_core/crypto_currency.dart';
9
import 'package:cw_core/transaction_history.dart';
10
import 'package:cw_core/balance.dart';
11
import 'package:cw_core/transaction_info.dart';
12
+import 'package:cw_core/utils/print_verbose.dart';
13
import 'package:mobx/mobx.dart';
14
import 'package:cake_wallet/reactions/check_connection.dart';
15
import 'package:cake_wallet/reactions/on_wallet_sync_status_change.dart';
@@ -46,7 +47,7 @@ void startCurrentWalletChangeReaction(
47
// appStore.wallet.walletInfo.yatLastUsedAddress = address;
48
// await appStore.wallet.walletInfo.save();
49
//} catch (e) {
49
- // print(e.toString());
50
+ // printV(e.toString());
51
//}
52
//});
53
@@ -91,7 +92,7 @@ void startCurrentWalletChangeReaction(
92
}
93
}
94
} catch (e) {
94
- print(e.toString());
95
+ printV(e.toString());
96
}
97
});
98
@@ -138,7 +139,7 @@ void startCurrentWalletChangeReaction(
139
}
140
}
141
} catch (e) {
141
- print(e.toString());
142
+ printV(e.toString());
143
}
144
});
145
}
lib/reactions/on_wallet_sync_status_change.dart
+2
-1
@@ -1,5 +1,6 @@
1
import 'package:cake_wallet/entities/update_haven_rate.dart';
2
import 'package:cake_wallet/store/dashboard/fiat_conversion_store.dart';
3
+import 'package:cw_core/utils/print_verbose.dart';
4
import 'package:cw_core/wallet_type.dart';
5
import 'package:mobx/mobx.dart';
6
import 'package:cw_core/transaction_history.dart';
@@ -31,7 +32,7 @@ void startWalletSyncStatusChangeReaction(
32
await WakelockPlus.disable();
33
}
34
} catch (e) {
34
- print(e.toString());
35
+ printV(e.toString());
36
}
37
});
38
}
lib/src/screens/buy/buy_webview_page.dart
+2
-1
@@ -5,6 +5,7 @@ import 'package:cake_wallet/generated/i18n.dart';
5
import 'package:cake_wallet/src/screens/base_page.dart';
6
import 'package:cake_wallet/store/dashboard/orders_store.dart';
7
import 'package:cake_wallet/view_model/buy/buy_view_model.dart';
8
+import 'package:cw_core/utils/print_verbose.dart';
9
import 'package:flutter/material.dart';
10
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
11
@@ -103,7 +104,7 @@ class BuyWebViewPageBodyState extends State<BuyWebViewPageBody> {
104
}
105
} catch (e) {
106
_isSaving = false;
106
- print(e);
107
+ printV(e);
108
}
109
});
110
}
lib/src/screens/connect_device/connect_device_page.dart
+2
-1
@@ -10,6 +10,7 @@ import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
10
import 'package:cake_wallet/themes/extensions/wallet_list_theme.dart';
11
import 'package:cake_wallet/utils/responsive_layout_util.dart';
12
import 'package:cake_wallet/view_model/hardware_wallet/ledger_view_model.dart';
13
+import 'package:cw_core/utils/print_verbose.dart';
14
import 'package:cw_core/wallet_type.dart';
15
import 'package:flutter/material.dart';
16
import 'package:flutter_mobx/flutter_mobx.dart';
@@ -127,7 +128,7 @@ class ConnectDevicePageBodyState extends State<ConnectDevicePageBody> {
128
_bleRefreshTimer = null;
129
}
130
} catch (e) {
130
- print(e);
131
+ printV(e);
132
}
133
}
134
lib/src/screens/connect_device/debug_device_page.dart
+2
-2
@@ -223,10 +223,10 @@
223
// setState(() => status = "Sending...");
224
// final acc = await func();
225
// setState(() => status = "$method: $acc");
226
-// print("$method: $acc");
226
+// printV("$method: $acc");
227
// } on LedgerException catch (ex) {
228
// setState(() => status = "${ex.errorCode.toRadixString(16)} ${ex.message}");
229
-// print("${ex.errorCode.toRadixString(16)} ${ex.message}");
229
+// printV("${ex.errorCode.toRadixString(16)} ${ex.message}");
230
// }
231
// },
232
// color: Theme.of(context).primaryColor,
lib/src/screens/dashboard/pages/cake_features_page.dart
+2
-1
@@ -7,6 +7,7 @@ import 'package:cake_wallet/src/widgets/dashboard_card_widget.dart';
7
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
8
import 'package:cake_wallet/utils/show_pop_up.dart';
9
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
10
+import 'package:cw_core/utils/print_verbose.dart';
11
import 'package:cw_core/wallet_type.dart';
12
import 'package:cake_wallet/view_model/dashboard/cake_features_view_model.dart';
13
import 'package:flutter/material.dart';
@@ -105,7 +106,7 @@ class CakeFeaturesPage extends StatelessWidget {
106
mode: LaunchMode.externalApplication,
107
);
108
} catch (e) {
108
- print(e);
109
+ printV(e);
110
}
111
}
112
lib/src/screens/root/root.dart
+2
-1
@@ -4,6 +4,7 @@ import 'package:cake_wallet/core/auth_service.dart';
4
import 'package:cake_wallet/core/totp_request_details.dart';
5
import 'package:cake_wallet/utils/device_info.dart';
6
import 'package:cake_wallet/view_model/link_view_model.dart';
7
+import 'package:cw_core/utils/print_verbose.dart';
8
import 'package:cw_core/wallet_base.dart';
9
import 'package:cw_core/wallet_type.dart';
10
import 'package:flutter/material.dart';
@@ -91,7 +92,7 @@ class RootState extends State<Root> with WidgetsBindingObserver {
92
93
handleDeepLinking(await getInitialUri());
94
} catch (e) {
94
- print(e);
95
+ printV(e);
96
}
97
}
98
lib/src/screens/send/send_page.dart
+2
-1
@@ -28,6 +28,7 @@ import 'package:cake_wallet/utils/request_review_handler.dart';
28
import 'package:cake_wallet/utils/responsive_layout_util.dart';
29
import 'package:cake_wallet/utils/show_pop_up.dart';
30
import 'package:cake_wallet/view_model/send/output.dart';
31
+import 'package:cw_core/utils/print_verbose.dart';
32
import 'package:cw_core/unspent_coin_type.dart';
33
import 'package:cw_core/wallet_type.dart';
34
import 'package:cake_wallet/view_model/send/send_view_model.dart';
@@ -584,7 +585,7 @@ class SendPage extends BasePage {
585
mode: LaunchMode.externalApplication,
586
);
587
} catch (e) {
587
- print(e);
588
+ printV(e);
589
}
590
}
591
}
lib/src/screens/settings/tor_page.dart
+3
-2
@@ -3,6 +3,7 @@ import 'dart:io';
3
4
import 'package:cake_wallet/src/screens/base_page.dart';
5
import 'package:cake_wallet/store/app_store.dart';
6
+import 'package:cw_core/utils/print_verbose.dart';
7
import 'package:flutter/material.dart';
8
// import 'package:tor/tor.dart';
9
@@ -57,7 +58,7 @@ class _TorPageBodyState extends State<TorPageBody> {
58
// }
59
// widget.appStore.wallet!.connectToNode(node: node);
60
60
- print('Done awaiting; tor should be running');
61
+ printV('Done awaiting; tor should be running');
62
}
63
64
Future<void> endTor() async {
@@ -69,7 +70,7 @@ class _TorPageBodyState extends State<TorPageBody> {
70
// torEnabled = Tor.instance.enabled; // Update flag
71
// });
72
//
72
- // print('Done awaiting; tor should be stopped');
73
+ // printV('Done awaiting; tor should be stopped');
74
}
75
//
76
// @override
lib/src/screens/setup_2fa/setup_2fa_enter_code_page.dart
+2
-1
@@ -3,6 +3,7 @@ import 'package:cake_wallet/core/execution_state.dart';
3
import 'package:cake_wallet/core/totp_request_details.dart';
4
import 'package:cake_wallet/utils/show_bar.dart';
5
import 'package:cake_wallet/view_model/auth_state.dart';
6
+import 'package:cw_core/utils/print_verbose.dart';
7
import 'package:flutter/material.dart';
8
9
import 'package:cake_wallet/generated/i18n.dart';
@@ -53,7 +54,7 @@ class TotpAuthCodePageState extends State<TotpAuthCodePage> {
54
}
55
56
if (state is FailureState) {
56
- print(state.error);
57
+ printV(state.error);
58
widget.totpArguments.onTotpAuthenticationFinished!(false, this);
59
}
60
lib/src/screens/support_chat/support_chat_page.dart
+2
-1
@@ -3,6 +3,7 @@ import 'package:cake_wallet/generated/i18n.dart';
3
import 'package:cake_wallet/src/screens/base_page.dart';
4
import 'package:cake_wallet/src/screens/support_chat/widgets/chatwoot_widget.dart';
5
import 'package:cake_wallet/view_model/support_view_model.dart';
6
+import 'package:cw_core/utils/print_verbose.dart';
7
import 'package:flutter/material.dart';
8
9
@@ -22,7 +23,7 @@ class SupportChatPage extends BasePage {
23
Widget body(BuildContext context) => FutureBuilder<String>(
24
future: getCookie(),
25
builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
25
- print(snapshot.data);
26
+ printV(snapshot.data);
27
if (snapshot.hasData)
28
return ChatwootWidget(
29
secureStorage,
lib/src/screens/support_chat/widgets/chatwoot_widget.dart
+2
-1
@@ -1,6 +1,7 @@
1
import 'dart:convert';
2
3
import 'package:cake_wallet/core/secure_storage.dart';
4
+import 'package:cw_core/utils/print_verbose.dart';
5
import 'package:flutter/material.dart';
6
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
7
@@ -38,7 +39,7 @@ class ChatwootWidgetState extends State<ChatwootWidget> {
39
final eventType = parsedMessage["event"];
40
if (eventType == 'loaded') {
41
final authToken = parsedMessage["config"]["authToken"];
41
- print(authToken);
42
+ printV(authToken);
43
storeCookie(authToken as String);
44
}
45
}
lib/store/settings_store.dart
+3
-2
@@ -36,6 +36,7 @@ import 'package:cake_wallet/wownero/wownero.dart';
36
import 'package:cw_core/node.dart';
37
import 'package:cw_core/set_app_secure_native.dart';
38
import 'package:cw_core/transaction_priority.dart';
39
+import 'package:cw_core/utils/print_verbose.dart';
40
import 'package:cw_core/wallet_type.dart';
41
import 'package:device_info_plus/device_info_plus.dart';
42
import 'package:flutter/material.dart';
@@ -1663,8 +1664,8 @@ abstract class SettingsStoreBase with Store {
1664
final windowsInfo = await deviceInfoPlugin.windowsInfo;
1665
deviceName = windowsInfo.productName;
1666
} catch (e) {
1666
- print(e);
1667
- print(
1667
+ printV(e);
1668
+ printV(
1669
'likely digitalProductId is null wait till https://github.com/fluttercommunity/plus_plugins/pull/3188 is merged');
1670
deviceName = "Windows Device";
1671
}
lib/store/yat/yat_store.dart
+3
-2
@@ -1,5 +1,6 @@
1
import 'package:cake_wallet/core/secure_storage.dart';
2
import 'package:cw_core/transaction_history.dart';
3
+import 'package:cw_core/utils/print_verbose.dart';
4
import 'package:cw_core/wallet_base.dart';
5
import 'package:cw_core/balance.dart';
6
import 'package:cw_core/transaction_info.dart';
@@ -250,7 +251,7 @@ abstract class YatStoreBase with Store {
251
walletInfo!.save();
252
}
253
} catch (e) {
253
- print(e.toString());
254
+ printV(e.toString());
255
}
256
}
257
@@ -265,7 +266,7 @@ abstract class YatStoreBase with Store {
266
// apiKey = await fetchYatApiKey(accessToken);
267
// await secureStorage.write(key: yatApiKey(_wallet.walletInfo.name), value: accessToken);
268
//} catch (e) {
268
- // print(e.toString());
269
+ // printV(e.toString());
270
//}
271
}
272
lib/utils/distribution_info.dart
+2
-1
@@ -1,5 +1,6 @@
1
import 'dart:io';
2
import 'package:cake_wallet/utils/package_info.dart';
3
+import 'package:cw_core/utils/print_verbose.dart';
4
5
enum DistributionType { googleplay, github, appstore, fdroid }
6
@@ -32,7 +33,7 @@ class DistributionInfo {
33
final packageInfo = await PackageInfo.fromPlatform();
34
return packageInfo.packageName == 'com.android.vending';
35
} catch (e) {
35
- print('Error: $e');
36
+ printV('Error: $e');
37
return false;
38
}
39
}
lib/utils/exception_handler.dart
+3
-2
@@ -7,6 +7,7 @@ import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
7
import 'package:cake_wallet/utils/show_bar.dart';
8
import 'package:cake_wallet/utils/show_pop_up.dart';
9
import 'package:cw_core/root_dir.dart';
10
+import 'package:cw_core/utils/print_verbose.dart';
11
import 'package:device_info_plus/device_info_plus.dart';
12
import 'package:flutter/foundation.dart';
13
import 'package:flutter/material.dart';
@@ -67,7 +68,7 @@ class ExceptionHandler {
68
final bool canSend = await FlutterMailer.canSendMail();
69
70
if (Platform.isIOS && !canSend) {
70
- debugPrint('Mail app is not available');
71
+ printV('Mail app is not available');
72
return;
73
}
74
@@ -99,7 +100,7 @@ class ExceptionHandler {
100
static Future<void> onError(FlutterErrorDetails errorDetails) async {
101
if (kDebugMode || kProfileMode) {
102
FlutterError.presentError(errorDetails);
102
- debugPrint(errorDetails.toString());
103
+ printV(errorDetails.toString());
104
return;
105
}
106
lib/view_model/anonpay_details_view_model.dart
+2
-1
@@ -11,6 +11,7 @@ import 'package:cake_wallet/store/settings_store.dart';
11
import 'package:cake_wallet/utils/date_formatter.dart';
12
import 'package:cake_wallet/utils/show_bar.dart';
13
import 'package:cw_core/crypto_currency.dart';
14
+import 'package:cw_core/utils/print_verbose.dart';
15
import 'package:flutter/material.dart';
16
import 'package:flutter/services.dart';
17
import 'package:mobx/mobx.dart';
@@ -47,7 +48,7 @@ abstract class AnonpayDetailsViewModelBase with Store {
48
invoiceDetail.status = data.status;
49
_updateItems();
50
} catch (e) {
50
- print(e.toString());
51
+ printV(e.toString());
52
}
53
}
54
lib/view_model/backup_view_model.dart
+2
-1
@@ -5,6 +5,7 @@ import 'package:cake_wallet/core/secure_storage.dart';
5
import 'package:cake_wallet/entities/secret_store_key.dart';
6
import 'package:cake_wallet/store/secret_store.dart';
7
import 'package:cw_core/root_dir.dart';
8
+import 'package:cw_core/utils/print_verbose.dart';
9
import 'package:flutter/foundation.dart';
10
import 'package:mobx/mobx.dart';
11
import 'package:intl/intl.dart';
@@ -67,7 +68,7 @@ abstract class BackupViewModelBase with Store {
68
69
return BackupExportFile(backupContent.toList(), name: fileName);
70
} catch (e) {
70
- print(e.toString());
71
+ printV(e.toString());
72
state = FailureState(e.toString());
73
return null;
74
}
lib/view_model/buy/buy_item.dart
+2
-1
@@ -2,6 +2,7 @@ import 'package:cake_wallet/buy/buy_amount.dart';
2
import 'package:cake_wallet/buy/buy_provider.dart';
3
import 'package:cake_wallet/entities/fiat_currency.dart';
4
import 'package:cake_wallet/view_model/buy/buy_amount_view_model.dart';
5
+import 'package:cw_core/utils/print_verbose.dart';
6
7
class BuyItem {
8
BuyItem({required this.provider, required this.buyAmountViewModel});
@@ -21,7 +22,7 @@ class BuyItem {
22
.calculateAmount(amount?.toString() ?? '', fiatCurrency.title);
23
} catch (e) {
24
_buyAmount = BuyAmount(sourceAmount: 0.0, destAmount: 0.0);
24
- print(e.toString());
25
+ printV(e.toString());
26
}
27
28
return _buyAmount;
lib/view_model/buy/buy_view_model.dart
+3
-2
@@ -3,6 +3,7 @@ import 'package:cake_wallet/buy/moonpay/moonpay_provider.dart';
3
import 'package:cake_wallet/buy/wyre/wyre_buy_provider.dart';
4
import 'package:cw_core/crypto_currency.dart';
5
import 'package:cake_wallet/entities/fiat_currency.dart';
6
+import 'package:cw_core/utils/print_verbose.dart';
7
import 'package:cw_core/wallet_type.dart';
8
import 'package:cake_wallet/store/settings_store.dart';
9
import 'package:cake_wallet/view_model/buy/buy_item.dart';
@@ -63,7 +64,7 @@ abstract class BuyViewModelBase with Store {
64
try {
65
_url = await selectedProvider!.requestUrl(doubleAmount.toString(), fiatCurrency.title);
66
} catch (e) {
66
- print(e.toString());
67
+ printV(e.toString());
68
}
69
70
return _url;
@@ -77,7 +78,7 @@ abstract class BuyViewModelBase with Store {
78
await ordersSource.add(order);
79
ordersStore.setOrder(order);
80
} catch (e) {
80
- print(e.toString());
81
+ printV(e.toString());
82
}
83
}
84
lib/view_model/dashboard/home_settings_view_model.dart
+8
-7
@@ -15,6 +15,7 @@ import 'package:cake_wallet/tron/tron.dart';
15
import 'package:cake_wallet/view_model/dashboard/balance_view_model.dart';
16
import 'package:cw_core/crypto_currency.dart';
17
import 'package:cw_core/erc20_token.dart';
18
+import 'package:cw_core/utils/print_verbose.dart';
19
import 'package:cw_core/wallet_type.dart';
20
import 'package:mobx/mobx.dart';
21
import 'package:http/http.dart' as http;
@@ -236,7 +237,7 @@ abstract class HomeSettingsViewModelBase with Store {
237
238
return false;
239
} catch (e) {
239
- print('Error while checking scam via moralis: ${e.toString()}');
240
+ printV('Error while checking scam via moralis: ${e.toString()}');
241
return true;
242
}
243
}
@@ -277,7 +278,7 @@ abstract class HomeSettingsViewModelBase with Store {
278
279
return false;
280
} catch (e) {
280
- print('Error while checking scam via explorers: ${e.toString()}');
281
+ printV('Error while checking scam via explorers: ${e.toString()}');
282
return true;
283
}
284
}
@@ -303,21 +304,21 @@ abstract class HomeSettingsViewModelBase with Store {
304
final decodedResponse = jsonDecode(response.body) as Map<String, dynamic>;
305
306
if (decodedResponse['status'] == '0') {
306
- print('${response.body}\n');
307
- print('${decodedResponse['result']}\n');
307
+ printV('${response.body}\n');
308
+ printV('${decodedResponse['result']}\n');
309
return true;
310
}
311
312
if (decodedResponse['status'] == '1' &&
313
decodedResponse['result'][0]['ABI'] == 'Contract source code not verified') {
313
- print('Call is valid but contract is not verified');
314
+ printV('Call is valid but contract is not verified');
315
return true; // Contract is not verified
316
} else {
316
- print('Call is valid and contract is verified');
317
+ printV('Call is valid and contract is verified');
318
return false; // Contract is verified
319
}
320
} catch (e) {
320
- print('Error while checking contract verification: ${e.toString()}');
321
+ printV('Error while checking contract verification: ${e.toString()}');
322
return true;
323
}
324
}
lib/view_model/exchange/exchange_trade_view_model.dart
+2
-1
@@ -16,6 +16,7 @@ import 'package:cake_wallet/src/screens/exchange_trade/exchange_trade_item.dart'
16
import 'package:cake_wallet/store/dashboard/trades_store.dart';
17
import 'package:cake_wallet/view_model/send/send_view_model.dart';
18
import 'package:cw_core/crypto_currency.dart';
19
+import 'package:cw_core/utils/print_verbose.dart';
20
import 'package:cw_core/wallet_base.dart';
21
import 'package:hive/hive.dart';
22
import 'package:mobx/mobx.dart';
@@ -139,7 +140,7 @@ abstract class ExchangeTradeViewModelBase with Store {
140
141
_updateItems();
142
} catch (e) {
142
- print(e.toString());
143
+ printV(e.toString());
144
}
145
}
146
lib/view_model/exchange/exchange_view_model.dart
+2
-1
@@ -9,6 +9,7 @@ import 'package:cake_wallet/exchange/provider/stealth_ex_exchange_provider.dart'
9
import 'package:cw_core/crypto_currency.dart';
10
import 'package:cw_core/sync_status.dart';
11
import 'package:cw_core/transaction_priority.dart';
12
+import 'package:cw_core/utils/print_verbose.dart';
13
import 'package:cw_core/wallet_type.dart';
14
import 'package:hive/hive.dart';
15
import 'package:http/http.dart' as http;
@@ -944,7 +945,7 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
945
946
return isContractAddress;
947
} catch (e) {
947
- print(e);
948
+ printV(e);
949
return false;
950
}
951
}
lib/view_model/hardware_wallet/ledger_view_model.dart
+2
-1
@@ -9,6 +9,7 @@ import 'package:cake_wallet/polygon/polygon.dart';
9
import 'package:cake_wallet/utils/device_info.dart';
10
import 'package:cake_wallet/wallet_type_utils.dart';
11
import 'package:cw_core/hardware/device_connection_type.dart';
12
+import 'package:cw_core/utils/print_verbose.dart';
13
import 'package:cw_core/wallet_base.dart';
14
import 'package:cw_core/wallet_type.dart';
15
@@ -95,7 +96,7 @@ abstract class LedgerViewModelBase with Store {
96
97
if (_connectionChangeListener == null) {
98
_connectionChangeListener = ledger.deviceStateChanges.listen((event) {
98
- print('Ledger Device State Changed: $event');
99
+ printV('Ledger Device State Changed: $event');
100
if (event == sdk.BleConnectionState.disconnected) {
101
_connection = null;
102
if (type == WalletType.monero) {
lib/view_model/order_details_view_model.dart
+2
-1
@@ -3,6 +3,7 @@ import 'package:cake_wallet/buy/buy_provider.dart';
3
import 'package:cake_wallet/buy/buy_provider_description.dart';
4
import 'package:cake_wallet/buy/order.dart';
5
import 'package:cake_wallet/utils/date_formatter.dart';
6
+import 'package:cw_core/utils/print_verbose.dart';
7
import 'package:mobx/mobx.dart';
8
import 'package:cake_wallet/generated/i18n.dart';
9
import 'package:cake_wallet/src/screens/transaction_details/standart_list_item.dart';
@@ -65,7 +66,7 @@ abstract class OrderDetailsViewModelBase with Store {
66
_updateItems();
67
}
68
} catch (e) {
68
- print(e.toString());
69
+ printV(e.toString());
70
}
71
}
72
lib/view_model/send/output.dart
+2
-1
@@ -11,6 +11,7 @@ import 'package:cake_wallet/src/screens/send/widgets/extract_address_from_parsed
11
import 'package:cake_wallet/tron/tron.dart';
12
import 'package:cake_wallet/wownero/wownero.dart';
13
import 'package:cw_core/crypto_currency.dart';
14
+import 'package:cw_core/utils/print_verbose.dart';
15
import 'package:flutter/material.dart';
16
import 'package:intl/intl.dart';
17
import 'package:mobx/mobx.dart';
@@ -180,7 +181,7 @@ abstract class OutputBase with Store {
181
return polygon!.formatterPolygonAmountToDouble(amount: BigInt.from(fee));
182
}
183
} catch (e) {
183
- print(e.toString());
184
+ printV(e.toString());
185
}
186
187
return 0;
lib/view_model/send/send_view_model.dart
+2
-1
@@ -27,6 +27,7 @@ import 'package:cw_core/transaction_priority.dart';
27
import 'package:cw_core/unspent_coin_type.dart';
28
import 'package:cake_wallet/view_model/send/output.dart';
29
import 'package:cake_wallet/view_model/send/send_template_view_model.dart';
30
+import 'package:cw_core/utils/print_verbose.dart';
31
import 'package:flutter/material.dart';
32
import 'package:hive/hive.dart';
33
import 'package:mobx/mobx.dart';
@@ -672,7 +673,7 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
673
lamportsNeeded != null ? ((lamportsNeeded + 5000) / lamportsPerSol) : 0.0;
674
return S.current.insufficient_lamports(solValueNeeded.toString());
675
} else {
675
- print("No match found.");
676
+ printV("No match found.");
677
return S.current.insufficient_lamport_for_tx;
678
}
679
}
lib/view_model/trade_details_view_model.dart
+2
-1
@@ -22,6 +22,7 @@ import 'package:cake_wallet/store/settings_store.dart';
22
import 'package:cake_wallet/utils/date_formatter.dart';
23
import 'package:cake_wallet/utils/show_bar.dart';
24
import 'package:collection/collection.dart';
25
+import 'package:cw_core/utils/print_verbose.dart';
26
import 'package:flutter/cupertino.dart';
27
import 'package:flutter/services.dart';
28
import 'package:hive/hive.dart';
@@ -134,7 +135,7 @@ abstract class TradeDetailsViewModelBase with Store {
135
136
_updateItems();
137
} catch (e) {
137
- print(e.toString());
138
+ printV(e.toString());
139
}
140
}
141
lib/view_model/transaction_details_view_model.dart
+3
-2
@@ -1,5 +1,6 @@
1
import 'package:cake_wallet/tron/tron.dart';
2
import 'package:cake_wallet/wownero/wownero.dart';
3
+import 'package:cw_core/utils/print_verbose.dart';
4
import 'package:cw_core/wallet_base.dart';
5
import 'package:cw_core/transaction_info.dart';
6
import 'package:cw_core/wallet_type.dart';
@@ -279,7 +280,7 @@ abstract class TransactionDetailsViewModelBase with Store {
280
));
281
}
282
} catch (e) {
282
- print(e.toString());
283
+ printV(e.toString());
284
}
285
}
286
@@ -769,7 +770,7 @@ abstract class TransactionDetailsViewModelBase with Store {
770
);
771
}
772
} catch (e) {
772
- print(e.toString());
773
+ printV(e.toString());
774
}
775
}
776
lib/view_model/unspent_coins/unspent_coins_list_view_model.dart
+3
-2
@@ -6,6 +6,7 @@ import 'package:cake_wallet/wownero/wownero.dart';
6
import 'package:cw_core/unspent_coin_type.dart';
7
import 'package:cw_core/unspent_coins_info.dart';
8
import 'package:cw_core/unspent_transaction_output.dart';
9
+import 'package:cw_core/utils/print_verbose.dart';
10
import 'package:cw_core/wallet_base.dart';
11
import 'package:cw_core/wallet_type.dart';
12
import 'package:flutter/cupertino.dart';
@@ -82,7 +83,7 @@ abstract class UnspentCoinsListViewModelBase with Store {
83
await existingInfo.save();
84
_updateUnspentCoinsInfo();
85
} catch (e) {
85
- print('Error saving coin info: $e');
86
+ printV('Error saving coin info: $e');
87
}
88
}
89
@@ -151,7 +152,7 @@ abstract class UnspentCoinsListViewModelBase with Store {
152
isSilentPayment: existingItem.isSilentPayment ?? false,
153
);
154
} catch (e, s) {
154
- print('Error: $e\nStack: $s');
155
+ printV('Error: $e\nStack: $s');
156
ExceptionHandler.onError(
157
FlutterErrorDetails(exception: e, stack: s),
158
);
lib/view_model/wallet_creation_vm.dart
+3
-2
@@ -12,6 +12,7 @@ import 'package:cake_wallet/view_model/restore/restore_mode.dart';
12
import 'package:cake_wallet/view_model/restore/restore_wallet.dart';
13
import 'package:cake_wallet/view_model/seed_settings_view_model.dart';
14
import 'package:cw_core/pathForWallet.dart';
15
+import 'package:cw_core/utils/print_verbose.dart';
16
import 'package:cw_core/wallet_base.dart';
17
import 'package:cw_core/wallet_credentials.dart';
18
import 'package:cw_core/wallet_info.dart';
@@ -116,8 +117,8 @@ abstract class WalletCreationVMBase with Store {
117
_appStore.authenticationStore.allowed();
118
state = ExecutedSuccessfullyState();
119
} catch (e, s) {
119
- print("error: $e");
120
- print("stack: $s");
120
+ printV("error: $e");
121
+ printV("stack: $s");
122
state = FailureState(e.toString());
123
}
124
}
lib/view_model/wallet_hardware_restore_view_model.dart
+2
-1
@@ -10,6 +10,7 @@ import 'package:cake_wallet/view_model/hardware_wallet/ledger_view_model.dart';
10
import 'package:cake_wallet/view_model/seed_settings_view_model.dart';
11
import 'package:cake_wallet/view_model/wallet_creation_vm.dart';
12
import 'package:cw_core/hardware/hardware_account_data.dart';
13
+import 'package:cw_core/utils/print_verbose.dart';
14
import 'package:cw_core/wallet_base.dart';
15
import 'package:cw_core/wallet_credentials.dart';
16
import 'package:cw_core/wallet_info.dart';
@@ -82,7 +83,7 @@ abstract class WalletHardwareRestoreViewModelBase extends WalletCreationVM with
83
// } on LedgerException catch (e) {
84
// error = ledgerViewModel.interpretErrorCode(e.errorCode.toRadixString(16));
85
} catch (e) {
85
- print(e);
86
+ printV(e);
87
error = S.current.ledger_connection_error;
88
}
89
tool/append_translation.dart
+5
-3
@@ -1,3 +1,5 @@
1
+import 'package:cw_core/utils/print_verbose.dart';
2
+
3
import 'utils/translation/arb_file_utils.dart';
4
import 'utils/translation/translation_constants.dart';
5
import 'utils/translation/translation_utils.dart';
@@ -14,7 +16,7 @@ void main(List<String> args) async {
16
final text = args[1];
17
final force = args.last == "--force";
18
17
- print('Appending "$name": "$text"');
19
+ printV('Appending "$name": "$text"');
20
21
// add translation to all languages:
22
for (var lang in langs) {
@@ -24,12 +26,12 @@ void main(List<String> args) async {
26
appendStringToArbFile(fileName, name, translation, force: force);
27
}
28
27
- print('Alphabetizing all files...');
29
+ printV('Alphabetizing all files...');
30
31
for (var lang in langs) {
32
final fileName = getArbFileName(lang);
33
alphabetizeArbFile(fileName);
34
}
35
34
- print('Done!');
36
+ printV('Done!');
37
}
\ No newline at end of file
tool/configure.dart
+4
@@ -95,6 +95,7 @@ import 'package:cw_core/wallet_credentials.dart';
95
import 'package:cw_core/wallet_info.dart';
96
import 'package:cw_core/wallet_service.dart';
97
import 'package:cw_core/wallet_type.dart';
98
+import 'package:cw_core/utils/print_verbose.dart';
99
import 'package:cw_core/get_height_by_date.dart';
100
import 'package:hive/hive.dart';
101
import 'package:ledger_flutter_plus/ledger_flutter_plus.dart' as ledger;
@@ -834,6 +835,7 @@ import 'package:cw_core/wallet_base.dart';
835
import 'package:cw_core/wallet_credentials.dart';
836
import 'package:cw_core/wallet_info.dart';
837
import 'package:cw_core/wallet_service.dart';
838
+import 'package:cw_core/utils/print_verbose.dart';
839
import 'package:hive/hive.dart';
840
import 'package:ledger_flutter_plus/ledger_flutter_plus.dart' as ledger;
841
import 'package:web3dart/web3dart.dart';
@@ -938,6 +940,7 @@ import 'package:cw_core/wallet_base.dart';
940
import 'package:cw_core/wallet_credentials.dart';
941
import 'package:cw_core/wallet_info.dart';
942
import 'package:cw_core/wallet_service.dart';
943
+import 'package:cw_core/utils/print_verbose.dart';
944
import 'package:hive/hive.dart';
945
import 'package:ledger_flutter_plus/ledger_flutter_plus.dart' as ledger;
946
import 'package:web3dart/web3dart.dart';
@@ -1100,6 +1103,7 @@ import 'package:cw_core/wallet_service.dart';
1103
import 'package:cw_core/output_info.dart';
1104
import 'package:cw_core/nano_account_info_response.dart';
1105
import 'package:cw_core/n2_node.dart';
1106
+import 'package:cw_core/utils/print_verbose.dart';
1107
import 'package:mobx/mobx.dart';
1108
import 'package:hive/hive.dart';
1109
import 'package:cake_wallet/view_model/send/output.dart';
tool/download_moneroc_prebuilds.dart
+6
-5
@@ -1,5 +1,6 @@
1
import 'dart:io';
2
3
+import 'package:cw_core/utils/print_verbose.dart';
4
import 'package:dio/dio.dart';
5
import 'package:archive/archive_io.dart';
6
@@ -29,7 +30,7 @@ Future<void> main() async {
30
final resp = await _dio.get("https://api.github.com/repos/mrcyjanek/monero_c/releases");
31
final data = resp.data[0];
32
final tagName = data['tag_name'];
32
- print("Downloading artifacts for: ${tagName}");
33
+ printV("Downloading artifacts for: ${tagName}");
34
final assets = data['assets'] as List<dynamic>;
35
for (var i = 0; i < assets.length; i++) {
36
for (var triplet in triplets) {
@@ -40,9 +41,9 @@ Future<void> main() async {
41
String localFilename = filename.replaceAll("${coin}_${triplet}_", "");
42
localFilename = "scripts/monero_c/release/${coin}/${triplet}_${localFilename}";
43
final url = asset["browser_download_url"] as String;
43
- print("- downloading $localFilename");
44
+ printV("- downloading $localFilename");
45
await _dio.download(url, localFilename);
45
- print(" extracting $localFilename");
46
+ printV(" extracting $localFilename");
47
final inputStream = InputFileStream(localFilename);
48
final archive = XZDecoder().decodeBuffer(inputStream);
49
final outputStream = OutputFileStream(localFilename.replaceAll(".xz", ""));
@@ -50,11 +51,11 @@ Future<void> main() async {
51
}
52
}
53
if (Platform.isMacOS) {
53
- print("Generating ios framework");
54
+ printV("Generating ios framework");
55
final result = Process.runSync("bash", [
56
"-c",
57
"cd scripts/ios && ./gen_framework.sh && cd ../.."
58
]);
58
- print((result.stdout+result.stderr).toString().trim());
59
+ printV((result.stdout+result.stderr).toString().trim());
60
}
61
}
\ No newline at end of file
tool/generate_localization.dart
+7
-5
@@ -1,5 +1,7 @@
1
import 'dart:io';
2
import 'dart:convert';
3
+import 'package:cw_core/utils/print_verbose.dart';
4
+
5
import 'localization/localization_constants.dart';
6
import 'utils/utils.dart';
7
@@ -35,7 +37,7 @@ Future<void> main(List<String> args) async {
37
38
extraInfo.forEach((key, dynamic value) async {
39
if (key != srcDir) {
38
- print('Wrong key: $key');
40
+ printV('Wrong key: $key');
41
return;
42
}
43
@@ -43,7 +45,7 @@ Future<void> main(List<String> args) async {
45
final dir = Directory(dirPath);
46
47
if (!await dir.exists()) {
46
- print('Wrong directory path: $dirPath');
48
+ printV('Wrong directory path: $dirPath');
49
return;
50
}
51
@@ -53,12 +55,12 @@ Future<void> main(List<String> args) async {
55
final shortLocale = element.path.split('_',)[1].split('.')[0];
56
localePath[shortLocale] = element.path;
57
} catch (e) {
56
- print('Wrong file: ${element.path}');
58
+ printV('Wrong file: ${element.path}');
59
}
60
});
61
62
if (!localePath.keys.contains(defaultLocale)) {
61
- print("Locale list doesn't contain $defaultLocale");
63
+ printV("Locale list doesn't contain $defaultLocale");
64
return;
65
}
66
@@ -115,7 +117,7 @@ Future<void> main(List<String> args) async {
117
118
await File(outputPath + localeListFileName).writeAsString(locales);
119
} catch (e) {
118
- print(e.toString());
120
+ printV(e.toString());
121
}
122
});
123
}
tool/translation_add_lang.dart
+3
-1
@@ -1,5 +1,7 @@
1
import 'dart:io';
2
3
+import 'package:cw_core/utils/print_verbose.dart';
4
+
5
import 'utils/translation/arb_file_utils.dart';
6
import 'utils/translation/translation_constants.dart';
7
import 'utils/translation/translation_utils.dart';
@@ -32,5 +34,5 @@ void main(List<String> args) async {
34
}
35
36
appendStringsToArbFile(targetFileName, translations);
35
- print("Success! Please add your Language Code to lib/entities/language_service.dart");
37
+ printV("Success! Please add your Language Code to lib/entities/language_service.dart");
38
}
tool/translation_consistence.dart
+6
-4
@@ -1,18 +1,20 @@
1
import 'dart:io';
2
3
+import 'package:cw_core/utils/print_verbose.dart';
4
+
5
import 'utils/translation/arb_file_utils.dart';
6
import 'utils/translation/translation_constants.dart';
7
import 'utils/translation/translation_utils.dart';
8
9
void main(List<String> args) async {
8
- print('Checking Consistency of all arb-files. Default: $defaultLang');
10
+ printV('Checking Consistency of all arb-files. Default: $defaultLang');
11
12
final doFix = args.contains("--fix");
13
14
if (doFix)
13
- print('Auto fixing enabled!\n');
15
+ printV('Auto fixing enabled!\n');
16
else
15
- print('Auto fixing disabled!\nRun with arg "--fix" to enable autofix\n');
17
+ printV('Auto fixing disabled!\nRun with arg "--fix" to enable autofix\n');
18
19
final fileName = getArbFileName(defaultLang);
20
final file = File(fileName);
@@ -25,7 +27,7 @@ void main(List<String> args) async {
27
final missingDefaults = <String, String>{};
28
29
missingKeys.forEach((key) {
28
- print('Missing in "$lang": "$key"');
30
+ printV('Missing in "$lang": "$key"');
31
if (doFix)
32
missingDefaults[key] = arbObj[key] as String;
33
});
tool/utils/translation/arb_file_utils.dart
+3
-1
@@ -1,12 +1,14 @@
1
import 'dart:convert';
2
import 'dart:io';
3
4
+import 'package:cw_core/utils/print_verbose.dart';
5
+
6
void appendStringToArbFile(String fileName, String name, String text, {bool force = false}) {
7
final file = File(fileName);
8
final arbObj = readArbFile(file);
9
10
if (arbObj.containsKey(name) && !force) {
9
- print("String $name already exists in $fileName!");
11
+ printV("String $name already exists in $fileName!");
12
return;
13
}
14