mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-30 06:48:49 +01:00
Upstream reformatted its whole tree in 16ddc0837. Matching it removes
formatting from the conflict surface of this and every later sync.
56 lines
1.6 KiB
Dart
56 lines
1.6 KiB
Dart
import 'dart:typed_data';
|
|
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)
|
|
.toP2wpkhInP2sh()
|
|
.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);
|