@onekeyfe/hd-web-sdk 0.1.24 → 0.1.27
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.018b08d876d5a3fcfde7.js +3 -0
- package/build/js/{iframe.d989798a9cd215994caa.js.LICENSE.txt → iframe.018b08d876d5a3fcfde7.js.LICENSE.txt} +0 -0
- package/build/js/iframe.018b08d876d5a3fcfde7.js.map +1 -0
- package/build/onekey-js-sdk.js +78 -8
- 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 +13 -4
- package/dist/index.js.map +1 -1
- package/dist/utils/bridgeUtils.d.ts +1 -0
- package/dist/utils/bridgeUtils.d.ts.map +1 -1
- package/dist/utils/bridgeUtils.js +3 -1
- package/dist/utils/bridgeUtils.js.map +1 -1
- package/package.json +6 -6
- package/src/index.ts +16 -4
- package/src/utils/bridgeUtils.ts +7 -1
- package/build/js/iframe.d989798a9cd215994caa.js +0 -3
- package/build/js/iframe.d989798a9cd215994caa.js.map +0 -1
package/build/onekey-js-sdk.js
CHANGED
|
@@ -4133,6 +4133,10 @@ const inject = ({
|
|
|
4133
4133
|
connectId,
|
|
4134
4134
|
method: 'deviceUpdateReboot'
|
|
4135
4135
|
}),
|
|
4136
|
+
deviceSupportFeatures: connectId => call({
|
|
4137
|
+
connectId,
|
|
4138
|
+
method: 'deviceSupportFeatures'
|
|
4139
|
+
}),
|
|
4136
4140
|
deviceVerify: (connectId, params) => call(Object.assign(Object.assign({}, params), {
|
|
4137
4141
|
connectId,
|
|
4138
4142
|
method: 'deviceVerify'
|
|
@@ -13670,9 +13674,25 @@ const getDeviceBLEFirmwareVersion = features => {
|
|
|
13670
13674
|
return null;
|
|
13671
13675
|
}
|
|
13672
13676
|
|
|
13677
|
+
if (!semver__default["default"].valid(features.ble_ver)) {
|
|
13678
|
+
return null;
|
|
13679
|
+
}
|
|
13680
|
+
|
|
13673
13681
|
return features.ble_ver.split('.');
|
|
13674
13682
|
};
|
|
13675
13683
|
|
|
13684
|
+
const supportInputPinOnSoftware = features => {
|
|
13685
|
+
if (!features) return false;
|
|
13686
|
+
const deviceType = getDeviceType(features);
|
|
13687
|
+
|
|
13688
|
+
if (deviceType === 'touch') {
|
|
13689
|
+
return false;
|
|
13690
|
+
}
|
|
13691
|
+
|
|
13692
|
+
const currentVersion = getDeviceFirmwareVersion(features).join('.');
|
|
13693
|
+
return semver__default["default"].gte(currentVersion, '2.3.0');
|
|
13694
|
+
};
|
|
13695
|
+
|
|
13676
13696
|
const HD_HARDENED = 0x80000000;
|
|
13677
13697
|
|
|
13678
13698
|
const toHardened = n => (n | HD_HARDENED) >>> 0;
|
|
@@ -14351,6 +14371,7 @@ const DEVICE = {
|
|
|
14351
14371
|
PASSPHRASE: 'passphrase',
|
|
14352
14372
|
PASSPHRASE_ON_DEVICE: 'passphrase_on_device',
|
|
14353
14373
|
WORD: 'word',
|
|
14374
|
+
SUPPORT_FEATURES: 'support_features',
|
|
14354
14375
|
FEATURES: 'features'
|
|
14355
14376
|
};
|
|
14356
14377
|
|
|
@@ -14579,7 +14600,7 @@ const UI_REQUEST = {
|
|
|
14579
14600
|
FIRMWARE_NOT_INSTALLED: 'ui-device_firmware_not_installed',
|
|
14580
14601
|
NOT_USE_ONEKEY_DEVICE: 'ui-device_please_use_onekey_device'
|
|
14581
14602
|
};
|
|
14582
|
-
const DEFAULT_DOMAIN = `https://jssdk.onekey.so/`;
|
|
14603
|
+
const DEFAULT_DOMAIN = `https://jssdk.onekey.so/${"0.1.27"}/`;
|
|
14583
14604
|
const DEFAULT_PRIORITY = 2;
|
|
14584
14605
|
const initialSettings = {
|
|
14585
14606
|
configSrc: './data/config.json',
|
|
@@ -15218,6 +15239,15 @@ class BaseMethod {
|
|
|
15218
15239
|
})));
|
|
15219
15240
|
}
|
|
15220
15241
|
|
|
15242
|
+
checkDeviceSupportFeature() {
|
|
15243
|
+
if (!this.device || !this.device.features) return;
|
|
15244
|
+
const inputPinOnSoftware = supportInputPinOnSoftware(this.device.features);
|
|
15245
|
+
this.postMessage(createDeviceMessage(DEVICE.SUPPORT_FEATURES, {
|
|
15246
|
+
inputPinOnSoftware,
|
|
15247
|
+
device: this.device.toMessageObject()
|
|
15248
|
+
}));
|
|
15249
|
+
}
|
|
15250
|
+
|
|
15221
15251
|
dispose() {}
|
|
15222
15252
|
|
|
15223
15253
|
}
|
|
@@ -16872,6 +16902,20 @@ class DeviceUpdateReboot extends BaseMethod {
|
|
|
16872
16902
|
|
|
16873
16903
|
}
|
|
16874
16904
|
|
|
16905
|
+
class DeviceSupportFeatures extends BaseMethod {
|
|
16906
|
+
init() {}
|
|
16907
|
+
|
|
16908
|
+
run() {
|
|
16909
|
+
if (!this.device.features) return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Device not initialized'));
|
|
16910
|
+
const inputPinOnSoftware = supportInputPinOnSoftware(this.device.features);
|
|
16911
|
+
return Promise.resolve({
|
|
16912
|
+
inputPinOnSoftware,
|
|
16913
|
+
device: this.device.toMessageObject()
|
|
16914
|
+
});
|
|
16915
|
+
}
|
|
16916
|
+
|
|
16917
|
+
}
|
|
16918
|
+
|
|
16875
16919
|
class DeviceVerify extends BaseMethod {
|
|
16876
16920
|
init() {
|
|
16877
16921
|
validateParams(this.payload, [{
|
|
@@ -18905,6 +18949,7 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
|
|
|
18905
18949
|
deviceReset: DeviceReset,
|
|
18906
18950
|
deviceSettings: DeviceSettings,
|
|
18907
18951
|
deviceUpdateReboot: DeviceUpdateReboot,
|
|
18952
|
+
deviceSupportFeatures: DeviceSupportFeatures,
|
|
18908
18953
|
deviceVerify: DeviceVerify,
|
|
18909
18954
|
deviceWipe: DeviceWipe,
|
|
18910
18955
|
evmGetAddress: EvmGetAddress,
|
|
@@ -19232,6 +19277,7 @@ const callAPI = message => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
19232
19277
|
}
|
|
19233
19278
|
|
|
19234
19279
|
method.checkFirmwareRelease();
|
|
19280
|
+
method.checkDeviceSupportFeature();
|
|
19235
19281
|
|
|
19236
19282
|
if (_deviceList) {
|
|
19237
19283
|
yield TransportManager.reconfigure(device.getFirmwareVersion());
|
|
@@ -44733,6 +44779,7 @@ var IInjectedProviderNames;
|
|
|
44733
44779
|
IInjectedProviderNames["ethereum"] = "ethereum";
|
|
44734
44780
|
IInjectedProviderNames["conflux"] = "conflux";
|
|
44735
44781
|
IInjectedProviderNames["solana"] = "solana";
|
|
44782
|
+
IInjectedProviderNames["starcoin"] = "starcoin";
|
|
44736
44783
|
IInjectedProviderNames["sollet"] = "sollet";
|
|
44737
44784
|
IInjectedProviderNames["near"] = "near";
|
|
44738
44785
|
IInjectedProviderNames["$private"] = "$private";
|
|
@@ -45164,7 +45211,7 @@ function parseOpts(arg) {
|
|
|
45164
45211
|
|
|
45165
45212
|
|
|
45166
45213
|
;// CONCATENATED MODULE: ../../node_modules/@onekeyfe/cross-inpage-provider-core/dist/versionInfo.js
|
|
45167
|
-
const version = '0.0.
|
|
45214
|
+
const version = '0.0.17';
|
|
45168
45215
|
const versionBuild = '2020-0101-1';
|
|
45169
45216
|
/* harmony default export */ const dist_versionInfo = ({
|
|
45170
45217
|
version,
|
|
@@ -45870,6 +45917,12 @@ class JsBridgeSimple extends (/* unused pure expression or super */ null && (JsB
|
|
|
45870
45917
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
45871
45918
|
|
|
45872
45919
|
let postMessageListenerAdded = false;
|
|
45920
|
+
/**
|
|
45921
|
+
* When the JsBridgeIframe instance changes, the tag can be changed manually
|
|
45922
|
+
*/
|
|
45923
|
+
function setPostMessageListenerFlag(value) {
|
|
45924
|
+
postMessageListenerAdded = value;
|
|
45925
|
+
}
|
|
45873
45926
|
function setupPostMessageListener(options = {}) {
|
|
45874
45927
|
if (postMessageListenerAdded) {
|
|
45875
45928
|
return;
|
|
@@ -46006,6 +46059,7 @@ let frameBridge; // eslint-disable-next-line import/no-mutable-exports
|
|
|
46006
46059
|
|
|
46007
46060
|
let hostBridge;
|
|
46008
46061
|
const Log = (0,dist/* getLogger */.jl)(dist/* LoggerNames.SendMessage */.d0.SendMessage);
|
|
46062
|
+
const resetListenerFlag = () => setPostMessageListenerFlag(false);
|
|
46009
46063
|
const createJsBridge = params => {
|
|
46010
46064
|
const bridge = new JsBridgeIframe(params);
|
|
46011
46065
|
|
|
@@ -46078,6 +46132,10 @@ const handleMessage = async message => {
|
|
|
46078
46132
|
eventEmitter.emit(message.type, message.payload);
|
|
46079
46133
|
}
|
|
46080
46134
|
|
|
46135
|
+
if (message.type === dist/* DEVICE.SUPPORT_FEATURES */.Td.SUPPORT_FEATURES) {
|
|
46136
|
+
eventEmitter.emit(message.type, message.payload);
|
|
46137
|
+
}
|
|
46138
|
+
|
|
46081
46139
|
break;
|
|
46082
46140
|
|
|
46083
46141
|
default:
|
|
@@ -46118,17 +46176,22 @@ const cancel = connectId => {
|
|
|
46118
46176
|
});
|
|
46119
46177
|
};
|
|
46120
46178
|
|
|
46179
|
+
let prevFrameInstance = null;
|
|
46180
|
+
|
|
46121
46181
|
const createJSBridge = messageEvent => {
|
|
46182
|
+
var _iframe$instance;
|
|
46183
|
+
|
|
46122
46184
|
if (messageEvent.origin !== origin) {
|
|
46123
46185
|
return;
|
|
46124
46186
|
}
|
|
46125
46187
|
|
|
46126
|
-
if (!hostBridge) {
|
|
46127
|
-
var _iframe$
|
|
46188
|
+
if (!hostBridge || prevFrameInstance !== ((_iframe$instance = instance) === null || _iframe$instance === void 0 ? void 0 : _iframe$instance.contentWindow)) {
|
|
46189
|
+
var _iframe$instance2, _iframe$instance3;
|
|
46128
46190
|
|
|
46191
|
+
resetListenerFlag();
|
|
46129
46192
|
createJsBridge({
|
|
46130
46193
|
isHost: true,
|
|
46131
|
-
remoteFrame: (_iframe$
|
|
46194
|
+
remoteFrame: (_iframe$instance2 = instance) === null || _iframe$instance2 === void 0 ? void 0 : _iframe$instance2.contentWindow,
|
|
46132
46195
|
remoteFrameName: bridge_config.iframeName,
|
|
46133
46196
|
selfFrameName: bridge_config.hostName,
|
|
46134
46197
|
channel: bridge_config.channel,
|
|
@@ -46149,6 +46212,7 @@ const createJSBridge = messageEvent => {
|
|
|
46149
46212
|
return response;
|
|
46150
46213
|
}
|
|
46151
46214
|
});
|
|
46215
|
+
prevFrameInstance = (_iframe$instance3 = instance) === null || _iframe$instance3 === void 0 ? void 0 : _iframe$instance3.contentWindow;
|
|
46152
46216
|
}
|
|
46153
46217
|
};
|
|
46154
46218
|
|
|
@@ -46168,7 +46232,7 @@ const src_init = async settings => {
|
|
|
46168
46232
|
|
|
46169
46233
|
try {
|
|
46170
46234
|
await init({ ..._settings,
|
|
46171
|
-
version: "0.1.
|
|
46235
|
+
version: "0.1.27"
|
|
46172
46236
|
});
|
|
46173
46237
|
return true;
|
|
46174
46238
|
} catch (e) {
|
|
@@ -46178,14 +46242,20 @@ const src_init = async settings => {
|
|
|
46178
46242
|
};
|
|
46179
46243
|
|
|
46180
46244
|
const call = async params => {
|
|
46181
|
-
src_Log.debug('call : ', params);
|
|
46245
|
+
src_Log.debug('call : ', params);
|
|
46246
|
+
/**
|
|
46247
|
+
* Try to recreate iframe if it's initialize failed
|
|
46248
|
+
*/
|
|
46182
46249
|
|
|
46183
46250
|
if (!instance && !timeout) {
|
|
46184
46251
|
_settings = (0,dist/* parseConnectSettings */._4)(_settings);
|
|
46252
|
+
src_Log.debug("Try to recreate iframe if it's initialize failed: ", _settings);
|
|
46185
46253
|
|
|
46186
46254
|
try {
|
|
46187
|
-
src_init(_settings);
|
|
46255
|
+
await src_init(_settings);
|
|
46256
|
+
src_Log.debug('Recreate iframe success');
|
|
46188
46257
|
} catch (error) {
|
|
46258
|
+
src_Log.debug('Recreate iframe failed: ', error);
|
|
46189
46259
|
return (0,dist/* createErrorMessage */.xG)(error);
|
|
46190
46260
|
}
|
|
46191
46261
|
}
|