@ledgerhq/hw-app-eth
Advanced tools
Comparing version 1.0.8 to 1.1.0-beta.4775db4c
@@ -1,3 +0,3 @@ | ||
// flow-typed signature: 292be4275bd775765b32a0a71e7603d3 | ||
// flow-typed version: <<STUB>>/@ledgerhq/hw-transport_v^1.0.5/flow_v0.63.1 | ||
// flow-typed signature: 91b46c276b3d4c3a35e1ca40b7e6e947 | ||
// flow-typed version: <<STUB>>/@ledgerhq/hw-transport_v^1.0.8/flow_v0.63.1 | ||
@@ -25,3 +25,3 @@ /** | ||
*/ | ||
declare module '@ledgerhq/hw-transport/src/Comm' { | ||
declare module '@ledgerhq/hw-transport/src/Transport' { | ||
declare module.exports: any; | ||
@@ -31,4 +31,4 @@ } | ||
// Filename aliases | ||
declare module '@ledgerhq/hw-transport/src/Comm.js' { | ||
declare module.exports: $Exports<'@ledgerhq/hw-transport/src/Comm'>; | ||
declare module '@ledgerhq/hw-transport/src/Transport.js' { | ||
declare module.exports: $Exports<'@ledgerhq/hw-transport/src/Transport'>; | ||
} |
@@ -37,10 +37,10 @@ "use strict"; | ||
* import Eth from "@ledgerhq/hw-app-eth"; | ||
* const eth = new Eth(comm) | ||
* const eth = new Eth(transport) | ||
*/ | ||
var Eth = function () { | ||
function Eth(comm) { | ||
function Eth(transport) { | ||
_classCallCheck(this, Eth); | ||
this.comm = comm; | ||
comm.setScrambleKey("w0w"); | ||
this.transport = transport; | ||
transport.setScrambleKey("w0w"); | ||
} | ||
@@ -73,3 +73,3 @@ | ||
}); | ||
return this.comm.exchange(buffer.toString("hex"), [0x9000]).then(function (responseHex) { | ||
return this.transport.exchange(buffer.toString("hex"), [0x9000]).then(function (responseHex) { | ||
var result = {}; | ||
@@ -131,3 +131,3 @@ var response = new Buffer(responseHex, "hex"); | ||
return (0, _utils.foreach)(apdus, function (apdu) { | ||
return _this.comm.exchange(apdu, [0x9000]).then(function (apduResponse) { | ||
return _this.transport.exchange(apdu, [0x9000]).then(function (apduResponse) { | ||
response = apduResponse; | ||
@@ -156,3 +156,3 @@ }); | ||
buffer[4] = 0x00; | ||
return this.comm.exchange(buffer.toString("hex"), [0x9000]).then(function (responseHex) { | ||
return this.transport.exchange(buffer.toString("hex"), [0x9000]).then(function (responseHex) { | ||
var result = {}; | ||
@@ -217,3 +217,3 @@ var response = Buffer.from(responseHex, "hex"); | ||
return (0, _utils.foreach)(apdus, function (apdu) { | ||
return _this2.comm.exchange(apdu, [0x9000]).then(function (apduResponse) { | ||
return _this2.transport.exchange(apdu, [0x9000]).then(function (apduResponse) { | ||
response = apduResponse; | ||
@@ -220,0 +220,0 @@ }); |
{ | ||
"name": "@ledgerhq/hw-app-eth", | ||
"version": "1.0.8", | ||
"version": "1.1.0-beta.4775db4c", | ||
"description": "Ledger Hardware Wallet Ethereum Application API", | ||
@@ -28,3 +28,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@ledgerhq/hw-transport": "^1.0.8" | ||
"@ledgerhq/hw-transport": "^1.1.0-beta.4775db4c" | ||
}, | ||
@@ -39,4 +39,4 @@ "devDependencies": { | ||
"build": "cd ../.. && export PATH=$(yarn bin):$PATH && cd - && babel --source-maps -d lib src && flow-copy-source -v src lib", | ||
"watch": "cd ../.. && export PATH=$(yarn bin):$PATH && cd - && babel --watch --source-maps -d lib src" | ||
"watch": "cd ../.. && export PATH=$(yarn bin):$PATH && cd - && babel --watch --source-maps -d lib src & flow-copy-source -w -v src lib" | ||
} | ||
} |
@@ -21,3 +21,3 @@ /******************************************************************************** | ||
import { splitPath, foreach } from "./utils"; | ||
import type Comm from "@ledgerhq/hw-transport"; | ||
import type Transport from "@ledgerhq/hw-transport"; | ||
@@ -29,10 +29,10 @@ /** | ||
* import Eth from "@ledgerhq/hw-app-eth"; | ||
* const eth = new Eth(comm) | ||
* const eth = new Eth(transport) | ||
*/ | ||
export default class Eth { | ||
comm: Comm; | ||
transport: Transport<*>; | ||
constructor(comm: Comm) { | ||
this.comm = comm; | ||
comm.setScrambleKey("w0w"); | ||
constructor(transport: Transport<*>) { | ||
this.transport = transport; | ||
transport.setScrambleKey("w0w"); | ||
} | ||
@@ -69,3 +69,3 @@ | ||
}); | ||
return this.comm | ||
return this.transport | ||
.exchange(buffer.toString("hex"), [0x9000]) | ||
@@ -145,3 +145,3 @@ .then(responseHex => { | ||
return foreach(apdus, apdu => | ||
this.comm.exchange(apdu, [0x9000]).then(apduResponse => { | ||
this.transport.exchange(apdu, [0x9000]).then(apduResponse => { | ||
response = apduResponse; | ||
@@ -170,3 +170,3 @@ }) | ||
buffer[4] = 0x00; | ||
return this.comm | ||
return this.transport | ||
.exchange(buffer.toString("hex"), [0x9000]) | ||
@@ -242,3 +242,3 @@ .then(responseHex => { | ||
return foreach(apdus, apdu => | ||
this.comm.exchange(apdu, [0x9000]).then(apduResponse => { | ||
this.transport.exchange(apdu, [0x9000]).then(apduResponse => { | ||
response = apduResponse; | ||
@@ -245,0 +245,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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
69536
1