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/scripts/monero_c/release
key: ${{ hashFiles('**/prepare_moneroc.sh' ,'**/build_monero_all.sh' ,'**/cache_dependencies.yml') }}
- if: ${{ steps.cache-externals.outputs.cache-hit != 'true' }}
name: Generate Externals
run: |
@ -69,12 +70,16 @@ jobs:
source ./app_env.sh cakewallet
./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
id: cache-keystore
uses: actions/cache@v3
with:
path: /opt/android/cake_wallet/android/app/key.jks
key: $STORE_PASS
path: ${{ env.cache-file-path }}
key: keystore
- if: ${{ steps.cache-keystore.outputs.cache-hit != 'true' }}
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/
./build_mwebd.sh --dont-install
# - name: Cache Keystore
# id: cache-keystore
# uses: actions/cache@v3
# with:
# path: /opt/android/cake_wallet/android/app/key.jks
# key: $STORE_PASS
#
# - if: ${{ steps.cache-keystore.outputs.cache-hit != 'true' }}
- name: Generate KeyStore
- 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
id: cache-keystore
uses: actions/cache@v3
with:
path: ${{ env.cache-file-path }}
key: keystore
- if: ${{ steps.cache-keystore.outputs.cache-hit != 'true' }}
name: Generate KeyStore
run: |
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

View file

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

View file

@ -4,6 +4,7 @@ import 'dart:io';
import 'dart:typed_data';
import 'package:bitcoin_base/bitcoin_base.dart';
import 'package:cw_bitcoin/bitcoin_amount_format.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:flutter/foundation.dart';
import 'package:rxdart/rxdart.dart';
@ -117,17 +118,17 @@ class ElectrumClient {
_parseResponse(message);
}
} catch (e) {
print("socket.listen: $e");
printV("socket.listen: $e");
}
},
onError: (Object error) {
final errorMsg = error.toString();
print(errorMsg);
printV(errorMsg);
unterminatedString = '';
socket = null;
},
onDone: () {
print("SOCKET CLOSED!!!!!");
printV("SOCKET CLOSED!!!!!");
unterminatedString = '';
try {
if (host == socket?.address.host || socket == null) {
@ -136,7 +137,7 @@ class ElectrumClient {
socket = null;
}
} catch (e) {
print("onDone: $e");
printV("onDone: $e");
}
},
cancelOnError: true,
@ -181,7 +182,7 @@ class ElectrumClient {
unterminatedString = '';
}
} catch (e) {
print("parse $e");
printV("parse $e");
}
}
@ -403,7 +404,7 @@ class ElectrumClient {
} on RequestFailedTimeoutException catch (_) {
return null;
} catch (e) {
print("getCurrentBlockChainTip: ${e.toString()}");
printV("getCurrentBlockChainTip: ${e.toString()}");
return null;
}
}
@ -434,7 +435,7 @@ class ElectrumClient {
return subscription;
} catch (e) {
print("subscribe $e");
printV("subscribe $e");
return null;
}
}
@ -473,7 +474,7 @@ class ElectrumClient {
return completer.future;
} catch (e) {
print("callWithTimeout $e");
printV("callWithTimeout $e");
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/transaction_history.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:mobx/mobx.dart';
import 'package:cw_core/transaction_history.dart';
@ -51,7 +52,7 @@ abstract class ElectrumTransactionHistoryBase
final data = json.encode({'height': _height, 'transactions': txjson});
await encryptionFileUtils.write(path: path, password: _password, data: data);
} 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;
} catch (e) {
print(e);
printV(e);
}
}

View file

@ -4,6 +4,8 @@ import 'dart:io';
import 'dart:isolate';
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/litecoin_wallet.dart';
import 'package:shared_preferences/shared_preferences.dart';
@ -479,8 +481,8 @@ abstract class ElectrumWalletBase
syncStatus = SyncedSyncStatus();
}
} catch (e, stacktrace) {
print(stacktrace);
print("startSync $e");
printV(stacktrace);
printV("startSync $e");
syncStatus = FailedSyncStatus();
}
}
@ -506,7 +508,7 @@ abstract class ElectrumWalletBase
_feeRates = [slowFee, mediumFee, fastFee];
return;
} catch (e) {
print(e);
printV(e);
}
}
@ -588,8 +590,8 @@ abstract class ElectrumWalletBase
await electrumClient.connectToUri(node.uri, useSSL: node.useSSL);
} catch (e, stacktrace) {
print(stacktrace);
print("connectToNode $e");
printV(stacktrace);
printV("connectToNode $e");
syncStatus = FailedSyncStatus();
}
}
@ -1492,7 +1494,7 @@ abstract class ElectrumWalletBase
await unspentCoinsInfo.deleteAll(keys);
}
} catch (e) {
print("refreshUnspentCoinsInfo $e");
printV("refreshUnspentCoinsInfo $e");
}
}
@ -1935,7 +1937,7 @@ abstract class ElectrumWalletBase
return historiesWithDetails;
} catch (e) {
print("fetchTransactions $e");
printV("fetchTransactions $e");
return {};
}
}
@ -2059,7 +2061,7 @@ abstract class ElectrumWalletBase
}
Future<void> updateTransactions() async {
print("updateTransactions() called!");
printV("updateTransactions() called!");
try {
if (_isTransactionUpdating) {
return;
@ -2091,8 +2093,8 @@ abstract class ElectrumWalletBase
walletAddresses.updateReceiveAddresses();
_isTransactionUpdating = false;
} catch (e, stacktrace) {
print(stacktrace);
print(e);
printV(stacktrace);
printV(e);
_isTransactionUpdating = false;
}
}
@ -2110,13 +2112,13 @@ abstract class ElectrumWalletBase
try {
await _scripthashesUpdateSubject[sh]?.close();
} catch (e) {
print("failed to close: $e");
printV("failed to close: $e");
}
}
try {
_scripthashesUpdateSubject[sh] = await electrumClient.scripthashUpdate(sh);
} catch (e) {
print("failed scripthashUpdate: $e");
printV("failed scripthashUpdate: $e");
}
_scripthashesUpdateSubject[sh]?.listen((event) async {
try {
@ -2126,7 +2128,7 @@ abstract class ElectrumWalletBase
await _fetchAddressHistory(address, await getCurrentChainTip());
} catch (e, s) {
print("sub error: $e");
printV("sub error: $e");
_onError?.call(FlutterErrorDetails(
exception: e,
stack: s,
@ -2134,7 +2136,7 @@ abstract class ElectrumWalletBase
));
}
}, 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 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();
return balance[currency] ?? ElectrumBalance(confirmed: 0, unconfirmed: 0, frozen: 0);
}
@ -2213,7 +2215,7 @@ abstract class ElectrumWalletBase
}
Future<void> updateBalance() async {
print("updateBalance() called!");
printV("updateBalance() called!");
balance[currency] = await fetchBalances();
await save();
}
@ -2353,7 +2355,7 @@ abstract class ElectrumWalletBase
}
void _syncStatusReaction(SyncStatus syncStatus) async {
print("SYNC_STATUS_CHANGE: ${syncStatus}");
printV("SYNC_STATUS_CHANGE: ${syncStatus}");
if (syncStatus is SyncingSyncStatus) {
return;
}

View file

@ -3,6 +3,8 @@ import 'dart:io' show Platform;
import 'package:bitcoin_base/bitcoin_base.dart';
import 'package:blockchain_utils/blockchain_utils.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_core/wallet_addresses.dart';
import 'package:cw_core/wallet_info.dart';
@ -193,7 +195,7 @@ abstract class ElectrumWalletAddressesBase extends WalletAddresses with Store {
receiveAddresses.remove(addressRecord);
receiveAddresses.insert(0, addressRecord);
} 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();
} 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_core/cake_hive.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_mweb/mwebd.pbgrpc.dart';
import 'package:fixnum/fixnum.dart';
@ -283,7 +284,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
}
Future<void> waitForMwebAddresses() async {
print("waitForMwebAddresses() called!");
printV("waitForMwebAddresses() called!");
// ensure that we have the full 1000 mweb addresses generated before continuing:
// should no longer be needed, but leaving here just in case
await (walletAddresses as LitecoinWalletAddresses).ensureMwebAddressUpToIndexExists(1020);
@ -302,8 +303,8 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
@action
@override
Future<void> startSync() async {
print("startSync() called!");
print("STARTING SYNC - MWEB ENABLED: $mwebEnabled");
printV("startSync() called!");
printV("STARTING SYNC - MWEB ENABLED: $mwebEnabled");
if (!mwebEnabled) {
try {
// 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;
}
print("STARTING SYNC - MWEB ENABLED: $mwebEnabled");
printV("STARTING SYNC - MWEB ENABLED: $mwebEnabled");
_syncTimer?.cancel();
try {
mwebSyncStatus = SyncronizingSyncStatus();
try {
await subscribeForUpdates();
} catch (e) {
print("failed to subcribe for updates: $e");
printV("failed to subcribe for updates: $e");
}
updateFeeRates();
_feeRatesTimer?.cancel();
_feeRatesTimer =
Timer.periodic(const Duration(minutes: 1), (timer) async => await updateFeeRates());
print("START SYNC FUNCS");
printV("START SYNC FUNCS");
await waitForMwebAddresses();
await processMwebUtxos();
await updateTransactions();
await updateUnspent();
await updateBalance();
print("DONE SYNC FUNCS");
} catch (e, s) {
print("mweb sync failed: $e $s");
mwebSyncStatus = FailedSyncStatus(error: "mweb sync failed: $e");
} catch (e) {
printV("failed to start mweb sync: $e");
syncStatus = FailedSyncStatus();
return;
}
_syncTimer?.cancel();
_syncTimer = Timer.periodic(const Duration(milliseconds: 3000), (timer) async {
if (mwebSyncStatus is FailedSyncStatus) {
_syncTimer?.cancel();
@ -401,7 +402,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
for (var coin in tx.unspents!) {
final utxo = mwebUtxosBox.get(coin.address);
if (utxo != null) {
print("deleting utxo ${coin.address} @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
printV("deleting utxo ${coin.address} @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
await mwebUtxosBox.delete(coin.address);
}
}
@ -428,7 +429,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
return;
}
} catch (e) {
print("error syncing: $e");
printV("error syncing: $e");
mwebSyncStatus = FailedSyncStatus(error: e.toString());
}
});
@ -437,12 +438,12 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
@action
@override
Future<void> stopSync() async {
print("stopSync() called!");
printV("stopSync() called!");
_syncTimer?.cancel();
_utxoStream?.cancel();
_feeRatesTimer?.cancel();
await CwMweb.stop();
print("stopped syncing!");
printV("stopped syncing!");
}
Future<void> initMwebUtxosBox() async {
@ -514,7 +515,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
}
Future<void> handleIncoming(MwebUtxo utxo) async {
print("handleIncoming() called!");
printV("handleIncoming() called!");
final status = await CwMweb.status(StatusRequest());
var date = DateTime.now();
var confirmations = 0;
@ -559,7 +560,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
final addressRecord = walletAddresses.allAddresses
.firstWhereOrNull((addressRecord) => addressRecord.address == utxo.address);
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;
}
@ -580,13 +581,13 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
}
Future<void> processMwebUtxos() async {
print("processMwebUtxos() called!");
printV("processMwebUtxos() called!");
if (!mwebEnabled) {
return;
}
int restoreHeight = walletInfo.restoreHeight;
print("SCANNING FROM HEIGHT: $restoreHeight");
printV("SCANNING FROM HEIGHT: $restoreHeight");
final req = UtxosRequest(scanSecret: scanSecret, fromHeight: restoreHeight);
// 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:
final existingUtxo = mwebUtxosBox.get(utxo.outputId);
if (existingUtxo!.height != utxo.height) {
print(
printV(
"updating utxo height for $utxo.outputId: ${existingUtxo.height} -> ${utxo.height}");
existingUtxo.height = utxo.height;
await mwebUtxosBox.put(utxo.outputId, existingUtxo);
@ -644,7 +645,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
await handleIncoming(utxo);
},
onError: (error) {
print("error in utxo stream: $error");
printV("error in utxo stream: $error");
mwebSyncStatus = FailedSyncStatus(error: error.toString());
},
cancelOnError: true,
@ -652,7 +653,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
}
Future<void> deleteSpentUtxos() async {
print("deleteSpentUtxos() called!");
printV("deleteSpentUtxos() called!");
final chainHeight = await electrumClient.getCurrentBlockChainTip();
final status = await CwMweb.status(StatusRequest());
if (chainHeight == null || status.blockHeaderHeight != chainHeight) return;
@ -676,7 +677,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
}
Future<void> checkMwebUtxosSpent() async {
print("checkMwebUtxosSpent() called!");
printV("checkMwebUtxosSpent() called!");
if (!mwebEnabled) {
return;
}
@ -791,7 +792,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
}
Future<void> updateUnspent() async {
print("updateUnspent() called!");
printV("updateUnspent() called!");
await checkMwebUtxosSpent();
await updateAllUnspents();
}
@ -822,7 +823,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
.firstWhereOrNull((addressRecord) => addressRecord.address == utxo.address);
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;
}
final unspent = BitcoinUnspent(
@ -863,7 +864,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
mwebUtxosBox.values.forEach((utxo) {
bool isConfirmed = utxo.height > 0;
print(
printV(
"utxo: ${isConfirmed ? "confirmed" : "unconfirmed"} ${utxo.spent ? "spent" : "unspent"} ${utxo.outputId} ${utxo.height} ${utxo.value}");
if (isConfirmed) {
@ -1001,7 +1002,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
final sum1 = _sumOutputAmounts(outputs.map((e) => e.toOutput).toList()) + fee;
final sum2 = utxos.sumOfUtxosValue();
if (sum1 != sum2) {
print("@@@@@ WE HAD TO ADJUST THE FEE! @@@@@@@@");
printV("@@@@@ WE HAD TO ADJUST THE FEE! @@@@@@@@");
final diff = sum2 - sum1;
// add the difference to the fee (abs value):
fee += diff.abs();
@ -1166,7 +1167,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
addressRecord.balance -= utxo.value.toInt();
});
transaction.inputAddresses?.addAll(addresses);
print("isPegIn: $isPegIn, isPegOut: $isPegOut");
printV("isPegIn: $isPegIn, isPegOut: $isPegOut");
transaction.additionalInfo["isPegIn"] = isPegIn;
transaction.additionalInfo["isPegOut"] = isPegOut;
transactionHistory.addOne(transaction);
@ -1174,10 +1175,10 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
await updateBalance();
});
} catch (e, s) {
print(e);
print(s);
printV(e);
printV(s);
if (e.toString().contains("commit failed")) {
print(e);
printV(e);
throw Exception("Transaction commit failed (no peers responded), please try again.");
}
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/utils.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_mweb/cw_mweb.dart';
import 'package:flutter/foundation.dart';
@ -35,7 +36,7 @@ abstract class LitecoinWalletAddressesBase extends ElectrumWalletAddresses with
for (int i = 0; i < mwebAddresses.length; i++) {
mwebAddrs.add(mwebAddresses[i].address);
}
print("initialized with ${mwebAddrs.length} mweb addresses");
printV("initialized with ${mwebAddrs.length} mweb addresses");
}
final Bip32Slip10Secp256k1? mwebHd;
@ -73,25 +74,25 @@ abstract class LitecoinWalletAddressesBase extends ElectrumWalletAddresses with
}
while (generating) {
print("generating.....");
printV("generating.....");
// this function was called multiple times in multiple places:
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;
try {
while (mwebAddrs.length <= (index + 1)) {
final addresses =
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:
await Future.delayed(Duration(milliseconds: 200));
mwebAddrs.addAll(addresses!);
}
} catch (_) {}
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:
// This is the Case if the Litecoin Wallet is a hardware Wallet
@ -109,7 +110,7 @@ abstract class LitecoinWalletAddressesBase extends ElectrumWalletAddresses with
))
.toList();
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:convert/convert.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:ledger_bitcoin/psbt.dart';
class PSBTTransactionBuild {
@ -16,6 +17,10 @@ class PSBTTransactionBuild {
for (var i = 0; i < inputs.length; 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.setInputOutputIndex(i, input.utxo.vout);
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';
const MethodChannel _channel = MethodChannel('com.cake_wallet/native_utils');
@ -6,17 +7,17 @@ Future<void> requestDisableBatteryOptimization() async {
try {
await _channel.invokeMethod('disableBatteryOptimization');
} on PlatformException catch (e) {
print("Failed to disable battery optimization: '${e.message}'.");
printV("Failed to disable battery optimization: '${e.message}'.");
}
}
Future<bool> isBatteryOptimizationDisabled() async {
try {
final bool isDisabled = await _channel.invokeMethod('isBatteryOptimizationDisabled') as bool;
print('It\'s actually disabled? $isDisabled');
printV('It\'s actually disabled? $isDisabled');
return isDisabled;
} on PlatformException catch (e) {
print("Failed to check battery optimization status: '${e.message}'.");
printV("Failed to check battery optimization status: '${e.message}'.");
return false;
}
}

View file

@ -1,3 +1,4 @@
import 'package:cw_core/utils/print_verbose.dart';
import 'package:intl/intl.dart';
import 'dart:convert';
import 'package:http/http.dart' as http;
@ -152,7 +153,7 @@ int getMoneroHeigthByDate({required DateTime date}) {
height = startHeight + daysHeight - heightPerDay;
}
} catch (e) {
print(e.toString());
printV(e.toString());
}
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/utils/print_verbose.dart';
import 'package:cw_core/wallet_info.dart';
import 'package:cw_core/wallet_type.dart';
@ -71,7 +72,7 @@ abstract class WalletAddresses {
await walletInfo.save();
}
} catch (e) {
print(e.toString());
printV(e.toString());
}
}

View file

@ -1,5 +1,6 @@
import 'dart:io';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:flutter/services.dart';
const MethodChannel _channel = MethodChannel('com.cake_wallet/native_utils');
@ -14,9 +15,9 @@ Future<void> setDefaultMinimumWindowSize() async {
) as bool;
if (!result) {
print("Failed to set minimum window size.");
printV("Failed to set minimum window size.");
}
} 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/sync_status.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_base.dart';
import 'package:cw_core/wallet_info.dart';
@ -200,7 +201,7 @@ abstract class EVMChainWalletBase
} else {
// MaxFeePerGas with gasPrice;
maxFeePerGas = gasPrice;
debugPrint('MaxFeePerGas with gasPrice: $maxFeePerGas');
printV('MaxFeePerGas with gasPrice: $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'
as exception;
import 'package:cw_core/utils/print_verbose.dart';
import 'package:ledger_ethereum/ledger_ethereum.dart';
import 'package:ledger_flutter_plus/ledger_flutter_plus.dart';
import 'package:web3dart/crypto.dart';
@ -96,7 +97,7 @@ class EvmLedgerCredentials extends CredentialsWithKnownAddress {
await ethereumLedgerApp!.getAndProvideERC20TokenInformation(
erc20ContractAddress: erc20ContractAddress, chainId: chainId);
} catch (e) {
print(e);
printV(e);
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:cw_core/account.dart';
import 'package:cw_core/account_list.dart';
@ -77,7 +78,7 @@ abstract class HavenAccountListBase extends AccountList<Account> with Store {
_isRefreshing = false;
} catch (e) {
_isRefreshing = false;
print(e);
printV(e);
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:flutter/services.dart';
import 'package:mobx/mobx.dart';
@ -79,7 +80,7 @@ abstract class HavenSubaddressListBase with Store {
_isRefreshing = false;
} on PlatformException catch (e) {
_isRefreshing = false;
print(e);
printV(e);
rethrow;
}
}

View file

@ -3,6 +3,7 @@ import 'dart:io';
import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/pathForWallet.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_core/monero_amount_format.dart';
import 'package:cw_haven/haven_transaction_creation_exception.dart';
@ -130,7 +131,7 @@ abstract class HavenWalletBase
syncStatus = ConnectedSyncStatus();
} catch (e) {
syncStatus = FailedSyncStatus();
print(e);
printV(e);
}
}
@ -147,7 +148,7 @@ abstract class HavenWalletBase
_listener?.start();
} catch (e) {
syncStatus = FailedSyncStatus();
print(e);
printV(e);
rethrow;
}
}
@ -324,7 +325,7 @@ abstract class HavenWalletBase
await transactionHistory.save();
_isTransactionUpdating = false;
} catch (e) {
print(e);
printV(e);
_isTransactionUpdating = false;
}
}
@ -403,7 +404,7 @@ abstract class HavenWalletBase
syncStatus = SyncingSyncStatus(blocksLeft, ptc);
}
} catch (e) {
print(e.toString());
printV(e.toString());
}
}
@ -413,7 +414,7 @@ abstract class HavenWalletBase
_askForUpdateBalance();
await Future<void>.delayed(Duration(seconds: 1));
} 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_info.dart';
import 'package:cw_core/account.dart';
@ -60,7 +61,7 @@ abstract class HavenWalletAddressesBase extends WalletAddressesWithAccount<Accou
await saveAddressesInBox();
} catch (e) {
print(e.toString());
printV(e.toString());
}
}

