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
@@ -1115,7 +1116,7 @@ var DashTx = ("object" === typeof module && exports) || {};
1115
1116
`signable input must have either 'pubKeyHash' or 'script'` ,
1116
1117
) ;
1117
1118
}
1118
- lockScript = ` ${ OP_DUP } ${ OP_HASH160 } ${ PKH_SIZE } ${ input . pubKeyHash } ${ OP_EQUALVERIFY } ${ OP_CHECKSIG } ` ;
1119
+ lockScript = Tx . createPkhScript ( input . pubKeyHash ) ;
1119
1120
}
1120
1121
return {
1121
1122
txId : input . txId || input . txid ,
@@ -1127,6 +1128,15 @@ var DashTx = ("object" === typeof module && exports) || {};
1127
1128
} ;
1128
1129
} ;
1129
1130
1131
+ /**
1132
+ * @param {Hex } pubKeyHash
1133
+ * @returns {Hex }
1134
+ */
1135
+ Tx . createPkhScript = function ( pubKeyHash ) {
1136
+ let lockScript = `${ OP_DUP } ${ OP_HASH160 } ${ PKH_SIZE } ${ pubKeyHash } ${ OP_EQUALVERIFY } ${ OP_CHECKSIG } ` ;
1137
+ return lockScript ;
1138
+ } ;
1139
+
1130
1140
Tx . serialize = function (
1131
1141
{
1132
1142
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