@onekeyfe/hd-core 1.1.4-alpha.0 → 1.1.4-alpha.1
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.
- package/dist/api/BaseMethod.d.ts +0 -2
- package/dist/api/BaseMethod.d.ts.map +1 -1
- package/dist/api/allnetwork/AllNetworkGetAddress.d.ts +28 -4
- package/dist/api/allnetwork/AllNetworkGetAddress.d.ts.map +1 -1
- package/dist/api/btc/BTCGetPublicKey.d.ts.map +1 -1
- package/dist/api/cosmos/CosmosGetPublicKey.d.ts +1 -1
- package/dist/api/cosmos/CosmosGetPublicKey.d.ts.map +1 -1
- package/dist/api/device/DeviceUnlock.d.ts +2 -0
- package/dist/api/device/DeviceUnlock.d.ts.map +1 -1
- package/dist/api/evm/EVMGetPublicKey.d.ts +0 -1
- package/dist/api/evm/EVMGetPublicKey.d.ts.map +1 -1
- package/dist/api/index.d.ts +0 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/core/RequestQueue.d.ts +0 -4
- package/dist/core/RequestQueue.d.ts.map +1 -1
- package/dist/core/index.d.ts +2 -3
- package/dist/core/index.d.ts.map +1 -1
- package/dist/device/Device.d.ts +1 -4
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/device/DeviceCommands.d.ts +4 -4
- package/dist/events/call.d.ts +0 -9
- package/dist/events/call.d.ts.map +1 -1
- package/dist/events/core.d.ts +2 -2
- package/dist/events/core.d.ts.map +1 -1
- package/dist/events/iframe.d.ts +1 -11
- package/dist/events/iframe.d.ts.map +1 -1
- package/dist/index.d.ts +12 -40
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +141 -394
- package/dist/inject.d.ts +0 -3
- package/dist/inject.d.ts.map +1 -1
- package/dist/types/api/allNetworkGetAddress.d.ts +2 -9
- package/dist/types/api/allNetworkGetAddress.d.ts.map +1 -1
- package/dist/types/api/evmGetPublicKey.d.ts +0 -1
- package/dist/types/api/evmGetPublicKey.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +1 -2
- package/dist/types/api/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/BaseMethod.ts +0 -3
- package/src/api/allnetwork/AllNetworkGetAddress.ts +407 -14
- package/src/api/btc/BTCGetPublicKey.ts +0 -13
- package/src/api/cosmos/CosmosGetPublicKey.ts +1 -1
- package/src/api/device/DeviceUnlock.ts +48 -1
- package/src/api/evm/EVMGetPublicKey.ts +3 -9
- package/src/api/index.ts +0 -1
- package/src/core/RequestQueue.ts +0 -26
- package/src/core/index.ts +3 -29
- package/src/device/Device.ts +0 -66
- package/src/events/call.ts +0 -10
- package/src/events/core.ts +1 -7
- package/src/events/iframe.ts +1 -12
- package/src/index.ts +1 -2
- package/src/inject.ts +0 -47
- package/src/types/api/allNetworkGetAddress.ts +2 -16
- package/src/types/api/evmGetPublicKey.ts +0 -1
- package/src/types/api/index.ts +1 -2
- package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts +0 -47
- package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts.map +0 -1
- package/dist/api/allnetwork/AllNetworkGetAddressByLoop.d.ts +0 -8
- package/dist/api/allnetwork/AllNetworkGetAddressByLoop.d.ts.map +0 -1
- package/src/api/allnetwork/AllNetworkGetAddressBase.ts +0 -477
- package/src/api/allnetwork/AllNetworkGetAddressByLoop.ts +0 -151
package/dist/index.js
CHANGED
|
@@ -26,82 +26,6 @@ var ByteBuffer__default = /*#__PURE__*/_interopDefaultLegacy(ByteBuffer);
|
|
|
26
26
|
var BigNumber__default = /*#__PURE__*/_interopDefaultLegacy(BigNumber);
|
|
27
27
|
var JSZip__default = /*#__PURE__*/_interopDefaultLegacy(JSZip);
|
|
28
28
|
|
|
29
|
-
/******************************************************************************
|
|
30
|
-
Copyright (c) Microsoft Corporation.
|
|
31
|
-
|
|
32
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
33
|
-
purpose with or without fee is hereby granted.
|
|
34
|
-
|
|
35
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
36
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
37
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
38
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
39
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
40
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
41
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
42
|
-
***************************************************************************** */
|
|
43
|
-
|
|
44
|
-
function __rest(s, e) {
|
|
45
|
-
var t = {};
|
|
46
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
47
|
-
t[p] = s[p];
|
|
48
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
49
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
50
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
51
|
-
t[p[i]] = s[p[i]];
|
|
52
|
-
}
|
|
53
|
-
return t;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
57
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
58
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
59
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
60
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
61
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
62
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function __values(o) {
|
|
67
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
68
|
-
if (m) return m.call(o);
|
|
69
|
-
if (o && typeof o.length === "number") return {
|
|
70
|
-
next: function () {
|
|
71
|
-
if (o && i >= o.length) o = void 0;
|
|
72
|
-
return { value: o && o[i++], done: !o };
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function __asyncValues(o) {
|
|
79
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
80
|
-
var m = o[Symbol.asyncIterator], i;
|
|
81
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
82
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
83
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
87
|
-
var e = new Error(message);
|
|
88
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const callbackManager = new Map();
|
|
92
|
-
const generateCallbackId = () => `callback_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
|
|
93
|
-
const registerCallback = (id, callback) => {
|
|
94
|
-
callbackManager.set(id, callback);
|
|
95
|
-
};
|
|
96
|
-
const executeCallback = (id, ...args) => {
|
|
97
|
-
const callback = callbackManager.get(id);
|
|
98
|
-
if (callback) {
|
|
99
|
-
callback(...args);
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
const cleanupCallback = (id) => {
|
|
103
|
-
callbackManager.delete(id);
|
|
104
|
-
};
|
|
105
29
|
const inject = ({ call, cancel, dispose, eventEmitter, init, updateSettings, switchTransport, uiResponse, }) => {
|
|
106
30
|
const api = Object.assign({ on: (type, fn) => {
|
|
107
31
|
eventEmitter.on(type, fn);
|
|
@@ -153,20 +77,6 @@ const createCoreApi = (call) => ({
|
|
|
153
77
|
getNextU2FCounter: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'getNextU2FCounter' })),
|
|
154
78
|
setU2FCounter: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'setU2FCounter' })),
|
|
155
79
|
allNetworkGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'allNetworkGetAddress' })),
|
|
156
|
-
allNetworkGetAddressByLoop: (connectId, deviceId, params) => {
|
|
157
|
-
const { onLoopItemResponse, onAllItemsResponse } = params, restParams = __rest(params, ["onLoopItemResponse", "onAllItemsResponse"]);
|
|
158
|
-
const callbackId = generateCallbackId();
|
|
159
|
-
registerCallback(callbackId, onLoopItemResponse);
|
|
160
|
-
const callbackIdFinish = generateCallbackId();
|
|
161
|
-
registerCallback(callbackIdFinish, (data) => {
|
|
162
|
-
onAllItemsResponse === null || onAllItemsResponse === void 0 ? void 0 : onAllItemsResponse(data);
|
|
163
|
-
cleanupCallback(callbackIdFinish);
|
|
164
|
-
cleanupCallback(callbackId);
|
|
165
|
-
});
|
|
166
|
-
return call(Object.assign(Object.assign({}, restParams), { connectId,
|
|
167
|
-
deviceId, method: 'allNetworkGetAddressByLoop', callbackId,
|
|
168
|
-
callbackIdFinish }));
|
|
169
|
-
},
|
|
170
80
|
evmGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'evmGetAddress' })),
|
|
171
81
|
evmGetPublicKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'evmGetPublicKey' })),
|
|
172
82
|
evmSignMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'evmSignMessage' })),
|
|
@@ -774,6 +684,68 @@ const topLevelInject = () => {
|
|
|
774
684
|
return api;
|
|
775
685
|
};
|
|
776
686
|
|
|
687
|
+
/******************************************************************************
|
|
688
|
+
Copyright (c) Microsoft Corporation.
|
|
689
|
+
|
|
690
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
691
|
+
purpose with or without fee is hereby granted.
|
|
692
|
+
|
|
693
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
694
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
695
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
696
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
697
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
698
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
699
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
700
|
+
***************************************************************************** */
|
|
701
|
+
|
|
702
|
+
function __rest(s, e) {
|
|
703
|
+
var t = {};
|
|
704
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
705
|
+
t[p] = s[p];
|
|
706
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
707
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
708
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
709
|
+
t[p[i]] = s[p[i]];
|
|
710
|
+
}
|
|
711
|
+
return t;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
715
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
716
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
717
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
718
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
719
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
720
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
function __values(o) {
|
|
725
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
726
|
+
if (m) return m.call(o);
|
|
727
|
+
if (o && typeof o.length === "number") return {
|
|
728
|
+
next: function () {
|
|
729
|
+
if (o && i >= o.length) o = void 0;
|
|
730
|
+
return { value: o && o[i++], done: !o };
|
|
731
|
+
}
|
|
732
|
+
};
|
|
733
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
function __asyncValues(o) {
|
|
737
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
738
|
+
var m = o[Symbol.asyncIterator], i;
|
|
739
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
740
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
741
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
745
|
+
var e = new Error(message);
|
|
746
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
747
|
+
};
|
|
748
|
+
|
|
777
749
|
const LOG_EVENT = 'LOG_EVENT';
|
|
778
750
|
const LOG = {
|
|
779
751
|
OUTPUT: 'log-output',
|
|
@@ -25826,7 +25798,6 @@ const IFRAME = {
|
|
|
25826
25798
|
CALL: 'iframe-call',
|
|
25827
25799
|
CANCEL: 'iframe-cancel',
|
|
25828
25800
|
SWITCH_TRANSPORT: 'iframe-switch-transport',
|
|
25829
|
-
CALLBACK: 'iframe-callback',
|
|
25830
25801
|
};
|
|
25831
25802
|
const createIFrameMessage = (type, payload) => ({
|
|
25832
25803
|
event: UI_EVENT,
|
|
@@ -26720,15 +26691,6 @@ class Device extends events.exports {
|
|
|
26720
26691
|
const env = DataManager.getSettings('env');
|
|
26721
26692
|
if ((this.isUsedHere() && !this.keepSession && this.mainId) ||
|
|
26722
26693
|
(this.mainId && DataManager.isBleConnect(env))) {
|
|
26723
|
-
if (this.pendingCallbackPromise) {
|
|
26724
|
-
try {
|
|
26725
|
-
Log$a.debug('Waiting for callback tasks to complete before releasing device (in release method)');
|
|
26726
|
-
yield this.pendingCallbackPromise.promise;
|
|
26727
|
-
}
|
|
26728
|
-
catch (error) {
|
|
26729
|
-
Log$a.error('Error waiting for callback tasks in release method:', error);
|
|
26730
|
-
}
|
|
26731
|
-
}
|
|
26732
26694
|
if (this.commands) {
|
|
26733
26695
|
this.commands.dispose(false);
|
|
26734
26696
|
if (this.commands.callPromise) {
|
|
@@ -27109,46 +27071,6 @@ class Device extends events.exports {
|
|
|
27109
27071
|
return res.message;
|
|
27110
27072
|
});
|
|
27111
27073
|
}
|
|
27112
|
-
supportUnlockVersionRange() {
|
|
27113
|
-
return {
|
|
27114
|
-
pro: {
|
|
27115
|
-
min: '4.15.0',
|
|
27116
|
-
},
|
|
27117
|
-
};
|
|
27118
|
-
}
|
|
27119
|
-
unlockDevice() {
|
|
27120
|
-
var _a;
|
|
27121
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
27122
|
-
const firmwareVersion = (_a = getDeviceFirmwareVersion(this.features)) === null || _a === void 0 ? void 0 : _a.join('.');
|
|
27123
|
-
const versionRange = getMethodVersionRange(this.features, type => this.supportUnlockVersionRange()[type]);
|
|
27124
|
-
if (versionRange && semver__default["default"].gte(firmwareVersion, versionRange.min)) {
|
|
27125
|
-
const res = yield this.commands.typedCall('UnLockDevice', 'UnLockDeviceResponse');
|
|
27126
|
-
if (this.features) {
|
|
27127
|
-
this.features.unlocked = res.message.unlocked == null ? null : res.message.unlocked;
|
|
27128
|
-
this.features.unlocked_attach_pin =
|
|
27129
|
-
res.message.unlocked_attach_pin == null ? undefined : res.message.unlocked_attach_pin;
|
|
27130
|
-
this.features.passphrase_protection =
|
|
27131
|
-
res.message.passphrase_protection == null ? null : res.message.passphrase_protection;
|
|
27132
|
-
return Promise.resolve(this.features);
|
|
27133
|
-
}
|
|
27134
|
-
const featuresRes = yield this.commands.typedCall('GetFeatures', 'Features');
|
|
27135
|
-
this._updateFeatures(featuresRes.message);
|
|
27136
|
-
return Promise.resolve(featuresRes.message);
|
|
27137
|
-
}
|
|
27138
|
-
const { type } = yield this.commands.typedCall('GetAddress', 'Address', {
|
|
27139
|
-
address_n: [toHardened(44), toHardened(1), toHardened(0), 0, 0],
|
|
27140
|
-
coin_name: 'Testnet',
|
|
27141
|
-
script_type: 'SPENDADDRESS',
|
|
27142
|
-
show_display: false,
|
|
27143
|
-
});
|
|
27144
|
-
if (type === 'CallMethodError') {
|
|
27145
|
-
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'unlock device error');
|
|
27146
|
-
}
|
|
27147
|
-
const res = yield this.commands.typedCall('GetFeatures', 'Features');
|
|
27148
|
-
this._updateFeatures(res.message);
|
|
27149
|
-
return Promise.resolve(res.message);
|
|
27150
|
-
});
|
|
27151
|
-
}
|
|
27152
27074
|
checkPassphraseStateSafety(passphraseState, useEmptyPassphrase, skipPassphraseCheck) {
|
|
27153
27075
|
return __awaiter(this, void 0, void 0, function* () {
|
|
27154
27076
|
if (!this.features)
|
|
@@ -28721,9 +28643,42 @@ class DeviceUnlock extends BaseMethod {
|
|
|
28721
28643
|
init() {
|
|
28722
28644
|
this.useDevicePassphraseState = false;
|
|
28723
28645
|
}
|
|
28646
|
+
supportUnlockVersionRange() {
|
|
28647
|
+
return {
|
|
28648
|
+
pro: {
|
|
28649
|
+
min: '4.15.0',
|
|
28650
|
+
},
|
|
28651
|
+
};
|
|
28652
|
+
}
|
|
28724
28653
|
run() {
|
|
28654
|
+
var _a;
|
|
28725
28655
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28726
|
-
|
|
28656
|
+
const firmwareVersion = (_a = getDeviceFirmwareVersion(this.device.features)) === null || _a === void 0 ? void 0 : _a.join('.');
|
|
28657
|
+
const versionRange = getMethodVersionRange(this.device.features, type => this.supportUnlockVersionRange()[type]);
|
|
28658
|
+
if (versionRange && semver__default["default"].gte(firmwareVersion, versionRange.min)) {
|
|
28659
|
+
const res = yield this.device.commands.typedCall('UnLockDevice', 'UnLockDeviceResponse');
|
|
28660
|
+
if (this.device.features) {
|
|
28661
|
+
this.device.features.unlocked = res.message.unlocked == null ? null : res.message.unlocked;
|
|
28662
|
+
this.device.features.unlocked_attach_pin =
|
|
28663
|
+
res.message.unlocked_attach_pin == null ? undefined : res.message.unlocked_attach_pin;
|
|
28664
|
+
this.device.features.passphrase_protection =
|
|
28665
|
+
res.message.passphrase_protection == null ? null : res.message.passphrase_protection;
|
|
28666
|
+
return Promise.resolve(this.device.features);
|
|
28667
|
+
}
|
|
28668
|
+
const featuresRes = yield this.device.commands.typedCall('GetFeatures', 'Features');
|
|
28669
|
+
return Promise.resolve(featuresRes.message);
|
|
28670
|
+
}
|
|
28671
|
+
const { type } = yield this.device.commands.typedCall('GetAddress', 'Address', {
|
|
28672
|
+
address_n: [toHardened(44), toHardened(1), toHardened(0), 0, 0],
|
|
28673
|
+
coin_name: 'Testnet',
|
|
28674
|
+
script_type: 'SPENDADDRESS',
|
|
28675
|
+
show_display: false,
|
|
28676
|
+
});
|
|
28677
|
+
if (type === 'CallMethodError') {
|
|
28678
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Get the passphrase state error');
|
|
28679
|
+
}
|
|
28680
|
+
const res = yield this.device.commands.typedCall('GetFeatures', 'Features');
|
|
28681
|
+
return Promise.resolve(res.message);
|
|
28727
28682
|
});
|
|
28728
28683
|
}
|
|
28729
28684
|
}
|
|
@@ -30086,17 +30041,12 @@ const networkConfigMap = {
|
|
|
30086
30041
|
methodName: 'neoGetAddress',
|
|
30087
30042
|
},
|
|
30088
30043
|
};
|
|
30089
|
-
class
|
|
30090
|
-
constructor() {
|
|
30091
|
-
super(...arguments);
|
|
30092
|
-
this.abortController = null;
|
|
30093
|
-
}
|
|
30044
|
+
class AllNetworkGetAddress extends BaseMethod {
|
|
30094
30045
|
init() {
|
|
30095
|
-
var _a, _b;
|
|
30096
30046
|
this.checkDeviceId = true;
|
|
30097
30047
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
30098
30048
|
validateParams(this.payload, [{ name: 'bundle', type: 'array' }]);
|
|
30099
|
-
|
|
30049
|
+
this.payload.bundle.forEach((batch) => {
|
|
30100
30050
|
validateParams(batch, [
|
|
30101
30051
|
{ name: 'path', required: true },
|
|
30102
30052
|
{ name: 'network', type: 'string', required: true },
|
|
@@ -30136,24 +30086,6 @@ class AllNetworkGetAddressBase extends BaseMethod {
|
|
|
30136
30086
|
try {
|
|
30137
30087
|
method.init();
|
|
30138
30088
|
(_a = method.setDevice) === null || _a === void 0 ? void 0 : _a.call(method, this.device);
|
|
30139
|
-
method.context = this.context;
|
|
30140
|
-
const onSignalAbort = () => {
|
|
30141
|
-
var _a;
|
|
30142
|
-
console.log('=====>>>>> onSignalAbort');
|
|
30143
|
-
(_a = this.abortController) === null || _a === void 0 ? void 0 : _a.abort(hdShared.HardwareErrorCodeMessage[hdShared.HardwareErrorCode.RepeatUnlocking]);
|
|
30144
|
-
};
|
|
30145
|
-
const _onDeviceButtonHandler = (...[device, request]) => {
|
|
30146
|
-
if (request.code === 'ButtonRequest_PinEntry' ||
|
|
30147
|
-
request.code === 'ButtonRequest_AttachPin') {
|
|
30148
|
-
onSignalAbort();
|
|
30149
|
-
}
|
|
30150
|
-
else {
|
|
30151
|
-
onDeviceButtonHandler(device, request);
|
|
30152
|
-
}
|
|
30153
|
-
};
|
|
30154
|
-
this.device.on(DEVICE.BUTTON, _onDeviceButtonHandler);
|
|
30155
|
-
this.device.on(DEVICE.PIN, onSignalAbort);
|
|
30156
|
-
this.device.on(DEVICE.PASSPHRASE, onSignalAbort);
|
|
30157
30089
|
preCheckDeviceSupport(this.device, method);
|
|
30158
30090
|
const response = yield method.run();
|
|
30159
30091
|
if (!Array.isArray(response) || response.length === 0) {
|
|
@@ -30180,20 +30112,45 @@ class AllNetworkGetAddressBase extends BaseMethod {
|
|
|
30180
30112
|
});
|
|
30181
30113
|
}
|
|
30182
30114
|
run() {
|
|
30115
|
+
var _a, _b;
|
|
30183
30116
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30184
|
-
const
|
|
30185
|
-
|
|
30186
|
-
|
|
30187
|
-
|
|
30188
|
-
|
|
30189
|
-
|
|
30190
|
-
|
|
30191
|
-
|
|
30192
|
-
|
|
30193
|
-
|
|
30117
|
+
const responses = [];
|
|
30118
|
+
const resultMap = {};
|
|
30119
|
+
const { bundle } = this.payload;
|
|
30120
|
+
const methodGroups = bundle
|
|
30121
|
+
.map((param, index) => this.generateMethodName({
|
|
30122
|
+
network: param.network,
|
|
30123
|
+
payload: param,
|
|
30124
|
+
originalIndex: index,
|
|
30125
|
+
}))
|
|
30126
|
+
.reduce((acc, cur) => {
|
|
30127
|
+
if (!acc[cur.methodName]) {
|
|
30128
|
+
acc[cur.methodName] = [];
|
|
30194
30129
|
}
|
|
30195
|
-
|
|
30196
|
-
|
|
30130
|
+
acc[cur.methodName].push(cur);
|
|
30131
|
+
return acc;
|
|
30132
|
+
}, {});
|
|
30133
|
+
let i = 0;
|
|
30134
|
+
for (const [methodName, params] of Object.entries(methodGroups)) {
|
|
30135
|
+
const methodParams = {
|
|
30136
|
+
bundle: params.map(param => (Object.assign({}, param.params))),
|
|
30137
|
+
};
|
|
30138
|
+
const response = yield this.callMethod(methodName, methodParams);
|
|
30139
|
+
for (let i = 0; i < params.length; i++) {
|
|
30140
|
+
const { _originRequestParams, _originalIndex } = params[i];
|
|
30141
|
+
const responseKey = `${_originalIndex}`;
|
|
30142
|
+
resultMap[responseKey] = Object.assign(Object.assign({}, _originRequestParams), response[i]);
|
|
30143
|
+
}
|
|
30144
|
+
if (((_b = (_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle) === null || _b === void 0 ? void 0 : _b.length) > 1) {
|
|
30145
|
+
const progress = Math.round(((i + 1) / this.payload.bundle.length) * 100);
|
|
30146
|
+
this.postMessage(createUiMessage(UI_REQUEST.DEVICE_PROGRESS, { progress }));
|
|
30147
|
+
}
|
|
30148
|
+
i++;
|
|
30149
|
+
}
|
|
30150
|
+
for (let i = 0; i < bundle.length; i++) {
|
|
30151
|
+
responses.push(resultMap[i]);
|
|
30152
|
+
}
|
|
30153
|
+
return Promise.resolve(responses);
|
|
30197
30154
|
});
|
|
30198
30155
|
}
|
|
30199
30156
|
}
|
|
@@ -30214,7 +30171,10 @@ function handleSkippableHardwareError(e, device, method) {
|
|
|
30214
30171
|
let error;
|
|
30215
30172
|
if (e instanceof hdShared.HardwareError && e.errorCode !== hdShared.HardwareErrorCode.RuntimeError) {
|
|
30216
30173
|
const { errorCode } = e;
|
|
30217
|
-
if (errorCode === hdShared.HardwareErrorCode.
|
|
30174
|
+
if (errorCode === hdShared.HardwareErrorCode.CallMethodInvalidParameter) {
|
|
30175
|
+
error = e;
|
|
30176
|
+
}
|
|
30177
|
+
else if (errorCode === hdShared.HardwareErrorCode.CallMethodNeedUpgradeFirmware) {
|
|
30218
30178
|
error = e;
|
|
30219
30179
|
}
|
|
30220
30180
|
else if (errorCode === hdShared.HardwareErrorCode.DeviceNotSupportMethod) {
|
|
@@ -30240,164 +30200,6 @@ function handleSkippableHardwareError(e, device, method) {
|
|
|
30240
30200
|
return error;
|
|
30241
30201
|
}
|
|
30242
30202
|
|
|
30243
|
-
class AllNetworkGetAddress extends AllNetworkGetAddressBase {
|
|
30244
|
-
getAllNetworkAddress() {
|
|
30245
|
-
var _a, _b, _c, _d;
|
|
30246
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
30247
|
-
const responses = [];
|
|
30248
|
-
const resultMap = {};
|
|
30249
|
-
const { bundle } = this.payload;
|
|
30250
|
-
const methodGroups = bundle
|
|
30251
|
-
.map((param, index) => this.generateMethodName({
|
|
30252
|
-
network: param.network,
|
|
30253
|
-
payload: param,
|
|
30254
|
-
originalIndex: index,
|
|
30255
|
-
}))
|
|
30256
|
-
.reduce((acc, cur) => {
|
|
30257
|
-
if (!acc[cur.methodName]) {
|
|
30258
|
-
acc[cur.methodName] = [];
|
|
30259
|
-
}
|
|
30260
|
-
acc[cur.methodName].push(cur);
|
|
30261
|
-
return acc;
|
|
30262
|
-
}, {});
|
|
30263
|
-
let i = 0;
|
|
30264
|
-
for (const [methodName, params] of Object.entries(methodGroups)) {
|
|
30265
|
-
const methodParams = {
|
|
30266
|
-
bundle: params.map(param => (Object.assign({}, param.params))),
|
|
30267
|
-
};
|
|
30268
|
-
if ((_a = this.abortController) === null || _a === void 0 ? void 0 : _a.signal.aborted) {
|
|
30269
|
-
throw new Error(hdShared.HardwareErrorCodeMessage[hdShared.HardwareErrorCode.RepeatUnlocking]);
|
|
30270
|
-
}
|
|
30271
|
-
const response = yield this.callMethod(methodName, methodParams);
|
|
30272
|
-
if ((_b = this.abortController) === null || _b === void 0 ? void 0 : _b.signal.aborted) {
|
|
30273
|
-
throw new Error(hdShared.HardwareErrorCodeMessage[hdShared.HardwareErrorCode.RepeatUnlocking]);
|
|
30274
|
-
}
|
|
30275
|
-
for (let i = 0; i < params.length; i++) {
|
|
30276
|
-
const { _originRequestParams, _originalIndex } = params[i];
|
|
30277
|
-
const responseKey = `${_originalIndex}`;
|
|
30278
|
-
resultMap[responseKey] = Object.assign(Object.assign({}, _originRequestParams), response[i]);
|
|
30279
|
-
}
|
|
30280
|
-
if (((_d = (_c = this.payload) === null || _c === void 0 ? void 0 : _c.bundle) === null || _d === void 0 ? void 0 : _d.length) > 1) {
|
|
30281
|
-
const progress = Math.round(((i + 1) / this.payload.bundle.length) * 100);
|
|
30282
|
-
this.postMessage(createUiMessage(UI_REQUEST.DEVICE_PROGRESS, { progress }));
|
|
30283
|
-
}
|
|
30284
|
-
i++;
|
|
30285
|
-
}
|
|
30286
|
-
for (let i = 0; i < bundle.length; i++) {
|
|
30287
|
-
responses.push(resultMap[i]);
|
|
30288
|
-
}
|
|
30289
|
-
this.abortController = null;
|
|
30290
|
-
return Promise.resolve(responses);
|
|
30291
|
-
});
|
|
30292
|
-
}
|
|
30293
|
-
}
|
|
30294
|
-
|
|
30295
|
-
class AllNetworkGetAddressByLoop extends AllNetworkGetAddressBase {
|
|
30296
|
-
getAllNetworkAddress() {
|
|
30297
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
30298
|
-
const { callbackId, callbackIdFinish } = this.payload;
|
|
30299
|
-
if (!callbackId) {
|
|
30300
|
-
throw new Error('callbackId is required');
|
|
30301
|
-
}
|
|
30302
|
-
if (!callbackIdFinish) {
|
|
30303
|
-
throw new Error('callbackIdFinish is required');
|
|
30304
|
-
}
|
|
30305
|
-
const bundle = this.payload.bundle || [this.payload];
|
|
30306
|
-
const callbackPromise = this.processCallbacksInBackground(bundle, callbackId, callbackIdFinish);
|
|
30307
|
-
this.device.pendingCallbackPromise = hdShared.createDeferred(callbackPromise);
|
|
30308
|
-
if (this.context && this.payload.connectId) {
|
|
30309
|
-
this.context.registerCallbackTask(this.payload.connectId, this.device.pendingCallbackPromise);
|
|
30310
|
-
}
|
|
30311
|
-
return Promise.resolve([]);
|
|
30312
|
-
});
|
|
30313
|
-
}
|
|
30314
|
-
processCallbacksInBackground(bundle, callbackId, callbackIdFinish) {
|
|
30315
|
-
var _a, _b, _c;
|
|
30316
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
30317
|
-
try {
|
|
30318
|
-
const allResults = [];
|
|
30319
|
-
for (let i = 0; i < bundle.length; i++) {
|
|
30320
|
-
const item = bundle[i];
|
|
30321
|
-
if ((_a = this.abortController) === null || _a === void 0 ? void 0 : _a.signal.aborted) {
|
|
30322
|
-
throw new Error(hdShared.HardwareErrorCodeMessage[hdShared.HardwareErrorCode.RepeatUnlocking]);
|
|
30323
|
-
}
|
|
30324
|
-
const methodParams = this.generateMethodName({
|
|
30325
|
-
network: item.network,
|
|
30326
|
-
payload: item,
|
|
30327
|
-
originalIndex: i,
|
|
30328
|
-
});
|
|
30329
|
-
const singleMethodParams = {
|
|
30330
|
-
bundle: [methodParams.params],
|
|
30331
|
-
};
|
|
30332
|
-
const response = yield this.callMethod(methodParams.methodName, singleMethodParams);
|
|
30333
|
-
if ((_b = this.abortController) === null || _b === void 0 ? void 0 : _b.signal.aborted) {
|
|
30334
|
-
throw new Error(hdShared.HardwareErrorCodeMessage[hdShared.HardwareErrorCode.RepeatUnlocking]);
|
|
30335
|
-
}
|
|
30336
|
-
const singleResult = Object.assign(Object.assign({}, item), response[0]);
|
|
30337
|
-
allResults.push(singleResult);
|
|
30338
|
-
this.sendItemCallback(callbackId, singleResult, i);
|
|
30339
|
-
}
|
|
30340
|
-
this.sendFinishCallback({
|
|
30341
|
-
callbackId: callbackIdFinish,
|
|
30342
|
-
data: allResults,
|
|
30343
|
-
});
|
|
30344
|
-
}
|
|
30345
|
-
catch (error) {
|
|
30346
|
-
let errorCode = error.errorCode || error.code;
|
|
30347
|
-
let errorMessage = error.message;
|
|
30348
|
-
if (error instanceof hdShared.HardwareError) {
|
|
30349
|
-
errorCode = error.errorCode;
|
|
30350
|
-
errorMessage = error.message;
|
|
30351
|
-
}
|
|
30352
|
-
else if (error.message === hdShared.HardwareErrorCodeMessage[hdShared.HardwareErrorCode.RepeatUnlocking]) {
|
|
30353
|
-
errorCode = hdShared.HardwareErrorCode.RepeatUnlocking;
|
|
30354
|
-
errorMessage = error.message;
|
|
30355
|
-
}
|
|
30356
|
-
else {
|
|
30357
|
-
const hardwareError = hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, error.message);
|
|
30358
|
-
errorCode = hardwareError.errorCode;
|
|
30359
|
-
errorMessage = hardwareError.message;
|
|
30360
|
-
}
|
|
30361
|
-
this.sendFinishCallback({
|
|
30362
|
-
callbackId: callbackIdFinish,
|
|
30363
|
-
error: {
|
|
30364
|
-
success: false,
|
|
30365
|
-
payload: {
|
|
30366
|
-
error: errorMessage,
|
|
30367
|
-
code: errorCode,
|
|
30368
|
-
},
|
|
30369
|
-
},
|
|
30370
|
-
});
|
|
30371
|
-
}
|
|
30372
|
-
finally {
|
|
30373
|
-
(_c = this.context) === null || _c === void 0 ? void 0 : _c.cancelCallbackTasks(this.payload.connectId);
|
|
30374
|
-
this.abortController = null;
|
|
30375
|
-
}
|
|
30376
|
-
});
|
|
30377
|
-
}
|
|
30378
|
-
sendFinishCallback({ callbackId, data, error, }) {
|
|
30379
|
-
this.postMessage({
|
|
30380
|
-
event: IFRAME.CALLBACK,
|
|
30381
|
-
type: IFRAME.CALLBACK,
|
|
30382
|
-
payload: {
|
|
30383
|
-
callbackId,
|
|
30384
|
-
data,
|
|
30385
|
-
error,
|
|
30386
|
-
},
|
|
30387
|
-
});
|
|
30388
|
-
}
|
|
30389
|
-
sendItemCallback(callbackId, data, itemIndex) {
|
|
30390
|
-
this.postMessage({
|
|
30391
|
-
event: IFRAME.CALLBACK,
|
|
30392
|
-
type: IFRAME.CALLBACK,
|
|
30393
|
-
payload: {
|
|
30394
|
-
callbackId,
|
|
30395
|
-
data: Object.assign(Object.assign({}, data), { index: itemIndex }),
|
|
30396
|
-
},
|
|
30397
|
-
});
|
|
30398
|
-
}
|
|
30399
|
-
}
|
|
30400
|
-
|
|
30401
30203
|
var bitcoin = [
|
|
30402
30204
|
{
|
|
30403
30205
|
name: "Bitcoin",
|
|
@@ -30972,15 +30774,6 @@ class BTCGetPublicKey extends BaseMethod {
|
|
|
30972
30774
|
}
|
|
30973
30775
|
}
|
|
30974
30776
|
catch (error) {
|
|
30975
|
-
if (error instanceof hdShared.HardwareError) {
|
|
30976
|
-
const { errorCode } = error;
|
|
30977
|
-
if (errorCode === hdShared.HardwareErrorCode.PinCancelled ||
|
|
30978
|
-
errorCode === hdShared.HardwareErrorCode.ActionCancelled ||
|
|
30979
|
-
errorCode === hdShared.HardwareErrorCode.ResponseUnexpectTypeError ||
|
|
30980
|
-
errorCode === hdShared.HardwareErrorCode.PinInvalid) {
|
|
30981
|
-
throw error;
|
|
30982
|
-
}
|
|
30983
|
-
}
|
|
30984
30777
|
responses = [];
|
|
30985
30778
|
for (let i = 0; i < this.params.length; i++) {
|
|
30986
30779
|
const param = this.params[i];
|
|
@@ -31820,7 +31613,6 @@ class EVMGetPublicKey extends BaseMethod {
|
|
|
31820
31613
|
constructor() {
|
|
31821
31614
|
super(...arguments);
|
|
31822
31615
|
this.hasBundle = false;
|
|
31823
|
-
this.confirmShowOnOneKey = false;
|
|
31824
31616
|
this.useBatch = false;
|
|
31825
31617
|
}
|
|
31826
31618
|
init() {
|
|
@@ -31828,8 +31620,7 @@ class EVMGetPublicKey extends BaseMethod {
|
|
|
31828
31620
|
this.checkDeviceId = true;
|
|
31829
31621
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
31830
31622
|
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
31831
|
-
this.
|
|
31832
|
-
this.useBatch = !this.confirmShowOnOneKey && this.hasBundle && this.payload.useBatch;
|
|
31623
|
+
this.useBatch = (_c = (_b = this.payload) === null || _b === void 0 ? void 0 : _b.bundle) === null || _c === void 0 ? void 0 : _c.every((item) => item.showOnOneKey !== true);
|
|
31833
31624
|
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
31834
31625
|
validateParams(payload, [{ name: 'bundle', type: 'array' }]);
|
|
31835
31626
|
this.params = [];
|
|
@@ -31865,7 +31656,7 @@ class EVMGetPublicKey extends BaseMethod {
|
|
|
31865
31656
|
var _a;
|
|
31866
31657
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31867
31658
|
const responses = [];
|
|
31868
|
-
if (this.useBatch && supportBatchPublicKey((_a = this.device) === null || _a === void 0 ? void 0 : _a.features)) {
|
|
31659
|
+
if (this.useBatch && this.hasBundle && supportBatchPublicKey((_a = this.device) === null || _a === void 0 ? void 0 : _a.features)) {
|
|
31869
31660
|
try {
|
|
31870
31661
|
const res = yield batchGetPublickeys(this.device, this.params, 'secp256k1', 60, {
|
|
31871
31662
|
includeNode: false,
|
|
@@ -38322,7 +38113,6 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
|
|
|
38322
38113
|
promptWebDeviceAccess: PromptWebDeviceAccess,
|
|
38323
38114
|
cipherKeyValue: CipherKeyValue,
|
|
38324
38115
|
allNetworkGetAddress: AllNetworkGetAddress,
|
|
38325
|
-
allNetworkGetAddressByLoop: AllNetworkGetAddressByLoop,
|
|
38326
38116
|
btcGetAddress: BTCGetAddress,
|
|
38327
38117
|
btcGetPublicKey: BTCGetPublicKey,
|
|
38328
38118
|
btcSignMessage: BTCSignMessage,
|
|
@@ -38535,7 +38325,6 @@ const Log$1 = getLogger(exports.LoggerNames.Core);
|
|
|
38535
38325
|
class RequestQueue {
|
|
38536
38326
|
constructor() {
|
|
38537
38327
|
this.requestQueue = new Map();
|
|
38538
|
-
this.pendingCallbackTasks = new Map();
|
|
38539
38328
|
this.generateRequestId = (method) => {
|
|
38540
38329
|
if (method && method.responseID != null) {
|
|
38541
38330
|
return method.responseID;
|
|
@@ -38612,28 +38401,6 @@ class RequestQueue {
|
|
|
38612
38401
|
releaseTask(requestId) {
|
|
38613
38402
|
this.requestQueue.delete(requestId);
|
|
38614
38403
|
}
|
|
38615
|
-
registerPendingCallbackTask(connectId, callbackPromise) {
|
|
38616
|
-
this.pendingCallbackTasks.set(connectId, callbackPromise);
|
|
38617
|
-
callbackPromise.promise.finally(() => {
|
|
38618
|
-
Log$1.debug(`Callback task completed for connectId: ${connectId}`);
|
|
38619
|
-
this.pendingCallbackTasks.delete(connectId);
|
|
38620
|
-
});
|
|
38621
|
-
}
|
|
38622
|
-
waitForPendingCallbackTasks(connectId) {
|
|
38623
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
38624
|
-
const pendingTask = this.pendingCallbackTasks.get(connectId);
|
|
38625
|
-
if (pendingTask) {
|
|
38626
|
-
Log$1.debug(`Waiting for pending callback task to complete for connectId: ${connectId}`);
|
|
38627
|
-
yield pendingTask.promise;
|
|
38628
|
-
}
|
|
38629
|
-
});
|
|
38630
|
-
}
|
|
38631
|
-
cancelCallbackTasks(connectId) {
|
|
38632
|
-
const pendingTask = this.pendingCallbackTasks.get(connectId);
|
|
38633
|
-
if (pendingTask) {
|
|
38634
|
-
pendingTask.resolve();
|
|
38635
|
-
}
|
|
38636
|
-
}
|
|
38637
38404
|
}
|
|
38638
38405
|
|
|
38639
38406
|
const getMutex = () => {
|
|
@@ -38756,9 +38523,6 @@ const onCallDevice = (context, message, method) => __awaiter(void 0, void 0, voi
|
|
|
38756
38523
|
Log.debug('passphrase state change, clear device cache');
|
|
38757
38524
|
DevicePool.clearDeviceCache(method.payload.connectId);
|
|
38758
38525
|
}
|
|
38759
|
-
if (method.connectId) {
|
|
38760
|
-
yield context.waitForCallbackTasks(method.connectId);
|
|
38761
|
-
}
|
|
38762
38526
|
yield waitForPendingPromise(getPrePendingCallPromise, setPrePendingCallPromise);
|
|
38763
38527
|
const task = requestQueue.createTask(method);
|
|
38764
38528
|
let device;
|
|
@@ -38782,7 +38546,6 @@ const onCallDevice = (context, message, method) => __awaiter(void 0, void 0, voi
|
|
|
38782
38546
|
}
|
|
38783
38547
|
Log.debug('Call API - setDevice: ', device.mainId);
|
|
38784
38548
|
(_b = method.setDevice) === null || _b === void 0 ? void 0 : _b.call(method, device);
|
|
38785
|
-
method.context = context;
|
|
38786
38549
|
device.on(DEVICE.PIN, onDevicePinHandler);
|
|
38787
38550
|
device.on(DEVICE.BUTTON, onDeviceButtonHandler);
|
|
38788
38551
|
device.on(DEVICE.PASSPHRASE, message.payload.useEmptyPassphrase ? onEmptyPassphraseHandler : onDevicePassphraseHandler);
|
|
@@ -38790,9 +38553,6 @@ const onCallDevice = (context, message, method) => __awaiter(void 0, void 0, voi
|
|
|
38790
38553
|
device.on(DEVICE.FEATURES, onDeviceFeaturesHandler);
|
|
38791
38554
|
device.on(DEVICE.SELECT_DEVICE_IN_BOOTLOADER_FOR_WEB_DEVICE, onSelectDeviceInBootloaderForWebDeviceHandler);
|
|
38792
38555
|
try {
|
|
38793
|
-
if (method.connectId) {
|
|
38794
|
-
yield context.waitForCallbackTasks(method.connectId);
|
|
38795
|
-
}
|
|
38796
38556
|
yield waitForPendingPromise(getPrePendingCallPromise, setPrePendingCallPromise);
|
|
38797
38557
|
const inner = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
38798
38558
|
var _c, _d, _e, _f, _g;
|
|
@@ -39130,7 +38890,6 @@ const cancel = (context, connectId) => {
|
|
|
39130
38890
|
const { requestQueue, setPrePendingCallPromise } = context;
|
|
39131
38891
|
if (connectId) {
|
|
39132
38892
|
try {
|
|
39133
|
-
requestQueue.cancelCallbackTasks(connectId);
|
|
39134
38893
|
const requestIds = requestQueue.getRequestTasksId();
|
|
39135
38894
|
Log.debug(`Cancel Api connect requestQueues: length:${requestIds.length} requestIds:${requestIds.join(',')}`);
|
|
39136
38895
|
const canceledDevices = [];
|
|
@@ -39311,11 +39070,6 @@ class Core extends events.exports {
|
|
|
39311
39070
|
setPrePendingCallPromise: (promise) => {
|
|
39312
39071
|
this.prePendingCallPromise = promise;
|
|
39313
39072
|
},
|
|
39314
|
-
registerCallbackTask: (connectId, callbackPromise) => {
|
|
39315
|
-
this.requestQueue.registerPendingCallbackTask(connectId, callbackPromise);
|
|
39316
|
-
},
|
|
39317
|
-
waitForCallbackTasks: (connectId) => this.requestQueue.waitForPendingCallbackTasks(connectId),
|
|
39318
|
-
cancelCallbackTasks: (connectId) => this.requestQueue.cancelCallbackTasks(connectId),
|
|
39319
39073
|
};
|
|
39320
39074
|
}
|
|
39321
39075
|
handleMessage(message) {
|
|
@@ -39357,11 +39111,6 @@ class Core extends events.exports {
|
|
|
39357
39111
|
cancel(this.getCoreContext(), message.payload.connectId);
|
|
39358
39112
|
break;
|
|
39359
39113
|
}
|
|
39360
|
-
case IFRAME.CALLBACK: {
|
|
39361
|
-
Log.log('callback message: ', message);
|
|
39362
|
-
postMessage(message);
|
|
39363
|
-
break;
|
|
39364
|
-
}
|
|
39365
39114
|
}
|
|
39366
39115
|
return Promise.resolve(message);
|
|
39367
39116
|
});
|
|
@@ -39460,7 +39209,6 @@ exports.UI_REQUEST = UI_REQUEST;
|
|
|
39460
39209
|
exports.UI_RESPONSE = UI_RESPONSE;
|
|
39461
39210
|
exports.checkNeedUpdateBootForClassicAndMini = checkNeedUpdateBootForClassicAndMini;
|
|
39462
39211
|
exports.checkNeedUpdateBootForTouch = checkNeedUpdateBootForTouch;
|
|
39463
|
-
exports.cleanupCallback = cleanupCallback;
|
|
39464
39212
|
exports.corsValidator = corsValidator;
|
|
39465
39213
|
exports.createDeviceMessage = createDeviceMessage;
|
|
39466
39214
|
exports.createErrorMessage = createErrorMessage;
|
|
@@ -39472,7 +39220,6 @@ exports.createUiMessage = createUiMessage;
|
|
|
39472
39220
|
exports.createUiResponse = createUiResponse;
|
|
39473
39221
|
exports["default"] = HardwareSdk;
|
|
39474
39222
|
exports.enableLog = enableLog;
|
|
39475
|
-
exports.executeCallback = executeCallback;
|
|
39476
39223
|
exports.getDeviceBLEFirmwareVersion = getDeviceBLEFirmwareVersion;
|
|
39477
39224
|
exports.getDeviceBleName = getDeviceBleName;
|
|
39478
39225
|
exports.getDeviceBoardloaderVersion = getDeviceBoardloaderVersion;
|