Merge branch 'main' into support/salvium

This commit is contained in:
0xskydb 2024-12-10 10:34:58 +10:00 committed by GitHub
commit a46c7dcc12
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
158 changed files with 665 additions and 358 deletions

View file

@ -62,6 +62,7 @@ jobs:
/opt/android/cake_wallet/cw_salvium/android/.cxx /opt/android/cake_wallet/cw_salvium/android/.cxx
/opt/android/cake_wallet/scripts/monero_c/release /opt/android/cake_wallet/scripts/monero_c/release
key: ${{ hashFiles('**/prepare_moneroc.sh' ,'**/build_monero_all.sh' ,'**/cache_dependencies.yml') }} key: ${{ hashFiles('**/prepare_moneroc.sh' ,'**/build_monero_all.sh' ,'**/cache_dependencies.yml') }}
- if: ${{ steps.cache-externals.outputs.cache-hit != 'true' }} - if: ${{ steps.cache-externals.outputs.cache-hit != 'true' }}
name: Generate Externals name: Generate Externals
run: | run: |
@ -69,12 +70,16 @@ jobs:
source ./app_env.sh cakewallet source ./app_env.sh cakewallet
./build_monero_all.sh ./build_monero_all.sh
- name: Set up cache path
id: cache-path
run: echo "cache-file-path=/opt/android/cake_wallet/android/app/key.jks" >> $GITHUB_ENV
- name: Cache Keystore - name: Cache Keystore
id: cache-keystore id: cache-keystore
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: /opt/android/cake_wallet/android/app/key.jks path: ${{ env.cache-file-path }}
key: $STORE_PASS key: keystore
- if: ${{ steps.cache-keystore.outputs.cache-hit != 'true' }} - if: ${{ steps.cache-keystore.outputs.cache-hit != 'true' }}
name: Generate KeyStore name: Generate KeyStore

21
.github/workflows/no_print_in_dart.yaml vendored Normal file
View file

@ -0,0 +1,21 @@
name: No print statements in dart files
on:
pull_request:
branches: [main]
jobs:
PR_test_build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Check for print() statements in dart code (use printV() instead)
if: github.event_name == 'pull_request'
run: |
GIT_GREP_OUT="$(git grep ' print(' | (grep .dart: || test $? = 1) | (grep -v print_verbose.dart || test $? = 1) || true)"
[[ "x$GIT_GREP_OUT" == "x" ]] && exit 0
echo "$GIT_GREP_OUT"
echo "There are .dart files which use print() statements"
echo "Please use printV from package: cw_core/utils/print_verbose.dart"
exit 1

View file

@ -115,15 +115,19 @@ jobs:
cd /opt/android/cake_wallet/scripts/android/ cd /opt/android/cake_wallet/scripts/android/
./build_mwebd.sh --dont-install ./build_mwebd.sh --dont-install
# - name: Cache Keystore - name: Set up cache path
# id: cache-keystore id: cache-path
# uses: actions/cache@v3 run: echo "cache-file-path=/opt/android/cake_wallet/android/app/key.jks" >> $GITHUB_ENV
# with:
# path: /opt/android/cake_wallet/android/app/key.jks - name: Cache Keystore
# key: $STORE_PASS id: cache-keystore
# uses: actions/cache@v3
# - if: ${{ steps.cache-keystore.outputs.cache-hit != 'true' }} with:
- name: Generate KeyStore path: ${{ env.cache-file-path }}
key: keystore
- if: ${{ steps.cache-keystore.outputs.cache-hit != 'true' }}
name: Generate KeyStore
run: | run: |
cd /opt/android/cake_wallet/android/app cd /opt/android/cake_wallet/android/app
keytool -genkey -v -keystore key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias testKey -noprompt -dname "CN=CakeWallet, OU=CakeWallet, O=CakeWallet, L=Florida, S=America, C=USA" -storepass $STORE_PASS -keypass $KEY_PASS keytool -genkey -v -keystore key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias testKey -noprompt -dname "CN=CakeWallet, OU=CakeWallet, O=CakeWallet, L=Florida, S=America, C=USA" -storepass $STORE_PASS -keypass $KEY_PASS

View file

@ -6,6 +6,7 @@ import 'package:cw_bitcoin/utils.dart';
import 'package:cw_core/hardware/hardware_account_data.dart'; import 'package:cw_core/hardware/hardware_account_data.dart';
import 'package:ledger_bitcoin/ledger_bitcoin.dart'; import 'package:ledger_bitcoin/ledger_bitcoin.dart';
import 'package:ledger_flutter_plus/ledger_flutter_plus.dart'; import 'package:ledger_flutter_plus/ledger_flutter_plus.dart';
import 'package:cw_core/utils/print_verbose.dart';
class BitcoinHardwareWalletService { class BitcoinHardwareWalletService {
BitcoinHardwareWalletService(this.ledgerConnection); BitcoinHardwareWalletService(this.ledgerConnection);

View file

@ -4,6 +4,7 @@ import 'dart:io';
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:bitcoin_base/bitcoin_base.dart'; import 'package:bitcoin_base/bitcoin_base.dart';
import 'package:cw_bitcoin/bitcoin_amount_format.dart'; import 'package:cw_bitcoin/bitcoin_amount_format.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:rxdart/rxdart.dart'; import 'package:rxdart/rxdart.dart';
@ -117,17 +118,17 @@ class ElectrumClient {
_parseResponse(message); _parseResponse(message);
} }
} catch (e) { } catch (e) {
print("socket.listen: $e"); printV("socket.listen: $e");
} }
}, },
onError: (Object error) { onError: (Object error) {
final errorMsg = error.toString(); final errorMsg = error.toString();
print(errorMsg); printV(errorMsg);
unterminatedString = ''; unterminatedString = '';
socket = null; socket = null;
}, },
onDone: () { onDone: () {
print("SOCKET CLOSED!!!!!"); printV("SOCKET CLOSED!!!!!");
unterminatedString = ''; unterminatedString = '';
try { try {
if (host == socket?.address.host || socket == null) { if (host == socket?.address.host || socket == null) {
@ -136,7 +137,7 @@ class ElectrumClient {
socket = null; socket = null;
} }
} catch (e) { } catch (e) {
print("onDone: $e"); printV("onDone: $e");
} }
}, },
cancelOnError: true, cancelOnError: true,
@ -181,7 +182,7 @@ class ElectrumClient {
unterminatedString = ''; unterminatedString = '';
} }
} catch (e) { } catch (e) {
print("parse $e"); printV("parse $e");
} }
} }
@ -403,7 +404,7 @@ class ElectrumClient {
} on RequestFailedTimeoutException catch (_) { } on RequestFailedTimeoutException catch (_) {
return null; return null;
} catch (e) { } catch (e) {
print("getCurrentBlockChainTip: ${e.toString()}"); printV("getCurrentBlockChainTip: ${e.toString()}");
return null; return null;
} }
} }
@ -434,7 +435,7 @@ class ElectrumClient {
return subscription; return subscription;
} catch (e) { } catch (e) {
print("subscribe $e"); printV("subscribe $e");
return null; return null;
} }
} }
@ -473,7 +474,7 @@ class ElectrumClient {
return completer.future; return completer.future;
} catch (e) { } catch (e) {
print("callWithTimeout $e"); printV("callWithTimeout $e");
rethrow; rethrow;
} }
} }

View file

@ -5,6 +5,7 @@ import 'package:cw_bitcoin/electrum_transaction_info.dart';
import 'package:cw_core/pathForWallet.dart'; import 'package:cw_core/pathForWallet.dart';
import 'package:cw_core/transaction_history.dart'; import 'package:cw_core/transaction_history.dart';
import 'package:cw_core/utils/file.dart'; import 'package:cw_core/utils/file.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_info.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
import 'package:cw_core/transaction_history.dart'; import 'package:cw_core/transaction_history.dart';
@ -51,7 +52,7 @@ abstract class ElectrumTransactionHistoryBase
final data = json.encode({'height': _height, 'transactions': txjson}); final data = json.encode({'height': _height, 'transactions': txjson});
await encryptionFileUtils.write(path: path, password: _password, data: data); await encryptionFileUtils.write(path: path, password: _password, data: data);
} catch (e) { } catch (e) {
print('Error while save bitcoin transaction history: ${e.toString()}'); printV('Error while save bitcoin transaction history: ${e.toString()}');
} }
} }
@ -88,7 +89,7 @@ abstract class ElectrumTransactionHistoryBase
_height = content['height'] as int; _height = content['height'] as int;
} catch (e) { } catch (e) {
print(e); printV(e);
} }
} }

View file

@ -4,6 +4,8 @@ import 'dart:io';
import 'dart:isolate'; import 'dart:isolate';
import 'package:bitcoin_base/bitcoin_base.dart'; import 'package:bitcoin_base/bitcoin_base.dart';
import 'package:cw_bitcoin/litecoin_wallet_addresses.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_bitcoin/bitcoin_wallet.dart'; import 'package:cw_bitcoin/bitcoin_wallet.dart';
import 'package:cw_bitcoin/litecoin_wallet.dart'; import 'package:cw_bitcoin/litecoin_wallet.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
@ -479,8 +481,8 @@ abstract class ElectrumWalletBase
syncStatus = SyncedSyncStatus(); syncStatus = SyncedSyncStatus();
} }
} catch (e, stacktrace) { } catch (e, stacktrace) {
print(stacktrace); printV(stacktrace);
print("startSync $e"); printV("startSync $e");
syncStatus = FailedSyncStatus(); syncStatus = FailedSyncStatus();
} }
} }
@ -506,7 +508,7 @@ abstract class ElectrumWalletBase
_feeRates = [slowFee, mediumFee, fastFee]; _feeRates = [slowFee, mediumFee, fastFee];
return; return;
} catch (e) { } catch (e) {
print(e); printV(e);
} }
} }
@ -588,8 +590,8 @@ abstract class ElectrumWalletBase
await electrumClient.connectToUri(node.uri, useSSL: node.useSSL); await electrumClient.connectToUri(node.uri, useSSL: node.useSSL);
} catch (e, stacktrace) { } catch (e, stacktrace) {
print(stacktrace); printV(stacktrace);
print("connectToNode $e"); printV("connectToNode $e");
syncStatus = FailedSyncStatus(); syncStatus = FailedSyncStatus();
} }
} }
@ -1492,7 +1494,7 @@ abstract class ElectrumWalletBase
await unspentCoinsInfo.deleteAll(keys); await unspentCoinsInfo.deleteAll(keys);
} }
} catch (e) { } catch (e) {
print("refreshUnspentCoinsInfo $e"); printV("refreshUnspentCoinsInfo $e");
} }
} }
@ -1935,7 +1937,7 @@ abstract class ElectrumWalletBase
return historiesWithDetails; return historiesWithDetails;
} catch (e) { } catch (e) {
print("fetchTransactions $e"); printV("fetchTransactions $e");
return {}; return {};
} }
} }
@ -2059,7 +2061,7 @@ abstract class ElectrumWalletBase
} }
Future<void> updateTransactions() async { Future<void> updateTransactions() async {
print("updateTransactions() called!"); printV("updateTransactions() called!");
try { try {
if (_isTransactionUpdating) { if (_isTransactionUpdating) {
return; return;
@ -2091,8 +2093,8 @@ abstract class ElectrumWalletBase
walletAddresses.updateReceiveAddresses(); walletAddresses.updateReceiveAddresses();
_isTransactionUpdating = false; _isTransactionUpdating = false;
} catch (e, stacktrace) { } catch (e, stacktrace) {
print(stacktrace); printV(stacktrace);
print(e); printV(e);
_isTransactionUpdating = false; _isTransactionUpdating = false;
} }
} }
@ -2110,13 +2112,13 @@ abstract class ElectrumWalletBase
try { try {
await _scripthashesUpdateSubject[sh]?.close(); await _scripthashesUpdateSubject[sh]?.close();
} catch (e) { } catch (e) {
print("failed to close: $e"); printV("failed to close: $e");
} }
} }
try { try {
_scripthashesUpdateSubject[sh] = await electrumClient.scripthashUpdate(sh); _scripthashesUpdateSubject[sh] = await electrumClient.scripthashUpdate(sh);
} catch (e) { } catch (e) {
print("failed scripthashUpdate: $e"); printV("failed scripthashUpdate: $e");
} }
_scripthashesUpdateSubject[sh]?.listen((event) async { _scripthashesUpdateSubject[sh]?.listen((event) async {
try { try {
@ -2126,7 +2128,7 @@ abstract class ElectrumWalletBase
await _fetchAddressHistory(address, await getCurrentChainTip()); await _fetchAddressHistory(address, await getCurrentChainTip());
} catch (e, s) { } catch (e, s) {
print("sub error: $e"); printV("sub error: $e");
_onError?.call(FlutterErrorDetails( _onError?.call(FlutterErrorDetails(
exception: e, exception: e,
stack: s, stack: s,
@ -2134,7 +2136,7 @@ abstract class ElectrumWalletBase
)); ));
} }
}, onError: (e, s) { }, onError: (e, s) {
print("sub_listen error: $e $s"); printV("sub_listen error: $e $s");
}); });
})); }));
} }
@ -2186,7 +2188,7 @@ abstract class ElectrumWalletBase
if (balances.isNotEmpty && balances.first['confirmed'] == null) { if (balances.isNotEmpty && balances.first['confirmed'] == null) {
// if we got null balance responses from the server, set our connection status to lost and return our last known balance: // if we got null balance responses from the server, set our connection status to lost and return our last known balance:
print("got null balance responses from the server, setting connection status to lost"); printV("got null balance responses from the server, setting connection status to lost");
syncStatus = LostConnectionSyncStatus(); syncStatus = LostConnectionSyncStatus();
return balance[currency] ?? ElectrumBalance(confirmed: 0, unconfirmed: 0, frozen: 0); return balance[currency] ?? ElectrumBalance(confirmed: 0, unconfirmed: 0, frozen: 0);
} }
@ -2213,7 +2215,7 @@ abstract class ElectrumWalletBase
} }
Future<void> updateBalance() async { Future<void> updateBalance() async {
print("updateBalance() called!"); printV("updateBalance() called!");
balance[currency] = await fetchBalances(); balance[currency] = await fetchBalances();
await save(); await save();
} }
@ -2353,7 +2355,7 @@ abstract class ElectrumWalletBase
} }
void _syncStatusReaction(SyncStatus syncStatus) async { void _syncStatusReaction(SyncStatus syncStatus) async {
print("SYNC_STATUS_CHANGE: ${syncStatus}"); printV("SYNC_STATUS_CHANGE: ${syncStatus}");
if (syncStatus is SyncingSyncStatus) { if (syncStatus is SyncingSyncStatus) {
return; return;
} }

View file

@ -3,6 +3,8 @@ import 'dart:io' show Platform;
import 'package:bitcoin_base/bitcoin_base.dart'; import 'package:bitcoin_base/bitcoin_base.dart';
import 'package:blockchain_utils/blockchain_utils.dart'; import 'package:blockchain_utils/blockchain_utils.dart';
import 'package:cw_bitcoin/bitcoin_address_record.dart'; import 'package:cw_bitcoin/bitcoin_address_record.dart';
import 'package:cw_bitcoin/electrum_wallet.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_bitcoin/bitcoin_unspent.dart'; import 'package:cw_bitcoin/bitcoin_unspent.dart';
import 'package:cw_core/wallet_addresses.dart'; import 'package:cw_core/wallet_addresses.dart';
import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_info.dart';
@ -193,7 +195,7 @@ abstract class ElectrumWalletAddressesBase extends WalletAddresses with Store {
receiveAddresses.remove(addressRecord); receiveAddresses.remove(addressRecord);
receiveAddresses.insert(0, addressRecord); receiveAddresses.insert(0, addressRecord);
} catch (e) { } catch (e) {
print("ElectrumWalletAddressBase: set address ($addr): $e"); printV("ElectrumWalletAddressBase: set address ($addr): $e");
} }
} }
@ -483,7 +485,7 @@ abstract class ElectrumWalletAddressesBase extends WalletAddresses with Store {
await saveAddressesInBox(); await saveAddressesInBox();
} catch (e) { } catch (e) {
print("updateAddresses $e"); printV("updateAddresses $e");
} }
} }

View file

