Skip to content

Commit 9e4d3a1

Browse files
committed
chore: minor fix for type hint / check
1 parent 1f153ac commit 9e4d3a1

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

dashtx.js

+13-11
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
/**
5757
* @callback TxCreate
58-
* @param {TxDeps} myUtils
58+
* @param {TxDeps} keyUtils
5959
* @returns {tx}
6060
*/
6161

@@ -230,10 +230,10 @@ var DashTx = ("object" === typeof module && exports) || {};
230230
return sats;
231231
};
232232

233-
Tx.create = function (myUtils) {
233+
Tx.create = function (_keyUtils) {
234234
let txInst = {};
235235

236-
txInst._utils = Object.assign({}, Tx.utils, myUtils);
236+
txInst._utils = Object.assign({}, Tx.utils, _keyUtils);
237237

238238
/** @type {TxHashAndSignAll} */
239239
txInst.hashAndSignAll = async function (txInfo, keys) {
@@ -746,11 +746,11 @@ var DashTx = ("object" === typeof module && exports) || {};
746746
};
747747

748748
/**
749-
* @param {TxDeps} myUtils
749+
* @param {TxDeps} keyUtils
750750
* @param {Array<TxPrivateKey>} keys
751751
*/
752-
Tx._createKeyUtils = function (myUtils, keys) {
753-
let _getPublicKey = myUtils.getPublicKey || getPublicKey;
752+
Tx._createKeyUtils = function (keyUtils, keys) {
753+
let _getPublicKey = keyUtils.getPublicKey || getPublicKey;
754754
let _utils = {
755755
/** @type {TxGetPrivateKey} */
756756
getPrivateKey: async function (_, i) {
@@ -759,16 +759,16 @@ var DashTx = ("object" === typeof module && exports) || {};
759759
},
760760
/** @type {TxGetPublicKey} */
761761
getPublicKey: _getPublicKey,
762-
sign: myUtils.sign,
762+
sign: keyUtils.sign,
763763
};
764764

765765
/** @type {TxGetPublicKey} */
766766
async function getPublicKey(txInput, i, txInputs) {
767767
let privKey = keys[i];
768-
if (!myUtils.toPublicKey) {
768+
if (!keyUtils.toPublicKey) {
769769
throw new Error("type assert: missing 'toPublicKey'");
770770
}
771-
let pubKey = myUtils.toPublicKey(privKey);
771+
let pubKey = keyUtils.toPublicKey(privKey);
772772
if ("string" === typeof pubKey) {
773773
console.warn(
774774
"oops, you gave a publicKey as hex (deprecated) rather than a buffer",
@@ -778,7 +778,7 @@ var DashTx = ("object" === typeof module && exports) || {};
778778
return pubKey;
779779
}
780780

781-
return Object.assign(_utils, myUtils);
781+
return Object.assign(_utils, keyUtils);
782782
};
783783

784784
/**
@@ -903,7 +903,7 @@ var DashTx = ("object" === typeof module && exports) || {};
903903
* TODO _param {Array<TxOutput>} txInfo.outputs
904904
* TODO _param {Uint32} [txInfo.version]
905905
* TODO _param {Boolean} [txInfo._debug] - bespoke debug output
906-
* @param {TxDeps} myUtils
906+
* @param {TxDeps} keyUtils
907907
* @returns {Promise<TxInfoSigned>}
908908
*/
909909
Tx._hashAndSignAll = async function (txInfo, keyUtils) {
@@ -937,6 +937,8 @@ var DashTx = ("object" === typeof module && exports) || {};
937937
inputs: [],
938938
outputs: txInfo.outputs,
939939
version: txInfo.version || CURRENT_VERSION,
940+
locktime: txInfo.locktime || 0x00,
941+
transaction: "",
940942
};
941943

942944
// temp shim

0 commit comments

Comments
 (0)