mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-03-28 18:19:13 +00:00
[skip ci] review updates pt.1
This commit is contained in:
parent
57a88cc522
commit
bb6d89a4b8
4 changed files with 38 additions and 14 deletions
cw_bitcoin/lib
lib
|
@ -610,7 +610,7 @@ abstract class ElectrumWalletBase
|
|||
bool spendsUnconfirmedTX = false;
|
||||
|
||||
int leftAmount = credentialsAmount;
|
||||
final availableInputs = unspentCoins.where((utx) {
|
||||
var availableInputs = unspentCoins.where((utx) {
|
||||
if (!utx.isSending || utx.isFrozen) {
|
||||
return false;
|
||||
}
|
||||
|
@ -627,7 +627,7 @@ abstract class ElectrumWalletBase
|
|||
final unconfirmedCoins = availableInputs.where((utx) => utx.confirmations == 0).toList();
|
||||
|
||||
// sort the unconfirmed coins so that mweb coins are first:
|
||||
unconfirmedCoins.sort((a, b) => a.bitcoinAddressRecord.type == SegwitAddresType.mweb ? -1 : 1);
|
||||
availableInputs.sort((a, b) => a.bitcoinAddressRecord.type == SegwitAddresType.mweb ? -1 : 1);
|
||||
|
||||
for (int i = 0; i < availableInputs.length; i++) {
|
||||
final utx = availableInputs[i];
|
||||
|
@ -1026,7 +1026,6 @@ abstract class ElectrumWalletBase
|
|||
Future<PendingTransaction> createTransaction(Object credentials) async {
|
||||
try {
|
||||
final outputs = <BitcoinOutput>[];
|
||||
List<BitcoinScriptOutput>? outputsOverride;
|
||||
final transactionCredentials = credentials as BitcoinTransactionCredentials;
|
||||
final hasMultiDestination = transactionCredentials.outputs.length > 1;
|
||||
final sendAll = !hasMultiDestination && transactionCredentials.outputs.first.sendAll;
|
||||
|
|
|
@ -393,11 +393,10 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
|
|||
// print("updating confs ${tx.id} from ${tx.confirmations} -> $confirmations");
|
||||
|
||||
// if an outgoing tx is now confirmed, delete the utxo from the box (delete the unspent coin):
|
||||
if (tx.confirmations >= 2 &&
|
||||
if (confirmations >= 2 &&
|
||||
tx.direction == TransactionDirection.outgoing &&
|
||||
tx.unspents != null) {
|
||||
for (var coin in tx.unspents!) {
|
||||
print(coin.address);
|
||||
final utxo = mwebUtxosBox.get(coin.address);
|
||||
if (utxo != null) {
|
||||
print("deleting utxo ${coin.address} @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
|
||||
|
@ -1051,8 +1050,11 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
|
|||
hasMwebOutput = true;
|
||||
break;
|
||||
}
|
||||
if (!(output.address.toLowerCase().contains("mweb")) ||
|
||||
!(output.extractedAddress?.toLowerCase().contains("mweb") ?? false)) {
|
||||
if (!(output.address.toLowerCase().contains("mweb"))) {
|
||||
hasRegularOutput = true;
|
||||
}
|
||||
final extractedAddress = output.extractedAddress;
|
||||
if (extractedAddress != null && !(extractedAddress.toLowerCase().contains("mweb"))) {
|
||||
hasRegularOutput = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import 'dart:io';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
|
@ -10,7 +11,6 @@ import 'package:cake_wallet/view_model/settings/mweb_settings_view_model.dart';
|
|||
import 'package:cw_core/root_dir.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
class MwebLogsPage extends BasePage {
|
||||
|
@ -81,14 +81,38 @@ class MwebLogsPage extends BasePage {
|
|||
rightButtonText: S.of(context).save_to_downloads,
|
||||
leftButtonText: S.of(context).share,
|
||||
actionRightButton: () async {
|
||||
const downloadDirPath = "/storage/emulated/0/Download";
|
||||
final filePath = downloadDirPath + "/debug.log";
|
||||
await mwebSettingsViewModelBase.saveLogsLocally(filePath);
|
||||
try {
|
||||
const downloadDirPath = "/storage/emulated/0/Download";
|
||||
final filePath = downloadDirPath + "/debug.log";
|
||||
await mwebSettingsViewModelBase.saveLogsLocally(filePath);
|
||||
} catch (e) {
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (_) {
|
||||
return AlertWithOneAction(
|
||||
alertTitle: S.current.error,
|
||||
alertContent: e.toString(),
|
||||
buttonText: S.of(context).ok,
|
||||
buttonAction: () => Navigator.of(context).pop(),
|
||||
);
|
||||
});
|
||||
}
|
||||
Navigator.of(dialogContext).pop();
|
||||
},
|
||||
actionLeftButton: () async {
|
||||
Navigator.of(dialogContext).pop();
|
||||
await share(context);
|
||||
try {
|
||||
await share(context);
|
||||
} catch (e) {
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (_) => AlertWithOneAction(
|
||||
alertTitle: S.current.error,
|
||||
alertContent: e.toString(),
|
||||
buttonText: S.of(context).ok,
|
||||
buttonAction: () => Navigator.of(context).pop(),
|
||||
));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -71,12 +71,11 @@ class TransactionListItem extends ActionListItem with Keyable {
|
|||
case WalletType.litecoin:
|
||||
bool isPegIn = (transaction.additionalInfo["isPegIn"] as bool?) ?? false;
|
||||
bool isPegOut = (transaction.additionalInfo["isPegOut"] as bool?) ?? false;
|
||||
bool isPegInOut = isPegIn || isPegOut;
|
||||
String str = '';
|
||||
if (transaction.confirmations <= 0) {
|
||||
str = S.current.pending;
|
||||
}
|
||||
if (isPegInOut && transaction.confirmations >= 0 && transaction.confirmations < 6) {
|
||||
if (isPegOut && transaction.confirmations >= 0 && transaction.confirmations < 6) {
|
||||
str = " (${transaction.confirmations}/6)";
|
||||
}
|
||||
if (isPegIn) {
|
||||
|
|
Loading…
Reference in a new issue