FIX: gracefully handling existing LDK wallets after deprecation

This commit is contained in:
overtorment 2024-08-17 15:55:37 +01:00
parent fabd816bfe
commit 6bb6f69a27

View File

@ -455,13 +455,14 @@ export class BlueApp {
unserializedWallet.init();
break;
}
case 'lightningLdk':
// since ldk wallets are deprecated and removed, we need to handle a case when such wallet still exists in storage
unserializedWallet = new HDSegwitBech32Wallet();
unserializedWallet.setSecret(tempObj.secret.replace('ldk://', ''));
break;
case LegacyWallet.type:
default:
unserializedWallet = LegacyWallet.fromJson(key) as unknown as LegacyWallet;
if (tempObj.secret?.startsWith('ldk://')) {
const extractedSecret = tempObj.secret.replace('ldk://', '');
unserializedWallet.setSecret(extractedSecret);
}
break;
}