@ledgerhq/hw-transport-http
Advanced tools
Comparing version 1.2.0-beta.ffc162fd to 2.0.0
@@ -53,3 +53,3 @@ "use strict"; | ||
exchange(apduHex, statusList) { | ||
exchange(apdu) { | ||
var _this = this; | ||
@@ -64,3 +64,3 @@ | ||
}, | ||
body: JSON.stringify({ apduHex, statusList }) | ||
body: JSON.stringify({ apduHex: apdu.toString("hex") }) | ||
}); | ||
@@ -86,5 +86,5 @@ if (response.status !== 200) { | ||
HttpTransport.discover = _observer => ({ | ||
HttpTransport.listen = _observer => ({ | ||
unsubscribe: () => {} | ||
}); | ||
//# sourceMappingURL=HttpTransport.js.map |
@@ -14,3 +14,3 @@ "use strict"; | ||
exports.default = url => { | ||
if (!url) return _HttpTransport2.default; // by default, HttpTransport don't yield anything in list/discover | ||
if (!url) return _HttpTransport2.default; // by default, HttpTransport don't yield anything in list/listen | ||
class StaticHttpTransport extends _HttpTransport2.default {} | ||
@@ -20,3 +20,3 @@ | ||
StaticHttpTransport.discover = observer => { | ||
StaticHttpTransport.listen = observer => { | ||
let unsubscribed = false; | ||
@@ -28,3 +28,3 @@ | ||
if (unsubscribed) return; | ||
observer.next(url); | ||
observer.next({ descriptor: url, type: "add" }); | ||
observer.complete(); | ||
@@ -31,0 +31,0 @@ }, () => { |
{ | ||
"name": "@ledgerhq/hw-transport-http", | ||
"version": "1.2.0-beta.ffc162fd", | ||
"version": "2.0.0", | ||
"description": "Ledger Hardware Wallet communication layer over http", | ||
@@ -28,3 +28,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@ledgerhq/hw-transport": "^1.2.0-beta.ffc162fd" | ||
"@ledgerhq/hw-transport": "^2.0.0" | ||
}, | ||
@@ -31,0 +31,0 @@ "devDependencies": { |
@@ -13,3 +13,3 @@ //@flow | ||
static list = (): * => Promise.resolve([]); | ||
static discover = (_observer: *) => ({ | ||
static listen = (_observer: *) => ({ | ||
unsubscribe: () => {} | ||
@@ -44,3 +44,3 @@ }); | ||
async exchange(apduHex: string, statusList: Array<number>): Promise<string> { | ||
async exchange(apdu: Buffer): Promise<Buffer> { | ||
const response = await fetch(this.url, { | ||
@@ -52,3 +52,3 @@ method: "POST", | ||
}, | ||
body: JSON.stringify({ apduHex, statusList }) | ||
body: JSON.stringify({ apduHex: apdu.toString("hex") }) | ||
}); | ||
@@ -55,0 +55,0 @@ if (response.status !== 200) { |
import HttpTransport from "./HttpTransport"; | ||
export default (url: ?string) => { | ||
if (!url) return HttpTransport; // by default, HttpTransport don't yield anything in list/discover | ||
if (!url) return HttpTransport; // by default, HttpTransport don't yield anything in list/listen | ||
class StaticHttpTransport extends HttpTransport { | ||
static list = (): * => HttpTransport.open(url).then(() => [url], () => []); | ||
static discover = (observer: *) => { | ||
static listen = (observer: *) => { | ||
let unsubscribed = false; | ||
@@ -14,3 +14,3 @@ | ||
if (unsubscribed) return; | ||
observer.next(url); | ||
observer.next({ descriptor: url, type: "add" }); | ||
observer.complete(); | ||
@@ -17,0 +17,0 @@ }, |
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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
23508
0
+ Added@ledgerhq/hw-transport@2.2.0(transitive)
- Removed@ledgerhq/hw-transport@1.2.0-beta.ffc162fd(transitive)
- Removedinvariant@2.2.4(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedloose-envify@1.4.0(transitive)