24
24
* @prop {TxCreateInputRaw } createInputRaw
25
25
* @prop {TxCreateForSig } createForSig
26
26
* @prop {TxCreateInputForSig } createInputForSig
27
+ * @prop {TxCreatePkhScript } createPkhScript
27
28
* @prop {TxCreateSigned } createSigned
28
29
* @prop {TxGetId } getId - only useful for fully signed tx
29
30
* @prop {TxCreateLegacyTx } createLegacyTx
@@ -1122,7 +1123,7 @@ var DashTx = ("object" === typeof module && exports) || {};
1122
1123
`signable input must have either 'pubKeyHash' or 'script'` ,
1123
1124
) ;
1124
1125
}
1125
- lockScript = ` ${ OP_DUP } ${ OP_HASH160 } ${ PKH_SIZE } ${ input . pubKeyHash } ${ OP_EQUALVERIFY } ${ OP_CHECKSIG } ` ;
1126
+ lockScript = Tx . createPkhScript ( input . pubKeyHash ) ;
1126
1127
}
1127
1128
return {
1128
1129
txId : input . txId || input . txid ,
@@ -1134,6 +1135,15 @@ var DashTx = ("object" === typeof module && exports) || {};
1134
1135
} ;
1135
1136
} ;
1136
1137
1138
+ /**
1139
+ * @param {Hex } pubKeyHash
1140
+ * @returns {Hex }
1141
+ */
1142
+ Tx . createPkhScript = function ( pubKeyHash ) {
1143
+ let lockScript = `${ OP_DUP } ${ OP_HASH160 } ${ PKH_SIZE } ${ pubKeyHash } ${ OP_EQUALVERIFY } ${ OP_CHECKSIG } ` ;
1144
+ return lockScript ;
1145
+ } ;
1146
+
1137
1147
Tx . serialize = function (
1138
1148
{
1139
1149
version = CURRENT_VERSION ,
@@ -2195,6 +2205,12 @@ if ("object" === typeof module) {
2195
2205
* @param {Uint32 } inputIndex - create hashable tx for this input
2196
2206
*/
2197
2207
2208
+ /**
2209
+ * @callback TxCreatePkhScript
2210
+ * @param {Hex } pubKeyHash
2211
+ * @returns {Hex } - ${OP_DUP}${OP_HASH160}${PKH_SIZE}${pubKeyHash}${OP_EQUALVERIFY}${OP_CHECKSIG}
2212
+ */
2213
+
2198
2214
/**
2199
2215
* @callback TxCreateRaw
2200
2216
* @param {Object } opts
0 commit comments