Skip to content

Commit 1e918a6

Browse files
committed
v6.2.0
- Update dependencies. - Support PSBT for BCH - Support for BIP-173 - Support for BCH schnorr signing
1 parent 267cd41 commit 1e918a6

56 files changed

Lines changed: 890 additions & 593 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 6.2.0
2+
3+
- Update dependencies.
4+
- Support PSBT for BCH
5+
- Support for BIP-173
6+
- Support for BCH schnorr signing
7+
18
## 6.1.0
29

310
- Fix der signature validation.

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,10 @@ We have integrated three APIs—Mempool, BlockCypher, and Electrum—into the pl
141141
final publicKey = privateKey.getPublic();
142142
143143
// Sign an input using the private key.
144-
final signSegwitV0OrLagacy = privateKey.signInput();
144+
final signSegwitV0OrLagacy = privateKey.signECDSA();
145145
146146
// Sign a Taproot transaction using the private key.
147-
final signSegwitV1TapprotTransaction = privateKey.signTapRoot();
147+
final signSegwitV1TapprotTransaction = privateKey.signBip340();
148148
149149
// Convert the private key to a WIF (Wallet Import Format) encoded string.
150150
// The boolean argument specifies whether to use the compressed format.
@@ -432,9 +432,9 @@ In the [example](https://github.com/mrtnetwork/bitcoin_base/tree/main/example/li
432432
final transaction =
433433
builder.buildTransaction((trDigest, utxo, publicKey, sighash) {
434434
if (utxo.utxo.isP2tr()) {
435-
return privateKey.signTapRoot(trDigest, sighash: sighash);
435+
return privateKey.signBip340(trDigest, sighash: sighash);
436436
}
437-
return privateKey.signInput(trDigest, sigHash: sighash);
437+
return privateKey.signECDSA(trDigest, sighash: sighash);
438438
});
439439
440440
/// get tx id
@@ -569,7 +569,7 @@ In the [example](https://github.com/mrtnetwork/bitcoin_base/tree/main/example/li
569569
);
570570
final transaaction =
571571
bchTransaction.buildTransaction((trDigest, utxo, publicKey, sighash) {
572-
return privateKey.signInput(trDigest, sigHash: sighash);
572+
return privateKey.signECDSA(trDigest, sighash: sighash);
573573
});
574574
575575
/// transaction ID
@@ -645,7 +645,7 @@ In the [example](https://github.com/mrtnetwork/bitcoin_base/tree/main/example/li
645645
extFlags: 0,
646646
);
647647
648-
// sign transaction using `signTapRoot` method of thransaction
648+
// sign transaction using `signBip340` method of thransaction
649649
final signedTx = sign(txDigit, utxo[i].public().toHex(), SIGHASH_ALL);
650650
651651
// add witness for current index

example/lib/bitcoin_cash/burn_token_example.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ void main() async {
128128
);
129129
final transaaction =
130130
bchTransaction.buildTransaction((trDigest, utxo, publicKey, sighash) {
131-
return privateKey.signInput(trDigest, sigHash: sighash);
131+
return privateKey.signECDSA(trDigest, sighash: sighash);
132132
});
133133

134134
/// transaction ID

example/lib/bitcoin_cash/create_cash_token_example.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ void main() async {
121121
outputOrdering: BitcoinOrdering.none);
122122
final transaaction =
123123
bchTransaction.buildTransaction((trDigest, utxo, publicKey, sighash) {
124-
return privateKey.signInput(trDigest, sigHash: sighash);
124+
return privateKey.signECDSA(trDigest, sighash: sighash);
125125
});
126126

127127
/// transaction ID

example/lib/bitcoin_cash/create_nft_example.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ void main() async {
109109
);
110110
final transaaction =
111111
bchTransaction.buildTransaction((trDigest, utxo, publicKey, sighash) {
112-
return privateKey.signInput(trDigest, sigHash: sighash);
112+
return privateKey.signECDSA(trDigest, sighash: sighash);
113113
});
114114

115115
/// transaction ID

example/lib/bitcoin_cash/make_vout0_example.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void main() async {
6565
);
6666
final transaaction =
6767
bchTransaction.buildTransaction((trDigest, utxo, publicKey, sighash) {
68-
return privateKey.signInput(trDigest, sigHash: sighash);
68+
return privateKey.signECDSA(trDigest, sighash: sighash);
6969
});
7070

7171
/// transaction ID

example/lib/bitcoin_cash/minting_nft_example.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ void main() async {
165165
);
166166
final transaaction =
167167
bchTransaction.buildTransaction((trDigest, utxo, publicKey, sighash) {
168-
return privateKey.signInput(trDigest, sigHash: sighash);
168+
return privateKey.signECDSA(trDigest, sighash: sighash);
169169
});
170170

171171
/// transaction ID

example/lib/bitcoin_cash/old_examples/old_example.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,13 @@ void _spendFrom2P2SHAnd2P2PKHAddress() async {
152152
/// For each input in the transaction, locate the corresponding private key
153153
/// and sign the transaction digest to construct the unlocking script.
154154
if (publicKey == childKey1PublicKey.toHex()) {
155-
return childKey1PrivateKey.signInput(trDigest, sigHash: sighash);
155+
return childKey1PrivateKey.signECDSA(trDigest, sighash: sighash);
156156
}
157157
if (publicKey == examplePublicKey.toHex()) {
158-
return childKey2PrivateKey.signInput(trDigest, sigHash: sighash);
158+
return childKey2PrivateKey.signECDSA(trDigest, sighash: sighash);
159159
}
160160
if (publicKey == examplePublicKey2.toHex()) {
161-
return examplePrivateKey.signInput(trDigest, sigHash: sighash);
161+
return examplePrivateKey.signECDSA(trDigest, sighash: sighash);
162162
}
163163

164164
throw UnimplementedError();
@@ -353,13 +353,13 @@ void _spendFrom2P2SHAnd1P2PKHAddress() async {
353353
]);
354354
final tr = b.buildTransaction((trDigest, utxo, publicKey, int sighash) {
355355
if (publicKey == childKey1PublicKey.toHex()) {
356-
return childKey1PrivateKey.signInput(trDigest, sigHash: sighash);
356+
return childKey1PrivateKey.signECDSA(trDigest, sighash: sighash);
357357
}
358358
if (publicKey == examplePublicKey.toHex()) {
359-
return childKey2PrivateKey.signInput(trDigest, sigHash: sighash);
359+
return childKey2PrivateKey.signECDSA(trDigest, sighash: sighash);
360360
}
361361
if (publicKey == examplePublicKey2.toHex()) {
362-
return examplePrivateKey.signInput(trDigest, sigHash: sighash);
362+
return examplePrivateKey.signECDSA(trDigest, sighash: sighash);
363363
}
364364

365365
throw UnimplementedError();

example/lib/bitcoin_cash/p2sh32_spend_example.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ void main() async {
9898
);
9999
final transaaction =
100100
bchTransaction.buildTransaction((trDigest, utxo, publicKey, sighash) {
101-
return privateKey.signInput(trDigest, sigHash: sighash);
101+
return privateKey.signECDSA(trDigest, sighash: sighash);
102102
});
103103

104104
/// transaction ID

example/lib/bitcoin_cash/send_ft_token_example.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ void main() async {
124124
);
125125
final transaaction =
126126
bchTransaction.buildTransaction((trDigest, utxo, publicKey, sighash) {
127-
return privateKey.signInput(trDigest, sigHash: sighash);
127+
return privateKey.signECDSA(trDigest, sighash: sighash);
128128
});
129129

130130
/// transaction ID

0 commit comments

Comments
 (0)