Files
hash-wallet/lib/view_model/advanced_privacy_settings_view_model.dart
T
jwinterm b57ab7cc06 Nuke Solana/Tron/Zano/Decred/Zcash/Haven from the codebase entirely
94 files changed, -5926 net lines. No stubs, no generators, no dead enum
values, no orphan switch branches. Removed for principled reasons (we
do not ship these chains) and to make the codebase smaller and friendlier
to contribute to.

What's gone:
- lib/{solana,tron,zano,decred,zcash,haven}/ directories
- lib/exchange/provider/jupiter_exchange_provider.dart (Solana-only)
- lib/entities/haven_seed_store.dart
- WalletType.{solana,tron,zano,decred,zcash,haven} enum values
  (HiveField IDs are pinned: Wownero stays at 12, all surviving types
  keep their IDs, so existing user-saved wallets deserialize unchanged)
- All ~70 lib/ files that imported the removed chain stubs or branched
  on the removed WalletType values
- backupSeeds(Box<HavenSeedStore>) abstract method + Wownero implementation
- Jupiter exchange branches in send/exchange view models
- TronGrid usage settings, Zano alias lookups, Zcash transparent address
  handling, Decred default-spv-nodes branches, Haven seed migration

What stays (intentional):
- CryptoCurrency.{xhv,sol,trx,dcr,zano,zec} enum entries in cw_core —
  they're still used as exchange/swap currency identifiers in
  address_validator.dart and elsewhere. The wallet types are gone but
  the *currencies* are still tradeable through Trocador.
- cw_core/spl_token.dart and cw_core/tron_token.dart Hive adapters in
  main.dart — the tokens still register as Hive types for backwards-
  compat with any old box data.
- lib/buy/{moonpay,robinhood,onramper,dfx,kryptonim,meld}/ provider
  source files (just stripped of solana/tron/etc references; providers
  themselves remain dormant per provider_types.dart).

Pinned-ID note: WalletType enum now has gaps in @HiveField IDs (4, 10,
11, 13, 14, 18 removed). This is deliberate — re-using a freed ID later
would mis-deserialize old hive boxes. Don't renumber.

Bundled config / CI hasn't changed; configure.dart was already free of
these chains in commit 4eb7db0b7.
2026-05-17 12:30:25 -04:00

129 lines
3.7 KiB
Dart

import 'package:hash_wallet/entities/exchange_api_mode.dart';
import 'package:hash_wallet/entities/fiat_api_mode.dart';
import 'package:hash_wallet/entities/seed_phrase_length.dart';
import 'package:hash_wallet/entities/seed_type.dart';
import 'package:hash_wallet/evm/evm.dart';
import 'package:hash_wallet/reactions/wallet_connect.dart';
import 'package:hash_wallet/store/settings_store.dart';
import 'package:cw_core/wallet_type.dart';
import 'package:mobx/mobx.dart';
part 'advanced_privacy_settings_view_model.g.dart';
class AdvancedPrivacySettingsViewModel = AdvancedPrivacySettingsViewModelBase
with _$AdvancedPrivacySettingsViewModel;
abstract class AdvancedPrivacySettingsViewModelBase with Store {
AdvancedPrivacySettingsViewModelBase(this.type, this._settingsStore) : _addCustomNode = false;
@computed
ExchangeApiMode get exchangeStatus => _settingsStore.exchangeStatus;
@computed
FiatApiMode get fiatApiMode => _settingsStore.fiatApiMode;
@computed
bool get disableBulletin => _settingsStore.disableBulletin;
@computed
bool get useBlinkProtection => _settingsStore.useBlinkProtection;
bool get canUseBlinkProtection {
if (!isEVMCompatibleChain(type)) return false;
// Get the chainId from the wallet type
final chainId = evm!.getChainIdByWalletType(type);
return canSupportBlinkProtection(chainId);
}
@observable
bool _addCustomNode = false;
final WalletType type;
final SettingsStore _settingsStore;
@computed
bool get hasSeedPhraseLengthOption {
// convert to switch case so that it give a syntax error when adding a new wallet type
// thus we don't forget about it
switch (type) {
case WalletType.ethereum:
case WalletType.bitcoinCash:
case WalletType.dogecoin:
case WalletType.polygon:
case WalletType.base:
case WalletType.arbitrum:
case WalletType.bsc:
return true;
case WalletType.bitcoin:
case WalletType.litecoin:
return _settingsStore.bitcoinSeedType == BitcoinSeedType.bip39;
case WalletType.nano:
case WalletType.banano:
return _settingsStore.nanoSeedType == NanoSeedType.bip39;
case WalletType.monero:
case WalletType.wownero:
case WalletType.none:
return false;
}
}
bool get isMoneroSeedTypeOptionsEnabled => [
WalletType.monero,
WalletType.wownero,
].contains(type);
bool get isBitcoinSeedTypeOptionsEnabled => [
WalletType.bitcoin,
WalletType.litecoin,
].contains(type);
bool get isNanoSeedTypeOptionsEnabled => [WalletType.nano].contains(type);
bool get hasPassphraseOption => [
WalletType.bitcoin,
WalletType.litecoin,
WalletType.bitcoinCash,
WalletType.ethereum,
WalletType.polygon,
WalletType.base,
WalletType.arbitrum,
WalletType.bsc,
WalletType.monero,
WalletType.wownero,
WalletType.dogecoin,
].contains(type);
@computed
bool get addCustomNode => _addCustomNode;
@computed
SeedPhraseLength get seedPhraseLength => _settingsStore.seedPhraseLength;
@computed
bool get isPolySeed => _settingsStore.moneroSeedType == MoneroSeedType.polyseed;
@action
void setFiatApiMode(FiatApiMode fiatApiMode) => _settingsStore.fiatApiMode = fiatApiMode;
@action
void setExchangeApiMode(ExchangeApiMode value) => _settingsStore.exchangeStatus = value;
@action
void setDisableBulletin(bool value) => _settingsStore.disableBulletin = value;
@action
void setUseBlinkProtection(bool value) => _settingsStore.useBlinkProtection = value;
@action
void toggleAddCustomNode() => _addCustomNode = !_addCustomNode;
@action
void setSeedPhraseLength(SeedPhraseLength length) => _settingsStore.seedPhraseLength = length;
}