bitcoin_flutter removal fixes

This commit is contained in:
Matthew Fosse 2024-08-12 14:55:55 -07:00
parent 3408de80d6
commit 8949db3b93
4 changed files with 17 additions and 11 deletions

View file

@ -105,11 +105,17 @@ abstract class ElectrumWalletBase
}
if (seedBytes != null) {
return currency == CryptoCurrency.bch
? bitcoinCashHDWallet(seedBytes)
: Bip32Slip10Secp256k1.fromSeed(seedBytes).derivePath(
switch (currency) {
case CryptoCurrency.btc:
case CryptoCurrency.ltc:
return Bip32Slip10Secp256k1.fromSeed(seedBytes).derivePath(
_hardenedDerivationPath(derivationInfo?.derivationPath ?? electrum_path))
as Bip32Slip10Secp256k1;
case CryptoCurrency.bch:
return bitcoinCashHDWallet(seedBytes);
default:
throw Exception("Unsupported currency");
}
}
return Bip32Slip10Secp256k1.fromExtendedKey(xpub!);
@ -461,7 +467,6 @@ abstract class ElectrumWalletBase
}
}
node!.isElectrs = false;
node!.save();
return node!.isElectrs!;
@ -2281,4 +2286,3 @@ class UtxoDetails {
required this.spendsUnconfirmedTX,
});
}

View file

@ -1,6 +1,5 @@
import 'dart:async';
import 'dart:math';
import 'package:blockchain_utils/bip/bip/bip32/base/bip32_base.dart';
import 'package:collection/collection.dart';
import 'package:convert/convert.dart' as convert;
import 'package:crypto/crypto.dart';
@ -65,7 +64,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
seedBytes: seedBytes,
currency: CryptoCurrency.ltc,
) {
mwebHd = Bip32Slip10Secp256k1.fromSeed(seedBytes).derivePath("m/1000") as Bip32Slip10Secp256k1;
mwebHd = Bip32Slip10Secp256k1.fromSeed(seedBytes).derivePath("m/1000'") as Bip32Slip10Secp256k1;
mwebEnabled = alwaysScan ?? false;
walletAddresses = LitecoinWalletAddresses(
walletInfo,
@ -84,7 +83,6 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
_stub = value;
});
}
late final Bip32Slip10Secp256k1 mwebHd;
late final Box<MwebUtxo> mwebUtxosBox;
Timer? _syncTimer;

View file

@ -27,9 +27,10 @@ abstract class LitecoinWalletAddressesBase extends ElectrumWalletAddresses with
}
final Bip32Slip10Secp256k1 mwebHd;
List<int> get scanSecret => mwebHd.childKey(Bip32KeyIndex(0x80000000)).privateKey.privKey.raw;
// TODO: I'm not 100% sure if it's supposed to be the compressed or uncompressed public key!
List<int> get spendPubkey => mwebHd.childKey(Bip32KeyIndex(0x80000001)).publicKey.pubKey.compressed;
List<int> get spendPubkey =>
mwebHd.childKey(Bip32KeyIndex(0x80000001)).publicKey.pubKey.compressed;
List<String> mwebAddrs = [];

View file

@ -45,7 +45,6 @@ dependencies:
url: https://github.com/rafael-xmr/sp_scanner
ref: sp_v4.0.0
dev_dependencies:
flutter_test:
sdk: flutter
@ -66,6 +65,10 @@ dependency_overrides:
url: https://github.com/cake-tech/bitcoin_base
ref: cake-update-v5
pointycastle: 3.7.4
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec