@onekeyfe/hd-web-sdk 0.1.21 → 0.1.24
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/build/iframe.html +1 -1
- package/build/js/iframe.d989798a9cd215994caa.js +3 -0
- package/build/js/{iframe.9767bf698d2170937d7b.js.LICENSE.txt → iframe.d989798a9cd215994caa.js.LICENSE.txt} +0 -0
- package/build/js/iframe.d989798a9cd215994caa.js.map +1 -0
- package/build/onekey-js-sdk.js +31 -19
- package/build/onekey-js-sdk.js.map +1 -1
- package/build/onekey-js-sdk.min.js +1 -1
- package/build/onekey-js-sdk.min.js.map +1 -1
- package/package.json +5 -5
- package/build/js/iframe.9767bf698d2170937d7b.js +0 -3
- package/build/js/iframe.9767bf698d2170937d7b.js.map +0 -1
package/build/onekey-js-sdk.js
CHANGED
|
@@ -14468,6 +14468,8 @@ class DeviceCommands {
|
|
|
14468
14468
|
}
|
|
14469
14469
|
|
|
14470
14470
|
_filterCommonTypes(res) {
|
|
14471
|
+
var _a;
|
|
14472
|
+
|
|
14471
14473
|
Log$4.debug('_filterCommonTypes: ', res);
|
|
14472
14474
|
|
|
14473
14475
|
if (res.type === 'Failure') {
|
|
@@ -14506,6 +14508,10 @@ class DeviceCommands {
|
|
|
14506
14508
|
return Promise.resolve(patchFeatures(res));
|
|
14507
14509
|
}
|
|
14508
14510
|
|
|
14511
|
+
if ((_a = this.device.features) === null || _a === void 0 ? void 0 : _a.passphrase_protection) {
|
|
14512
|
+
return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotSupportPassphrase));
|
|
14513
|
+
}
|
|
14514
|
+
|
|
14509
14515
|
if (res.type === 'ButtonRequest') {
|
|
14510
14516
|
if (res.message.code === 'ButtonRequest_PassphraseEntry') {
|
|
14511
14517
|
this.device.emit(DEVICE.PASSPHRASE_ON_DEVICE, this.device);
|
|
@@ -14531,9 +14537,7 @@ class DeviceCommands {
|
|
|
14531
14537
|
}
|
|
14532
14538
|
|
|
14533
14539
|
if (res.type === 'PassphraseRequest') {
|
|
14534
|
-
return
|
|
14535
|
-
passphrase: ''
|
|
14536
|
-
});
|
|
14540
|
+
return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotSupportPassphrase));
|
|
14537
14541
|
}
|
|
14538
14542
|
|
|
14539
14543
|
if (res.type === 'Deprecated_PassphraseStateRequest') ;
|
|
@@ -14917,20 +14921,24 @@ class Device extends events.exports {
|
|
|
14917
14921
|
_runInner(fn, options) {
|
|
14918
14922
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14919
14923
|
if (!this.isUsedHere() || this.commands.disposed) {
|
|
14920
|
-
|
|
14924
|
+
const env = DataManager.getSettings('env');
|
|
14921
14925
|
|
|
14922
|
-
|
|
14923
|
-
|
|
14924
|
-
yield this.initialize();
|
|
14925
|
-
}
|
|
14926
|
-
} catch (error) {
|
|
14927
|
-
this.runPromise = null;
|
|
14926
|
+
if (env !== 'react-native') {
|
|
14927
|
+
yield this.acquire();
|
|
14928
14928
|
|
|
14929
|
-
|
|
14930
|
-
|
|
14931
|
-
|
|
14929
|
+
try {
|
|
14930
|
+
if (fn) {
|
|
14931
|
+
yield this.initialize();
|
|
14932
|
+
}
|
|
14933
|
+
} catch (error) {
|
|
14934
|
+
this.runPromise = null;
|
|
14935
|
+
|
|
14936
|
+
if (error instanceof hdShared.HardwareError) {
|
|
14937
|
+
return Promise.reject(error);
|
|
14938
|
+
}
|
|
14932
14939
|
|
|
14933
|
-
|
|
14940
|
+
return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceInitializeFailed, `Initialize failed: ${error.message}, code: ${error.code}`));
|
|
14941
|
+
}
|
|
14934
14942
|
}
|
|
14935
14943
|
}
|
|
14936
14944
|
|
|
@@ -19161,7 +19169,7 @@ const callAPI = message => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
19161
19169
|
callApiQueue.push(method);
|
|
19162
19170
|
|
|
19163
19171
|
if (callApiQueue.length > 1) {
|
|
19164
|
-
Log.debug('should cancel the previous method execution: ', callApiQueue);
|
|
19172
|
+
Log.debug('should cancel the previous method execution: ', callApiQueue.map(m => m.name));
|
|
19165
19173
|
}
|
|
19166
19174
|
|
|
19167
19175
|
if (pollingState[pollingId]) {
|
|
@@ -19272,11 +19280,11 @@ const callAPI = message => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
19272
19280
|
}
|
|
19273
19281
|
}
|
|
19274
19282
|
|
|
19275
|
-
const index =
|
|
19283
|
+
const index = method.responseID ? callApiQueue.findIndex(m => m.responseID === method.responseID) : -1;
|
|
19276
19284
|
|
|
19277
19285
|
if (index > -1) {
|
|
19278
19286
|
callApiQueue.splice(index, 1);
|
|
19279
|
-
Log.debug('Remove the finished method from the queue: ', callApiQueue);
|
|
19287
|
+
Log.debug('Remove the finished method from the queue: ', callApiQueue.map(m => m.name));
|
|
19280
19288
|
}
|
|
19281
19289
|
|
|
19282
19290
|
closePopup();
|
|
@@ -19421,7 +19429,7 @@ const ensureConnected = (method, pollingId) => __awaiter(void 0, void 0, void 0,
|
|
|
19421
19429
|
} catch (error) {
|
|
19422
19430
|
Log.debug('device error: ', error);
|
|
19423
19431
|
|
|
19424
|
-
if ([hdShared.HardwareErrorCode.BlePermissionError, hdShared.HardwareErrorCode.BleLocationError, hdShared.HardwareErrorCode.BleDeviceNotBonded, hdShared.HardwareErrorCode.BleCharacteristicNotifyError].includes(error.errorCode)) {
|
|
19432
|
+
if ([hdShared.HardwareErrorCode.BlePermissionError, hdShared.HardwareErrorCode.BleLocationError, hdShared.HardwareErrorCode.BleDeviceNotBonded, hdShared.HardwareErrorCode.BleCharacteristicNotifyError, hdShared.HardwareErrorCode.BleWriteCharacteristicError].includes(error.errorCode)) {
|
|
19425
19433
|
reject(error);
|
|
19426
19434
|
return;
|
|
19427
19435
|
}
|
|
@@ -20841,6 +20849,7 @@ const HardwareErrorCode = {
|
|
|
20841
20849
|
DeviceUnexpectedBootloaderMode: 108,
|
|
20842
20850
|
DeviceInterruptedFromUser: 109,
|
|
20843
20851
|
DeviceCheckDeviceIdError: 110,
|
|
20852
|
+
DeviceNotSupportPassphrase: 111,
|
|
20844
20853
|
NotInitialized: 200,
|
|
20845
20854
|
IFrameNotInitialized: 300,
|
|
20846
20855
|
IFrameAleradyInitialized: 301,
|
|
@@ -20866,6 +20875,7 @@ const HardwareErrorCode = {
|
|
|
20866
20875
|
BleCharacteristicNotFound: 707,
|
|
20867
20876
|
BleMonitorError: 708,
|
|
20868
20877
|
BleCharacteristicNotifyError: 709,
|
|
20878
|
+
BleWriteCharacteristicError: 710,
|
|
20869
20879
|
RuntimeError: 800,
|
|
20870
20880
|
PinInvalid: 801,
|
|
20871
20881
|
PinCancelled: 802,
|
|
@@ -20890,6 +20900,7 @@ const HardwareErrorCodeMessage = {
|
|
|
20890
20900
|
[HardwareErrorCode.DeviceInterruptedFromUser]: 'Device interrupted',
|
|
20891
20901
|
[HardwareErrorCode.DeviceUnexpectedBootloaderMode]: 'Device should be in bootloader mode',
|
|
20892
20902
|
[HardwareErrorCode.DeviceCheckDeviceIdError]: 'Device Id in the features is not same.',
|
|
20903
|
+
[HardwareErrorCode.DeviceNotSupportPassphrase]: 'Device not support passphrase',
|
|
20893
20904
|
[HardwareErrorCode.NotInitialized]: 'Not initialized',
|
|
20894
20905
|
[HardwareErrorCode.IFrameNotInitialized]: 'IFrame not initialized',
|
|
20895
20906
|
[HardwareErrorCode.IFrameAleradyInitialized]: 'IFrame alerady initialized',
|
|
@@ -20915,6 +20926,7 @@ const HardwareErrorCodeMessage = {
|
|
|
20915
20926
|
[HardwareErrorCode.BleCharacteristicNotFound]: 'BLEServiceNotFound: service not found',
|
|
20916
20927
|
[HardwareErrorCode.BleMonitorError]: 'Monitor Error: characteristic not found',
|
|
20917
20928
|
[HardwareErrorCode.BleCharacteristicNotifyError]: 'Characteristic Notify Error',
|
|
20929
|
+
[HardwareErrorCode.BleWriteCharacteristicError]: 'Write Characteristic Error',
|
|
20918
20930
|
[HardwareErrorCode.RuntimeError]: 'Runtime error',
|
|
20919
20931
|
[HardwareErrorCode.PinInvalid]: 'Pin invalid',
|
|
20920
20932
|
[HardwareErrorCode.PinCancelled]: 'Pin cancelled',
|
|
@@ -46156,7 +46168,7 @@ const src_init = async settings => {
|
|
|
46156
46168
|
|
|
46157
46169
|
try {
|
|
46158
46170
|
await init({ ..._settings,
|
|
46159
|
-
version: "0.1.
|
|
46171
|
+
version: "0.1.24"
|
|
46160
46172
|
});
|
|
46161
46173
|
return true;
|
|
46162
46174
|
} catch (e) {
|