mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
feat: add Wownero wallet seed backup during migration step 54 (#2667)
* feat: add Wownero wallet seed backup during migration step 54 * feat: add Haven wallet seed backup support in configure tool interface
This commit is contained in:
@@ -5,6 +5,7 @@ import 'package:cake_wallet/core/secure_storage.dart';
|
||||
import 'package:cake_wallet/entities/exchange_api_mode.dart';
|
||||
import 'package:cake_wallet/entities/fiat_api_mode.dart';
|
||||
import 'package:cake_wallet/entities/haven_seed_store.dart';
|
||||
import 'package:cake_wallet/wownero/wownero.dart';
|
||||
import 'package:cw_core/cake_hive.dart';
|
||||
import 'package:cw_core/pathForWallet.dart';
|
||||
import 'package:cake_wallet/entities/secret_store_key.dart';
|
||||
@@ -555,6 +556,9 @@ Future<void> defaultSettingsMigration(
|
||||
currentNodePreferenceKey: PreferencesKey.currentArbitrumNodeIdKey,
|
||||
);
|
||||
break;
|
||||
case 54:
|
||||
await _backupWowneroSeeds(havenSeedStore);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
@@ -740,6 +744,12 @@ Future<void> disableServiceStatusFiatDisabled(SharedPreferences sharedPreference
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _backupWowneroSeeds(Box<HavenSeedStore> havenSeedStore) async {
|
||||
final future = wownero?.backupSeeds(havenSeedStore);
|
||||
if (future != null) await future;
|
||||
return;
|
||||
}
|
||||
|
||||
Future<void> _updateMoneroPriority(SharedPreferences sharedPreferences) async {
|
||||
final currentPriority =
|
||||
await sharedPreferences.getInt(PreferencesKey.moneroTransactionPriority) ??
|
||||
|
||||
+1
-1
@@ -266,7 +266,7 @@ Future<void> initializeAppConfigs({bool loadWallet = true}) async {
|
||||
payjoinSessionSource: payjoinSessionSource,
|
||||
anonpayInvoiceInfo: anonpayInvoiceInfo,
|
||||
havenSeedStore: havenSeedStore,
|
||||
initialMigrationVersion: 53,
|
||||
initialMigrationVersion: 54,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -365,4 +365,20 @@ class CWWownero extends Wownero {
|
||||
Map<String, List<int>> debugCallLength() {
|
||||
return wownero_wallet_api.debugCallLength();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> backupSeeds(Box<HavenSeedStore> havenSeedStore) async {
|
||||
final wallets = await WalletInfo.selectList('type = ?', [WalletType.wownero.index]);
|
||||
final unspentCoinsInfo = await CakeHive.openBox<UnspentCoinsInfo>(UnspentCoinsInfo.boxName);
|
||||
for (final w in wallets) {
|
||||
final walletService = WowneroWalletService(unspentCoinsInfo);
|
||||
final flutterSecureStorage = secureStorageShared;
|
||||
final keyService = KeyService(flutterSecureStorage);
|
||||
final password = await keyService.getWalletPassword(walletName: w.name);
|
||||
final wallet = await walletService.openWallet(w.name, password);
|
||||
await havenSeedStore.add(HavenSeedStore(id: wallet.id, seed: wallet.seed));
|
||||
wallet.close();
|
||||
}
|
||||
await havenSeedStore.flush();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -517,6 +517,13 @@ import 'package:cw_core/transaction_info.dart';
|
||||
import 'package:cw_core/balance.dart';
|
||||
import 'package:cw_core/output_info.dart';
|
||||
import 'package:cake_wallet/view_model/send/output.dart';
|
||||
import 'package:cw_core/crypto_currency.dart';
|
||||
import 'package:cake_wallet/core/key_service.dart';
|
||||
import 'package:cake_wallet/core/secure_storage.dart';
|
||||
import 'package:cake_wallet/entities/haven_seed_store.dart';
|
||||
import 'package:cw_core/cake_hive.dart';
|
||||
import 'package:cw_core/wallet_info.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
import 'package:cw_core/wallet_service.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:polyseed/polyseed.dart';""";
|
||||
@@ -650,6 +657,7 @@ abstract class Wownero {
|
||||
Map<String, String> pendingTransactionInfo(Object transaction);
|
||||
String getLegacySeed(Object wallet, String langName);
|
||||
Map<String, List<int>> debugCallLength();
|
||||
Future<void> backupSeeds(Box<HavenSeedStore> havenSeedStore);
|
||||
}
|
||||
|
||||
abstract class WowneroSubaddressList {
|
||||
|
||||
Reference in New Issue
Block a user