Skip to content

Commit

Permalink
decred: Update derivation info.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeGruffins committed Feb 10, 2025
1 parent 28752a6 commit 858e4e8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
23 changes: 13 additions & 10 deletions cw_decred/lib/wallet_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ class DecredWalletService extends WalletService<
password: credentials.password!,
network: isTestnet == true ? testnet : mainnet,
);
credentials.walletInfo!.derivationPath =
isTestnet == true ? seedRestorePathTestnet : seedRestorePath;
final di = DerivationInfo(
derivationPath: isTestnet == true ? seedRestorePathTestnet : seedRestorePath);
credentials.walletInfo!.derivationInfo = di;
final wallet =
DecredWallet(credentials.walletInfo!, credentials.password!, this.unspentCoinsInfoSource);
await wallet.init();
Expand All @@ -61,8 +62,8 @@ class DecredWalletService extends WalletService<
Future<DecredWallet> openWallet(String name, String password) async {
final walletInfo = walletInfoSource.values
.firstWhereOrNull((info) => info.id == WalletBase.idFor(name, getType()))!;
final network = walletInfo.derivationPath == seedRestorePathTestnet ||
walletInfo.derivationPath == pubkeyRestorePathTestnet
final network = walletInfo.derivationInfo?.derivationPath == seedRestorePathTestnet ||
walletInfo.derivationInfo?.derivationPath == pubkeyRestorePathTestnet
? testnet
: mainnet;

Expand Down Expand Up @@ -93,8 +94,8 @@ class DecredWalletService extends WalletService<
Future<void> rename(String currentName, String password, String newName) async {
final currentWalletInfo = walletInfoSource.values
.firstWhereOrNull((info) => info.id == WalletBase.idFor(currentName, getType()))!;
final network = currentWalletInfo.derivationPath == seedRestorePathTestnet ||
currentWalletInfo.derivationPath == pubkeyRestorePathTestnet
final network = currentWalletInfo.derivationInfo?.derivationPath == seedRestorePathTestnet ||
currentWalletInfo.derivationInfo?.derivationPath == pubkeyRestorePathTestnet
? testnet
: mainnet;
final currentWallet = DecredWallet(currentWalletInfo, password, this.unspentCoinsInfoSource);
Expand All @@ -120,8 +121,9 @@ class DecredWalletService extends WalletService<
password: credentials.password!,
mnemonic: credentials.mnemonic,
network: isTestnet == true ? testnet : mainnet);
credentials.walletInfo!.derivationPath =
isTestnet == true ? seedRestorePathTestnet : seedRestorePath;
final di = DerivationInfo(
derivationPath: isTestnet == true ? seedRestorePathTestnet : seedRestorePath);
credentials.walletInfo!.derivationInfo = di;
final wallet =
DecredWallet(credentials.walletInfo!, credentials.password!, this.unspentCoinsInfoSource);
await wallet.init();
Expand All @@ -139,8 +141,9 @@ class DecredWalletService extends WalletService<
credentials.pubkey,
isTestnet == true ? testnet : mainnet,
);
credentials.walletInfo!.derivationPath =
isTestnet == true ? pubkeyRestorePathTestnet : pubkeyRestorePath;
final di = DerivationInfo(
derivationPath: isTestnet == true ? pubkeyRestorePathTestnet : pubkeyRestorePath);
credentials.walletInfo!.derivationInfo = di;
final wallet =
DecredWallet(credentials.walletInfo!, credentials.password!, this.unspentCoinsInfoSource);
await wallet.init();
Expand Down
4 changes: 2 additions & 2 deletions cw_decred/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -769,10 +769,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
url: "https://pub.dev"
source: hosted
version: "14.2.4"
version: "14.2.5"
watcher:
dependency: transitive
description:
Expand Down

0 comments on commit 858e4e8

Please sign in to comment.