mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-08 11:59:23 +00:00
bbba41396d
* refactor: remove bitcoin_flutter, update deps, electrs node improvements * feat: connecting/disconnecting improvements, fix rescan by date, scanning message * chore: print * Update pubspec.yaml * Update pubspec.yaml * handle null sockets, retry connection on connect failure * fix imports * fix transaction history * fix RBF * minor fixes/readability enhancements [skip ci] --------- Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com> Co-authored-by: Matthew Fosse <matt@fosse.co>
54 lines
1.5 KiB
Dart
54 lines
1.5 KiB
Dart
import 'package:bitcoin_base/bitcoin_base.dart';
|
|
import 'package:blockchain_utils/blockchain_utils.dart';
|
|
|
|
ECPrivate generateECPrivate({
|
|
required Bip32Slip10Secp256k1 hd,
|
|
required BasedUtxoNetwork network,
|
|
required int index,
|
|
}) =>
|
|
ECPrivate(hd.childKey(Bip32KeyIndex(index)).privateKey);
|
|
|
|
String generateP2WPKHAddress({
|
|
required Bip32Slip10Secp256k1 hd,
|
|
required BasedUtxoNetwork network,
|
|
required int index,
|
|
}) =>
|
|
ECPublic.fromBip32(hd.childKey(Bip32KeyIndex(index)).publicKey)
|
|
.toP2wpkhAddress()
|
|
.toAddress(network);
|
|
|
|
String generateP2SHAddress({
|
|
required Bip32Slip10Secp256k1 hd,
|
|
required BasedUtxoNetwork network,
|
|
required int index,
|
|
}) =>
|
|
ECPublic.fromBip32(hd.childKey(Bip32KeyIndex(index)).publicKey)
|
|
.toP2wshInP2sh()
|
|
.toAddress(network);
|
|
|
|
String generateP2WSHAddress({
|
|
required Bip32Slip10Secp256k1 hd,
|
|
required BasedUtxoNetwork network,
|
|
required int index,
|
|
}) =>
|
|
ECPublic.fromBip32(hd.childKey(Bip32KeyIndex(index)).publicKey)
|
|
.toP2wshAddress()
|
|
.toAddress(network);
|
|
|
|
String generateP2PKHAddress({
|
|
required Bip32Slip10Secp256k1 hd,
|
|
required BasedUtxoNetwork network,
|
|
required int index,
|
|
}) =>
|
|
ECPublic.fromBip32(hd.childKey(Bip32KeyIndex(index)).publicKey)
|
|
.toP2pkhAddress()
|
|
.toAddress(network);
|
|
|
|
String generateP2TRAddress({
|
|
required Bip32Slip10Secp256k1 hd,
|
|
required BasedUtxoNetwork network,
|
|
required int index,
|
|
}) =>
|
|
ECPublic.fromBip32(hd.childKey(Bip32KeyIndex(index)).publicKey)
|
|
.toTaprootAddress()
|
|
.toAddress(network);
|