linting, formatting, small cleanups, and an extra logging call

This commit is contained in:
Julian 2025-03-20 20:47:10 -06:00
parent 7cf966c443
commit 37f318a902
3 changed files with 26 additions and 22 deletions
crypto_plugins
lib/wallets/wallet

@ -1 +1 @@
Subproject commit 0bb1b1ced6e0d3c66e383698f89825754c692986
Subproject commit 8830be2ba661828d743be12df6f33d560448ed6a

View file

@ -20,7 +20,6 @@ import '../../../services/event_bus/global_event_bus.dart';
import '../../../utilities/amount/amount.dart';
import '../../../utilities/logger.dart';
import '../../../utilities/stack_file_system.dart';
import '../../crypto_currency/crypto_currency.dart';
import '../../models/tx_data.dart';
import '../intermediate/lib_xelis_wallet.dart';
@ -88,7 +87,7 @@ class XelisWallet extends LibXelisWallet {
final wallet = await x_wallet.createXelisWallet(
name: name,
directory: directory,
password: password!,
password: password,
network: cryptoCurrency.network.xelisNetwork,
precomputedTablesPath: tablePath,
l1Low: tableState.currentSize.isLow,
@ -106,7 +105,6 @@ class XelisWallet extends LibXelisWallet {
}
Future<void> _existingWallet() async {
print("EXISTING");
Logging.instance.i("Xelis: opening existing wallet");
final tablePath = await getPrecomputedTablesPath();
final tableState = await getTableState();
@ -135,16 +133,16 @@ class XelisWallet extends LibXelisWallet {
}
final newReceivingAddress =
await getCurrentReceivingAddress() ??
Address(
walletId: walletId,
derivationIndex: 0,
derivationPath: null,
value: libXelisWallet!.getAddressStr(),
publicKey: [],
type: AddressType.xelis,
subType: AddressSubType.receiving,
);
await getCurrentReceivingAddress() ??
Address(
walletId: walletId,
derivationIndex: 0,
derivationPath: null,
value: libXelisWallet!.getAddressStr(),
publicKey: [],
type: AddressType.xelis,
subType: AddressSubType.receiving,
);
await mainDB.updateOrPutAddresses([newReceivingAddress]);
@ -168,7 +166,9 @@ class XelisWallet extends LibXelisWallet {
_initCompleter = Completer<void>();
try {
final bool walletExists = await LibXelisWallet.checkWalletExists(walletId);
final bool walletExists = await LibXelisWallet.checkWalletExists(
walletId,
);
if (libXelisWallet == null) {
if (isRestore == true) {
@ -182,8 +182,13 @@ class XelisWallet extends LibXelisWallet {
}
}
_initCompleter!.complete();
} catch (e) {
} catch (e, s) {
_initCompleter!.completeError(e);
Logging.instance.e(
"Xelis init() rethrowing error",
error: e,
stackTrace: s,
);
rethrow;
}
@ -227,7 +232,7 @@ class XelisWallet extends LibXelisWallet {
} catch (_) {
await handleOffline();
return false;
}
}
}
final _balanceUpdateMutex = Mutex();
@ -275,7 +280,8 @@ class XelisWallet extends LibXelisWallet {
final Map<String, dynamic> nodeInfo =
(json.decode(infoString) as Map).cast();
pruningHeight = int.tryParse(nodeInfo['pruned_topoheight']?.toString() ?? '0') ?? 0;
pruningHeight =
int.tryParse(nodeInfo['pruned_topoheight']?.toString() ?? '0') ?? 0;
return int.parse(nodeInfo['topoheight'].toString());
}
@ -539,7 +545,7 @@ class XelisWallet extends LibXelisWallet {
inputs: List.unmodifiable(inputs),
outputs: List.unmodifiable(outputs),
version: -1, // Version not provided
type: txType!,
type: txType,
subType: txSubType,
otherData: jsonEncode({
...otherData,

View file

@ -14,7 +14,6 @@ import '../../../utilities/logger.dart';
import '../../../utilities/stack_file_system.dart';
import '../../crypto_currency/crypto_currency.dart';
import '../../crypto_currency/intermediate/electrum_currency.dart';
import '../wallet.dart';
import '../wallet_mixin_interfaces/mnemonic_interface.dart';
import 'external_wallet.dart';
@ -153,7 +152,6 @@ abstract class LibXelisWallet<T extends ElectrumCurrency>
static const String _kHasFullTablesKey = 'xelis_has_full_tables';
static const String _kGeneratingTablesKey = 'xelis_generating_tables';
static const String _kWantsFullTablesKey = 'xelis_wants_full_tables';
static final _initMutex = Mutex();
static final _tableGenerationMutex = Mutex();
static Completer<void>? _tableGenerationCompleter;
@ -437,4 +435,4 @@ extension XelisTableManagement on LibXelisWallet {
}
});
}
}
}