mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-03-12 09:32:33 +00:00
bip39 fixes
This commit is contained in:
parent
9697baa565
commit
5c78541dbc
1 changed files with 21 additions and 10 deletions
|
@ -11,6 +11,7 @@ import 'package:cw_core/wallet_info.dart';
|
|||
import 'package:cw_bitcoin/bitcoin_address_record.dart';
|
||||
import 'package:cw_bitcoin/electrum_balance.dart';
|
||||
import 'package:cw_bitcoin/bitcoin_wallet_addresses.dart';
|
||||
import 'package:bip39/bip39.dart' as bip39;
|
||||
|
||||
part 'bitcoin_wallet.g.dart';
|
||||
|
||||
|
@ -57,13 +58,19 @@ abstract class BitcoinWalletBase extends ElectrumWallet with Store {
|
|||
ElectrumBalance? initialBalance,
|
||||
int initialRegularAddressIndex = 0,
|
||||
int initialChangeAddressIndex = 0}) async {
|
||||
|
||||
late Uint8List seedBytes;
|
||||
if (walletInfo.derivationType == DerivationType.electrum2) {
|
||||
seedBytes = await mnemonicToSeedBytes(mnemonic);
|
||||
} else {
|
||||
// TODO: add bip39 seed
|
||||
seedBytes = await mnemonicToSeedBytes(mnemonic);
|
||||
|
||||
switch (walletInfo.derivationType) {
|
||||
case DerivationType.electrum2:
|
||||
seedBytes = await mnemonicToSeedBytes(mnemonic);
|
||||
break;
|
||||
case DerivationType.bip39:
|
||||
default:
|
||||
seedBytes = await bip39.mnemonicToSeed(mnemonic);
|
||||
break;
|
||||
}
|
||||
|
||||
return BitcoinWallet(
|
||||
mnemonic: mnemonic,
|
||||
password: password,
|
||||
|
@ -96,11 +103,15 @@ abstract class BitcoinWalletBase extends ElectrumWallet with Store {
|
|||
}
|
||||
|
||||
late Uint8List seedBytes;
|
||||
if (walletInfo.derivationType == DerivationType.electrum2) {
|
||||
seedBytes = await mnemonicToSeedBytes(snp.mnemonic);
|
||||
} else {
|
||||
// TODO: add bip39 seed
|
||||
seedBytes = await mnemonicToSeedBytes(snp.mnemonic);
|
||||
|
||||
switch (walletInfo.derivationType) {
|
||||
case DerivationType.electrum2:
|
||||
seedBytes = await mnemonicToSeedBytes(snp.mnemonic);
|
||||
break;
|
||||
case DerivationType.bip39:
|
||||
default:
|
||||
seedBytes = await bip39.mnemonicToSeed(snp.mnemonic);
|
||||
break;
|
||||
}
|
||||
|
||||
return BitcoinWallet(
|
||||
|
|
Loading…
Reference in a new issue