View file

@ -1,5 +1,6 @@
import 'dart:io';
import 'package:collection/collection.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/monero_wallet_utils.dart';
import 'package:hive/hive.dart';
@ -81,7 +82,7 @@ class HavenWalletService extends WalletService<
return wallet;
} catch (e) {
// TODO: Implement Exception for wallet list service.
print('HavenWalletsManager Error: ${e.toString()}');
printV('HavenWalletsManager Error: ${e.toString()}');
rethrow;
}
}
@ -93,7 +94,7 @@ class HavenWalletService extends WalletService<
return haven_wallet_manager.isWalletExist(path: path);
} catch (e) {
// TODO: Implement Exception for wallet list service.
print('HavenWalletsManager Error: $e');
printV('HavenWalletsManager Error: $e');
rethrow;
}
}
@ -197,7 +198,7 @@ class HavenWalletService extends WalletService<
return wallet;
} catch (e) {
// TODO: Implement Exception for wallet list service.
print('HavenWalletsManager Error: $e');
printV('HavenWalletsManager Error: $e');
rethrow;
}
}
@ -218,7 +219,7 @@ class HavenWalletService extends WalletService<
return wallet;
} catch (e) {
// TODO: Implement Exception for wallet list service.
print('HavenWalletsManager Error: $e');
printV('HavenWalletsManager Error: $e');
rethrow;
}
}
@ -252,7 +253,7 @@ class HavenWalletService extends WalletService<
newFile.writeAsBytesSync(file.readAsBytesSync());
});
} 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 amounts = outputs.map((e) => monero.Wallet_amountFromString(e.amount)).toList();
// print("multDest: dstAddrs: $dstAddrs");
// print("multDest: amounts: $amounts");
// printV("multDest: dstAddrs: $dstAddrs");
// printV("multDest: amounts: $amounts");
final txptr = monero.Wallet_createTransactionMultDest(
wptr!,

View file

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

View file

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

View file

@ -28,9 +28,9 @@ void enableLedgerExchange(monero.wallet ptr, LedgerConnection connection) {
ptr, emptyPointer.cast<UnsignedChar>(), 0);
malloc.free(emptyPointer);
// print("> ${ledgerRequest.toHexString()}");
// printV("> ${ledgerRequest.toHexString()}");
final response = await exchange(connection, ledgerRequest);
// print("< ${response.toHexString()}");
// printV("< ${response.toHexString()}");
final Pointer<Uint8> result = malloc<Uint8>(response.length);
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/utils/print_verbose.dart';
import 'package:mobx/mobx.dart';
import 'package:cw_core/account.dart';
import 'package:cw_monero/api/account_list.dart' as account_list;
@ -74,7 +75,7 @@ abstract class MoneroAccountListBase with Store {
_isRefreshing = false;
} catch (e) {
_isRefreshing = false;
print(e);
printV(e);
rethrow;
}
}

