@onekeyfe/hd-web-sdk 0.0.1 → 0.0.4

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.
@@ -4108,10 +4108,10 @@ const inject = ({
4108
4108
  connectId,
4109
4109
  method: 'deviceReset'
4110
4110
  })),
4111
- deviceSettings: connectId => call({
4111
+ deviceSettings: (connectId, params) => call(Object.assign(Object.assign({}, params), {
4112
4112
  connectId,
4113
4113
  method: 'deviceSettings'
4114
- }),
4114
+ })),
4115
4115
  deviceUpdateReboot: connectId => call({
4116
4116
  connectId,
4117
4117
  method: 'deviceUpdateReboot'
@@ -4167,6 +4167,26 @@ const inject = ({
4167
4167
  btcVerifyMessage: (connectId, params) => call(Object.assign(Object.assign({}, params), {
4168
4168
  connectId,
4169
4169
  method: 'btcVerifyMessage'
4170
+ })),
4171
+ starcoinGetAddress: (connectId, params) => call(Object.assign(Object.assign({}, params), {
4172
+ connectId,
4173
+ method: 'starcoinGetAddress'
4174
+ })),
4175
+ starcoinGetPublicKey: (connectId, params) => call(Object.assign(Object.assign({}, params), {
4176
+ connectId,
4177
+ method: 'starcoinGetPublicKey'
4178
+ })),
4179
+ starcoinSignMessage: (connectId, params) => call(Object.assign(Object.assign({}, params), {
4180
+ connectId,
4181
+ method: 'starcoinSignMessage'
4182
+ })),
4183
+ starcoinSignTransaction: (connectId, params) => call(Object.assign(Object.assign({}, params), {
4184
+ connectId,
4185
+ method: 'starcoinSignTransaction'
4186
+ })),
4187
+ starcoinVerifyMessage: (connectId, params) => call(Object.assign(Object.assign({}, params), {
4188
+ connectId,
4189
+ method: 'starcoinVerifyMessage'
4170
4190
  }))
4171
4191
  };
4172
4192
  return api;
@@ -4978,6 +4998,53 @@ function create(arg, data) {
4978
4998
  };
4979
4999
  }
4980
5000
 
5001
+ const getDeviceType = features => {
5002
+ if (!features || typeof features !== 'object' || !features.serial_no) {
5003
+ return 'classic';
5004
+ }
5005
+
5006
+ const serialNo = features.serial_no;
5007
+ const miniFlag = serialNo.slice(0, 2);
5008
+ if (miniFlag.toLowerCase() === 'mi') return 'mini';
5009
+ return 'classic';
5010
+ };
5011
+
5012
+ const getDeviceUUID = features => {
5013
+ const deviceType = getDeviceType(features);
5014
+
5015
+ if (deviceType === 'classic') {
5016
+ return features.onekey_serial;
5017
+ }
5018
+
5019
+ return features.serial_no;
5020
+ };
5021
+
5022
+ const getDeviceLabel = features => {
5023
+ const deviceType = getDeviceType(features);
5024
+
5025
+ if (typeof features.label === 'string') {
5026
+ return features.label;
5027
+ }
5028
+
5029
+ return `My OneKey ${deviceType.charAt(0).toUpperCase() + deviceType.slice(1)}`;
5030
+ };
5031
+
5032
+ const getDeviceFirmwareVersion = features => {
5033
+ if (features.onekey_version) {
5034
+ return features.onekey_version.split('.');
5035
+ }
5036
+
5037
+ return [features.major_version, features.minor_version, features.patch_version];
5038
+ };
5039
+
5040
+ const getDeviceBLEFirmwareVersion = features => {
5041
+ if (!features.ble_ver) {
5042
+ return null;
5043
+ }
5044
+
5045
+ return features.ble_ver.split('.');
5046
+ };
5047
+
4981
5048
  var nested = {
4982
5049
  BinanceGetAddress: {
4983
5050
  fields: {
@@ -13638,53 +13705,6 @@ var MessagesJSON = {
13638
13705
  nested: nested
13639
13706
  };
13640
13707
 
13641
- const getDeviceType = features => {
13642
- if (!features || typeof features !== 'object' || !features.serial_no) {
13643
- return 'classic';
13644
- }
13645
-
13646
- const serialNo = features.serial_no;
13647
- const miniFlag = serialNo.slice(0, 2);
13648
- if (miniFlag.toLowerCase() === 'mi') return 'mini';
13649
- return 'classic';
13650
- };
13651
-
13652
- const getDeviceUUID = features => {
13653
- const deviceType = getDeviceType(features);
13654
-
13655
- if (deviceType === 'classic') {
13656
- return features.onekey_serial;
13657
- }
13658
-
13659
- return features.serial_no;
13660
- };
13661
-
13662
- const getDeviceLabel = features => {
13663
- const deviceType = getDeviceType(features);
13664
-
13665
- if (typeof features.label === 'string') {
13666
- return features.label;
13667
- }
13668
-
13669
- return `My OneKey ${deviceType.charAt(0).toUpperCase() + deviceType.slice(1)}`;
13670
- };
13671
-
13672
- const getDeviceFirmwareVersion = features => {
13673
- if (features.onekey_version) {
13674
- return features.onekey_version.split('.');
13675
- }
13676
-
13677
- return [features.major_version, features.minor_version, features.patch_version];
13678
- };
13679
-
13680
- const getDeviceBLEFirmwareVersion = features => {
13681
- if (!features.ble_ver) {
13682
- return null;
13683
- }
13684
-
13685
- return features.ble_ver.split('.');
13686
- };
13687
-
13688
13708
  var _a;
13689
13709
 
13690
13710
  class DataManager {
@@ -13926,7 +13946,10 @@ const createErrorMessage = error => ({
13926
13946
 
13927
13947
  const UI_EVENT = 'UI_EVENT';
13928
13948
  const UI_REQUEST$1 = {
13929
- REQUEST_PIN: 'ui-request_pin'
13949
+ REQUEST_PIN: 'ui-request_pin',
13950
+ INVALID_PIN: 'ui-invalid_pin',
13951
+ REQUEST_BUTTON: 'ui-button',
13952
+ CLOSE_UI_WINDOW: 'ui-close_window'
13930
13953
  };
13931
13954
 
13932
13955
  const createUiMessage = (type, payload) => ({
@@ -13967,6 +13990,7 @@ const createUiResponse = (type, payload) => ({
13967
13990
  payload
13968
13991
  });
13969
13992
 
13993
+ const DEVICE_EVENT = 'DEVICE_EVENT';
13970
13994
  const DEVICE = {
13971
13995
  CONNECT: 'device-connect',
13972
13996
  CONNECT_UNACQUIRED: 'device-connect_unacquired',
@@ -13986,6 +14010,12 @@ const DEVICE = {
13986
14010
  WORD: 'word'
13987
14011
  };
13988
14012
 
14013
+ const createDeviceMessage = (type, payload) => ({
14014
+ event: DEVICE_EVENT,
14015
+ type,
14016
+ payload
14017
+ });
14018
+
13989
14019
  const assertType = (res, resType) => {
13990
14020
  const splitResTypes = Array.isArray(resType) ? resType : resType.split('|');
13991
14021
 
@@ -14276,6 +14306,7 @@ class Device extends events.exports {
14276
14306
  deviceType: getDeviceType(this.features),
14277
14307
  deviceId: this.features.device_id || null,
14278
14308
  path: this.originalDescriptor.path,
14309
+ name: this.features.ble_name || this.features.label || `OneKey ${getDeviceType(this.features).toUpperCase()}`,
14279
14310
  label: getDeviceLabel(this.features),
14280
14311
  mode: this.getMode(),
14281
14312
  features: this.features,
@@ -14685,7 +14716,8 @@ class SearchDevices extends BaseMethod {
14685
14716
 
14686
14717
  if (env === 'react-native') {
14687
14718
  return devicesDescriptor.map(device => Object.assign(Object.assign({}, device), {
14688
- connectId: device.id
14719
+ connectId: device.id,
14720
+ deviceType: 'classic'
14689
14721
  }));
14690
14722
  }
14691
14723
 
@@ -14813,6 +14845,17 @@ const getOutputScriptType = path => {
14813
14845
  }
14814
14846
  };
14815
14847
 
14848
+ const serializedPath = path => {
14849
+ const pathStr = path.map(p => {
14850
+ if (p & HD_HARDENED) {
14851
+ return `${p & ~HD_HARDENED}'`;
14852
+ }
14853
+
14854
+ return p;
14855
+ }).join('/');
14856
+ return `m/${pathStr}`;
14857
+ };
14858
+
14816
14859
  const validatePath = (path, length = 0, base = false) => {
14817
14860
  let valid;
14818
14861
 
@@ -15233,7 +15276,9 @@ class BTCGetAddress extends BaseMethod {
15233
15276
  for (let i = 0; i < this.params.length; i++) {
15234
15277
  const param = this.params[i];
15235
15278
  const res = yield this.device.commands.typedCall('GetAddress', 'Address', Object.assign({}, param));
15236
- responses.push(res.message);
15279
+ responses.push(Object.assign({
15280
+ path: serializedPath(param.address_n)
15281
+ }, res.message));
15237
15282
  }
15238
15283
 
15239
15284
  return Promise.resolve(this.hasBundle ? responses : responses[0]);
@@ -15310,7 +15355,9 @@ class BTCGetPublicKey extends BaseMethod {
15310
15355
  for (let i = 0; i < this.params.length; i++) {
15311
15356
  const param = this.params[i];
15312
15357
  const res = yield this.device.commands.typedCall('GetPublicKey', 'PublicKey', Object.assign({}, param));
15313
- responses.push(res.message);
15358
+ responses.push(Object.assign({
15359
+ path: serializedPath(param.address_n)
15360
+ }, res.message));
15314
15361
  }
15315
15362
 
15316
15363
  return Promise.resolve(this.hasBundle ? responses : responses[0]);
@@ -16358,7 +16405,13 @@ class EvmGetAddress extends BaseMethod {
16358
16405
  for (let i = 0; i < this.params.length; i++) {
16359
16406
  const param = this.params[i];
16360
16407
  const res = yield this.device.commands.typedCall('EthereumGetAddress', 'EthereumAddress', Object.assign({}, param));
16361
- responses.push(res.message);
16408
+ const {
16409
+ address
16410
+ } = res.message;
16411
+ responses.push({
16412
+ path: serializedPath(param.address_n),
16413
+ address
16414
+ });
16362
16415
  }
16363
16416
 
16364
16417
  return Promise.resolve(this.hasBundle ? responses : responses[0]);
@@ -16412,7 +16465,9 @@ class EVMGetPublicKey extends BaseMethod {
16412
16465
  for (let i = 0; i < this.params.length; i++) {
16413
16466
  const param = this.params[i];
16414
16467
  const res = yield this.device.commands.typedCall('EthereumGetPublicKey', 'EthereumPublicKey', Object.assign({}, param));
16415
- responses.push(res.message);
16468
+ responses.push(Object.assign({
16469
+ path: serializedPath(param.address_n)
16470
+ }, res.message));
16416
16471
  }
16417
16472
 
16418
16473
  return Promise.resolve(this.hasBundle ? responses : responses[0]);
@@ -16421,7 +16476,7 @@ class EVMGetPublicKey extends BaseMethod {
16421
16476
 
16422
16477
  }
16423
16478
 
16424
- class EVMSignMessage$1 extends BaseMethod {
16479
+ class EVMSignMessage$2 extends BaseMethod {
16425
16480
  init() {
16426
16481
  this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.INITIALIZE];
16427
16482
  validateParams(this.payload, [{
@@ -16511,7 +16566,7 @@ class EVMSignTransaction extends BaseMethod {
16511
16566
  const r = request.signature_r;
16512
16567
  const s = request.signature_s;
16513
16568
 
16514
- if (!v || !r || !s) {
16569
+ if (v == null || r == null || s == null) {
16515
16570
  throw TypedError('Runtime', 'processTxRequest: Unexpected request');
16516
16571
  }
16517
16572
 
@@ -16774,7 +16829,7 @@ class EVMSignMessageEIP712 extends BaseMethod {
16774
16829
 
16775
16830
  }
16776
16831
 
16777
- class EVMSignMessage extends BaseMethod {
16832
+ class EVMSignMessage$1 extends BaseMethod {
16778
16833
  init() {
16779
16834
  this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.INITIALIZE];
16780
16835
  validateParams(this.payload, [{
@@ -16811,6 +16866,217 @@ class EVMSignMessage extends BaseMethod {
16811
16866
 
16812
16867
  }
16813
16868
 
16869
+ class StarcoinGetAddress extends BaseMethod {
16870
+ constructor() {
16871
+ super(...arguments);
16872
+ this.hasBundle = false;
16873
+ }
16874
+
16875
+ init() {
16876
+ var _a;
16877
+
16878
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.INITIALIZE];
16879
+ this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
16880
+ const payload = this.hasBundle ? this.payload : {
16881
+ bundle: [this.payload]
16882
+ };
16883
+ validateParams(payload, [{
16884
+ name: 'bundle',
16885
+ type: 'array'
16886
+ }]);
16887
+ this.params = [];
16888
+ payload.bundle.forEach(batch => {
16889
+ var _a;
16890
+
16891
+ const addressN = validatePath(batch.path, 3);
16892
+ validateParams(batch, [{
16893
+ name: 'path',
16894
+ required: true
16895
+ }, {
16896
+ name: 'showOnOneKey',
16897
+ type: 'boolean'
16898
+ }]);
16899
+ const showOnOneKey = (_a = batch.showOnOneKey) !== null && _a !== void 0 ? _a : true;
16900
+ this.params.push({
16901
+ address_n: addressN,
16902
+ show_display: showOnOneKey
16903
+ });
16904
+ });
16905
+ }
16906
+
16907
+ run() {
16908
+ return __awaiter(this, void 0, void 0, function* () {
16909
+ const responses = [];
16910
+
16911
+ for (let i = 0; i < this.params.length; i++) {
16912
+ const param = this.params[i];
16913
+ const res = yield this.device.commands.typedCall('StarcoinGetAddress', 'StarcoinAddress', Object.assign({}, param));
16914
+ responses.push(Object.assign({
16915
+ path: serializedPath(param.address_n)
16916
+ }, res.message));
16917
+ }
16918
+
16919
+ return Promise.resolve(this.hasBundle ? responses : responses[0]);
16920
+ });
16921
+ }
16922
+
16923
+ }
16924
+
16925
+ class StarcoinGetPublicKey extends BaseMethod {
16926
+ constructor() {
16927
+ super(...arguments);
16928
+ this.hasBundle = false;
16929
+ }
16930
+
16931
+ init() {
16932
+ var _a;
16933
+
16934
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.INITIALIZE];
16935
+ this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
16936
+ const payload = this.hasBundle ? this.payload : {
16937
+ bundle: [this.payload]
16938
+ };
16939
+ validateParams(payload, [{
16940
+ name: 'bundle',
16941
+ type: 'array'
16942
+ }]);
16943
+ this.params = [];
16944
+ payload.bundle.forEach(batch => {
16945
+ var _a;
16946
+
16947
+ const addressN = validatePath(batch.path, 3);
16948
+ validateParams(batch, [{
16949
+ name: 'path',
16950
+ required: true
16951
+ }, {
16952
+ name: 'showOnOneKey',
16953
+ type: 'boolean'
16954
+ }]);
16955
+ const showOnOneKey = (_a = batch.showOnOneKey) !== null && _a !== void 0 ? _a : true;
16956
+ this.params.push({
16957
+ address_n: addressN,
16958
+ show_display: showOnOneKey
16959
+ });
16960
+ });
16961
+ }
16962
+
16963
+ run() {
16964
+ return __awaiter(this, void 0, void 0, function* () {
16965
+ const responses = [];
16966
+
16967
+ for (let i = 0; i < this.params.length; i++) {
16968
+ const param = this.params[i];
16969
+ const res = yield this.device.commands.typedCall('StarcoinGetPublicKey', 'StarcoinPublicKey', Object.assign({}, param));
16970
+ responses.push(Object.assign({
16971
+ path: serializedPath(param.address_n)
16972
+ }, res.message));
16973
+ }
16974
+
16975
+ return Promise.resolve(this.hasBundle ? responses : responses[0]);
16976
+ });
16977
+ }
16978
+
16979
+ }
16980
+
16981
+ class StarcoinSignMessage extends BaseMethod {
16982
+ init() {
16983
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.INITIALIZE];
16984
+ validateParams(this.payload, [{
16985
+ name: 'path',
16986
+ required: true
16987
+ }, {
16988
+ name: 'messageHex',
16989
+ type: 'hexString',
16990
+ required: true
16991
+ }]);
16992
+ const {
16993
+ path,
16994
+ messageHex
16995
+ } = this.payload;
16996
+ const addressN = validatePath(path, 3);
16997
+ this.params = {
16998
+ address_n: addressN,
16999
+ message: formatAnyHex(messageHex)
17000
+ };
17001
+ }
17002
+
17003
+ run() {
17004
+ return __awaiter(this, void 0, void 0, function* () {
17005
+ const res = yield this.device.commands.typedCall('StarcoinSignMessage', 'StarcoinMessageSignature', Object.assign({}, this.params));
17006
+ return Promise.resolve(res.message);
17007
+ });
17008
+ }
17009
+
17010
+ }
17011
+
17012
+ class StarcoinSignTransaction extends BaseMethod {
17013
+ init() {
17014
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.INITIALIZE];
17015
+ validateParams(this.payload, [{
17016
+ name: 'path',
17017
+ required: true
17018
+ }, {
17019
+ name: 'rawTx',
17020
+ type: 'hexString',
17021
+ required: true
17022
+ }]);
17023
+ const {
17024
+ path,
17025
+ rawTx
17026
+ } = this.payload;
17027
+ const addressN = validatePath(path, 3);
17028
+ this.params = {
17029
+ address_n: addressN,
17030
+ raw_tx: formatAnyHex(rawTx)
17031
+ };
17032
+ }
17033
+
17034
+ run() {
17035
+ return __awaiter(this, void 0, void 0, function* () {
17036
+ const res = yield this.device.commands.typedCall('StarcoinSignTx', 'StarcoinSignedTx', Object.assign({}, this.params));
17037
+ return Promise.resolve(res.message);
17038
+ });
17039
+ }
17040
+
17041
+ }
17042
+
17043
+ class EVMSignMessage extends BaseMethod {
17044
+ init() {
17045
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.INITIALIZE];
17046
+ validateParams(this.payload, [{
17047
+ name: 'publicKey',
17048
+ type: 'string',
17049
+ required: true
17050
+ }, {
17051
+ name: 'messageHex',
17052
+ type: 'hexString',
17053
+ required: true
17054
+ }, {
17055
+ name: 'signature',
17056
+ type: 'hexString',
17057
+ required: true
17058
+ }]);
17059
+ const {
17060
+ publicKey,
17061
+ messageHex,
17062
+ signature
17063
+ } = formatAnyHex(this.payload);
17064
+ this.params = {
17065
+ public_key: publicKey,
17066
+ message: messageHex,
17067
+ signature
17068
+ };
17069
+ }
17070
+
17071
+ run() {
17072
+ return __awaiter(this, void 0, void 0, function* () {
17073
+ const res = yield this.device.commands.typedCall('StarcoinVerifyMessage', 'Success', Object.assign({}, this.params));
17074
+ return Promise.resolve(res.message);
17075
+ });
17076
+ }
17077
+
17078
+ }
17079
+
16814
17080
  var ApiMethods = /*#__PURE__*/Object.freeze({
16815
17081
  __proto__: null,
16816
17082
  searchDevices: SearchDevices,
@@ -16834,11 +17100,16 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
16834
17100
  deviceWipe: DeviceWipe,
16835
17101
  evmGetAddress: EvmGetAddress,
16836
17102
  evmGetPublicKey: EVMGetPublicKey,
16837
- evmSignMessage: EVMSignMessage$1,
17103
+ evmSignMessage: EVMSignMessage$2,
16838
17104
  evmSignMessageEIP712: EVMSignMessageEIP712$1,
16839
17105
  evmSignTransaction: EVMSignTransaction,
16840
17106
  evmSignTypedData: EVMSignMessageEIP712,
16841
- evmVerifyMessage: EVMSignMessage
17107
+ evmVerifyMessage: EVMSignMessage$1,
17108
+ starcoinGetAddress: StarcoinGetAddress,
17109
+ starcoinGetPublicKey: StarcoinGetPublicKey,
17110
+ starcoinSignMessage: StarcoinSignMessage,
17111
+ starcoinSignTransaction: StarcoinSignTransaction,
17112
+ starcoinVerifyMessage: EVMSignMessage
16842
17113
  });
16843
17114
 
16844
17115
  function findMethod(message) {
@@ -17080,6 +17351,9 @@ const callAPI = message => __awaiter(void 0, void 0, void 0, function* () {
17080
17351
  Log.debug('Call API - setDevice: ', device);
17081
17352
  (_a = method.setDevice) === null || _a === void 0 ? void 0 : _a.call(method, device);
17082
17353
  device.on(DEVICE.PIN, onDevicePinHandler);
17354
+ device.on(DEVICE.BUTTON, (d, code) => {
17355
+ onDeviceButtonHandler(d, code);
17356
+ });
17083
17357
 
17084
17358
  try {
17085
17359
  const inner = () => __awaiter(void 0, void 0, void 0, function* () {
@@ -17122,6 +17396,9 @@ const callAPI = message => __awaiter(void 0, void 0, void 0, function* () {
17122
17396
  method.dispose();
17123
17397
  }
17124
17398
  }
17399
+
17400
+ closePopup();
17401
+ cleanup();
17125
17402
  }
17126
17403
  });
17127
17404
 
@@ -17185,6 +17462,15 @@ function initDeviceForBle(method) {
17185
17462
  return device;
17186
17463
  }
17187
17464
 
17465
+ const cleanup = () => {
17466
+ _uiPromises = [];
17467
+ Log.debug('Cleanup...');
17468
+ };
17469
+
17470
+ const closePopup = () => {
17471
+ postMessage(createUiMessage(UI_REQUEST$1.CLOSE_UI_WINDOW));
17472
+ };
17473
+
17188
17474
  const onDevicePinHandler = (...[device, type, callback]) => __awaiter(void 0, void 0, void 0, function* () {
17189
17475
  console.log('onDevicePinHandler');
17190
17476
  const uiPromise = createUiPromise(UI_RESPONSE.RECEIVE_PIN, device);
@@ -17196,6 +17482,15 @@ const onDevicePinHandler = (...[device, type, callback]) => __awaiter(void 0, vo
17196
17482
  callback(null, uiResp.payload);
17197
17483
  });
17198
17484
 
17485
+ const onDeviceButtonHandler = (...[device, request]) => {
17486
+ postMessage(createDeviceMessage(DEVICE.BUTTON, Object.assign(Object.assign({}, request), {
17487
+ device: device.toMessageObject()
17488
+ })));
17489
+ postMessage(createUiMessage(UI_REQUEST$1.REQUEST_BUTTON, {
17490
+ device: device.toMessageObject()
17491
+ }));
17492
+ };
17493
+
17199
17494
  const postMessage = message => {
17200
17495
  _core.emit(CORE_EVENT, message);
17201
17496
  };
@@ -17303,6 +17598,7 @@ __webpack_unused_export__ = CORE_EVENT;
17303
17598
  __webpack_unused_export__ = Core;
17304
17599
  __webpack_unused_export__ = DEFAULT_PRIORITY;
17305
17600
  __webpack_unused_export__ = DEVICE;
17601
+ __webpack_unused_export__ = DEVICE_EVENT;
17306
17602
  __webpack_unused_export__ = DataManager;
17307
17603
  exports.Sg = errors;
17308
17604
  exports.Bg = IFRAME;
@@ -17312,6 +17608,7 @@ __webpack_unused_export__ = UI_REQUEST$1;
17312
17608
  __webpack_unused_export__ = UI_RESPONSE;
17313
17609
  __webpack_unused_export__ = corsValidator;
17314
17610
  exports.Ue = create;
17611
+ __webpack_unused_export__ = createDeviceMessage;
17315
17612
  exports.xG = createErrorMessage;
17316
17613
  __webpack_unused_export__ = createIFrameMessage;
17317
17614
  __webpack_unused_export__ = createResponseMessage;
@@ -17319,6 +17616,11 @@ __webpack_unused_export__ = createUiMessage;
17319
17616
  __webpack_unused_export__ = createUiResponse;
17320
17617
  exports.ZP = HardwareSdk;
17321
17618
  exports.yI = enableLog;
17619
+ __webpack_unused_export__ = getDeviceBLEFirmwareVersion;
17620
+ __webpack_unused_export__ = getDeviceFirmwareVersion;
17621
+ __webpack_unused_export__ = getDeviceLabel;
17622
+ __webpack_unused_export__ = getDeviceType;
17623
+ __webpack_unused_export__ = getDeviceUUID;
17322
17624
  __webpack_unused_export__ = getEnv;
17323
17625
  __webpack_unused_export__ = getTimeStamp;
17324
17626
  __webpack_unused_export__ = httpRequest;
@@ -17646,22 +17948,28 @@ function buildOne(messages, name, data) {
17646
17948
  });
17647
17949
  }
17648
17950
 
17649
- const buildBuffer = (messages, name, data) => {
17951
+ const buildBuffers = (messages, name, data) => {
17650
17952
  const {
17651
17953
  Message,
17652
17954
  messageType
17653
17955
  } = createMessageFromName(messages, name);
17654
17956
  const buffer = encode$1(Message, data);
17655
- const encodeBuffer = encode(buffer, {
17957
+ const encodeBuffers = encode(buffer, {
17656
17958
  addTrezorHeaders: true,
17657
- chunked: false,
17959
+ chunked: true,
17658
17960
  messageType
17659
17961
  });
17660
- const outBuffer = new ByteBuffer__default["default"](BUFFER_SIZE + 1);
17661
- outBuffer.writeByte(MESSAGE_TOP_CHAR);
17662
- outBuffer.append(encodeBuffer);
17663
- outBuffer.reset();
17664
- return outBuffer;
17962
+ const outBuffers = [];
17963
+
17964
+ for (const buf of encodeBuffers) {
17965
+ const chunkBuffer = new ByteBuffer__default["default"](BUFFER_SIZE + 1);
17966
+ chunkBuffer.writeByte(MESSAGE_TOP_CHAR);
17967
+ chunkBuffer.append(buf);
17968
+ chunkBuffer.reset();
17969
+ outBuffers.push(chunkBuffer);
17970
+ }
17971
+
17972
+ return outBuffers;
17665
17973
  };
17666
17974
 
17667
17975
  function receiveOne(messages, data) {
@@ -18332,7 +18640,7 @@ protobuf__namespace.configure();
18332
18640
  var index = {
18333
18641
  check,
18334
18642
  buildOne,
18335
- buildBuffer,
18643
+ buildBuffers,
18336
18644
  receiveOne,
18337
18645
  parseConfigure
18338
18646
  };
@@ -42928,7 +43236,7 @@ const createJSBridge = messageEvent => {
42928
43236
  }
42929
43237
  };
42930
43238
 
42931
- const src_init = settings => {
43239
+ const src_init = async settings => {
42932
43240
  if (instance) {
42933
43241
  throw dist/* ERRORS.TypedError */.Sg.TypedError('Init_AlreadyInitialized');
42934
43242
  }
@@ -42936,17 +43244,18 @@ const src_init = settings => {
42936
43244
  _settings = (0,dist/* parseConnectSettings */._4)({ ..._settings,
42937
43245
  ...settings
42938
43246
  });
42939
-
42940
- if (_settings.lazyLoad) {
42941
- _settings.lazyLoad = false;
42942
- return;
42943
- }
42944
-
42945
43247
  (0,dist/* enableLog */.yI)(!!settings.debug);
42946
43248
  src_Log.debug('init');
42947
43249
  window.addEventListener('message', createJSBridge);
42948
43250
  window.addEventListener('unload', src_dispose);
42949
- init(_settings);
43251
+
43252
+ try {
43253
+ await init(_settings);
43254
+ return true;
43255
+ } catch (e) {
43256
+ console.log('init error: ', e);
43257
+ return false;
43258
+ }
42950
43259
  };
42951
43260
 
42952
43261
  const call = async params => {