@onekeyfe/hd-transport 0.1.44 → 0.1.45

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.
Files changed (2) hide show
  1. package/dist/index.js +170 -136
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,7 +1,35 @@
1
- import * as protobuf from 'protobufjs/light';
2
- import * as Long from 'long';
3
- import ByteBuffer from 'bytebuffer';
4
- import { Buffer } from 'buffer';
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var protobuf = require('protobufjs/light');
6
+ var Long = require('long');
7
+ var ByteBuffer = require('bytebuffer');
8
+ var buffer = require('buffer');
9
+
10
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11
+
12
+ function _interopNamespace(e) {
13
+ if (e && e.__esModule) return e;
14
+ var n = Object.create(null);
15
+ if (e) {
16
+ Object.keys(e).forEach(function (k) {
17
+ if (k !== 'default') {
18
+ var d = Object.getOwnPropertyDescriptor(e, k);
19
+ Object.defineProperty(n, k, d.get ? d : {
20
+ enumerable: true,
21
+ get: function () { return e[k]; }
22
+ });
23
+ }
24
+ });
25
+ }
26
+ n["default"] = e;
27
+ return Object.freeze(n);
28
+ }
29
+
30
+ var protobuf__namespace = /*#__PURE__*/_interopNamespace(protobuf);
31
+ var Long__namespace = /*#__PURE__*/_interopNamespace(Long);
32
+ var ByteBuffer__default = /*#__PURE__*/_interopDefaultLegacy(ByteBuffer);
5
33
 