@ -9,6 +9,7 @@ import 'package:crypto/crypto.dart';
import 'package:cw_bitcoin/bitcoin_transaction_credentials.dart'; import 'package:cw_bitcoin/bitcoin_transaction_credentials.dart';
import 'package:cw_core/cake_hive.dart'; import 'package:cw_core/cake_hive.dart';
import 'package:cw_core/mweb_utxo.dart'; import 'package:cw_core/mweb_utxo.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/node.dart'; import 'package:cw_core/node.dart';
import 'package:cw_mweb/mwebd.pbgrpc.dart'; import 'package:cw_mweb/mwebd.pbgrpc.dart';
import 'package:fixnum/fixnum.dart'; import 'package:fixnum/fixnum.dart';
@ -283,7 +284,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
} }
Future<void> waitForMwebAddresses() async { Future<void> waitForMwebAddresses() async {
print("waitForMwebAddresses() called!"); printV("waitForMwebAddresses() called!");
// ensure that we have the full 1000 mweb addresses generated before continuing: // ensure that we have the full 1000 mweb addresses generated before continuing:
// should no longer be needed, but leaving here just in case // should no longer be needed, but leaving here just in case
await (walletAddresses as LitecoinWalletAddresses).ensureMwebAddressUpToIndexExists(1020); await (walletAddresses as LitecoinWalletAddresses).ensureMwebAddressUpToIndexExists(1020);
@ -302,8 +303,8 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
@action @action
@override @override
Future<void> startSync() async { Future<void> startSync() async {
print("startSync() called!"); printV("startSync() called!");
print("STARTING SYNC - MWEB ENABLED: $mwebEnabled"); printV("STARTING SYNC - MWEB ENABLED: $mwebEnabled");
if (!mwebEnabled) { if (!mwebEnabled) {
try { try {
// in case we're switching from a litecoin wallet that had mweb enabled // in case we're switching from a litecoin wallet that had mweb enabled
@ -317,33 +318,33 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
return; return;
} }
print("STARTING SYNC - MWEB ENABLED: $mwebEnabled"); printV("STARTING SYNC - MWEB ENABLED: $mwebEnabled");
_syncTimer?.cancel(); _syncTimer?.cancel();
try { try {
mwebSyncStatus = SyncronizingSyncStatus(); mwebSyncStatus = SyncronizingSyncStatus();
try { try {
await subscribeForUpdates(); await subscribeForUpdates();
} catch (e) { } catch (e) {
print("failed to subcribe for updates: $e"); printV("failed to subcribe for updates: $e");
} }
updateFeeRates(); updateFeeRates();
_feeRatesTimer?.cancel(); _feeRatesTimer?.cancel();
_feeRatesTimer = _feeRatesTimer =
Timer.periodic(const Duration(minutes: 1), (timer) async => await updateFeeRates()); Timer.periodic(const Duration(minutes: 1), (timer) async => await updateFeeRates());
print("START SYNC FUNCS"); printV("START SYNC FUNCS");
await waitForMwebAddresses(); await waitForMwebAddresses();
await processMwebUtxos(); await processMwebUtxos();
await updateTransactions(); await updateTransactions();
await updateUnspent(); await updateUnspent();
await updateBalance(); await updateBalance();
print("DONE SYNC FUNCS"); } catch (e) {
} catch (e, s) { printV("failed to start mweb sync: $e");
print("mweb sync failed: $e $s"); syncStatus = FailedSyncStatus();
mwebSyncStatus = FailedSyncStatus(error: "mweb sync failed: $e");
return; return;
} }
_syncTimer?.cancel();
_syncTimer = Timer.periodic(const Duration(milliseconds: 3000), (timer) async { _syncTimer = Timer.periodic(const Duration(milliseconds: 3000), (timer) async {
if (mwebSyncStatus is FailedSyncStatus) { if (mwebSyncStatus is FailedSyncStatus) {
_syncTimer?.cancel(); _syncTimer?.cancel();
@ -401,7 +402,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
for (var coin in tx.unspents!) { for (var coin in tx.unspents!) {
final utxo = mwebUtxosBox.get(coin.address); final utxo = mwebUtxosBox.get(coin.address);
if (utxo != null) { if (utxo != null) {
print("deleting utxo ${coin.address} @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); printV("deleting utxo ${coin.address} @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
await mwebUtxosBox.delete(coin.address); await mwebUtxosBox.delete(coin.address);
} }
} }
@ -428,7 +429,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
return; return;
} }
} catch (e) { } catch (e) {
print("error syncing: $e"); printV("error syncing: $e");
mwebSyncStatus = FailedSyncStatus(error: e.toString()); mwebSyncStatus = FailedSyncStatus(error: e.toString());
} }
}); });
@ -437,12 +438,12 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
@action @action
@override @override
Future<void> stopSync() async { Future<void> stopSync() async {
print("stopSync() called!"); printV("stopSync() called!");
_syncTimer?.cancel(); _syncTimer?.cancel();
_utxoStream?.cancel(); _utxoStream?.cancel();
_feeRatesTimer?.cancel(); _feeRatesTimer?.cancel();
await CwMweb.stop(); await CwMweb.stop();
print("stopped syncing!"); printV("stopped syncing!");
} }
Future<void> initMwebUtxosBox() async { Future<void> initMwebUtxosBox() async {
@ -514,7 +515,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
} }
Future<void> handleIncoming(MwebUtxo utxo) async { Future<void> handleIncoming(MwebUtxo utxo) async {
print("handleIncoming() called!"); printV("handleIncoming() called!");
final status = await CwMweb.status(StatusRequest()); final status = await CwMweb.status(StatusRequest());
var date = DateTime.now(); var date = DateTime.now();
var confirmations = 0; var confirmations = 0;
@ -559,7 +560,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
final addressRecord = walletAddresses.allAddresses final addressRecord = walletAddresses.allAddresses
.firstWhereOrNull((addressRecord) => addressRecord.address == utxo.address); .firstWhereOrNull((addressRecord) => addressRecord.address == utxo.address);
if (addressRecord == null) { if (addressRecord == null) {
print("we don't have this address in the wallet! ${utxo.address}"); printV("we don't have this address in the wallet! ${utxo.address}");
return; return;
} }
@ -580,13 +581,13 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
} }
Future<void> processMwebUtxos() async { Future<void> processMwebUtxos() async {
print("processMwebUtxos() called!"); printV("processMwebUtxos() called!");
if (!mwebEnabled) { if (!mwebEnabled) {
return; return;
} }
int restoreHeight = walletInfo.restoreHeight; int restoreHeight = walletInfo.restoreHeight;
print("SCANNING FROM HEIGHT: $restoreHeight"); printV("SCANNING FROM HEIGHT: $restoreHeight");
final req = UtxosRequest(scanSecret: scanSecret, fromHeight: restoreHeight); final req = UtxosRequest(scanSecret: scanSecret, fromHeight: restoreHeight);
// process new utxos as they come in: // process new utxos as they come in:
@ -621,7 +622,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
// but do update the utxo height if it's somehow different: // but do update the utxo height if it's somehow different:
final existingUtxo = mwebUtxosBox.get(utxo.outputId); final existingUtxo = mwebUtxosBox.get(utxo.outputId);
if (existingUtxo!.height != utxo.height) { if (existingUtxo!.height != utxo.height) {
print( printV(
"updating utxo height for $utxo.outputId: ${existingUtxo.height} -> ${utxo.height}"); "updating utxo height for $utxo.outputId: ${existingUtxo.height} -> ${utxo.height}");
existingUtxo.height = utxo.height; existingUtxo.height = utxo.height;
await mwebUtxosBox.put(utxo.outputId, existingUtxo); await mwebUtxosBox.put(utxo.outputId, existingUtxo);
@ -644,7 +645,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
await handleIncoming(utxo); await handleIncoming(utxo);
}, },
onError: (error) { onError: (error) {
print("error in utxo stream: $error"); printV("error in utxo stream: $error");
mwebSyncStatus = FailedSyncStatus(error: error.toString()); mwebSyncStatus = FailedSyncStatus(error: error.toString());
}, },
cancelOnError: true, cancelOnError: true,
@ -652,7 +653,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
} }
Future<void> deleteSpentUtxos() async { Future<void> deleteSpentUtxos() async {
print("deleteSpentUtxos() called!"); printV("deleteSpentUtxos() called!");
final chainHeight = await electrumClient.getCurrentBlockChainTip(); final chainHeight = await electrumClient.getCurrentBlockChainTip();
final status = await CwMweb.status(StatusRequest()); final status = await CwMweb.status(StatusRequest());
if (chainHeight == null || status.blockHeaderHeight != chainHeight) return; if (chainHeight == null || status.blockHeaderHeight != chainHeight) return;
@ -676,7 +677,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
} }
Future<void> checkMwebUtxosSpent() async { Future<void> checkMwebUtxosSpent() async {
print("checkMwebUtxosSpent() called!"); printV("checkMwebUtxosSpent() called!");
if (!mwebEnabled) { if (!mwebEnabled) {
return; return;
} }
@ -791,7 +792,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
} }
Future<void> updateUnspent() async { Future<void> updateUnspent() async {
print("updateUnspent() called!"); printV("updateUnspent() called!");
await checkMwebUtxosSpent(); await checkMwebUtxosSpent();
await updateAllUnspents(); await updateAllUnspents();
} }
@ -822,7 +823,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
.firstWhereOrNull((addressRecord) => addressRecord.address == utxo.address); .firstWhereOrNull((addressRecord) => addressRecord.address == utxo.address);
if (addressRecord == null) { if (addressRecord == null) {
print("utxo contains an address that is not in the wallet: ${utxo.address}"); printV("utxo contains an address that is not in the wallet: ${utxo.address}");
return; return;
} }
final unspent = BitcoinUnspent( final unspent = BitcoinUnspent(
@ -863,7 +864,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
mwebUtxosBox.values.forEach((utxo) { mwebUtxosBox.values.forEach((utxo) {
bool isConfirmed = utxo.height > 0; bool isConfirmed = utxo.height > 0;
print( printV(
"utxo: ${isConfirmed ? "confirmed" : "unconfirmed"} ${utxo.spent ? "spent" : "unspent"} ${utxo.outputId} ${utxo.height} ${utxo.value}"); "utxo: ${isConfirmed ? "confirmed" : "unconfirmed"} ${utxo.spent ? "spent" : "unspent"} ${utxo.outputId} ${utxo.height} ${utxo.value}");
if (isConfirmed) { if (isConfirmed) {
@ -1001,7 +1002,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
final sum1 = _sumOutputAmounts(outputs.map((e) => e.toOutput).toList()) + fee; final sum1 = _sumOutputAmounts(outputs.map((e) => e.toOutput).toList()) + fee;
final sum2 = utxos.sumOfUtxosValue(); final sum2 = utxos.sumOfUtxosValue();
if (sum1 != sum2) { if (sum1 != sum2) {
print("@@@@@ WE HAD TO ADJUST THE FEE! @@@@@@@@"); printV("@@@@@ WE HAD TO ADJUST THE FEE! @@@@@@@@");
final diff = sum2 - sum1; final diff = sum2 - sum1;
// add the difference to the fee (abs value): // add the difference to the fee (abs value):
fee += diff.abs(); fee += diff.abs();
@ -1166,7 +1167,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
addressRecord.balance -= utxo.value.toInt(); addressRecord.balance -= utxo.value.toInt();
}); });
transaction.inputAddresses?.addAll(addresses); transaction.inputAddresses?.addAll(addresses);
print("isPegIn: $isPegIn, isPegOut: $isPegOut"); printV("isPegIn: $isPegIn, isPegOut: $isPegOut");
transaction.additionalInfo["isPegIn"] = isPegIn; transaction.additionalInfo["isPegIn"] = isPegIn;
transaction.additionalInfo["isPegOut"] = isPegOut; transaction.additionalInfo["isPegOut"] = isPegOut;
transactionHistory.addOne(transaction); transactionHistory.addOne(transaction);
@ -1174,10 +1175,10 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
await updateBalance(); await updateBalance();
}); });
} catch (e, s) { } catch (e, s) {
print(e); printV(e);
print(s); printV(s);
if (e.toString().contains("commit failed")) { if (e.toString().contains("commit failed")) {
print(e); printV(e);
throw Exception("Transaction commit failed (no peers responded), please try again."); throw Exception("Transaction commit failed (no peers responded), please try again.");
} }
rethrow; rethrow;

View file

@ -9,6 +9,7 @@ import 'package:cw_bitcoin/bitcoin_unspent.dart';
import 'package:cw_bitcoin/electrum_wallet.dart'; import 'package:cw_bitcoin/electrum_wallet.dart';
import 'package:cw_bitcoin/utils.dart'; import 'package:cw_bitcoin/utils.dart';
import 'package:cw_bitcoin/electrum_wallet_addresses.dart'; import 'package:cw_bitcoin/electrum_wallet_addresses.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_info.dart';
import 'package:cw_mweb/cw_mweb.dart'; import 'package:cw_mweb/cw_mweb.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
@ -35,7 +36,7 @@ abstract class LitecoinWalletAddressesBase extends ElectrumWalletAddresses with
for (int i = 0; i < mwebAddresses.length; i++) { for (int i = 0; i < mwebAddresses.length; i++) {
mwebAddrs.add(mwebAddresses[i].address); mwebAddrs.add(mwebAddresses[i].address);
} }
print("initialized with ${mwebAddrs.length} mweb addresses"); printV("initialized with ${mwebAddrs.length} mweb addresses");
} }
final Bip32Slip10Secp256k1? mwebHd; final Bip32Slip10Secp256k1? mwebHd;
@ -73,25 +74,25 @@ abstract class LitecoinWalletAddressesBase extends ElectrumWalletAddresses with
} }
while (generating) { while (generating) {
print("generating....."); printV("generating.....");
// this function was called multiple times in multiple places: // this function was called multiple times in multiple places:
await Future.delayed(const Duration(milliseconds: 100)); await Future.delayed(const Duration(milliseconds: 100));
} }
print("Generating MWEB addresses up to index $index"); printV("Generating MWEB addresses up to index $index");
generating = true; generating = true;
try { try {
while (mwebAddrs.length <= (index + 1)) { while (mwebAddrs.length <= (index + 1)) {
final addresses = final addresses =
await CwMweb.addresses(scan, spend, mwebAddrs.length, mwebAddrs.length + 50); await CwMweb.addresses(scan, spend, mwebAddrs.length, mwebAddrs.length + 50);
print("generated up to index ${mwebAddrs.length}"); printV("generated up to index ${mwebAddrs.length}");
// sleep for a bit to avoid making the main thread unresponsive: // sleep for a bit to avoid making the main thread unresponsive:
await Future.delayed(Duration(milliseconds: 200)); await Future.delayed(Duration(milliseconds: 200));
mwebAddrs.addAll(addresses!); mwebAddrs.addAll(addresses!);
} }
} catch (_) {} } catch (_) {}
generating = false; generating = false;
print("Done generating MWEB addresses len: ${mwebAddrs.length}"); printV("Done generating MWEB addresses len: ${mwebAddrs.length}");
// ensure mweb addresses are up to date: // ensure mweb addresses are up to date:
// This is the Case if the Litecoin Wallet is a hardware Wallet // This is the Case if the Litecoin Wallet is a hardware Wallet
@ -109,7 +110,7 @@ abstract class LitecoinWalletAddressesBase extends ElectrumWalletAddresses with
)) ))
.toList(); .toList();
addMwebAddresses(addressRecords); addMwebAddresses(addressRecords);
print("set ${addressRecords.length} mweb addresses"); printV("set ${addressRecords.length} mweb addresses");
} }
} }

View file

@ -2,6 +2,7 @@ import 'dart:typed_data';
import 'package:bitcoin_base/bitcoin_base.dart'; import 'package:bitcoin_base/bitcoin_base.dart';
import 'package:convert/convert.dart'; import 'package:convert/convert.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:ledger_bitcoin/psbt.dart'; import 'package:ledger_bitcoin/psbt.dart';
class PSBTTransactionBuild { class PSBTTransactionBuild {
@ -16,6 +17,10 @@ class PSBTTransactionBuild {
for (var i = 0; i < inputs.length; i++) { for (var i = 0; i < inputs.length; i++) {
final input = inputs[i]; final input = inputs[i];
printV(input.utxo.isP2tr());
printV(input.utxo.isSegwit());
printV(input.utxo.isP2shSegwit());
psbt.setInputPreviousTxId(i, Uint8List.fromList(hex.decode(input.utxo.txHash).reversed.toList())); psbt.setInputPreviousTxId(i, Uint8List.fromList(hex.decode(input.utxo.txHash).reversed.toList()));
psbt.setInputOutputIndex(i, input.utxo.vout); psbt.setInputOutputIndex(i, input.utxo.vout);
psbt.setInputSequence(i, enableRBF ? 0x1 : 0xffffffff); psbt.setInputSequence(i, enableRBF ? 0x1 : 0xffffffff);

View file

@ -1,3 +1,4 @@
import 'package:cw_core/utils/print_verbose.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
const MethodChannel _channel = MethodChannel('com.cake_wallet/native_utils'); const MethodChannel _channel = MethodChannel('com.cake_wallet/native_utils');
@ -6,17 +7,17 @@ Future<void> requestDisableBatteryOptimization() async {
try { try {
await _channel.invokeMethod('disableBatteryOptimization'); await _channel.invokeMethod('disableBatteryOptimization');
} on PlatformException catch (e) { } on PlatformException catch (e) {
print("Failed to disable battery optimization: '${e.message}'."); printV("Failed to disable battery optimization: '${e.message}'.");
} }
} }
Future<bool> isBatteryOptimizationDisabled() async { Future<bool> isBatteryOptimizationDisabled() async {
try { try {
final bool isDisabled = await _channel.invokeMethod('isBatteryOptimizationDisabled') as bool; final bool isDisabled = await _channel.invokeMethod('isBatteryOptimizationDisabled') as bool;
print('It\'s actually disabled? $isDisabled'); printV('It\'s actually disabled? $isDisabled');
return isDisabled; return isDisabled;
} on PlatformException catch (e) { } on PlatformException catch (e) {
print("Failed to check battery optimization status: '${e.message}'."); printV("Failed to check battery optimization status: '${e.message}'.");
return false; return false;
} }
} }

View file

@ -1,3 +1,4 @@
import 'package:cw_core/utils/print_verbose.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'dart:convert'; import 'dart:convert';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
@ -152,7 +153,7 @@ int getMoneroHeigthByDate({required DateTime date}) {
height = startHeight + daysHeight - heightPerDay; height = startHeight + daysHeight - heightPerDay;
} }
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
} }
return height; return height;

View file

@ -0,0 +1,84 @@
void printV(dynamic content) {
CustomTrace programInfo = CustomTrace(StackTrace.current);
print("${programInfo.fileName}#${programInfo.lineNumber}:${programInfo.columnNumber} ${programInfo.callerFunctionName}: $content");
}
// https://stackoverflow.com/a/59386101
class CustomTrace {
final StackTrace _trace;
String? fileName;
String? functionName;
String? callerFunctionName;
int? lineNumber;
int? columnNumber;
CustomTrace(this._trace) {
try {
_parseTrace();
} catch (e) {
print("Unable to parse trace (printV): $e");
}
}
String _getFunctionNameFromFrame(String frame) {
/* Just giving another nickname to the frame */
var currentTrace = frame;
/* To get rid off the #number thing, get the index of the first whitespace */
var indexOfWhiteSpace = currentTrace.indexOf(' ');
/* Create a substring from the first whitespace index till the end of the string */
var subStr = currentTrace.substring(indexOfWhiteSpace);
/* Grab the function name using reg expr */
var indexOfFunction = subStr.indexOf(RegExp(r'[A-Za-z0-9_]'));
/* Create a new substring from the function name index till the end of string */
subStr = subStr.substring(indexOfFunction);
indexOfWhiteSpace = subStr.indexOf(RegExp(r'[ .]'));
/* Create a new substring from start to the first index of a whitespace. This substring gives us the function name */
subStr = subStr.substring(0, indexOfWhiteSpace);
return subStr;
}
void _parseTrace() {
/* 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 */
var frames = this._trace.toString().split("\n");
/* The first frame is the current function */
this.functionName = _getFunctionNameFromFrame(frames[0]);
/* The second frame is the caller function */
this.callerFunctionName = _getFunctionNameFromFrame(frames[1]);
/* The first frame has all the information we need */
var traceString = frames[1];
/* Search through the string and find the index of the file name by looking for the '.dart' regex */
var indexOfFileName = traceString.indexOf(RegExp(r'[/A-Za-z_]+.dart'), 1); // 1 to offest and not print the printV function name
var fileInfo = traceString.substring(indexOfFileName);
var listOfInfos = fileInfo.split(":");
/* Splitting fileInfo by the character ":" separates the file name, the line number and the column counter nicely.
Example: main.dart:5:12
To get the file name, we split with ":" and get the first index
To get the line number, we would have to get the second index
To get the column number, we would have to get the third index
*/
try {
this.fileName = listOfInfos[0];
this.lineNumber = int.tryParse(listOfInfos[1]);
var columnStr = listOfInfos[2];
columnStr = columnStr.replaceFirst(")", "");
this.columnNumber = int.tryParse(columnStr);
} catch (e) {
}
}
}

View file

@ -1,4 +1,5 @@
import 'package:cw_core/address_info.dart'; import 'package:cw_core/address_info.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_info.dart';
import 'package:cw_core/wallet_type.dart'; import 'package:cw_core/wallet_type.dart';
@ -71,7 +72,7 @@ abstract class WalletAddresses {
await walletInfo.save(); await walletInfo.save();
} }
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
} }
} }

