mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-16 17:27:39 +00:00
min/required confirmations switch
This commit is contained in:
parent
7ddf212091
commit
e20d16436d
15 changed files with 95 additions and 113 deletions
|
@ -112,6 +112,12 @@ class _CoinControlViewState extends ConsumerState<CoinControlView> {
|
|||
Widget build(BuildContext context) {
|
||||
debugPrint("BUILD: $runtimeType");
|
||||
|
||||
final minConfirms = ref
|
||||
.watch(pWallets)
|
||||
.getWallet(widget.walletId)
|
||||
.cryptoCurrency
|
||||
.minConfirms;
|
||||
|
||||
final coin = ref.watch(pWalletCoin(widget.walletId));
|
||||
final currentHeight = ref.watch(pWalletChainHeight(widget.walletId));
|
||||
|
||||
|
@ -340,7 +346,7 @@ class _CoinControlViewState extends ConsumerState<CoinControlView> {
|
|||
!utxo.isBlocked &&
|
||||
utxo.isConfirmed(
|
||||
currentHeight,
|
||||
coin.requiredConfirmations,
|
||||
minConfirms,
|
||||
)),
|
||||
initialSelectedState: isSelected,
|
||||
onSelectedChanged: (value) {
|
||||
|
@ -403,7 +409,7 @@ class _CoinControlViewState extends ConsumerState<CoinControlView> {
|
|||
!_showBlocked &&
|
||||
utxo.isConfirmed(
|
||||
currentHeight,
|
||||
coin.requiredConfirmations,
|
||||
minConfirms,
|
||||
)),
|
||||
initialSelectedState: isSelected,
|
||||
onSelectedChanged: (value) {
|
||||
|
@ -545,7 +551,7 @@ class _CoinControlViewState extends ConsumerState<CoinControlView> {
|
|||
!utxo.isBlocked &&
|
||||
utxo.isConfirmed(
|
||||
currentHeight,
|
||||
coin.requiredConfirmations,
|
||||
minConfirms,
|
||||
)),
|
||||
initialSelectedState: isSelected,
|
||||
onSelectedChanged: (value) {
|
||||
|
|
|
@ -12,6 +12,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:stackwallet/db/isar/main_db.dart';
|
||||
import 'package:stackwallet/models/isar/models/isar_models.dart';
|
||||
import 'package:stackwallet/providers/global/wallets_provider.dart';
|
||||
import 'package:stackwallet/themes/stack_colors.dart';
|
||||
import 'package:stackwallet/utilities/amount/amount.dart';
|
||||
import 'package:stackwallet/utilities/amount/amount_formatter.dart';
|
||||
|
@ -111,7 +112,11 @@ class _UtxoCardState extends ConsumerState<UtxoCard> {
|
|||
blocked: utxo.isBlocked,
|
||||
status: utxo.isConfirmed(
|
||||
currentHeight,
|
||||
coin.requiredConfirmations,
|
||||
ref
|
||||
.watch(pWallets)
|
||||
.getWallet(widget.walletId)
|
||||
.cryptoCurrency
|
||||
.minConfirms,
|
||||
)
|
||||
? UTXOStatusIconStatus.confirmed
|
||||
: UTXOStatusIconStatus.unconfirmed,
|
||||
|
|
|
@ -16,6 +16,7 @@ import 'package:isar/isar.dart';
|
|||
import 'package:stackwallet/db/isar/main_db.dart';
|
||||
import 'package:stackwallet/models/isar/models/isar_models.dart';
|
||||
import 'package:stackwallet/pages/wallet_view/transaction_views/transaction_details_view.dart';
|
||||
import 'package:stackwallet/providers/global/wallets_provider.dart';
|
||||
import 'package:stackwallet/themes/stack_colors.dart';
|
||||
import 'package:stackwallet/utilities/amount/amount.dart';
|
||||
import 'package:stackwallet/utilities/amount/amount_formatter.dart';
|
||||
|
@ -96,7 +97,7 @@ class _UtxoDetailsViewState extends ConsumerState<UtxoDetailsView> {
|
|||
|
||||
final confirmed = utxo!.isConfirmed(
|
||||
currentHeight,
|
||||
coin.requiredConfirmations,
|
||||
ref.watch(pWallets).getWallet(widget.walletId).cryptoCurrency.minConfirms,
|
||||
);
|
||||
|
||||
return ConditionalParent(
|
||||
|
|
|
@ -46,7 +46,8 @@ class TokenTransactionsList extends ConsumerStatefulWidget {
|
|||
}
|
||||
|
||||
class _TransactionsListState extends ConsumerState<TokenTransactionsList> {
|
||||
//
|
||||
late final int minConfirms;
|
||||
|
||||
bool _hasLoaded = false;
|
||||
List<Transaction> _transactions2 = [];
|
||||
|
||||
|
@ -97,7 +98,7 @@ class _TransactionsListState extends ConsumerState<TokenTransactionsList> {
|
|||
// this may mess with combined firo transactions
|
||||
key: tx.isConfirmed(
|
||||
ref.watch(pWalletChainHeight(widget.walletId)),
|
||||
coin.requiredConfirmations)
|
||||
minConfirms)
|
||||
? Key(tx.txid + tx.type.name + tx.address.value.toString())
|
||||
: UniqueKey(), //
|
||||
transaction: tx,
|
||||
|
@ -194,8 +195,8 @@ class _TransactionsListState extends ConsumerState<TokenTransactionsList> {
|
|||
),
|
||||
child: TransactionCard(
|
||||
// this may mess with combined firo transactions
|
||||
key: tx.isConfirmed(ref.watch(pWalletChainHeight(widget.walletId)),
|
||||
coin.requiredConfirmations)
|
||||
key: tx.isConfirmed(
|
||||
ref.watch(pWalletChainHeight(widget.walletId)), minConfirms)
|
||||
? Key(tx.txid + tx.type.name + tx.address.value.toString())
|
||||
: UniqueKey(),
|
||||
transaction: tx,
|
||||
|
@ -205,6 +206,16 @@ class _TransactionsListState extends ConsumerState<TokenTransactionsList> {
|
|||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
minConfirms = ref
|
||||
.read(pWallets)
|
||||
.getWallet(widget.walletId)
|
||||
.cryptoCurrency
|
||||
.minConfirms;
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final wallet =
|
||||
|
|
|
@ -16,6 +16,7 @@ import 'package:flutter_svg/svg.dart';
|
|||
import 'package:stackwallet/models/isar/models/blockchain_data/v2/transaction_v2.dart';
|
||||
import 'package:stackwallet/models/isar/models/isar_models.dart';
|
||||
import 'package:stackwallet/models/isar/stack_theme.dart';
|
||||
import 'package:stackwallet/providers/global/wallets_provider.dart';
|
||||
import 'package:stackwallet/themes/theme_providers.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
|
@ -87,7 +88,7 @@ class TxIcon extends ConsumerWidget {
|
|||
txIsReceived,
|
||||
!tx.isConfirmed(
|
||||
currentHeight,
|
||||
coin.requiredConfirmations,
|
||||
ref.watch(pWallets).getWallet(tx.walletId).cryptoCurrency.minConfirms,
|
||||
),
|
||||
tx.subType,
|
||||
ref.watch(themeAssetsProvider),
|
||||
|
@ -100,7 +101,7 @@ class TxIcon extends ConsumerWidget {
|
|||
txIsReceived,
|
||||
!tx.isConfirmed(
|
||||
currentHeight,
|
||||
coin.requiredConfirmations,
|
||||
ref.watch(pWallets).getWallet(tx.walletId).cryptoCurrency.minConfirms,
|
||||
),
|
||||
tx.subType,
|
||||
ref.watch(themeAssetsProvider),
|
||||
|
|
|
@ -833,6 +833,7 @@ class _DesktopTransactionCardRowState
|
|||
extends ConsumerState<DesktopTransactionCardRow> {
|
||||
late final Transaction _transaction;
|
||||
late final String walletId;
|
||||
late final int minConfirms;
|
||||
|
||||
String whatIsIt(TransactionType type, Coin coin, int height) {
|
||||
if (coin == Coin.epicCash && _transaction.slateId == null) {
|
||||
|
@ -840,7 +841,7 @@ class _DesktopTransactionCardRowState
|
|||
}
|
||||
|
||||
if (_transaction.subType == TransactionSubType.mint) {
|
||||
if (_transaction.isConfirmed(height, coin.requiredConfirmations)) {
|
||||
if (_transaction.isConfirmed(height, minConfirms)) {
|
||||
return "Anonymized";
|
||||
} else {
|
||||
return "Anonymizing";
|
||||
|
@ -848,13 +849,13 @@ class _DesktopTransactionCardRowState
|
|||
}
|
||||
|
||||
if (type == TransactionType.incoming) {
|
||||
if (_transaction.isConfirmed(height, coin.requiredConfirmations)) {
|
||||
if (_transaction.isConfirmed(height, minConfirms)) {
|
||||
return "Received";
|
||||
} else {
|
||||
return "Receiving";
|
||||
}
|
||||
} else if (type == TransactionType.outgoing) {
|
||||
if (_transaction.isConfirmed(height, coin.requiredConfirmations)) {
|
||||
if (_transaction.isConfirmed(height, minConfirms)) {
|
||||
return "Sent";
|
||||
} else {
|
||||
return "Sending";
|
||||
|
@ -869,6 +870,8 @@ class _DesktopTransactionCardRowState
|
|||
@override
|
||||
void initState() {
|
||||
walletId = widget.walletId;
|
||||
minConfirms =
|
||||
ref.read(pWallets).getWallet(walletId).cryptoCurrency.minConfirms;
|
||||
_transaction = widget.transaction;
|
||||
super.initState();
|
||||
}
|
||||
|
|
|
@ -86,6 +86,7 @@ class _TransactionDetailsViewState
|
|||
late final String unit;
|
||||
late final bool isTokenTx;
|
||||
late final EthContract? ethContract;
|
||||
late final int minConfirms;
|
||||
|
||||
bool showFeePending = false;
|
||||
|
||||
|
@ -96,6 +97,11 @@ class _TransactionDetailsViewState
|
|||
isTokenTx = _transaction.subType == TransactionSubType.ethToken;
|
||||
walletId = widget.walletId;
|
||||
|
||||
minConfirms = ref
|
||||
.read(pWallets)
|
||||
.getWallet(widget.walletId)
|
||||
.cryptoCurrency
|
||||
.minConfirms;
|
||||
coin = widget.coin;
|
||||
amount = _transaction.realAmount;
|
||||
fee = _transaction.fee.toAmountAsRaw(fractionDigits: coin.decimals);
|
||||
|
@ -130,7 +136,7 @@ class _TransactionDetailsViewState
|
|||
final type = tx.type;
|
||||
if (coin == Coin.firo || coin == Coin.firoTestNet) {
|
||||
if (tx.subType == TransactionSubType.mint) {
|
||||
if (tx.isConfirmed(height, coin.requiredConfirmations)) {
|
||||
if (tx.isConfirmed(height, minConfirms)) {
|
||||
return "Minted";
|
||||
} else {
|
||||
return "Minting";
|
||||
|
@ -142,7 +148,7 @@ class _TransactionDetailsViewState
|
|||
if (_transaction.isCancelled) {
|
||||
return "Cancelled";
|
||||
} else if (type == TransactionType.incoming) {
|
||||
if (tx.isConfirmed(height, coin.requiredConfirmations)) {
|
||||
if (tx.isConfirmed(height, minConfirms)) {
|
||||
return "Received";
|
||||
} else {
|
||||
if (_transaction.numberOfMessages == 1) {
|
||||
|
@ -154,7 +160,7 @@ class _TransactionDetailsViewState
|
|||
}
|
||||
}
|
||||
} else if (type == TransactionType.outgoing) {
|
||||
if (tx.isConfirmed(height, coin.requiredConfirmations)) {
|
||||
if (tx.isConfirmed(height, minConfirms)) {
|
||||
return "Sent (confirmed)";
|
||||
} else {
|
||||
if (_transaction.numberOfMessages == 1) {
|
||||
|
@ -172,13 +178,13 @@ class _TransactionDetailsViewState
|
|||
// if (_transaction.isMinting) {
|
||||
// return "Minting";
|
||||
// } else
|
||||
if (tx.isConfirmed(height, coin.requiredConfirmations)) {
|
||||
if (tx.isConfirmed(height, minConfirms)) {
|
||||
return "Received";
|
||||
} else {
|
||||
return "Receiving";
|
||||
}
|
||||
} else if (type == TransactionType.outgoing) {
|
||||
if (tx.isConfirmed(height, coin.requiredConfirmations)) {
|
||||
if (tx.isConfirmed(height, minConfirms)) {
|
||||
return "Sent";
|
||||
} else {
|
||||
return "Sending";
|
||||
|
@ -1041,7 +1047,7 @@ class _TransactionDetailsViewState
|
|||
String feeString = showFeePending
|
||||
? _transaction.isConfirmed(
|
||||
currentHeight,
|
||||
coin.requiredConfirmations,
|
||||
minConfirms,
|
||||
)
|
||||
? ref
|
||||
.watch(pAmountFormatter(coin))
|
||||
|
@ -1140,7 +1146,7 @@ class _TransactionDetailsViewState
|
|||
height = widget.coin != Coin.epicCash &&
|
||||
_transaction.isConfirmed(
|
||||
currentHeight,
|
||||
coin.requiredConfirmations,
|
||||
minConfirms,
|
||||
)
|
||||
? "${_transaction.height == 0 ? "Unknown" : _transaction.height}"
|
||||
: _transaction.getConfirmations(
|
||||
|
|
|
@ -819,11 +819,12 @@ class _DesktopTransactionCardRowState
|
|||
extends ConsumerState<DesktopTransactionCardRow> {
|
||||
late final TransactionV2 _transaction;
|
||||
late final String walletId;
|
||||
late final int minConfirms;
|
||||
|
||||
String whatIsIt(TransactionType type, Coin coin, int height) {
|
||||
if (_transaction.subType == TransactionSubType.mint ||
|
||||
_transaction.subType == TransactionSubType.cashFusion) {
|
||||
if (_transaction.isConfirmed(height, coin.requiredConfirmations)) {
|
||||
if (_transaction.isConfirmed(height, minConfirms)) {
|
||||
return "Anonymized";
|
||||
} else {
|
||||
return "Anonymizing";
|
||||
|
@ -831,13 +832,13 @@ class _DesktopTransactionCardRowState
|
|||
}
|
||||
|
||||
if (type == TransactionType.incoming) {
|
||||
if (_transaction.isConfirmed(height, coin.requiredConfirmations)) {
|
||||
if (_transaction.isConfirmed(height, minConfirms)) {
|
||||
return "Received";
|
||||
} else {
|
||||
return "Receiving";
|
||||
}
|
||||
} else if (type == TransactionType.outgoing) {
|
||||
if (_transaction.isConfirmed(height, coin.requiredConfirmations)) {
|
||||
if (_transaction.isConfirmed(height, minConfirms)) {
|
||||
return "Sent";
|
||||
} else {
|
||||
return "Sending";
|
||||
|
@ -852,6 +853,11 @@ class _DesktopTransactionCardRowState
|
|||
@override
|
||||
void initState() {
|
||||
walletId = widget.walletId;
|
||||
minConfirms = ref
|
||||
.read(pWallets)
|
||||
.getWallet(widget.walletId)
|
||||
.cryptoCurrency
|
||||
.minConfirms;
|
||||
_transaction = widget.transaction;
|
||||
super.initState();
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import 'package:stackwallet/pages/wallet_view/transaction_views/tx_v2/transactio
|
|||
import 'package:stackwallet/providers/global/locale_provider.dart';
|
||||
import 'package:stackwallet/providers/global/prefs_provider.dart';
|
||||
import 'package:stackwallet/providers/global/price_provider.dart';
|
||||
import 'package:stackwallet/providers/global/wallets_provider.dart';
|
||||
import 'package:stackwallet/themes/stack_colors.dart';
|
||||
import 'package:stackwallet/utilities/amount/amount.dart';
|
||||
import 'package:stackwallet/utilities/amount/amount_formatter.dart';
|
||||
|
@ -46,7 +47,7 @@ class _TransactionCardStateV2 extends ConsumerState<TransactionCardV2> {
|
|||
) {
|
||||
final confirmedStatus = _transaction.isConfirmed(
|
||||
currentHeight,
|
||||
coin.requiredConfirmations,
|
||||
ref.read(pWallets).getWallet(walletId).cryptoCurrency.minConfirms,
|
||||
);
|
||||
|
||||
if (_transaction.subType == TransactionSubType.cashFusion) {
|
||||
|
|
|
@ -79,6 +79,7 @@ class _TransactionV2DetailsViewState
|
|||
late final Amount fee;
|
||||
late final String amountPrefix;
|
||||
late final String unit;
|
||||
late final int minConfirms;
|
||||
|
||||
late final List<({List<String> addresses, Amount amount})> data;
|
||||
|
||||
|
@ -91,6 +92,8 @@ class _TransactionV2DetailsViewState
|
|||
walletId = widget.walletId;
|
||||
|
||||
coin = widget.coin;
|
||||
minConfirms =
|
||||
ref.read(pWallets).getWallet(walletId).cryptoCurrency.minConfirms;
|
||||
|
||||
fee = _transaction.getFee(coin: coin);
|
||||
|
||||
|
@ -165,7 +168,7 @@ class _TransactionV2DetailsViewState
|
|||
final type = tx.type;
|
||||
if (coin == Coin.firo || coin == Coin.firoTestNet) {
|
||||
if (tx.subType == TransactionSubType.mint) {
|
||||
if (tx.isConfirmed(height, coin.requiredConfirmations)) {
|
||||
if (tx.isConfirmed(height, minConfirms)) {
|
||||
return "Minted";
|
||||
} else {
|
||||
return "Minting";
|
||||
|
@ -177,7 +180,7 @@ class _TransactionV2DetailsViewState
|
|||
// if (_transaction.isCancelled) {
|
||||
// return "Cancelled";
|
||||
// } else if (type == TransactionType.incoming) {
|
||||
// if (tx.isConfirmed(height, coin.requiredConfirmations)) {
|
||||
// if (tx.isConfirmed(height, minConfirms)) {
|
||||
// return "Received";
|
||||
// } else {
|
||||
// if (_transaction.numberOfMessages == 1) {
|
||||
|
@ -189,7 +192,7 @@ class _TransactionV2DetailsViewState
|
|||
// }
|
||||
// }
|
||||
// } else if (type == TransactionType.outgoing) {
|
||||
// if (tx.isConfirmed(height, coin.requiredConfirmations)) {
|
||||
// if (tx.isConfirmed(height, minConfirms)) {
|
||||
// return "Sent (confirmed)";
|
||||
// } else {
|
||||
// if (_transaction.numberOfMessages == 1) {
|
||||
|
@ -204,7 +207,7 @@ class _TransactionV2DetailsViewState
|
|||
// }
|
||||
|
||||
if (tx.subType == TransactionSubType.cashFusion) {
|
||||
if (tx.isConfirmed(height, coin.requiredConfirmations)) {
|
||||
if (tx.isConfirmed(height, minConfirms)) {
|
||||
return "Anonymized";
|
||||
} else {
|
||||
return "Anonymizing";
|
||||
|
@ -215,13 +218,13 @@ class _TransactionV2DetailsViewState
|
|||
// if (_transaction.isMinting) {
|
||||
// return "Minting";
|
||||
// } else
|
||||
if (tx.isConfirmed(height, coin.requiredConfirmations)) {
|
||||
if (tx.isConfirmed(height, minConfirms)) {
|
||||
return "Received";
|
||||
} else {
|
||||
return "Receiving";
|
||||
}
|
||||
} else if (type == TransactionType.outgoing) {
|
||||
if (tx.isConfirmed(height, coin.requiredConfirmations)) {
|
||||
if (tx.isConfirmed(height, minConfirms)) {
|
||||
return "Sent";
|
||||
} else {
|
||||
return "Sending";
|
||||
|
@ -1090,7 +1093,7 @@ class _TransactionV2DetailsViewState
|
|||
String feeString = showFeePending
|
||||
? _transaction.isConfirmed(
|
||||
currentHeight,
|
||||
coin.requiredConfirmations,
|
||||
minConfirms,
|
||||
)
|
||||
? ref
|
||||
.watch(pAmountFormatter(coin))
|
||||
|
@ -1187,7 +1190,7 @@ class _TransactionV2DetailsViewState
|
|||
height = widget.coin != Coin.epicCash &&
|
||||
_transaction.isConfirmed(
|
||||
currentHeight,
|
||||
coin.requiredConfirmations,
|
||||
minConfirms,
|
||||
)
|
||||
? "${_transaction.height == 0 ? "Unknown" : _transaction.height}"
|
||||
: _transaction.getConfirmations(
|
||||
|
|
|
@ -14,6 +14,7 @@ import 'package:isar/isar.dart';
|
|||
import 'package:stackwallet/db/isar/main_db.dart';
|
||||
import 'package:stackwallet/models/isar/models/isar_models.dart';
|
||||
import 'package:stackwallet/pages/coin_control/utxo_details_view.dart';
|
||||
import 'package:stackwallet/providers/global/wallets_provider.dart';
|
||||
import 'package:stackwallet/themes/stack_colors.dart';
|
||||
import 'package:stackwallet/utilities/amount/amount.dart';
|
||||
import 'package:stackwallet/utilities/amount/amount_formatter.dart';
|
||||
|
@ -136,7 +137,11 @@ class _UtxoRowState extends ConsumerState<UtxoRow> {
|
|||
blocked: utxo.isBlocked,
|
||||
status: utxo.isConfirmed(
|
||||
ref.watch(pWalletChainHeight(widget.walletId)),
|
||||
coin.requiredConfirmations,
|
||||
ref
|
||||
.watch(pWallets)
|
||||
.getWallet(widget.walletId)
|
||||
.cryptoCurrency
|
||||
.minConfirms,
|
||||
)
|
||||
? UTXOStatusIconStatus.confirmed
|
||||
: UTXOStatusIconStatus.unconfirmed,
|
||||
|
|
|
@ -74,9 +74,12 @@ mixin CoinControlInterface {
|
|||
if (utxo.isBlocked) {
|
||||
satoshiBalanceBlocked += utxoAmount;
|
||||
} else {
|
||||
// TODO: [prio=high] Fix this
|
||||
throw UnimplementedError(
|
||||
"Fix the following 42 (should be min confirms)");
|
||||
if (utxo.isConfirmed(
|
||||
currentChainHeight,
|
||||
_coin.requiredConfirmations,
|
||||
42,
|
||||
)) {
|
||||
satoshiBalanceSpendable += utxoAmount;
|
||||
} else {
|
||||
|
|
|
@ -20,6 +20,7 @@ import 'package:stackwallet/services/exchange/exchange_response.dart';
|
|||
import 'package:stackwallet/services/node_service.dart';
|
||||
import 'package:stackwallet/services/notifications_api.dart';
|
||||
import 'package:stackwallet/services/trade_service.dart';
|
||||
import 'package:stackwallet/services/wallets.dart';
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
import 'package:stackwallet/utilities/logger.dart';
|
||||
import 'package:stackwallet/utilities/prefs.dart';
|
||||
|
@ -118,6 +119,7 @@ class NotificationsService extends ChangeNotifier {
|
|||
try {
|
||||
final Coin coin = coinFromPrettyName(notification.coinName);
|
||||
final txid = notification.txid!;
|
||||
final wallet = Wallets.sharedInstance.getWallet(notification.walletId);
|
||||
|
||||
final node = nodeService.getPrimaryNodeFor(coin: coin);
|
||||
if (node != null) {
|
||||
|
@ -153,14 +155,14 @@ class NotificationsService extends ChangeNotifier {
|
|||
// check if the number of confirmations is greater than the number
|
||||
// required by the wallet to count the tx as confirmed and update the
|
||||
// flag on whether this notification should still be monitored
|
||||
if (confirmations >= coin.requiredConfirmations) {
|
||||
if (confirmations >= wallet.cryptoCurrency.minConfirms) {
|
||||
shouldWatchForUpdates = false;
|
||||
confirmations = coin.requiredConfirmations;
|
||||
confirmations = wallet.cryptoCurrency.minConfirms;
|
||||
}
|
||||
|
||||
// grab confirms string to compare
|
||||
final String newConfirms =
|
||||
"($confirmations/${coin.requiredConfirmations})";
|
||||
"($confirmations/${wallet.cryptoCurrency.minConfirms})";
|
||||
final String oldConfirms = notification.title
|
||||
.substring(notification.title.lastIndexOf("("));
|
||||
|
||||
|
|
|
@ -8,24 +8,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
import 'package:stackwallet/services/coins/bitcoincash/bitcoincash_wallet.dart'
|
||||
as bch;
|
||||
import 'package:stackwallet/services/coins/ecash/ecash_wallet.dart' as ecash;
|
||||
import 'package:stackwallet/services/coins/epiccash/epiccash_wallet.dart'
|
||||
as epic;
|
||||
import 'package:stackwallet/services/coins/ethereum/ethereum_wallet.dart'
|
||||
as eth;
|
||||
import 'package:stackwallet/services/coins/firo/firo_wallet.dart' as firo;
|
||||
import 'package:stackwallet/services/coins/litecoin/litecoin_wallet.dart'
|
||||
as ltc;
|
||||
import 'package:stackwallet/services/coins/monero/monero_wallet.dart' as xmr;
|
||||
import 'package:stackwallet/services/coins/namecoin/namecoin_wallet.dart'
|
||||
as nmc;
|
||||
import 'package:stackwallet/services/coins/nano/nano_wallet.dart' as nano;
|
||||
import 'package:stackwallet/services/coins/particl/particl_wallet.dart'
|
||||
as particl;
|
||||
import 'package:stackwallet/services/coins/stellar/stellar_wallet.dart' as xlm;
|
||||
import 'package:stackwallet/services/coins/tezos/tezos_wallet.dart' as tezos;
|
||||
import 'package:stackwallet/utilities/constants.dart';
|
||||
|
||||
enum Coin {
|
||||
|
@ -371,62 +353,6 @@ extension CoinExt on Coin {
|
|||
}
|
||||
}
|
||||
|
||||
int get requiredConfirmations {
|
||||
switch (this) {
|
||||
case Coin.bitcoin:
|
||||
case Coin.bitcoinTestNet:
|
||||
throw UnimplementedError("moved");
|
||||
|
||||
case Coin.litecoin:
|
||||
case Coin.litecoinTestNet:
|
||||
return ltc.MINIMUM_CONFIRMATIONS;
|
||||
|
||||
case Coin.bitcoincash:
|
||||
case Coin.bitcoincashTestnet:
|
||||
return bch.MINIMUM_CONFIRMATIONS;
|
||||
|
||||
case Coin.firo:
|
||||
case Coin.firoTestNet:
|
||||
return firo.MINIMUM_CONFIRMATIONS;
|
||||
|
||||
case Coin.dogecoin:
|
||||
case Coin.dogecoinTestNet:
|
||||
throw UnimplementedError("moved");
|
||||
|
||||
case Coin.epicCash:
|
||||
return epic.MINIMUM_CONFIRMATIONS;
|
||||
|
||||
case Coin.eCash:
|
||||
return ecash.MINIMUM_CONFIRMATIONS;
|
||||
|
||||
case Coin.ethereum:
|
||||
return eth.MINIMUM_CONFIRMATIONS;
|
||||
|
||||
case Coin.monero:
|
||||
return xmr.MINIMUM_CONFIRMATIONS;
|
||||
|
||||
case Coin.particl:
|
||||
return particl.MINIMUM_CONFIRMATIONS;
|
||||
|
||||
case Coin.stellar:
|
||||
case Coin.stellarTestnet:
|
||||
return xlm.MINIMUM_CONFIRMATIONS;
|
||||
|
||||
case Coin.tezos:
|
||||
return tezos.MINIMUM_CONFIRMATIONS;
|
||||
|
||||
case Coin.wownero:
|
||||
throw UnimplementedError("moved");
|
||||
|
||||
case Coin.namecoin:
|
||||
return nmc.MINIMUM_CONFIRMATIONS;
|
||||
|
||||
case Coin.nano:
|
||||
case Coin.banano:
|
||||
return nano.MINIMUM_CONFIRMATIONS;
|
||||
}
|
||||
}
|
||||
|
||||
int get decimals => Constants.decimalPlacesForCoin(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ class _TransactionCardState extends ConsumerState<TransactionCard> {
|
|||
late final String unit;
|
||||
late final Coin coin;
|
||||
late final EthContract? tokenContract;
|
||||
late final int minConfirms;
|
||||
|
||||
String whatIsIt(
|
||||
TransactionType type,
|
||||
|
@ -63,7 +64,7 @@ class _TransactionCardState extends ConsumerState<TransactionCard> {
|
|||
|
||||
final confirmedStatus = _transaction.isConfirmed(
|
||||
currentHeight,
|
||||
coin.requiredConfirmations,
|
||||
minConfirms,
|
||||
);
|
||||
|
||||
if (type != TransactionType.incoming &&
|
||||
|
@ -110,6 +111,8 @@ class _TransactionCardState extends ConsumerState<TransactionCard> {
|
|||
@override
|
||||
void initState() {
|
||||
walletId = widget.walletId;
|
||||
minConfirms =
|
||||
ref.read(pWallets).getWallet(walletId).cryptoCurrency.minConfirms;
|
||||
_transaction = widget.transaction;
|
||||
isTokenTx = _transaction.subType == TransactionSubType.ethToken;
|
||||
if (Util.isDesktop) {
|
||||
|
|
Loading…
Reference in a new issue