mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-29 21:55:58 +00:00
linter warning clean up
This commit is contained in:
parent
8556748517
commit
4ad5bd6e6d
4 changed files with 71 additions and 72 deletions
|
@ -418,7 +418,7 @@ class BitcoinWallet extends CoinServiceAPI {
|
|||
"index: $index, \t GapCounter $account ${type.name}: $gapCounter",
|
||||
level: LogLevel.Info);
|
||||
|
||||
final ID = "k_$index";
|
||||
final _id = "k_$index";
|
||||
Map<String, String> txCountCallArgs = {};
|
||||
final Map<String, dynamic> receivingNodes = {};
|
||||
|
||||
|
@ -463,13 +463,13 @@ class BitcoinWallet extends CoinServiceAPI {
|
|||
throw Exception("No Path type $type exists");
|
||||
}
|
||||
receivingNodes.addAll({
|
||||
"${ID}_$j": {
|
||||
"${_id}_$j": {
|
||||
"node": node,
|
||||
"address": address,
|
||||
}
|
||||
});
|
||||
txCountCallArgs.addAll({
|
||||
"${ID}_$j": address,
|
||||
"${_id}_$j": address,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -478,9 +478,9 @@ class BitcoinWallet extends CoinServiceAPI {
|
|||
|
||||
// check and add appropriate addresses
|
||||
for (int k = 0; k < txCountBatchSize; k++) {
|
||||
int count = counts["${ID}_$k"]!;
|
||||
int count = counts["${_id}_$k"]!;
|
||||
if (count > 0) {
|
||||
final node = receivingNodes["${ID}_$k"];
|
||||
final node = receivingNodes["${_id}_$k"];
|
||||
// add address to array
|
||||
addressArray.add(node["address"] as String);
|
||||
iterationsAddressArray.add(node["address"] as String);
|
||||
|
@ -526,7 +526,7 @@ class BitcoinWallet extends CoinServiceAPI {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
} catch (e, s) {
|
||||
} catch (e) {
|
||||
//
|
||||
}
|
||||
}
|
||||
|
@ -568,25 +568,25 @@ class BitcoinWallet extends CoinServiceAPI {
|
|||
// receiving addresses
|
||||
Logging.instance
|
||||
.log("checking receiving addresses...", level: LogLevel.Info);
|
||||
Future resultReceive44 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
final resultReceive44 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip44, 0);
|
||||
|
||||
Future resultReceive49 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
final resultReceive49 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip49, 0);
|
||||
|
||||
Future resultReceive84 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
final resultReceive84 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip84, 0);
|
||||
|
||||
Logging.instance
|
||||
.log("checking change addresses...", level: LogLevel.Info);
|
||||
// change addresses
|
||||
Future resultChange44 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
final resultChange44 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip44, 1);
|
||||
|
||||
Future resultChange49 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
final resultChange49 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip49, 1);
|
||||
|
||||
Future resultChange84 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
final resultChange84 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip84, 1);
|
||||
|
||||
await Future.wait([
|
||||
|
@ -851,7 +851,7 @@ class BitcoinWallet extends CoinServiceAPI {
|
|||
// notify on unconfirmed transactions
|
||||
for (final tx in unconfirmedTxnsToNotifyPending) {
|
||||
if (tx.txType == "Received") {
|
||||
NotificationApi.showNotification(
|
||||
unawaited(NotificationApi.showNotification(
|
||||
title: "Incoming transaction",
|
||||
body: walletName,
|
||||
walletId: walletId,
|
||||
|
@ -862,10 +862,10 @@ class BitcoinWallet extends CoinServiceAPI {
|
|||
txid: tx.txid,
|
||||
confirmations: tx.confirmations,
|
||||
requiredConfirmations: MINIMUM_CONFIRMATIONS,
|
||||
);
|
||||
));
|
||||
await txTracker.addNotifiedPending(tx.txid);
|
||||
} else if (tx.txType == "Sent") {
|
||||
NotificationApi.showNotification(
|
||||
unawaited(NotificationApi.showNotification(
|
||||
title: "Sending transaction",
|
||||
body: walletName,
|
||||
walletId: walletId,
|
||||
|
@ -876,7 +876,7 @@ class BitcoinWallet extends CoinServiceAPI {
|
|||
txid: tx.txid,
|
||||
confirmations: tx.confirmations,
|
||||
requiredConfirmations: MINIMUM_CONFIRMATIONS,
|
||||
);
|
||||
));
|
||||
await txTracker.addNotifiedPending(tx.txid);
|
||||
}
|
||||
}
|
||||
|
@ -884,7 +884,7 @@ class BitcoinWallet extends CoinServiceAPI {
|
|||
// notify on confirmed
|
||||
for (final tx in unconfirmedTxnsToNotifyConfirmed) {
|
||||
if (tx.txType == "Received") {
|
||||
NotificationApi.showNotification(
|
||||
unawaited(NotificationApi.showNotification(
|
||||
title: "Incoming transaction confirmed",
|
||||
body: walletName,
|
||||
walletId: walletId,
|
||||
|
@ -892,10 +892,10 @@ class BitcoinWallet extends CoinServiceAPI {
|
|||
date: DateTime.fromMillisecondsSinceEpoch(tx.timestamp * 1000),
|
||||
shouldWatchForUpdates: false,
|
||||
coinName: coin.name,
|
||||
);
|
||||
));
|
||||
await txTracker.addNotifiedConfirmed(tx.txid);
|
||||
} else if (tx.txType == "Sent") {
|
||||
NotificationApi.showNotification(
|
||||
unawaited(NotificationApi.showNotification(
|
||||
title: "Outgoing transaction confirmed",
|
||||
body: walletName,
|
||||
walletId: walletId,
|
||||
|
@ -903,7 +903,7 @@ class BitcoinWallet extends CoinServiceAPI {
|
|||
date: DateTime.fromMillisecondsSinceEpoch(tx.timestamp * 1000),
|
||||
shouldWatchForUpdates: false,
|
||||
coinName: coin.name,
|
||||
);
|
||||
));
|
||||
await txTracker.addNotifiedConfirmed(tx.txid);
|
||||
}
|
||||
}
|
||||
|
@ -970,15 +970,15 @@ class BitcoinWallet extends CoinServiceAPI {
|
|||
if (currentHeight != storedHeight) {
|
||||
if (currentHeight != -1) {
|
||||
// -1 failed to fetch current height
|
||||
updateStoredChainHeight(newHeight: currentHeight);
|
||||
unawaited(updateStoredChainHeight(newHeight: currentHeight));
|
||||
}
|
||||
|
||||
GlobalEventBus.instance.fire(RefreshPercentChangedEvent(0.2, walletId));
|
||||
Future changeAddressForTransactions =
|
||||
final changeAddressForTransactions =
|
||||
_checkChangeAddressForTransactions(DerivePathType.bip84);
|
||||
|
||||
GlobalEventBus.instance.fire(RefreshPercentChangedEvent(0.3, walletId));
|
||||
Future currentReceivingAddressesForTransactions =
|
||||
final currentReceivingAddressesForTransactions =
|
||||
_checkCurrentReceivingAddressesForTransactions();
|
||||
|
||||
final newTxData = _fetchTransactionData();
|
||||
|
@ -999,7 +999,7 @@ class BitcoinWallet extends CoinServiceAPI {
|
|||
GlobalEventBus.instance
|
||||
.fire(RefreshPercentChangedEvent(0.80, walletId));
|
||||
|
||||
Future allTxsToWatch = getAllTxsToWatch(await newTxData);
|
||||
final allTxsToWatch = getAllTxsToWatch(await newTxData);
|
||||
await Future.wait([
|
||||
newTxData,
|
||||
changeAddressForTransactions,
|
||||
|
@ -1358,7 +1358,7 @@ class BitcoinWallet extends CoinServiceAPI {
|
|||
);
|
||||
|
||||
if (shouldRefresh) {
|
||||
refresh();
|
||||
unawaited(refresh());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -251,7 +251,7 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
}
|
||||
|
||||
Future<void> updateStoredChainHeight({required int newHeight}) async {
|
||||
DB.instance.put<dynamic>(
|
||||
await DB.instance.put<dynamic>(
|
||||
boxName: walletId, key: "storedChainHeight", value: newHeight);
|
||||
}
|
||||
|
||||
|
@ -365,7 +365,7 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
"index: $index, \t GapCounter $account ${type.name}: $gapCounter",
|
||||
level: LogLevel.Info);
|
||||
|
||||
final ID = "k_$index";
|
||||
final _id = "k_$index";
|
||||
Map<String, String> txCountCallArgs = {};
|
||||
final Map<String, dynamic> receivingNodes = {};
|
||||
|
||||
|
@ -392,13 +392,13 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
throw Exception("No Path type $type exists");
|
||||
}
|
||||
receivingNodes.addAll({
|
||||
"${ID}_$j": {
|
||||
"${_id}_$j": {
|
||||
"node": node,
|
||||
"address": address,
|
||||
}
|
||||
});
|
||||
txCountCallArgs.addAll({
|
||||
"${ID}_$j": address,
|
||||
"${_id}_$j": address,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -407,9 +407,9 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
|
||||
// check and add appropriate addresses
|
||||
for (int k = 0; k < txCountBatchSize; k++) {
|
||||
int count = counts["${ID}_$k"]!;
|
||||
int count = counts["${_id}_$k"]!;
|
||||
if (count > 0) {
|
||||
final node = receivingNodes["${ID}_$k"];
|
||||
final node = receivingNodes["${_id}_$k"];
|
||||
// add address to array
|
||||
addressArray.add(node["address"] as String);
|
||||
iterationsAddressArray.add(node["address"] as String);
|
||||
|
@ -455,7 +455,7 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
} catch (e, s) {
|
||||
} catch (e) {
|
||||
//
|
||||
}
|
||||
}
|
||||
|
@ -485,13 +485,13 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
// receiving addresses
|
||||
Logging.instance
|
||||
.log("checking receiving addresses...", level: LogLevel.Info);
|
||||
Future resultReceive44 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
final resultReceive44 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip44, 0);
|
||||
|
||||
Logging.instance
|
||||
.log("checking change addresses...", level: LogLevel.Info);
|
||||
// change addresses
|
||||
Future resultChange44 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
final resultChange44 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip44, 1);
|
||||
|
||||
await Future.wait([
|
||||
|
@ -653,7 +653,7 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
// notify on new incoming transaction
|
||||
for (final tx in unconfirmedTxnsToNotifyPending) {
|
||||
if (tx.txType == "Received") {
|
||||
NotificationApi.showNotification(
|
||||
unawaited(NotificationApi.showNotification(
|
||||
title: "Incoming transaction",
|
||||
body: walletName,
|
||||
walletId: walletId,
|
||||
|
@ -664,10 +664,10 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
txid: tx.txid,
|
||||
confirmations: tx.confirmations,
|
||||
requiredConfirmations: MINIMUM_CONFIRMATIONS,
|
||||
);
|
||||
));
|
||||
await txTracker.addNotifiedPending(tx.txid);
|
||||
} else if (tx.txType == "Sent") {
|
||||
NotificationApi.showNotification(
|
||||
unawaited(NotificationApi.showNotification(
|
||||
title: "Sending transaction",
|
||||
body: walletName,
|
||||
walletId: walletId,
|
||||
|
@ -678,7 +678,7 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
txid: tx.txid,
|
||||
confirmations: tx.confirmations,
|
||||
requiredConfirmations: MINIMUM_CONFIRMATIONS,
|
||||
);
|
||||
));
|
||||
await txTracker.addNotifiedPending(tx.txid);
|
||||
}
|
||||
}
|
||||
|
@ -686,7 +686,7 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
// notify on confirmed
|
||||
for (final tx in unconfirmedTxnsToNotifyConfirmed) {
|
||||
if (tx.txType == "Received") {
|
||||
NotificationApi.showNotification(
|
||||
unawaited(NotificationApi.showNotification(
|
||||
title: "Incoming transaction confirmed",
|
||||
body: walletName,
|
||||
walletId: walletId,
|
||||
|
@ -694,11 +694,11 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
date: DateTime.now(),
|
||||
shouldWatchForUpdates: false,
|
||||
coinName: coin.name,
|
||||
);
|
||||
));
|
||||
|
||||
await txTracker.addNotifiedConfirmed(tx.txid);
|
||||
} else if (tx.txType == "Sent") {
|
||||
NotificationApi.showNotification(
|
||||
unawaited(NotificationApi.showNotification(
|
||||
title: "Outgoing transaction confirmed",
|
||||
body: walletName,
|
||||
walletId: walletId,
|
||||
|
@ -706,7 +706,7 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
date: DateTime.now(),
|
||||
shouldWatchForUpdates: false,
|
||||
coinName: coin.name,
|
||||
);
|
||||
));
|
||||
await txTracker.addNotifiedConfirmed(tx.txid);
|
||||
}
|
||||
}
|
||||
|
@ -770,7 +770,7 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
if (currentHeight != storedHeight) {
|
||||
if (currentHeight != -1) {
|
||||
// -1 failed to fetch current height
|
||||
updateStoredChainHeight(newHeight: currentHeight);
|
||||
unawaited(updateStoredChainHeight(newHeight: currentHeight));
|
||||
}
|
||||
|
||||
GlobalEventBus.instance.fire(RefreshPercentChangedEvent(0.2, walletId));
|
||||
|
@ -1127,7 +1127,7 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
);
|
||||
|
||||
if (shouldRefresh) {
|
||||
refresh();
|
||||
unawaited(refresh());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2796,7 +2796,7 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
);
|
||||
|
||||
// clear cache
|
||||
_cachedElectrumXClient.clearSharedTransactionCache(coin: coin);
|
||||
await _cachedElectrumXClient.clearSharedTransactionCache(coin: coin);
|
||||
|
||||
// back up data
|
||||
await _rescanBackup();
|
||||
|
@ -3062,6 +3062,7 @@ class DogecoinWallet extends CoinServiceAPI {
|
|||
return available - estimatedFee;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> generateNewAddress() async {
|
||||
try {
|
||||
await _incrementAddressIndexForChain(
|
||||
|
|
|
@ -225,7 +225,7 @@ Future<void> executeNative(Map<String, dynamic> arguments) async {
|
|||
sendPort
|
||||
.send("Error An error was thrown in this isolate $function: $e\n$s");
|
||||
} finally {
|
||||
Logging.instance.isar?.close();
|
||||
await Logging.instance.isar?.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -539,7 +539,7 @@ class EpicCashWallet extends CoinServiceAPI {
|
|||
// TODO notify ui/ fire event for node changed?
|
||||
|
||||
if (shouldRefresh) {
|
||||
refresh();
|
||||
unawaited(refresh());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -705,7 +705,7 @@ class EpicCashWallet extends CoinServiceAPI {
|
|||
try {
|
||||
result = await cancelPendingTransaction(tx_slate_id);
|
||||
Logging.instance.log("result?: $result", level: LogLevel.Info);
|
||||
if (result != null && !(result.toLowerCase().contains("error"))) {
|
||||
if (!(result.toLowerCase().contains("error"))) {
|
||||
await postCancel(
|
||||
receiveAddress, tx_slate_id, signature, sendersAddress);
|
||||
}
|
||||
|
@ -1180,10 +1180,10 @@ class EpicCashWallet extends CoinServiceAPI {
|
|||
transactionFees = message['result'] as String;
|
||||
});
|
||||
debugPrint(transactionFees);
|
||||
var decodeData;
|
||||
dynamic decodeData;
|
||||
try {
|
||||
decodeData = json.decode(transactionFees!);
|
||||
} catch (e, s) {
|
||||
} catch (e) {
|
||||
if (ifErrorEstimateFee) {
|
||||
//Error Not enough funds. Required: 0.56500000, Available: 0.56200000
|
||||
if (transactionFees!.contains("Required")) {
|
||||
|
@ -1705,7 +1705,7 @@ class EpicCashWallet extends CoinServiceAPI {
|
|||
|
||||
try {
|
||||
final String response = message['result'] as String;
|
||||
if (response == null || response == "") {
|
||||
if (response == "") {
|
||||
Logging.instance.log("response: ${response.runtimeType}",
|
||||
level: LogLevel.Info);
|
||||
await deleteSlate(currentAddress,
|
||||
|
@ -1921,7 +1921,7 @@ class EpicCashWallet extends CoinServiceAPI {
|
|||
if (currentHeight != storedHeight) {
|
||||
if (currentHeight != -1) {
|
||||
// -1 failed to fetch current height
|
||||
updateStoredChainHeight(newHeight: currentHeight);
|
||||
unawaited(updateStoredChainHeight(newHeight: currentHeight));
|
||||
}
|
||||
|
||||
final newTxData = _fetchTransactionData();
|
||||
|
@ -2288,7 +2288,7 @@ class EpicCashWallet extends CoinServiceAPI {
|
|||
timer?.cancel();
|
||||
timer = null;
|
||||
if (isActive) {
|
||||
startSync();
|
||||
unawaited(startSync());
|
||||
} else {
|
||||
for (final isolate in isolates.values) {
|
||||
isolate.kill(priority: Isolate.immediate);
|
||||
|
|
|
@ -1127,7 +1127,7 @@ class FiroWallet extends CoinServiceAPI {
|
|||
final balance =
|
||||
Format.decimalAmountToSatoshis(await availablePrivateBalance());
|
||||
if (satoshiAmount == balance) {
|
||||
print("is send all");
|
||||
// print("is send all");
|
||||
isSendAll = true;
|
||||
}
|
||||
dynamic txHexOrError =
|
||||
|
@ -2796,18 +2796,18 @@ class FiroWallet extends CoinServiceAPI {
|
|||
final listTxData = txData.getAllTransactions();
|
||||
listTxData.forEach((key, value) {
|
||||
// ignore change addresses
|
||||
bool hasAtLeastOneReceive = false;
|
||||
// bool hasAtLeastOneReceive = false;
|
||||
// int howManyReceiveInputs = 0;
|
||||
for (var element in value.inputs) {
|
||||
if (listLelantusTxData.containsKey(element.txid) &&
|
||||
listLelantusTxData[element.txid]!.txType == "Received"
|
||||
// &&
|
||||
// listLelantusTxData[element.txid].subType != "mint"
|
||||
) {
|
||||
hasAtLeastOneReceive = true;
|
||||
// howManyReceiveInputs++;
|
||||
}
|
||||
}
|
||||
// for (var element in value.inputs) {
|
||||
// if (listLelantusTxData.containsKey(element.txid) &&
|
||||
// listLelantusTxData[element.txid]!.txType == "Received"
|
||||
// // &&
|
||||
// // listLelantusTxData[element.txid].subType != "mint"
|
||||
// ) {
|
||||
// // hasAtLeastOneReceive = true;
|
||||
// // howManyReceiveInputs++;
|
||||
// }
|
||||
// }
|
||||
|
||||
if (value.txType == "Received" && value.subType != "mint") {
|
||||
// Every receive other than a mint should be shown. Mints will be collected and shown from the send side
|
||||
|
@ -4238,7 +4238,7 @@ class FiroWallet extends CoinServiceAPI {
|
|||
Future<void> _restore(int latestSetId, Map<dynamic, dynamic> setDataMap,
|
||||
dynamic usedSerialNumbers) async {
|
||||
final mnemonic = await _secureStore.read(key: '${_walletId}_mnemonic');
|
||||
Future data = _txnData;
|
||||
final dataFuture = _txnData;
|
||||
final String currency = _prefs.currency;
|
||||
final Decimal currentPrice = await firoPrice;
|
||||
|
||||
|
@ -4252,7 +4252,7 @@ class FiroWallet extends CoinServiceAPI {
|
|||
"network": _network,
|
||||
});
|
||||
|
||||
await Future.wait([data]);
|
||||
await Future.wait([dataFuture]);
|
||||
var result = await receivePort.first;
|
||||
if (result is String) {
|
||||
Logging.instance
|
||||
|
@ -4263,8 +4263,7 @@ class FiroWallet extends CoinServiceAPI {
|
|||
stop(receivePort);
|
||||
|
||||
final message = await staticProcessRestore(
|
||||
(await data) as models.TransactionData,
|
||||
result as Map<dynamic, dynamic>);
|
||||
(await dataFuture), result as Map<dynamic, dynamic>);
|
||||
|
||||
await DB.instance.put<dynamic>(
|
||||
boxName: walletId, key: 'mintIndex', value: message['mintIndex']);
|
||||
|
@ -4305,7 +4304,7 @@ class FiroWallet extends CoinServiceAPI {
|
|||
final latestSetId = await getLatestSetId();
|
||||
|
||||
final List<Map<String, dynamic>> sets = [];
|
||||
List<Future> anonFutures = [];
|
||||
List<Future<Map<String, dynamic>>> anonFutures = [];
|
||||
for (int i = 1; i <= latestSetId; i++) {
|
||||
final set = cachedElectrumXClient.getAnonymitySet(
|
||||
groupId: "$i",
|
||||
|
@ -4315,8 +4314,7 @@ class FiroWallet extends CoinServiceAPI {
|
|||
}
|
||||
await Future.wait(anonFutures);
|
||||
for (int i = 1; i <= latestSetId; i++) {
|
||||
Map<String, dynamic> set =
|
||||
(await anonFutures[i - 1]) as Map<String, dynamic>;
|
||||
Map<String, dynamic> set = (await anonFutures[i - 1]);
|
||||
set["setId"] = i;
|
||||
sets.add(set);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue