@onekeyfe/hd-transport 1.2.0-alpha.57 → 1.2.0-alpha.59

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.
@@ -1,5 +1,6 @@
1
1
  import { Buffer } from 'buffer';
2
2
  import ByteBuffer from 'bytebuffer';
3
+ import { Enum } from 'protobufjs/light';
3
4
 
4
5
  import { isPrimitiveField } from '../../utils/protobuf';
5
6
 
@@ -49,7 +50,10 @@ export function patch(Message: Type, payload: any) {
49
50
  // repeated
50
51
  if (field.repeated) {
51
52
  const RefMessage = Message.lookupTypeOrEnum(field.type);
52
- patched[key] = value.map((v: any) => patch(RefMessage, v));
53
+ patched[key] =
54
+ RefMessage instanceof Enum
55
+ ? value.map((v: any) => transform(field.type, v))
56
+ : value.map((v: any) => patch(RefMessage, v));
53
57
  }
54
58
  // message type
55
59
  else if (typeof value === 'object' && value !== null) {
@@ -1423,31 +1423,6 @@ export type ECDHSessionKey = {
1423
1423
  public_key?: string;
1424
1424
  };
1425
1425
 
1426
- // CosiCommit
1427
- export type CosiCommit = {
1428
- address_n: number[];
1429
- data?: string;
1430
- };
1431
-
1432
- // CosiCommitment
1433
- export type CosiCommitment = {
1434
- commitment?: string;
1435
- pubkey?: string;
1436
- };
1437
-
1438
- // CosiSign
1439
- export type CosiSign = {
1440
- address_n: number[];
1441
- data?: string;
1442
- global_commitment?: string;
1443
- global_pubkey?: string;
1444
- };
1445
-
1446
- // CosiSignature
1447
- export type CosiSignature = {
1448
- signature: string;
1449
- };
1450
-
1451
1426
  export type Path = {
1452
1427
  address_n: number[];
1453
1428
  };
@@ -1466,106 +1441,6 @@ export type EcdsaPublicKeys = {
1466
1441
  root_fingerprint?: number;
1467
1442
  };
1468
1443
 
1469
- export enum DebugSwipeDirection {
1470
- UP = 0,
1471
- DOWN = 1,
1472
- LEFT = 2,
1473
- RIGHT = 3,
1474
- }
1475
-
1476
- // DebugLinkDecision
1477
- export type DebugLinkDecision = {
1478
- yes_no?: boolean;
1479
- swipe?: DebugSwipeDirection;
1480
- input?: string;
1481
- x?: number;
1482
- y?: number;
1483
- wait?: boolean;
1484
- hold_ms?: number;
1485
- };
1486
-
1487
- // DebugLinkLayout
1488
- export type DebugLinkLayout = {
1489
- lines: string[];
1490
- };
1491
-
1492
- // DebugLinkReseedRandom
1493
- export type DebugLinkReseedRandom = {
1494
- value?: number;
1495
- };
1496
-
1497
- // DebugLinkRecordScreen
1498
- export type DebugLinkRecordScreen = {
1499
- target_directory?: string;
1500
- };
1501
-
1502
- // DebugLinkGetState
1503
- export type DebugLinkGetState = {
1504
- wait_word_list?: boolean;
1505
- wait_word_pos?: boolean;
1506
- wait_layout?: boolean;
1507
- };
1508
-
1509
- // DebugLinkState
1510
- export type DebugLinkState = {
1511
- layout?: string;
1512
- pin?: string;
1513
- matrix?: string;
1514
- mnemonic_secret?: string;
1515
- node?: HDNodeType;
1516
- passphrase_protection?: boolean;
1517
- reset_word?: string;
1518
- reset_entropy?: string;
1519
- recovery_fake_word?: string;
1520
- recovery_word_pos?: number;
1521
- reset_word_pos?: number;
1522
- mnemonic_type?: BackupType;
1523
- layout_lines: string[];
1524
- };
1525
-
1526
- // DebugLinkStop
1527
- export type DebugLinkStop = {};
1528
-
1529
- // DebugLinkLog
1530
- export type DebugLinkLog = {
1531
- level?: number;
1532
- bucket?: string;
1533
- text?: string;
1534
- };
1535
-
1536
- // DebugLinkMemoryRead
1537
- export type DebugLinkMemoryRead = {
1538
- address?: number;
1539
- length?: number;
1540
- };
1541
-
1542
- // DebugLinkMemory
1543
- export type DebugLinkMemory = {
1544
- memory?: string;
1545
- };
1546
-
1547
- // DebugLinkMemoryWrite
1548
- export type DebugLinkMemoryWrite = {
1549
- address?: number;
1550
- memory?: string;
1551
- flash?: boolean;
1552
- };
1553
-
1554
- // DebugLinkFlashErase
1555
- export type DebugLinkFlashErase = {
1556
- sector?: number;
1557
- };
1558
-
1559
- // DebugLinkEraseSdCard
1560
- export type DebugLinkEraseSdCard = {
1561
- format?: boolean;
1562
- };
1563
-
1564
- // DebugLinkWatchLayout
1565
- export type DebugLinkWatchLayout = {
1566
- watch?: boolean;
1567
- };
1568
-
1569
1444
  // DnxGetAddress
1570
1445
  export type DnxGetAddress = {
1571
1446
  address_n: number[];
@@ -2804,19 +2679,6 @@ export type Entropy = {
2804
2679
  // WipeDevice
2805
2680
  export type WipeDevice = {};
2806
2681
 
2807
- // LoadDevice
2808
- export type LoadDevice = {
2809
- mnemonics: string[];
2810
- pin?: string;
2811
- passphrase_protection?: boolean;
2812
- language?: string;
2813
- label?: string;
2814
- skip_checksum?: boolean;
2815
- u2f_counter?: number;
2816
- needs_backup?: boolean;
2817
- no_backup?: boolean;
2818
- };
2819
-
2820
2682
  // ResetDevice
2821
2683
  export type ResetDevice = {
2822
2684
  display_random?: boolean;
@@ -3492,26 +3354,6 @@ export type MoneroLiveRefreshFinalRequest = {};
3492
3354
  // MoneroLiveRefreshFinalAck
3493
3355
  export type MoneroLiveRefreshFinalAck = {};
3494
3356
 
3495
- // DebugMoneroDiagRequest
3496
- export type DebugMoneroDiagRequest = {
3497
- ins?: number;
3498
- p1?: number;
3499
- p2?: number;
3500
- pd: number[];
3501
- data1?: string;
3502
- data2?: string;
3503
- };
3504
-
3505
- // DebugMoneroDiagAck
3506
- export type DebugMoneroDiagAck = {
3507
- ins?: number;
3508
- p1?: number;
3509
- p2?: number;
3510
- pd: number[];
3511
- data1?: string;
3512
- data2?: string;
3513
- };
3514
-
3515
3357
  // NearGetAddress
3516
3358
  export type NearGetAddress = {
3517
3359
  address_n: number[];
@@ -4700,39 +4542,6 @@ export type TronMessageSignature = {
4700
4542
  signature: string;
4701
4543
  };
4702
4544
 
4703
- // WebAuthnListResidentCredentials
4704
- export type WebAuthnListResidentCredentials = {};
4705
-
4706
- // WebAuthnAddResidentCredential
4707
- export type WebAuthnAddResidentCredential = {
4708
- credential_id?: string;
4709
- };
4710
-
4711
- // WebAuthnRemoveResidentCredential
4712
- export type WebAuthnRemoveResidentCredential = {
4713
- index?: number;
4714
- };
4715
-
4716
- export type WebAuthnCredential = {
4717
- index?: number;
4718
- id?: string;
4719
- rp_id?: string;
4720
- rp_name?: string;
4721
- user_id?: string;
4722
- user_name?: string;
4723
- user_display_name?: string;
4724
- creation_time?: number;
4725
- hmac_secret?: boolean;
4726
- use_sign_count?: boolean;
4727
- algorithm?: number;
4728
- curve?: number;
4729
- };
4730
-
4731
- // WebAuthnCredentials
4732
- export type WebAuthnCredentials = {
4733
- credentials: WebAuthnCredential[];
4734
- };
4735
-
4736
4545
  // facotry
4737
4546
  export type facotry = {};
4738
4547
 
@@ -5640,27 +5449,9 @@ export type MessageType = {
5640
5449
  SignedIdentity: SignedIdentity;
5641
5450
  GetECDHSessionKey: GetECDHSessionKey;
5642
5451
  ECDHSessionKey: ECDHSessionKey;
5643
- CosiCommit: CosiCommit;
5644
- CosiCommitment: CosiCommitment;
5645
- CosiSign: CosiSign;
5646
- CosiSignature: CosiSignature;
5647
5452
  Path: Path;
5648
5453
  BatchGetPublickeys: BatchGetPublickeys;
5649
5454
  EcdsaPublicKeys: EcdsaPublicKeys;
5650
- DebugLinkDecision: DebugLinkDecision;
5651
- DebugLinkLayout: DebugLinkLayout;
5652
- DebugLinkReseedRandom: DebugLinkReseedRandom;
5653
- DebugLinkRecordScreen: DebugLinkRecordScreen;
5654
- DebugLinkGetState: DebugLinkGetState;
5655
- DebugLinkState: DebugLinkState;
5656
- DebugLinkStop: DebugLinkStop;
5657
- DebugLinkLog: DebugLinkLog;
5658
- DebugLinkMemoryRead: DebugLinkMemoryRead;
5659
- DebugLinkMemory: DebugLinkMemory;
5660
- DebugLinkMemoryWrite: DebugLinkMemoryWrite;
5661
- DebugLinkFlashErase: DebugLinkFlashErase;
5662
- DebugLinkEraseSdCard: DebugLinkEraseSdCard;
5663
- DebugLinkWatchLayout: DebugLinkWatchLayout;
5664
5455
  DnxGetAddress: DnxGetAddress;
5665
5456
  DnxAddress: DnxAddress;
5666
5457
  DnxSignTx: DnxSignTx;
@@ -5798,7 +5589,6 @@ export type MessageType = {
5798
5589
  GetEntropy: GetEntropy;
5799
5590
  Entropy: Entropy;
5800
5591
  WipeDevice: WipeDevice;
5801
- LoadDevice: LoadDevice;
5802
5592
  ResetDevice: ResetDevice;
5803
5593
  BackupDevice: BackupDevice;
5804
5594
  EntropyRequest: EntropyRequest;
@@ -5906,8 +5696,6 @@ export type MessageType = {
5906
5696
  MoneroLiveRefreshStepAck: MoneroLiveRefreshStepAck;
5907
5697
  MoneroLiveRefreshFinalRequest: MoneroLiveRefreshFinalRequest;
5908
5698
  MoneroLiveRefreshFinalAck: MoneroLiveRefreshFinalAck;
5909
- DebugMoneroDiagRequest: DebugMoneroDiagRequest;
5910
- DebugMoneroDiagAck: DebugMoneroDiagAck;
5911
5699
  NearGetAddress: NearGetAddress;
5912
5700
  NearAddress: NearAddress;
5913
5701
  NearSignTx: NearSignTx;
@@ -6062,11 +5850,6 @@ export type MessageType = {
6062
5850
  TronSignedTx: TronSignedTx;
6063
5851
  TronSignMessage: TronSignMessage;
6064
5852
  TronMessageSignature: TronMessageSignature;
6065
- WebAuthnListResidentCredentials: WebAuthnListResidentCredentials;
6066
- WebAuthnAddResidentCredential: WebAuthnAddResidentCredential;
6067
- WebAuthnRemoveResidentCredential: WebAuthnRemoveResidentCredential;
6068
- WebAuthnCredential: WebAuthnCredential;
6069
- WebAuthnCredentials: WebAuthnCredentials;
6070
5853
  facotry: facotry;
6071
5854
  experimental_message: experimental_message;
6072
5855
  experimental_field: experimental_field;