write migration for existing bitcoin and nano wallets

This commit is contained in:
fosse 2023-10-16 10:08:37 -04:00
parent 8fa9db24df
commit 5e9743cdb9
2 changed files with 16 additions and 2 deletions

View file

@ -175,7 +175,7 @@ Future<void> defaultSettingsMigration(
sharedPreferences: sharedPreferences, nodes: nodes); sharedPreferences: sharedPreferences, nodes: nodes);
break; break;
case 24: case 24:
// TODO: await updateBtcAndNanoWalletInfos() await updateBtcNanoWalletInfos(walletInfoSource);
break; break;
default: default:
@ -526,6 +526,20 @@ Future<void> changeDefaultMoneroNode(
} }
} }
Future<void> updateBtcNanoWalletInfos(Box<WalletInfo> walletsInfoSource) async {
for (WalletInfo walletInfo in walletsInfoSource.values) {
if (walletInfo.type == WalletType.nano || walletInfo.type == WalletType.bitcoin) {
walletInfo.derivationInfo = DerivationInfo(
derivationPath: walletInfo.derivationPath,
derivationType: walletInfo.derivationType,
address: walletInfo.address,
height: walletInfo.restoreHeight,
);
await walletInfo.save();
}
}
}
Future<void> checkCurrentNodes( Future<void> checkCurrentNodes(
Box<Node> nodeSource, Box<Node> powNodeSource, SharedPreferences sharedPreferences) async { Box<Node> nodeSource, Box<Node> powNodeSource, SharedPreferences sharedPreferences) async {
final currentMoneroNodeId = sharedPreferences.getInt(PreferencesKey.currentNodeIdKey); final currentMoneroNodeId = sharedPreferences.getInt(PreferencesKey.currentNodeIdKey);

View file

@ -166,7 +166,7 @@ Future<void> initializeAppConfigs() async {
transactionDescriptions: transactionDescriptions, transactionDescriptions: transactionDescriptions,
secureStorage: secureStorage, secureStorage: secureStorage,
anonpayInvoiceInfo: anonpayInvoiceInfo, anonpayInvoiceInfo: anonpayInvoiceInfo,
initialMigrationVersion: 23); initialMigrationVersion: 24);
} }
Future<void> initialSetup( Future<void> initialSetup(