chore: printVs

This commit is contained in:
Rafael Saes 2024-12-09 17:20:38 -03:00
parent b927af97ba
commit f702a19965
4 changed files with 21 additions and 19 deletions

View file

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

View file

@ -21,6 +21,7 @@ import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/sync_status.dart'; import 'package:cw_core/sync_status.dart';
import 'package:cw_core/transaction_direction.dart'; import 'package:cw_core/transaction_direction.dart';
import 'package:cw_core/unspent_coins_info.dart'; import 'package:cw_core/unspent_coins_info.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_info.dart';
import 'package:cw_core/wallet_keys_file.dart'; import 'package:cw_core/wallet_keys_file.dart';
// import 'package:cw_core/wallet_type.dart'; // import 'package:cw_core/wallet_type.dart';
@ -134,14 +135,14 @@ abstract class BitcoinWalletBase extends ElectrumWallet with Store {
seedBytes = ElectrumV2SeedGenerator.generateFromString(mnemonic, passphrase); seedBytes = ElectrumV2SeedGenerator.generateFromString(mnemonic, passphrase);
hdWallets[CWBitcoinDerivationType.electrum] = Bip32Slip10Secp256k1.fromSeed(seedBytes); hdWallets[CWBitcoinDerivationType.electrum] = Bip32Slip10Secp256k1.fromSeed(seedBytes);
} catch (e) { } catch (e) {
print("electrum_v2 seed error: $e"); printV("electrum_v2 seed error: $e");
try { try {
seedBytes = ElectrumV1SeedGenerator(mnemonic).generate(); seedBytes = ElectrumV1SeedGenerator(mnemonic).generate();
hdWallets[CWBitcoinDerivationType.electrum] = hdWallets[CWBitcoinDerivationType.electrum] =
Bip32Slip10Secp256k1.fromSeed(seedBytes); Bip32Slip10Secp256k1.fromSeed(seedBytes);
} catch (e) { } catch (e) {
print("electrum_v1 seed error: $e"); printV("electrum_v1 seed error: $e");
} }
} }
@ -265,14 +266,14 @@ abstract class BitcoinWalletBase extends ElectrumWallet with Store {
seedBytes = ElectrumV2SeedGenerator.generateFromString(mnemonic, passphrase); seedBytes = ElectrumV2SeedGenerator.generateFromString(mnemonic, passphrase);
hdWallets[CWBitcoinDerivationType.electrum] = Bip32Slip10Secp256k1.fromSeed(seedBytes); hdWallets[CWBitcoinDerivationType.electrum] = Bip32Slip10Secp256k1.fromSeed(seedBytes);
} catch (e) { } catch (e) {
print("electrum_v2 seed error: $e"); printV("electrum_v2 seed error: $e");
try { try {
seedBytes = ElectrumV1SeedGenerator(mnemonic).generate(); seedBytes = ElectrumV1SeedGenerator(mnemonic).generate();
hdWallets[CWBitcoinDerivationType.electrum] = hdWallets[CWBitcoinDerivationType.electrum] =
Bip32Slip10Secp256k1.fromSeed(seedBytes); Bip32Slip10Secp256k1.fromSeed(seedBytes);
} catch (e) { } catch (e) {
print("electrum_v1 seed error: $e"); printV("electrum_v1 seed error: $e");
} }
} }
@ -629,7 +630,7 @@ abstract class BitcoinWalletBase extends ElectrumWallet with Store {
// .toList(), // .toList(),
// ); // );
// print("registered: $registered"); // printV("registered: $registered");
} }
@action @action
@ -657,7 +658,7 @@ abstract class BitcoinWalletBase extends ElectrumWallet with Store {
switch (workerMethod) { switch (workerMethod) {
case ElectrumRequestMethods.tweaksSubscribeMethod: case ElectrumRequestMethods.tweaksSubscribeMethod:
if (workerError != null) { if (workerError != null) {
print(messageJson); printV(messageJson);
// _onConnectionStatusChange(ConnectionStatus.failed); // _onConnectionStatusChange(ConnectionStatus.failed);
break; break;
} }
@ -827,7 +828,7 @@ abstract class BitcoinWalletBase extends ElectrumWallet with Store {
// return historiesWithDetails; // return historiesWithDetails;
// } catch (e) { // } catch (e) {
// print("fetchTransactions $e"); // printV("fetchTransactions $e");
// return {}; // return {};
// } // }
} }

View file

@ -6,6 +6,7 @@ import 'package:cw_bitcoin/bitcoin_unspent.dart';
import 'package:cw_core/transaction_direction.dart'; import 'package:cw_core/transaction_direction.dart';
import 'package:cw_core/transaction_info.dart'; import 'package:cw_core/transaction_info.dart';
import 'package:cw_core/format_amount.dart'; import 'package:cw_core/format_amount.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_type.dart'; import 'package:cw_core/wallet_type.dart';
import 'package:hex/hex.dart'; import 'package:hex/hex.dart';
@ -173,10 +174,10 @@ class ElectrumTransactionInfo extends TransactionInfo {
} }
} }
} catch (e) { } catch (e) {
print(bundle.originalTransaction.txId()); printV(bundle.originalTransaction.txId());
print("original: ${bundle.originalTransaction}"); printV("original: ${bundle.originalTransaction}");
print("bundle.inputs: ${bundle.originalTransaction.inputs}"); printV("bundle.inputs: ${bundle.originalTransaction.inputs}");
print("ins: ${bundle.ins}"); printV("ins: ${bundle.ins}");
rethrow; rethrow;
} }

View file

@ -15,6 +15,7 @@ import 'package:cw_bitcoin/electrum_worker/electrum_worker_params.dart';
import 'package:cw_bitcoin/electrum_worker/methods/methods.dart'; import 'package:cw_bitcoin/electrum_worker/methods/methods.dart';
import 'package:cw_core/sync_status.dart'; import 'package:cw_core/sync_status.dart';
import 'package:cw_core/transaction_direction.dart'; import 'package:cw_core/transaction_direction.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_type.dart'; import 'package:cw_core/wallet_type.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:rxdart/rxdart.dart'; import 'package:rxdart/rxdart.dart';
@ -49,7 +50,7 @@ class ElectrumWorker {
} }
void handleMessage(dynamic message) async { void handleMessage(dynamic message) async {
print("Worker: received message: $message"); printV("Worker: received message: $message");
try { try {
Map<String, dynamic> messageJson; Map<String, dynamic> messageJson;
@ -107,7 +108,7 @@ class ElectrumWorker {
); );
break; break;
case ElectrumWorkerMethods.stopScanningMethod: case ElectrumWorkerMethods.stopScanningMethod:
print("Worker: received message: $message"); printV("Worker: received message: $message");
await _handleStopScanning( await _handleStopScanning(
ElectrumWorkerStopScanningRequest.fromJson(messageJson), ElectrumWorkerStopScanningRequest.fromJson(messageJson),
); );
@ -205,7 +206,7 @@ class ElectrumWorker {
return; return;
} }
print("status: $status"); printV("status: $status");
_sendResponse(ElectrumWorkerScripthashesSubscribeResponse( _sendResponse(ElectrumWorkerScripthashesSubscribeResponse(
result: {address: req.onResponse(status)}, result: {address: req.onResponse(status)},
@ -756,13 +757,13 @@ class ElectrumWorker {
return; return;
} catch (e, stacktrace) { } catch (e, stacktrace) {
print(stacktrace); printV(stacktrace);
print(e.toString()); printV(e.toString());
} }
} }
} catch (e, stacktrace) { } catch (e, stacktrace) {
print(stacktrace); printV(stacktrace);
print(e.toString()); printV(e.toString());
} }
syncHeight = tweakHeight; syncHeight = tweakHeight;