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

View file

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

View file

@ -27,9 +27,10 @@ abstract class LitecoinWalletAddressesBase extends ElectrumWalletAddresses with
} }
final Bip32Slip10Secp256k1 mwebHd; final Bip32Slip10Secp256k1 mwebHd;
List<int> get scanSecret => mwebHd.childKey(Bip32KeyIndex(0x80000000)).privateKey.privKey.raw; 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 =>
List<int> get spendPubkey => mwebHd.childKey(Bip32KeyIndex(0x80000001)).publicKey.pubKey.compressed; mwebHd.childKey(Bip32KeyIndex(0x80000001)).publicKey.pubKey.compressed;
List<String> mwebAddrs = []; List<String> mwebAddrs = [];

View file

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