@@ -282,7 +282,7 @@ object Transaction extends BtcSerializer[Transaction] {
282282 * @param amount amount of the output claimed by this tx input
283283 * @param signatureVersion signature version (1: segwit, 0: pre-segwit)
284284 * @param privateKey private key
285- * @return the encoded signature of this tx for this specific tx input
285+ * @return the encoded signature (DER + sighash byte) of this tx for this specific tx input
286286 */
287287 def signInput (tx : Transaction , inputIndex : Int , previousOutputScript : ByteVector , sighashType : Int , amount : Satoshi , signatureVersion : Int , privateKey : PrivateKey ): ByteVector = {
288288 tx.signInput(inputIndex, previousOutputScript, sighashType, amount, signatureVersion, privateKey)
@@ -298,7 +298,7 @@ object Transaction extends BtcSerializer[Transaction] {
298298 * @param amount amount of the output claimed by this tx input
299299 * @param signatureVersion signature version (1: segwit, 0: pre-segwit)
300300 * @param privateKey private key
301- * @return the encoded signature of this tx for this specific tx input
301+ * @return the encoded signature (DER + sighash byte) of this tx for this specific tx input
302302 */
303303 def signInput (tx : Transaction , inputIndex : Int , previousOutputScript : Seq [ScriptElt ], sighashType : Int , amount : Satoshi , signatureVersion : Int , privateKey : PrivateKey ): ByteVector =
304304 signInput(tx, inputIndex, Script .write(previousOutputScript), sighashType, amount, signatureVersion, privateKey)
@@ -484,6 +484,36 @@ case class Transaction(version: Long, txIn: Seq[TxIn], txOut: Seq[TxOut], lockTi
484484 scala2kmp(this ).hashForSigningTaprootScriptPath(inputIndex, inputs.map(scala2kmp).asJava, sighashType, scala2kmp(tapleaf), annex_opt.map(scala2kmp).orNull)
485485 }
486486
487+ /**
488+ * sign a tx input
489+ *
490+ * @param inputIndex index of the tx input that is being processed
491+ * @param previousOutputScript public key script of the output claimed by this tx input
492+ * @param sighashType signature hash type, which will be appended to the signature
493+ * @param amount amount of the output claimed by this tx input
494+ * @param signatureVersion signature version (1: segwit, 0: pre-segwit)
495+ * @param privateKey private key
496+ * @return the encoded signature of this tx for this specific tx input in compact 64 bytes format
497+ */
498+ def signInputCompact (inputIndex : Int , previousOutputScript : ByteVector , sighashType : Int , amount : Satoshi , signatureVersion : Int , privateKey : PrivateKey ): ByteVector64 = {
499+ scala2kmp(this ).signInputCompact(inputIndex, scala2kmp(previousOutputScript), sighashType, amount, signatureVersion, privateKey.priv)
500+ }
501+
502+ /**
503+ * sign a tx input
504+ *
505+ * @param inputIndex index of the tx input that is being processed
506+ * @param previousOutputScript public key script of the output claimed by this tx input
507+ * @param sighashType signature hash type, which will be appended to the signature
508+ * @param amount amount of the output claimed by this tx input
509+ * @param signatureVersion signature version (1: segwit, 0: pre-segwit)
510+ * @param privateKey private key
511+ * @return the encoded signature of this tx for this specific tx input in compact 64 bytes format
512+ */
513+ def signInputCompact (inputIndex : Int , previousOutputScript : Seq [ScriptElt ], sighashType : Int , amount : Satoshi , signatureVersion : Int , privateKey : PrivateKey ): ByteVector64 =
514+ signInputCompact(inputIndex, Script .write(previousOutputScript), sighashType, amount, signatureVersion, privateKey)
515+
516+
487517 /**
488518 * sign a tx input
489519 *
0 commit comments