View file

@ -1,5 +1,6 @@
import 'dart:io'; import 'dart:io';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
const MethodChannel _channel = MethodChannel('com.cake_wallet/native_utils'); const MethodChannel _channel = MethodChannel('com.cake_wallet/native_utils');
@ -14,9 +15,9 @@ Future<void> setDefaultMinimumWindowSize() async {
) as bool; ) as bool;
if (!result) { if (!result) {
print("Failed to set minimum window size."); printV("Failed to set minimum window size.");
} }
} on PlatformException catch (e) { } on PlatformException catch (e) {
print("Failed to set minimum window size: '${e.message}'."); printV("Failed to set minimum window size: '${e.message}'.");
} }
} }

View file

@ -14,6 +14,7 @@ import 'package:cw_core/pathForWallet.dart';
import 'package:cw_core/pending_transaction.dart'; import 'package:cw_core/pending_transaction.dart';
import 'package:cw_core/sync_status.dart'; import 'package:cw_core/sync_status.dart';
import 'package:cw_core/transaction_priority.dart'; import 'package:cw_core/transaction_priority.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_addresses.dart'; import 'package:cw_core/wallet_addresses.dart';
import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_info.dart';
@ -200,7 +201,7 @@ abstract class EVMChainWalletBase
} else { } else {
// MaxFeePerGas with gasPrice; // MaxFeePerGas with gasPrice;
maxFeePerGas = gasPrice; maxFeePerGas = gasPrice;
debugPrint('MaxFeePerGas with gasPrice: $maxFeePerGas'); printV('MaxFeePerGas with gasPrice: $maxFeePerGas');
} }
final totalGasFee = estimatedGasUnits * maxFeePerGas; final totalGasFee = estimatedGasUnits * maxFeePerGas;

View file

@ -3,6 +3,7 @@ import 'dart:typed_data';
import 'package:cw_core/hardware/device_not_connected_exception.dart' import 'package:cw_core/hardware/device_not_connected_exception.dart'
as exception; as exception;
import 'package:cw_core/utils/print_verbose.dart';
import 'package:ledger_ethereum/ledger_ethereum.dart'; import 'package:ledger_ethereum/ledger_ethereum.dart';
import 'package:ledger_flutter_plus/ledger_flutter_plus.dart'; import 'package:ledger_flutter_plus/ledger_flutter_plus.dart';
import 'package:web3dart/crypto.dart'; import 'package:web3dart/crypto.dart';
@ -96,7 +97,7 @@ class EvmLedgerCredentials extends CredentialsWithKnownAddress {
await ethereumLedgerApp!.getAndProvideERC20TokenInformation( await ethereumLedgerApp!.getAndProvideERC20TokenInformation(
erc20ContractAddress: erc20ContractAddress, chainId: chainId); erc20ContractAddress: erc20ContractAddress, chainId: chainId);
} catch (e) { } catch (e) {
print(e); printV(e);
rethrow; rethrow;
// if (e.errorCode != -28672) rethrow; // if (e.errorCode != -28672) rethrow;
} }

View file

@ -1,3 +1,4 @@
import 'package:cw_core/utils/print_verbose.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
import 'package:cw_core/account.dart'; import 'package:cw_core/account.dart';
import 'package:cw_core/account_list.dart'; import 'package:cw_core/account_list.dart';
@ -77,7 +78,7 @@ abstract class HavenAccountListBase extends AccountList<Account> with Store {
_isRefreshing = false; _isRefreshing = false;
} catch (e) { } catch (e) {
_isRefreshing = false; _isRefreshing = false;
print(e); printV(e);
rethrow; rethrow;
} }
} }

View file

@ -1,3 +1,4 @@
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_haven/api/structs/subaddress_row.dart'; import 'package:cw_haven/api/structs/subaddress_row.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
@ -79,7 +80,7 @@ abstract class HavenSubaddressListBase with Store {
_isRefreshing = false; _isRefreshing = false;
} on PlatformException catch (e) { } on PlatformException catch (e) {
_isRefreshing = false; _isRefreshing = false;
print(e); printV(e);
rethrow; rethrow;
} }
} }

View file

@ -3,6 +3,7 @@ import 'dart:io';
import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/pathForWallet.dart'; import 'package:cw_core/pathForWallet.dart';
import 'package:cw_core/transaction_priority.dart'; import 'package:cw_core/transaction_priority.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_haven/haven_transaction_creation_credentials.dart'; import 'package:cw_haven/haven_transaction_creation_credentials.dart';
import 'package:cw_core/monero_amount_format.dart'; import 'package:cw_core/monero_amount_format.dart';
import 'package:cw_haven/haven_transaction_creation_exception.dart'; import 'package:cw_haven/haven_transaction_creation_exception.dart';
@ -130,7 +131,7 @@ abstract class HavenWalletBase
syncStatus = ConnectedSyncStatus(); syncStatus = ConnectedSyncStatus();
} catch (e) { } catch (e) {
syncStatus = FailedSyncStatus(); syncStatus = FailedSyncStatus();
print(e); printV(e);
} }
} }
@ -147,7 +148,7 @@ abstract class HavenWalletBase
_listener?.start(); _listener?.start();
} catch (e) { } catch (e) {
syncStatus = FailedSyncStatus(); syncStatus = FailedSyncStatus();
print(e); printV(e);
rethrow; rethrow;
} }
} }
@ -324,7 +325,7 @@ abstract class HavenWalletBase
await transactionHistory.save(); await transactionHistory.save();
_isTransactionUpdating = false; _isTransactionUpdating = false;
} catch (e) { } catch (e) {
print(e); printV(e);
_isTransactionUpdating = false; _isTransactionUpdating = false;
} }
} }
@ -403,7 +404,7 @@ abstract class HavenWalletBase
syncStatus = SyncingSyncStatus(blocksLeft, ptc); syncStatus = SyncingSyncStatus(blocksLeft, ptc);
} }
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
} }
} }
@ -413,7 +414,7 @@ abstract class HavenWalletBase
_askForUpdateBalance(); _askForUpdateBalance();
await Future<void>.delayed(Duration(seconds: 1)); await Future<void>.delayed(Duration(seconds: 1));
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
} }
} }

View file

@ -1,3 +1,4 @@
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_addresses_with_account.dart'; import 'package:cw_core/wallet_addresses_with_account.dart';
import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_info.dart';
import 'package:cw_core/account.dart'; import 'package:cw_core/account.dart';
@ -60,7 +61,7 @@ abstract class HavenWalletAddressesBase extends WalletAddressesWithAccount<Accou
await saveAddressesInBox(); await saveAddressesInBox();
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
} }
} }

View file

@ -1,5 +1,6 @@
import 'dart:io'; import 'dart:io';
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/monero_wallet_utils.dart'; import 'package:cw_core/monero_wallet_utils.dart';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
@ -81,7 +82,7 @@ class HavenWalletService extends WalletService<
return wallet; return wallet;
} catch (e) { } catch (e) {
// TODO: Implement Exception for wallet list service. // TODO: Implement Exception for wallet list service.
print('HavenWalletsManager Error: ${e.toString()}'); printV('HavenWalletsManager Error: ${e.toString()}');
rethrow; rethrow;
} }
} }
@ -93,7 +94,7 @@ class HavenWalletService extends WalletService<
return haven_wallet_manager.isWalletExist(path: path); return haven_wallet_manager.isWalletExist(path: path);
} catch (e) { } catch (e) {
// TODO: Implement Exception for wallet list service. // TODO: Implement Exception for wallet list service.
print('HavenWalletsManager Error: $e'); printV('HavenWalletsManager Error: $e');
rethrow; rethrow;
} }
} }
@ -197,7 +198,7 @@ class HavenWalletService extends WalletService<
return wallet; return wallet;
} catch (e) { } catch (e) {
// TODO: Implement Exception for wallet list service. // TODO: Implement Exception for wallet list service.
print('HavenWalletsManager Error: $e'); printV('HavenWalletsManager Error: $e');
rethrow; rethrow;
} }
} }
@ -218,7 +219,7 @@ class HavenWalletService extends WalletService<
return wallet; return wallet;
} catch (e) { } catch (e) {
// TODO: Implement Exception for wallet list service. // TODO: Implement Exception for wallet list service.
print('HavenWalletsManager Error: $e'); printV('HavenWalletsManager Error: $e');
rethrow; rethrow;
} }
} }
@ -252,7 +253,7 @@ class HavenWalletService extends WalletService<
newFile.writeAsBytesSync(file.readAsBytesSync()); newFile.writeAsBytesSync(file.readAsBytesSync());
}); });
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
} }
} }
} }

View file

@ -171,8 +171,8 @@ PendingTransactionDescription createTransactionMultDestSync(
final dstAddrs = outputs.map((e) => e.address).toList(); final dstAddrs = outputs.map((e) => e.address).toList();
final amounts = outputs.map((e) => monero.Wallet_amountFromString(e.amount)).toList(); final amounts = outputs.map((e) => monero.Wallet_amountFromString(e.amount)).toList();
// print("multDest: dstAddrs: $dstAddrs"); // printV("multDest: dstAddrs: $dstAddrs");
// print("multDest: amounts: $amounts"); // printV("multDest: amounts: $amounts");
final txptr = monero.Wallet_createTransactionMultDest( final txptr = monero.Wallet_createTransactionMultDest(
wptr!, wptr!,

View file

@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:ffi'; import 'dart:ffi';
import 'dart:isolate'; import 'dart:isolate';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_monero/api/account_list.dart'; import 'package:cw_monero/api/account_list.dart';
import 'package:cw_monero/api/exceptions/setup_wallet_exception.dart'; import 'package:cw_monero/api/exceptions/setup_wallet_exception.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
@ -11,7 +12,7 @@ import 'package:mutex/mutex.dart';
int getSyncingHeight() { int getSyncingHeight() {
// final height = monero.MONERO_cw_WalletListener_height(getWlptr()); // final height = monero.MONERO_cw_WalletListener_height(getWlptr());
final h2 = monero.Wallet_blockChainHeight(wptr!); final h2 = monero.Wallet_blockChainHeight(wptr!);
// print("height: $height / $h2"); // printV("height: $height / $h2");
return h2; return h2;
} }
@ -70,9 +71,9 @@ String getSeedLegacy(String? language) {
Map<int, Map<int, Map<int, String>>> addressCache = {}; Map<int, Map<int, Map<int, String>>> addressCache = {};
String getAddress({int accountIndex = 0, int addressIndex = 0}) { String getAddress({int accountIndex = 0, int addressIndex = 0}) {
// print("getaddress: ${accountIndex}/${addressIndex}: ${monero.Wallet_numSubaddresses(wptr!, accountIndex: accountIndex)}: ${monero.Wallet_address(wptr!, accountIndex: accountIndex, addressIndex: addressIndex)}"); // printV("getaddress: ${accountIndex}/${addressIndex}: ${monero.Wallet_numSubaddresses(wptr!, accountIndex: accountIndex)}: ${monero.Wallet_address(wptr!, accountIndex: accountIndex, addressIndex: addressIndex)}");
while (monero.Wallet_numSubaddresses(wptr!, accountIndex: accountIndex)-1 < addressIndex) { while (monero.Wallet_numSubaddresses(wptr!, accountIndex: accountIndex)-1 < addressIndex) {
print("adding subaddress"); printV("adding subaddress");
monero.Wallet_addSubaddress(wptr!, accountIndex: accountIndex); monero.Wallet_addSubaddress(wptr!, accountIndex: accountIndex);
} }
addressCache[wptr!.address] ??= {}; addressCache[wptr!.address] ??= {};
@ -101,7 +102,7 @@ Future<bool> setupNodeSync(
bool useSSL = false, bool useSSL = false,
bool isLightWallet = false, bool isLightWallet = false,
String? socksProxyAddress}) async { String? socksProxyAddress}) async {
print(''' printV('''
{ {
wptr!, wptr!,
daemonAddress: $address, daemonAddress: $address,
@ -126,7 +127,7 @@ Future<bool> setupNodeSync(
if (status != 0) { if (status != 0) {
final error = monero.Wallet_errorString(wptr!); final error = monero.Wallet_errorString(wptr!);
print("error: $error"); printV("error: $error");
throw SetupWalletException(message: error); throw SetupWalletException(message: error);
} }

View file

@ -2,6 +2,7 @@ import 'dart:ffi';
import 'dart:io'; import 'dart:io';
import 'dart:isolate'; import 'dart:isolate';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_monero/api/account_list.dart'; import 'package:cw_monero/api/account_list.dart';
import 'package:cw_monero/api/exceptions/wallet_creation_exception.dart'; import 'package:cw_monero/api/exceptions/wallet_creation_exception.dart';
import 'package:cw_monero/api/exceptions/wallet_opening_exception.dart'; import 'package:cw_monero/api/exceptions/wallet_opening_exception.dart';
@ -50,9 +51,9 @@ final monero.WalletManager wmPtr = Pointer.fromAddress((() {
// than plugging gdb in. Especially on windows/android. // than plugging gdb in. Especially on windows/android.
monero.printStarts = false; monero.printStarts = false;
_wmPtr ??= monero.WalletManagerFactory_getWalletManager(); _wmPtr ??= monero.WalletManagerFactory_getWalletManager();
print("ptr: $_wmPtr"); printV("ptr: $_wmPtr");
} catch (e) { } catch (e) {
print(e); printV(e);
rethrow; rethrow;
} }
return _wmPtr!.address; return _wmPtr!.address;
@ -223,7 +224,7 @@ void restoreWalletFromSpendKeySync(
if (status != 0) { if (status != 0) {
final err = monero.Wallet_errorString(newWptr); final err = monero.Wallet_errorString(newWptr);
print("err: $err"); printV("err: $err");
throw WalletRestoreFromKeysException(message: err); throw WalletRestoreFromKeysException(message: err);
} }
@ -301,7 +302,7 @@ Future<void> loadWallet(
); );
final status = monero.WalletManager_errorString(wmPtr); final status = monero.WalletManager_errorString(wmPtr);
if (status != "") { if (status != "") {
print("loadWallet:"+status); printV("loadWallet:"+status);
throw WalletOpeningException(message: status); throw WalletOpeningException(message: status);
} }
} else { } else {
@ -326,7 +327,7 @@ Future<void> loadWallet(
final status = monero.Wallet_status(newWptr); final status = monero.Wallet_status(newWptr);
if (status != 0) { if (status != 0) {
final err = monero.Wallet_errorString(newWptr); final err = monero.Wallet_errorString(newWptr);
print("loadWallet:"+err); printV("loadWallet:"+err);
throw WalletOpeningException(message: err); throw WalletOpeningException(message: err);
} }

View file

@ -28,9 +28,9 @@ void enableLedgerExchange(monero.wallet ptr, LedgerConnection connection) {
ptr, emptyPointer.cast<UnsignedChar>(), 0); ptr, emptyPointer.cast<UnsignedChar>(), 0);
malloc.free(emptyPointer); malloc.free(emptyPointer);
// print("> ${ledgerRequest.toHexString()}"); // printV("> ${ledgerRequest.toHexString()}");
final response = await exchange(connection, ledgerRequest); final response = await exchange(connection, ledgerRequest);
// print("< ${response.toHexString()}"); // printV("< ${response.toHexString()}");
final Pointer<Uint8> result = malloc<Uint8>(response.length); final Pointer<Uint8> result = malloc<Uint8>(response.length);
for (var i = 0; i < response.length; i++) { for (var i = 0; i < response.length; i++) {

View file

@ -1,4 +1,5 @@
import 'package:cw_core/monero_amount_format.dart'; import 'package:cw_core/monero_amount_format.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
import 'package:cw_core/account.dart'; import 'package:cw_core/account.dart';
import 'package:cw_monero/api/account_list.dart' as account_list; import 'package:cw_monero/api/account_list.dart' as account_list;
@ -74,7 +75,7 @@ abstract class MoneroAccountListBase with Store {
_isRefreshing = false; _isRefreshing = false;
} catch (e) { } catch (e) {
_isRefreshing = false; _isRefreshing = false;
print(e); printV(e);
rethrow; rethrow;
} }
} }

View file

@ -1,4 +1,5 @@
import 'package:cw_core/subaddress.dart'; import 'package:cw_core/subaddress.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_monero/api/coins_info.dart'; import 'package:cw_monero/api/coins_info.dart';
import 'package:cw_monero/api/subaddress_list.dart' as subaddress_list; import 'package:cw_monero/api/subaddress_list.dart' as subaddress_list;
import 'package:cw_monero/api/wallet.dart'; import 'package:cw_monero/api/wallet.dart';
@ -87,7 +88,7 @@ abstract class MoneroSubaddressListBase with Store {
_isRefreshing = false; _isRefreshing = false;
} on PlatformException catch (e) { } on PlatformException catch (e) {
_isRefreshing = false; _isRefreshing = false;
print(e); printV(e);
rethrow; rethrow;
} }
} }

View file

@ -1,4 +1,5 @@
import 'package:cw_core/unspent_transaction_output.dart'; import 'package:cw_core/unspent_transaction_output.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_monero/api/coins_info.dart'; import 'package:cw_monero/api/coins_info.dart';
import 'package:monero/monero.dart' as monero; import 'package:monero/monero.dart' as monero;
@ -10,7 +11,7 @@ class MoneroUnspent extends Unspent {
@override @override
set isFrozen(bool freeze) { set isFrozen(bool freeze) {
print("set isFrozen: $freeze ($keyImage): $freeze"); printV("set isFrozen: $freeze ($keyImage): $freeze");
final coinId = getCoinByKeyImage(keyImage!); final coinId = getCoinByKeyImage(keyImage!);
if (coinId == null) throw Exception("Unable to find a coin for address $address"); if (coinId == null) throw Exception("Unable to find a coin for address $address");
if (freeze) { if (freeze) {
@ -22,7 +23,7 @@ class MoneroUnspent extends Unspent {
@override @override
bool get isFrozen { bool get isFrozen {
print("get isFrozen"); printV("get isFrozen");
final coinId = getCoinByKeyImage(keyImage!); final coinId = getCoinByKeyImage(keyImage!);
if (coinId == null) throw Exception("Unable to find a coin for address $address"); if (coinId == null) throw Exception("Unable to find a coin for address $address");
final coin = getCoin(coinId); final coin = getCoin(coinId);

View file

@ -17,6 +17,7 @@ import 'package:cw_core/pending_transaction.dart';
import 'package:cw_core/sync_status.dart'; import 'package:cw_core/sync_status.dart';
import 'package:cw_core/transaction_direction.dart'; import 'package:cw_core/transaction_direction.dart';
import 'package:cw_core/unspent_coins_info.dart'; import 'package:cw_core/unspent_coins_info.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_info.dart';
import 'package:cw_monero/api/account_list.dart'; import 'package:cw_monero/api/account_list.dart';
@ -198,7 +199,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
syncStatus = ConnectedSyncStatus(); syncStatus = ConnectedSyncStatus();
} catch (e) { } catch (e) {
syncStatus = FailedSyncStatus(); syncStatus = FailedSyncStatus();
print(e); printV(e);
} }
} }
@ -229,7 +230,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
_listener?.start(); _listener?.start();
} catch (e) { } catch (e) {
syncStatus = FailedSyncStatus(); syncStatus = FailedSyncStatus();
print(e); printV(e);
rethrow; rethrow;
} }
} }
@ -399,8 +400,8 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
try { try {
await backupWalletFiles(name); await backupWalletFiles(name);
} catch (e) { } catch (e) {
print("¯\\_(ツ)_/¯"); printV("¯\\_(ツ)_/¯");
print(e); printV(e);
} }
} }
@ -409,7 +410,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
final currentWalletDirPath = await pathForWalletDir(name: name, type: type); final currentWalletDirPath = await pathForWalletDir(name: name, type: type);
if (openedWalletsByPath["$currentWalletDirPath/$name"] != null) { if (openedWalletsByPath["$currentWalletDirPath/$name"] != null) {
// NOTE: this is realistically only required on windows. // NOTE: this is realistically only required on windows.
print("closing wallet"); printV("closing wallet");
final wmaddr = wmPtr.address; final wmaddr = wmPtr.address;
final waddr = openedWalletsByPath["$currentWalletDirPath/$name"]!.address; final waddr = openedWalletsByPath["$currentWalletDirPath/$name"]!.address;
await Isolate.run(() { await Isolate.run(() {
@ -417,7 +418,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
Pointer.fromAddress(wmaddr), Pointer.fromAddress(waddr), true); Pointer.fromAddress(wmaddr), Pointer.fromAddress(waddr), true);
}); });
openedWalletsByPath.remove("$currentWalletDirPath/$name"); openedWalletsByPath.remove("$currentWalletDirPath/$name");
print("wallet closed"); printV("wallet closed");
} }
try { try {
// -- rename the waller folder -- // -- rename the waller folder --
@ -555,7 +556,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
await _refreshUnspentCoinsInfo(); await _refreshUnspentCoinsInfo();
_askForUpdateBalance(); _askForUpdateBalance();
} catch (e, s) { } catch (e, s) {
print(e.toString()); printV(e.toString());
onError?.call(FlutterErrorDetails( onError?.call(FlutterErrorDetails(
exception: e, exception: e,
stack: s, stack: s,
@ -604,7 +605,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
await unspentCoinsInfo.deleteAll(keys); await unspentCoinsInfo.deleteAll(keys);
} }
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
} }
} }
@ -637,7 +638,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
await transactionHistory.save(); await transactionHistory.save();
_isTransactionUpdating = false; _isTransactionUpdating = false;
} catch (e) { } catch (e) {
print(e); printV(e);
_isTransactionUpdating = false; _isTransactionUpdating = false;
} }
} }
@ -784,7 +785,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
syncStatus = SyncingSyncStatus(blocksLeft, ptc); syncStatus = SyncingSyncStatus(blocksLeft, ptc);
} }
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
} }
} }
@ -794,7 +795,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
_askForUpdateBalance(); _askForUpdateBalance();
await Future<void>.delayed(Duration(seconds: 1)); await Future<void>.delayed(Duration(seconds: 1));
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
} }
} }

