mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-02 12:14:09 +01:00
v4.23.0 release candidate (#1974)
* v4.23.0 release candidate * - Fix restoring zano from QR - Fix Zano confirmations count - Fix birdpay - Fix balance display * Fix Zano assets showing amount before they are added * - handle fetching token data while the API is busy - potential fix for duplicate transactions * fix receive confirmations, maybe * revert onChangeWallet cleanup * Fix confirmations not updating * improve zano wallet opening, fix CI commands and messages on slack (#1979) Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com> * Cache wallet when creating/restoring as well * - hardcode Trocador Maximum limit for Zano temporarily - Configure Cake Zano node to use SSL * reformatting [skip ci] * revert to non-ssl * update build numbers [skip ci] * disable zano for desktop [skip ci] --------- Co-authored-by: cyan <cyjan@mrcyjanek.net>
This commit is contained in:
@@ -197,15 +197,14 @@ abstract class BalanceViewModelBase with Store {
|
||||
}
|
||||
}
|
||||
|
||||
@computed
|
||||
String get additionalBalance {
|
||||
final walletBalance = _walletBalance;
|
||||
String additionalBalance(CryptoCurrency cryptoCurrency) {
|
||||
final balance = _currencyBalance(cryptoCurrency);
|
||||
|
||||
if (displayMode == BalanceDisplayMode.hiddenBalance) {
|
||||
return '0.0';
|
||||
}
|
||||
|
||||
return walletBalance.formattedAdditionalBalance;
|
||||
return balance.formattedAdditionalBalance;
|
||||
}
|
||||
|
||||
@computed
|
||||
@@ -217,7 +216,7 @@ abstract class BalanceViewModelBase with Store {
|
||||
key,
|
||||
BalanceRecord(
|
||||
availableBalance: '●●●●●●',
|
||||
additionalBalance: additionalBalance,
|
||||
additionalBalance: additionalBalance(key),
|
||||
frozenBalance: '',
|
||||
secondAvailableBalance: '●●●●●●',
|
||||
secondAdditionalBalance: '●●●●●●',
|
||||
@@ -287,10 +286,9 @@ abstract class BalanceViewModelBase with Store {
|
||||
@observable
|
||||
bool mwebEnabled = false;
|
||||
|
||||
@computed
|
||||
bool get hasAdditionalBalance {
|
||||
bool hasAdditionalBalance(CryptoCurrency currency) {
|
||||
bool isWalletTypeActivated = _hasAdditionalBalanceForWalletType(wallet.type);
|
||||
bool isNotZeroAmount = additionalBalance != "0.0";
|
||||
bool isNotZeroAmount = additionalBalance(currency) != "0.0";
|
||||
|
||||
return isWalletTypeActivated && isNotZeroAmount;
|
||||
}
|
||||
@@ -384,9 +382,8 @@ abstract class BalanceViewModelBase with Store {
|
||||
return balance;
|
||||
}
|
||||
|
||||
@computed
|
||||
Balance get _walletBalance {
|
||||
final balance = wallet.balance[wallet.currency];
|
||||
Balance _currencyBalance(CryptoCurrency cryptoCurrency) {
|
||||
final balance = wallet.balance[cryptoCurrency];
|
||||
|
||||
if (balance == null) {
|
||||
throw Exception('No balance for ${wallet.currency}');
|
||||
|
||||
@@ -157,18 +157,128 @@ abstract class DashboardViewModelBase with Store {
|
||||
type = appStore.wallet!.type,
|
||||
transactions = ObservableList<TransactionListItem>(),
|
||||
wallet = appStore.wallet! {
|
||||
name = wallet.name;
|
||||
type = wallet.type;
|
||||
isShowFirstYatIntroduction = false;
|
||||
isShowSecondYatIntroduction = false;
|
||||
isShowThirdYatIntroduction = false;
|
||||
updateActions();
|
||||
|
||||
onWalletChange(wallet);
|
||||
final _wallet = wallet;
|
||||
|
||||
if (_wallet.type == WalletType.monero) {
|
||||
subname = monero!.getCurrentAccount(_wallet).label;
|
||||
|
||||
_onMoneroAccountChangeReaction = reaction(
|
||||
(_) => monero!.getMoneroWalletDetails(wallet).account,
|
||||
(Account account) => _onMoneroAccountChange(_wallet));
|
||||
|
||||
_onMoneroBalanceChangeReaction = reaction(
|
||||
(_) => monero!.getMoneroWalletDetails(wallet).balance,
|
||||
(MoneroBalance balance) => _onMoneroTransactionsUpdate(_wallet));
|
||||
|
||||
final _accountTransactions = _wallet.transactionHistory.transactions.values
|
||||
.where((tx) =>
|
||||
monero!.getTransactionInfoAccountId(tx) == monero!.getCurrentAccount(wallet).id)
|
||||
.toList();
|
||||
|
||||
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,
|
||||
key: ValueKey('monero_transaction_history_item_${transaction.id}_key'),
|
||||
),
|
||||
),
|
||||
);
|
||||
} else if (_wallet.type == WalletType.wownero) {
|
||||
subname = wow.wownero!.getCurrentAccount(_wallet).label;
|
||||
|
||||
_onMoneroAccountChangeReaction = reaction(
|
||||
(_) => wow.wownero!.getWowneroWalletDetails(wallet).account,
|
||||
(wow.Account account) => _onMoneroAccountChange(_wallet));
|
||||
|
||||
_onMoneroBalanceChangeReaction = reaction(
|
||||
(_) => wow.wownero!.getWowneroWalletDetails(wallet).balance,
|
||||
(wow.WowneroBalance balance) => _onMoneroTransactionsUpdate(_wallet));
|
||||
|
||||
final _accountTransactions = _wallet.transactionHistory.transactions.values
|
||||
.where((tx) =>
|
||||
wow.wownero!.getTransactionInfoAccountId(tx) ==
|
||||
wow.wownero!.getCurrentAccount(wallet).id)
|
||||
.toList();
|
||||
|
||||
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,
|
||||
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,
|
||||
key: ValueKey('${_wallet.type.name}_transaction_history_item_${transaction.id}_key'),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// TODO: nano sub-account generation is disabled:
|
||||
// if (_wallet.type == WalletType.nano || _wallet.type == WalletType.banano) {
|
||||
// subname = nano!.getCurrentAccount(_wallet).label;
|
||||
// }
|
||||
|
||||
reaction((_) => appStore.wallet, (wallet) {
|
||||
_onWalletChange(wallet);
|
||||
_checkMweb();
|
||||
});
|
||||
|
||||
connectMapToListWithTransform(
|
||||
appStore.wallet!.transactionHistory.transactions,
|
||||
transactions,
|
||||
(TransactionInfo? transaction) => TransactionListItem(
|
||||
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;
|
||||
}
|
||||
|
||||
final wallet = _wallet;
|
||||
if (wallet.type == WalletType.monero) {
|
||||
return monero!.getTransactionInfoAccountId(transaction) ==
|
||||
monero!.getCurrentAccount(wallet).id;
|
||||
}
|
||||
if (wallet.type == WalletType.wownero) {
|
||||
return wow.wownero!.getTransactionInfoAccountId(transaction) ==
|
||||
wow.wownero!.getCurrentAccount(wallet).id;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
if (hasSilentPayments) {
|
||||
silentPaymentsScanningActive = bitcoin!.getScanningActive(wallet);
|
||||
|
||||
@@ -482,11 +592,11 @@ abstract class DashboardViewModelBase with Store {
|
||||
}
|
||||
|
||||
@action
|
||||
void onWalletChange(
|
||||
void _onWalletChange(
|
||||
WalletBase<Balance, TransactionHistoryBase<TransactionInfo>, TransactionInfo>? wallet) {
|
||||
if (wallet == null) return;
|
||||
|
||||
_checkMweb();
|
||||
if (wallet == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.wallet = wallet;
|
||||
type = wallet.type;
|
||||
|
||||
@@ -105,6 +105,7 @@ class TransactionListItem extends ActionListItem with Keyable {
|
||||
WalletType.haven,
|
||||
WalletType.wownero,
|
||||
WalletType.litecoin,
|
||||
WalletType.zano,
|
||||
].contains(balanceViewModel.wallet.type)) {
|
||||
return formattedPendingStatus;
|
||||
}
|
||||
@@ -214,6 +215,10 @@ class TransactionListItem extends ActionListItem with Keyable {
|
||||
break;
|
||||
case WalletType.zano:
|
||||
final asset = zano!.assetOfTransaction(balanceViewModel.wallet, transaction);
|
||||
if (asset == null) {
|
||||
amount = "0.00";
|
||||
break;
|
||||
}
|
||||
final price = balanceViewModel.fiatConvertationStore.prices[asset];
|
||||
amount = calculateFiatAmountRaw(
|
||||
cryptoAmount: zano!.formatterIntAmountToDouble(amount: transaction.amount, currency: asset, forFee: false),
|
||||
|
||||
@@ -76,9 +76,7 @@ class WalletRestoreFromQRCode {
|
||||
RegExp _getPattern(int wordCount) =>
|
||||
RegExp(r'(?<=\W|^)((?:\w+\s+){' + (wordCount - 1).toString() + r'}\w+)(?=\W|$)');
|
||||
|
||||
List<int> patternCounts = walletType == WalletType.monero || walletType == WalletType.wownero
|
||||
? [25, 16, 14, 13]
|
||||
: [24, 18, 12];
|
||||
final List<int> patternCounts = [12, 13, 14, 16, 18, 24, 25, 26];
|
||||
|
||||
for (final count in patternCounts) {
|
||||
final pattern = _getPattern(count);
|
||||
@@ -122,7 +120,9 @@ class WalletRestoreFromQRCode {
|
||||
queryParameters['seed'] = _extractSeedPhraseFromUrl(code, walletType!);
|
||||
}
|
||||
if (queryParameters['address'] == null) {
|
||||
queryParameters['address'] = _extractAddressFromUrl(code, walletType!);
|
||||
try {
|
||||
queryParameters['address'] = _extractAddressFromUrl(code, walletType!);
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
Map<String, dynamic> credentials = {'type': walletType, ...queryParameters, 'raw_qr': code};
|
||||
@@ -223,7 +223,8 @@ class WalletRestoreFromQRCode {
|
||||
|
||||
if (type == WalletType.monero) {
|
||||
final codeParsed = json.decode(credentials['raw_qr'].toString());
|
||||
if (codeParsed["version"] != 0) throw UnimplementedError("Found view-only restore with unsupported version");
|
||||
if (codeParsed["version"] != 0)
|
||||
throw UnimplementedError("Found view-only restore with unsupported version");
|
||||
if (codeParsed["primaryAddress"] == null ||
|
||||
codeParsed["privateViewKey"] == null ||
|
||||
codeParsed["restoreHeight"] == null) {
|
||||
|
||||
@@ -3,10 +3,8 @@ import 'package:cake_wallet/haven/haven.dart';
|
||||
import 'package:cake_wallet/monero/monero.dart';
|
||||
import 'package:cake_wallet/reactions/wallet_connect.dart';
|
||||
import 'package:cake_wallet/src/screens/transaction_details/standart_list_item.dart';
|
||||
import 'package:cake_wallet/src/widgets/text_info_box.dart';
|
||||
import 'package:cake_wallet/store/app_store.dart';
|
||||
import 'package:cake_wallet/wownero/wownero.dart';
|
||||
import 'package:cake_wallet/zano/zano.dart';
|
||||
import 'package:cw_core/transaction_direction.dart';
|
||||
import 'package:cw_core/transaction_info.dart';
|
||||
import 'package:cw_core/wallet_base.dart';
|
||||
|
||||
@@ -73,11 +73,16 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store {
|
||||
? advancedPrivacySettingsViewModel.seedPhraseLength.value
|
||||
: 24;
|
||||
case WalletType.nano:
|
||||
case WalletType.banano:
|
||||
return seedSettingsViewModel.nanoSeedType == NanoSeedType.bip39
|
||||
? advancedPrivacySettingsViewModel.seedPhraseLength.value
|
||||
: 24;
|
||||
default:
|
||||
case WalletType.none:
|
||||
return 24;
|
||||
case WalletType.haven:
|
||||
return 25;
|
||||
case WalletType.zano:
|
||||
return 26;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,8 +72,6 @@ abstract class WalletRestoreViewModelBase extends WalletCreationVM with Store {
|
||||
}
|
||||
|
||||
static const moneroSeedMnemonicLength = 25;
|
||||
static const electrumSeedMnemonicLength = 24;
|
||||
static const electrumShortSeedMnemonicLength = 12;
|
||||
|
||||
late List<WalletRestoreMode> availableModes;
|
||||
final bool hasSeedLanguageSelector;
|
||||
|
||||
Reference in New Issue
Block a user