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
@@ -1114,7 +1115,7 @@ var DashTx = ("object" === typeof module && exports) || {};
1114
1115
`signable input must have either 'pubKeyHash' or 'script'` ,
1115
1116
) ;
1116
1117
}
1117
- lockScript = ` ${ OP_DUP } ${ OP_HASH160 } ${ PKH_SIZE } ${ input . pubKeyHash } ${ OP_EQUALVERIFY } ${ OP_CHECKSIG } ` ;
1118
+ lockScript = Tx . createPkhScript ( input . pubKeyHash ) ;
1118
1119
}
1119
1120
return {
1120
1121
txId : input . txId || input . txid ,
@@ -1126,6 +1127,15 @@ var DashTx = ("object" === typeof module && exports) || {};
1126
1127
} ;
1127
1128
} ;
1128
1129
1130
+ /**
1131
+ * @param {Hex } pubKeyHash
1132
+ * @returns {Hex }
1133
+ */
1134
+ Tx . createPkhScript = function ( pubKeyHash ) {
1135
+ let lockScript = `${ OP_DUP } ${ OP_HASH160 } ${ PKH_SIZE } ${ pubKeyHash } ${ OP_EQUALVERIFY } ${ OP_CHECKSIG } ` ;
1136
+ return lockScript ;
1137
+ } ;
1138
+
1129
1139
Tx . serialize = function (
1130
1140
{
1131
1141
version = CURRENT_VERSION ,
@@ -2187,6 +2197,12 @@ if ("object" === typeof module) {
2187
2197
* @param {Uint32 } inputIndex - create hashable tx for this input
2188
2198
*/
2189
2199
2200
+ /**
2201
+ * @callback TxCreatePkhScript
2202
+ * @param {Hex } pubKeyHash
2203
+ * @returns {Hex } - ${OP_DUP}${OP_HASH160}${PKH_SIZE}${pubKeyHash}${OP_EQUALVERIFY}${OP_CHECKSIG}
2204
+ */
2205
+
2190
2206
/**
2191
2207
* @callback TxCreateRaw
2192
2208
* @param {Object } opts
0 commit comments