View file

@ -1,4 +1,5 @@
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/subaddress_list.dart' as subaddress_list;
import 'package:cw_monero/api/wallet.dart';
@ -87,7 +88,7 @@ abstract class MoneroSubaddressListBase with Store {
_isRefreshing = false;
} on PlatformException catch (e) {
_isRefreshing = false;
print(e);
printV(e);
rethrow;
}
}

View file

@ -1,4 +1,5 @@
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:monero/monero.dart' as monero;
@ -10,7 +11,7 @@ class MoneroUnspent extends Unspent {
@override
set isFrozen(bool freeze) {
print("set isFrozen: $freeze ($keyImage): $freeze");
printV("set isFrozen: $freeze ($keyImage): $freeze");
final coinId = getCoinByKeyImage(keyImage!);
if (coinId == null) throw Exception("Unable to find a coin for address $address");
if (freeze) {
@ -22,7 +23,7 @@ class MoneroUnspent extends Unspent {
@override
bool get isFrozen {
print("get isFrozen");
printV("get isFrozen");
final coinId = getCoinByKeyImage(keyImage!);
if (coinId == null) throw Exception("Unable to find a coin for address $address");
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/transaction_direction.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_info.dart';
import 'package:cw_monero/api/account_list.dart';
@ -198,7 +199,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
syncStatus = ConnectedSyncStatus();
} catch (e) {
syncStatus = FailedSyncStatus();
print(e);
printV(e);
}
}
@ -229,7 +230,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
_listener?.start();
} catch (e) {
syncStatus = FailedSyncStatus();
print(e);
printV(e);
rethrow;
}
}
@ -399,8 +400,8 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
try {
await backupWalletFiles(name);
} catch (e) {
print("¯\\_(ツ)_/¯");
print(e);
printV("¯\\_(ツ)_/¯");
printV(e);
}
}
@ -409,7 +410,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
final currentWalletDirPath = await pathForWalletDir(name: name, type: type);
if (openedWalletsByPath["$currentWalletDirPath/$name"] != null) {
// NOTE: this is realistically only required on windows.
print("closing wallet");
printV("closing wallet");
final wmaddr = wmPtr.address;
final waddr = openedWalletsByPath["$currentWalletDirPath/$name"]!.address;
await Isolate.run(() {
@ -417,7 +418,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
Pointer.fromAddress(wmaddr), Pointer.fromAddress(waddr), true);
});
openedWalletsByPath.remove("$currentWalletDirPath/$name");
print("wallet closed");
printV("wallet closed");
}
try {
// -- rename the waller folder --
@ -555,7 +556,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
await _refreshUnspentCoinsInfo();
_askForUpdateBalance();
} catch (e, s) {
print(e.toString());
printV(e.toString());
onError?.call(FlutterErrorDetails(
exception: e,
stack: s,
@ -604,7 +605,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
await unspentCoinsInfo.deleteAll(keys);
}
} catch (e) {
print(e.toString());
printV(e.toString());
}
}
@ -637,7 +638,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
await transactionHistory.save();
_isTransactionUpdating = false;
} catch (e) {
print(e);
printV(e);
_isTransactionUpdating = false;
}
}
@ -784,7 +785,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
syncStatus = SyncingSyncStatus(blocksLeft, ptc);
}
} catch (e) {
print(e.toString());
printV(e.toString());
}
}
@ -794,7 +795,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
_askForUpdateBalance();
await Future<void>.delayed(Duration(seconds: 1));
} catch (e) {
print(e.toString());
printV(e.toString());
}
}

View file

@ -1,6 +1,7 @@
import 'package:cw_core/account.dart';
import 'package:cw_core/address_info.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_info.dart';
import 'package:cw_monero/api/subaddress_list.dart' as subaddress_list;
@ -96,7 +97,7 @@ abstract class MoneroWalletAddressesBase extends WalletAddresses with Store {
await saveAddressesInBox();
} 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/pathForWallet.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_credentials.dart';
import 'package:cw_core/wallet_info.dart';
@ -110,7 +111,7 @@ class MoneroWalletService extends WalletService<
return wallet;
} catch (e) {
// TODO: Implement Exception for wallet list service.
print('MoneroWalletsManager Error: ${e.toString()}');
printV('MoneroWalletsManager Error: ${e.toString()}');
rethrow;
}
}
@ -122,7 +123,7 @@ class MoneroWalletService extends WalletService<
return monero_wallet_manager.isWalletExist(path: path);
} catch (e) {
// TODO: Implement Exception for wallet list service.
print('MoneroWalletsManager Error: $e');
printV('MoneroWalletsManager Error: $e');
rethrow;
}
}
@ -177,7 +178,7 @@ class MoneroWalletService extends WalletService<
final path = await pathForWalletDir(name: wallet, type: getType());
if (openedWalletsByPath["$path/$wallet"] != null) {
// NOTE: this is realistically only required on windows.
print("closing wallet");
printV("closing wallet");
final wmaddr = wmPtr.address;
final waddr = openedWalletsByPath["$path/$wallet"]!.address;
// await Isolate.run(() {
@ -185,7 +186,7 @@ class MoneroWalletService extends WalletService<
Pointer.fromAddress(wmaddr), Pointer.fromAddress(waddr), false);
// });
openedWalletsByPath.remove("$path/$wallet");
print("wallet closed");
printV("wallet closed");
}
final file = Directory(path);
@ -241,7 +242,7 @@ class MoneroWalletService extends WalletService<
return wallet;
} catch (e) {
// TODO: Implement Exception for wallet list service.
print('MoneroWalletsManager Error: $e');
printV('MoneroWalletsManager Error: $e');
rethrow;
}
}
@ -272,7 +273,7 @@ class MoneroWalletService extends WalletService<
return wallet;
} catch (e) {
// TODO: Implement Exception for wallet list service.
print('MoneroWalletsManager Error: $e');
printV('MoneroWalletsManager Error: $e');
rethrow;
}
}
@ -301,7 +302,7 @@ class MoneroWalletService extends WalletService<
return wallet;
} catch (e) {
// TODO: Implement Exception for wallet list service.
print('MoneroWalletsManager Error: $e');
printV('MoneroWalletsManager Error: $e');
rethrow;
}
}
@ -318,7 +319,7 @@ class MoneroWalletService extends WalletService<
path, credentials.password!, polyseed, credentials.walletInfo!, lang);
} catch (e) {
// TODO: Implement Exception for wallet list service.
print('MoneroWalletsManager Error: $e');
printV('MoneroWalletsManager Error: $e');
rethrow;
}
}
@ -381,7 +382,7 @@ class MoneroWalletService extends WalletService<
newFile.writeAsBytesSync(file.readAsBytesSync());
});
} catch (e) {
print(e.toString());
printV(e.toString());
}
}

View file

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

View file

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

View file

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

View file

