@onekeyfe/hd-web-sdk 0.1.22 → 0.1.25
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/data/config.ts +1 -1
- package/build/iframe.html +1 -1
- package/build/js/iframe.03bcf830892a0fabe7a3.js +3 -0
- package/build/js/{iframe.0d0020defda6bb93c4a1.js.LICENSE.txt → iframe.03bcf830892a0fabe7a3.js.LICENSE.txt} +0 -0
- package/build/js/iframe.03bcf830892a0fabe7a3.js.map +1 -0
- package/build/onekey-js-sdk.js +37 -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/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/index.ts +7 -2
- package/build/js/iframe.0d0020defda6bb93c4a1.js +0 -3
- package/build/js/iframe.0d0020defda6bb93c4a1.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);
|
|
@@ -14573,7 +14579,7 @@ const UI_REQUEST = {
|
|
|
14573
14579
|
FIRMWARE_NOT_INSTALLED: 'ui-device_firmware_not_installed',
|
|
14574
14580
|
NOT_USE_ONEKEY_DEVICE: 'ui-device_please_use_onekey_device'
|
|
14575
14581
|
};
|
|
14576
|
-
const DEFAULT_DOMAIN = `https://jssdk.onekey.so/`;
|
|
14582
|
+
const DEFAULT_DOMAIN = `https://jssdk.onekey.so/${"0.1.25"}/`;
|
|
14577
14583
|
const DEFAULT_PRIORITY = 2;
|
|
14578
14584
|
const initialSettings = {
|
|
14579
14585
|
configSrc: './data/config.json',
|
|
@@ -14915,20 +14921,24 @@ class Device extends events.exports {
|
|
|
14915
14921
|
_runInner(fn, options) {
|
|
14916
14922
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14917
14923
|
if (!this.isUsedHere() || this.commands.disposed) {
|
|
14918
|
-
|
|
14924
|
+
const env = DataManager.getSettings('env');
|
|
14919
14925
|
|
|
14920
|
-
|
|
14921
|
-
|
|
14922
|
-
yield this.initialize();
|
|
14923
|
-
}
|
|
14924
|
-
} catch (error) {
|
|
14925
|
-
this.runPromise = null;
|
|
14926
|
+
if (env !== 'react-native') {
|
|
14927
|
+
yield this.acquire();
|
|
14926
14928
|
|
|
14927
|
-
|
|
14928
|
-
|
|
14929
|
-
|
|
14929
|
+
try {
|
|
14930
|
+
if (fn) {
|
|
14931
|
+
yield this.initialize();
|
|
14932
|
+
}
|
|
14933
|
+
} catch (error) {
|
|
14934
|
+
this.runPromise = null;
|
|
14930
14935
|
|
|
14931
|
-
|
|
14936
|
+
if (error instanceof hdShared.HardwareError) {
|
|
14937
|
+
return Promise.reject(error);
|
|
14938
|
+
}
|
|
14939
|
+
|
|
14940
|
+
return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceInitializeFailed, `Initialize failed: ${error.message}, code: ${error.code}`));
|
|
14941
|
+
}
|
|
14932
14942
|
}
|
|
14933
14943
|
}
|
|
14934
14944
|
|
|
@@ -19159,7 +19169,7 @@ const callAPI = message => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
19159
19169
|
callApiQueue.push(method);
|
|
19160
19170
|
|
|
19161
19171
|
if (callApiQueue.length > 1) {
|
|
19162
|
-
Log.debug('should cancel the previous method execution: ', callApiQueue);
|
|
19172
|
+
Log.debug('should cancel the previous method execution: ', callApiQueue.map(m => m.name));
|
|
19163
19173
|
}
|
|
19164
19174
|
|
|
19165
19175
|
if (pollingState[pollingId]) {
|
|
@@ -19270,11 +19280,11 @@ const callAPI = message => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
19270
19280
|
}
|
|
19271
19281
|
}
|
|
19272
19282
|
|
|
19273
|
-
const index =
|
|
19283
|
+
const index = method.responseID ? callApiQueue.findIndex(m => m.responseID === method.responseID) : -1;
|
|
19274
19284
|
|
|
19275
19285
|
if (index > -1) {
|
|
19276
19286
|
callApiQueue.splice(index, 1);
|
|
19277
|
-
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));
|
|
19278
19288
|
}
|
|
19279
19289
|
|
|
19280
19290
|
closePopup();
|
|
@@ -19419,7 +19429,7 @@ const ensureConnected = (method, pollingId) => __awaiter(void 0, void 0, void 0,
|
|
|
19419
19429
|
} catch (error) {
|
|
19420
19430
|
Log.debug('device error: ', error);
|
|
19421
19431
|
|
|
19422
|
-
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)) {
|
|
19423
19433
|
reject(error);
|
|
19424
19434
|
return;
|
|
19425
19435
|
}
|
|
@@ -20865,6 +20875,7 @@ const HardwareErrorCode = {
|
|
|
20865
20875
|
BleCharacteristicNotFound: 707,
|
|
20866
20876
|
BleMonitorError: 708,
|
|
20867
20877
|
BleCharacteristicNotifyError: 709,
|
|
20878
|
+
BleWriteCharacteristicError: 710,
|
|
20868
20879
|
RuntimeError: 800,
|
|
20869
20880
|
PinInvalid: 801,
|
|
20870
20881
|
PinCancelled: 802,
|
|
@@ -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.25"
|
|
46160
46172
|
});
|
|
46161
46173
|
return true;
|
|
46162
46174
|
} catch (e) {
|
|
@@ -46166,14 +46178,20 @@ const src_init = async settings => {
|
|
|
46166
46178
|
};
|
|
46167
46179
|
|
|
46168
46180
|
const call = async params => {
|
|
46169
|
-
src_Log.debug('call : ', params);
|
|
46181
|
+
src_Log.debug('call : ', params);
|
|
46182
|
+
/**
|
|
46183
|
+
* Try to recreate iframe if it's initialize failed
|
|
46184
|
+
*/
|
|
46170
46185
|
|
|
46171
46186
|
if (!instance && !timeout) {
|
|
46172
46187
|
_settings = (0,dist/* parseConnectSettings */._4)(_settings);
|
|
46188
|
+
src_Log.debug("Try to recreate iframe if it's initialize failed: ", _settings);
|
|
46173
46189
|
|
|
46174
46190
|
try {
|
|
46175
|
-
src_init(_settings);
|
|
46191
|
+
await src_init(_settings);
|
|
46192
|
+
src_Log.debug('Recreate iframe success');
|
|
46176
46193
|
} catch (error) {
|
|
46194
|
+
src_Log.debug('Recreate iframe failed: ', error);
|
|
46177
46195
|
return (0,dist/* createErrorMessage */.xG)(error);
|
|
46178
46196
|
}
|
|
46179
46197
|
}
|