@ledgerhq/wallet-api-simulator 1.0.5 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,wBAAgB,YAAY,CAC1B,cAAc,EAAE,eAAe,EAC/B,OAAO,EAAE,gBAAgB,QAe1B"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,wBAAgB,YAAY,CAC1B,cAAc,EAAE,eAAe,EAC/B,OAAO,EAAE,gBAAgB,QAM1B"}
package/lib/helpers.js CHANGED
@@ -5,14 +5,7 @@ function applyProfile(serverInstance, profile) {
5
5
  serverInstance.setAccounts(profile.accounts);
6
6
  serverInstance.setCurrencies(profile.currencies);
7
7
  serverInstance.setPermissions(profile.permissions);
8
- const methodIds = Object.keys(profile.methods);
9
- methodIds.forEach((methodId) => {
10
- const key = methodId;
11
- const handler = profile.methods[key];
12
- if (handler) {
13
- serverInstance.setHandler(key, handler);
14
- }
15
- });
8
+ serverInstance.setHandlers(profile.methods);
16
9
  }
17
10
  exports.applyProfile = applyProfile;
18
11
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";;;AAGA,SAAgB,YAAY,CAC1B,cAA+B,EAC/B,OAAyB;IAEzB,cAAc,CAAC,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7C,cAAc,CAAC,aAAa,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACjD,cAAc,CAAC,cAAc,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAEnD,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAE/C,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QAC7B,MAAM,GAAG,GAAG,QAAwC,CAAC;QACrD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACrC,IAAI,OAAO,EAAE;YACX,cAAc,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;SACzC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAjBD,oCAiBC"}
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";;;AAGA,SAAgB,YAAY,CAC1B,cAA+B,EAC/B,OAAyB;IAEzB,cAAc,CAAC,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7C,cAAc,CAAC,aAAa,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACjD,cAAc,CAAC,cAAc,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACnD,cAAc,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AAC9C,CAAC;AARD,oCAQC"}
@@ -1,4 +1,5 @@
1
1
  import type { Transport } from "@ledgerhq/wallet-api-core";
2
+ import { CustomHandlers } from "@ledgerhq/wallet-api-server";
2
3
  import type { SimulatorProfile } from "./types";
3
- export declare function getSimulatorTransport(profile: SimulatorProfile): Transport;
4
+ export declare function getSimulatorTransport(profile: SimulatorProfile, customHandlers?: CustomHandlers): Transport;
4
5
  //# sourceMappingURL=transport.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAG3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS,CA4B1E"}
1
+ {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EACL,cAAc,EAGf,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,gBAAgB,EACzB,cAAc,CAAC,EAAE,cAAc,GAC9B,SAAS,CAkCX"}
package/lib/transport.js CHANGED
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getSimulatorTransport = void 0;
4
4
  const wallet_api_server_1 = require("@ledgerhq/wallet-api-server");
5
5
  const helpers_1 = require("./helpers");
6
- function getSimulatorTransport(profile) {
6
+ function getSimulatorTransport(profile, customHandlers) {
7
+ // eslint-disable-next-line prefer-const
7
8
  let clientTransport;
8
9
  const serverTransport = {
9
10
  onMessage: undefined,
@@ -23,7 +24,7 @@ function getSimulatorTransport(profile) {
23
24
  }
24
25
  },
25
26
  };
26
- const serverInstance = new wallet_api_server_1.WalletAPIServer(serverTransport, profile.config);
27
+ const serverInstance = new wallet_api_server_1.WalletAPIServer(serverTransport, profile.config, wallet_api_server_1.defaultLogger, customHandlers);
27
28
  (0, helpers_1.applyProfile)(serverInstance, profile);
28
29
  return clientTransport;
29
30
  }
@@ -1 +1 @@
1
- {"version":3,"file":"transport.js","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":";;;AACA,mEAA8D;AAC9D,uCAAyC;AAGzC,SAAgB,qBAAqB,CAAC,OAAyB;IAC7D,IAAI,eAAsC,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EAAE,CAAC,OAAO,EAAE,EAAE;YAChB,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;YACtC,IAAI,eAAe,EAAE,SAAS,EAAE;gBAC9B,eAAe,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;aACpC;QACH,CAAC;KACF,CAAC;IAEF,MAAM,cAAc,GAAG,IAAI,mCAAe,CACxC,eAAe,EACf,OAAO,CAAC,MAAM,EACd,iCAAa,EACb,cAAc,CACf,CAAC;IAEF,IAAA,sBAAY,EAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAEtC,OAAO,eAAe,CAAC;AACzB,CAAC;AArCD,sDAqCC"}
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,wBAAgB,YAAY,CAC1B,cAAc,EAAE,eAAe,EAC/B,OAAO,EAAE,gBAAgB,QAe1B"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,wBAAgB,YAAY,CAC1B,cAAc,EAAE,eAAe,EAC/B,OAAO,EAAE,gBAAgB,QAM1B"}
package/lib-es/helpers.js CHANGED
@@ -2,13 +2,6 @@ export function applyProfile(serverInstance, profile) {
2
2
  serverInstance.setAccounts(profile.accounts);
3
3
  serverInstance.setCurrencies(profile.currencies);
4
4
  serverInstance.setPermissions(profile.permissions);
5
- const methodIds = Object.keys(profile.methods);
6
- methodIds.forEach((methodId) => {
7
- const key = methodId;
8
- const handler = profile.methods[key];
9
- if (handler) {
10
- serverInstance.setHandler(key, handler);
11
- }
12
- });
5
+ serverInstance.setHandlers(profile.methods);
13
6
  }
14
7
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,YAAY,CAC1B,cAA+B,EAC/B,OAAyB;IAEzB,cAAc,CAAC,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7C,cAAc,CAAC,aAAa,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACjD,cAAc,CAAC,cAAc,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAEnD,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAE/C,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QAC7B,MAAM,GAAG,GAAG,QAAwC,CAAC;QACrD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACrC,IAAI,OAAO,EAAE;YACX,cAAc,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;SACzC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,YAAY,CAC1B,cAA+B,EAC/B,OAAyB;IAEzB,cAAc,CAAC,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7C,cAAc,CAAC,aAAa,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACjD,cAAc,CAAC,cAAc,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACnD,cAAc,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AAC9C,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import type { Transport } from "@ledgerhq/wallet-api-core";
2
+ import { CustomHandlers } from "@ledgerhq/wallet-api-server";
2
3
  import type { SimulatorProfile } from "./types";
3
- export declare function getSimulatorTransport(profile: SimulatorProfile): Transport;
4
+ export declare function getSimulatorTransport(profile: SimulatorProfile, customHandlers?: CustomHandlers): Transport;
4
5
  //# sourceMappingURL=transport.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAG3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS,CA4B1E"}
1
+ {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EACL,cAAc,EAGf,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,gBAAgB,EACzB,cAAc,CAAC,EAAE,cAAc,GAC9B,SAAS,CAkCX"}
@@ -1,6 +1,7 @@
1
- import { WalletAPIServer } from "@ledgerhq/wallet-api-server";
1
+ import { WalletAPIServer, defaultLogger, } from "@ledgerhq/wallet-api-server";
2
2
  import { applyProfile } from "./helpers";
3
- export function getSimulatorTransport(profile) {
3
+ export function getSimulatorTransport(profile, customHandlers) {
4
+ // eslint-disable-next-line prefer-const
4
5
  let clientTransport;
5
6
  const serverTransport = {
6
7
  onMessage: undefined,
@@ -20,7 +21,7 @@ export function getSimulatorTransport(profile) {
20
21
  }
21
22
  },
22
23
  };
23
- const serverInstance = new WalletAPIServer(serverTransport, profile.config);
24
+ const serverInstance = new WalletAPIServer(serverTransport, profile.config, defaultLogger, customHandlers);
24
25
  applyProfile(serverInstance, profile);
25
26
  return clientTransport;
26
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"transport.js","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGzC,MAAM,UAAU,qBAAqB,CAAC,OAAyB;IAC7D,IAAI,eAAsC,CAAC;IAE3C,MAAM,eAAe,GAAc;QACjC,SAAS,EAAE,SAAS;QACpB,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE;YAChB,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;YACtC,IAAI,eAAe,EAAE,SAAS,EAAE;gBAC9B,eAAe,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;aACpC;QACH,CAAC;KACF,CAAC;IAEF,eAAe,GAAG;QAChB,SAAS,EAAE,SAAS;QACpB,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE;YAChB,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;YACtC,IAAI,eAAe,EAAE,SAAS,EAAE;gBAC9B,eAAe,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;aACpC;QACH,CAAC;KACF,CAAC;IAEF,MAAM,cAAc,GAAG,IAAI,eAAe,CAAC,eAAe,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAE5E,YAAY,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAEtC,OAAO,eAAe,CAAC;AACzB,CAAC"}
1
+ {"version":3,"file":"transport.js","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,eAAe,EACf,aAAa,GACd,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGzC,MAAM,UAAU,qBAAqB,CACnC,OAAyB,EACzB,cAA+B;IAE/B,wCAAwC;IACxC,IAAI,eAAsC,CAAC;IAE3C,MAAM,eAAe,GAAc;QACjC,SAAS,EAAE,SAAS;QACpB,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE;YAChB,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;YACtC,IAAI,eAAe,EAAE,SAAS,EAAE;gBAC9B,eAAe,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;aACpC;QACH,CAAC;KACF,CAAC;IAEF,eAAe,GAAG;QAChB,SAAS,EAAE,SAAS;QACpB,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE;YAChB,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;YACtC,IAAI,eAAe,EAAE,SAAS,EAAE;gBAC9B,eAAe,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;aACpC;QACH,CAAC;KACF,CAAC;IAEF,MAAM,cAAc,GAAG,IAAI,eAAe,CACxC,eAAe,EACf,OAAO,CAAC,MAAM,EACd,aAAa,EACb,cAAc,CACf,CAAC;IAEF,YAAY,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAEtC,OAAO,eAAe,CAAC;AACzB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/wallet-api-simulator",
3
- "version": "1.0.5",
3
+ "version": "1.1.0",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-es/index.js",
@@ -27,9 +27,9 @@
27
27
  "@ledgerhq/hw-transport-http": "^6.28.3",
28
28
  "rxjs": "^7.8.1",
29
29
  "ws": "^8.13.0",
30
- "@ledgerhq/wallet-api-client": "1.1.0",
31
- "@ledgerhq/wallet-api-core": "1.2.0",
32
- "@ledgerhq/wallet-api-server": "1.2.0"
30
+ "@ledgerhq/wallet-api-client": "1.2.0",
31
+ "@ledgerhq/wallet-api-core": "1.3.0",
32
+ "@ledgerhq/wallet-api-server": "1.3.0"
33
33
  },
34
34
  "scripts": {
35
35
  "format:check": "prettier --check \"src\"",