@ -1,6 +1,7 @@
import 'dart:convert';
import 'dart:core';
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/encryption_file_utils.dart';
import 'package:mobx/mobx.dart';
@ -37,7 +38,7 @@ abstract class NanoTransactionHistoryBase extends TransactionHistoryBase<NanoTra
final data = json.encode({'transactions': transactions});
await encryptionFileUtils.write(path: path, password: _password, data: data);
} 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) {
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/transaction_direction.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_info.dart';
import 'package:cw_core/wallet_keys_file.dart';
@ -170,12 +171,12 @@ abstract class NanoWalletBase
await _updateRep();
await _receiveAll();
} catch (e) {
print(e);
printV(e);
}
syncStatus = ConnectedSyncStatus();
} catch (e) {
print(e);
printV(e);
syncStatus = FailedSyncStatus();
}
}
@ -367,7 +368,7 @@ abstract class NanoWalletBase
syncStatus = SyncedSyncStatus();
} catch (e) {
print(e);
printV(e);
syncStatus = FailedSyncStatus();
rethrow;
}
@ -444,7 +445,7 @@ abstract class NanoWalletBase
try {
balance[currency] = await _client.getBalance(_publicAddress!);
} 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
// otherwise, it's better to just leave it as whatever it was before:
if (balance[currency] == null) {

View file

@ -1,4 +1,5 @@
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_info.dart';
import 'package:cw_core/nano_account.dart';
@ -47,7 +48,7 @@ abstract class NanoWalletAddressesBase extends WalletAddresses with Store {
addressesMap[address] = '';
await saveAddressesInBox();
} 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/node.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_solana/pending_solana_transaction.dart';
import 'package:cw_solana/solana_balance.dart';
import 'package:cw_solana/solana_transaction_model.dart';
@ -529,7 +530,7 @@ class SolanaWalletClient {
return signature;
} catch (e) {
print('Error while sending transaction: ${e.toString()}');
printV('Error while sending transaction: ${e.toString()}');
throw Exception(e);
}
}
@ -546,7 +547,7 @@ class SolanaWalletClient {
return null;
}
} catch (e) {
print('Error occurred while fetching token image: \n${e.toString()}');
printV('Error occurred while fetching token image: \n${e.toString()}');
return null;
}
}

View file

@ -2,6 +2,7 @@ import 'dart:convert';
import 'dart:core';
import 'package:cw_core/encryption_file_utils.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_solana/solana_transaction_info.dart';
import 'package:mobx/mobx.dart';
@ -36,8 +37,8 @@ abstract class SolanaTransactionHistoryBase extends TransactionHistoryBase<Solan
final data = json.encode({'transactions': transactionMaps});
await encryptionFileUtils.write(path: path, password: _password, data: data);
} catch (e, s) {
print('Error while saving solana transaction history: ${e.toString()}');
print(s);
printV('Error while saving solana transaction history: ${e.toString()}');
printV(s);
}
}
@ -72,7 +73,7 @@ abstract class SolanaTransactionHistoryBase extends TransactionHistoryBase<Solan
}
});
} 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/transaction_direction.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_base.dart';
import 'package:cw_core/wallet_info.dart';
@ -454,7 +455,7 @@ abstract class SolanaWalletBase
SolanaBalance(0.0);
balance[token] = tokenBalance;
} catch (e) {
print('Error fetching spl token (${token.symbol}) balance ${e.toString()}');
printV('Error fetching spl token (${token.symbol}) balance ${e.toString()}');
}
} else {
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_info.dart';
import 'package:mobx/mobx.dart';
@ -30,7 +31,7 @@ abstract class SolanaWalletAddressesBase extends WalletAddresses with Store {
addressesMap[address] = '';
await saveAddressesInBox();
} catch (e) {
print(e.toString());
printV(e.toString());
}
}
}

View file

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

View file

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

View file

