New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ledgerhq/hw-app-btc

Package Overview
Dependencies
Maintainers
7
Versions
440
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ledgerhq/hw-app-btc - npm Package Compare versions

Comparing version

to
4.12.0-beta.7be0b960

23

flow-typed/npm/@ledgerhq/hw-transport_vx.x.x.js

@@ -1,2 +0,2 @@

// flow-typed signature: de76e43b7f594cd142bb9865fb4eb16a
// flow-typed signature: f6daf2211427d50e92ed6170713459e9
// flow-typed version: <<STUB>>/@ledgerhq/hw-transport_v^4.7.3/flow_v0.68.0

@@ -25,14 +25,2 @@

*/
declare module '@ledgerhq/hw-transport/flow-typed/npm/events_vx.x.x' {
declare module.exports: any;
}
declare module '@ledgerhq/hw-transport/flow-typed/npm/flow-bin_v0.x.x' {
declare module.exports: any;
}
declare module '@ledgerhq/hw-transport/flow-typed/npm/flow-typed_vx.x.x' {
declare module.exports: any;
}
declare module '@ledgerhq/hw-transport/src/Transport' {

@@ -43,13 +31,4 @@ declare module.exports: any;

// Filename aliases
declare module '@ledgerhq/hw-transport/flow-typed/npm/events_vx.x.x.js' {
declare module.exports: $Exports<'@ledgerhq/hw-transport/flow-typed/npm/events_vx.x.x'>;
}
declare module '@ledgerhq/hw-transport/flow-typed/npm/flow-bin_v0.x.x.js' {
declare module.exports: $Exports<'@ledgerhq/hw-transport/flow-typed/npm/flow-bin_v0.x.x'>;
}
declare module '@ledgerhq/hw-transport/flow-typed/npm/flow-typed_vx.x.x.js' {
declare module.exports: $Exports<'@ledgerhq/hw-transport/flow-typed/npm/flow-typed_vx.x.x'>;
}
declare module '@ledgerhq/hw-transport/src/Transport.js' {
declare module.exports: $Exports<'@ledgerhq/hw-transport/src/Transport'>;
}

31

lib/Btc.js

@@ -281,5 +281,5 @@ "use strict";

value: function startUntrustedHashTransactionInputRaw(newTransaction, firstRound, transactionData) {
var segwit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
var bip143 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
return this.transport.send(0xe0, 0x44, firstRound ? 0x00 : 0x80, newTransaction ? segwit ? 0x02 : 0x00 : 0x80, transactionData);
return this.transport.send(0xe0, 0x44, firstRound ? 0x00 : 0x80, newTransaction ? bip143 ? 0x02 : 0x00 : 0x80, transactionData);
}

@@ -291,6 +291,6 @@ }, {

var segwit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
var bip143 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
var data = Buffer.concat([transaction.version, transaction.timestamp || Buffer.alloc(0), this.createVarint(transaction.inputs.length)]);
return this.startUntrustedHashTransactionInputRaw(newTransaction, true, data, segwit).then(function () {
return this.startUntrustedHashTransactionInputRaw(newTransaction, true, data, bip143).then(function () {
var i = 0;

@@ -300,3 +300,3 @@ return (0, _utils.eachSeries)(transaction.inputs, function (input) {

if (inputs[i].trustedInput) {
if (segwit) {
if (bip143) {
prefix = Buffer.from([0x02]);

@@ -310,3 +310,3 @@ } else {

data = Buffer.concat([prefix, inputs[i].value, _this2.createVarint(input.script.length)]);
return _this2.startUntrustedHashTransactionInputRaw(newTransaction, false, data, segwit).then(function () {
return _this2.startUntrustedHashTransactionInputRaw(newTransaction, false, data, bip143).then(function () {
var scriptBlocks = [];

@@ -328,3 +328,3 @@ var offset = 0;

return (0, _utils.eachSeries)(scriptBlocks, function (scriptBlock) {
return _this2.startUntrustedHashTransactionInputRaw(newTransaction, false, scriptBlock, segwit);
return _this2.startUntrustedHashTransactionInputRaw(newTransaction, false, scriptBlock, bip143);
}).then(function () {

@@ -466,2 +466,3 @@ i++;

* @param initialTimestamp is the timestamp when the function is called, not the one that the tx will include
* @param additionals list of additionnal options ("abc" for bch, "gold" for btg, "bipxxx" for using BIPxxx)
* @return the signed transaction ready to be broadcast

@@ -482,10 +483,12 @@ * @example

var sigHashType = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : SIGHASH_ALL;
var segwit = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
var _this5 = this;
var segwit = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
var initialTimestamp = arguments[7];
var additionals = arguments[8];
var hasTimestamp = initialTimestamp !== undefined;
var startTime = Date.now();
var useBip143 = segwit || !!additionals && (additionals.includes("abc") || additionals.includes("gold"));
// Inputs are provided as arrays of [transaction, output_index, optional redeem script, optional sequence]

@@ -508,3 +511,3 @@ // associatedKeysets are provided as arrays of [path]

};
var getTrustedInputCall = segwit ? this.getTrustedInputBIP143.bind(this) : this.getTrustedInput.bind(this);
var getTrustedInputCall = useBip143 ? this.getTrustedInputBIP143.bind(this) : this.getTrustedInput.bind(this);
var outputScript = Buffer.from(outputScriptHex, "hex");

@@ -560,7 +563,8 @@

}).then(function () {
return (0, _utils.doIf)(segwit, function () {
return (0, _utils.doIf)(useBip143, function () {
return (
// Do the first run with all inputs
_this5.startUntrustedHashTransactionInput(true, targetTransaction, trustedInputs, segwit).then(function () {
_this5.startUntrustedHashTransactionInput(true, targetTransaction, trustedInputs, useBip143).then(function () {
return (0, _utils.doIf)(!resuming && typeof changePath != "undefined", function () {
// $FlowFixMe
return _this5.provideOutputFullChangePath(changePath);

@@ -585,5 +589,6 @@ }).then(function () {

}
return _this5.startUntrustedHashTransactionInput(!segwit && firstRun, pseudoTX, pseudoTrustedInputs, segwit).then(function () {
return (0, _utils.doIf)(!segwit, function () {
return _this5.startUntrustedHashTransactionInput(!useBip143 && firstRun, pseudoTX, pseudoTrustedInputs, useBip143).then(function () {
return (0, _utils.doIf)(!segwit && !!additionals && (additionals.includes("abc") || additionals.includes("gold")), function () {
return (0, _utils.doIf)(!resuming && typeof changePath != "undefined", function () {
// $FlowFixMe
return _this5.provideOutputFullChangePath(changePath);

@@ -590,0 +595,0 @@ }).then(function () {

{
"name": "@ledgerhq/hw-app-btc",
"version": "4.11.1",
"version": "4.12.0-beta.7be0b960",
"description": "Ledger Hardware Wallet Bitcoin Application API",

@@ -28,3 +28,3 @@ "keywords": [

"dependencies": {
"@ledgerhq/hw-transport": "^4.7.3",
"@ledgerhq/hw-transport": "^4.12.0-beta.7be0b960",
"create-hash": "^1.1.3"

@@ -31,0 +31,0 @@ },

@@ -257,3 +257,3 @@ //@flow

transactionData: Buffer,
segwit?: boolean = false
bip143?: boolean = false
) {

@@ -264,3 +264,3 @@ return this.transport.send(

firstRound ? 0x00 : 0x80,
newTransaction ? (segwit ? 0x02 : 0x00) : 0x80,
newTransaction ? (bip143 ? 0x02 : 0x00) : 0x80,
transactionData

@@ -274,3 +274,3 @@ );

inputs: Array<{ trustedInput: boolean, value: Buffer }>,
segwit?: boolean = false
bip143?: boolean = false
) {

@@ -286,3 +286,3 @@ let data = Buffer.concat([

data,
segwit
bip143
).then(() => {

@@ -293,3 +293,3 @@ let i = 0;

if (inputs[i].trustedInput) {
if (segwit) {
if (bip143) {
prefix = Buffer.from([0x02]);

@@ -311,3 +311,3 @@ } else {

data,
segwit
bip143
).then(() => {

@@ -344,3 +344,3 @@ let scriptBlocks = [];

scriptBlock,
segwit
bip143
);

@@ -491,2 +491,3 @@ }).then(() => {

* @param initialTimestamp is the timestamp when the function is called, not the one that the tx will include
* @param additionals list of additionnal options ("abc" for bch, "gold" for btg, "bipxxx" for using BIPxxx)
* @return the signed transaction ready to be broadcast

@@ -509,6 +510,8 @@ * @example

segwit?: boolean = false,
initialTimestamp?: number
initialTimestamp?: number,
additionals?: Array<string>
) {
const hasTimestamp = initialTimestamp !== undefined;
let startTime = Date.now();
let useBip143 = segwit || (!!additionals && (additionals.includes("abc") || additionals.includes("gold")))
// Inputs are provided as arrays of [transaction, output_index, optional redeem script, optional sequence]

@@ -531,3 +534,3 @@ // associatedKeysets are provided as arrays of [path]

};
const getTrustedInputCall = segwit
const getTrustedInputCall = useBip143
? this.getTrustedInputBIP143.bind(this)

@@ -603,3 +606,3 @@ : this.getTrustedInput.bind(this);

.then(() =>
doIf(segwit, () =>
doIf(useBip143, () =>
// Do the first run with all inputs

@@ -610,5 +613,6 @@ this.startUntrustedHashTransactionInput(

trustedInputs,
segwit
useBip143
).then(() =>
doIf(!resuming && typeof changePath != "undefined", () => {
// $FlowFixMe
return this.provideOutputFullChangePath(changePath);

@@ -640,10 +644,11 @@ }).then(() => this.hashOutputFull(outputScript))

return this.startUntrustedHashTransactionInput(
!segwit && firstRun,
!useBip143 && firstRun,
pseudoTX,
pseudoTrustedInputs,
segwit
useBip143
)
.then(() =>
doIf(!segwit, () =>
doIf(!segwit && (!!additionals && (additionals.includes("abc") || additionals.includes("gold"))), () =>
doIf(!resuming && typeof changePath != "undefined", () => {
// $FlowFixMe
return this.provideOutputFullChangePath(changePath);

@@ -650,0 +655,0 @@ }).then(() => this.hashOutputFull(outputScript))

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet