From 59c5816c43153783268fe0e2614455af719c6500 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sun, 16 Feb 2025 01:26:11 -0700 Subject: [PATCH 1/2] fix: allow user-defined sequence and null sighashtype --- dashtx.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dashtx.js b/dashtx.js index 2650f9a..af6691c 100644 --- a/dashtx.js +++ b/dashtx.js @@ -1271,7 +1271,7 @@ var DashTx = ("object" === typeof module && exports) || {}; tx.push(rawScript); } - let sequence = "ffffffff"; + let sequence = input.sequence ?? "ffffffff"; tx.push(sequence); return tx; @@ -2086,6 +2086,7 @@ if ("object" === typeof module) { * @prop {String} [script] - the previous lock script (default: derived from public key as p2pkh) * @prop {String} publicKey - hex-encoded public key (typically starts with a 0x02 or 0x03 prefix) * @prop {String} [pubKeyHash] - the 20-byte pubKeyHash (address without magic byte or checksum) + * @prop {String} [sequence] - the 4-byte sequence (typically ffffffff) * @prop {Uint32} sigHashType - typically 0x81 (SIGHASH_ALL|SIGHASH_ANYONECANPAY) */ @@ -2100,6 +2101,7 @@ if ("object" === typeof module) { * @prop {String} [script] - the previous lock script (default: derived from public key as p2pkh) * @prop {String} [publicKey] - hex-encoded public key (typically starts with a 0x02 or 0x03 prefix) * @prop {String} [pubKeyHash] - the 20-byte pubKeyHash (address without magic byte or checksum) + * @prop {String} [sequence] - the 4-byte sequence (typically ffffffff) * @prop {Uint32} sigHashType - typically 0x81 (SIGHASH_ALL|SIGHASH_ANYONECANPAY) */ @@ -2110,6 +2112,7 @@ if ("object" === typeof module) { * @prop {String} [txId] - deprecated * @prop {String} txid - hex (not pre-reversed) * @prop {Uint32} outputIndex - index in previous tx's output (vout index) + * @prop {String} [sequence] - the 4-byte sequence (typically ffffffff) */ /** @@ -2134,7 +2137,7 @@ if ("object" === typeof module) { */ /** - * @typedef {Pick} TxInputSigned + * @typedef {Pick} TxInputSigned */ /** @@ -2355,7 +2358,7 @@ if ("object" === typeof module) { * @param {Uint32} [txInfo.locktime] * @param {Hex?} [txInfo.extraPayload] - extra payload * @param {Boolean} [txInfo._debug] - bespoke debug output - * @param {Uint32} [sigHashType] + * @param {Uint32?} [sigHashType] */ /** @@ -2368,7 +2371,7 @@ if ("object" === typeof module) { * @param {Array} txInfo.outputs * @param {Hex?} [txInfo.extraPayload] - extra payload * @param {Boolean} [txInfo._debug] - bespoke debug output - * @param {Uint32} sigHashType + * @param {Uint32?} sigHashType */ /** From 545126d8ea2fe1e044a6905deb5c1ae6a7928178 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sun, 16 Feb 2025 01:34:15 -0700 Subject: [PATCH 2/2] chore(release): bump to v0.20.3 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 52c7576..0ebc435 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "dashtx", - "version": "0.20.2", + "version": "0.20.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "dashtx", - "version": "0.20.2", + "version": "0.20.3", "license": "SEE LICENSE IN LICENSE", "bin": { "dashtx-inspect": "bin/inspect.js" diff --git a/package.json b/package.json index b601278..152e452 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dashtx", - "version": "0.20.2", + "version": "0.20.3", "description": "Create DASH Transactions with Vanilla JS (0 deps, cross-platform)", "main": "dashtx.js", "module": "dashtx.mjs",