View file

@ -1,6 +1,7 @@
import 'package:cw_core/account.dart'; import 'package:cw_core/account.dart';
import 'package:cw_core/address_info.dart'; import 'package:cw_core/address_info.dart';
import 'package:cw_core/subaddress.dart'; import 'package:cw_core/subaddress.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_addresses.dart'; import 'package:cw_core/wallet_addresses.dart';
import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_info.dart';
import 'package:cw_monero/api/subaddress_list.dart' as subaddress_list; import 'package:cw_monero/api/subaddress_list.dart' as subaddress_list;
@ -96,7 +97,7 @@ abstract class MoneroWalletAddressesBase extends WalletAddresses with Store {
await saveAddressesInBox(); await saveAddressesInBox();
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
} }
} }

View file

@ -3,6 +3,7 @@ import 'dart:io';
import 'package:cw_core/monero_wallet_utils.dart'; import 'package:cw_core/monero_wallet_utils.dart';
import 'package:cw_core/pathForWallet.dart'; import 'package:cw_core/pathForWallet.dart';
import 'package:cw_core/unspent_coins_info.dart'; import 'package:cw_core/unspent_coins_info.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/wallet_credentials.dart'; import 'package:cw_core/wallet_credentials.dart';
import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_info.dart';
@ -110,7 +111,7 @@ class MoneroWalletService extends WalletService<
return wallet; return wallet;
} catch (e) { } catch (e) {
// TODO: Implement Exception for wallet list service. // TODO: Implement Exception for wallet list service.
print('MoneroWalletsManager Error: ${e.toString()}'); printV('MoneroWalletsManager Error: ${e.toString()}');
rethrow; rethrow;
} }
} }
@ -122,7 +123,7 @@ class MoneroWalletService extends WalletService<
return monero_wallet_manager.isWalletExist(path: path); return monero_wallet_manager.isWalletExist(path: path);
} catch (e) { } catch (e) {
// TODO: Implement Exception for wallet list service. // TODO: Implement Exception for wallet list service.
print('MoneroWalletsManager Error: $e'); printV('MoneroWalletsManager Error: $e');
rethrow; rethrow;
} }
} }
@ -177,7 +178,7 @@ class MoneroWalletService extends WalletService<
final path = await pathForWalletDir(name: wallet, type: getType()); final path = await pathForWalletDir(name: wallet, type: getType());
if (openedWalletsByPath["$path/$wallet"] != null) { if (openedWalletsByPath["$path/$wallet"] != null) {
// NOTE: this is realistically only required on windows. // NOTE: this is realistically only required on windows.
print("closing wallet"); printV("closing wallet");
final wmaddr = wmPtr.address; final wmaddr = wmPtr.address;
final waddr = openedWalletsByPath["$path/$wallet"]!.address; final waddr = openedWalletsByPath["$path/$wallet"]!.address;
// await Isolate.run(() { // await Isolate.run(() {
@ -185,7 +186,7 @@ class MoneroWalletService extends WalletService<
Pointer.fromAddress(wmaddr), Pointer.fromAddress(waddr), false); Pointer.fromAddress(wmaddr), Pointer.fromAddress(waddr), false);
// }); // });
openedWalletsByPath.remove("$path/$wallet"); openedWalletsByPath.remove("$path/$wallet");
print("wallet closed"); printV("wallet closed");
} }
final file = Directory(path); final file = Directory(path);
@ -241,7 +242,7 @@ class MoneroWalletService extends WalletService<
return wallet; return wallet;
} catch (e) { } catch (e) {
// TODO: Implement Exception for wallet list service. // TODO: Implement Exception for wallet list service.
print('MoneroWalletsManager Error: $e'); printV('MoneroWalletsManager Error: $e');
rethrow; rethrow;
} }
} }
@ -272,7 +273,7 @@ class MoneroWalletService extends WalletService<
return wallet; return wallet;
} catch (e) { } catch (e) {
// TODO: Implement Exception for wallet list service. // TODO: Implement Exception for wallet list service.
print('MoneroWalletsManager Error: $e'); printV('MoneroWalletsManager Error: $e');
rethrow; rethrow;
} }
} }
@ -301,7 +302,7 @@ class MoneroWalletService extends WalletService<
return wallet; return wallet;
} catch (e) { } catch (e) {
// TODO: Implement Exception for wallet list service. // TODO: Implement Exception for wallet list service.
print('MoneroWalletsManager Error: $e'); printV('MoneroWalletsManager Error: $e');
rethrow; rethrow;
} }
} }
@ -318,7 +319,7 @@ class MoneroWalletService extends WalletService<
path, credentials.password!, polyseed, credentials.walletInfo!, lang); path, credentials.password!, polyseed, credentials.walletInfo!, lang);
} catch (e) { } catch (e) {
// TODO: Implement Exception for wallet list service. // TODO: Implement Exception for wallet list service.
print('MoneroWalletsManager Error: $e'); printV('MoneroWalletsManager Error: $e');
rethrow; rethrow;
} }
} }
@ -381,7 +382,7 @@ class MoneroWalletService extends WalletService<
newFile.writeAsBytesSync(file.readAsBytesSync()); newFile.writeAsBytesSync(file.readAsBytesSync());
}); });
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
} }
} }

View file

@ -4,6 +4,7 @@ import 'dart:developer';
import 'dart:io'; import 'dart:io';
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:grpc/grpc.dart'; import 'package:grpc/grpc.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import 'cw_mweb_platform_interface.dart'; import 'cw_mweb_platform_interface.dart';
@ -39,18 +40,18 @@ class CwMweb {
final fileStream = file.openRead(lastLength, currentLength); final fileStream = file.openRead(lastLength, currentLength);
final newLines = await fileStream.transform(utf8.decoder).join(); final newLines = await fileStream.transform(utf8.decoder).join();
lastLength = currentLength; lastLength = currentLength;
log(newLines); printV(newLines);
} }
} on GrpcError catch (e) { } on GrpcError catch (e) {
log('Caught grpc error: ${e.message}'); printV('Caught grpc error: ${e.message}');
} catch (e) { } catch (e) {
log('The mwebd debug log probably is not initialized yet.'); printV('The mwebd debug log probably is not initialized yet.');
} }
}); });
} }
static Future<void> _initializeClient() async { static Future<void> _initializeClient() async {
print("_initializeClient() called!"); printV("_initializeClient() called!");
final appDir = await getApplicationSupportDirectory(); final appDir = await getApplicationSupportDirectory();
const ltcNodeUri = "ltc-electrum.cakewallet.com:9333"; const ltcNodeUri = "ltc-electrum.cakewallet.com:9333";
@ -61,14 +62,14 @@ class CwMweb {
if (_port == null || _port == 0) { if (_port == null || _port == 0) {
throw Exception("Failed to start server"); throw Exception("Failed to start server");
} }
log("Attempting to connect to server on port: $_port"); printV("Attempting to connect to server on port: $_port");
// wait for the server to finish starting up before we try to connect to it: // wait for the server to finish starting up before we try to connect to it:
await Future.delayed(const Duration(seconds: 8)); await Future.delayed(const Duration(seconds: 8));
_clientChannel = ClientChannel('127.0.0.1', port: _port!, channelShutdownHandler: () { _clientChannel = ClientChannel('127.0.0.1', port: _port!, channelShutdownHandler: () {
_rpcClient = null; _rpcClient = null;
log("Channel is shutting down!"); printV("Channel is shutting down!");
}, },
options: const ChannelOptions( options: const ChannelOptions(
credentials: ChannelCredentials.insecure(), credentials: ChannelCredentials.insecure(),
@ -90,14 +91,14 @@ class CwMweb {
} }
return _rpcClient!; return _rpcClient!;
} on GrpcError catch (e) { } on GrpcError catch (e) {
log("Attempt $i failed: $e"); printV("Attempt $i failed: $e");
log('Caught grpc error: ${e.message}'); printV('Caught grpc error: ${e.message}');
_rpcClient = null; _rpcClient = null;
// necessary if the database isn't open: // necessary if the database isn't open:
await stop(); await stop();
await Future.delayed(const Duration(seconds: 3)); await Future.delayed(const Duration(seconds: 3));
} catch (e) { } catch (e) {
log("Attempt $i failed: $e"); printV("Attempt $i failed: $e");
_rpcClient = null; _rpcClient = null;
await stop(); await stop();
await Future.delayed(const Duration(seconds: 3)); await Future.delayed(const Duration(seconds: 3));
@ -111,9 +112,9 @@ class CwMweb {
await CwMwebPlatform.instance.stop(); await CwMwebPlatform.instance.stop();
await cleanup(); await cleanup();
} on GrpcError catch (e) { } on GrpcError catch (e) {
log('Caught grpc error: ${e.message}'); printV('Caught grpc error: ${e.message}');
} catch (e) { } catch (e) {
log("Error stopping server: $e"); printV("Error stopping server: $e");
} }
} }
@ -123,9 +124,9 @@ class CwMweb {
?.split(',') ?.split(',')
.first; .first;
} on GrpcError catch (e) { } on GrpcError catch (e) {
log('Caught grpc error: ${e.message}'); printV('Caught grpc error: ${e.message}');
} catch (e) { } catch (e) {
log("Error getting address: $e"); printV("Error getting address: $e");
} }
return null; return null;
} }
@ -159,9 +160,9 @@ class CwMweb {
_rpcClient = await stub(); _rpcClient = await stub();
return await _rpcClient!.spent(request, options: CallOptions(timeout: TIMEOUT_DURATION)); return await _rpcClient!.spent(request, options: CallOptions(timeout: TIMEOUT_DURATION));
} on GrpcError catch (e) { } on GrpcError catch (e) {
log('Caught grpc error: ${e.message}'); printV('Caught grpc error: ${e.message}');
} catch (e) { } catch (e) {
log("Error getting spent: $e"); printV("Error getting spent: $e");
} }
return SpentResponse(); return SpentResponse();
} }
@ -172,9 +173,9 @@ class CwMweb {
_rpcClient = await stub(); _rpcClient = await stub();
return await _rpcClient!.status(request, options: CallOptions(timeout: TIMEOUT_DURATION)); return await _rpcClient!.status(request, options: CallOptions(timeout: TIMEOUT_DURATION));
} on GrpcError catch (e) { } on GrpcError catch (e) {
log('Caught grpc error: ${e.message}'); printV('Caught grpc error: ${e.message}');
} catch (e) { } catch (e) {
log("Error getting status: $e"); printV("Error getting status: $e");
} }
return StatusResponse(); return StatusResponse();
} }
@ -185,9 +186,9 @@ class CwMweb {
_rpcClient = await stub(); _rpcClient = await stub();
return await _rpcClient!.create(request, options: CallOptions(timeout: TIMEOUT_DURATION)); return await _rpcClient!.create(request, options: CallOptions(timeout: TIMEOUT_DURATION));
} on GrpcError catch (e) { } on GrpcError catch (e) {
log('Caught grpc error: ${e.message}'); printV('Caught grpc error: ${e.message}');
} catch (e) { } catch (e) {
log("Error getting create: $e"); printV("Error getting create: $e");
} }
return CreateResponse(); return CreateResponse();
} }
@ -201,9 +202,9 @@ class CwMweb {
log("got utxo stream"); log("got utxo stream");
return resp; return resp;
} on GrpcError catch (e) { } on GrpcError catch (e) {
log('Caught grpc error: ${e.message}'); printV('Caught grpc error: ${e.message}');
} catch (e) { } catch (e) {
log("Error getting utxos: $e"); printV("Error getting utxos: $e");
} }
return null; return null;
} }
@ -217,7 +218,7 @@ class CwMweb {
log('Caught grpc error: ${e.message}'); log('Caught grpc error: ${e.message}');
throw "error from broadcast mweb: $e"; throw "error from broadcast mweb: $e";
} catch (e) { } catch (e) {
log("Error getting create: $e"); printV("Error getting utxos: $e");
rethrow; rethrow;
} }
} }

View file

@ -13,6 +13,8 @@ dependencies:
grpc: ^3.2.4 grpc: ^3.2.4
path_provider: ^2.1.2 path_provider: ^2.1.2
plugin_platform_interface: ^2.0.2 plugin_platform_interface: ^2.0.2
cw_core:
path: ../cw_core
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

View file

@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'package:cw_core/nano_account_info_response.dart'; import 'package:cw_core/nano_account_info_response.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_nano/nano_block_info_response.dart'; import 'package:cw_nano/nano_block_info_response.dart';
import 'package:cw_core/n2_node.dart'; import 'package:cw_core/n2_node.dart';
import 'package:cw_nano/nano_balance.dart'; import 'package:cw_nano/nano_balance.dart';
@ -106,7 +107,7 @@ class NanoClient {
final data = await jsonDecode(response.body); final data = await jsonDecode(response.body);
return AccountInfoResponse.fromJson(data as Map<String, dynamic>); return AccountInfoResponse.fromJson(data as Map<String, dynamic>);
} catch (e) { } catch (e) {
print("error while getting account info $e"); printV("error while getting account info $e");
return null; return null;
} }
} }
@ -127,7 +128,7 @@ class NanoClient {
final data = await jsonDecode(response.body); final data = await jsonDecode(response.body);
return BlockContentsResponse.fromJson(data["contents"] as Map<String, dynamic>); return BlockContentsResponse.fromJson(data["contents"] as Map<String, dynamic>);
} catch (e) { } catch (e) {
print("error while getting block info $e"); printV("error while getting block info $e");
return null; return null;
} }
} }
@ -508,7 +509,7 @@ class NanoClient {
.map<NanoTransactionModel>((transaction) => NanoTransactionModel.fromJson(transaction)) .map<NanoTransactionModel>((transaction) => NanoTransactionModel.fromJson(transaction))
.toList(); .toList();
} catch (e) { } catch (e) {
print(e); printV(e);
return []; return [];
} }
} }

View file

@ -1,6 +1,7 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:core'; import 'dart:core';
import 'package:cw_core/pathForWallet.dart'; import 'package:cw_core/pathForWallet.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_info.dart';
import 'package:cw_core/encryption_file_utils.dart'; import 'package:cw_core/encryption_file_utils.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
@ -37,7 +38,7 @@ abstract class NanoTransactionHistoryBase extends TransactionHistoryBase<NanoTra
final data = json.encode({'transactions': transactions}); final data = json.encode({'transactions': transactions});
await encryptionFileUtils.write(path: path, password: _password, data: data); await encryptionFileUtils.write(path: path, password: _password, data: data);
} catch (e) { } catch (e) {
print('Error while save nano transaction history: ${e.toString()}'); printV('Error while save nano transaction history: ${e.toString()}');
} }
} }
@ -72,7 +73,7 @@ abstract class NanoTransactionHistoryBase extends TransactionHistoryBase<NanoTra
} }
}); });
} catch (e) { } catch (e) {
print(e); printV(e);
} }
} }

View file

@ -15,6 +15,7 @@ import 'package:cw_core/pending_transaction.dart';
import 'package:cw_core/sync_status.dart'; import 'package:cw_core/sync_status.dart';
import 'package:cw_core/transaction_direction.dart'; import 'package:cw_core/transaction_direction.dart';
import 'package:cw_core/transaction_priority.dart'; import 'package:cw_core/transaction_priority.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_info.dart';
import 'package:cw_core/wallet_keys_file.dart'; import 'package:cw_core/wallet_keys_file.dart';
@ -170,12 +171,12 @@ abstract class NanoWalletBase
await _updateRep(); await _updateRep();
await _receiveAll(); await _receiveAll();
} catch (e) { } catch (e) {
print(e); printV(e);
} }
syncStatus = ConnectedSyncStatus(); syncStatus = ConnectedSyncStatus();
} catch (e) { } catch (e) {
print(e); printV(e);
syncStatus = FailedSyncStatus(); syncStatus = FailedSyncStatus();
} }
} }
@ -367,7 +368,7 @@ abstract class NanoWalletBase
syncStatus = SyncedSyncStatus(); syncStatus = SyncedSyncStatus();
} catch (e) { } catch (e) {
print(e); printV(e);
syncStatus = FailedSyncStatus(); syncStatus = FailedSyncStatus();
rethrow; rethrow;
} }
@ -444,7 +445,7 @@ abstract class NanoWalletBase
try { try {
balance[currency] = await _client.getBalance(_publicAddress!); balance[currency] = await _client.getBalance(_publicAddress!);
} catch (e) { } catch (e) {
print("Failed to get balance $e"); printV("Failed to get balance $e");
// if we don't have a balance, we should at least create one, since it's a late binding // if we don't have a balance, we should at least create one, since it's a late binding
// otherwise, it's better to just leave it as whatever it was before: // otherwise, it's better to just leave it as whatever it was before:
if (balance[currency] == null) { if (balance[currency] == null) {

View file

@ -1,4 +1,5 @@
import 'package:cw_core/cake_hive.dart'; import 'package:cw_core/cake_hive.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_addresses.dart'; import 'package:cw_core/wallet_addresses.dart';
import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_info.dart';
import 'package:cw_core/nano_account.dart'; import 'package:cw_core/nano_account.dart';
@ -47,7 +48,7 @@ abstract class NanoWalletAddressesBase extends WalletAddresses with Store {
addressesMap[address] = ''; addressesMap[address] = '';
await saveAddressesInBox(); await saveAddressesInBox();
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
} }
} }
} }

View file

@ -4,6 +4,7 @@ import 'dart:math';
import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/node.dart'; import 'package:cw_core/node.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_solana/pending_solana_transaction.dart'; import 'package:cw_solana/pending_solana_transaction.dart';
import 'package:cw_solana/solana_balance.dart'; import 'package:cw_solana/solana_balance.dart';
import 'package:cw_solana/solana_transaction_model.dart'; import 'package:cw_solana/solana_transaction_model.dart';
@ -529,7 +530,7 @@ class SolanaWalletClient {
return signature; return signature;
} catch (e) { } catch (e) {
print('Error while sending transaction: ${e.toString()}'); printV('Error while sending transaction: ${e.toString()}');
throw Exception(e); throw Exception(e);
} }
} }
@ -546,7 +547,7 @@ class SolanaWalletClient {
return null; return null;
} }
} catch (e) { } catch (e) {
print('Error occurred while fetching token image: \n${e.toString()}'); printV('Error occurred while fetching token image: \n${e.toString()}');
return null; return null;
} }
} }

View file

@ -2,6 +2,7 @@ import 'dart:convert';
import 'dart:core'; import 'dart:core';
import 'package:cw_core/encryption_file_utils.dart'; import 'package:cw_core/encryption_file_utils.dart';
import 'package:cw_core/pathForWallet.dart'; import 'package:cw_core/pathForWallet.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_info.dart';
import 'package:cw_solana/solana_transaction_info.dart'; import 'package:cw_solana/solana_transaction_info.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
@ -36,8 +37,8 @@ abstract class SolanaTransactionHistoryBase extends TransactionHistoryBase<Solan
final data = json.encode({'transactions': transactionMaps}); final data = json.encode({'transactions': transactionMaps});
await encryptionFileUtils.write(path: path, password: _password, data: data); await encryptionFileUtils.write(path: path, password: _password, data: data);
} catch (e, s) { } catch (e, s) {
print('Error while saving solana transaction history: ${e.toString()}'); printV('Error while saving solana transaction history: ${e.toString()}');
print(s); printV(s);
} }
} }
@ -72,7 +73,7 @@ abstract class SolanaTransactionHistoryBase extends TransactionHistoryBase<Solan
} }
}); });
} catch (e) { } catch (e) {
print(e); printV(e);
} }
} }

View file

@ -11,6 +11,7 @@ import 'package:cw_core/pending_transaction.dart';
import 'package:cw_core/sync_status.dart'; import 'package:cw_core/sync_status.dart';
import 'package:cw_core/transaction_direction.dart'; import 'package:cw_core/transaction_direction.dart';
import 'package:cw_core/transaction_priority.dart'; import 'package:cw_core/transaction_priority.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_addresses.dart'; import 'package:cw_core/wallet_addresses.dart';
import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_info.dart';
@ -454,7 +455,7 @@ abstract class SolanaWalletBase
SolanaBalance(0.0); SolanaBalance(0.0);
balance[token] = tokenBalance; balance[token] = tokenBalance;
} catch (e) { } catch (e) {
print('Error fetching spl token (${token.symbol}) balance ${e.toString()}'); printV('Error fetching spl token (${token.symbol}) balance ${e.toString()}');
} }
} else { } else {
balance.remove(token); balance.remove(token);

View file

@ -1,3 +1,4 @@
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_addresses.dart'; import 'package:cw_core/wallet_addresses.dart';
import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_info.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
@ -30,7 +31,7 @@ abstract class SolanaWalletAddressesBase extends WalletAddresses with Store {
addressesMap[address] = ''; addressesMap[address] = '';
await saveAddressesInBox(); await saveAddressesInBox();
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
} }
} }
} }

View file

@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:ffi'; import 'dart:ffi';
import 'dart:isolate'; import 'dart:isolate';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_wownero/api/account_list.dart'; import 'package:cw_wownero/api/account_list.dart';
import 'package:cw_wownero/api/exceptions/setup_wallet_exception.dart'; import 'package:cw_wownero/api/exceptions/setup_wallet_exception.dart';
import 'package:monero/wownero.dart' as wownero; import 'package:monero/wownero.dart' as wownero;
@ -10,7 +11,7 @@ import 'package:mutex/mutex.dart';
int getSyncingHeight() { int getSyncingHeight() {
// final height = wownero.WOWNERO_cw_WalletListener_height(getWlptr()); // final height = wownero.WOWNERO_cw_WalletListener_height(getWlptr());
final h2 = wownero.Wallet_blockChainHeight(wptr!); final h2 = wownero.Wallet_blockChainHeight(wptr!);
// print("height: $height / $h2"); // printV("height: $height / $h2");
return h2; return h2;
} }
@ -71,7 +72,7 @@ Map<int, Map<int, Map<int, String>>> addressCache = {};
String getAddress({int accountIndex = 0, int addressIndex = 1}) { String getAddress({int accountIndex = 0, int addressIndex = 1}) {
while (wownero.Wallet_numSubaddresses(wptr!, accountIndex: accountIndex)-1 < addressIndex) { while (wownero.Wallet_numSubaddresses(wptr!, accountIndex: accountIndex)-1 < addressIndex) {
print("adding subaddress"); printV("adding subaddress");
wownero.Wallet_addSubaddress(wptr!, accountIndex: accountIndex); wownero.Wallet_addSubaddress(wptr!, accountIndex: accountIndex);
} }
addressCache[wptr!.address] ??= {}; addressCache[wptr!.address] ??= {};
@ -100,7 +101,7 @@ Future<bool> setupNodeSync(
bool useSSL = false, bool useSSL = false,
bool isLightWallet = false, bool isLightWallet = false,
String? socksProxyAddress}) async { String? socksProxyAddress}) async {
print(''' printV('''
{ {
wptr!, wptr!,
daemonAddress: $address, daemonAddress: $address,
@ -125,7 +126,7 @@ Future<bool> setupNodeSync(
if (status != 0) { if (status != 0) {
final error = wownero.Wallet_errorString(wptr!); final error = wownero.Wallet_errorString(wptr!);
print("error: $error"); printV("error: $error");
throw SetupWalletException(message: error); throw SetupWalletException(message: error);
} }

View file

@ -2,6 +2,7 @@ import 'dart:ffi';
import 'dart:io'; import 'dart:io';
import 'dart:isolate'; import 'dart:isolate';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_wownero/api/account_list.dart'; import 'package:cw_wownero/api/account_list.dart';
import 'package:cw_wownero/api/exceptions/wallet_creation_exception.dart'; import 'package:cw_wownero/api/exceptions/wallet_creation_exception.dart';
import 'package:cw_wownero/api/exceptions/wallet_opening_exception.dart'; import 'package:cw_wownero/api/exceptions/wallet_opening_exception.dart';
@ -53,9 +54,9 @@ final wownero.WalletManager wmPtr = Pointer.fromAddress((() {
// than plugging gdb in. Especially on windows/android. // than plugging gdb in. Especially on windows/android.
wownero.printStarts = false; wownero.printStarts = false;
_wmPtr ??= wownero.WalletManagerFactory_getWalletManager(); _wmPtr ??= wownero.WalletManagerFactory_getWalletManager();
print("ptr: $_wmPtr"); printV("ptr: $_wmPtr");
} catch (e) { } catch (e) {
print(e); printV(e);
rethrow; rethrow;
} }
return _wmPtr!.address; return _wmPtr!.address;
@ -230,7 +231,7 @@ void restoreWalletFromSpendKeySync(
if (status != 0) { if (status != 0) {
final err = wownero.Wallet_errorString(newWptr); final err = wownero.Wallet_errorString(newWptr);
print("err: $err"); printV("err: $err");
throw WalletRestoreFromKeysException(message: err); throw WalletRestoreFromKeysException(message: err);
} }
@ -299,7 +300,7 @@ void loadWallet(
final status = wownero.Wallet_status(newWptr); final status = wownero.Wallet_status(newWptr);
if (status != 0) { if (status != 0) {
final err = wownero.Wallet_errorString(newWptr); final err = wownero.Wallet_errorString(newWptr);
print(err); printV(err);
throw WalletOpeningException(message: err); throw WalletOpeningException(message: err);
} }
wptr = newWptr; wptr = newWptr;

View file

@ -1,3 +1,5 @@
import 'package:cw_core/utils/print_verbose.dart';
const prefixLength = 3; const prefixLength = 3;
String swapEndianBytes(String original) { String swapEndianBytes(String original) {
@ -37,14 +39,14 @@ String mnemonicDecode(String seed) {
.indexOf(wlist[i + 2].substring(0, prefixLength)); .indexOf(wlist[i + 2].substring(0, prefixLength));
if (w1 == -1 || w2 == -1 || w3 == -1) { if (w1 == -1 || w2 == -1 || w3 == -1) {
print("invalid word in mnemonic"); printV("invalid word in mnemonic");
return ''; return '';
} }
final x = w1 + n * (((n - w1) + w2) % n) + n * n * (((n - w2) + w3) % n); final x = w1 + n * (((n - w1) + w2) % n) + n * n * (((n - w2) + w3) % n);
if (x % n != w1) { if (x % n != w1) {
print("Something went wrong when decoding your private key, please try again"); printV("Something went wrong when decoding your private key, please try again");
return ''; return '';
} }

View file

@ -1,3 +1,4 @@
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wownero_amount_format.dart'; import 'package:cw_core/wownero_amount_format.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
import 'package:cw_core/account.dart'; import 'package:cw_core/account.dart';
@ -74,7 +75,7 @@ abstract class WowneroAccountListBase with Store {
_isRefreshing = false; _isRefreshing = false;
} catch (e) { } catch (e) {
_isRefreshing = false; _isRefreshing = false;
print(e); printV(e);
rethrow; rethrow;
} }
} }

View file

@ -1,4 +1,5 @@
import 'package:cw_core/subaddress.dart'; import 'package:cw_core/subaddress.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_wownero/api/coins_info.dart'; import 'package:cw_wownero/api/coins_info.dart';
import 'package:cw_wownero/api/subaddress_list.dart' as subaddress_list; import 'package:cw_wownero/api/subaddress_list.dart' as subaddress_list;
import 'package:cw_wownero/api/wallet.dart'; import 'package:cw_wownero/api/wallet.dart';
@ -95,7 +96,7 @@ abstract class WowneroSubaddressListBase with Store {
_isRefreshing = false; _isRefreshing = false;
} on PlatformException catch (e) { } on PlatformException catch (e) {
_isRefreshing = false; _isRefreshing = false;
print(e); printV(e);
rethrow; rethrow;
} }
} }

View file

@ -15,6 +15,7 @@ import 'package:cw_core/sync_status.dart';
import 'package:cw_core/transaction_direction.dart'; import 'package:cw_core/transaction_direction.dart';
import 'package:cw_core/transaction_priority.dart'; import 'package:cw_core/transaction_priority.dart';
import 'package:cw_core/unspent_coins_info.dart'; import 'package:cw_core/unspent_coins_info.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_info.dart';
import 'package:cw_core/wownero_amount_format.dart'; import 'package:cw_core/wownero_amount_format.dart';
@ -185,7 +186,7 @@ abstract class WowneroWalletBase
syncStatus = ConnectedSyncStatus(); syncStatus = ConnectedSyncStatus();
} catch (e) { } catch (e) {
syncStatus = FailedSyncStatus(); syncStatus = FailedSyncStatus();
print(e); printV(e);
} }
} }
@ -216,7 +217,7 @@ abstract class WowneroWalletBase
_listener?.start(); _listener?.start();
} catch (e) { } catch (e) {
syncStatus = FailedSyncStatus(); syncStatus = FailedSyncStatus();
print(e); printV(e);
rethrow; rethrow;
} }
} }
@ -349,8 +350,8 @@ abstract class WowneroWalletBase
try { try {
await backupWalletFiles(name); await backupWalletFiles(name);
} catch (e) { } catch (e) {
print("¯\\_(ツ)_/¯"); printV("¯\\_(ツ)_/¯");
print(e); printV(e);
} }
} }
@ -359,7 +360,7 @@ abstract class WowneroWalletBase
final currentWalletDirPath = await pathForWalletDir(name: name, type: type); final currentWalletDirPath = await pathForWalletDir(name: name, type: type);
if (openedWalletsByPath["$currentWalletDirPath/$name"] != null) { if (openedWalletsByPath["$currentWalletDirPath/$name"] != null) {
// NOTE: this is realistically only required on windows. // NOTE: this is realistically only required on windows.
print("closing wallet"); printV("closing wallet");
final wmaddr = wmPtr.address; final wmaddr = wmPtr.address;
final waddr = openedWalletsByPath["$currentWalletDirPath/$name"]!.address; final waddr = openedWalletsByPath["$currentWalletDirPath/$name"]!.address;
await Isolate.run(() { await Isolate.run(() {
@ -367,7 +368,7 @@ abstract class WowneroWalletBase
Pointer.fromAddress(wmaddr), Pointer.fromAddress(waddr), true); Pointer.fromAddress(wmaddr), Pointer.fromAddress(waddr), true);
}); });
openedWalletsByPath.remove("$currentWalletDirPath/$name"); openedWalletsByPath.remove("$currentWalletDirPath/$name");
print("wallet closed"); printV("wallet closed");
} }
try { try {
// -- rename the waller folder -- // -- rename the waller folder --
@ -499,7 +500,7 @@ abstract class WowneroWalletBase
await _refreshUnspentCoinsInfo(); await _refreshUnspentCoinsInfo();
_askForUpdateBalance(); _askForUpdateBalance();
} catch (e, s) { } catch (e, s) {
print(e.toString()); printV(e.toString());
onError?.call(FlutterErrorDetails( onError?.call(FlutterErrorDetails(
exception: e, exception: e,
stack: s, stack: s,
@ -546,7 +547,7 @@ abstract class WowneroWalletBase
await unspentCoinsInfo.deleteAll(keys); await unspentCoinsInfo.deleteAll(keys);
} }
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
} }
} }
@ -577,7 +578,7 @@ abstract class WowneroWalletBase
await transactionHistory.save(); await transactionHistory.save();
_isTransactionUpdating = false; _isTransactionUpdating = false;
} catch (e) { } catch (e) {
print(e); printV(e);
_isTransactionUpdating = false; _isTransactionUpdating = false;
} }
} }
@ -717,7 +718,7 @@ abstract class WowneroWalletBase
syncStatus = SyncingSyncStatus(blocksLeft, ptc); syncStatus = SyncingSyncStatus(blocksLeft, ptc);
} }
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
} }
} }
@ -727,7 +728,7 @@ abstract class WowneroWalletBase
_askForUpdateBalance(); _askForUpdateBalance();
await Future<void>.delayed(Duration(seconds: 1)); await Future<void>.delayed(Duration(seconds: 1));
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
} }
} }

