@onekeyfe/hd-core 0.0.10 → 0.1.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/dist/api/BaseMethod.d.ts +2 -0
- package/dist/api/BaseMethod.d.ts.map +1 -1
- package/dist/api/CheckBLEFirmwareRelease.d.ts +8 -1
- package/dist/api/CheckBLEFirmwareRelease.d.ts.map +1 -1
- package/dist/api/CheckFirmwareRelease.d.ts +8 -1
- package/dist/api/CheckFirmwareRelease.d.ts.map +1 -1
- package/dist/api/FirmwareUpdate.d.ts +14 -0
- package/dist/api/FirmwareUpdate.d.ts.map +1 -0
- package/dist/api/firmware/getBinary.d.ts +33 -0
- package/dist/api/firmware/getBinary.d.ts.map +1 -0
- package/dist/api/firmware/uploadFirmware.d.ts +8 -0
- package/dist/api/firmware/uploadFirmware.d.ts.map +1 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/stellar/StellarSignTransaction.d.ts +1 -1
- package/dist/constants/errors.d.ts +2 -0
- package/dist/constants/errors.d.ts.map +1 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +10 -0
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/device/Device.d.ts +3 -1
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/device/DeviceCommands.d.ts +1 -0
- package/dist/device/DeviceCommands.d.ts.map +1 -1
- package/dist/device/DeviceList.d.ts.map +1 -1
- package/dist/events/call.d.ts +7 -0
- 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 -0
- package/dist/events/iframe.d.ts.map +1 -1
- package/dist/events/ui-request.d.ts +9 -1
- package/dist/events/ui-request.d.ts.map +1 -1
- package/dist/index.d.ts +108 -9
- package/dist/index.js +269 -50
- package/dist/inject.d.ts.map +1 -1
- package/dist/types/api/checkBLEFirmwareRelease.d.ts +12 -2
- package/dist/types/api/checkBLEFirmwareRelease.d.ts.map +1 -1
- package/dist/types/api/checkFirmwareRelease.d.ts +11 -1
- package/dist/types/api/checkFirmwareRelease.d.ts.map +1 -1
- package/dist/types/api/firmwareUpdate.d.ts +13 -0
- package/dist/types/api/firmwareUpdate.d.ts.map +1 -0
- package/dist/types/api/index.d.ts +3 -1
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/device.d.ts +38 -0
- package/dist/types/device.d.ts.map +1 -1
- package/dist/types/firmware.d.ts +2 -1
- package/dist/types/firmware.d.ts.map +1 -1
- package/dist/types/params.d.ts +3 -0
- package/dist/types/params.d.ts.map +1 -1
- package/dist/utils/assets.d.ts +1 -1
- package/dist/utils/assets.d.ts.map +1 -1
- package/dist/utils/networkUtils.d.ts.map +1 -1
- package/dist/utils/release.d.ts +4 -0
- package/dist/utils/release.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/api/BaseMethod.ts +4 -0
- package/src/api/CheckBLEFirmwareRelease.ts +7 -1
- package/src/api/CheckFirmwareRelease.ts +7 -1
- package/src/api/FirmwareUpdate.ts +78 -0
- package/src/api/firmware/getBinary.ts +46 -0
- package/src/api/firmware/uploadFirmware.ts +72 -0
- package/src/api/index.ts +2 -0
- package/src/constants/errors.ts +2 -0
- package/src/core/index.ts +29 -1
- package/src/data-manager/DataManager.ts +36 -20
- package/src/device/Device.ts +22 -11
- package/src/device/DeviceCommands.ts +6 -0
- package/src/device/DeviceList.ts +13 -1
- package/src/events/call.ts +6 -0
- package/src/events/core.ts +2 -1
- package/src/events/iframe.ts +1 -0
- package/src/events/ui-request.ts +15 -1
- package/src/inject.ts +2 -0
- package/src/types/api/checkBLEFirmwareRelease.ts +12 -4
- package/src/types/api/checkFirmwareRelease.ts +11 -1
- package/src/types/api/firmwareUpdate.ts +21 -0
- package/src/types/api/index.ts +4 -1
- package/src/types/device.ts +44 -0
- package/src/types/firmware.ts +2 -1
- package/src/types/params.ts +2 -0
- package/src/utils/assets.ts +1 -1
- package/src/utils/networkUtils.ts +3 -1
- package/src/utils/release.ts +24 -0
package/dist/index.js
CHANGED
|
@@ -67,6 +67,7 @@ const inject = ({ call, cancel, dispose, eventEmitter, init, uiResponse, }) => {
|
|
|
67
67
|
solSignTransaction: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'solSignTransaction' })),
|
|
68
68
|
stellarGetAddress: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'stellarGetAddress' })),
|
|
69
69
|
stellarSignTransaction: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'stellarSignTransaction' })),
|
|
70
|
+
firmwareUpdate: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'firmwareUpdate' })),
|
|
70
71
|
};
|
|
71
72
|
return api;
|
|
72
73
|
};
|
|
@@ -608,11 +609,13 @@ const ERROR_CODES = {
|
|
|
608
609
|
Method_InvalidParameter: '',
|
|
609
610
|
Call_API: '',
|
|
610
611
|
Call_NotResponse: 'No response data',
|
|
612
|
+
Method_FirmwareUpdate_DownloadFailed: '',
|
|
611
613
|
Transport_InvalidProtobuf: '',
|
|
612
614
|
Device_FwException: '',
|
|
613
615
|
Device_UnexpectedMode: '',
|
|
614
616
|
Device_CallInProgress: '',
|
|
615
617
|
Device_InitializeFailed: '',
|
|
618
|
+
Device_Interrupted: 'The device is performing other operations',
|
|
616
619
|
Not_Use_Onekey_Device: 'Please use onekey device',
|
|
617
620
|
Runtime: '',
|
|
618
621
|
Init_NotInitialized: 'Init_NotInitialized',
|
|
@@ -656,7 +659,7 @@ const colors = {
|
|
|
656
659
|
Transport: 'color: #ffb6c1; background: #000;',
|
|
657
660
|
};
|
|
658
661
|
const MAX_ENTRIES = 100;
|
|
659
|
-
class Log$
|
|
662
|
+
class Log$6 {
|
|
660
663
|
constructor(prefix, enabled) {
|
|
661
664
|
this.prefix = prefix;
|
|
662
665
|
this.enabled = enabled;
|
|
@@ -706,7 +709,7 @@ class Log$5 {
|
|
|
706
709
|
}
|
|
707
710
|
const _logs = {};
|
|
708
711
|
const initLog = (prefix, enabled) => {
|
|
709
|
-
const instance = new Log$
|
|
712
|
+
const instance = new Log$6(prefix, !!enabled);
|
|
710
713
|
_logs[prefix] = instance;
|
|
711
714
|
return instance;
|
|
712
715
|
};
|
|
@@ -720,20 +723,21 @@ const httpRequest$1 = (url, type = 'text') => __awaiter(void 0, void 0, void 0,
|
|
|
720
723
|
const response = yield axios__default["default"].request({
|
|
721
724
|
url,
|
|
722
725
|
withCredentials: false,
|
|
726
|
+
responseType: type === 'binary' ? 'arraybuffer' : 'json',
|
|
723
727
|
});
|
|
724
728
|
if (+response.status === 200) {
|
|
725
729
|
if (type === 'json') {
|
|
726
730
|
return response.data;
|
|
727
731
|
}
|
|
728
732
|
if (type === 'binary') {
|
|
729
|
-
return response.data
|
|
733
|
+
return response.data;
|
|
730
734
|
}
|
|
731
735
|
return response.data;
|
|
732
736
|
}
|
|
733
737
|
throw new Error(`httpRequest error: ${url} ${response.statusText}`);
|
|
734
738
|
});
|
|
735
739
|
|
|
736
|
-
const httpRequest = (url,
|
|
740
|
+
const httpRequest = (url, type) => httpRequest$1(url, type);
|
|
737
741
|
const getTimeStamp = () => new Date().getTime();
|
|
738
742
|
|
|
739
743
|
const VER_NUMS = 3;
|
|
@@ -9751,6 +9755,21 @@ var MessagesJSON = {
|
|
|
9751
9755
|
nested: nested
|
|
9752
9756
|
};
|
|
9753
9757
|
|
|
9758
|
+
const getReleaseStatus = (releases, currentVersion) => {
|
|
9759
|
+
const newVersions = releases.filter(r => semver__default["default"].gt(r.version.join('.'), currentVersion));
|
|
9760
|
+
if (newVersions.length === 0) {
|
|
9761
|
+
return 'valid';
|
|
9762
|
+
}
|
|
9763
|
+
if (newVersions.some(r => r.required)) {
|
|
9764
|
+
return 'required';
|
|
9765
|
+
}
|
|
9766
|
+
return 'outdated';
|
|
9767
|
+
};
|
|
9768
|
+
const getReleaseChangelog = (releases, currentVersion) => {
|
|
9769
|
+
const newVersions = releases.filter(r => semver__default["default"].gt(r.version.join('.'), currentVersion));
|
|
9770
|
+
return newVersions.map(r => r.changelog);
|
|
9771
|
+
};
|
|
9772
|
+
|
|
9754
9773
|
var _a;
|
|
9755
9774
|
class DataManager {
|
|
9756
9775
|
static load(settings) {
|
|
@@ -9818,17 +9837,26 @@ DataManager.getFirmwareStatus = (features) => {
|
|
|
9818
9837
|
return 'unknown';
|
|
9819
9838
|
}
|
|
9820
9839
|
const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b.firmware) !== null && _c !== void 0 ? _c : [];
|
|
9821
|
-
const latestFirmware = targetDeviceConfigList[targetDeviceConfigList.length - 1];
|
|
9822
|
-
if (!latestFirmware)
|
|
9823
|
-
return 'valid';
|
|
9824
|
-
const latestVersion = latestFirmware.version.join('.');
|
|
9825
9840
|
const currentVersion = deviceFirmwareVersion.join('.');
|
|
9826
|
-
|
|
9827
|
-
|
|
9828
|
-
|
|
9829
|
-
|
|
9841
|
+
return getReleaseStatus(targetDeviceConfigList, currentVersion);
|
|
9842
|
+
};
|
|
9843
|
+
DataManager.getFirmwareChangelog = (features) => {
|
|
9844
|
+
var _b, _c;
|
|
9845
|
+
const deviceType = getDeviceType(features);
|
|
9846
|
+
const deviceFirmwareVersion = getDeviceFirmwareVersion(features);
|
|
9847
|
+
if (features.firmware_present === false ||
|
|
9848
|
+
(deviceType === 'classic' && features.bootloader_mode)) {
|
|
9849
|
+
return [];
|
|
9830
9850
|
}
|
|
9831
|
-
|
|
9851
|
+
const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b.firmware) !== null && _c !== void 0 ? _c : [];
|
|
9852
|
+
const currentVersion = deviceFirmwareVersion.join('.');
|
|
9853
|
+
return getReleaseChangelog(targetDeviceConfigList, currentVersion);
|
|
9854
|
+
};
|
|
9855
|
+
DataManager.getFirmwareLeatestRelease = (features) => {
|
|
9856
|
+
var _b, _c;
|
|
9857
|
+
const deviceType = getDeviceType(features);
|
|
9858
|
+
const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b.firmware) !== null && _c !== void 0 ? _c : [];
|
|
9859
|
+
return targetDeviceConfigList[targetDeviceConfigList.length - 1];
|
|
9832
9860
|
};
|
|
9833
9861
|
DataManager.getBLEFirmwareStatus = (features) => {
|
|
9834
9862
|
var _b, _c;
|
|
@@ -9838,17 +9866,25 @@ DataManager.getBLEFirmwareStatus = (features) => {
|
|
|
9838
9866
|
return 'none';
|
|
9839
9867
|
}
|
|
9840
9868
|
const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b.ble) !== null && _c !== void 0 ? _c : [];
|
|
9841
|
-
const latestBLEFirmware = targetDeviceConfigList[targetDeviceConfigList.length - 1];
|
|
9842
|
-
if (!latestBLEFirmware)
|
|
9843
|
-
return 'valid';
|
|
9844
|
-
const latestVersion = latestBLEFirmware.version.join('.');
|
|
9845
9869
|
const currentVersion = deviceBLEFirmwareVersion.join('.');
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
|
|
9870
|
+
return getReleaseStatus(targetDeviceConfigList, currentVersion);
|
|
9871
|
+
};
|
|
9872
|
+
DataManager.getBleFirmwareChangelog = (features) => {
|
|
9873
|
+
var _b, _c;
|
|
9874
|
+
const deviceType = getDeviceType(features);
|
|
9875
|
+
const deviceBLEFirmwareVersion = getDeviceBLEFirmwareVersion(features);
|
|
9876
|
+
if (!deviceBLEFirmwareVersion) {
|
|
9877
|
+
return [];
|
|
9850
9878
|
}
|
|
9851
|
-
|
|
9879
|
+
const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b.ble) !== null && _c !== void 0 ? _c : [];
|
|
9880
|
+
const currentVersion = deviceBLEFirmwareVersion.join('.');
|
|
9881
|
+
return getReleaseChangelog(targetDeviceConfigList, currentVersion);
|
|
9882
|
+
};
|
|
9883
|
+
DataManager.getBleFirmwareLeatestRelease = (features) => {
|
|
9884
|
+
var _b, _c;
|
|
9885
|
+
const deviceType = getDeviceType(features);
|
|
9886
|
+
const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b.ble) !== null && _c !== void 0 ? _c : [];
|
|
9887
|
+
return targetDeviceConfigList[targetDeviceConfigList.length - 1];
|
|
9852
9888
|
};
|
|
9853
9889
|
DataManager.getTransportStatus = (localVersion) => {
|
|
9854
9890
|
var _b, _c;
|
|
@@ -9859,7 +9895,7 @@ DataManager.getTransportStatus = (localVersion) => {
|
|
|
9859
9895
|
return isLatest ? 'valid' : 'outdated';
|
|
9860
9896
|
};
|
|
9861
9897
|
|
|
9862
|
-
const Log$
|
|
9898
|
+
const Log$5 = initLog('Transport');
|
|
9863
9899
|
class TransportManager {
|
|
9864
9900
|
static load() {
|
|
9865
9901
|
console.log('transport manager load');
|
|
@@ -9870,25 +9906,25 @@ class TransportManager {
|
|
|
9870
9906
|
return __awaiter(this, void 0, void 0, function* () {
|
|
9871
9907
|
try {
|
|
9872
9908
|
const env = DataManager.getSettings('env');
|
|
9873
|
-
Log$
|
|
9909
|
+
Log$5.debug('Initializing transports');
|
|
9874
9910
|
if (env === 'react-native') {
|
|
9875
9911
|
if (!this.reactNativeInit) {
|
|
9876
9912
|
yield this.transport.init();
|
|
9877
9913
|
this.reactNativeInit = true;
|
|
9878
9914
|
}
|
|
9879
9915
|
else {
|
|
9880
|
-
Log$
|
|
9916
|
+
Log$5.debug('React Native Do Not Initializing transports');
|
|
9881
9917
|
}
|
|
9882
9918
|
}
|
|
9883
9919
|
else {
|
|
9884
9920
|
yield this.transport.init();
|
|
9885
9921
|
}
|
|
9886
|
-
Log$
|
|
9922
|
+
Log$5.debug('Configuring transports');
|
|
9887
9923
|
yield this.transport.configure(JSON.stringify(this.defaultMessages));
|
|
9888
|
-
Log$
|
|
9924
|
+
Log$5.debug('Configuring transports done');
|
|
9889
9925
|
}
|
|
9890
9926
|
catch (error) {
|
|
9891
|
-
Log$
|
|
9927
|
+
Log$5.debug('Initializing transports error: ', error);
|
|
9892
9928
|
}
|
|
9893
9929
|
});
|
|
9894
9930
|
}
|
|
@@ -9963,6 +9999,7 @@ const UI_REQUEST$1 = {
|
|
|
9963
9999
|
CLOSE_UI_WINDOW: 'ui-close_window',
|
|
9964
10000
|
BLUETOOTH_PERMISSION: 'ui-bluetooth_permission',
|
|
9965
10001
|
LOCATION_PERMISSION: 'ui-location_permission',
|
|
10002
|
+
FIRMWARE_PROGRESS: 'ui-firmware-progress',
|
|
9966
10003
|
};
|
|
9967
10004
|
const createUiMessage = (type, payload) => ({
|
|
9968
10005
|
event: UI_EVENT,
|
|
@@ -9974,6 +10011,7 @@ const IFRAME = {
|
|
|
9974
10011
|
INIT: 'iframe-init',
|
|
9975
10012
|
INIT_BRIDGE: 'iframe-init-bridge',
|
|
9976
10013
|
CALL: 'iframe-call',
|
|
10014
|
+
CANCEL: 'iframe-cancel',
|
|
9977
10015
|
};
|
|
9978
10016
|
const createIFrameMessage = (type, payload) => ({
|
|
9979
10017
|
event: UI_EVENT,
|
|
@@ -10030,7 +10068,7 @@ const assertType = (res, resType) => {
|
|
|
10030
10068
|
throw TypedError('Runtime', `assertType: Response of unexpected type: ${res.type}. Should be ${resType}`);
|
|
10031
10069
|
}
|
|
10032
10070
|
};
|
|
10033
|
-
const Log$
|
|
10071
|
+
const Log$4 = initLog('DeviceCommands');
|
|
10034
10072
|
class DeviceCommands {
|
|
10035
10073
|
constructor(device, mainId) {
|
|
10036
10074
|
this.device = device;
|
|
@@ -10039,8 +10077,13 @@ class DeviceCommands {
|
|
|
10039
10077
|
this.disposed = false;
|
|
10040
10078
|
}
|
|
10041
10079
|
dispose() {
|
|
10080
|
+
var _a, _b;
|
|
10042
10081
|
this.disposed = true;
|
|
10082
|
+
if (this._cancelableRequest) {
|
|
10083
|
+
this._cancelableRequest();
|
|
10084
|
+
}
|
|
10043
10085
|
this._cancelableRequest = undefined;
|
|
10086
|
+
(_b = (_a = this.transport).cancel) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
10044
10087
|
}
|
|
10045
10088
|
call(type, msg = {}) {
|
|
10046
10089
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -10049,11 +10092,11 @@ class DeviceCommands {
|
|
|
10049
10092
|
const promise = this.transport.call(this.mainId, type, msg);
|
|
10050
10093
|
this.callPromise = promise;
|
|
10051
10094
|
const res = yield promise;
|
|
10052
|
-
Log$
|
|
10095
|
+
Log$4.debug('[DeviceCommands] [call] Received', res.type);
|
|
10053
10096
|
return res;
|
|
10054
10097
|
}
|
|
10055
10098
|
catch (error) {
|
|
10056
|
-
Log$
|
|
10099
|
+
Log$4.debug('[DeviceCommands] [call] Received error', error);
|
|
10057
10100
|
throw error;
|
|
10058
10101
|
}
|
|
10059
10102
|
});
|
|
@@ -10246,7 +10289,7 @@ const parseRunOptions = (options) => {
|
|
|
10246
10289
|
options = {};
|
|
10247
10290
|
return options;
|
|
10248
10291
|
};
|
|
10249
|
-
const Log$
|
|
10292
|
+
const Log$3 = initLog('Device');
|
|
10250
10293
|
class Device extends events.exports {
|
|
10251
10294
|
constructor(descriptor) {
|
|
10252
10295
|
super();
|
|
@@ -10257,7 +10300,6 @@ class Device extends events.exports {
|
|
|
10257
10300
|
this.unavailableCapabilities = {};
|
|
10258
10301
|
this.instance = 0;
|
|
10259
10302
|
this.internalState = [];
|
|
10260
|
-
this.loaded = false;
|
|
10261
10303
|
this.needReloadDevice = false;
|
|
10262
10304
|
this.keepSession = false;
|
|
10263
10305
|
this.originalDescriptor = descriptor;
|
|
@@ -10326,11 +10368,11 @@ class Device extends events.exports {
|
|
|
10326
10368
|
if (env === 'react-native') {
|
|
10327
10369
|
const res = yield ((_a = this.deviceConnector) === null || _a === void 0 ? void 0 : _a.acquire(this.originalDescriptor.id));
|
|
10328
10370
|
this.mainId = (_b = res.uuid) !== null && _b !== void 0 ? _b : '';
|
|
10329
|
-
Log$
|
|
10371
|
+
Log$3.debug('Expected uuid:', this.mainId);
|
|
10330
10372
|
}
|
|
10331
10373
|
else {
|
|
10332
10374
|
this.mainId = yield ((_c = this.deviceConnector) === null || _c === void 0 ? void 0 : _c.acquire(this.originalDescriptor.path, this.originalDescriptor.session));
|
|
10333
|
-
Log$
|
|
10375
|
+
Log$3.debug('Expected session id:', this.mainId);
|
|
10334
10376
|
}
|
|
10335
10377
|
this.updateDescriptor({ [mainIdKey]: this.mainId });
|
|
10336
10378
|
if (this.commands) {
|
|
@@ -10371,7 +10413,7 @@ class Device extends events.exports {
|
|
|
10371
10413
|
this.updateDescriptor({ session: null });
|
|
10372
10414
|
}
|
|
10373
10415
|
catch (err) {
|
|
10374
|
-
Log$
|
|
10416
|
+
Log$3.error('[Device] release error: ', err);
|
|
10375
10417
|
}
|
|
10376
10418
|
finally {
|
|
10377
10419
|
this.needReloadDevice = true;
|
|
@@ -10379,6 +10421,9 @@ class Device extends events.exports {
|
|
|
10379
10421
|
}
|
|
10380
10422
|
});
|
|
10381
10423
|
}
|
|
10424
|
+
getCommands() {
|
|
10425
|
+
return this.commands;
|
|
10426
|
+
}
|
|
10382
10427
|
getInternalState() {
|
|
10383
10428
|
return this.internalState[this.instance];
|
|
10384
10429
|
}
|
|
@@ -10421,11 +10466,19 @@ class Device extends events.exports {
|
|
|
10421
10466
|
this.originalDescriptor.session = upcomingSession;
|
|
10422
10467
|
}
|
|
10423
10468
|
}
|
|
10469
|
+
updateFromCache(device) {
|
|
10470
|
+
this.mainId = device.mainId;
|
|
10471
|
+
this.commands = device.commands;
|
|
10472
|
+
this.updateDescriptor(device.originalDescriptor);
|
|
10473
|
+
if (device.features) {
|
|
10474
|
+
this._updateFeatures(device.features);
|
|
10475
|
+
}
|
|
10476
|
+
}
|
|
10424
10477
|
run(fn, options) {
|
|
10425
10478
|
return __awaiter(this, void 0, void 0, function* () {
|
|
10426
10479
|
if (this.runPromise) {
|
|
10427
|
-
|
|
10428
|
-
|
|
10480
|
+
this.interruption();
|
|
10481
|
+
Log$3.debug('[Device] run error:', 'Device is running, but will cancel previous operate');
|
|
10429
10482
|
}
|
|
10430
10483
|
options = parseRunOptions(options);
|
|
10431
10484
|
this.runPromise = create(this._runInner.bind(this, fn, options));
|
|
@@ -10452,24 +10505,26 @@ class Device extends events.exports {
|
|
|
10452
10505
|
if (fn) {
|
|
10453
10506
|
yield fn();
|
|
10454
10507
|
}
|
|
10455
|
-
if (this.loaded && this.features) {
|
|
10456
|
-
yield this.getFeatures();
|
|
10457
|
-
}
|
|
10458
10508
|
if ((!this.keepSession && typeof options.keepSession !== 'boolean') ||
|
|
10459
10509
|
options.keepSession === false) {
|
|
10460
10510
|
this.keepSession = false;
|
|
10461
10511
|
yield this.release();
|
|
10462
|
-
Log$
|
|
10512
|
+
Log$3.debug('release device, mainId: ', this.mainId);
|
|
10463
10513
|
}
|
|
10464
10514
|
if (this.runPromise) {
|
|
10465
10515
|
this.runPromise.resolve();
|
|
10466
10516
|
}
|
|
10467
10517
|
this.runPromise = null;
|
|
10468
|
-
if (!this.loaded) {
|
|
10469
|
-
this.loaded = true;
|
|
10470
|
-
}
|
|
10471
10518
|
});
|
|
10472
10519
|
}
|
|
10520
|
+
interruption() {
|
|
10521
|
+
if (this.commands) {
|
|
10522
|
+
this.commands.dispose();
|
|
10523
|
+
}
|
|
10524
|
+
if (this.runPromise) {
|
|
10525
|
+
this.runPromise.reject(TypedError('Device_Interrupted'));
|
|
10526
|
+
}
|
|
10527
|
+
}
|
|
10473
10528
|
getMode() {
|
|
10474
10529
|
var _a, _b, _c;
|
|
10475
10530
|
if ((_a = this.features) === null || _a === void 0 ? void 0 : _a.bootloader_mode)
|
|
@@ -10534,6 +10589,8 @@ class Device extends events.exports {
|
|
|
10534
10589
|
}
|
|
10535
10590
|
}
|
|
10536
10591
|
|
|
10592
|
+
const cacheDeviceMap = new Map();
|
|
10593
|
+
const Log$2 = initLog('DeviceList');
|
|
10537
10594
|
class DeviceList extends events.exports {
|
|
10538
10595
|
constructor() {
|
|
10539
10596
|
super(...arguments);
|
|
@@ -10551,7 +10608,7 @@ class DeviceList extends events.exports {
|
|
|
10551
10608
|
try {
|
|
10552
10609
|
for (var descriptorList_1 = __asyncValues(descriptorList), descriptorList_1_1; descriptorList_1_1 = yield descriptorList_1.next(), !descriptorList_1_1.done;) {
|
|
10553
10610
|
const descriptor = descriptorList_1_1.value;
|
|
10554
|
-
|
|
10611
|
+
let device = Device.fromDescriptor(descriptor);
|
|
10555
10612
|
device.deviceConnector = this.connector;
|
|
10556
10613
|
yield device.connect();
|
|
10557
10614
|
yield device.initialize();
|
|
@@ -10559,7 +10616,14 @@ class DeviceList extends events.exports {
|
|
|
10559
10616
|
deviceList.push(device);
|
|
10560
10617
|
if (device.features) {
|
|
10561
10618
|
const uuid = getDeviceUUID(device.features);
|
|
10619
|
+
if (cacheDeviceMap.has(uuid)) {
|
|
10620
|
+
const cache = cacheDeviceMap.get(uuid);
|
|
10621
|
+
cache === null || cache === void 0 ? void 0 : cache.updateFromCache(device);
|
|
10622
|
+
device = cache;
|
|
10623
|
+
Log$2.debug('use cache device: ', uuid);
|
|
10624
|
+
}
|
|
10562
10625
|
this.devices[uuid] = device;
|
|
10626
|
+
cacheDeviceMap.set(uuid, device);
|
|
10563
10627
|
}
|
|
10564
10628
|
}
|
|
10565
10629
|
}
|
|
@@ -11555,7 +11619,13 @@ class CheckFirmwareRelease extends BaseMethod {
|
|
|
11555
11619
|
run() {
|
|
11556
11620
|
if (this.device.features) {
|
|
11557
11621
|
const firmwareStatus = DataManager.getFirmwareStatus(this.device.features);
|
|
11558
|
-
|
|
11622
|
+
const changelog = DataManager.getFirmwareChangelog(this.device.features);
|
|
11623
|
+
const release = DataManager.getFirmwareLeatestRelease(this.device.features);
|
|
11624
|
+
return Promise.resolve({
|
|
11625
|
+
status: firmwareStatus,
|
|
11626
|
+
changelog,
|
|
11627
|
+
release,
|
|
11628
|
+
});
|
|
11559
11629
|
}
|
|
11560
11630
|
return Promise.resolve(null);
|
|
11561
11631
|
}
|
|
@@ -11568,7 +11638,13 @@ class CheckBLEFirmwareRelease extends BaseMethod {
|
|
|
11568
11638
|
run() {
|
|
11569
11639
|
if (this.device.features) {
|
|
11570
11640
|
const firmwareStatus = DataManager.getBLEFirmwareStatus(this.device.features);
|
|
11571
|
-
|
|
11641
|
+
const changelog = DataManager.getBleFirmwareChangelog(this.device.features);
|
|
11642
|
+
const release = DataManager.getBleFirmwareLeatestRelease(this.device.features);
|
|
11643
|
+
return Promise.resolve({
|
|
11644
|
+
status: firmwareStatus,
|
|
11645
|
+
changelog,
|
|
11646
|
+
release,
|
|
11647
|
+
});
|
|
11572
11648
|
}
|
|
11573
11649
|
return Promise.resolve(null);
|
|
11574
11650
|
}
|
|
@@ -12830,6 +12906,120 @@ class StellarSignTransaction extends BaseMethod {
|
|
|
12830
12906
|
}
|
|
12831
12907
|
}
|
|
12832
12908
|
|
|
12909
|
+
const getBinary = ({ features, updateType, version }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
12910
|
+
const releaseInfo = getInfo({ features, updateType });
|
|
12911
|
+
if (!releaseInfo) {
|
|
12912
|
+
throw TypedError('Runtime', 'no firmware found for this device');
|
|
12913
|
+
}
|
|
12914
|
+
if (version &&
|
|
12915
|
+
!semver__default["default"].eq(releaseInfo.version, version)) {
|
|
12916
|
+
throw TypedError('Runtime', 'firmware version mismatch');
|
|
12917
|
+
}
|
|
12918
|
+
const url = updateType === 'ble' ? releaseInfo.webUpdate : releaseInfo.url;
|
|
12919
|
+
const fw = yield httpRequest(url, 'binary');
|
|
12920
|
+
return Object.assign(Object.assign({}, releaseInfo), { binary: fw });
|
|
12921
|
+
});
|
|
12922
|
+
const getInfo = ({ features, updateType }) => {
|
|
12923
|
+
var _a, _b, _c;
|
|
12924
|
+
const deviceType = getDeviceType(features);
|
|
12925
|
+
const { deviceMap } = DataManager;
|
|
12926
|
+
const releaseInfo = (_c = (_b = (_a = deviceMap === null || deviceMap === void 0 ? void 0 : deviceMap[deviceType]) === null || _a === void 0 ? void 0 : _a[updateType]) === null || _b === void 0 ? void 0 : _b[0]) !== null && _c !== void 0 ? _c : null;
|
|
12927
|
+
return releaseInfo;
|
|
12928
|
+
};
|
|
12929
|
+
|
|
12930
|
+
const postConfirmationMessage = (device) => {
|
|
12931
|
+
var _a;
|
|
12932
|
+
if ((_a = device.features) === null || _a === void 0 ? void 0 : _a.firmware_present) {
|
|
12933
|
+
device.emit(DEVICE.BUTTON, device, { code: 'ButtonRequest_FirmwareUpdate' });
|
|
12934
|
+
}
|
|
12935
|
+
};
|
|
12936
|
+
const postProgressMessage = (device, progress, postMessage) => {
|
|
12937
|
+
postMessage(createUiMessage(UI_REQUEST$1.FIRMWARE_PROGRESS, {
|
|
12938
|
+
device: device.toMessageObject(),
|
|
12939
|
+
progress,
|
|
12940
|
+
}));
|
|
12941
|
+
};
|
|
12942
|
+
const uploadFirmware = (updateType, typedCall, postMessage, device, { payload }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
12943
|
+
var _a, _b;
|
|
12944
|
+
if (((_a = device.features) === null || _a === void 0 ? void 0 : _a.major_version) === 1) {
|
|
12945
|
+
postConfirmationMessage(device);
|
|
12946
|
+
const eraseCommand = updateType === 'firmware' ? 'FirmwareErase' : 'FirmwareErase_ex';
|
|
12947
|
+
yield typedCall(eraseCommand, 'Success', {});
|
|
12948
|
+
postProgressMessage(device, 0, postMessage);
|
|
12949
|
+
const { message } = yield typedCall('FirmwareUpload', 'Success', {
|
|
12950
|
+
payload,
|
|
12951
|
+
});
|
|
12952
|
+
return message;
|
|
12953
|
+
}
|
|
12954
|
+
if (((_b = device.features) === null || _b === void 0 ? void 0 : _b.major_version) === 2) {
|
|
12955
|
+
postConfirmationMessage(device);
|
|
12956
|
+
const length = payload.byteLength;
|
|
12957
|
+
let response = yield typedCall('FirmwareErase', ['FirmwareRequest', 'Success'], { length });
|
|
12958
|
+
while (response.type !== 'Success') {
|
|
12959
|
+
const start = response.message.offset;
|
|
12960
|
+
const end = response.message.offset + response.message.length;
|
|
12961
|
+
const chunk = payload.slice(start, end);
|
|
12962
|
+
if (start > 0) {
|
|
12963
|
+
postProgressMessage(device, Math.round((start / length) * 100), postMessage);
|
|
12964
|
+
}
|
|
12965
|
+
response = yield typedCall('FirmwareUpload', ['FirmwareRequest', 'Success'], {
|
|
12966
|
+
payload: chunk,
|
|
12967
|
+
});
|
|
12968
|
+
}
|
|
12969
|
+
postProgressMessage(device, 100, postMessage);
|
|
12970
|
+
return response.message;
|
|
12971
|
+
}
|
|
12972
|
+
throw TypedError('Runtime', 'uploadFirmware: unknown major_version');
|
|
12973
|
+
});
|
|
12974
|
+
|
|
12975
|
+
class FirmwareUpdate extends BaseMethod {
|
|
12976
|
+
init() {
|
|
12977
|
+
this.allowDeviceMode = [UI_REQUEST.BOOTLOADER, UI_REQUEST.INITIALIZE];
|
|
12978
|
+
this.requireDeviceMode = [UI_REQUEST.BOOTLOADER];
|
|
12979
|
+
const { payload } = this;
|
|
12980
|
+
validateParams(payload, [
|
|
12981
|
+
{ name: 'version', type: 'array' },
|
|
12982
|
+
{ name: 'binary', type: 'buffer' },
|
|
12983
|
+
]);
|
|
12984
|
+
if (!payload.updateType) {
|
|
12985
|
+
throw TypedError('Method_InvalidParameter', 'updateType is required');
|
|
12986
|
+
}
|
|
12987
|
+
this.params = { updateType: payload.updateType };
|
|
12988
|
+
if ('version' in payload) {
|
|
12989
|
+
this.params = Object.assign(Object.assign({}, this.params), { version: payload.version });
|
|
12990
|
+
}
|
|
12991
|
+
if ('binary' in payload) {
|
|
12992
|
+
this.params = Object.assign(Object.assign({}, this.params), { binary: payload.binary });
|
|
12993
|
+
}
|
|
12994
|
+
}
|
|
12995
|
+
run() {
|
|
12996
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
12997
|
+
const { device, params } = this;
|
|
12998
|
+
let binary;
|
|
12999
|
+
try {
|
|
13000
|
+
if (params.binary) {
|
|
13001
|
+
binary = this.params.binary;
|
|
13002
|
+
}
|
|
13003
|
+
else {
|
|
13004
|
+
if (!device.features) {
|
|
13005
|
+
throw TypedError('Runtime', 'no features found for this device');
|
|
13006
|
+
}
|
|
13007
|
+
const firmware = yield getBinary({
|
|
13008
|
+
features: device.features,
|
|
13009
|
+
version: params.version,
|
|
13010
|
+
updateType: params.updateType,
|
|
13011
|
+
});
|
|
13012
|
+
binary = firmware.binary;
|
|
13013
|
+
}
|
|
13014
|
+
}
|
|
13015
|
+
catch (err) {
|
|
13016
|
+
throw TypedError('Method_FirmwareUpdate_DownloadFailed', err);
|
|
13017
|
+
}
|
|
13018
|
+
return uploadFirmware(params.updateType, this.device.getCommands().typedCall.bind(this.device.getCommands()), this.postMessage, device, { payload: binary });
|
|
13019
|
+
});
|
|
13020
|
+
}
|
|
13021
|
+
}
|
|
13022
|
+
|
|
12833
13023
|
var ApiMethods = /*#__PURE__*/Object.freeze({
|
|
12834
13024
|
__proto__: null,
|
|
12835
13025
|
searchDevices: SearchDevices,
|
|
@@ -12869,7 +13059,8 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
|
|
|
12869
13059
|
solGetAddress: SolGetAddress,
|
|
12870
13060
|
solSignTransaction: SolSignTransaction,
|
|
12871
13061
|
stellarGetAddress: StellarGetAddress,
|
|
12872
|
-
stellarSignTransaction: StellarSignTransaction
|
|
13062
|
+
stellarSignTransaction: StellarSignTransaction,
|
|
13063
|
+
firmwareUpdate: FirmwareUpdate
|
|
12873
13064
|
});
|
|
12874
13065
|
|
|
12875
13066
|
function findMethod(message) {
|
|
@@ -13033,6 +13224,7 @@ let _deviceList;
|
|
|
13033
13224
|
let _connector;
|
|
13034
13225
|
let _uiPromises = [];
|
|
13035
13226
|
let _callPromise;
|
|
13227
|
+
const deviceCacheMap = new Map();
|
|
13036
13228
|
const callAPI = (message) => __awaiter(void 0, void 0, void 0, function* () {
|
|
13037
13229
|
var _a, _b;
|
|
13038
13230
|
if (!message.id || !message.payload || message.type !== IFRAME.CALL) {
|
|
@@ -13043,6 +13235,7 @@ const callAPI = (message) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
13043
13235
|
try {
|
|
13044
13236
|
method = findMethod(message);
|
|
13045
13237
|
method.connector = _connector;
|
|
13238
|
+
method.postMessage = postMessage;
|
|
13046
13239
|
method.init();
|
|
13047
13240
|
}
|
|
13048
13241
|
catch (error) {
|
|
@@ -13192,10 +13385,32 @@ function initDeviceForBle(method) {
|
|
|
13192
13385
|
if (!method.connectId) {
|
|
13193
13386
|
return initDevice(method);
|
|
13194
13387
|
}
|
|
13195
|
-
|
|
13388
|
+
let device;
|
|
13389
|
+
if (deviceCacheMap.has(method.connectId)) {
|
|
13390
|
+
device = deviceCacheMap.get(method.connectId);
|
|
13391
|
+
}
|
|
13392
|
+
else {
|
|
13393
|
+
device = Device.fromDescriptor({ id: method.connectId });
|
|
13394
|
+
deviceCacheMap.set(method.connectId, device);
|
|
13395
|
+
}
|
|
13196
13396
|
device.deviceConnector = _connector;
|
|
13197
13397
|
return device;
|
|
13198
13398
|
}
|
|
13399
|
+
const cancel = (connectId) => {
|
|
13400
|
+
const env = DataManager.getSettings('env');
|
|
13401
|
+
if (connectId) {
|
|
13402
|
+
let device;
|
|
13403
|
+
if (env === 'react-native') {
|
|
13404
|
+
device = initDeviceForBle({ connectId });
|
|
13405
|
+
}
|
|
13406
|
+
else {
|
|
13407
|
+
device = initDevice({ connectId });
|
|
13408
|
+
}
|
|
13409
|
+
device === null || device === void 0 ? void 0 : device.interruption();
|
|
13410
|
+
}
|
|
13411
|
+
cleanup();
|
|
13412
|
+
closePopup();
|
|
13413
|
+
};
|
|
13199
13414
|
const cleanup = () => {
|
|
13200
13415
|
_uiPromises = [];
|
|
13201
13416
|
Log.debug('Cleanup...');
|
|
@@ -13258,6 +13473,10 @@ class Core extends events.exports {
|
|
|
13258
13473
|
const response = yield callAPI(message);
|
|
13259
13474
|
return response;
|
|
13260
13475
|
}
|
|
13476
|
+
case IFRAME.CANCEL: {
|
|
13477
|
+
cancel(message.payload.connectId);
|
|
13478
|
+
break;
|
|
13479
|
+
}
|
|
13261
13480
|
}
|
|
13262
13481
|
return Promise.resolve(message);
|
|
13263
13482
|
});
|
package/dist/inject.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inject.d.ts","sourceRoot":"","sources":["../src/inject.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,UAAU,CAAC;IACjB,YAAY,EAAE,YAAY,CAAC;IAC3B,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC5B,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAClC,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,MAAM,+DAOhB,SAAS,KAAG,
|
|
1
|
+
{"version":3,"file":"inject.d.ts","sourceRoot":"","sources":["../src/inject.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,UAAU,CAAC;IACjB,YAAY,EAAE,YAAY,CAAC;IAC3B,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC5B,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAClC,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,MAAM,+DAOhB,SAAS,KAAG,OA8Gd,CAAC"}
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import type { Response } from '../params';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
2
|
+
import type { IDeviceBLEFirmwareStatus } from '../device';
|
|
3
|
+
import { IBLEFirmwareReleaseInfo } from '../settings';
|
|
4
|
+
declare type BleFirmwareRelease = {
|
|
5
|
+
status: IDeviceBLEFirmwareStatus;
|
|
6
|
+
changelog: {
|
|
7
|
+
'zh-CN': string;
|
|
8
|
+
'en-US': string;
|
|
9
|
+
}[];
|
|
10
|
+
release: IBLEFirmwareReleaseInfo;
|
|
11
|
+
};
|
|
12
|
+
export declare function checkBLEFirmwareRelease(connectId?: string): Response<BleFirmwareRelease>;
|
|
13
|
+
export {};
|
|
4
14
|
//# sourceMappingURL=checkBLEFirmwareRelease.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkBLEFirmwareRelease.d.ts","sourceRoot":"","sources":["../../../src/types/api/checkBLEFirmwareRelease.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"checkBLEFirmwareRelease.d.ts","sourceRoot":"","sources":["../../../src/types/api/checkBLEFirmwareRelease.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,aAAK,kBAAkB,GAAG;IACxB,MAAM,EAAE,wBAAwB,CAAC;IACjC,SAAS,EAAE;QACT,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KACjB,EAAE,CAAC;IACJ,OAAO,EAAE,uBAAuB,CAAC;CAClC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC,kBAAkB,CAAC,CAAC"}
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import type { Response } from '../params';
|
|
2
2
|
import type { IDeviceFirmwareStatus } from '../device';
|
|
3
|
-
|
|
3
|
+
import { IFirmwareReleaseInfo } from '../settings';
|
|
4
|
+
declare type FirmwareRelease = {
|
|
5
|
+
status: IDeviceFirmwareStatus;
|
|
6
|
+
changelog: {
|
|
7
|
+
'en-US': string;
|
|
8
|
+
'zh-CN': string;
|
|
9
|
+
}[];
|
|
10
|
+
release: IFirmwareReleaseInfo;
|
|
11
|
+
};
|
|
12
|
+
export declare function checkFirmwareRelease(connectId?: string): Response<FirmwareRelease>;
|
|
13
|
+
export {};
|
|
4
14
|
//# sourceMappingURL=checkFirmwareRelease.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkFirmwareRelease.d.ts","sourceRoot":"","sources":["../../../src/types/api/checkFirmwareRelease.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"checkFirmwareRelease.d.ts","sourceRoot":"","sources":["../../../src/types/api/checkFirmwareRelease.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,aAAK,eAAe,GAAG;IACrB,MAAM,EAAE,qBAAqB,CAAC;IAC9B,SAAS,EAAE;QACT,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KACjB,EAAE,CAAC;IACJ,OAAO,EAAE,oBAAoB,CAAC;CAC/B,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PROTO } from '../../constants';
|
|
2
|
+
import type { Params, Response } from '../params';
|
|
3
|
+
export interface FirmwareUpdateBinary {
|
|
4
|
+
binary: ArrayBuffer;
|
|
5
|
+
}
|
|
6
|
+
export interface FirmwareUpdate {
|
|
7
|
+
version: number[];
|
|
8
|
+
btcOnly?: boolean;
|
|
9
|
+
updateType: 'firmware' | 'ble';
|
|
10
|
+
}
|
|
11
|
+
export declare function firmwareUpdate(connectId: string | undefined, params: Params<FirmwareUpdate>): Response<PROTO.Success>;
|
|
12
|
+
export declare function firmwareUpdate(connectId: string | undefined, params: Params<FirmwareUpdateBinary>): Response<PROTO.Success>;
|
|
13
|
+
//# sourceMappingURL=firmwareUpdate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firmwareUpdate.d.ts","sourceRoot":"","sources":["../../../src/types/api/firmwareUpdate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAElD,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,UAAU,GAAG,KAAK,CAAC;CAChC;AAED,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC,GAC7B,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAC3B,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,MAAM,EAAE,MAAM,CAAC,oBAAoB,CAAC,GACnC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC"}
|