@ -1,3 +1,5 @@
import 'package:cw_core/utils/print_verbose.dart';
const prefixLength = 3;
String swapEndianBytes(String original) {
@ -37,14 +39,14 @@ String mnemonicDecode(String seed) {
.indexOf(wlist[i + 2].substring(0, prefixLength));
if (w1 == -1 || w2 == -1 || w3 == -1) {
print("invalid word in mnemonic");
printV("invalid word in mnemonic");
return '';
}
final x = w1 + n * (((n - w1) + w2) % n) + n * n * (((n - w2) + w3) % n);
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 '';
}

View file

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

View file

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

View file

@ -1,6 +1,7 @@
import 'package:cw_core/account.dart';
import 'package:cw_core/address_info.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_info.dart';
import 'package:cw_wownero/api/transaction_history.dart';
@ -94,7 +95,7 @@ abstract class WowneroWalletAddressesBase extends WalletAddresses with Store {
await saveAddressesInBox();
} 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/pathForWallet.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_credentials.dart';
import 'package:cw_core/wallet_info.dart';
@ -99,7 +100,7 @@ class WowneroWalletService extends WalletService<
return wallet;
} catch (e) {
// TODO: Implement Exception for wallet list service.
print('WowneroWalletsManager Error: ${e.toString()}');
printV('WowneroWalletsManager Error: ${e.toString()}');
rethrow;
}
}
@ -111,7 +112,7 @@ class WowneroWalletService extends WalletService<
return wownero_wallet_manager.isWalletExist(path: path);
} catch (e) {
// TODO: Implement Exception for wallet list service.
print('WowneroWalletsManager Error: $e');
printV('WowneroWalletsManager Error: $e');
rethrow;
}
}
@ -182,7 +183,7 @@ class WowneroWalletService extends WalletService<
final path = await pathForWalletDir(name: wallet, type: getType());
if (openedWalletsByPath["$path/$wallet"] != null) {
// NOTE: this is realistically only required on windows.
print("closing wallet");
printV("closing wallet");
final wmaddr = wmPtr.address;
final waddr = openedWalletsByPath["$path/$wallet"]!.address;
// await Isolate.run(() {
@ -190,7 +191,7 @@ class WowneroWalletService extends WalletService<
Pointer.fromAddress(wmaddr), Pointer.fromAddress(waddr), false);
// });
openedWalletsByPath.remove("$path/$wallet");
print("wallet closed");
printV("wallet closed");
}
final file = Directory(path);
@ -241,7 +242,7 @@ class WowneroWalletService extends WalletService<
return wallet;
} catch (e) {
// TODO: Implement Exception for wallet list service.
print('WowneroWalletsManager Error: $e');
printV('WowneroWalletsManager Error: $e');
rethrow;
}
}
@ -274,7 +275,7 @@ class WowneroWalletService extends WalletService<
return wallet;
} catch (e) {
// TODO: Implement Exception for wallet list service.
print('WowneroWalletsManager Error: $e');
printV('WowneroWalletsManager Error: $e');
rethrow;
}
}
@ -291,7 +292,7 @@ class WowneroWalletService extends WalletService<
path, credentials.password!, polyseed, credentials.walletInfo!, lang);
} catch (e) {
// TODO: Implement Exception for wallet list service.
print('WowneroWalletsManager Error: $e');
printV('WowneroWalletsManager Error: $e');
rethrow;
}
}
@ -348,7 +349,7 @@ class WowneroWalletService extends WalletService<
newFile.writeAsBytesSync(file.readAsBytesSync());
});
} 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);
} catch (e, s) {
print("derivationInfoError: $e");
print("derivationInfoStack: $s");
printV("derivationInfoError: $e");
printV("derivationInfoStack: $s");
}
}
}
@ -498,7 +498,7 @@ class CWBitcoin extends Bitcoin {
try {
return hardwareWalletService.getAvailableAccounts(index: index, limit: limit);
} catch (err) {
print(err);
printV(err);
throw err;
}
}
@ -510,7 +510,7 @@ class CWBitcoin extends Bitcoin {
try {
return hardwareWalletService.getAvailableAccounts(index: index, limit: limit);
} catch (err) {
print(err);
printV(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/view_model/hardware_wallet/ledger_view_model.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_type.dart';
import 'package:flutter/material.dart';
@ -136,7 +137,7 @@ class DFXBuyProvider extends BuyProvider {
return {};
}
} catch (e) {
print('DFX Error fetching fiat currencies: $e');
printV('DFX Error fetching fiat currencies: $e');
return {};
}
}
@ -266,19 +267,19 @@ class DFXBuyProvider extends BuyProvider {
quote.setCryptoCurrency = cryptoCurrency;
return [quote];
} else {
print('DFX: Unexpected data type: ${responseData.runtimeType}');
printV('DFX: Unexpected data type: ${responseData.runtimeType}');
return null;
}
} else {
if (responseData is Map<String, dynamic> && responseData.containsKey('message')) {
print('DFX Error: ${responseData['message']}');
printV('DFX Error: ${responseData['message']}');
} else {
print('DFX Failed to fetch buy quote: ${response.statusCode}');
printV('DFX Failed to fetch buy quote: ${response.statusCode}');
}
return null;
}
} catch (e) {
print('DFX Error fetching buy quote: $e');
printV('DFX Error fetching buy quote: $e');
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/utils/show_pop_up.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:flutter/material.dart';
import 'dart:developer';
@ -75,11 +76,11 @@ class MeldBuyProvider extends BuyProvider {
data.map((e) => PaymentMethod.fromMeldJson(e as Map<String, dynamic>)).toList();
return paymentMethods;
} else {
print('Meld: Failed to fetch payment types');
printV('Meld: Failed to fetch payment types');
return List<PaymentMethod>.empty();
}
} catch (e) {
print('Meld: Failed to fetch payment types: $e');
printV('Meld: Failed to fetch payment types: $e');
return List<PaymentMethod>.empty();
}
}
@ -132,7 +133,7 @@ class MeldBuyProvider extends BuyProvider {
return null;
}
} catch (e) {
print('Error fetching buy quote: $e');
printV('Error fetching buy quote: $e');
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/wallet_base.dart';
import 'package:cw_core/wallet_type.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart';
import 'package:url_launcher/url_launcher.dart';
@ -113,11 +114,11 @@ class MoonPayProvider extends BuyProvider {
if (response.statusCode == 200) {
return jsonDecode(response.body) as Map<String, dynamic>;
} else {
print('MoonPay does not support fiat: $fiatCurrency');
printV('MoonPay does not support fiat: $fiatCurrency');
return {};
}
} catch (e) {
print('MoonPay Error fetching fiat currencies: $e');
printV('MoonPay Error fetching fiat currencies: $e');
return {};
}
}
@ -204,11 +205,11 @@ class MoonPayProvider extends BuyProvider {
return [quote];
} else {
print('Moon Pay: Error fetching buy quote: ');
printV('Moon Pay: Error fetching buy quote: ');
return null;
}
} catch (e) {
print('Moon Pay: Error fetching buy quote: $e');
printV('Moon Pay: Error fetching buy quote: $e');
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:cw_core/crypto_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:flutter/material.dart';
import 'package:http/http.dart' as http;
@ -67,11 +68,11 @@ class OnRamperBuyProvider extends BuyProvider {
.map((item) => PaymentMethod.fromOnramperJson(item as Map<String, dynamic>))
.toList();
} else {
print('Failed to fetch available payment types');
printV('Failed to fetch available payment types');
return [];
}
} catch (e) {
print('Failed to fetch available payment types: $e');
printV('Failed to fetch available payment types: $e');
return [];
}
}
@ -98,11 +99,11 @@ class OnRamperBuyProvider extends BuyProvider {
return result;
} else {
print('Failed to fetch onramp metadata');
printV('Failed to fetch onramp metadata');
return {};
}
} catch (e) {
print('Error occurred: $e');
printV('Error occurred: $e');
return {};
}
}
@ -178,11 +179,11 @@ class OnRamperBuyProvider extends BuyProvider {
return validQuotes;
} else {
print('Onramper: Failed to fetch rate');
printV('Onramper: Failed to fetch rate');
return null;
}
} catch (e) {
print('Onramper: Failed to fetch rate $e');
printV('Onramper: Failed to fetch rate $e');
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/view_model/hardware_wallet/ledger_view_model.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_type.dart';
import 'package:flutter/material.dart';
@ -176,7 +177,7 @@ class RobinhoodBuyProvider extends BuyProvider {
if (responseData.containsKey('message')) {
log('Robinhood Error: ${responseData['message']}');
} else {
print('Robinhood Failed to fetch $action quote: ${response.statusCode}');
printV('Robinhood Failed to fetch $action quote: ${response.statusCode}');
}
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_user_credentials.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:http/http.dart' as http;
@ -140,7 +141,7 @@ class CakePayApi {
final response = await http.get(uri, headers: headers);
print('Response: ${response.statusCode}');
printV('Response: ${response.statusCode}');
if (response.statusCode != 200) {
throw Exception('Unexpected http status: ${response.statusCode}');
@ -167,7 +168,7 @@ class CakePayApi {
throw Exception('Unexpected http status: ${response.statusCode}');
}
} 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/routes.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:mobx/mobx.dart';
import 'package:shared_preferences/shared_preferences.dart';
@ -51,7 +52,7 @@ class AuthService with Store {
try {
password = await secureStorage.read(key: key) ?? '';
} catch (e) {
print(e);
printV(e);
}
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:cw_core/root_dir.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:flutter/foundation.dart';
import 'package:hive/hive.dart';
@ -110,11 +111,11 @@ class BackupService {
for (var ignore in ignoreFiles) {
final filename = entity.absolute.path;
if (filename.endsWith(ignore) && !filename.contains("wallets/")) {
print("ignoring backup file: $filename");
printV("ignoring backup file: $filename");
return;
}
}
print("restoring: $filename");
printV("restoring: $filename");
if (entity.statSync().type == FileSystemEntityType.directory) {
zipEncoder.addDirectory(Directory(entity.path));
} else {
@ -175,11 +176,11 @@ class BackupService {
final filename = file.name;
for (var ignore in ignoreFiles) {
if (filename.endsWith(ignore) && !filename.contains("wallets/")) {
print("ignoring backup file: $filename");
printV("ignoring backup file: $filename");
continue outer;
}
}
print("restoring: $filename");
printV("restoring: $filename");
if (file.isFile) {
final content = file.content as List<int>;
File('${appDir.path}/' + filename)
@ -193,7 +194,7 @@ class BackupService {
await _verifyWallets();
await _importKeychainDumpV2(password);
await _importPreferencesDump();
await _importTransactionDescriptionDump();
await _importTransactionDescriptionDump(); // HiveError: Box has already been closed
}
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/src/screens/wallet_connect/widgets/connection_widget.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/solana.dart';
import 'package:walletconnect_flutter_v2/walletconnect_flutter_v2.dart';
@ -127,7 +128,7 @@ class SolanaChainServiceImpl implements ChainService {
commitment: Commitment.confirmed,
);
print(signature);
printV(signature);
bottomSheetService.queueBottomSheet(
isModalDismissible: true,
@ -165,7 +166,7 @@ class SolanaChainServiceImpl implements ChainService {
try {
sign = await ownerKeyPair?.sign(base58decode(solanaSignMessage.message));
} catch (e) {
print(e);
printV(e);
}
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/modals/web3_request_modal.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:eth_sig_util/eth_sig_util.dart';
import 'package:flutter/material.dart';
@ -260,7 +261,7 @@ abstract class Web3WalletServiceBase with Store {
@action
void _refreshPairings() {
print('Refreshing pairings');
printV('Refreshing pairings');
pairings.clear();
final allPairings = _web3Wallet.pairings.getAll();
@ -397,10 +398,10 @@ abstract class Web3WalletServiceBase with Store {
// Get all pairing topics attached to this key
final pairingTopicsForWallet = getPairingTopicsForWallet(key);
print(pairingTopicsForWallet);
printV(pairingTopicsForWallet);
bool isPairingTopicAlreadySaved = pairingTopicsForWallet.contains(pairingTopic);
print('Is Pairing Topic Saved: $isPairingTopicAlreadySaved');
printV('Is Pairing Topic Saved: $isPairingTopicAlreadySaved');
if (!isPairingTopicAlreadySaved) {
// 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/show_pop_up.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_info.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
authenticatedErrorStreamController.add(corruptedWalletsSeeds);
} catch (e) {
print(e);
printV(e);
// save seeds and show corrupted wallets' seeds to the user
try {
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/wallet_list/wallet_list_item.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_type.dart';
import 'package:flutter/foundation.dart';
@ -83,8 +84,8 @@ void callbackDispatcher() {
return Future.value(true);
} catch (error, stackTrace) {
print(error);
print(stackTrace);
printV(error);
printV(stackTrace);
return Future.error(error);
}
});
@ -149,8 +150,8 @@ class BackgroundTasks {
constraints: constraints,
);
} catch (error, stackTrace) {
print(error);
print(stackTrace);
printV(error);
printV(stackTrace);
}
}
@ -158,8 +159,8 @@ class BackgroundTasks {
try {
Workmanager().cancelByUniqueName(moneroSyncTaskKey);
} catch (error, stackTrace) {
print(error);
print(stackTrace);
printV(error);
printV(stackTrace);
}
}
}

View file

@ -1,3 +1,4 @@
import 'package:cw_core/utils/print_verbose.dart';
import 'package:flutter/services.dart';
import 'package:flutter_local_authentication/flutter_local_authentication.dart';
@ -9,7 +10,7 @@ class BiometricAuth {
final authenticated = await _flutterLocalAuthenticationPlugin.authenticate();
return authenticated;
} catch (e) {
print(e);
printV(e);
}
return false;
}
@ -20,7 +21,7 @@ class BiometricAuth {
canAuthenticate = await _flutterLocalAuthenticationPlugin.canAuthenticate();
await _flutterLocalAuthenticationPlugin.setTouchIDAuthenticationAllowableReuseDuration(0);
} catch (error) {
print("Exception checking support. $error");
printV("Exception checking support. $error");
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:cake_wallet/entities/secret_store_key.dart';
import 'package:cw_core/root_dir.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:hive/hive.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:cake_wallet/entities/preferences_key.dart';
@ -306,7 +307,7 @@ Future<void> defaultSettingsMigration(
await sharedPreferences.setInt(
PreferencesKey.currentDefaultSettingsMigrationVersion, version);
} catch (e) {
print('Migration error: ${e.toString()}');
printV('Migration error: ${e.toString()}');
}
});
@ -729,7 +730,7 @@ Future<void> insecureStorageMigration({
await secureStorage.write(
key: SecureKey.lastAuthTimeMilliseconds, value: lastAuthTimeMilliseconds.toString());
} 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
// 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;
await info.save();
} 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/polygon/polygon.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/wallet_type.dart';
import 'package:ens_dart/ens_dart.dart';
@ -47,7 +48,7 @@ class EnsRecord {
final addr = await ens.withName(name).getAddress();
return addr.hex;
} catch (e) {
print(e);
printV(e);
return "";
}
}

View file

@ -2,6 +2,7 @@ import 'dart:io';
import 'dart:convert';
import 'package:cake_wallet/core/secure_storage.dart';
import 'package:collection/collection.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:hive/hive.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!);
}
} catch (e) {
print(e.toString());
printV(e.toString());
}
});
@ -326,7 +327,7 @@ Future<void> ios_migrate_wallet_info(Box<WalletInfo> walletsInfoSource) async {
return walletInfo;
}
} catch (e) {
print(e.toString());
printV(e.toString());
return null;
}
})
@ -336,7 +337,7 @@ Future<void> ios_migrate_wallet_info(Box<WalletInfo> walletsInfoSource) async {
await walletsInfoSource.addAll(infoRecords);
await prefs.setBool('ios_migration_wallet_info_completed', true);
} 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 prefs.setBool('ios_migration_trade_list_completed', true);
} 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 prefs.setBool('ios_migration_address_book_completed', true);
} catch (e) {
print(e.toString());
printV(e.toString());
}
}