View file

@ -1,6 +1,7 @@
import 'package:cw_core/account.dart'; import 'package:cw_core/account.dart';
import 'package:cw_core/address_info.dart'; import 'package:cw_core/address_info.dart';
import 'package:cw_core/subaddress.dart'; import 'package:cw_core/subaddress.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_addresses.dart'; import 'package:cw_core/wallet_addresses.dart';
import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_info.dart';
import 'package:cw_wownero/api/transaction_history.dart'; import 'package:cw_wownero/api/transaction_history.dart';
@ -94,7 +95,7 @@ abstract class WowneroWalletAddressesBase extends WalletAddresses with Store {
await saveAddressesInBox(); await saveAddressesInBox();
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
} }
} }

View file

@ -3,6 +3,7 @@ import 'dart:io';
import 'package:cw_core/monero_wallet_utils.dart'; import 'package:cw_core/monero_wallet_utils.dart';
import 'package:cw_core/pathForWallet.dart'; import 'package:cw_core/pathForWallet.dart';
import 'package:cw_core/unspent_coins_info.dart'; import 'package:cw_core/unspent_coins_info.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/wallet_credentials.dart'; import 'package:cw_core/wallet_credentials.dart';
import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_info.dart';
@ -99,7 +100,7 @@ class WowneroWalletService extends WalletService<
return wallet; return wallet;
} catch (e) { } catch (e) {
// TODO: Implement Exception for wallet list service. // TODO: Implement Exception for wallet list service.
print('WowneroWalletsManager Error: ${e.toString()}'); printV('WowneroWalletsManager Error: ${e.toString()}');
rethrow; rethrow;
} }
} }
@ -111,7 +112,7 @@ class WowneroWalletService extends WalletService<
return wownero_wallet_manager.isWalletExist(path: path); return wownero_wallet_manager.isWalletExist(path: path);
} catch (e) { } catch (e) {
// TODO: Implement Exception for wallet list service. // TODO: Implement Exception for wallet list service.
print('WowneroWalletsManager Error: $e'); printV('WowneroWalletsManager Error: $e');
rethrow; rethrow;
} }
} }
@ -182,7 +183,7 @@ class WowneroWalletService extends WalletService<
final path = await pathForWalletDir(name: wallet, type: getType()); final path = await pathForWalletDir(name: wallet, type: getType());
if (openedWalletsByPath["$path/$wallet"] != null) { if (openedWalletsByPath["$path/$wallet"] != null) {
// NOTE: this is realistically only required on windows. // NOTE: this is realistically only required on windows.
print("closing wallet"); printV("closing wallet");
final wmaddr = wmPtr.address; final wmaddr = wmPtr.address;
final waddr = openedWalletsByPath["$path/$wallet"]!.address; final waddr = openedWalletsByPath["$path/$wallet"]!.address;
// await Isolate.run(() { // await Isolate.run(() {
@ -190,7 +191,7 @@ class WowneroWalletService extends WalletService<
Pointer.fromAddress(wmaddr), Pointer.fromAddress(waddr), false); Pointer.fromAddress(wmaddr), Pointer.fromAddress(waddr), false);
// }); // });
openedWalletsByPath.remove("$path/$wallet"); openedWalletsByPath.remove("$path/$wallet");
print("wallet closed"); printV("wallet closed");
} }
final file = Directory(path); final file = Directory(path);
@ -241,7 +242,7 @@ class WowneroWalletService extends WalletService<
return wallet; return wallet;
} catch (e) { } catch (e) {
// TODO: Implement Exception for wallet list service. // TODO: Implement Exception for wallet list service.
print('WowneroWalletsManager Error: $e'); printV('WowneroWalletsManager Error: $e');
rethrow; rethrow;
} }
} }
@ -274,7 +275,7 @@ class WowneroWalletService extends WalletService<
return wallet; return wallet;
} catch (e) { } catch (e) {
// TODO: Implement Exception for wallet list service. // TODO: Implement Exception for wallet list service.
print('WowneroWalletsManager Error: $e'); printV('WowneroWalletsManager Error: $e');
rethrow; rethrow;
} }
} }
@ -291,7 +292,7 @@ class WowneroWalletService extends WalletService<
path, credentials.password!, polyseed, credentials.walletInfo!, lang); path, credentials.password!, polyseed, credentials.walletInfo!, lang);
} catch (e) { } catch (e) {
// TODO: Implement Exception for wallet list service. // TODO: Implement Exception for wallet list service.
print('WowneroWalletsManager Error: $e'); printV('WowneroWalletsManager Error: $e');
rethrow; rethrow;
} }
} }
@ -348,7 +349,7 @@ class WowneroWalletService extends WalletService<
newFile.writeAsBytesSync(file.readAsBytesSync()); newFile.writeAsBytesSync(file.readAsBytesSync());
}); });
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
} }
} }
} }

Binary file not shown.

View file

@ -0,0 +1 @@
../scripts/monero_c/release/zano/host-apple-ios_libwallet2_api_c.dylib

View file

@ -404,8 +404,8 @@ class CWBitcoin extends Bitcoin {
list.add(dInfoCopy); list.add(dInfoCopy);
} catch (e, s) { } catch (e, s) {
print("derivationInfoError: $e"); printV("derivationInfoError: $e");
print("derivationInfoStack: $s"); printV("derivationInfoStack: $s");
} }
} }
} }
@ -498,7 +498,7 @@ class CWBitcoin extends Bitcoin {
try { try {
return hardwareWalletService.getAvailableAccounts(index: index, limit: limit); return hardwareWalletService.getAvailableAccounts(index: index, limit: limit);
} catch (err) { } catch (err) {
print(err); printV(err);
throw err; throw err;
} }
} }
@ -510,7 +510,7 @@ class CWBitcoin extends Bitcoin {
try { try {
return hardwareWalletService.getAvailableAccounts(index: index, limit: limit); return hardwareWalletService.getAvailableAccounts(index: index, limit: limit);
} catch (err) { } catch (err) {
print(err); printV(err);
throw err; throw err;
} }
} }

View file

@ -12,6 +12,7 @@ import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:cake_wallet/view_model/hardware_wallet/ledger_view_model.dart'; import 'package:cake_wallet/view_model/hardware_wallet/ledger_view_model.dart';
import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/wallet_type.dart'; import 'package:cw_core/wallet_type.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -136,7 +137,7 @@ class DFXBuyProvider extends BuyProvider {
return {}; return {};
} }
} catch (e) { } catch (e) {
print('DFX Error fetching fiat currencies: $e'); printV('DFX Error fetching fiat currencies: $e');
return {}; return {};
} }
} }
@ -266,19 +267,19 @@ class DFXBuyProvider extends BuyProvider {
quote.setCryptoCurrency = cryptoCurrency; quote.setCryptoCurrency = cryptoCurrency;
return [quote]; return [quote];
} else { } else {
print('DFX: Unexpected data type: ${responseData.runtimeType}'); printV('DFX: Unexpected data type: ${responseData.runtimeType}');
return null; return null;
} }
} else { } else {
if (responseData is Map<String, dynamic> && responseData.containsKey('message')) { if (responseData is Map<String, dynamic> && responseData.containsKey('message')) {
print('DFX Error: ${responseData['message']}'); printV('DFX Error: ${responseData['message']}');
} else { } else {
print('DFX Failed to fetch buy quote: ${response.statusCode}'); printV('DFX Failed to fetch buy quote: ${response.statusCode}');
} }
return null; return null;
} }
} catch (e) { } catch (e) {
print('DFX Error fetching buy quote: $e'); printV('DFX Error fetching buy quote: $e');
return null; return null;
} }
} }

View file

@ -9,6 +9,7 @@ import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart'; import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/wallet_base.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'dart:developer'; import 'dart:developer';
@ -75,11 +76,11 @@ class MeldBuyProvider extends BuyProvider {
data.map((e) => PaymentMethod.fromMeldJson(e as Map<String, dynamic>)).toList(); data.map((e) => PaymentMethod.fromMeldJson(e as Map<String, dynamic>)).toList();
return paymentMethods; return paymentMethods;
} else { } else {
print('Meld: Failed to fetch payment types'); printV('Meld: Failed to fetch payment types');
return List<PaymentMethod>.empty(); return List<PaymentMethod>.empty();
} }
} catch (e) { } catch (e) {
print('Meld: Failed to fetch payment types: $e'); printV('Meld: Failed to fetch payment types: $e');
return List<PaymentMethod>.empty(); return List<PaymentMethod>.empty();
} }
} }
@ -132,7 +133,7 @@ class MeldBuyProvider extends BuyProvider {
return null; return null;
} }
} catch (e) { } catch (e) {
print('Error fetching buy quote: $e'); printV('Error fetching buy quote: $e');
return null; return null;
} }
} }

View file

@ -18,6 +18,7 @@ import 'package:cake_wallet/themes/theme_base.dart';
import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/wallet_type.dart'; import 'package:cw_core/wallet_type.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:http/http.dart'; import 'package:http/http.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
@ -113,11 +114,11 @@ class MoonPayProvider extends BuyProvider {
if (response.statusCode == 200) { if (response.statusCode == 200) {
return jsonDecode(response.body) as Map<String, dynamic>; return jsonDecode(response.body) as Map<String, dynamic>;
} else { } else {
print('MoonPay does not support fiat: $fiatCurrency'); printV('MoonPay does not support fiat: $fiatCurrency');
return {}; return {};
} }
} catch (e) { } catch (e) {
print('MoonPay Error fetching fiat currencies: $e'); printV('MoonPay Error fetching fiat currencies: $e');
return {}; return {};
} }
} }
@ -204,11 +205,11 @@ class MoonPayProvider extends BuyProvider {
return [quote]; return [quote];
} else { } else {
print('Moon Pay: Error fetching buy quote: '); printV('Moon Pay: Error fetching buy quote: ');
return null; return null;
} }
} catch (e) { } catch (e) {
print('Moon Pay: Error fetching buy quote: $e'); printV('Moon Pay: Error fetching buy quote: $e');
return null; return null;
} }
} }

View file

@ -11,6 +11,7 @@ import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart'; import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/currency.dart'; import 'package:cw_core/currency.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/wallet_base.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
@ -67,11 +68,11 @@ class OnRamperBuyProvider extends BuyProvider {
.map((item) => PaymentMethod.fromOnramperJson(item as Map<String, dynamic>)) .map((item) => PaymentMethod.fromOnramperJson(item as Map<String, dynamic>))
.toList(); .toList();
} else { } else {
print('Failed to fetch available payment types'); printV('Failed to fetch available payment types');
return []; return [];
} }
} catch (e) { } catch (e) {
print('Failed to fetch available payment types: $e'); printV('Failed to fetch available payment types: $e');
return []; return [];
} }
} }
@ -98,11 +99,11 @@ class OnRamperBuyProvider extends BuyProvider {
return result; return result;
} else { } else {
print('Failed to fetch onramp metadata'); printV('Failed to fetch onramp metadata');
return {}; return {};
} }
} catch (e) { } catch (e) {
print('Error occurred: $e'); printV('Error occurred: $e');
return {}; return {};
} }
} }
@ -178,11 +179,11 @@ class OnRamperBuyProvider extends BuyProvider {
return validQuotes; return validQuotes;
} else { } else {
print('Onramper: Failed to fetch rate'); printV('Onramper: Failed to fetch rate');
return null; return null;
} }
} catch (e) { } catch (e) {
print('Onramper: Failed to fetch rate $e'); printV('Onramper: Failed to fetch rate $e');
return null; return null;
} }
} }

View file

@ -13,6 +13,7 @@ import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:cake_wallet/view_model/hardware_wallet/ledger_view_model.dart'; import 'package:cake_wallet/view_model/hardware_wallet/ledger_view_model.dart';
import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/wallet_type.dart'; import 'package:cw_core/wallet_type.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -176,7 +177,7 @@ class RobinhoodBuyProvider extends BuyProvider {
if (responseData.containsKey('message')) { if (responseData.containsKey('message')) {
log('Robinhood Error: ${responseData['message']}'); log('Robinhood Error: ${responseData['message']}');
} else { } else {
print('Robinhood Failed to fetch $action quote: ${response.statusCode}'); printV('Robinhood Failed to fetch $action quote: ${response.statusCode}');
} }
return null; return null;
} }

View file

@ -3,6 +3,7 @@ import 'dart:convert';
import 'package:cake_wallet/cake_pay/cake_pay_order.dart'; import 'package:cake_wallet/cake_pay/cake_pay_order.dart';
import 'package:cake_wallet/cake_pay/cake_pay_user_credentials.dart'; import 'package:cake_wallet/cake_pay/cake_pay_user_credentials.dart';
import 'package:cake_wallet/cake_pay/cake_pay_vendor.dart'; import 'package:cake_wallet/cake_pay/cake_pay_vendor.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cake_wallet/entities/country.dart'; import 'package:cake_wallet/entities/country.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
@ -140,7 +141,7 @@ class CakePayApi {
final response = await http.get(uri, headers: headers); final response = await http.get(uri, headers: headers);
print('Response: ${response.statusCode}'); printV('Response: ${response.statusCode}');
if (response.statusCode != 200) { if (response.statusCode != 200) {
throw Exception('Unexpected http status: ${response.statusCode}'); throw Exception('Unexpected http status: ${response.statusCode}');
@ -167,7 +168,7 @@ class CakePayApi {
throw Exception('Unexpected http status: ${response.statusCode}'); throw Exception('Unexpected http status: ${response.statusCode}');
} }
} catch (e) { } catch (e) {
print('Caught exception: $e'); printV('Caught exception: $e');
} }
} }

View file