6
34
  /******************************************************************************
7
35
  Copyright (c) Microsoft Corporation.
@@ -54,7 +82,7 @@ const transform$1 = (field, value) => {
54
82
  return null;
55
83
  }
56
84
  if (field.type === 'bytes') {
57
- return ByteBuffer.wrap(value).toString('hex');
85
+ return ByteBuffer__default["default"].wrap(value).toString('hex');
58
86
  }
59
87
  if (field.long) {
60
88
  if (Number.isSafeInteger(value.toNumber())) {
@@ -110,7 +138,7 @@ const transform = (fieldType, value) => {
110
138
  if (fieldType === 'bytes') {
111
139
  if (typeof value === 'string' && !value)
112
140
  return value;
113
- return Buffer.from(value, 'hex');
141
+ return buffer.Buffer.from(value, 'hex');
114
142
  }
115
143
  if (typeof value === 'number' && !Number.isSafeInteger(value)) {
116
144
  throw new RangeError('field value is not within safe integer range');
@@ -159,7 +187,7 @@ const encode$1 = (Message, data) => {
159
187
  const payload = patch(Message, data);
160
188
  const message = Message.fromObject(payload);
161
189
  const buffer = Message.encode(message).finish();
162
- const bytebuffer = new ByteBuffer(buffer.byteLength);
190
+ const bytebuffer = new ByteBuffer__default["default"](buffer.byteLength);
163
191
  bytebuffer.append(buffer);
164
192
  bytebuffer.reset();
165
193
  return bytebuffer;
@@ -167,9 +195,9 @@ const encode$1 = (Message, data) => {
167
195
 
168
196
  function parseConfigure(data) {
169
197
  if (typeof data === 'string') {
170
- return protobuf.Root.fromJSON(JSON.parse(data));
198
+ return protobuf__namespace.Root.fromJSON(JSON.parse(data));
171
199
  }
172
- return protobuf.Root.fromJSON(data);
200
+ return protobuf__namespace.Root.fromJSON(data);
173
201
  }
174
202
  const createMessageFromName = (messages, name) => {
175
203
  const Message = messages.lookupType(name);
@@ -219,7 +247,7 @@ const decode = (byteBuffer) => {
219
247
  };
220
248
  };
221
249
  const decodeChunked = (bytes) => {
222
- const byteBuffer = ByteBuffer.wrap(bytes, undefined, undefined, true);
250
+ const byteBuffer = ByteBuffer__default["default"].wrap(bytes, undefined, undefined, true);
223
251
  const { sharp1, sharp2, typeId, length } = readHeaderChunked(byteBuffer);
224
252
  if (sharp1 !== MESSAGE_HEADER_BYTE || sharp2 !== MESSAGE_HEADER_BYTE) {
225
253
  throw new Error("Didn't receive expected header signature.");
@@ -236,7 +264,7 @@ var decodeProtocol = /*#__PURE__*/Object.freeze({
236
264
  function encode(data, options) {
237
265
  const { addTrezorHeaders, chunked, messageType } = options;
238
266
  const fullSize = (addTrezorHeaders ? HEADER_SIZE : HEADER_SIZE - 2) + data.limit;
239
- const encodedByteBuffer = new ByteBuffer(fullSize);
267
+ const encodedByteBuffer = new ByteBuffer__default["default"](fullSize);
240
268
  if (addTrezorHeaders) {
241
269
  encodedByteBuffer.writeByte(MESSAGE_HEADER_BYTE);
242
270
  encodedByteBuffer.writeByte(MESSAGE_HEADER_BYTE);
@@ -283,7 +311,7 @@ const buildBuffers = (messages, name, data) => {
283
311
  const encodeBuffers = buildEncodeBuffers(messages, name, data);
284
312
  const outBuffers = [];
285
313
  for (const buf of encodeBuffers) {
286
- const chunkBuffer = new ByteBuffer(BUFFER_SIZE + 1);
314
+ const chunkBuffer = new ByteBuffer__default["default"](BUFFER_SIZE + 1);
287
315
  chunkBuffer.writeByte(MESSAGE_TOP_CHAR);
288
316
  chunkBuffer.append(buf);
289
317
  chunkBuffer.reset();
@@ -293,7 +321,7 @@ const buildBuffers = (messages, name, data) => {
293
321
  };
294
322
 
295
323
  function receiveOne(messages, data) {
296
- const bytebuffer = ByteBuffer.wrap(data, 'hex');
324
+ const bytebuffer = ByteBuffer__default["default"].wrap(data, 'hex');
297
325
  const { typeId, buffer } = decode(bytebuffer);
298
326
  const { Message, messageName } = createMessageFromType(messages, typeId);
299
327
  const message = decode$1(Message, buffer);
@@ -390,27 +418,27 @@ var check = /*#__PURE__*/Object.freeze({
390
418
  call: call
391
419
  });
392
420
 
393
- var BinanceOrderType;
421
+ exports.BinanceOrderType = void 0;
394
422
  (function (BinanceOrderType) {
395
423
  BinanceOrderType[BinanceOrderType["OT_UNKNOWN"] = 0] = "OT_UNKNOWN";
396
424
  BinanceOrderType[BinanceOrderType["MARKET"] = 1] = "MARKET";
397
425
  BinanceOrderType[BinanceOrderType["LIMIT"] = 2] = "LIMIT";
398
426
  BinanceOrderType[BinanceOrderType["OT_RESERVED"] = 3] = "OT_RESERVED";
399
- })(BinanceOrderType || (BinanceOrderType = {}));
400
- var BinanceOrderSide;
427
+ })(exports.BinanceOrderType || (exports.BinanceOrderType = {}));
428
+ exports.BinanceOrderSide = void 0;
401
429
  (function (BinanceOrderSide) {
402
430
  BinanceOrderSide[BinanceOrderSide["SIDE_UNKNOWN"] = 0] = "SIDE_UNKNOWN";
403
431
  BinanceOrderSide[BinanceOrderSide["BUY"] = 1] = "BUY";
404
432
  BinanceOrderSide[BinanceOrderSide["SELL"] = 2] = "SELL";
405
- })(BinanceOrderSide || (BinanceOrderSide = {}));
406
- var BinanceTimeInForce;
433
+ })(exports.BinanceOrderSide || (exports.BinanceOrderSide = {}));
434
+ exports.BinanceTimeInForce = void 0;
407
435
  (function (BinanceTimeInForce) {
408
436
  BinanceTimeInForce[BinanceTimeInForce["TIF_UNKNOWN"] = 0] = "TIF_UNKNOWN";
409
437
  BinanceTimeInForce[BinanceTimeInForce["GTE"] = 1] = "GTE";
410
438
  BinanceTimeInForce[BinanceTimeInForce["TIF_RESERVED"] = 2] = "TIF_RESERVED";
411
439
  BinanceTimeInForce[BinanceTimeInForce["IOC"] = 3] = "IOC";
412
- })(BinanceTimeInForce || (BinanceTimeInForce = {}));
413
- var Enum_InputScriptType;
440
+ })(exports.BinanceTimeInForce || (exports.BinanceTimeInForce = {}));
441
+ exports.Enum_InputScriptType = void 0;
414
442
  (function (Enum_InputScriptType) {
415
443
  Enum_InputScriptType[Enum_InputScriptType["SPENDADDRESS"] = 0] = "SPENDADDRESS";
416
444
  Enum_InputScriptType[Enum_InputScriptType["SPENDMULTISIG"] = 1] = "SPENDMULTISIG";
@@ -418,8 +446,8 @@ var Enum_InputScriptType;
418
446
  Enum_InputScriptType[Enum_InputScriptType["SPENDWITNESS"] = 3] = "SPENDWITNESS";
419
447
  Enum_InputScriptType[Enum_InputScriptType["SPENDP2SHWITNESS"] = 4] = "SPENDP2SHWITNESS";
420
448
  Enum_InputScriptType[Enum_InputScriptType["SPENDTAPROOT"] = 5] = "SPENDTAPROOT";
421
- })(Enum_InputScriptType || (Enum_InputScriptType = {}));
422
- var Enum_OutputScriptType;
449
+ })(exports.Enum_InputScriptType || (exports.Enum_InputScriptType = {}));
450
+ exports.Enum_OutputScriptType = void 0;
423
451
  (function (Enum_OutputScriptType) {
424
452
  Enum_OutputScriptType[Enum_OutputScriptType["PAYTOADDRESS"] = 0] = "PAYTOADDRESS";
425
453
  Enum_OutputScriptType[Enum_OutputScriptType["PAYTOSCRIPTHASH"] = 1] = "PAYTOSCRIPTHASH";
@@ -428,20 +456,20 @@ var Enum_OutputScriptType;
428
456
  Enum_OutputScriptType[Enum_OutputScriptType["PAYTOWITNESS"] = 4] = "PAYTOWITNESS";
429
457
  Enum_OutputScriptType[Enum_OutputScriptType["PAYTOP2SHWITNESS"] = 5] = "PAYTOP2SHWITNESS";
430
458
  Enum_OutputScriptType[Enum_OutputScriptType["PAYTOTAPROOT"] = 6] = "PAYTOTAPROOT";
431
- })(Enum_OutputScriptType || (Enum_OutputScriptType = {}));
432
- var DecredStakingSpendType;
459
+ })(exports.Enum_OutputScriptType || (exports.Enum_OutputScriptType = {}));
460
+ exports.DecredStakingSpendType = void 0;
433
461
  (function (DecredStakingSpendType) {
434
462
  DecredStakingSpendType[DecredStakingSpendType["SSGen"] = 0] = "SSGen";
435
463
  DecredStakingSpendType[DecredStakingSpendType["SSRTX"] = 1] = "SSRTX";
436
- })(DecredStakingSpendType || (DecredStakingSpendType = {}));
437
- var AmountUnit;
464
+ })(exports.DecredStakingSpendType || (exports.DecredStakingSpendType = {}));
465
+ exports.AmountUnit = void 0;
438
466
  (function (AmountUnit) {
439
467
  AmountUnit[AmountUnit["BITCOIN"] = 0] = "BITCOIN";
440
468
  AmountUnit[AmountUnit["MILLIBITCOIN"] = 1] = "MILLIBITCOIN";
441
469
  AmountUnit[AmountUnit["MICROBITCOIN"] = 2] = "MICROBITCOIN";
442
470
  AmountUnit[AmountUnit["SATOSHI"] = 3] = "SATOSHI";
443
- })(AmountUnit || (AmountUnit = {}));
444
- var Enum_RequestType;
471
+ })(exports.AmountUnit || (exports.AmountUnit = {}));
472
+ exports.Enum_RequestType = void 0;
445
473
  (function (Enum_RequestType) {
446
474
  Enum_RequestType[Enum_RequestType["TXINPUT"] = 0] = "TXINPUT";
447
475
  Enum_RequestType[Enum_RequestType["TXOUTPUT"] = 1] = "TXOUTPUT";
@@ -450,14 +478,14 @@ var Enum_RequestType;
450
478
  Enum_RequestType[Enum_RequestType["TXEXTRADATA"] = 4] = "TXEXTRADATA";
451
479
  Enum_RequestType[Enum_RequestType["TXORIGINPUT"] = 5] = "TXORIGINPUT";
452
480
  Enum_RequestType[Enum_RequestType["TXORIGOUTPUT"] = 6] = "TXORIGOUTPUT";
453
- })(Enum_RequestType || (Enum_RequestType = {}));
454
- var CardanoDerivationType;
481
+ })(exports.Enum_RequestType || (exports.Enum_RequestType = {}));
482
+ exports.CardanoDerivationType = void 0;
455
483
  (function (CardanoDerivationType) {
456
484
  CardanoDerivationType[CardanoDerivationType["LEDGER"] = 0] = "LEDGER";
457
485
  CardanoDerivationType[CardanoDerivationType["ICARUS"] = 1] = "ICARUS";
458
486
  CardanoDerivationType[CardanoDerivationType["ICARUS_TREZOR"] = 2] = "ICARUS_TREZOR";
459
- })(CardanoDerivationType || (CardanoDerivationType = {}));
460
- var CardanoAddressType;
487
+ })(exports.CardanoDerivationType || (exports.CardanoDerivationType = {}));
488
+ exports.CardanoAddressType = void 0;
461
489
  (function (CardanoAddressType) {
462
490
  CardanoAddressType[CardanoAddressType["BASE"] = 0] = "BASE";
463
491
  CardanoAddressType[CardanoAddressType["BASE_SCRIPT_KEY"] = 1] = "BASE_SCRIPT_KEY";
@@ -470,8 +498,8 @@ var CardanoAddressType;
470
498
  CardanoAddressType[CardanoAddressType["BYRON"] = 8] = "BYRON";
471
499
  CardanoAddressType[CardanoAddressType["REWARD"] = 14] = "REWARD";
472
500
  CardanoAddressType[CardanoAddressType["REWARD_SCRIPT"] = 15] = "REWARD_SCRIPT";
473
- })(CardanoAddressType || (CardanoAddressType = {}));
474
- var CardanoNativeScriptType;
501
+ })(exports.CardanoAddressType || (exports.CardanoAddressType = {}));
502
+ exports.CardanoNativeScriptType = void 0;
475
503
  (function (CardanoNativeScriptType) {
476
504
  CardanoNativeScriptType[CardanoNativeScriptType["PUB_KEY"] = 0] = "PUB_KEY";
477
505
  CardanoNativeScriptType[CardanoNativeScriptType["ALL"] = 1] = "ALL";
@@ -479,43 +507,43 @@ var CardanoNativeScriptType;
479
507
  CardanoNativeScriptType[CardanoNativeScriptType["N_OF_K"] = 3] = "N_OF_K";
480
508
  CardanoNativeScriptType[CardanoNativeScriptType["INVALID_BEFORE"] = 4] = "INVALID_BEFORE";
481
509
  CardanoNativeScriptType[CardanoNativeScriptType["INVALID_HEREAFTER"] = 5] = "INVALID_HEREAFTER";
482
- })(CardanoNativeScriptType || (CardanoNativeScriptType = {}));
483
- var CardanoNativeScriptHashDisplayFormat;
510
+ })(exports.CardanoNativeScriptType || (exports.CardanoNativeScriptType = {}));
511
+ exports.CardanoNativeScriptHashDisplayFormat = void 0;
484
512
  (function (CardanoNativeScriptHashDisplayFormat) {
485
513
  CardanoNativeScriptHashDisplayFormat[CardanoNativeScriptHashDisplayFormat["HIDE"] = 0] = "HIDE";
486
514
  CardanoNativeScriptHashDisplayFormat[CardanoNativeScriptHashDisplayFormat["BECH32"] = 1] = "BECH32";
487
515
  CardanoNativeScriptHashDisplayFormat[CardanoNativeScriptHashDisplayFormat["POLICY_ID"] = 2] = "POLICY_ID";
488
- })(CardanoNativeScriptHashDisplayFormat || (CardanoNativeScriptHashDisplayFormat = {}));
489
- var CardanoCertificateType;
516
+ })(exports.CardanoNativeScriptHashDisplayFormat || (exports.CardanoNativeScriptHashDisplayFormat = {}));
517
+ exports.CardanoCertificateType = void 0;
490
518
  (function (CardanoCertificateType) {
491
519
  CardanoCertificateType[CardanoCertificateType["STAKE_REGISTRATION"] = 0] = "STAKE_REGISTRATION";
492
520
  CardanoCertificateType[CardanoCertificateType["STAKE_DEREGISTRATION"] = 1] = "STAKE_DEREGISTRATION";
493
521
  CardanoCertificateType[CardanoCertificateType["STAKE_DELEGATION"] = 2] = "STAKE_DELEGATION";
494
522
  CardanoCertificateType[CardanoCertificateType["STAKE_POOL_REGISTRATION"] = 3] = "STAKE_POOL_REGISTRATION";
495
- })(CardanoCertificateType || (CardanoCertificateType = {}));
496
- var CardanoPoolRelayType;
523
+ })(exports.CardanoCertificateType || (exports.CardanoCertificateType = {}));
524
+ exports.CardanoPoolRelayType = void 0;
497
525
  (function (CardanoPoolRelayType) {
498
526
  CardanoPoolRelayType[CardanoPoolRelayType["SINGLE_HOST_IP"] = 0] = "SINGLE_HOST_IP";
499
527
  CardanoPoolRelayType[CardanoPoolRelayType["SINGLE_HOST_NAME"] = 1] = "SINGLE_HOST_NAME";
500
528
  CardanoPoolRelayType[CardanoPoolRelayType["MULTIPLE_HOST_NAME"] = 2] = "MULTIPLE_HOST_NAME";
501
- })(CardanoPoolRelayType || (CardanoPoolRelayType = {}));
502
- var CardanoTxAuxiliaryDataSupplementType;
529
+ })(exports.CardanoPoolRelayType || (exports.CardanoPoolRelayType = {}));
530
+ exports.CardanoTxAuxiliaryDataSupplementType = void 0;
503
531
  (function (CardanoTxAuxiliaryDataSupplementType) {
504
532
  CardanoTxAuxiliaryDataSupplementType[CardanoTxAuxiliaryDataSupplementType["NONE"] = 0] = "NONE";
505
533
  CardanoTxAuxiliaryDataSupplementType[CardanoTxAuxiliaryDataSupplementType["CATALYST_REGISTRATION_SIGNATURE"] = 1] = "CATALYST_REGISTRATION_SIGNATURE";
506
- })(CardanoTxAuxiliaryDataSupplementType || (CardanoTxAuxiliaryDataSupplementType = {}));
507
- var CardanoTxSigningMode;
534
+ })(exports.CardanoTxAuxiliaryDataSupplementType || (exports.CardanoTxAuxiliaryDataSupplementType = {}));
535
+ exports.CardanoTxSigningMode = void 0;
508
536
  (function (CardanoTxSigningMode) {
509
537
  CardanoTxSigningMode[CardanoTxSigningMode["ORDINARY_TRANSACTION"] = 0] = "ORDINARY_TRANSACTION";
510
538
  CardanoTxSigningMode[CardanoTxSigningMode["POOL_REGISTRATION_AS_OWNER"] = 1] = "POOL_REGISTRATION_AS_OWNER";
511
539
  CardanoTxSigningMode[CardanoTxSigningMode["MULTISIG_TRANSACTION"] = 2] = "MULTISIG_TRANSACTION";
512
- })(CardanoTxSigningMode || (CardanoTxSigningMode = {}));
513
- var CardanoTxWitnessType;
540
+ })(exports.CardanoTxSigningMode || (exports.CardanoTxSigningMode = {}));
541
+ exports.CardanoTxWitnessType = void 0;
514
542
  (function (CardanoTxWitnessType) {
515
543
  CardanoTxWitnessType[CardanoTxWitnessType["BYRON_WITNESS"] = 0] = "BYRON_WITNESS";
516
544
  CardanoTxWitnessType[CardanoTxWitnessType["SHELLEY_WITNESS"] = 1] = "SHELLEY_WITNESS";
517
- })(CardanoTxWitnessType || (CardanoTxWitnessType = {}));
518
- var FailureType;
545
+ })(exports.CardanoTxWitnessType || (exports.CardanoTxWitnessType = {}));
546
+ exports.FailureType = void 0;
519
547
  (function (FailureType) {
520
548
  FailureType[FailureType["Failure_UnexpectedMessage"] = 1] = "Failure_UnexpectedMessage";
521
549
  FailureType[FailureType["Failure_ButtonExpected"] = 2] = "Failure_ButtonExpected";
@@ -532,8 +560,8 @@ var FailureType;
532
560
  FailureType[FailureType["Failure_WipeCodeMismatch"] = 13] = "Failure_WipeCodeMismatch";
533
561
  FailureType[FailureType["Failure_InvalidSession"] = 14] = "Failure_InvalidSession";
534
562
  FailureType[FailureType["Failure_FirmwareError"] = 99] = "Failure_FirmwareError";
535
- })(FailureType || (FailureType = {}));
536
- var Enum_ButtonRequestType;
563
+ })(exports.FailureType || (exports.FailureType = {}));
564
+ exports.Enum_ButtonRequestType = void 0;
537
565
  (function (Enum_ButtonRequestType) {
538
566
  Enum_ButtonRequestType[Enum_ButtonRequestType["ButtonRequest_Other"] = 1] = "ButtonRequest_Other";
539
567
  Enum_ButtonRequestType[Enum_ButtonRequestType["ButtonRequest_FeeOverThreshold"] = 2] = "ButtonRequest_FeeOverThreshold";
@@ -555,8 +583,8 @@ var Enum_ButtonRequestType;
555
583
  Enum_ButtonRequestType[Enum_ButtonRequestType["ButtonRequest_Warning"] = 18] = "ButtonRequest_Warning";
556
584
  Enum_ButtonRequestType[Enum_ButtonRequestType["ButtonRequest_PassphraseEntry"] = 19] = "ButtonRequest_PassphraseEntry";
557
585
  Enum_ButtonRequestType[Enum_ButtonRequestType["ButtonRequest_PinEntry"] = 20] = "ButtonRequest_PinEntry";
558
- })(Enum_ButtonRequestType || (Enum_ButtonRequestType = {}));
559
- var Enum_PinMatrixRequestType;
586
+ })(exports.Enum_ButtonRequestType || (exports.Enum_ButtonRequestType = {}));
587
+ exports.Enum_PinMatrixRequestType = void 0;
560
588
  (function (Enum_PinMatrixRequestType) {
561
589
  Enum_PinMatrixRequestType[Enum_PinMatrixRequestType["PinMatrixRequestType_Current"] = 1] = "PinMatrixRequestType_Current";
562
590
  Enum_PinMatrixRequestType[Enum_PinMatrixRequestType["PinMatrixRequestType_NewFirst"] = 2] = "PinMatrixRequestType_NewFirst";
@@ -565,8 +593,8 @@ var Enum_PinMatrixRequestType;
565
593
  Enum_PinMatrixRequestType[Enum_PinMatrixRequestType["PinMatrixRequestType_WipeCodeSecond"] = 5] = "PinMatrixRequestType_WipeCodeSecond";
566
594
  Enum_PinMatrixRequestType[Enum_PinMatrixRequestType["PinMatrixRequestType_BackupFirst"] = 6] = "PinMatrixRequestType_BackupFirst";
567
595
  Enum_PinMatrixRequestType[Enum_PinMatrixRequestType["PinMatrixRequestType_BackupSecond"] = 7] = "PinMatrixRequestType_BackupSecond";
568
- })(Enum_PinMatrixRequestType || (Enum_PinMatrixRequestType = {}));
569
- var EthereumDataType;
596
+ })(exports.Enum_PinMatrixRequestType || (exports.Enum_PinMatrixRequestType = {}));
597
+ exports.EthereumDataType = void 0;
570
598
  (function (EthereumDataType) {
571
599
  EthereumDataType[EthereumDataType["UINT"] = 1] = "UINT";
572
600
  EthereumDataType[EthereumDataType["INT"] = 2] = "INT";
@@ -576,20 +604,20 @@ var EthereumDataType;
576
604
  EthereumDataType[EthereumDataType["ADDRESS"] = 6] = "ADDRESS";
577
605
  EthereumDataType[EthereumDataType["ARRAY"] = 7] = "ARRAY";
578
606
  EthereumDataType[EthereumDataType["STRUCT"] = 8] = "STRUCT";
579
- })(EthereumDataType || (EthereumDataType = {}));
580
- var Enum_BackupType;
607
+ })(exports.EthereumDataType || (exports.EthereumDataType = {}));
608
+ exports.Enum_BackupType = void 0;
581
609
  (function (Enum_BackupType) {
582
610
  Enum_BackupType[Enum_BackupType["Bip39"] = 0] = "Bip39";
583
611
  Enum_BackupType[Enum_BackupType["Slip39_Basic"] = 1] = "Slip39_Basic";
584
612
  Enum_BackupType[Enum_BackupType["Slip39_Advanced"] = 2] = "Slip39_Advanced";
585
- })(Enum_BackupType || (Enum_BackupType = {}));
586
- var Enum_SafetyCheckLevel;
613
+ })(exports.Enum_BackupType || (exports.Enum_BackupType = {}));
614
+ exports.Enum_SafetyCheckLevel = void 0;
587
615
  (function (Enum_SafetyCheckLevel) {
588
616
  Enum_SafetyCheckLevel[Enum_SafetyCheckLevel["Strict"] = 0] = "Strict";
589
617
  Enum_SafetyCheckLevel[Enum_SafetyCheckLevel["PromptAlways"] = 1] = "PromptAlways";
590
618
  Enum_SafetyCheckLevel[Enum_SafetyCheckLevel["PromptTemporarily"] = 2] = "PromptTemporarily";
591
- })(Enum_SafetyCheckLevel || (Enum_SafetyCheckLevel = {}));
592
- var Enum_Capability;
619
+ })(exports.Enum_SafetyCheckLevel || (exports.Enum_SafetyCheckLevel = {}));
620
+ exports.Enum_Capability = void 0;
593
621
  (function (Enum_Capability) {
594
622
  Enum_Capability[Enum_Capability["Capability_Bitcoin"] = 1] = "Capability_Bitcoin";
595
623
  Enum_Capability[Enum_Capability["Capability_Bitcoin_like"] = 2] = "Capability_Bitcoin_like";
@@ -608,145 +636,145 @@ var Enum_Capability;
608
636
  Enum_Capability[Enum_Capability["Capability_Shamir"] = 15] = "Capability_Shamir";
609
637
  Enum_Capability[Enum_Capability["Capability_ShamirGroups"] = 16] = "Capability_ShamirGroups";
610
638
  Enum_Capability[Enum_Capability["Capability_PassphraseEntry"] = 17] = "Capability_PassphraseEntry";
611
- })(Enum_Capability || (Enum_Capability = {}));
612
- var ExportType;
639
+ })(exports.Enum_Capability || (exports.Enum_Capability = {}));
640
+ exports.ExportType = void 0;
613
641
  (function (ExportType) {
614
642
  ExportType[ExportType["SeedEncExportType_NO"] = 0] = "SeedEncExportType_NO";
615
643
  ExportType[ExportType["SeedEncExportType_YES"] = 1] = "SeedEncExportType_YES";
616
644
  ExportType[ExportType["MnemonicPlainExportType_YES"] = 2] = "MnemonicPlainExportType_YES";
617
- })(ExportType || (ExportType = {}));
618
- var SdProtectOperationType;
645
+ })(exports.ExportType || (exports.ExportType = {}));
646
+ exports.SdProtectOperationType = void 0;
619
647
  (function (SdProtectOperationType) {
620
648
  SdProtectOperationType[SdProtectOperationType["DISABLE"] = 0] = "DISABLE";
621
649
  SdProtectOperationType[SdProtectOperationType["ENABLE"] = 1] = "ENABLE";
622
650
  SdProtectOperationType[SdProtectOperationType["REFRESH"] = 2] = "REFRESH";
623
- })(SdProtectOperationType || (SdProtectOperationType = {}));
624
- var RecoveryDeviceType;
651
+ })(exports.SdProtectOperationType || (exports.SdProtectOperationType = {}));
652
+ exports.RecoveryDeviceType = void 0;
625
653
  (function (RecoveryDeviceType) {
626
654
  RecoveryDeviceType[RecoveryDeviceType["RecoveryDeviceType_ScrambledWords"] = 0] = "RecoveryDeviceType_ScrambledWords";
627
655
  RecoveryDeviceType[RecoveryDeviceType["RecoveryDeviceType_Matrix"] = 1] = "RecoveryDeviceType_Matrix";
628
- })(RecoveryDeviceType || (RecoveryDeviceType = {}));
629
- var Enum_WordRequestType;
656
+ })(exports.RecoveryDeviceType || (exports.RecoveryDeviceType = {}));
657
+ exports.Enum_WordRequestType = void 0;
630
658
  (function (Enum_WordRequestType) {
631
659
  Enum_WordRequestType[Enum_WordRequestType["WordRequestType_Plain"] = 0] = "WordRequestType_Plain";
632
660
  Enum_WordRequestType[Enum_WordRequestType["WordRequestType_Matrix9"] = 1] = "WordRequestType_Matrix9";
633
661
  Enum_WordRequestType[Enum_WordRequestType["WordRequestType_Matrix6"] = 2] = "WordRequestType_Matrix6";
634
- })(Enum_WordRequestType || (Enum_WordRequestType = {}));
635
- var SeedRequestType;
662
+ })(exports.Enum_WordRequestType || (exports.Enum_WordRequestType = {}));
663
+ exports.SeedRequestType = void 0;
636
664
  (function (SeedRequestType) {
637
665
  SeedRequestType[SeedRequestType["SeedRequestType_Gen"] = 0] = "SeedRequestType_Gen";
638
666
  SeedRequestType[SeedRequestType["SeedRequestType_EncExport"] = 1] = "SeedRequestType_EncExport";
639
667
  SeedRequestType[SeedRequestType["SeedRequestType_EncImport"] = 2] = "SeedRequestType_EncImport";
640
- })(SeedRequestType || (SeedRequestType = {}));
641
- var WL_OperationType;
668
+ })(exports.SeedRequestType || (exports.SeedRequestType = {}));
669
+ exports.WL_OperationType = void 0;
642
670
  (function (WL_OperationType) {
643
671
  WL_OperationType[WL_OperationType["WL_OperationType_Add"] = 0] = "WL_OperationType_Add";
644
672
  WL_OperationType[WL_OperationType["WL_OperationType_Delete"] = 1] = "WL_OperationType_Delete";
645
673
  WL_OperationType[WL_OperationType["WL_OperationType_Inquire"] = 2] = "WL_OperationType_Inquire";
646
- })(WL_OperationType || (WL_OperationType = {}));
647
- var NEMMosaicLevy;
674
+ })(exports.WL_OperationType || (exports.WL_OperationType = {}));
675
+ exports.NEMMosaicLevy = void 0;
648
676
  (function (NEMMosaicLevy) {
649
677
  NEMMosaicLevy[NEMMosaicLevy["MosaicLevy_Absolute"] = 1] = "MosaicLevy_Absolute";
650
678
  NEMMosaicLevy[NEMMosaicLevy["MosaicLevy_Percentile"] = 2] = "MosaicLevy_Percentile";
651
- })(NEMMosaicLevy || (NEMMosaicLevy = {}));
652
- var NEMSupplyChangeType;
679
+ })(exports.NEMMosaicLevy || (exports.NEMMosaicLevy = {}));
680
+ exports.NEMSupplyChangeType = void 0;
653
681
  (function (NEMSupplyChangeType) {
654
682
  NEMSupplyChangeType[NEMSupplyChangeType["SupplyChange_Increase"] = 1] = "SupplyChange_Increase";
655
683
  NEMSupplyChangeType[NEMSupplyChangeType["SupplyChange_Decrease"] = 2] = "SupplyChange_Decrease";
656
- })(NEMSupplyChangeType || (NEMSupplyChangeType = {}));
657
- var NEMModificationType;
684
+ })(exports.NEMSupplyChangeType || (exports.NEMSupplyChangeType = {}));
685
+ exports.NEMModificationType = void 0;
658
686
  (function (NEMModificationType) {
659
687
  NEMModificationType[NEMModificationType["CosignatoryModification_Add"] = 1] = "CosignatoryModification_Add";
660
688
  NEMModificationType[NEMModificationType["CosignatoryModification_Delete"] = 2] = "CosignatoryModification_Delete";
661
- })(NEMModificationType || (NEMModificationType = {}));
662
- var NEMImportanceTransferMode;
689
+ })(exports.NEMModificationType || (exports.NEMModificationType = {}));
690
+ exports.NEMImportanceTransferMode = void 0;
663
691
  (function (NEMImportanceTransferMode) {
664
692
  NEMImportanceTransferMode[NEMImportanceTransferMode["ImportanceTransfer_Activate"] = 1] = "ImportanceTransfer_Activate";
665
693
  NEMImportanceTransferMode[NEMImportanceTransferMode["ImportanceTransfer_Deactivate"] = 2] = "ImportanceTransfer_Deactivate";
666
- })(NEMImportanceTransferMode || (NEMImportanceTransferMode = {}));
667
- var StellarAssetType;
694
+ })(exports.NEMImportanceTransferMode || (exports.NEMImportanceTransferMode = {}));
695
+ exports.StellarAssetType = void 0;
668
696
  (function (StellarAssetType) {
669
697
  StellarAssetType[StellarAssetType["NATIVE"] = 0] = "NATIVE";
670
698
  StellarAssetType[StellarAssetType["ALPHANUM4"] = 1] = "ALPHANUM4";
671
699
  StellarAssetType[StellarAssetType["ALPHANUM12"] = 2] = "ALPHANUM12";
672
- })(StellarAssetType || (StellarAssetType = {}));
673
- var StellarMemoType;
700
+ })(exports.StellarAssetType || (exports.StellarAssetType = {}));
701
+ exports.StellarMemoType = void 0;
674
702
  (function (StellarMemoType) {
675
703
  StellarMemoType[StellarMemoType["NONE"] = 0] = "NONE";
676
704
  StellarMemoType[StellarMemoType["TEXT"] = 1] = "TEXT";
677
705
  StellarMemoType[StellarMemoType["ID"] = 2] = "ID";
678
706
  StellarMemoType[StellarMemoType["HASH"] = 3] = "HASH";
679
707
  StellarMemoType[StellarMemoType["RETURN"] = 4] = "RETURN";
680
- })(StellarMemoType || (StellarMemoType = {}));
681
- var StellarSignerType;
708
+ })(exports.StellarMemoType || (exports.StellarMemoType = {}));
709
+ exports.StellarSignerType = void 0;
682
710
  (function (StellarSignerType) {
683
711
  StellarSignerType[StellarSignerType["ACCOUNT"] = 0] = "ACCOUNT";
684
712
  StellarSignerType[StellarSignerType["PRE_AUTH"] = 1] = "PRE_AUTH";
685
713
  StellarSignerType[StellarSignerType["HASH"] = 2] = "HASH";
686
- })(StellarSignerType || (StellarSignerType = {}));
687
- var TezosContractType;
714
+ })(exports.StellarSignerType || (exports.StellarSignerType = {}));
715
+ exports.TezosContractType = void 0;
688
716
  (function (TezosContractType) {
689
717
  TezosContractType[TezosContractType["Implicit"] = 0] = "Implicit";
690
718
  TezosContractType[TezosContractType["Originated"] = 1] = "Originated";
691
- })(TezosContractType || (TezosContractType = {}));
692
- var TezosBallotType;
719
+ })(exports.TezosContractType || (exports.TezosContractType = {}));
720
+ exports.TezosBallotType = void 0;
693
721
  (function (TezosBallotType) {
694
722
  TezosBallotType[TezosBallotType["Yay"] = 0] = "Yay";
695
723
  TezosBallotType[TezosBallotType["Nay"] = 1] = "Nay";
696
724
  TezosBallotType[TezosBallotType["Pass"] = 2] = "Pass";
697
- })(TezosBallotType || (TezosBallotType = {}));
698
- var CommandFlags;
725
+ })(exports.TezosBallotType || (exports.TezosBallotType = {}));
726
+ exports.CommandFlags = void 0;
699
727
  (function (CommandFlags) {
700
728
  CommandFlags[CommandFlags["Default"] = 0] = "Default";
701
729
  CommandFlags[CommandFlags["Factory_Only"] = 1] = "Factory_Only";
702
- })(CommandFlags || (CommandFlags = {}));
730
+ })(exports.CommandFlags || (exports.CommandFlags = {}));
703
731
 
