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 {
585585 this . __CACHE ,
586586 sighashTypes ,
587587 ) ;
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+ }
588606 return Promise . resolve ( keyPair . sign ( hash ) ) . then ( signature => {
589607 const partialSig = [
590608 {
Original file line number Diff line number Diff line change @@ -706,6 +706,26 @@ export class Psbt {
706706 sighashTypes ,
707707 ) ;
708708
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+
709729 return Promise . resolve ( keyPair . sign ( hash ) ) . then ( signature => {
710730 const partialSig = [
711731 {
You can’t perform that action at this time.
0 commit comments