@ -4,6 +4,7 @@ import 'package:cake_wallet/core/secure_storage.dart';
import 'package:cake_wallet/core/totp_request_details.dart'; import 'package:cake_wallet/core/totp_request_details.dart';
import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/src/screens/auth/auth_page.dart'; import 'package:cake_wallet/src/screens/auth/auth_page.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
@ -51,7 +52,7 @@ class AuthService with Store {
try { try {
password = await secureStorage.read(key: key) ?? ''; password = await secureStorage.read(key: key) ?? '';
} catch (e) { } catch (e) {
print(e); printV(e);
} }
return walletName.isNotEmpty && password.isNotEmpty; return walletName.isNotEmpty && password.isNotEmpty;

View file

@ -7,6 +7,7 @@ import 'package:cake_wallet/entities/transaction_description.dart';
import 'package:cake_wallet/themes/theme_list.dart'; import 'package:cake_wallet/themes/theme_list.dart';
import 'package:cw_core/root_dir.dart'; import 'package:cw_core/root_dir.dart';
import 'package:cake_wallet/utils/device_info.dart'; import 'package:cake_wallet/utils/device_info.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_type.dart'; import 'package:cw_core/wallet_type.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
@ -110,11 +111,11 @@ class BackupService {
for (var ignore in ignoreFiles) { for (var ignore in ignoreFiles) {
final filename = entity.absolute.path; final filename = entity.absolute.path;
if (filename.endsWith(ignore) && !filename.contains("wallets/")) { if (filename.endsWith(ignore) && !filename.contains("wallets/")) {
print("ignoring backup file: $filename"); printV("ignoring backup file: $filename");
return; return;
} }
} }
print("restoring: $filename"); printV("restoring: $filename");
if (entity.statSync().type == FileSystemEntityType.directory) { if (entity.statSync().type == FileSystemEntityType.directory) {
zipEncoder.addDirectory(Directory(entity.path)); zipEncoder.addDirectory(Directory(entity.path));
} else { } else {
@ -175,11 +176,11 @@ class BackupService {
final filename = file.name; final filename = file.name;
for (var ignore in ignoreFiles) { for (var ignore in ignoreFiles) {
if (filename.endsWith(ignore) && !filename.contains("wallets/")) { if (filename.endsWith(ignore) && !filename.contains("wallets/")) {
print("ignoring backup file: $filename"); printV("ignoring backup file: $filename");
continue outer; continue outer;
} }
} }
print("restoring: $filename"); printV("restoring: $filename");
if (file.isFile) { if (file.isFile) {
final content = file.content as List<int>; final content = file.content as List<int>;
File('${appDir.path}/' + filename) File('${appDir.path}/' + filename)
@ -193,7 +194,7 @@ class BackupService {
await _verifyWallets(); await _verifyWallets();
await _importKeychainDumpV2(password); await _importKeychainDumpV2(password);
await _importPreferencesDump(); await _importPreferencesDump();
await _importTransactionDescriptionDump(); await _importTransactionDescriptionDump(); // HiveError: Box has already been closed
} }
Future<void> _verifyWallets() async { Future<void> _verifyWallets() async {

View file

@ -8,6 +8,7 @@ import 'package:cake_wallet/src/screens/wallet_connect/widgets/message_display_w
import 'package:cake_wallet/core/wallet_connect/models/connection_model.dart'; import 'package:cake_wallet/core/wallet_connect/models/connection_model.dart';
import 'package:cake_wallet/src/screens/wallet_connect/widgets/connection_widget.dart'; import 'package:cake_wallet/src/screens/wallet_connect/widgets/connection_widget.dart';
import 'package:cake_wallet/src/screens/wallet_connect/widgets/modals/web3_request_modal.dart'; import 'package:cake_wallet/src/screens/wallet_connect/widgets/modals/web3_request_modal.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:solana/base58.dart'; import 'package:solana/base58.dart';
import 'package:solana/solana.dart'; import 'package:solana/solana.dart';
import 'package:walletconnect_flutter_v2/walletconnect_flutter_v2.dart'; import 'package:walletconnect_flutter_v2/walletconnect_flutter_v2.dart';
@ -127,7 +128,7 @@ class SolanaChainServiceImpl implements ChainService {
commitment: Commitment.confirmed, commitment: Commitment.confirmed,
); );
print(signature); printV(signature);
bottomSheetService.queueBottomSheet( bottomSheetService.queueBottomSheet(
isModalDismissible: true, isModalDismissible: true,
@ -165,7 +166,7 @@ class SolanaChainServiceImpl implements ChainService {
try { try {
sign = await ownerKeyPair?.sign(base58decode(solanaSignMessage.message)); sign = await ownerKeyPair?.sign(base58decode(solanaSignMessage.message));
} catch (e) { } catch (e) {
print(e); printV(e);
} }
if (sign == null) { if (sign == null) {

View file

@ -17,6 +17,7 @@ import 'package:cake_wallet/src/screens/wallet_connect/widgets/connection_reques
import 'package:cake_wallet/src/screens/wallet_connect/widgets/message_display_widget.dart'; import 'package:cake_wallet/src/screens/wallet_connect/widgets/message_display_widget.dart';
import 'package:cake_wallet/src/screens/wallet_connect/widgets/modals/web3_request_modal.dart'; import 'package:cake_wallet/src/screens/wallet_connect/widgets/modals/web3_request_modal.dart';
import 'package:cake_wallet/store/app_store.dart'; import 'package:cake_wallet/store/app_store.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_type.dart'; import 'package:cw_core/wallet_type.dart';
import 'package:eth_sig_util/eth_sig_util.dart'; import 'package:eth_sig_util/eth_sig_util.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -260,7 +261,7 @@ abstract class Web3WalletServiceBase with Store {
@action @action
void _refreshPairings() { void _refreshPairings() {
print('Refreshing pairings'); printV('Refreshing pairings');
pairings.clear(); pairings.clear();
final allPairings = _web3Wallet.pairings.getAll(); final allPairings = _web3Wallet.pairings.getAll();
@ -397,10 +398,10 @@ abstract class Web3WalletServiceBase with Store {
// Get all pairing topics attached to this key // Get all pairing topics attached to this key
final pairingTopicsForWallet = getPairingTopicsForWallet(key); final pairingTopicsForWallet = getPairingTopicsForWallet(key);
print(pairingTopicsForWallet); printV(pairingTopicsForWallet);
bool isPairingTopicAlreadySaved = pairingTopicsForWallet.contains(pairingTopic); bool isPairingTopicAlreadySaved = pairingTopicsForWallet.contains(pairingTopic);
print('Is Pairing Topic Saved: $isPairingTopicAlreadySaved'); printV('Is Pairing Topic Saved: $isPairingTopicAlreadySaved');
if (!isPairingTopicAlreadySaved) { if (!isPairingTopicAlreadySaved) {
// Update the list with the most recent pairing topic // Update the list with the most recent pairing topic

View file

@ -12,6 +12,7 @@ import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
import 'package:cake_wallet/utils/exception_handler.dart'; import 'package:cake_wallet/utils/exception_handler.dart';
import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:cw_core/cake_hive.dart'; import 'package:cw_core/cake_hive.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_info.dart';
import 'package:cw_core/wallet_service.dart'; import 'package:cw_core/wallet_service.dart';
@ -97,7 +98,7 @@ class WalletLoadingService {
// if found a wallet that is not corrupted, then still display the seeds of the corrupted ones // if found a wallet that is not corrupted, then still display the seeds of the corrupted ones
authenticatedErrorStreamController.add(corruptedWalletsSeeds); authenticatedErrorStreamController.add(corruptedWalletsSeeds);
} catch (e) { } catch (e) {
print(e); printV(e);
// save seeds and show corrupted wallets' seeds to the user // save seeds and show corrupted wallets' seeds to the user
try { try {
final seeds = await _getCorruptedWalletSeeds(walletInfo.name, walletInfo.type); final seeds = await _getCorruptedWalletSeeds(walletInfo.name, walletInfo.type);

View file

@ -8,6 +8,7 @@ import 'package:cake_wallet/utils/feature_flag.dart';
import 'package:cake_wallet/view_model/settings/sync_mode.dart'; import 'package:cake_wallet/view_model/settings/sync_mode.dart';
import 'package:cake_wallet/view_model/wallet_list/wallet_list_item.dart'; import 'package:cake_wallet/view_model/wallet_list/wallet_list_item.dart';
import 'package:cake_wallet/view_model/wallet_list/wallet_list_view_model.dart'; import 'package:cake_wallet/view_model/wallet_list/wallet_list_view_model.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/wallet_type.dart'; import 'package:cw_core/wallet_type.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
@ -83,8 +84,8 @@ void callbackDispatcher() {
return Future.value(true); return Future.value(true);
} catch (error, stackTrace) { } catch (error, stackTrace) {
print(error); printV(error);
print(stackTrace); printV(stackTrace);
return Future.error(error); return Future.error(error);
} }
}); });
@ -149,8 +150,8 @@ class BackgroundTasks {
constraints: constraints, constraints: constraints,
); );
} catch (error, stackTrace) { } catch (error, stackTrace) {
print(error); printV(error);
print(stackTrace); printV(stackTrace);
} }
} }
@ -158,8 +159,8 @@ class BackgroundTasks {
try { try {
Workmanager().cancelByUniqueName(moneroSyncTaskKey); Workmanager().cancelByUniqueName(moneroSyncTaskKey);
} catch (error, stackTrace) { } catch (error, stackTrace) {
print(error); printV(error);
print(stackTrace); printV(stackTrace);
} }
} }
} }

View file

@ -1,3 +1,4 @@
import 'package:cw_core/utils/print_verbose.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_local_authentication/flutter_local_authentication.dart'; import 'package:flutter_local_authentication/flutter_local_authentication.dart';
@ -9,7 +10,7 @@ class BiometricAuth {
final authenticated = await _flutterLocalAuthenticationPlugin.authenticate(); final authenticated = await _flutterLocalAuthenticationPlugin.authenticate();
return authenticated; return authenticated;
} catch (e) { } catch (e) {
print(e); printV(e);
} }
return false; return false;
} }
@ -20,7 +21,7 @@ class BiometricAuth {
canAuthenticate = await _flutterLocalAuthenticationPlugin.canAuthenticate(); canAuthenticate = await _flutterLocalAuthenticationPlugin.canAuthenticate();
await _flutterLocalAuthenticationPlugin.setTouchIDAuthenticationAllowableReuseDuration(0); await _flutterLocalAuthenticationPlugin.setTouchIDAuthenticationAllowableReuseDuration(0);
} catch (error) { } catch (error) {
print("Exception checking support. $error"); printV("Exception checking support. $error");
canAuthenticate = false; canAuthenticate = false;
} }

View file

@ -7,6 +7,7 @@ import 'package:cake_wallet/entities/fiat_api_mode.dart';
import 'package:cw_core/pathForWallet.dart'; import 'package:cw_core/pathForWallet.dart';
import 'package:cake_wallet/entities/secret_store_key.dart'; import 'package:cake_wallet/entities/secret_store_key.dart';
import 'package:cw_core/root_dir.dart'; import 'package:cw_core/root_dir.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:cake_wallet/entities/preferences_key.dart'; import 'package:cake_wallet/entities/preferences_key.dart';
@ -306,7 +307,7 @@ Future<void> defaultSettingsMigration(
await sharedPreferences.setInt( await sharedPreferences.setInt(
PreferencesKey.currentDefaultSettingsMigrationVersion, version); PreferencesKey.currentDefaultSettingsMigrationVersion, version);
} catch (e) { } catch (e) {
print('Migration error: ${e.toString()}'); printV('Migration error: ${e.toString()}');
} }
}); });
@ -729,7 +730,7 @@ Future<void> insecureStorageMigration({
await secureStorage.write( await secureStorage.write(
key: SecureKey.lastAuthTimeMilliseconds, value: lastAuthTimeMilliseconds.toString()); key: SecureKey.lastAuthTimeMilliseconds, value: lastAuthTimeMilliseconds.toString());
} catch (e) { } catch (e) {
print("Error migrating shared preferences to secure storage!: $e"); printV("Error migrating shared preferences to secure storage!: $e");
// this actually shouldn't be that big of a problem since we don't delete the old keys in this update // this actually shouldn't be that big of a problem since we don't delete the old keys in this update
// and we read and write to the new locations when loading storage, the migration is just for extra safety // and we read and write to the new locations when loading storage, the migration is just for extra safety
} }
@ -902,7 +903,7 @@ Future<void> addAddressesForMoneroWallets(Box<WalletInfo> walletInfoSource) asyn
info.address = addressText; info.address = addressText;
await info.save(); await info.save();
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
} }
}); });
} }

View file

@ -1,5 +1,6 @@
import 'package:cake_wallet/ethereum/ethereum.dart'; import 'package:cake_wallet/ethereum/ethereum.dart';
import 'package:cake_wallet/polygon/polygon.dart'; import 'package:cake_wallet/polygon/polygon.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/wallet_type.dart'; import 'package:cw_core/wallet_type.dart';
import 'package:ens_dart/ens_dart.dart'; import 'package:ens_dart/ens_dart.dart';
@ -47,7 +48,7 @@ class EnsRecord {
final addr = await ens.withName(name).getAddress(); final addr = await ens.withName(name).getAddress();
return addr.hex; return addr.hex;
} catch (e) { } catch (e) {
print(e); printV(e);
return ""; return "";
} }
} }

View file

@ -2,6 +2,7 @@ import 'dart:io';
import 'dart:convert'; import 'dart:convert';
import 'package:cake_wallet/core/secure_storage.dart'; import 'package:cake_wallet/core/secure_storage.dart';
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
@ -171,7 +172,7 @@ Future<void> ios_migrate_wallet_passwords() async {
await keyService.saveWalletPassword(walletName: name, password: password!); await keyService.saveWalletPassword(walletName: name, password: password!);
} }
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
} }
}); });
@ -326,7 +327,7 @@ Future<void> ios_migrate_wallet_info(Box<WalletInfo> walletsInfoSource) async {
return walletInfo; return walletInfo;
} }
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
return null; return null;
} }
}) })
@ -336,7 +337,7 @@ Future<void> ios_migrate_wallet_info(Box<WalletInfo> walletsInfoSource) async {
await walletsInfoSource.addAll(infoRecords); await walletsInfoSource.addAll(infoRecords);
await prefs.setBool('ios_migration_wallet_info_completed', true); await prefs.setBool('ios_migration_wallet_info_completed', true);
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
} }
} }
@ -403,7 +404,7 @@ Future<void> ios_migrate_trades_list(Box<Trade> tradeSource) async {
await tradeSource.addAll(trades); await tradeSource.addAll(trades);
await prefs.setBool('ios_migration_trade_list_completed', true); await prefs.setBool('ios_migration_trade_list_completed', true);
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
} }
} }
@ -437,6 +438,6 @@ Future<void> ios_migrate_address_book(Box<Contact> contactSource) async {
await contactSource.addAll(contacts); await contactSource.addAll(contacts);
await prefs.setBool('ios_migration_address_book_completed', true); await prefs.setBool('ios_migration_address_book_completed', true);
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
} }
} }

View file

@ -1,4 +1,5 @@
import 'package:basic_utils/basic_utils.dart'; import 'package:basic_utils/basic_utils.dart';
import 'package:cw_core/utils/print_verbose.dart';
class OpenaliasRecord { class OpenaliasRecord {
OpenaliasRecord({ OpenaliasRecord({
@ -27,7 +28,7 @@ class OpenaliasRecord {
return txtRecord; return txtRecord;
} catch (e) { } catch (e) {
print("${e.toString()}"); printV("${e.toString()}");
return null; return null;
} }
} }

View file

@ -11,6 +11,7 @@ import 'package:cake_wallet/nostr/nostr_api.dart';
import 'package:cake_wallet/store/settings_store.dart'; import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/twitter/twitter_api.dart'; import 'package:cake_wallet/twitter/twitter_api.dart';
import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/wallet_type.dart'; import 'package:cw_core/wallet_type.dart';
import 'package:cake_wallet/entities/fio_address_provider.dart'; import 'package:cake_wallet/entities/fio_address_provider.dart';
@ -283,7 +284,7 @@ class AddressResolver {
} }
} }
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
} }
return ParsedAddress(addresses: [text]); return ParsedAddress(addresses: [text]);

View file

@ -93,6 +93,7 @@ class PreferencesKey {
static const donationLinkWalletName = 'donation_link_wallet_name'; static const donationLinkWalletName = 'donation_link_wallet_name';
static const lastSeenAppVersion = 'last_seen_app_version'; static const lastSeenAppVersion = 'last_seen_app_version';
static const shouldShowMarketPlaceInDashboard = 'should_show_marketplace_in_dashboard'; static const shouldShowMarketPlaceInDashboard = 'should_show_marketplace_in_dashboard';
static const showAddressBookPopupEnabled = 'show_address_book_popup_enabled';
static const isNewInstall = 'is_new_install'; static const isNewInstall = 'is_new_install';
static const serviceStatusShaKey = 'service_status_sha_key'; static const serviceStatusShaKey = 'service_status_sha_key';
static const walletConnectPairingTopicsList = 'wallet_connect_pairing_topics_list'; static const walletConnectPairingTopicsList = 'wallet_connect_pairing_topics_list';

View file

@ -5,6 +5,7 @@ import 'package:cake_wallet/main.dart';
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart'; import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart'; import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:fast_scanner/fast_scanner.dart'; import 'package:fast_scanner/fast_scanner.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart'; import 'package:flutter/scheduler.dart';
@ -61,7 +62,7 @@ class _BarcodeScannerSimpleState extends State<BarcodeScannerSimple> {
); );
}, },
); );
print(e); printV(e);
} }
} }

View file

@ -1,5 +1,6 @@
import 'dart:convert'; import 'dart:convert';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
Future<String> fetchUnstoppableDomainAddress(String domain, String ticker) async { Future<String> fetchUnstoppableDomainAddress(String domain, String ticker) async {
@ -20,7 +21,7 @@ Future<String> fetchUnstoppableDomainAddress(String domain, String ticker) async
return records[key] as String? ?? ''; return records[key] as String? ?? '';
} catch (e) { } catch (e) {
print('Unstoppable domain error: ${e.toString()}'); printV('Unstoppable domain error: ${e.toString()}');
address = ''; address = '';
} }

View file

@ -205,7 +205,7 @@ class CWEthereum extends Ethereum {
try { try {
return await hardwareWalletService.getAvailableAccounts(index: index, limit: limit); return await hardwareWalletService.getAvailableAccounts(index: index, limit: limit);
} catch (err) { } catch (err) {
print(err); printV(err);
throw err; throw err;
} }
} }

View file

@ -15,6 +15,7 @@ import 'package:cake_wallet/utils/device_info.dart';
import 'package:cake_wallet/utils/distribution_info.dart'; import 'package:cake_wallet/utils/distribution_info.dart';
import 'package:cake_wallet/wallet_type_utils.dart'; import 'package:cake_wallet/wallet_type_utils.dart';
import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:http/http.dart'; import 'package:http/http.dart';
class ChangeNowExchangeProvider extends ExchangeProvider { class ChangeNowExchangeProvider extends ExchangeProvider {
@ -127,7 +128,7 @@ class ChangeNowExchangeProvider extends ExchangeProvider {
return isReverse ? (amount / fromAmount) : (toAmount / amount); return isReverse ? (amount / fromAmount) : (toAmount / amount);
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
return 0.0; return 0.0;
} }
} }

View file

@ -10,6 +10,7 @@ import 'package:cake_wallet/exchange/trade_request.dart';
import 'package:cake_wallet/exchange/trade_state.dart'; import 'package:cake_wallet/exchange/trade_state.dart';
import 'package:cake_wallet/exchange/utils/currency_pairs_utils.dart'; import 'package:cake_wallet/exchange/utils/currency_pairs_utils.dart';
import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:http/http.dart'; import 'package:http/http.dart';
class ExolixExchangeProvider extends ExchangeProvider { class ExolixExchangeProvider extends ExchangeProvider {
@ -124,7 +125,7 @@ class ExolixExchangeProvider extends ExchangeProvider {
return responseJSON['rate'] as double; return responseJSON['rate'] as double;
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
return 0.0; return 0.0;
} }
} }

View file

@ -11,6 +11,7 @@ import 'package:cake_wallet/exchange/trade_request.dart';
import 'package:cake_wallet/exchange/trade_state.dart'; import 'package:cake_wallet/exchange/trade_state.dart';
import 'package:cake_wallet/exchange/utils/currency_pairs_utils.dart'; import 'package:cake_wallet/exchange/utils/currency_pairs_utils.dart';
import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:http/http.dart'; import 'package:http/http.dart';
class QuantexExchangeProvider extends ExchangeProvider { class QuantexExchangeProvider extends ExchangeProvider {
@ -86,7 +87,7 @@ class QuantexExchangeProvider extends ExchangeProvider {
// coin not found: // coin not found:
return Limits(min: 0, max: 0); return Limits(min: 0, max: 0);
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
return Limits(min: 0, max: 0); return Limits(min: 0, max: 0);
} }
} }
@ -121,7 +122,7 @@ class QuantexExchangeProvider extends ExchangeProvider {
double rate = double.parse(data['price'].toString()); double rate = double.parse(data['price'].toString());
return rate; return rate;
} catch (e) { } catch (e) {
print("error fetching rate: ${e.toString()}"); printV("error fetching rate: ${e.toString()}");
return 0.0; return 0.0;
} }
} }
@ -178,7 +179,7 @@ class QuantexExchangeProvider extends ExchangeProvider {
isSendAll: isSendAll, isSendAll: isSendAll,
); );
} catch (e) { } catch (e) {
print("error creating trade: ${e.toString()}"); printV("error creating trade: ${e.toString()}");
throw TradeNotCreatedException(description, description: e.toString()); throw TradeNotCreatedException(description, description: e.toString());
} }
} }
@ -225,7 +226,7 @@ class QuantexExchangeProvider extends ExchangeProvider {
state: state, state: state,
); );
} catch (e) { } catch (e) {
print("error getting trade: ${e.toString()}"); printV("error getting trade: ${e.toString()}");
throw TradeNotFoundException( throw TradeNotFoundException(
id, id,
provider: description, provider: description,

View file

@ -8,6 +8,7 @@ import 'package:cake_wallet/exchange/trade_request.dart';
import 'package:cake_wallet/exchange/trade_state.dart'; import 'package:cake_wallet/exchange/trade_state.dart';
import 'package:cake_wallet/exchange/utils/currency_pairs_utils.dart'; import 'package:cake_wallet/exchange/utils/currency_pairs_utils.dart';
import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
@ -86,7 +87,7 @@ class ThorChainExchangeProvider extends ExchangeProvider {
return _thorChainAmountToDouble(expectedAmountOut) / amount; return _thorChainAmountToDouble(expectedAmountOut) / amount;
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
return 0.0; return 0.0;
} }
} }

