mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-01 12:04:21 +01:00
Automated Integration Tests Flows (#1686)
* feat: Integration tests setup and tests for Disclaimer, Welcome and Setup Pin Code pages * feat: Integration test flow from start to restoring a wallet successfully done * test: Dashboard view test and linking to flow * feat: Testing the Exchange flow section, selecting sending and receiving currencies * test: Successfully create an exchange section * feat: Implement flow up to sending section * test: Complete Exchange flow * fix dependency issue * test: Final cleanups * feat: Add CI to run automated integration tests withan android emulator * feat: Adjust Automated integration test CI to run on ubuntu 20.04-a * fix: Move integration test CI into PR test build CI * ci: Add automated test ci which is a streamlined replica of pr test build ci * ci: Re-add step to access branch name * ci: Add KVM * ci: Add filepath to trigger the test run from * ci: Add required key * ci: Add required key * ci: Add missing secret key * ci: Add missing secret key * ci: Add nano secrets to workflow * ci: Switch step to free space on runner * ci: Remove timeout from workflow * ci: Confirm impact that removing copy_monero_deps would have on entire workflow time * ci: Update CI and temporarily remove cache related to emulator * ci: Remove dynamic java version * ci: Temporarily switch CI * ci: Switch to 11.x jdk * ci: Temporarily switch CI * ci: Revert ubuntu version * ci: Add more api levels * ci: Add more target options * ci: Settled on stable emulator matrix options * ci: Add more target options * ci: Modify flow * ci: Streamline api levels to 28 and 29 * ci: One more trial * ci: Switch to flutter drive * ci: Reduce options * ci: Remove haven from test * ci: Check for solana in list * ci: Adjust amounts and currencies for exchange flow * ci: Set write response on failure to true * ci: Split ci to funds and non funds related tests * test: Test for Send flow scenario and minor restructuring for test folders and files * chore: cleanup * ci: Pause CI for now * ci: Pause CI for now * ci: Pause CI for now * test: Restore wallets integration automated tests * Fix: Add keys back to currency amount textfield widget * fix: Switch variable name * fix: remove automation for now * tests: Automated tests for Create wallets flow * tests: Further optimize common flows * tests: Add missing await for call * tests: Confirm Seeds Display Properly WIP * tests: Confirm Seeds Display Correctly Automated Tests * fix: Add missing pubspec params for bitcoin and bitcoin_cash * feat: Automated Tests for Transaction History Flow * fix: Add missing pubspec parameter * feat: Automated Integration Tests for Transaction History flow * test: Updating send page robot and also syncing branch with main * test: Modifying tests to flow with wallet grouping implementation * fix: Issue with transaction history test * fix: Modifications to the PR and add automated confirmation for checking that all wallet types are restored or created correctly * test: Attempting automation for testing * fix: Issue from merge conflicts * test: Remove automation of test in this PR --------- Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
This commit is contained in:
co-authored by
OmarHatem
parent
48457fdd6d
commit
0fcfd76afd
@@ -1,3 +1,8 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
abstract class ActionListItem {
|
||||
ActionListItem({required this.key});
|
||||
|
||||
DateTime get date;
|
||||
Key key;
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import 'package:cake_wallet/anonpay/anonpay_invoice_info.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/action_list_item.dart';
|
||||
|
||||
class AnonpayTransactionListItem extends ActionListItem {
|
||||
AnonpayTransactionListItem({required this.transaction});
|
||||
AnonpayTransactionListItem({required this.transaction, required super.key});
|
||||
|
||||
final AnonpayInvoiceInfo transaction;
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ import 'package:cw_core/wallet_base.dart';
|
||||
import 'package:cw_core/wallet_info.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
import 'package:eth_sig_util/util/utils.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:mobx/mobx.dart';
|
||||
@@ -182,10 +183,16 @@ abstract class DashboardViewModelBase with Store {
|
||||
final sortedTransactions = [..._accountTransactions];
|
||||
sortedTransactions.sort((a, b) => a.date.compareTo(b.date));
|
||||
|
||||
transactions = ObservableList.of(sortedTransactions.map((transaction) => TransactionListItem(
|
||||
transaction: transaction,
|
||||
balanceViewModel: balanceViewModel,
|
||||
settingsStore: appStore.settingsStore)));
|
||||
transactions = ObservableList.of(
|
||||
sortedTransactions.map(
|
||||
(transaction) => TransactionListItem(
|
||||
transaction: transaction,
|
||||
balanceViewModel: balanceViewModel,
|
||||
settingsStore: appStore.settingsStore,
|
||||
key: ValueKey('monero_transaction_history_item_${transaction.id}_key'),
|
||||
),
|
||||
),
|
||||
);
|
||||
} else if (_wallet.type == WalletType.wownero) {
|
||||
subname = wow.wownero!.getCurrentAccount(_wallet).label;
|
||||
|
||||
@@ -206,18 +213,30 @@ abstract class DashboardViewModelBase with Store {
|
||||
final sortedTransactions = [..._accountTransactions];
|
||||
sortedTransactions.sort((a, b) => a.date.compareTo(b.date));
|
||||
|
||||
transactions = ObservableList.of(sortedTransactions.map((transaction) => TransactionListItem(
|
||||
transaction: transaction,
|
||||
balanceViewModel: balanceViewModel,
|
||||
settingsStore: appStore.settingsStore)));
|
||||
transactions = ObservableList.of(
|
||||
sortedTransactions.map(
|
||||
(transaction) => TransactionListItem(
|
||||
transaction: transaction,
|
||||
balanceViewModel: balanceViewModel,
|
||||
settingsStore: appStore.settingsStore,
|
||||
key: ValueKey('wownero_transaction_history_item_${transaction.id}_key'),
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
final sortedTransactions = [...wallet.transactionHistory.transactions.values];
|
||||
sortedTransactions.sort((a, b) => a.date.compareTo(b.date));
|
||||
|
||||
transactions = ObservableList.of(sortedTransactions.map((transaction) => TransactionListItem(
|
||||
transaction: transaction,
|
||||
balanceViewModel: balanceViewModel,
|
||||
settingsStore: appStore.settingsStore)));
|
||||
transactions = ObservableList.of(
|
||||
sortedTransactions.map(
|
||||
(transaction) => TransactionListItem(
|
||||
transaction: transaction,
|
||||
balanceViewModel: balanceViewModel,
|
||||
settingsStore: appStore.settingsStore,
|
||||
key: ValueKey('${_wallet.type.name}_transaction_history_item_${transaction.id}_key'),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// TODO: nano sub-account generation is disabled:
|
||||
@@ -234,9 +253,13 @@ abstract class DashboardViewModelBase with Store {
|
||||
appStore.wallet!.transactionHistory.transactions,
|
||||
transactions,
|
||||
(TransactionInfo? transaction) => TransactionListItem(
|
||||
transaction: transaction!,
|
||||
balanceViewModel: balanceViewModel,
|
||||
settingsStore: appStore.settingsStore), filter: (TransactionInfo? transaction) {
|
||||
transaction: transaction!,
|
||||
balanceViewModel: balanceViewModel,
|
||||
settingsStore: appStore.settingsStore,
|
||||
key: ValueKey(
|
||||
'${_wallet.type.name}_transaction_history_item_${transaction.id}_key',
|
||||
),
|
||||
), filter: (TransactionInfo? transaction) {
|
||||
if (transaction == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -650,20 +673,29 @@ abstract class DashboardViewModelBase with Store {
|
||||
|
||||
transactions.clear();
|
||||
|
||||
transactions.addAll(wallet.transactionHistory.transactions.values.map((transaction) =>
|
||||
TransactionListItem(
|
||||
transaction: transaction,
|
||||
balanceViewModel: balanceViewModel,
|
||||
settingsStore: appStore.settingsStore)));
|
||||
transactions.addAll(
|
||||
wallet.transactionHistory.transactions.values.map(
|
||||
(transaction) => TransactionListItem(
|
||||
transaction: transaction,
|
||||
balanceViewModel: balanceViewModel,
|
||||
settingsStore: appStore.settingsStore,
|
||||
key: ValueKey('${wallet.type.name}_transaction_history_item_${transaction.id}_key'),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
connectMapToListWithTransform(
|
||||
appStore.wallet!.transactionHistory.transactions,
|
||||
transactions,
|
||||
(TransactionInfo? transaction) => TransactionListItem(
|
||||
transaction: transaction!,
|
||||
balanceViewModel: balanceViewModel,
|
||||
settingsStore: appStore.settingsStore), filter: (TransactionInfo? tx) {
|
||||
transaction: transaction!,
|
||||
balanceViewModel: balanceViewModel,
|
||||
settingsStore: appStore.settingsStore,
|
||||
key: ValueKey(
|
||||
'${wallet.type.name}_transaction_history_item_${transaction.id}_key',
|
||||
),
|
||||
), filter: (TransactionInfo? tx) {
|
||||
if (tx == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -703,10 +735,16 @@ abstract class DashboardViewModelBase with Store {
|
||||
monero!.getTransactionInfoAccountId(tx) == monero!.getCurrentAccount(wallet).id)
|
||||
.toList();
|
||||
|
||||
transactions.addAll(_accountTransactions.map((transaction) => TransactionListItem(
|
||||
transaction: transaction,
|
||||
balanceViewModel: balanceViewModel,
|
||||
settingsStore: appStore.settingsStore)));
|
||||
transactions.addAll(
|
||||
_accountTransactions.map(
|
||||
(transaction) => TransactionListItem(
|
||||
transaction: transaction,
|
||||
balanceViewModel: balanceViewModel,
|
||||
settingsStore: appStore.settingsStore,
|
||||
key: ValueKey('monero_transaction_history_item_${transaction.id}_key'),
|
||||
),
|
||||
),
|
||||
);
|
||||
} else if (wallet.type == WalletType.wownero) {
|
||||
final _accountTransactions = wow.wownero!
|
||||
.getTransactionHistory(wallet)
|
||||
@@ -717,10 +755,16 @@ abstract class DashboardViewModelBase with Store {
|
||||
wow.wownero!.getCurrentAccount(wallet).id)
|
||||
.toList();
|
||||
|
||||
transactions.addAll(_accountTransactions.map((transaction) => TransactionListItem(
|
||||
transaction: transaction,
|
||||
balanceViewModel: balanceViewModel,
|
||||
settingsStore: appStore.settingsStore)));
|
||||
transactions.addAll(
|
||||
_accountTransactions.map(
|
||||
(transaction) => TransactionListItem(
|
||||
transaction: transaction,
|
||||
balanceViewModel: balanceViewModel,
|
||||
settingsStore: appStore.settingsStore,
|
||||
key: ValueKey('wownero_transaction_history_item_${transaction.id}_key'),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:cake_wallet/view_model/dashboard/action_list_item.dart';
|
||||
|
||||
class DateSectionItem extends ActionListItem {
|
||||
DateSectionItem(this.date);
|
||||
DateSectionItem(this.date, {required super.key});
|
||||
|
||||
@override
|
||||
final DateTime date;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:cake_wallet/view_model/dashboard/action_list_item.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/date_section_item.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
List<ActionListItem> formattedItemsList(List<ActionListItem> items) {
|
||||
final formattedList = <ActionListItem>[];
|
||||
@@ -11,7 +12,12 @@ List<ActionListItem> formattedItemsList(List<ActionListItem> items) {
|
||||
|
||||
if (lastDate == null) {
|
||||
lastDate = transaction.date;
|
||||
formattedList.add(DateSectionItem(transaction.date));
|
||||
formattedList.add(
|
||||
DateSectionItem(
|
||||
transaction.date,
|
||||
key: ValueKey('date_section_item_${transaction.date.microsecondsSinceEpoch}_key'),
|
||||
),
|
||||
);
|
||||
formattedList.add(transaction);
|
||||
continue;
|
||||
}
|
||||
@@ -26,7 +32,12 @@ List<ActionListItem> formattedItemsList(List<ActionListItem> items) {
|
||||
}
|
||||
|
||||
lastDate = transaction.date;
|
||||
formattedList.add(DateSectionItem(transaction.date));
|
||||
formattedList.add(
|
||||
DateSectionItem(
|
||||
transaction.date,
|
||||
key: ValueKey('date_section_item_${transaction.date.microsecondsSinceEpoch}_key'),
|
||||
),
|
||||
);
|
||||
formattedList.add(transaction);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@ import 'package:cake_wallet/entities/balance_display_mode.dart';
|
||||
class OrderListItem extends ActionListItem {
|
||||
OrderListItem({
|
||||
required this.order,
|
||||
required this.settingsStore});
|
||||
required this.settingsStore,
|
||||
required super.key,
|
||||
});
|
||||
|
||||
final Order order;
|
||||
final SettingsStore settingsStore;
|
||||
|
||||
@@ -4,7 +4,11 @@ import 'package:cake_wallet/store/settings_store.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/action_list_item.dart';
|
||||
|
||||
class TradeListItem extends ActionListItem {
|
||||
TradeListItem({required this.trade, required this.settingsStore});
|
||||
TradeListItem({
|
||||
required this.trade,
|
||||
required this.settingsStore,
|
||||
required super.key,
|
||||
});
|
||||
|
||||
final Trade trade;
|
||||
final SettingsStore settingsStore;
|
||||
|
||||
@@ -22,8 +22,12 @@ import 'package:cw_core/keyable.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
|
||||
class TransactionListItem extends ActionListItem with Keyable {
|
||||
TransactionListItem(
|
||||
{required this.transaction, required this.balanceViewModel, required this.settingsStore});
|
||||
TransactionListItem({
|
||||
required this.transaction,
|
||||
required this.balanceViewModel,
|
||||
required this.settingsStore,
|
||||
required super.key,
|
||||
});
|
||||
|
||||
final TransactionInfo transaction;
|
||||
final BalanceViewModel balanceViewModel;
|
||||
|
||||
@@ -20,6 +20,7 @@ import 'package:cake_wallet/view_model/send/send_view_model.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:cw_core/transaction_direction.dart';
|
||||
import 'package:cw_core/transaction_priority.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:intl/src/intl/date_format.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
@@ -52,7 +53,7 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||
break;
|
||||
case WalletType.bitcoin:
|
||||
_addElectrumListItems(tx, dateFormat);
|
||||
if(!canReplaceByFee)_checkForRBF(tx);
|
||||
if (!canReplaceByFee) _checkForRBF(tx);
|
||||
break;
|
||||
case WalletType.litecoin:
|
||||
case WalletType.bitcoinCash:
|
||||
@@ -83,8 +84,7 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||
break;
|
||||
}
|
||||
|
||||
final descriptionKey =
|
||||
'${transactionInfo.txHash}_${wallet.walletAddresses.primaryAddress}';
|
||||
final descriptionKey = '${transactionInfo.txHash}_${wallet.walletAddresses.primaryAddress}';
|
||||
final description = transactionDescriptionBox.values.firstWhere(
|
||||
(val) => val.id == descriptionKey || val.id == transactionInfo.txHash,
|
||||
orElse: () => TransactionDescription(id: descriptionKey));
|
||||
@@ -93,15 +93,20 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||
final recipientAddress = description.recipientAddress;
|
||||
|
||||
if (recipientAddress?.isNotEmpty ?? false) {
|
||||
items.add(StandartListItem(
|
||||
title: S.current.transaction_details_recipient_address,
|
||||
value: recipientAddress!));
|
||||
items.add(
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_recipient_address,
|
||||
value: recipientAddress!,
|
||||
key: ValueKey('standard_list_item_${recipientAddress}_key'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
final type = wallet.type;
|
||||
|
||||
items.add(BlockExplorerListItem(
|
||||
items.add(
|
||||
BlockExplorerListItem(
|
||||
title: S.current.view_in_block_explorer,
|
||||
value: _explorerDescription(type),
|
||||
onTap: () async {
|
||||
@@ -109,9 +114,13 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||
final uri = Uri.parse(_explorerUrl(type, tx.txHash));
|
||||
if (await canLaunchUrl(uri)) await launchUrl(uri, mode: LaunchMode.externalApplication);
|
||||
} catch (e) {}
|
||||
}));
|
||||
},
|
||||
key: ValueKey('block_explorer_list_item_${type.name}_wallet_type_key'),
|
||||
),
|
||||
);
|
||||
|
||||
items.add(TextFieldListItem(
|
||||
items.add(
|
||||
TextFieldListItem(
|
||||
title: S.current.note_tap_to_change,
|
||||
value: description.note,
|
||||
onSubmitted: (value) {
|
||||
@@ -122,7 +131,10 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||
} else {
|
||||
transactionDescriptionBox.add(description);
|
||||
}
|
||||
}));
|
||||
},
|
||||
key: ValueKey('textfield_list_item_note_entry_key'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
final TransactionInfo transactionInfo;
|
||||
@@ -209,14 +221,38 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||
final addressIndex = tx.additionalInfo['addressIndex'] as int;
|
||||
final feeFormatted = tx.feeFormatted();
|
||||
final _items = [
|
||||
StandartListItem(title: S.current.transaction_details_transaction_id, value: tx.txHash),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_date, value: dateFormat.format(tx.date)),
|
||||
StandartListItem(title: S.current.transaction_details_height, value: '${tx.height}'),
|
||||
StandartListItem(title: S.current.transaction_details_amount, value: tx.amountFormatted()),
|
||||
title: S.current.transaction_details_transaction_id,
|
||||
value: tx.txHash,
|
||||
key: ValueKey('standard_list_item_transaction_details_id_key'),
|
||||
),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_date,
|
||||
value: dateFormat.format(tx.date),
|
||||
key: ValueKey('standard_list_item_transaction_details_date_key'),
|
||||
),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_height,
|
||||
value: '${tx.height}',
|
||||
key: ValueKey('standard_list_item_transaction_details_height_key'),
|
||||
),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_amount,
|
||||
value: tx.amountFormatted(),
|
||||
key: ValueKey('standard_list_item_transaction_details_amount_key'),
|
||||
),
|
||||
if (feeFormatted != null)
|
||||
StandartListItem(title: S.current.transaction_details_fee, value: feeFormatted),
|
||||
if (key?.isNotEmpty ?? false) StandartListItem(title: S.current.transaction_key, value: key!),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_fee,
|
||||
value: feeFormatted,
|
||||
key: ValueKey('standard_list_item_transaction_details_fee_key'),
|
||||
),
|
||||
if (key?.isNotEmpty ?? false)
|
||||
StandartListItem(
|
||||
title: S.current.transaction_key,
|
||||
value: key!,
|
||||
key: ValueKey('standard_list_item_transaction_key'),
|
||||
),
|
||||
];
|
||||
|
||||
if (tx.direction == TransactionDirection.incoming) {
|
||||
@@ -226,14 +262,21 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||
|
||||
if (address.isNotEmpty) {
|
||||
isRecipientAddressShown = true;
|
||||
_items.add(StandartListItem(
|
||||
title: S.current.transaction_details_recipient_address,
|
||||
value: address,
|
||||
));
|
||||
_items.add(
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_recipient_address,
|
||||
value: address,
|
||||
key: ValueKey('standard_list_item_transaction_details_recipient_address_key'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (label.isNotEmpty) {
|
||||
_items.add(StandartListItem(title: S.current.address_label, value: label));
|
||||
_items.add(StandartListItem(
|
||||
title: S.current.address_label,
|
||||
value: label,
|
||||
key: ValueKey('standard_list_item_address_label_key'),
|
||||
));
|
||||
}
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
@@ -245,14 +288,37 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||
|
||||
void _addElectrumListItems(TransactionInfo tx, DateFormat dateFormat) {
|
||||
final _items = [
|
||||
StandartListItem(title: S.current.transaction_details_transaction_id, value: tx.txHash),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_date, value: dateFormat.format(tx.date)),
|
||||
StandartListItem(title: S.current.confirmations, value: tx.confirmations.toString()),
|
||||
StandartListItem(title: S.current.transaction_details_height, value: '${tx.height}'),
|
||||
StandartListItem(title: S.current.transaction_details_amount, value: tx.amountFormatted()),
|
||||
title: S.current.transaction_details_transaction_id,
|
||||
value: tx.txHash,
|
||||
key: ValueKey('standard_list_item_transaction_details_id_key'),
|
||||
),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_date,
|
||||
value: dateFormat.format(tx.date),
|
||||
key: ValueKey('standard_list_item_transaction_details_date_key'),
|
||||
),
|
||||
StandartListItem(
|
||||
title: S.current.confirmations,
|
||||
value: tx.confirmations.toString(),
|
||||
key: ValueKey('standard_list_item_transaction_confirmations_key'),
|
||||
),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_height,
|
||||
value: '${tx.height}',
|
||||
key: ValueKey('standard_list_item_transaction_details_height_key'),
|
||||
),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_amount,
|
||||
value: tx.amountFormatted(),
|
||||
key: ValueKey('standard_list_item_transaction_details_amount_key'),
|
||||
),
|
||||
if (tx.feeFormatted()?.isNotEmpty ?? false)
|
||||
StandartListItem(title: S.current.transaction_details_fee, value: tx.feeFormatted()!),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_fee,
|
||||
value: tx.feeFormatted()!,
|
||||
key: ValueKey('standard_list_item_transaction_details_fee_key'),
|
||||
),
|
||||
];
|
||||
|
||||
items.addAll(_items);
|
||||
@@ -260,30 +326,80 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||
|
||||
void _addHavenListItems(TransactionInfo tx, DateFormat dateFormat) {
|
||||
items.addAll([
|
||||
StandartListItem(title: S.current.transaction_details_transaction_id, value: tx.txHash),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_date, value: dateFormat.format(tx.date)),
|
||||
StandartListItem(title: S.current.transaction_details_height, value: '${tx.height}'),
|
||||
StandartListItem(title: S.current.transaction_details_amount, value: tx.amountFormatted()),
|
||||
title: S.current.transaction_details_transaction_id,
|
||||
value: tx.txHash,
|
||||
key: ValueKey('standard_list_item_transaction_details_id_key'),
|
||||
),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_date,
|
||||
value: dateFormat.format(tx.date),
|
||||
key: ValueKey('standard_list_item_transaction_details_date_key'),
|
||||
),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_height,
|
||||
value: '${tx.height}',
|
||||
key: ValueKey('standard_list_item_transaction_details_height_key'),
|
||||
),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_amount,
|
||||
value: tx.amountFormatted(),
|
||||
key: ValueKey('standard_list_item_transaction_details_amount_key'),
|
||||
),
|
||||
if (tx.feeFormatted()?.isNotEmpty ?? false)
|
||||
StandartListItem(title: S.current.transaction_details_fee, value: tx.feeFormatted()!),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_fee,
|
||||
value: tx.feeFormatted()!,
|
||||
key: ValueKey('standard_list_item_transaction_details_fee_key'),
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
void _addEthereumListItems(TransactionInfo tx, DateFormat dateFormat) {
|
||||
final _items = [
|
||||
StandartListItem(title: S.current.transaction_details_transaction_id, value: tx.txHash),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_date, value: dateFormat.format(tx.date)),
|
||||
StandartListItem(title: S.current.confirmations, value: tx.confirmations.toString()),
|
||||
StandartListItem(title: S.current.transaction_details_height, value: '${tx.height}'),
|
||||
StandartListItem(title: S.current.transaction_details_amount, value: tx.amountFormatted()),
|
||||
title: S.current.transaction_details_transaction_id,
|
||||
value: tx.txHash,
|
||||
key: ValueKey('standard_list_item_transaction_details_id_key'),
|
||||
),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_date,
|
||||
value: dateFormat.format(tx.date),
|
||||
key: ValueKey('standard_list_item_transaction_details_date_key'),
|
||||
),
|
||||
StandartListItem(
|
||||
title: S.current.confirmations,
|
||||
value: tx.confirmations.toString(),
|
||||
key: ValueKey('standard_list_item_transaction_confirmations_key'),
|
||||
),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_height,
|
||||
value: '${tx.height}',
|
||||
key: ValueKey('standard_list_item_transaction_details_height_key'),
|
||||
),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_amount,
|
||||
value: tx.amountFormatted(),
|
||||
key: ValueKey('standard_list_item_transaction_details_amount_key'),
|
||||
),
|
||||
if (tx.feeFormatted()?.isNotEmpty ?? false)
|
||||
StandartListItem(title: S.current.transaction_details_fee, value: tx.feeFormatted()!),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_fee,
|
||||
value: tx.feeFormatted()!,
|
||||
key: ValueKey('standard_list_item_transaction_details_fee_key'),
|
||||
),
|
||||
if (showRecipientAddress && tx.to != null)
|
||||
StandartListItem(title: S.current.transaction_details_recipient_address, value: tx.to!),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_recipient_address,
|
||||
value: tx.to!,
|
||||
key: ValueKey('standard_list_item_transaction_details_recipient_address_key'),
|
||||
),
|
||||
if (tx.direction == TransactionDirection.incoming && tx.from != null)
|
||||
StandartListItem(title: S.current.transaction_details_source_address, value: tx.from!),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_source_address,
|
||||
value: tx.from!,
|
||||
key: ValueKey('standard_list_item_transaction_details_source_address_key'),
|
||||
),
|
||||
];
|
||||
|
||||
items.addAll(_items);
|
||||
@@ -291,16 +407,43 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||
|
||||
void _addNanoListItems(TransactionInfo tx, DateFormat dateFormat) {
|
||||
final _items = [
|
||||
StandartListItem(title: S.current.transaction_details_transaction_id, value: tx.txHash),
|
||||
if (showRecipientAddress && tx.to != null)
|
||||
StandartListItem(title: S.current.transaction_details_recipient_address, value: tx.to!),
|
||||
if (showRecipientAddress && tx.from != null)
|
||||
StandartListItem(title: S.current.transaction_details_source_address, value: tx.from!),
|
||||
StandartListItem(title: S.current.transaction_details_amount, value: tx.amountFormatted()),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_date, value: dateFormat.format(tx.date)),
|
||||
StandartListItem(title: S.current.confirmed_tx, value: (tx.confirmations > 0).toString()),
|
||||
StandartListItem(title: S.current.transaction_details_height, value: '${tx.height}'),
|
||||
title: S.current.transaction_details_transaction_id,
|
||||
value: tx.txHash,
|
||||
key: ValueKey('standard_list_item_transaction_details_id_key'),
|
||||
),
|
||||
if (showRecipientAddress && tx.to != null)
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_recipient_address,
|
||||
value: tx.to!,
|
||||
key: ValueKey('standard_list_item_transaction_details_recipient_address_key'),
|
||||
),
|
||||
if (showRecipientAddress && tx.from != null)
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_source_address,
|
||||
value: tx.from!,
|
||||
key: ValueKey('standard_list_item_transaction_details_source_address_key'),
|
||||
),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_amount,
|
||||
value: tx.amountFormatted(),
|
||||
key: ValueKey('standard_list_item_transaction_details_amount_key'),
|
||||
),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_date,
|
||||
value: dateFormat.format(tx.date),
|
||||
key: ValueKey('standard_list_item_transaction_details_date_key'),
|
||||
),
|
||||
StandartListItem(
|
||||
title: S.current.confirmed_tx,
|
||||
value: (tx.confirmations > 0).toString(),
|
||||
key: ValueKey('standard_list_item_transaction_confirmed_key'),
|
||||
),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_height,
|
||||
value: '${tx.height}',
|
||||
key: ValueKey('standard_list_item_transaction_details_height_key'),
|
||||
),
|
||||
];
|
||||
|
||||
items.addAll(_items);
|
||||
@@ -308,18 +451,49 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||
|
||||
void _addPolygonListItems(TransactionInfo tx, DateFormat dateFormat) {
|
||||
final _items = [
|
||||
StandartListItem(title: S.current.transaction_details_transaction_id, value: tx.txHash),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_date, value: dateFormat.format(tx.date)),
|
||||
StandartListItem(title: S.current.confirmations, value: tx.confirmations.toString()),
|
||||
StandartListItem(title: S.current.transaction_details_height, value: '${tx.height}'),
|
||||
StandartListItem(title: S.current.transaction_details_amount, value: tx.amountFormatted()),
|
||||
title: S.current.transaction_details_transaction_id,
|
||||
value: tx.txHash,
|
||||
key: ValueKey('standard_list_item_transaction_details_id_key'),
|
||||
),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_date,
|
||||
value: dateFormat.format(tx.date),
|
||||
key: ValueKey('standard_list_item_transaction_details_date_key'),
|
||||
),
|
||||
StandartListItem(
|
||||
title: S.current.confirmations,
|
||||
value: tx.confirmations.toString(),
|
||||
key: ValueKey('standard_list_item_transaction_confirmations_key'),
|
||||
),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_height,
|
||||
value: '${tx.height}',
|
||||
key: ValueKey('standard_list_item_transaction_details_height_key'),
|
||||
),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_amount,
|
||||
value: tx.amountFormatted(),
|
||||
key: ValueKey('standard_list_item_transaction_details_amount_key'),
|
||||
),
|
||||
if (tx.feeFormatted()?.isNotEmpty ?? false)
|
||||
StandartListItem(title: S.current.transaction_details_fee, value: tx.feeFormatted()!),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_fee,
|
||||
value: tx.feeFormatted()!,
|
||||
key: ValueKey('standard_list_item_transaction_details_fee_key'),
|
||||
),
|
||||
if (showRecipientAddress && tx.to != null && tx.direction == TransactionDirection.outgoing)
|
||||
StandartListItem(title: S.current.transaction_details_recipient_address, value: tx.to!),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_recipient_address,
|
||||
value: tx.to!,
|
||||
key: ValueKey('standard_list_item_transaction_details_recipient_address_key'),
|
||||
),
|
||||
if (tx.direction == TransactionDirection.incoming && tx.from != null)
|
||||
StandartListItem(title: S.current.transaction_details_source_address, value: tx.from!),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_source_address,
|
||||
value: tx.from!,
|
||||
key: ValueKey('standard_list_item_transaction_details_source_address_key'),
|
||||
),
|
||||
];
|
||||
|
||||
items.addAll(_items);
|
||||
@@ -327,16 +501,39 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||
|
||||
void _addSolanaListItems(TransactionInfo tx, DateFormat dateFormat) {
|
||||
final _items = [
|
||||
StandartListItem(title: S.current.transaction_details_transaction_id, value: tx.txHash),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_date, value: dateFormat.format(tx.date)),
|
||||
StandartListItem(title: S.current.transaction_details_amount, value: tx.amountFormatted()),
|
||||
title: S.current.transaction_details_transaction_id,
|
||||
value: tx.txHash,
|
||||
key: ValueKey('standard_list_item_transaction_details_id_key'),
|
||||
),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_date,
|
||||
value: dateFormat.format(tx.date),
|
||||
key: ValueKey('standard_list_item_transaction_details_date_key'),
|
||||
),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_amount,
|
||||
value: tx.amountFormatted(),
|
||||
key: ValueKey('standard_list_item_transaction_details_amount_key'),
|
||||
),
|
||||
if (tx.feeFormatted()?.isNotEmpty ?? false)
|
||||
StandartListItem(title: S.current.transaction_details_fee, value: tx.feeFormatted()!),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_fee,
|
||||
value: tx.feeFormatted()!,
|
||||
key: ValueKey('standard_list_item_transaction_details_fee_key'),
|
||||
),
|
||||
if (showRecipientAddress && tx.to != null)
|
||||
StandartListItem(title: S.current.transaction_details_recipient_address, value: tx.to!),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_recipient_address,
|
||||
value: tx.to!,
|
||||
key: ValueKey('standard_list_item_transaction_details_recipient_address_key'),
|
||||
),
|
||||
if (tx.from != null)
|
||||
StandartListItem(title: S.current.transaction_details_source_address, value: tx.from!),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_source_address,
|
||||
value: tx.from!,
|
||||
key: ValueKey('standard_list_item_transaction_details_source_address_key'),
|
||||
),
|
||||
];
|
||||
|
||||
items.addAll(_items);
|
||||
@@ -354,7 +551,13 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||
newFee = bitcoin!.getFeeAmountForPriority(
|
||||
wallet, bitcoin!.getBitcoinTransactionPriorityMedium(), inputsCount, outputsCount);
|
||||
|
||||
RBFListItems.add(StandartListItem(title: S.current.old_fee, value: tx.feeFormatted() ?? '0.0'));
|
||||
RBFListItems.add(
|
||||
StandartListItem(
|
||||
title: S.current.old_fee,
|
||||
value: tx.feeFormatted() ?? '0.0',
|
||||
key: ValueKey('standard_list_item_rbf_old_fee_key'),
|
||||
),
|
||||
);
|
||||
|
||||
if (transactionInfo.fee != null && rawTransaction.isNotEmpty) {
|
||||
final size = bitcoin!.getTransactionVSize(wallet, rawTransaction);
|
||||
@@ -371,7 +574,9 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||
final customItemIndex = customItem != null ? priorities.indexOf(customItem) : null;
|
||||
final maxCustomFeeRate = sendViewModel.maxCustomFeeRate?.toDouble();
|
||||
|
||||
RBFListItems.add(StandardPickerListItem(
|
||||
RBFListItems.add(
|
||||
StandardPickerListItem(
|
||||
key: ValueKey('standard_picker_list_item_transaction_priorities_key'),
|
||||
title: S.current.estimated_new_fee,
|
||||
value: bitcoin!.formatterBitcoinAmountToString(amount: newFee) +
|
||||
' ${walletTypeToCryptoCurrency(wallet.type)}',
|
||||
@@ -387,42 +592,73 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||
onItemSelected: (dynamic item, double sliderValue) {
|
||||
transactionPriority = item as TransactionPriority;
|
||||
return setNewFee(value: sliderValue, priority: transactionPriority!);
|
||||
}));
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
if (transactionInfo.inputAddresses != null && transactionInfo.inputAddresses!.isNotEmpty) {
|
||||
RBFListItems.add(StandardExpandableListItem(
|
||||
title: S.current.inputs, expandableItems: transactionInfo.inputAddresses!));
|
||||
RBFListItems.add(
|
||||
StandardExpandableListItem(
|
||||
key: ValueKey('standard_expandable_list_item_transaction_input_addresses_key'),
|
||||
title: S.current.inputs,
|
||||
expandableItems: transactionInfo.inputAddresses!,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (transactionInfo.outputAddresses != null && transactionInfo.outputAddresses!.isNotEmpty) {
|
||||
final outputAddresses = transactionInfo.outputAddresses!.map((element) {
|
||||
if (element.contains('OP_RETURN:') && element.length > 40) {
|
||||
return element.substring(0, 40) + '...';
|
||||
return element.substring(0, 40) + '...';
|
||||
}
|
||||
return element;
|
||||
}).toList();
|
||||
|
||||
RBFListItems.add(
|
||||
StandardExpandableListItem(title: S.current.outputs, expandableItems: outputAddresses));
|
||||
StandardExpandableListItem(
|
||||
title: S.current.outputs,
|
||||
expandableItems: outputAddresses,
|
||||
key: ValueKey('standard_expandable_list_item_transaction_output_addresses_key'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void _addTronListItems(TransactionInfo tx, DateFormat dateFormat) {
|
||||
final _items = [
|
||||
StandartListItem(title: S.current.transaction_details_transaction_id, value: tx.txHash),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_date, value: dateFormat.format(tx.date)),
|
||||
StandartListItem(title: S.current.transaction_details_amount, value: tx.amountFormatted()),
|
||||
title: S.current.transaction_details_transaction_id,
|
||||
value: tx.txHash,
|
||||
key: ValueKey('standard_list_item_transaction_details_id_key'),
|
||||
),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_date,
|
||||
value: dateFormat.format(tx.date),
|
||||
key: ValueKey('standard_list_item_transaction_details_date_key'),
|
||||
),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_amount,
|
||||
value: tx.amountFormatted(),
|
||||
key: ValueKey('standard_list_item_transaction_details_amount_key'),
|
||||
),
|
||||
if (tx.feeFormatted()?.isNotEmpty ?? false)
|
||||
StandartListItem(title: S.current.transaction_details_fee, value: tx.feeFormatted()!),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_fee,
|
||||
value: tx.feeFormatted()!,
|
||||
key: ValueKey('standard_list_item_transaction_details_fee_key'),
|
||||
),
|
||||
if (showRecipientAddress && tx.to != null)
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_recipient_address,
|
||||
value: tron!.getTronBase58Address(tx.to!, wallet)),
|
||||
title: S.current.transaction_details_recipient_address,
|
||||
value: tron!.getTronBase58Address(tx.to!, wallet),
|
||||
key: ValueKey('standard_list_item_transaction_details_recipient_address_key'),
|
||||
),
|
||||
if (tx.from != null)
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_source_address,
|
||||
value: tron!.getTronBase58Address(tx.from!, wallet)),
|
||||
title: S.current.transaction_details_source_address,
|
||||
value: tron!.getTronBase58Address(tx.from!, wallet),
|
||||
key: ValueKey('standard_list_item_transaction_details_source_address_key'),
|
||||
),
|
||||
];
|
||||
|
||||
items.addAll(_items);
|
||||
@@ -455,7 +691,7 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||
return bitcoin!.formatterBitcoinAmountToString(amount: newFee);
|
||||
}
|
||||
|
||||
void replaceByFee(String newFee) => sendViewModel.replaceByFee(transactionInfo, newFee,);
|
||||
void replaceByFee(String newFee) => sendViewModel.replaceByFee(transactionInfo, newFee);
|
||||
|
||||
@computed
|
||||
String get pendingTransactionFiatAmountValueFormatted => sendViewModel.isFiatDisabled
|
||||
@@ -473,14 +709,38 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||
final addressIndex = tx.additionalInfo['addressIndex'] as int;
|
||||
final feeFormatted = tx.feeFormatted();
|
||||
final _items = [
|
||||
StandartListItem(title: S.current.transaction_details_transaction_id, value: tx.txHash),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_date, value: dateFormat.format(tx.date)),
|
||||
StandartListItem(title: S.current.transaction_details_height, value: '${tx.height}'),
|
||||
StandartListItem(title: S.current.transaction_details_amount, value: tx.amountFormatted()),
|
||||
title: S.current.transaction_details_transaction_id,
|
||||
value: tx.txHash,
|
||||
key: ValueKey('standard_list_item_transaction_details_id_key'),
|
||||
),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_date,
|
||||
value: dateFormat.format(tx.date),
|
||||
key: ValueKey('standard_list_item_transaction_details_date_key'),
|
||||
),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_height,
|
||||
value: '${tx.height}',
|
||||
key: ValueKey('standard_list_item_transaction_details_height_key'),
|
||||
),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_amount,
|
||||
value: tx.amountFormatted(),
|
||||
key: ValueKey('standard_list_item_transaction_details_amount_key'),
|
||||
),
|
||||
if (feeFormatted != null)
|
||||
StandartListItem(title: S.current.transaction_details_fee, value: feeFormatted),
|
||||
if (key?.isNotEmpty ?? false) StandartListItem(title: S.current.transaction_key, value: key!),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_fee,
|
||||
value: feeFormatted,
|
||||
key: ValueKey('standard_list_item_transaction_details_fee_key'),
|
||||
),
|
||||
if (key?.isNotEmpty ?? false)
|
||||
StandartListItem(
|
||||
title: S.current.transaction_key,
|
||||
value: key!,
|
||||
key: ValueKey('standard_list_item_transaction_key'),
|
||||
),
|
||||
];
|
||||
|
||||
if (tx.direction == TransactionDirection.incoming) {
|
||||
@@ -490,14 +750,23 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||
|
||||
if (address.isNotEmpty) {
|
||||
isRecipientAddressShown = true;
|
||||
_items.add(StandartListItem(
|
||||
title: S.current.transaction_details_recipient_address,
|
||||
value: address,
|
||||
));
|
||||
_items.add(
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_recipient_address,
|
||||
value: address,
|
||||
key: ValueKey('standard_list_item_transaction_details_recipient_address_key'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (label.isNotEmpty) {
|
||||
_items.add(StandartListItem(title: S.current.address_label, value: label));
|
||||
_items.add(
|
||||
StandartListItem(
|
||||
title: S.current.address_label,
|
||||
value: label,
|
||||
key: ValueKey('standard_list_item_address_label_key'),
|
||||
),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
|
||||
@@ -10,6 +10,7 @@ import 'package:cw_core/transaction_info.dart';
|
||||
import 'package:cw_core/wallet_base.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
import 'package:cw_monero/monero_wallet.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:polyseed/polyseed.dart';
|
||||
|
||||
@@ -24,6 +25,7 @@ abstract class WalletKeysViewModelBase with Store {
|
||||
_appStore.wallet!.type == WalletType.bitcoinCash
|
||||
? S.current.wallet_seed
|
||||
: S.current.wallet_keys,
|
||||
_walletName = _appStore.wallet!.type.name,
|
||||
_restoreHeight = _appStore.wallet!.walletInfo.restoreHeight,
|
||||
_restoreHeightByTransactions = 0,
|
||||
items = ObservableList<StandartListItem>() {
|
||||
@@ -38,12 +40,10 @@ abstract class WalletKeysViewModelBase with Store {
|
||||
_appStore.wallet!.type == WalletType.wownero) {
|
||||
final accountTransactions = _getWalletTransactions(_appStore.wallet!);
|
||||
if (accountTransactions.isNotEmpty) {
|
||||
final incomingAccountTransactions = accountTransactions
|
||||
.where((tx) => tx.direction == TransactionDirection.incoming);
|
||||
final incomingAccountTransactions =
|
||||
accountTransactions.where((tx) => tx.direction == TransactionDirection.incoming);
|
||||
if (incomingAccountTransactions.isNotEmpty) {
|
||||
incomingAccountTransactions
|
||||
.toList()
|
||||
.sort((a, b) => a.date.compareTo(b.date));
|
||||
incomingAccountTransactions.toList().sort((a, b) => a.date.compareTo(b.date));
|
||||
_restoreHeightByTransactions = _getRestoreHeightByTransactions(
|
||||
_appStore.wallet!.type, incomingAccountTransactions.first.date);
|
||||
}
|
||||
@@ -55,6 +55,10 @@ abstract class WalletKeysViewModelBase with Store {
|
||||
|
||||
final String title;
|
||||
|
||||
final String _walletName;
|
||||
|
||||
AppStore get appStore => _appStore;
|
||||
|
||||
final AppStore _appStore;
|
||||
|
||||
final int _restoreHeight;
|
||||
@@ -70,37 +74,56 @@ abstract class WalletKeysViewModelBase with Store {
|
||||
items.addAll([
|
||||
if (keys['publicSpendKey'] != null)
|
||||
StandartListItem(
|
||||
title: S.current.spend_key_public,
|
||||
value: keys['publicSpendKey']!),
|
||||
key: ValueKey('${_walletName}_wallet_public_spend_key_item_key'),
|
||||
title: S.current.spend_key_public,
|
||||
value: keys['publicSpendKey']!,
|
||||
),
|
||||
if (keys['privateSpendKey'] != null)
|
||||
StandartListItem(
|
||||
title: S.current.spend_key_private,
|
||||
value: keys['privateSpendKey']!),
|
||||
key: ValueKey('${_walletName}_wallet_private_spend_key_item_key'),
|
||||
title: S.current.spend_key_private,
|
||||
value: keys['privateSpendKey']!,
|
||||
),
|
||||
if (keys['publicViewKey'] != null)
|
||||
StandartListItem(
|
||||
title: S.current.view_key_public, value: keys['publicViewKey']!),
|
||||
key: ValueKey('${_walletName}_wallet_public_view_key_item_key'),
|
||||
title: S.current.view_key_public,
|
||||
value: keys['publicViewKey']!,
|
||||
),
|
||||
if (keys['privateViewKey'] != null)
|
||||
StandartListItem(
|
||||
title: S.current.view_key_private,
|
||||
value: keys['privateViewKey']!),
|
||||
key: ValueKey('${_walletName}_wallet_private_view_key_item_key'),
|
||||
title: S.current.view_key_private,
|
||||
value: keys['privateViewKey']!,
|
||||
),
|
||||
if (_appStore.wallet!.seed!.isNotEmpty)
|
||||
StandartListItem(title: S.current.wallet_seed, value: _appStore.wallet!.seed!),
|
||||
StandartListItem(
|
||||
key: ValueKey('${_walletName}_wallet_seed_item_key'),
|
||||
title: S.current.wallet_seed,
|
||||
value: _appStore.wallet!.seed!,
|
||||
),
|
||||
]);
|
||||
|
||||
if (_appStore.wallet?.seed != null &&
|
||||
Polyseed.isValidSeed(_appStore.wallet!.seed!)) {
|
||||
if (_appStore.wallet?.seed != null && Polyseed.isValidSeed(_appStore.wallet!.seed!)) {
|
||||
final lang = PolyseedLang.getByPhrase(_appStore.wallet!.seed!);
|
||||
items.add(StandartListItem(
|
||||
items.add(
|
||||
StandartListItem(
|
||||
key: ValueKey('${_walletName}_wallet_seed_legacy_item_key'),
|
||||
title: S.current.wallet_seed_legacy,
|
||||
value: (_appStore.wallet as MoneroWalletBase)
|
||||
.seedLegacy(lang.nameEnglish)));
|
||||
value: (_appStore.wallet as MoneroWalletBase).seedLegacy(lang.nameEnglish),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
final restoreHeight = monero!.getRestoreHeight(_appStore.wallet!);
|
||||
if (restoreHeight != null) {
|
||||
items.add(StandartListItem(
|
||||
items.add(
|
||||
StandartListItem(
|
||||
key: ValueKey('${_walletName}_wallet_restore_height_item_key'),
|
||||
title: S.current.wallet_recovery_height,
|
||||
value: restoreHeight.toString()));
|
||||
value: restoreHeight.toString(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,21 +133,34 @@ abstract class WalletKeysViewModelBase with Store {
|
||||
items.addAll([
|
||||
if (keys['publicSpendKey'] != null)
|
||||
StandartListItem(
|
||||
title: S.current.spend_key_public,
|
||||
value: keys['publicSpendKey']!),
|
||||
key: ValueKey('${_walletName}_wallet_public_spend_key_item_key'),
|
||||
title: S.current.spend_key_public,
|
||||
value: keys['publicSpendKey']!,
|
||||
),
|
||||
if (keys['privateSpendKey'] != null)
|
||||
StandartListItem(
|
||||
title: S.current.spend_key_private,
|
||||
value: keys['privateSpendKey']!),
|
||||
key: ValueKey('${_walletName}_wallet_private_spend_key_item_key'),
|
||||
title: S.current.spend_key_private,
|
||||
value: keys['privateSpendKey']!,
|
||||
),
|
||||
if (keys['publicViewKey'] != null)
|
||||
StandartListItem(
|
||||
title: S.current.view_key_public, value: keys['publicViewKey']!),
|
||||
key: ValueKey('${_walletName}_wallet_public_view_key_item_key'),
|
||||
title: S.current.view_key_public,
|
||||
value: keys['publicViewKey']!,
|
||||
),
|
||||
if (keys['privateViewKey'] != null)
|
||||
StandartListItem(
|
||||
title: S.current.view_key_private,
|
||||
value: keys['privateViewKey']!),
|
||||
key: ValueKey('${_walletName}_wallet_private_view_key_item_key'),
|
||||
title: S.current.view_key_private,
|
||||
value: keys['privateViewKey']!,
|
||||
),
|
||||
if (_appStore.wallet!.seed!.isNotEmpty)
|
||||
StandartListItem(title: S.current.wallet_seed, value: _appStore.wallet!.seed!),
|
||||
StandartListItem(
|
||||
key: ValueKey('${_walletName}_wallet_seed_item_key'),
|
||||
title: S.current.wallet_seed,
|
||||
value: _appStore.wallet!.seed!,
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -134,29 +170,45 @@ abstract class WalletKeysViewModelBase with Store {
|
||||
items.addAll([
|
||||
if (keys['publicSpendKey'] != null)
|
||||
StandartListItem(
|
||||
title: S.current.spend_key_public,
|
||||
value: keys['publicSpendKey']!),
|
||||
key: ValueKey('${_walletName}_wallet_public_spend_key_item_key'),
|
||||
title: S.current.spend_key_public,
|
||||
value: keys['publicSpendKey']!,
|
||||
),
|
||||
if (keys['privateSpendKey'] != null)
|
||||
StandartListItem(
|
||||
title: S.current.spend_key_private,
|
||||
value: keys['privateSpendKey']!),
|
||||
key: ValueKey('${_walletName}_wallet_private_spend_key_item_key'),
|
||||
title: S.current.spend_key_private,
|
||||
value: keys['privateSpendKey']!,
|
||||
),
|
||||
if (keys['publicViewKey'] != null)
|
||||
StandartListItem(
|
||||
title: S.current.view_key_public, value: keys['publicViewKey']!),
|
||||
key: ValueKey('${_walletName}_wallet_public_view_key_item_key'),
|
||||
title: S.current.view_key_public,
|
||||
value: keys['publicViewKey']!,
|
||||
),
|
||||
if (keys['privateViewKey'] != null)
|
||||
StandartListItem(
|
||||
title: S.current.view_key_private,
|
||||
value: keys['privateViewKey']!),
|
||||
key: ValueKey('${_walletName}_wallet_private_view_key_item_key'),
|
||||
title: S.current.view_key_private,
|
||||
value: keys['privateViewKey']!,
|
||||
),
|
||||
if (_appStore.wallet!.seed!.isNotEmpty)
|
||||
StandartListItem(title: S.current.wallet_seed, value: _appStore.wallet!.seed!),
|
||||
StandartListItem(
|
||||
key: ValueKey('${_walletName}_wallet_seed_item_key'),
|
||||
title: S.current.wallet_seed,
|
||||
value: _appStore.wallet!.seed!,
|
||||
),
|
||||
]);
|
||||
|
||||
if (_appStore.wallet?.seed != null &&
|
||||
Polyseed.isValidSeed(_appStore.wallet!.seed!)) {
|
||||
if (_appStore.wallet?.seed != null && Polyseed.isValidSeed(_appStore.wallet!.seed!)) {
|
||||
final lang = PolyseedLang.getByPhrase(_appStore.wallet!.seed!);
|
||||
items.add(StandartListItem(
|
||||
items.add(
|
||||
StandartListItem(
|
||||
key: ValueKey('${_walletName}_wallet_seed_legacy_item_key'),
|
||||
title: S.current.wallet_seed_legacy,
|
||||
value: wownero!.getLegacySeed(_appStore.wallet!, lang.nameEnglish)));
|
||||
value: wownero!.getLegacySeed(_appStore.wallet!, lang.nameEnglish),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,7 +225,10 @@ abstract class WalletKeysViewModelBase with Store {
|
||||
// if (keys['publicKey'] != null)
|
||||
// StandartListItem(title: S.current.public_key, value: keys['publicKey']!),
|
||||
StandartListItem(
|
||||
title: S.current.wallet_seed, value: _appStore.wallet!.seed!),
|
||||
key: ValueKey('${_walletName}_wallet_seed_item_key'),
|
||||
title: S.current.wallet_seed,
|
||||
value: _appStore.wallet!.seed!,
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -183,31 +238,43 @@ abstract class WalletKeysViewModelBase with Store {
|
||||
items.addAll([
|
||||
if (_appStore.wallet!.privateKey != null)
|
||||
StandartListItem(
|
||||
title: S.current.private_key,
|
||||
value: _appStore.wallet!.privateKey!),
|
||||
key: ValueKey('${_walletName}_wallet_private_key_item_key'),
|
||||
title: S.current.private_key,
|
||||
value: _appStore.wallet!.privateKey!,
|
||||
),
|
||||
if (_appStore.wallet!.seed != null)
|
||||
StandartListItem(
|
||||
title: S.current.wallet_seed, value: _appStore.wallet!.seed!),
|
||||
key: ValueKey('${_walletName}_wallet_seed_item_key'),
|
||||
title: S.current.wallet_seed,
|
||||
value: _appStore.wallet!.seed!,
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
bool nanoBased = _appStore.wallet!.type == WalletType.nano ||
|
||||
_appStore.wallet!.type == WalletType.banano;
|
||||
bool nanoBased =
|
||||
_appStore.wallet!.type == WalletType.nano || _appStore.wallet!.type == WalletType.banano;
|
||||
|
||||
if (nanoBased) {
|
||||
// we always have the hex version of the seed and private key:
|
||||
items.addAll([
|
||||
if (_appStore.wallet!.seed != null)
|
||||
StandartListItem(
|
||||
title: S.current.wallet_seed, value: _appStore.wallet!.seed!),
|
||||
key: ValueKey('${_walletName}_wallet_seed_item_key'),
|
||||
title: S.current.wallet_seed,
|
||||
value: _appStore.wallet!.seed!,
|
||||
),
|
||||
if (_appStore.wallet!.hexSeed != null)
|
||||
StandartListItem(
|
||||
title: S.current.seed_hex_form,
|
||||
value: _appStore.wallet!.hexSeed!),
|
||||
key: ValueKey('${_walletName}_wallet_hex_seed_key'),
|
||||
title: S.current.seed_hex_form,
|
||||
value: _appStore.wallet!.hexSeed!,
|
||||
),
|
||||
if (_appStore.wallet!.privateKey != null)
|
||||
StandartListItem(
|
||||
title: S.current.private_key,
|
||||
value: _appStore.wallet!.privateKey!),
|
||||
key: ValueKey('${_walletName}_wallet_private_key_item_key'),
|
||||
title: S.current.private_key,
|
||||
value: _appStore.wallet!.privateKey!,
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -273,8 +340,7 @@ abstract class WalletKeysViewModelBase with Store {
|
||||
if (_appStore.wallet!.seed != null) 'seed': _appStore.wallet!.seed!,
|
||||
if (_appStore.wallet!.seed == null && _appStore.wallet!.hexSeed != null)
|
||||
'hexSeed': _appStore.wallet!.hexSeed!,
|
||||
if (_appStore.wallet!.seed == null &&
|
||||
_appStore.wallet!.privateKey != null)
|
||||
if (_appStore.wallet!.seed == null && _appStore.wallet!.privateKey != null)
|
||||
'private_key': _appStore.wallet!.privateKey!,
|
||||
if (restoreHeightResult != null) ...{'height': restoreHeightResult},
|
||||
if (_appStore.wallet!.passphrase != null) 'passphrase': _appStore.wallet!.passphrase!
|
||||
@@ -292,11 +358,7 @@ abstract class WalletKeysViewModelBase with Store {
|
||||
} else if (wallet.type == WalletType.haven) {
|
||||
return haven!.getTransactionHistory(wallet).transactions.values.toList();
|
||||
} else if (wallet.type == WalletType.wownero) {
|
||||
return wownero!
|
||||
.getTransactionHistory(wallet)
|
||||
.transactions
|
||||
.values
|
||||
.toList();
|
||||
return wownero!.getTransactionHistory(wallet).transactions.values.toList();
|
||||
}
|
||||
return [];
|
||||
}
|
||||
@@ -312,6 +374,5 @@ abstract class WalletKeysViewModelBase with Store {
|
||||
return 0;
|
||||
}
|
||||
|
||||
String getRoundedRestoreHeight(int height) =>
|
||||
((height / 1000).floor() * 1000).toString();
|
||||
String getRoundedRestoreHeight(int height) => ((height / 1000).floor() * 1000).toString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user