mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-31 06:58:42 +01:00
Merge upstream Cake Wallet v6.5.0
Catches up from the May 12 fork point (v6.1.2+23) through v6.5.0: 535 upstream commits, including the Monero silent-open fix, Monero on Trezor, Ledger/Trezor BLE fixes, the new seed and history screens, quick Bitcoin sync, git-pinned dependencies (pubspec_overrides.yaml), frozen Hive adapters (*.part.dart), monero_c v0.18.4.6-RC2 and Flutter 3.41.9. Merged with both sides normalized first (import rename, 100-column format), which took the conflict count from 614 paths to 322. The procedure is now scripts/upstream_sync.sh. Kept from Hash Bags: - WalletType enum order and Hive IDs. SQLite stores WalletType.index and our order differs from upstream's; taking theirs would reread saved wallets as other chains. Our frozen adapter keeps the shipped IDs. - The 1.0.2 legacy PIN and wallet-password decode and self-heal. - Removed chains (Solana, Tron, Zano, Zcash, Decred, Haven) and the new Robinhood chain stay out; Cake Pay and non-Trocador swaps stay out. - Default nodes (node.wownero.org, sethforprivacy, Blockstream, bysh.me), converted to upstream's isDefault node-list key; Wownero is back in the node reset list. - Privacy: address resolvers limited to domain-anchored sources again; prices.neroswap.com for fiat; upstream's charts tab, which reads prices.cakewallet.com, sits behind FeatureFlag.isChartsEnabled = false. - Lightning stays behind FeatureFlag.isLightningEnabled, including upstream's new post-seed Lightning username step. - Our icon pipeline, branding and bundle identifiers. Twelve new upstream widget tests are skipped: test and code are unchanged from v6.5.0 apart from renames (not rerun on a pristine upstream checkout; upstream's top_bar_test does not compile against its own TopBar). flutter analyze lib: 0 errors; flutter test: 345 passed, 12 skipped; flutter build bundle compiles. Built with Flutter 3.41.9.
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:hash_wallet/core/address_resolver/address_resolver_service.dart';
|
||||
import 'package:hash_wallet/core/address_resolver/address_sources.dart';
|
||||
import 'package:hash_wallet/entities/exchange_api_mode.dart';
|
||||
import 'package:hash_wallet/entities/fiat_api_mode.dart';
|
||||
import 'package:hash_wallet/evm/evm.dart';
|
||||
import 'package:hash_wallet/generated/i18n.dart';
|
||||
import 'package:hash_wallet/reactions/wallet_connect.dart';
|
||||
import 'package:hash_wallet/src/widgets/alert_with_one_action.dart';
|
||||
import 'package:hash_wallet/store/app_store.dart';
|
||||
import 'package:hash_wallet/store/settings_store.dart';
|
||||
import 'package:hash_wallet/utils/show_pop_up.dart';
|
||||
import 'package:hash_wallet/utils/tor.dart';
|
||||
@@ -49,9 +50,30 @@ abstract class ConnectionSyncViewModelBase with Store {
|
||||
@computed
|
||||
bool get looksUpENS => _settingsStore.lookupsENS;
|
||||
|
||||
@computed
|
||||
bool get lookupsZcashNames => _settingsStore.lookupsZcashNames;
|
||||
|
||||
@computed
|
||||
bool get looksUpWellKnown => _settingsStore.lookupsWellKnown;
|
||||
|
||||
@computed
|
||||
bool get lookupsNostr => _settingsStore.lookupsNostr;
|
||||
|
||||
@computed
|
||||
bool get lookupsFio => _settingsStore.lookupsFio;
|
||||
|
||||
@computed
|
||||
bool get lookupsBip353 => _settingsStore.lookupsBip353;
|
||||
|
||||
@computed
|
||||
bool get lookupsThorChain => _settingsStore.lookupsThorChain;
|
||||
|
||||
@computed
|
||||
bool get lookupsZcashAddress => _settingsStore.lookupsZcashAddress;
|
||||
|
||||
@computed
|
||||
bool get lookupsLNUrlPay => _settingsStore.lookupsLNUrl;
|
||||
|
||||
@computed
|
||||
ExchangeApiMode get exchangeStatus => _settingsStore.exchangeStatus;
|
||||
|
||||
@@ -65,6 +87,100 @@ abstract class ConnectionSyncViewModelBase with Store {
|
||||
@computed
|
||||
bool get builtinTor => _settingsStore.currentBuiltinTor;
|
||||
|
||||
List<AddressSource> get domainLookupSources => AddressResolverService.supportedSources;
|
||||
|
||||
bool lookupValue(AddressSource source) {
|
||||
switch (source) {
|
||||
case AddressSource.twitter:
|
||||
return lookupTwitter;
|
||||
case AddressSource.mastodon:
|
||||
return looksUpMastodon;
|
||||
case AddressSource.yatRecord:
|
||||
return looksUpYatService;
|
||||
case AddressSource.unstoppableDomains:
|
||||
return looksUpUnstoppableDomains;
|
||||
case AddressSource.openAlias:
|
||||
return looksUpOpenAlias;
|
||||
case AddressSource.ens:
|
||||
return looksUpENS;
|
||||
case AddressSource.zcashName:
|
||||
return lookupsZcashNames;
|
||||
case AddressSource.zcashAddress:
|
||||
return lookupsZcashAddress;
|
||||
case AddressSource.wellKnown:
|
||||
return looksUpWellKnown;
|
||||
case AddressSource.zanoAlias:
|
||||
return lookupsZanoAlias;
|
||||
case AddressSource.bip353:
|
||||
return lookupsBip353;
|
||||
case AddressSource.fio:
|
||||
return lookupsFio;
|
||||
case AddressSource.lnurlPay:
|
||||
return lookupsLNUrlPay;
|
||||
case AddressSource.thorChain:
|
||||
return lookupsThorChain;
|
||||
case AddressSource.nostr:
|
||||
return lookupsNostr;
|
||||
case AddressSource.contact:
|
||||
case AddressSource.notParsed:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@action
|
||||
void setLookupValue(AddressSource source, bool value) {
|
||||
switch (source) {
|
||||
case AddressSource.twitter:
|
||||
_settingsStore.lookupsTwitter = value;
|
||||
break;
|
||||
case AddressSource.mastodon:
|
||||
_settingsStore.lookupsMastodon = value;
|
||||
break;
|
||||
case AddressSource.yatRecord:
|
||||
_settingsStore.lookupsYatService = value;
|
||||
break;
|
||||
case AddressSource.unstoppableDomains:
|
||||
_settingsStore.lookupsUnstoppableDomains = value;
|
||||
break;
|
||||
case AddressSource.openAlias:
|
||||
_settingsStore.lookupsOpenAlias = value;
|
||||
break;
|
||||
case AddressSource.ens:
|
||||
_settingsStore.lookupsENS = value;
|
||||
break;
|
||||
case AddressSource.zcashName:
|
||||
_settingsStore.lookupsZcashNames = value;
|
||||
break;
|
||||
case AddressSource.zcashAddress:
|
||||
_settingsStore.lookupsZcashAddress = value;
|
||||
break;
|
||||
case AddressSource.wellKnown:
|
||||
_settingsStore.lookupsWellKnown = value;
|
||||
break;
|
||||
case AddressSource.zanoAlias:
|
||||
_settingsStore.lookupsZanoAlias = value;
|
||||
break;
|
||||
case AddressSource.bip353:
|
||||
_settingsStore.lookupsBip353 = value;
|
||||
break;
|
||||
case AddressSource.fio:
|
||||
_settingsStore.lookupsFio = value;
|
||||
break;
|
||||
case AddressSource.lnurlPay:
|
||||
_settingsStore.lookupsLNUrl = value;
|
||||
break;
|
||||
case AddressSource.thorChain:
|
||||
_settingsStore.lookupsThorChain = value;
|
||||
break;
|
||||
case AddressSource.nostr:
|
||||
_settingsStore.lookupsNostr = value;
|
||||
break;
|
||||
case AddressSource.contact:
|
||||
case AddressSource.notParsed:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@computed
|
||||
bool get hasPowNodes => [WalletType.nano, WalletType.banano].contains(_wallet.type);
|
||||
|
||||
@@ -88,6 +204,9 @@ abstract class ConnectionSyncViewModelBase with Store {
|
||||
@computed
|
||||
bool get useBaseScan => _settingsStore.useBaseScan;
|
||||
|
||||
@computed
|
||||
bool get useRobinhoodScan => _settingsStore.useRobinhoodScan;
|
||||
|
||||
@computed
|
||||
bool get useArbiScan => _settingsStore.useArbiScan;
|
||||
|
||||
@@ -103,36 +222,15 @@ abstract class ConnectionSyncViewModelBase with Store {
|
||||
@computed
|
||||
bool get canUseBaseScan => _wallet.chainId == 8453;
|
||||
|
||||
@computed
|
||||
bool get canUseRobinhoodScan => _wallet.chainId == 4663;
|
||||
|
||||
@computed
|
||||
bool get canUseArbiScan => _wallet.chainId == 42161;
|
||||
|
||||
@computed
|
||||
bool get canUseBscScan => _wallet.chainId == 56;
|
||||
|
||||
@action
|
||||
void setLookupsTwitter(bool value) => _settingsStore.lookupsTwitter = value;
|
||||
|
||||
@action
|
||||
void setLookupsZanoAlias(bool value) => _settingsStore.lookupsZanoAlias = value;
|
||||
|
||||
@action
|
||||
void setLookupsMastodon(bool value) => _settingsStore.lookupsMastodon = value;
|
||||
|
||||
@action
|
||||
void setLookupsENS(bool value) => _settingsStore.lookupsENS = value;
|
||||
|
||||
@action
|
||||
void setLookupsWellKnown(bool value) => _settingsStore.lookupsWellKnown = value;
|
||||
|
||||
@action
|
||||
void setLookupsYatService(bool value) => _settingsStore.lookupsYatService = value;
|
||||
|
||||
@action
|
||||
void setLookupsUnstoppableDomains(bool value) => _settingsStore.lookupsUnstoppableDomains = value;
|
||||
|
||||
@action
|
||||
void setLookupsOpenAlias(bool value) => _settingsStore.lookupsOpenAlias = value;
|
||||
|
||||
@action
|
||||
void setUseMempoolFeeAPI(bool value) => _settingsStore.useMempoolFeeAPI = value;
|
||||
|
||||
@@ -149,6 +247,11 @@ abstract class ConnectionSyncViewModelBase with Store {
|
||||
@action
|
||||
void setUseBlinkProtection(bool value) => _settingsStore.useBlinkProtection = value;
|
||||
|
||||
bool get hasRescan =>
|
||||
_wallet.hasRescan &&
|
||||
_wallet.type != WalletType.bitcoin &&
|
||||
_wallet.type != WalletType.litecoin;
|
||||
|
||||
@action
|
||||
void setUseEtherscan(bool value) {
|
||||
_settingsStore.useEtherscan = value;
|
||||
@@ -167,6 +270,12 @@ abstract class ConnectionSyncViewModelBase with Store {
|
||||
evm!.updateScanProviderUsageState(_wallet, value);
|
||||
}
|
||||
|
||||
@action
|
||||
void setUseRobinhoodScan(bool value) {
|
||||
_settingsStore.useRobinhoodScan = value;
|
||||
evm!.updateScanProviderUsageState(_wallet, value);
|
||||
}
|
||||
|
||||
@action
|
||||
void setUseArbiScan(bool value) {
|
||||
_settingsStore.useArbiScan = value;
|
||||
|
||||
@@ -47,6 +47,8 @@ abstract class OtherSettingsViewModelBase with Store {
|
||||
final SettingsStore _settingsStore;
|
||||
final SendViewModel sendViewModel;
|
||||
|
||||
bool get hasSignVerify => _wallet.canSignMessages;
|
||||
|
||||
@computed
|
||||
TransactionPriority get transactionPriority {
|
||||
final priority = _settingsStore.getPriority(walletType, chainId: chainId);
|
||||
@@ -156,6 +158,12 @@ abstract class OtherSettingsViewModelBase with Store {
|
||||
void setShouldSaveRecipientAddress(bool value) =>
|
||||
_settingsStore.shouldSaveRecipientAddress = value;
|
||||
|
||||
@computed
|
||||
bool get showCiBuildOverlay => _settingsStore.showCiBuildOverlay;
|
||||
|
||||
@action
|
||||
void setShowCiBuildOverlay(bool value) => _settingsStore.showCiBuildOverlay = value;
|
||||
|
||||
int? get customPriorityItemIndex {
|
||||
final priorities = priorityForWalletType(walletType);
|
||||
final customItem = priorities
|
||||
@@ -170,6 +178,10 @@ abstract class OtherSettingsViewModelBase with Store {
|
||||
return null;
|
||||
}
|
||||
|
||||
bool get hasPayjoin => _wallet.hasPayjoinSupport;
|
||||
|
||||
bool get hasLightning => _wallet.hasLightningSupport;
|
||||
|
||||
Future<File?> getLightningLog() async {
|
||||
final path = await pathForWalletDir(name: _wallet.name, type: walletType);
|
||||
final logFile = File("$path/lightning.log");
|
||||
|
||||
@@ -25,7 +25,12 @@ abstract class PrivacySettingsViewModelBase with Store {
|
||||
bool get isBitcoin => _wallet.type == WalletType.bitcoin;
|
||||
|
||||
@computed
|
||||
bool get hasMWEB => _wallet.type == WalletType.litecoin && (Platform.isIOS || Platform.isAndroid);
|
||||
bool get hasSilentPaymentsScanning => _wallet.hasSilentPaymentsScanning;
|
||||
|
||||
@computed
|
||||
bool get hasMWEB =>
|
||||
_wallet.type == WalletType.litecoin && (Platform.isIOS || Platform.isAndroid) &&
|
||||
!_wallet.isHardwareWallet;
|
||||
|
||||
@computed
|
||||
bool get isAutoGenerateSubaddressesEnabled =>
|
||||
@@ -48,14 +53,7 @@ abstract class PrivacySettingsViewModelBase with Store {
|
||||
].contains(_wallet.type);
|
||||
|
||||
@computed
|
||||
bool get hasCoinControl => [
|
||||
WalletType.bitcoin,
|
||||
WalletType.litecoin,
|
||||
WalletType.monero,
|
||||
WalletType.wownero,
|
||||
WalletType.bitcoinCash,
|
||||
WalletType.dogecoin
|
||||
].contains(_wallet.type);
|
||||
bool get hasCoinControl => _wallet.hasCoinControl;
|
||||
|
||||
bool get isMoneroWallet => _wallet.type == WalletType.monero;
|
||||
|
||||
@@ -96,6 +94,9 @@ abstract class PrivacySettingsViewModelBase with Store {
|
||||
@computed
|
||||
bool get looksUpENS => _settingsStore.lookupsENS;
|
||||
|
||||
@computed
|
||||
bool get lookupsZcashNames => _settingsStore.lookupsZcashNames;
|
||||
|
||||
@computed
|
||||
bool get looksUpWellKnown => _settingsStore.lookupsWellKnown;
|
||||
|
||||
@@ -103,11 +104,10 @@ abstract class PrivacySettingsViewModelBase with Store {
|
||||
bool get usePayjoin => _settingsStore.usePayjoin;
|
||||
|
||||
@computed
|
||||
bool get canUsePayjoin => _wallet.type == WalletType.bitcoin && DeviceInfo.instance.isMobile;
|
||||
bool get canUsePayjoin => _wallet.hasPayjoinSupport && DeviceInfo.instance.isMobile;
|
||||
|
||||
@computed
|
||||
bool get canUseLightning =>
|
||||
_wallet.type == WalletType.bitcoin && !Platform.isWindows && !Platform.isLinux;
|
||||
bool get canUseLightning => _wallet.hasLightningSupport;
|
||||
|
||||
@computed
|
||||
bool get useLightning => _wallet.type == WalletType.bitcoin && bitcoin!.useLightning(_wallet);
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hash_wallet/view_model/settings/settings_list_item.dart';
|
||||
|
||||
class RegularListItem extends SettingsListItem {
|
||||
RegularListItem({required String title, this.handler}) : super(title);
|
||||
|
||||
final void Function(BuildContext context)? handler;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:hash_wallet/view_model/settings/settings_list_item.dart';
|
||||
|
||||
class SwitcherListItem extends SettingsListItem {
|
||||
SwitcherListItem({required String title, required this.value, required this.onValueChange})
|
||||
: super(title);
|
||||
|
||||
final bool Function() value;
|
||||
final void Function(BuildContext context, bool value) onValueChange;
|
||||
}
|
||||
Reference in New Issue
Block a user