View file

@ -1,4 +1,5 @@
import 'package:basic_utils/basic_utils.dart';
import 'package:cw_core/utils/print_verbose.dart';
class OpenaliasRecord {
OpenaliasRecord({
@ -27,7 +28,7 @@ class OpenaliasRecord {
return txtRecord;
} catch (e) {
print("${e.toString()}");
printV("${e.toString()}");
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/twitter/twitter_api.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_type.dart';
import 'package:cake_wallet/entities/fio_address_provider.dart';
@ -283,7 +284,7 @@ class AddressResolver {
}
}
} catch (e) {
print(e.toString());
printV(e.toString());
}
return ParsedAddress(addresses: [text]);

View file

@ -93,6 +93,7 @@ class PreferencesKey {
static const donationLinkWalletName = 'donation_link_wallet_name';
static const lastSeenAppVersion = 'last_seen_app_version';
static const shouldShowMarketPlaceInDashboard = 'should_show_marketplace_in_dashboard';
static const showAddressBookPopupEnabled = 'show_address_book_popup_enabled';
static const isNewInstall = 'is_new_install';
static const serviceStatusShaKey = 'service_status_sha_key';
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_two_actions.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:flutter/material.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 'package:cw_core/utils/print_verbose.dart';
import 'package:http/http.dart' as http;
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? ?? '';
} catch (e) {
print('Unstoppable domain error: ${e.toString()}');
printV('Unstoppable domain error: ${e.toString()}');
address = '';
}

View file

@ -205,7 +205,7 @@ class CWEthereum extends Ethereum {
try {
return await hardwareWalletService.getAvailableAccounts(index: index, limit: limit);
} catch (err) {
print(err);
printV(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/wallet_type_utils.dart';
import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:http/http.dart';
class ChangeNowExchangeProvider extends ExchangeProvider {
@ -127,7 +128,7 @@ class ChangeNowExchangeProvider extends ExchangeProvider {
return isReverse ? (amount / fromAmount) : (toAmount / amount);
} catch (e) {
print(e.toString());
printV(e.toString());
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/utils/currency_pairs_utils.dart';
import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:http/http.dart';
class ExolixExchangeProvider extends ExchangeProvider {
@ -124,7 +125,7 @@ class ExolixExchangeProvider extends ExchangeProvider {
return responseJSON['rate'] as double;
} catch (e) {
print(e.toString());
printV(e.toString());
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/utils/currency_pairs_utils.dart';
import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:http/http.dart';
class QuantexExchangeProvider extends ExchangeProvider {
@ -86,7 +87,7 @@ class QuantexExchangeProvider extends ExchangeProvider {
// coin not found:
return Limits(min: 0, max: 0);
} catch (e) {
print(e.toString());
printV(e.toString());
return Limits(min: 0, max: 0);
}
}
@ -121,7 +122,7 @@ class QuantexExchangeProvider extends ExchangeProvider {
double rate = double.parse(data['price'].toString());
return rate;
} catch (e) {
print("error fetching rate: ${e.toString()}");
printV("error fetching rate: ${e.toString()}");
return 0.0;
}
}
@ -178,7 +179,7 @@ class QuantexExchangeProvider extends ExchangeProvider {
isSendAll: isSendAll,
);
} catch (e) {
print("error creating trade: ${e.toString()}");
printV("error creating trade: ${e.toString()}");
throw TradeNotCreatedException(description, description: e.toString());
}
}
@ -225,7 +226,7 @@ class QuantexExchangeProvider extends ExchangeProvider {
state: state,
);
} catch (e) {
print("error getting trade: ${e.toString()}");
printV("error getting trade: ${e.toString()}");
throw TradeNotFoundException(
id,
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/utils/currency_pairs_utils.dart';
import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:hive/hive.dart';
import 'package:http/http.dart' as http;
@ -86,7 +87,7 @@ class ThorChainExchangeProvider extends ExchangeProvider {
return _thorChainAmountToDouble(expectedAmountOut) / amount;
} catch (e) {
print(e.toString());
printV(e.toString());
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/utils/currency_pairs_utils.dart';
import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:http/http.dart';
class TrocadorExchangeProvider extends ExchangeProvider {
@ -148,7 +149,7 @@ class TrocadorExchangeProvider extends ExchangeProvider {
return isReceiveAmount ? (amount / fromAmount) : (toAmount / amount);
} catch (e) {
print(e.toString());
printV(e.toString());
return 0.0;
}
}

View file

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

View file

@ -249,7 +249,7 @@ class CWNanoUtil extends NanoUtil {
try {
mnemonic = NanoDerivations.standardSeedToMnemonic(seedKey);
} catch (e) {
print("not a valid 'nano' seed key");
printV("not a valid 'nano' seed key");
}
}
if (derivationType == DerivationType.bip39) {
@ -306,7 +306,7 @@ class CWNanoUtil extends NanoUtil {
try {
mnemonic = NanoDerivations.standardSeedToMnemonic(seedKey!);
} 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/picker.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:nostr_tools/nostr_tools.dart';
@ -83,7 +84,7 @@ class NostrProfileHandler {
relay.close();
return null;
} catch (e) {
print('[!] Error with relay $relayUrl: $e');
printV('[!] Error with relay $relayUrl: $e');
return null;
}
}
@ -115,7 +116,7 @@ class NostrProfileHandler {
var uri = Uri.parse(relayUrl);
return uri.host;
} catch (e) {
print('Error parsing URL: $e');
printV('Error parsing URL: $e');
return '';
}
}

View file

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

View file

@ -1,6 +1,7 @@
import 'dart:async';
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/sync_status.dart';
import 'package:cw_core/wallet_type.dart';
@ -36,7 +37,7 @@ void startCheckConnectionReaction(WalletBase wallet, SettingsStore settingsStore
}
}
} 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:cw_core/crypto_currency.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:mobx/mobx.dart';
@ -74,7 +75,7 @@ Future<void> startFiatRateUpdate(
}
}
} 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:cw_core/node.dart';
import 'package:cake_wallet/store/app_store.dart';
@ -10,14 +11,14 @@ void startOnCurrentNodeChangeReaction(AppStore appStore) {
try {
await appStore.wallet!.connectToNode(node: change.newValue!);
} catch (e) {
print(e.toString());
printV(e.toString());
}
});
appStore.settingsStore.powNodes.observe((change) async {
try {
await appStore.wallet!.connectToPowNode(node: change.newValue!);
} 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/balance.dart';
import 'package:cw_core/transaction_info.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:mobx/mobx.dart';
import 'package:cake_wallet/reactions/check_connection.dart';
import 'package:cake_wallet/reactions/on_wallet_sync_status_change.dart';
@ -47,7 +48,7 @@ void startCurrentWalletChangeReaction(
// appStore.wallet.walletInfo.yatLastUsedAddress = address;
// await appStore.wallet.walletInfo.save();
//} catch (e) {
// print(e.toString());
// printV(e.toString());
//}
//});
@ -96,7 +97,7 @@ void startCurrentWalletChangeReaction(
}
}
} catch (e) {
print(e.toString());
printV(e.toString());
}
});
@ -143,7 +144,7 @@ void startCurrentWalletChangeReaction(
}
}
} 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_salvium_rate.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:mobx/mobx.dart';
import 'package:cw_core/transaction_history.dart';
@ -36,7 +37,7 @@ void startWalletSyncStatusChangeReaction(
await WakelockPlus.disable();
}
} 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/store/dashboard/orders_store.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_inappwebview/flutter_inappwebview.dart';
@ -103,7 +104,7 @@ class BuyWebViewPageBodyState extends State<BuyWebViewPageBody> {
}
} catch (e) {
_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/utils/responsive_layout_util.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:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
@ -127,7 +128,7 @@ class ConnectDevicePageBodyState extends State<ConnectDevicePageBody> {
_bleRefreshTimer = null;
}
} catch (e) {
print(e);
printV(e);
}
}

