mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-11-28 11:34:52 +01:00
The big one. Touches 760+ files. Locks in the user's decision to break import-line compatibility with upstream cake-tech/cake_wallet in exchange for a binary named hash_wallet on every platform. Changes: - pubspec_description.yaml: project name cake_wallet -> hash_wallet - 762 Dart files: every 'package:cake_wallet/...' import rewritten to 'package:hash_wallet/...' (lib/, cw_*/lib/, tool/, test/, integration_test/) - linux/CMakeLists.txt: BINARY_NAME cake_wallet -> hash_wallet - windows/CMakeLists.txt: project + BINARY_NAME (CakeWallet -> HashWallet) - windows/runner/Runner.rc: company / file / product strings to Hash Wallet + Such Software LLC copyright - macos/Runner.xcodeproj/project_base.pbxproj: cake_wallet_new.app refs -> hash_wallet.app (macOS output bundle name) - com.suchsoftware.HashWallet.yml (Flatpak): all binary path refs cake_wallet -> hash_wallet (e.g. /app/hash_wallet/hash_wallet) - linux/com.suchsoftware.HashWallet.desktop: Exec=hash_wallet - scripts/android/copy_monero_deps.sh: CW_DIR target path - configure_hash_wallet.sh: error message typo (old filename) INTENTIONALLY UNCHANGED: - cw_* subpackage names (cw_core, cw_bitcoin, cw_wownero, etc.) — they remain as the historical 'cake wallet' naming; renaming them would cascade through every sub-package's internal structure - Method channel name 'com.cake_wallet/native_utils' in iOS/macOS/Android AppDelegates and MainActivity — it's a string identifier that has to match the Dart side exactly. Renaming requires both-sides change; it's internal-only and not user-visible. - ghcr.io/cake-tech/cake_wallet:debian13-... docker image references in build scripts — that's Cake Labs' published image we use as the build environment, not ours. User data directory now follows the new binary name: ~/.local/share/hash_wallet/ (was ~/.local/share/cake_wallet/) ~/.config/hash_wallet/ (was ~/.config/cake_wallet/) Existing users on the old name will need migration if any exist.
164 lines
5.8 KiB
Dart
164 lines
5.8 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/zano/zano.dart';
|
|
import 'package:hash_wallet/bitcoin_cash/bitcoin_cash.dart';
|
|
import 'package:hash_wallet/solana/solana.dart';
|
|
import 'package:hash_wallet/tron/tron.dart';
|
|
import 'package:hash_wallet/wownero/wownero.dart';
|
|
import 'package:hash_wallet/zcash/zcash.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:hash_wallet/decred/decred.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.haven, 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.solana:
|
|
return solana!.createSolanaNewWalletCredentials(
|
|
name: name,
|
|
password: walletPassword,
|
|
mnemonic: newWalletArguments!.mnemonic,
|
|
passphrase: passphrase,
|
|
);
|
|
case WalletType.tron:
|
|
return tron!.createTronNewWalletCredentials(
|
|
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.zano:
|
|
return zano!.createZanoNewWalletCredentials(
|
|
name: name,
|
|
password: walletPassword,
|
|
passphrase: passphrase,
|
|
);
|
|
case WalletType.zcash:
|
|
return zcash!.createZcashNewWalletCredentials(
|
|
name: name,
|
|
password: walletPassword,
|
|
mnemonic: newWalletArguments!.mnemonic,
|
|
passphrase: passphrase,
|
|
);
|
|
case WalletType.decred:
|
|
return decred!.createDecredNewWalletCredentials(name: name);
|
|
case WalletType.none:
|
|
case WalletType.haven:
|
|
throw Exception('Unexpected type: ${type.toString()}');
|
|
}
|
|
}
|
|
|
|
@override
|
|
Future<WalletBase> process(WalletCredentials credentials) async {
|
|
walletCreationService.changeWalletType(type: type);
|
|
return walletCreationService.create(credentials, isTestnet: useTestnet);
|
|
}
|
|
}
|