@onekeyfe/cross-inpage-provider-core 0.0.7-alpha.3 → 0.0.7

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.
@@ -18,7 +18,7 @@ declare abstract class JsBridgeBase extends EventEmitter {
18
18
  remoteId?: string | number | null;
19
19
  };
20
20
  private config;
21
- private readonly callbacksExpireTimeout;
21
+ protected callbacksExpireTimeout: number;
22
22
  debugLogger: IDebugLogger;
23
23
  private callbacks;
24
24
  private callbackId;
@@ -69,11 +69,14 @@ class JsBridgeBase extends EventEmitter {
69
69
  origin: '',
70
70
  remoteId: '',
71
71
  };
72
+ // TODO increase timeout as hardware sign transaction may take a long time
73
+ // can set timeout for each callback
74
+ this.callbacksExpireTimeout = 10 * 60 * 1000;
72
75
  this.debugLogger = appDebugLogger;
73
76
  this.callbacks = [];
74
77
  this.callbackId = 1;
75
78
  this.config = config;
76
- this.callbacksExpireTimeout = (_a = config.timeout) !== null && _a !== void 0 ? _a : 60 * 1000;
79
+ this.callbacksExpireTimeout = (_a = config.timeout) !== null && _a !== void 0 ? _a : this.callbacksExpireTimeout;
77
80
  this.debugLogger = config.debugLogger || appDebugLogger;
78
81
  this.sendAsString = (_b = config.sendAsString) !== null && _b !== void 0 ? _b : this.sendAsString;
79
82
  if (this.config.receiveHandler) {
@@ -113,6 +116,7 @@ class JsBridgeBase extends EventEmitter {
113
116
  if (payload.error) {
114
117
  const errorInfo = payload.error;
115
118
  payload.error = {
119
+ key: errorInfo.key,
116
120
  code: errorInfo.code,
117
121
  message: errorInfo.message,
118
122
  data: errorInfo.data,
@@ -4,6 +4,7 @@ declare class JsBridgeSimple extends JsBridgeBase {
4
4
  sendAsString: boolean;
5
5
  isInjected: boolean;
6
6
  private remote;
7
+ callbacksExpireTimeout: number;
7
8
  sendPayload(payload: IJsBridgeMessagePayload | string): void;
8
9
  setRemote(remote: JsBridgeBase): void;
9
10
  }
@@ -5,6 +5,7 @@ class JsBridgeSimple extends JsBridgeBase {
5
5
  this.sendAsString = true;
6
6
  this.isInjected = true;
7
7
  this.remote = null;
8
+ this.callbacksExpireTimeout = 0;
8
9
  }
9
10
  sendPayload(payload) {
10
11
  if (!this.remote) {
@@ -76,11 +76,14 @@ class JsBridgeBase extends eventemitter3_1.default {
76
76
  origin: '',
77
77
  remoteId: '',
78
78
  };
79
+ // TODO increase timeout as hardware sign transaction may take a long time
80
+ // can set timeout for each callback
81
+ this.callbacksExpireTimeout = 10 * 60 * 1000;
79
82
  this.debugLogger = loggers_1.appDebugLogger;
80
83
  this.callbacks = [];
81
84
  this.callbackId = 1;
82
85
  this.config = config;
83
- this.callbacksExpireTimeout = (_a = config.timeout) !== null && _a !== void 0 ? _a : 60 * 1000;
86
+ this.callbacksExpireTimeout = (_a = config.timeout) !== null && _a !== void 0 ? _a : this.callbacksExpireTimeout;
84
87
  this.debugLogger = config.debugLogger || loggers_1.appDebugLogger;
85
88
  this.sendAsString = (_b = config.sendAsString) !== null && _b !== void 0 ? _b : this.sendAsString;
86
89
  if (this.config.receiveHandler) {
@@ -120,6 +123,7 @@ class JsBridgeBase extends eventemitter3_1.default {
120
123
  if (payload.error) {
121
124
  const errorInfo = payload.error;
122
125
  payload.error = {
126
+ key: errorInfo.key,
123
127
  code: errorInfo.code,
124
128
  message: errorInfo.message,
125
129
  data: errorInfo.data,
@@ -8,6 +8,7 @@ class JsBridgeSimple extends JsBridgeBase_1.JsBridgeBase {
8
8
  this.sendAsString = true;
9
9
  this.isInjected = true;
10
10
  this.remote = null;
11
+ this.callbacksExpireTimeout = 0;
11
12
  }
12
13
  sendPayload(payload) {
13
14
  if (!this.remote) {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const version = '0.0.7-alpha.3';
3
+ const version = '0.0.7';
4
4
  const versionBuild = '2020-0101-1';
5
5
  exports.default = {
6
6
  version,
@@ -1,4 +1,4 @@
1
- const version = '0.0.7-alpha.3';
1
+ const version = '0.0.7';
2
2
  const versionBuild = '2020-0101-1';
3
3
  export default {
4
4
  version,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/cross-inpage-provider-core",
3
- "version": "0.0.7-alpha.3",
3
+ "version": "0.0.7",
4
4
  "keywords": [
5
5
  "cross-inpage-provider"
6
6
  ],
@@ -29,11 +29,11 @@
29
29
  "build-version-info": "node ./scripts/buildVersionInfo.js"
30
30
  },
31
31
  "dependencies": {
32
- "@onekeyfe/cross-inpage-provider-errors": "^0.0.7-alpha.3",
33
- "@onekeyfe/cross-inpage-provider-types": "^0.0.7-alpha.3",
32
+ "@onekeyfe/cross-inpage-provider-errors": "^0.0.7",
33
+ "@onekeyfe/cross-inpage-provider-types": "^0.0.7",
34
34
  "eventemitter3": "^4.0.7",
35
35
  "lodash": "^4.17.21",
36
36
  "ms": "^2.1.3"
37
37
  },
38
- "gitHead": "ff317617a1d5d8d1bc7f6957dcd6e27117192c64"
38
+ "gitHead": "74dd1645307232196a30750239156432737092a2"
39
39
  }