704
732
  var messages = /*#__PURE__*/Object.freeze({
705
733
  __proto__: null,
706
- get BinanceOrderType () { return BinanceOrderType; },
707
- get BinanceOrderSide () { return BinanceOrderSide; },
708
- get BinanceTimeInForce () { return BinanceTimeInForce; },
709
- get Enum_InputScriptType () { return Enum_InputScriptType; },
710
- get Enum_OutputScriptType () { return Enum_OutputScriptType; },
711
- get DecredStakingSpendType () { return DecredStakingSpendType; },
712
- get AmountUnit () { return AmountUnit; },
713
- get Enum_RequestType () { return Enum_RequestType; },
714
- get CardanoDerivationType () { return CardanoDerivationType; },
715
- get CardanoAddressType () { return CardanoAddressType; },
716
- get CardanoNativeScriptType () { return CardanoNativeScriptType; },
717
- get CardanoNativeScriptHashDisplayFormat () { return CardanoNativeScriptHashDisplayFormat; },
718
- get CardanoCertificateType () { return CardanoCertificateType; },
719
- get CardanoPoolRelayType () { return CardanoPoolRelayType; },
720
- get CardanoTxAuxiliaryDataSupplementType () { return CardanoTxAuxiliaryDataSupplementType; },
721
- get CardanoTxSigningMode () { return CardanoTxSigningMode; },
722
- get CardanoTxWitnessType () { return CardanoTxWitnessType; },
723
- get FailureType () { return FailureType; },
724
- get Enum_ButtonRequestType () { return Enum_ButtonRequestType; },
725
- get Enum_PinMatrixRequestType () { return Enum_PinMatrixRequestType; },
726
- get EthereumDataType () { return EthereumDataType; },
727
- get Enum_BackupType () { return Enum_BackupType; },
728
- get Enum_SafetyCheckLevel () { return Enum_SafetyCheckLevel; },
729
- get Enum_Capability () { return Enum_Capability; },
730
- get ExportType () { return ExportType; },
731
- get SdProtectOperationType () { return SdProtectOperationType; },
732
- get RecoveryDeviceType () { return RecoveryDeviceType; },
733
- get Enum_WordRequestType () { return Enum_WordRequestType; },
734
- get SeedRequestType () { return SeedRequestType; },
735
- get WL_OperationType () { return WL_OperationType; },
736
- get NEMMosaicLevy () { return NEMMosaicLevy; },
737
- get NEMSupplyChangeType () { return NEMSupplyChangeType; },
738
- get NEMModificationType () { return NEMModificationType; },
739
- get NEMImportanceTransferMode () { return NEMImportanceTransferMode; },
740
- get StellarAssetType () { return StellarAssetType; },
741
- get StellarMemoType () { return StellarMemoType; },
742
- get StellarSignerType () { return StellarSignerType; },
743
- get TezosContractType () { return TezosContractType; },
744
- get TezosBallotType () { return TezosBallotType; },
745
- get CommandFlags () { return CommandFlags; }
734
+ get BinanceOrderType () { return exports.BinanceOrderType; },
735
+ get BinanceOrderSide () { return exports.BinanceOrderSide; },
736
+ get BinanceTimeInForce () { return exports.BinanceTimeInForce; },
737
+ get Enum_InputScriptType () { return exports.Enum_InputScriptType; },
738
+ get Enum_OutputScriptType () { return exports.Enum_OutputScriptType; },
739
+ get DecredStakingSpendType () { return exports.DecredStakingSpendType; },
740
+ get AmountUnit () { return exports.AmountUnit; },
741
+ get Enum_RequestType () { return exports.Enum_RequestType; },
742
+ get CardanoDerivationType () { return exports.CardanoDerivationType; },
743
+ get CardanoAddressType () { return exports.CardanoAddressType; },
744
+ get CardanoNativeScriptType () { return exports.CardanoNativeScriptType; },
745
+ get CardanoNativeScriptHashDisplayFormat () { return exports.CardanoNativeScriptHashDisplayFormat; },
746
+ get CardanoCertificateType () { return exports.CardanoCertificateType; },
747
+ get CardanoPoolRelayType () { return exports.CardanoPoolRelayType; },
748
+ get CardanoTxAuxiliaryDataSupplementType () { return exports.CardanoTxAuxiliaryDataSupplementType; },
749
+ get CardanoTxSigningMode () { return exports.CardanoTxSigningMode; },
750
+ get CardanoTxWitnessType () { return exports.CardanoTxWitnessType; },
751
+ get FailureType () { return exports.FailureType; },
752
+ get Enum_ButtonRequestType () { return exports.Enum_ButtonRequestType; },
753
+ get Enum_PinMatrixRequestType () { return exports.Enum_PinMatrixRequestType; },
754
+ get EthereumDataType () { return exports.EthereumDataType; },
755
+ get Enum_BackupType () { return exports.Enum_BackupType; },
756
+ get Enum_SafetyCheckLevel () { return exports.Enum_SafetyCheckLevel; },
757
+ get Enum_Capability () { return exports.Enum_Capability; },
758
+ get ExportType () { return exports.ExportType; },
759
+ get SdProtectOperationType () { return exports.SdProtectOperationType; },
760
+ get RecoveryDeviceType () { return exports.RecoveryDeviceType; },
761
+ get Enum_WordRequestType () { return exports.Enum_WordRequestType; },
762
+ get SeedRequestType () { return exports.SeedRequestType; },
763
+ get WL_OperationType () { return exports.WL_OperationType; },
764
+ get NEMMosaicLevy () { return exports.NEMMosaicLevy; },
765
+ get NEMSupplyChangeType () { return exports.NEMSupplyChangeType; },
766
+ get NEMModificationType () { return exports.NEMModificationType; },
767
+ get NEMImportanceTransferMode () { return exports.NEMImportanceTransferMode; },
768
+ get StellarAssetType () { return exports.StellarAssetType; },
769
+ get StellarMemoType () { return exports.StellarMemoType; },
770
+ get StellarSignerType () { return exports.StellarSignerType; },
771
+ get TezosContractType () { return exports.TezosContractType; },
772
+ get TezosBallotType () { return exports.TezosBallotType; },
773
+ get CommandFlags () { return exports.CommandFlags; }
746
774
  });
