@ledgerhq/hw-app-btc
Advanced tools
Comparing version 3.0.2 to 3.0.8
@@ -451,3 +451,3 @@ "use strict"; | ||
* @param segwit is a boolean indicating wether to use segwit or not | ||
* @param initialTimestamp is the timestamp in ms when the function is called, not the one that the tx will include | ||
* @param initialTimestamp is the timestamp when the function is called, not the one that the tx will include | ||
* @return the signed transaction ready to be broadcast | ||
@@ -490,11 +490,7 @@ * @example | ||
inputs: [], | ||
version: defaultVersion | ||
version: defaultVersion, | ||
timestamp: Buffer.alloc(0) | ||
}; | ||
var getTrustedInputCall = segwit ? this.getTrustedInputBIP143.bind(this) : this.getTrustedInput.bind(this); | ||
var outputScript = Buffer.from(outputScriptHex, "hex"); | ||
var timestamp = Buffer.alloc(0); | ||
if (hasTimestamp) { | ||
timestamp = Buffer.alloc(4); | ||
timestamp.writeUInt32LE(Math.floor((initialTimestamp + (Date.now() - startTime)) / 1000), 0); | ||
} | ||
@@ -541,2 +537,7 @@ return (0, _utils.foreach)(inputs, function (input) { | ||
}).then(function () { | ||
if (hasTimestamp) { | ||
targetTransaction.timestamp = Buffer.alloc(4); | ||
targetTransaction.timestamp.writeUInt32LE(Math.floor(initialTimestamp + (Date.now() - startTime) / 1000), 0); | ||
} | ||
}).then(function () { | ||
return (0, _utils.doIf)(segwit, function () { | ||
@@ -582,2 +583,3 @@ return ( | ||
if (segwit) { | ||
targetTransaction.witness = Buffer.alloc(0); | ||
targetTransaction.inputs[_i].script = Buffer.concat([Buffer.from("160014", "hex"), _this5.hashPublicKey(publicKeys[_i])]); | ||
@@ -594,3 +596,2 @@ } else { | ||
} | ||
targetTransaction.witness = Buffer.alloc(0); | ||
@@ -600,3 +601,3 @@ var lockTimeBuffer = Buffer.alloc(4); | ||
var result = Buffer.concat([_this5.serializeTransaction(targetTransaction, false, timestamp), outputScript]); | ||
var result = Buffer.concat([_this5.serializeTransaction(targetTransaction, false, targetTransaction.timestamp), outputScript]); | ||
@@ -603,0 +604,0 @@ if (segwit) { |
{ | ||
"name": "@ledgerhq/hw-app-btc", | ||
"version": "3.0.2", | ||
"version": "3.0.8", | ||
"description": "Ledger Hardware Wallet Bitcoin Application API", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -464,3 +464,3 @@ //@flow | ||
* @param segwit is a boolean indicating wether to use segwit or not | ||
* @param initialTimestamp is the timestamp in ms when the function is called, not the one that the tx will include | ||
* @param initialTimestamp is the timestamp when the function is called, not the one that the tx will include | ||
* @return the signed transaction ready to be broadcast | ||
@@ -501,3 +501,4 @@ * @example | ||
inputs: [], | ||
version: defaultVersion | ||
version: defaultVersion, | ||
timestamp: Buffer.alloc(0) | ||
}; | ||
@@ -508,10 +509,2 @@ const getTrustedInputCall = segwit | ||
const outputScript = Buffer.from(outputScriptHex, "hex"); | ||
let timestamp = Buffer.alloc(0); | ||
if (hasTimestamp) { | ||
timestamp = Buffer.alloc(4); | ||
timestamp.writeUInt32LE( | ||
Math.floor((initialTimestamp + (Date.now() - startTime)) / 1000), | ||
0 | ||
); | ||
} | ||
@@ -567,2 +560,11 @@ return foreach(inputs, input => { | ||
) | ||
.then(() => { | ||
if (hasTimestamp) { | ||
targetTransaction.timestamp = Buffer.alloc(4); | ||
targetTransaction.timestamp.writeUInt32LE( | ||
Math.floor(initialTimestamp + (Date.now() - startTime) / 1000), | ||
0 | ||
); | ||
} | ||
}) | ||
.then(() => | ||
@@ -625,2 +627,3 @@ doIf(segwit, () => | ||
if (segwit) { | ||
targetTransaction.witness = Buffer.alloc(0); | ||
targetTransaction.inputs[i].script = Buffer.concat([ | ||
@@ -648,3 +651,2 @@ Buffer.from("160014", "hex"), | ||
} | ||
targetTransaction.witness = Buffer.alloc(0); | ||
@@ -655,3 +657,7 @@ const lockTimeBuffer = Buffer.alloc(4); | ||
var result = Buffer.concat([ | ||
this.serializeTransaction(targetTransaction, false, timestamp), | ||
this.serializeTransaction( | ||
targetTransaction, | ||
false, | ||
targetTransaction.timestamp | ||
), | ||
outputScript | ||
@@ -658,0 +664,0 @@ ]); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
192889
2248