Cw 528 backup wallet files (#1281)

* monero wallet backup changes

* [skipci] updates

* monero fixes

* start work for bitcoin/eth

* cleanup

* [skipci] more cleanup

* add all other coins

* merge fixes

* add corrupted test

* build for testing

* actually be able to test monero

* review fixes

* more review fixes
This commit is contained in:
Matthew Fosse 2024-02-07 07:44:29 -08:00 committed by GitHub
parent e4ddf82e69
commit 26fe28891d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 264 additions and 117 deletions

View file

@ -39,16 +39,31 @@ class EthereumWalletService extends EVMChainWalletService<EthereumWallet> {
Future<EthereumWallet> openWallet(String name, String password) async {
final walletInfo =
walletInfoSource.values.firstWhere((info) => info.id == WalletBase.idFor(name, getType()));
final wallet = await EthereumWallet.open(
name: name,
password: password,
walletInfo: walletInfo,
);
await wallet.init();
await wallet.save();
try {
final wallet = await EthereumWallet.open(
name: name,
password: password,
walletInfo: walletInfo,
);
return wallet;
await wallet.init();
await wallet.save();
saveBackup(name);
return wallet;
} catch (_) {
await restoreWalletFilesFromBackup(name);
final wallet = await EthereumWallet.open(
name: name,
password: password,
walletInfo: walletInfo,
);
await wallet.init();
await wallet.save();
return wallet;
}
}
@override
@ -59,6 +74,7 @@ class EthereumWalletService extends EVMChainWalletService<EthereumWallet> {
password: password, name: currentName, walletInfo: currentWalletInfo);
await currentWallet.renameWalletFiles(newName);
await saveBackup(newName);
final newWalletInfo = currentWalletInfo;
newWalletInfo.id = WalletBase.idFor(newName, getType());