View file

@ -223,10 +223,10 @@
// setState(() => status = "Sending...");
// final acc = await func();
// setState(() => status = "$method: $acc");
// print("$method: $acc");
// printV("$method: $acc");
// } on LedgerException catch (ex) {
// 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,

View file

@ -322,6 +322,7 @@ class _ContactListBodyState extends State<ContactListBody> {
? widget.contactListViewModel.contacts
: widget.contactListViewModel.contactsToShow;
return Scaffold(
backgroundColor: Theme.of(context).colorScheme.background,
body: Container(
child: FilteredList(
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/utils/show_pop_up.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:cake_wallet/view_model/dashboard/cake_features_view_model.dart';
import 'package:flutter/material.dart';
@ -105,7 +106,7 @@ class CakeFeaturesPage extends StatelessWidget {
mode: LaunchMode.externalApplication,
);
} 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/utils/device_info.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_type.dart';
import 'package:flutter/material.dart';
@ -91,7 +92,7 @@ class RootState extends State<Root> with WidgetsBindingObserver {
handleDeepLinking(await getInitialUri());
} 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/show_pop_up.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/wallet_type.dart';
import 'package:cake_wallet/view_model/send/send_view_model.dart';
@ -524,14 +525,14 @@ class SendPage extends BasePage {
? '. ${S.of(_dialogContext).waitFewSecondForTxUpdate}'
: '';
final newContactMessage = newContactAddress != null
final newContactMessage = newContactAddress != null && sendViewModel.showAddressBookPopup
? '\n${S.of(_dialogContext).add_contact_to_address_book}'
: '';
String alertContent =
"$successMessage$waitMessage$newContactMessage";
if (newContactAddress != null) {
if (newContactMessage.isNotEmpty) {
return AlertWithTwoActions(
alertDialogKey: ValueKey('send_page_sent_dialog_key'),
alertTitle: '',
@ -584,7 +585,7 @@ class SendPage extends BasePage {
mode: LaunchMode.externalApplication,
);
} 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/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_switcher_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:cw_core/wallet_type.dart';
@ -62,6 +63,13 @@ class OtherSettingsPage extends BasePage {
handler: (BuildContext context) =>
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(),
SettingsVersionCell(
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/store/app_store.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:flutter/material.dart';
// import 'package:tor/tor.dart';
@ -57,7 +58,7 @@ class _TorPageBodyState extends State<TorPageBody> {
// }
// widget.appStore.wallet!.connectToNode(node: node);
print('Done awaiting; tor should be running');
printV('Done awaiting; tor should be running');
}
Future<void> endTor() async {
@ -69,7 +70,7 @@ class _TorPageBodyState extends State<TorPageBody> {
// torEnabled = Tor.instance.enabled; // Update flag
// });
//
// print('Done awaiting; tor should be stopped');
// printV('Done awaiting; tor should be stopped');
}
//
// @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/utils/show_bar.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:cake_wallet/generated/i18n.dart';
@ -53,7 +54,7 @@ class TotpAuthCodePageState extends State<TotpAuthCodePage> {
}
if (state is FailureState) {
print(state.error);
printV(state.error);
widget.totpArguments.onTotpAuthenticationFinished!(false, this);
}

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