File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -585,6 +585,24 @@ class Psbt {
585
585
this . __CACHE ,
586
586
sighashTypes ,
587
587
) ;
588
+ const scriptType = this . getInputType ( inputIndex ) ;
589
+ if ( scriptType === 'taproot' ) {
590
+ if ( ! keyPair . signSchnorr ) {
591
+ throw new Error (
592
+ `Need Schnorr Signer to sign taproot input #${ inputIndex } .` ,
593
+ ) ;
594
+ }
595
+ return Promise . resolve ( keyPair . signSchnorr ( hash ) ) . then ( signature => {
596
+ const partialSig = [
597
+ {
598
+ pubkey : keyPair . publicKey ,
599
+ signature,
600
+ } ,
601
+ ] ;
602
+ // must be changed to use the `updateInput()` public API
603
+ this . data . inputs [ inputIndex ] . partialSig = partialSig ;
604
+ } ) ;
605
+ }
588
606
return Promise . resolve ( keyPair . sign ( hash ) ) . then ( signature => {
589
607
const partialSig = [
590
608
{
Original file line number Diff line number Diff line change @@ -706,6 +706,26 @@ export class Psbt {
706
706
sighashTypes ,
707
707
) ;
708
708
709
+ const scriptType = this . getInputType ( inputIndex ) ;
710
+
711
+ if ( scriptType === 'taproot' ) {
712
+ if ( ! keyPair . signSchnorr ) {
713
+ throw new Error (
714
+ `Need Schnorr Signer to sign taproot input #${ inputIndex } .` ,
715
+ ) ;
716
+ }
717
+ return Promise . resolve ( keyPair . signSchnorr ( hash ) ) . then ( signature => {
718
+ const partialSig = [
719
+ {
720
+ pubkey : keyPair . publicKey ,
721
+ signature,
722
+ } ,
723
+ ] ;
724
+ // must be changed to use the `updateInput()` public API
725
+ this . data . inputs [ inputIndex ] . partialSig = partialSig ;
726
+ } ) ;
727
+ }
728
+
709
729
return Promise . resolve ( keyPair . sign ( hash ) ) . then ( signature => {
710
730
const partialSig = [
711
731
{
You can’t perform that action at this time.
0 commit comments