747
775
 
748
- protobuf.util.Long = Long;
749
- protobuf.configure();
776
+ protobuf__namespace.util.Long = Long__namespace;
777
+ protobuf__namespace.configure();
750
778
  var index = {
751
779
  check,
752
780
  buildOne,
@@ -757,4 +785,10 @@ var index = {
757
785
  decodeProtocol,
758
786
  };
759
787
 
760
- export { AmountUnit, BUFFER_SIZE, BinanceOrderSide, BinanceOrderType, BinanceTimeInForce, COMMON_HEADER_SIZE, CardanoAddressType, CardanoCertificateType, CardanoDerivationType, CardanoNativeScriptHashDisplayFormat, CardanoNativeScriptType, CardanoPoolRelayType, CardanoTxAuxiliaryDataSupplementType, CardanoTxSigningMode, CardanoTxWitnessType, CommandFlags, DecredStakingSpendType, Enum_BackupType, Enum_ButtonRequestType, Enum_Capability, Enum_InputScriptType, Enum_OutputScriptType, Enum_PinMatrixRequestType, Enum_RequestType, Enum_SafetyCheckLevel, Enum_WordRequestType, EthereumDataType, ExportType, FailureType, HEADER_SIZE, MESSAGE_HEADER_BYTE, MESSAGE_TOP_CHAR, messages as Messages, NEMImportanceTransferMode, NEMModificationType, NEMMosaicLevy, NEMSupplyChangeType, RecoveryDeviceType, SdProtectOperationType, SeedRequestType, StellarAssetType, StellarMemoType, StellarSignerType, TezosBallotType, TezosContractType, WL_OperationType, index as default };
788
+ exports.BUFFER_SIZE = BUFFER_SIZE;
789
+ exports.COMMON_HEADER_SIZE = COMMON_HEADER_SIZE;
790
+ exports.HEADER_SIZE = HEADER_SIZE;
791
+ exports.MESSAGE_HEADER_BYTE = MESSAGE_HEADER_BYTE;
792
+ exports.MESSAGE_TOP_CHAR = MESSAGE_TOP_CHAR;
793
+ exports.Messages = messages;
794
+ exports["default"] = index;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-transport",
3
- "version": "0.1.44",
3
+ "version": "0.1.45",
4
4
  "description": "> TODO: description",
5
5
  "author": "OneKey",
6
6
  "homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
@@ -26,5 +26,5 @@
26
26
  "long": "^4.0.0",
27
27
  "protobufjs": "^6.11.2"
28
28
  },
29
- "gitHead": "fb673918587877267cbbeca6e0c6abbc56a0d0fa"
29
+ "gitHead": "0436f8ff26494933124c1c6f4586d4aeb5526c30"
30
30
  }