@onekeyfe/hd-web-sdk 0.2.1 → 0.2.2-beta-2
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.5799fe007c4f1aa371c7.js +3 -0
- package/build/js/iframe.5799fe007c4f1aa371c7.js.map +1 -0
- package/build/onekey-js-sdk.js +83 -5
- 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 +6 -6
- package/build/js/iframe.b3d08698f1332b9d17e0.js +0 -3
- package/build/js/iframe.b3d08698f1332b9d17e0.js.map +0 -1
- /package/build/js/{iframe.b3d08698f1332b9d17e0.js.LICENSE.txt → iframe.5799fe007c4f1aa371c7.js.LICENSE.txt} +0 -0
package/build/onekey-js-sdk.js
CHANGED
|
@@ -5174,6 +5174,10 @@ const inject = ({
|
|
|
5174
5174
|
connectId,
|
|
5175
5175
|
method: 'deviceWipe'
|
|
5176
5176
|
}),
|
|
5177
|
+
deviceFullyUploadResource: connectId => call({
|
|
5178
|
+
connectId,
|
|
5179
|
+
method: 'deviceFullyUploadResource'
|
|
5180
|
+
}),
|
|
5177
5181
|
getPassphraseState: (connectId, params) => call(Object.assign(Object.assign({}, params), {
|
|
5178
5182
|
connectId,
|
|
5179
5183
|
method: 'getPassphraseState'
|
|
@@ -6066,6 +6070,10 @@ const getDeviceModel = features => {
|
|
|
6066
6070
|
return 'model_mini';
|
|
6067
6071
|
}
|
|
6068
6072
|
|
|
6073
|
+
if (!features.model) {
|
|
6074
|
+
return 'model_mini';
|
|
6075
|
+
}
|
|
6076
|
+
|
|
6069
6077
|
if (features.model === '1') {
|
|
6070
6078
|
return 'model_mini';
|
|
6071
6079
|
}
|
|
@@ -16097,6 +16105,16 @@ DataManager.getSysResourcesLatestRelease = (features, forcedUpdateRes) => {
|
|
|
16097
16105
|
return (_d = findLatestRelease(targetDeviceConfig)) === null || _d === void 0 ? void 0 : _d.resource;
|
|
16098
16106
|
};
|
|
16099
16107
|
|
|
16108
|
+
DataManager.getSysFullResource = features => {
|
|
16109
|
+
var _b, _c, _d;
|
|
16110
|
+
|
|
16111
|
+
const deviceType = getDeviceType(features);
|
|
16112
|
+
if (deviceType !== 'pro' && deviceType !== 'touch') return undefined;
|
|
16113
|
+
const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b.firmware) !== null && _c !== void 0 ? _c : [];
|
|
16114
|
+
const targetDeviceConfig = targetDeviceConfigList.filter(item => !!item.fullResource);
|
|
16115
|
+
return (_d = findLatestRelease(targetDeviceConfig)) === null || _d === void 0 ? void 0 : _d.fullResource;
|
|
16116
|
+
};
|
|
16117
|
+
|
|
16100
16118
|
DataManager.getFirmwareChangelog = features => {
|
|
16101
16119
|
var _b, _c;
|
|
16102
16120
|
|
|
@@ -18525,9 +18543,9 @@ const waitBleInstall = updateType => __awaiter(void 0, void 0, void 0, function*
|
|
|
18525
18543
|
const uploadFirmware = (updateType, typedCall, postMessage, device, {
|
|
18526
18544
|
payload
|
|
18527
18545
|
}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18528
|
-
|
|
18546
|
+
const deviceModel = getDeviceModel(device.features);
|
|
18529
18547
|
|
|
18530
|
-
if (
|
|
18548
|
+
if (deviceModel === 'model_mini') {
|
|
18531
18549
|
postConfirmationMessage(device);
|
|
18532
18550
|
postProgressTip(device, 'ConfirmOnDevice', postMessage);
|
|
18533
18551
|
const eraseCommand = updateType === 'firmware' ? 'FirmwareErase' : 'FirmwareErase_ex';
|
|
@@ -18544,7 +18562,7 @@ const uploadFirmware = (updateType, typedCall, postMessage, device, {
|
|
|
18544
18562
|
return message;
|
|
18545
18563
|
}
|
|
18546
18564
|
|
|
18547
|
-
if (
|
|
18565
|
+
if (deviceModel === 'model_touch') {
|
|
18548
18566
|
postConfirmationMessage(device);
|
|
18549
18567
|
postProgressTip(device, 'ConfirmOnDevice', postMessage);
|
|
18550
18568
|
const length = payload.byteLength;
|
|
@@ -18637,6 +18655,65 @@ const updateResources = (typedCall, postMessage, device, source) => __awaiter(vo
|
|
|
18637
18655
|
return true;
|
|
18638
18656
|
});
|
|
18639
18657
|
|
|
18658
|
+
class DeviceFullyUploadResource extends BaseMethod {
|
|
18659
|
+
constructor() {
|
|
18660
|
+
super(...arguments);
|
|
18661
|
+
this.checkPromise = null;
|
|
18662
|
+
|
|
18663
|
+
this.postTipMessage = message => {
|
|
18664
|
+
this.postMessage(createUiMessage(UI_REQUEST.FIRMWARE_TIP, {
|
|
18665
|
+
device: this.device.toMessageObject(),
|
|
18666
|
+
data: {
|
|
18667
|
+
message
|
|
18668
|
+
}
|
|
18669
|
+
}));
|
|
18670
|
+
};
|
|
18671
|
+
}
|
|
18672
|
+
|
|
18673
|
+
init() {
|
|
18674
|
+
this.allowDeviceMode = [UI_REQUEST.BOOTLOADER, UI_REQUEST.INITIALIZE];
|
|
18675
|
+
this.requireDeviceMode = [];
|
|
18676
|
+
this.useDevicePassphraseState = false;
|
|
18677
|
+
}
|
|
18678
|
+
|
|
18679
|
+
isSupportResourceUpdate(features, updateType) {
|
|
18680
|
+
if (updateType !== 'firmware') return false;
|
|
18681
|
+
const deviceType = getDeviceType(features);
|
|
18682
|
+
const isTouchMode = deviceType === 'touch' || deviceType === 'pro';
|
|
18683
|
+
const currentVersion = getDeviceFirmwareVersion(features).join('.');
|
|
18684
|
+
return isTouchMode && semver__default["default"].gte(currentVersion, '3.4.0');
|
|
18685
|
+
}
|
|
18686
|
+
|
|
18687
|
+
run() {
|
|
18688
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18689
|
+
const {
|
|
18690
|
+
device
|
|
18691
|
+
} = this;
|
|
18692
|
+
const {
|
|
18693
|
+
features
|
|
18694
|
+
} = device;
|
|
18695
|
+
|
|
18696
|
+
if (!(features === null || features === void 0 ? void 0 : features.bootloader_mode) && features) {
|
|
18697
|
+
if (features) {
|
|
18698
|
+
this.postTipMessage('CheckLatestUiResource');
|
|
18699
|
+
const resourceUrl = DataManager.getSysFullResource(features);
|
|
18700
|
+
|
|
18701
|
+
if (resourceUrl) {
|
|
18702
|
+
this.postTipMessage('DownloadLatestUiResource');
|
|
18703
|
+
const resource = yield getSysResourceBinary(resourceUrl);
|
|
18704
|
+
this.postTipMessage('DownloadLatestUiResourceSuccess');
|
|
18705
|
+
|
|
18706
|
+
if (resource) {
|
|
18707
|
+
yield updateResources(this.device.getCommands().typedCall.bind(this.device.getCommands()), this.postMessage, device, resource.binary);
|
|
18708
|
+
}
|
|
18709
|
+
}
|
|
18710
|
+
}
|
|
18711
|
+
}
|
|
18712
|
+
});
|
|
18713
|
+
}
|
|
18714
|
+
|
|
18715
|
+
}
|
|
18716
|
+
|
|
18640
18717
|
class FirmwareUpdate$1 extends BaseMethod {
|
|
18641
18718
|
init() {
|
|
18642
18719
|
this.allowDeviceMode = [UI_REQUEST.BOOTLOADER, UI_REQUEST.INITIALIZE];
|
|
@@ -23029,6 +23106,7 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
|
|
|
23029
23106
|
deviceSupportFeatures: DeviceSupportFeatures,
|
|
23030
23107
|
deviceVerify: DeviceVerify,
|
|
23031
23108
|
deviceWipe: DeviceWipe,
|
|
23109
|
+
deviceFullyUploadResource: DeviceFullyUploadResource,
|
|
23032
23110
|
firmwareUpdate: FirmwareUpdate$1,
|
|
23033
23111
|
firmwareUpdateV2: FirmwareUpdate,
|
|
23034
23112
|
requestWebUsbDevice: RequestWebUsbDevice,
|
|
@@ -47838,7 +47916,7 @@ try {
|
|
|
47838
47916
|
/***/ ((module) => {
|
|
47839
47917
|
|
|
47840
47918
|
"use strict";
|
|
47841
|
-
module.exports = JSON.parse('{"name":"@onekeyfe/hd-core","version":"0.2.
|
|
47919
|
+
module.exports = JSON.parse('{"name":"@onekeyfe/hd-core","version":"0.2.2-beta-2","description":"> TODO: description","author":"OneKey","homepage":"https://github.com/OneKeyHQ/hardware-js-sdk#readme","license":"ISC","main":"dist/index.js","types":"dist/index.d.ts","repository":{"type":"git","url":"git+https://github.com/OneKeyHQ/hardware-js-sdk.git"},"publishConfig":{"access":"public"},"scripts":{"dev":"rimraf dist && rollup -c ../../build/rollup.config.js -w","build":"rimraf dist && rollup -c ../../build/rollup.config.js","lint":"eslint .","lint:fix":"eslint . --fix"},"bugs":{"url":"https://github.com/OneKeyHQ/hardware-js-sdk/issues"},"dependencies":{"@onekeyfe/hd-shared":"^0.2.2-beta-2","@onekeyfe/hd-transport":"^0.2.2-beta-2","axios":"^0.27.2","bignumber.js":"^9.0.2","jszip":"^3.10.1","parse-uri":"^1.0.7","semver":"^7.3.7"},"peerDependencies":{"@noble/hashes":"^1.1.3"},"devDependencies":{"@noble/hashes":"^1.1.3","@types/parse-uri":"^1.0.0","@types/semver":"^7.3.9"}}');
|
|
47842
47920
|
|
|
47843
47921
|
/***/ })
|
|
47844
47922
|
|
|
@@ -50365,7 +50443,7 @@ const src_init = async settings => {
|
|
|
50365
50443
|
|
|
50366
50444
|
try {
|
|
50367
50445
|
await init({ ..._settings,
|
|
50368
|
-
version: "0.2.
|
|
50446
|
+
version: "0.2.2-beta-2"
|
|
50369
50447
|
});
|
|
50370
50448
|
return true;
|
|
50371
50449
|
} catch (e) {
|