View file

@ -9,6 +9,7 @@ import 'package:cake_wallet/exchange/trade_request.dart';
import 'package:cake_wallet/exchange/trade_state.dart'; import 'package:cake_wallet/exchange/trade_state.dart';
import 'package:cake_wallet/exchange/utils/currency_pairs_utils.dart'; import 'package:cake_wallet/exchange/utils/currency_pairs_utils.dart';
import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:http/http.dart'; import 'package:http/http.dart';
class TrocadorExchangeProvider extends ExchangeProvider { class TrocadorExchangeProvider extends ExchangeProvider {
@ -148,7 +149,7 @@ class TrocadorExchangeProvider extends ExchangeProvider {
return isReceiveAmount ? (amount / fromAmount) : (toAmount / amount); return isReceiveAmount ? (amount / fromAmount) : (toAmount / amount);
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
return 0.0; return 0.0;
} }
} }

View file

@ -1,4 +1,5 @@
import 'dart:convert'; import 'dart:convert';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:cake_wallet/mastodon/mastodon_user.dart'; import 'package:cake_wallet/mastodon/mastodon_user.dart';
@ -27,7 +28,7 @@ class MastodonAPI {
return MastodonUser.fromJson(responseJSON); return MastodonUser.fromJson(responseJSON);
} catch (e) { } catch (e) {
print('Error in lookupUserByUserName: $e'); printV('Error in lookupUserByUserName: $e');
return null; return null;
} }
} }
@ -56,7 +57,7 @@ class MastodonAPI {
return responseJSON.map((json) => PinnedPost.fromJson(json as Map<String, dynamic>)).toList(); return responseJSON.map((json) => PinnedPost.fromJson(json as Map<String, dynamic>)).toList();
} catch (e) { } catch (e) {
print('Error in getPinnedPosts: $e'); printV('Error in getPinnedPosts: $e');
throw e; throw e;
} }
} }

View file

@ -249,7 +249,7 @@ class CWNanoUtil extends NanoUtil {
try { try {
mnemonic = NanoDerivations.standardSeedToMnemonic(seedKey); mnemonic = NanoDerivations.standardSeedToMnemonic(seedKey);
} catch (e) { } catch (e) {
print("not a valid 'nano' seed key"); printV("not a valid 'nano' seed key");
} }
} }
if (derivationType == DerivationType.bip39) { if (derivationType == DerivationType.bip39) {
@ -306,7 +306,7 @@ class CWNanoUtil extends NanoUtil {
try { try {
mnemonic = NanoDerivations.standardSeedToMnemonic(seedKey!); mnemonic = NanoDerivations.standardSeedToMnemonic(seedKey!);
} catch (e) { } catch (e) {
print("not a valid 'nano' seed key"); printV("not a valid 'nano' seed key");
} }
} }

View file

@ -5,6 +5,7 @@ import 'package:cake_wallet/nostr/nostr_user.dart';
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart'; import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
import 'package:cake_wallet/src/widgets/picker.dart'; import 'package:cake_wallet/src/widgets/picker.dart';
import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:nostr_tools/nostr_tools.dart'; import 'package:nostr_tools/nostr_tools.dart';
@ -83,7 +84,7 @@ class NostrProfileHandler {
relay.close(); relay.close();
return null; return null;
} catch (e) { } catch (e) {
print('[!] Error with relay $relayUrl: $e'); printV('[!] Error with relay $relayUrl: $e');
return null; return null;
} }
} }
@ -115,7 +116,7 @@ class NostrProfileHandler {
var uri = Uri.parse(relayUrl); var uri = Uri.parse(relayUrl);
return uri.host; return uri.host;
} catch (e) { } catch (e) {
print('Error parsing URL: $e'); printV('Error parsing URL: $e');
return ''; return '';
} }
} }

View file

@ -204,7 +204,7 @@ class CWPolygon extends Polygon {
try { try {
return await hardwareWalletService.getAvailableAccounts(index: index, limit: limit); return await hardwareWalletService.getAvailableAccounts(index: index, limit: limit);
} catch (err) { } catch (err) {
print(err); printV(err);
throw err; throw err;
} }
} }

View file

@ -1,6 +1,7 @@
import 'dart:async'; import 'dart:async';
import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/sync_status.dart'; import 'package:cw_core/sync_status.dart';
import 'package:cw_core/wallet_type.dart'; import 'package:cw_core/wallet_type.dart';
@ -36,7 +37,7 @@ void startCheckConnectionReaction(WalletBase wallet, SettingsStore settingsStore
} }
} }
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
} }
}); });
} }

View file

@ -12,6 +12,7 @@ import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/tron/tron.dart'; import 'package:cake_wallet/tron/tron.dart';
import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/erc20_token.dart'; import 'package:cw_core/erc20_token.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_type.dart'; import 'package:cw_core/wallet_type.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
@ -74,7 +75,7 @@ Future<void> startFiatRateUpdate(
} }
} }
} catch (e) { } catch (e) {
print(e); printV(e);
} }
}; };

View file

@ -1,3 +1,4 @@
import 'package:cw_core/utils/print_verbose.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
import 'package:cw_core/node.dart'; import 'package:cw_core/node.dart';
import 'package:cake_wallet/store/app_store.dart'; import 'package:cake_wallet/store/app_store.dart';
@ -10,14 +11,14 @@ void startOnCurrentNodeChangeReaction(AppStore appStore) {
try { try {
await appStore.wallet!.connectToNode(node: change.newValue!); await appStore.wallet!.connectToNode(node: change.newValue!);
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
} }
}); });
appStore.settingsStore.powNodes.observe((change) async { appStore.settingsStore.powNodes.observe((change) async {
try { try {
await appStore.wallet!.connectToPowNode(node: change.newValue!); await appStore.wallet!.connectToPowNode(node: change.newValue!);
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
} }
}); });
} }

View file

@ -10,6 +10,7 @@ import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/transaction_history.dart'; import 'package:cw_core/transaction_history.dart';
import 'package:cw_core/balance.dart'; import 'package:cw_core/balance.dart';
import 'package:cw_core/transaction_info.dart'; import 'package:cw_core/transaction_info.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
import 'package:cake_wallet/reactions/check_connection.dart'; import 'package:cake_wallet/reactions/check_connection.dart';
import 'package:cake_wallet/reactions/on_wallet_sync_status_change.dart'; import 'package:cake_wallet/reactions/on_wallet_sync_status_change.dart';
@ -47,7 +48,7 @@ void startCurrentWalletChangeReaction(
// appStore.wallet.walletInfo.yatLastUsedAddress = address; // appStore.wallet.walletInfo.yatLastUsedAddress = address;
// await appStore.wallet.walletInfo.save(); // await appStore.wallet.walletInfo.save();
//} catch (e) { //} catch (e) {
// print(e.toString()); // printV(e.toString());
//} //}
//}); //});
@ -96,7 +97,7 @@ void startCurrentWalletChangeReaction(
} }
} }
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
} }
}); });
@ -143,7 +144,7 @@ void startCurrentWalletChangeReaction(
} }
} }
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
} }
}); });
} }

View file

@ -1,6 +1,7 @@
import 'package:cake_wallet/entities/update_haven_rate.dart'; import 'package:cake_wallet/entities/update_haven_rate.dart';
import 'package:cake_wallet/entities/update_salvium_rate.dart'; import 'package:cake_wallet/entities/update_salvium_rate.dart';
import 'package:cake_wallet/store/dashboard/fiat_conversion_store.dart'; import 'package:cake_wallet/store/dashboard/fiat_conversion_store.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_type.dart'; import 'package:cw_core/wallet_type.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
import 'package:cw_core/transaction_history.dart'; import 'package:cw_core/transaction_history.dart';
@ -36,7 +37,7 @@ void startWalletSyncStatusChangeReaction(
await WakelockPlus.disable(); await WakelockPlus.disable();
} }
} catch (e) { } catch (e) {
print(e.toString()); printV(e.toString());
} }
}); });
} }

View file

@ -5,6 +5,7 @@ import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/store/dashboard/orders_store.dart'; import 'package:cake_wallet/store/dashboard/orders_store.dart';
import 'package:cake_wallet/view_model/buy/buy_view_model.dart'; import 'package:cake_wallet/view_model/buy/buy_view_model.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart';
@ -103,7 +104,7 @@ class BuyWebViewPageBodyState extends State<BuyWebViewPageBody> {
} }
} catch (e) { } catch (e) {
_isSaving = false; _isSaving = false;
print(e); printV(e);
} }
}); });
} }

View file

@ -10,6 +10,7 @@ import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'package:cake_wallet/themes/extensions/wallet_list_theme.dart'; import 'package:cake_wallet/themes/extensions/wallet_list_theme.dart';
import 'package:cake_wallet/utils/responsive_layout_util.dart'; import 'package:cake_wallet/utils/responsive_layout_util.dart';
import 'package:cake_wallet/view_model/hardware_wallet/ledger_view_model.dart'; import 'package:cake_wallet/view_model/hardware_wallet/ledger_view_model.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_type.dart'; import 'package:cw_core/wallet_type.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:flutter_mobx/flutter_mobx.dart';
@ -127,7 +128,7 @@ class ConnectDevicePageBodyState extends State<ConnectDevicePageBody> {
_bleRefreshTimer = null; _bleRefreshTimer = null;
} }
} catch (e) { } catch (e) {
print(e); printV(e);
} }
} }

View file

@ -223,10 +223,10 @@
// setState(() => status = "Sending..."); // setState(() => status = "Sending...");
// final acc = await func(); // final acc = await func();
// setState(() => status = "$method: $acc"); // setState(() => status = "$method: $acc");
// print("$method: $acc"); // printV("$method: $acc");
// } on LedgerException catch (ex) { // } on LedgerException catch (ex) {
// setState(() => status = "${ex.errorCode.toRadixString(16)} ${ex.message}"); // setState(() => status = "${ex.errorCode.toRadixString(16)} ${ex.message}");
// print("${ex.errorCode.toRadixString(16)} ${ex.message}"); // printV("${ex.errorCode.toRadixString(16)} ${ex.message}");
// } // }
// }, // },
// color: Theme.of(context).primaryColor, // color: Theme.of(context).primaryColor,

View file

@ -322,6 +322,7 @@ class _ContactListBodyState extends State<ContactListBody> {
? widget.contactListViewModel.contacts ? widget.contactListViewModel.contacts
: widget.contactListViewModel.contactsToShow; : widget.contactListViewModel.contactsToShow;
return Scaffold( return Scaffold(
backgroundColor: Theme.of(context).colorScheme.background,
body: Container( body: Container(
child: FilteredList( child: FilteredList(
list: contacts, list: contacts,

View file

@ -7,6 +7,7 @@ import 'package:cake_wallet/src/widgets/dashboard_card_widget.dart';
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart'; import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart'; import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_type.dart'; import 'package:cw_core/wallet_type.dart';
import 'package:cake_wallet/view_model/dashboard/cake_features_view_model.dart'; import 'package:cake_wallet/view_model/dashboard/cake_features_view_model.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -105,7 +106,7 @@ class CakeFeaturesPage extends StatelessWidget {
mode: LaunchMode.externalApplication, mode: LaunchMode.externalApplication,
); );
} catch (e) { } catch (e) {
print(e); printV(e);
} }
} }

View file

@ -4,6 +4,7 @@ import 'package:cake_wallet/core/auth_service.dart';
import 'package:cake_wallet/core/totp_request_details.dart'; import 'package:cake_wallet/core/totp_request_details.dart';
import 'package:cake_wallet/utils/device_info.dart'; import 'package:cake_wallet/utils/device_info.dart';
import 'package:cake_wallet/view_model/link_view_model.dart'; import 'package:cake_wallet/view_model/link_view_model.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/wallet_type.dart'; import 'package:cw_core/wallet_type.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -91,7 +92,7 @@ class RootState extends State<Root> with WidgetsBindingObserver {
handleDeepLinking(await getInitialUri()); handleDeepLinking(await getInitialUri());
} catch (e) { } catch (e) {
print(e); printV(e);
} }
} }

View file

@ -28,6 +28,7 @@ import 'package:cake_wallet/utils/request_review_handler.dart';
import 'package:cake_wallet/utils/responsive_layout_util.dart'; import 'package:cake_wallet/utils/responsive_layout_util.dart';
import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:cake_wallet/view_model/send/output.dart'; import 'package:cake_wallet/view_model/send/output.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/unspent_coin_type.dart'; import 'package:cw_core/unspent_coin_type.dart';
import 'package:cw_core/wallet_type.dart'; import 'package:cw_core/wallet_type.dart';
import 'package:cake_wallet/view_model/send/send_view_model.dart'; import 'package:cake_wallet/view_model/send/send_view_model.dart';
@ -524,14 +525,14 @@ class SendPage extends BasePage {
? '. ${S.of(_dialogContext).waitFewSecondForTxUpdate}' ? '. ${S.of(_dialogContext).waitFewSecondForTxUpdate}'
: ''; : '';
final newContactMessage = newContactAddress != null final newContactMessage = newContactAddress != null && sendViewModel.showAddressBookPopup
? '\n${S.of(_dialogContext).add_contact_to_address_book}' ? '\n${S.of(_dialogContext).add_contact_to_address_book}'
: ''; : '';
String alertContent = String alertContent =
"$successMessage$waitMessage$newContactMessage"; "$successMessage$waitMessage$newContactMessage";
if (newContactAddress != null) { if (newContactMessage.isNotEmpty) {
return AlertWithTwoActions( return AlertWithTwoActions(
alertDialogKey: ValueKey('send_page_sent_dialog_key'), alertDialogKey: ValueKey('send_page_sent_dialog_key'),
alertTitle: '', alertTitle: '',
@ -584,7 +585,7 @@ class SendPage extends BasePage {
mode: LaunchMode.externalApplication, mode: LaunchMode.externalApplication,
); );
} catch (e) { } catch (e) {
print(e); printV(e);
} }
} }
} }

View file

@ -6,6 +6,7 @@ import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/screens/settings/widgets/setting_priority_picker_cell.dart'; import 'package:cake_wallet/src/screens/settings/widgets/setting_priority_picker_cell.dart';
import 'package:cake_wallet/src/screens/settings/widgets/settings_cell_with_arrow.dart'; import 'package:cake_wallet/src/screens/settings/widgets/settings_cell_with_arrow.dart';
import 'package:cake_wallet/src/screens/settings/widgets/settings_picker_cell.dart'; import 'package:cake_wallet/src/screens/settings/widgets/settings_picker_cell.dart';
import 'package:cake_wallet/src/screens/settings/widgets/settings_switcher_cell.dart';
import 'package:cake_wallet/src/screens/settings/widgets/settings_version_cell.dart'; import 'package:cake_wallet/src/screens/settings/widgets/settings_version_cell.dart';
import 'package:cake_wallet/view_model/settings/other_settings_view_model.dart'; import 'package:cake_wallet/view_model/settings/other_settings_view_model.dart';
import 'package:cw_core/wallet_type.dart'; import 'package:cw_core/wallet_type.dart';
@ -62,6 +63,13 @@ class OtherSettingsPage extends BasePage {
handler: (BuildContext context) => handler: (BuildContext context) =>
Navigator.of(context).pushNamed(Routes.readDisclaimer), Navigator.of(context).pushNamed(Routes.readDisclaimer),
), ),
SettingsSwitcherCell(
title: S.of(context).show_address_book_popup,
value: _otherSettingsViewModel.showAddressBookPopup,
onValueChange: (_, bool value) {
_otherSettingsViewModel.setShowAddressBookPopup(value);
},
),
Spacer(), Spacer(),
SettingsVersionCell( SettingsVersionCell(
title: S.of(context).version(_otherSettingsViewModel.currentVersion)), title: S.of(context).version(_otherSettingsViewModel.currentVersion)),

View file

@ -3,6 +3,7 @@ import 'dart:io';
import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/store/app_store.dart'; import 'package:cake_wallet/store/app_store.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// import 'package:tor/tor.dart'; // import 'package:tor/tor.dart';
@ -57,7 +58,7 @@ class _TorPageBodyState extends State<TorPageBody> {
// } // }
// widget.appStore.wallet!.connectToNode(node: node); // widget.appStore.wallet!.connectToNode(node: node);
print('Done awaiting; tor should be running'); printV('Done awaiting; tor should be running');
} }
Future<void> endTor() async { Future<void> endTor() async {
@ -69,7 +70,7 @@ class _TorPageBodyState extends State<TorPageBody> {
// torEnabled = Tor.instance.enabled; // Update flag // torEnabled = Tor.instance.enabled; // Update flag
// }); // });
// //
// print('Done awaiting; tor should be stopped'); // printV('Done awaiting; tor should be stopped');
} }
// //
// @override // @override

View file

@ -3,6 +3,7 @@ import 'package:cake_wallet/core/execution_state.dart';
import 'package:cake_wallet/core/totp_request_details.dart'; import 'package:cake_wallet/core/totp_request_details.dart';
import 'package:cake_wallet/utils/show_bar.dart'; import 'package:cake_wallet/utils/show_bar.dart';
import 'package:cake_wallet/view_model/auth_state.dart'; import 'package:cake_wallet/view_model/auth_state.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
@ -53,7 +54,7 @@ class TotpAuthCodePageState extends State<TotpAuthCodePage> {
} }
if (state is FailureState) { if (state is FailureState) {
print(state.error); printV(state.error);
widget.totpArguments.onTotpAuthenticationFinished!(false, this); widget.totpArguments.onTotpAuthenticationFinished!(false, this);
} }

Some files were not shown because too many files have changed in this diff Show more