mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
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.
129 lines
4.6 KiB
Dart
129 lines
4.6 KiB
Dart
import 'package:hash_wallet/core/new_wallet_arguments.dart';
|
|
import 'package:hash_wallet/dogecoin/dogecoin.dart';
|
|
import 'package:hash_wallet/evm/evm.dart';
|
|
import 'package:hash_wallet/bitcoin_cash/bitcoin_cash.dart';
|
|
import 'package:hash_wallet/wownero/wownero.dart';
|
|
import 'package:mobx/mobx.dart';
|
|
import 'package:hash_wallet/bitcoin/bitcoin.dart';
|
|
import 'package:hash_wallet/core/wallet_creation_service.dart';
|
|
import 'package:hash_wallet/entities/seed_type.dart';
|
|
import 'package:hash_wallet/monero/monero.dart';
|
|
import 'package:hash_wallet/nano/nano.dart';
|
|
import 'package:hash_wallet/store/app_store.dart';
|
|
import 'package:hash_wallet/view_model/seed_settings_view_model.dart';
|
|
import 'package:hash_wallet/view_model/wallet_creation_vm.dart';
|
|
import 'package:cw_core/wallet_base.dart';
|
|
import 'package:cw_core/wallet_credentials.dart';
|
|
import 'package:cw_core/wallet_type.dart';
|
|
import 'advanced_privacy_settings_view_model.dart';
|
|
|
|
part 'wallet_new_vm.g.dart';
|
|
|
|
class WalletNewVM = WalletNewVMBase with _$WalletNewVM;
|
|
|
|
abstract class WalletNewVMBase extends WalletCreationVM with Store {
|
|
WalletNewVMBase(
|
|
AppStore appStore,
|
|
WalletCreationService walletCreationService,
|
|
this.advancedPrivacySettingsViewModel,
|
|
SeedSettingsViewModel seedSettingsViewModel, {
|
|
required this.newWalletArguments,
|
|
}) : selectedMnemonicLanguage = '',
|
|
super(appStore, walletCreationService, seedSettingsViewModel,
|
|
type: newWalletArguments!.type, isRecovery: false);
|
|
|
|
final NewWalletArguments? newWalletArguments;
|
|
final AdvancedPrivacySettingsViewModel advancedPrivacySettingsViewModel;
|
|
|
|
@observable
|
|
String selectedMnemonicLanguage;
|
|
|
|
bool get hasLanguageSelector =>
|
|
[WalletType.monero, WalletType.wownero].contains(type);
|
|
|
|
bool get showLanguageSelector => newWalletArguments?.mnemonic == null && hasLanguageSelector;
|
|
|
|
bool get hasSeedType =>
|
|
newWalletArguments?.mnemonic == null &&
|
|
[WalletType.monero, WalletType.wownero].contains(type);
|
|
|
|
@override
|
|
WalletCredentials getCredentials(dynamic _options) {
|
|
final options = _options as List<dynamic>?;
|
|
final passphrase = seedSettingsViewModel.passphrase;
|
|
seedSettingsViewModel.setPassphrase(null);
|
|
|
|
switch (type) {
|
|
case WalletType.monero:
|
|
return monero!.createMoneroNewWalletCredentials(
|
|
name: name,
|
|
language: options!.first as String,
|
|
password: walletPassword,
|
|
passphrase: passphrase,
|
|
seedType: newWalletArguments!.mnemonic != null
|
|
? MoneroSeedType.bip39.raw
|
|
: (options.last as MoneroSeedType).raw,
|
|
mnemonic: newWalletArguments!.mnemonic,
|
|
);
|
|
case WalletType.bitcoin:
|
|
case WalletType.litecoin:
|
|
return bitcoin!.createBitcoinNewWalletCredentials(
|
|
name: name,
|
|
password: walletPassword,
|
|
passphrase: passphrase,
|
|
mnemonic: newWalletArguments!.mnemonic,
|
|
);
|
|
case WalletType.ethereum:
|
|
case WalletType.polygon:
|
|
case WalletType.base:
|
|
case WalletType.arbitrum:
|
|
case WalletType.bsc:
|
|
return evm!.createEVMNewWalletCredentials(
|
|
name: name,
|
|
password: walletPassword,
|
|
mnemonic: newWalletArguments!.mnemonic,
|
|
passphrase: passphrase,
|
|
);
|
|
case WalletType.bitcoinCash:
|
|
return bitcoinCash!.createBitcoinCashNewWalletCredentials(
|
|
name: name,
|
|
password: walletPassword,
|
|
passphrase: passphrase,
|
|
mnemonic: newWalletArguments!.mnemonic,
|
|
);
|
|
case WalletType.dogecoin:
|
|
return dogecoin!.createDogeCoinNewWalletCredentials(
|
|
name: name,
|
|
password: walletPassword,
|
|
passphrase: passphrase,
|
|
mnemonic: newWalletArguments!.mnemonic,
|
|
);
|
|
case WalletType.nano:
|
|
case WalletType.banano:
|
|
return nano!.createNanoNewWalletCredentials(
|
|
name: name,
|
|
password: walletPassword,
|
|
mnemonic: newWalletArguments!.mnemonic,
|
|
passphrase: passphrase,
|
|
);
|
|
|
|
case WalletType.wownero:
|
|
return wownero!.createWowneroNewWalletCredentials(
|
|
name: name,
|
|
language: options!.first as String,
|
|
isPolyseed: (options.last as MoneroSeedType).raw == 1,
|
|
password: walletPassword,
|
|
passphrase: passphrase,
|
|
);
|
|
case WalletType.none:
|
|
throw Exception('Unexpected type: ${type.toString()}');
|
|
}
|
|
}
|
|
|
|
@override
|
|
Future<WalletBase> process(WalletCredentials credentials) async {
|
|
walletCreationService.changeWalletType(type: type);
|
|
return walletCreationService.create(credentials, isTestnet: useTestnet);
|
|
}
|
|
}
|