@onekeyfe/hd-core 0.0.1 → 0.0.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.
Files changed (54) hide show
  1. package/dist/api/BTCGetAddress.d.ts +3 -2
  2. package/dist/api/BTCGetAddress.d.ts.map +1 -1
  3. package/dist/api/BTCGetPublicKey.d.ts +3 -2
  4. package/dist/api/BTCGetPublicKey.d.ts.map +1 -1
  5. package/dist/api/EVMGetAddress.d.ts +3 -2
  6. package/dist/api/EVMGetAddress.d.ts.map +1 -1
  7. package/dist/api/EVMGetPublicKey.d.ts +3 -2
  8. package/dist/api/EVMGetPublicKey.d.ts.map +1 -1
  9. package/dist/api/EVMSignTransaction.d.ts +1 -7
  10. package/dist/api/EVMSignTransaction.d.ts.map +1 -1
  11. package/dist/api/GetFeatures.d.ts +1 -0
  12. package/dist/api/GetFeatures.d.ts.map +1 -1
  13. package/dist/api/SearchDevices.d.ts +1 -0
  14. package/dist/api/SearchDevices.d.ts.map +1 -1
  15. package/dist/api/helpers/pathUtils.d.ts +1 -0
  16. package/dist/api/helpers/pathUtils.d.ts.map +1 -1
  17. package/dist/device/Device.d.ts.map +1 -1
  18. package/dist/index.d.ts +55 -17
  19. package/dist/index.js +23 -5
  20. package/dist/types/api/btcGetAddress.d.ts +5 -2
  21. package/dist/types/api/btcGetAddress.d.ts.map +1 -1
  22. package/dist/types/api/btcGetPublicKey.d.ts +5 -2
  23. package/dist/types/api/btcGetPublicKey.d.ts.map +1 -1
  24. package/dist/types/api/deviceSettings.d.ts +2 -2
  25. package/dist/types/api/deviceSettings.d.ts.map +1 -1
  26. package/dist/types/api/evmGetAddress.d.ts +6 -3
  27. package/dist/types/api/evmGetAddress.d.ts.map +1 -1
  28. package/dist/types/api/evmGetPublicKey.d.ts +5 -2
  29. package/dist/types/api/evmGetPublicKey.d.ts.map +1 -1
  30. package/dist/types/api/evmSignTransaction.d.ts +8 -4
  31. package/dist/types/api/evmSignTransaction.d.ts.map +1 -1
  32. package/dist/types/api/searchDevices.d.ts +2 -2
  33. package/dist/types/api/searchDevices.d.ts.map +1 -1
  34. package/dist/types/device.d.ts +8 -0
  35. package/dist/types/device.d.ts.map +1 -1
  36. package/dist/utils/deviceFeaturesUtils.d.ts +1 -0
  37. package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
  38. package/package.json +3 -3
  39. package/src/api/BTCGetAddress.ts +8 -5
  40. package/src/api/BTCGetPublicKey.ts +8 -4
  41. package/src/api/EVMGetAddress.ts +10 -5
  42. package/src/api/EVMGetPublicKey.ts +8 -5
  43. package/src/api/EVMSignTransaction.ts +1 -6
  44. package/src/api/SearchDevices.ts +6 -1
  45. package/src/api/helpers/pathUtils.ts +13 -0
  46. package/src/device/Device.ts +4 -0
  47. package/src/types/api/btcGetAddress.ts +6 -2
  48. package/src/types/api/btcGetPublicKey.ts +6 -2
  49. package/src/types/api/deviceSettings.ts +5 -2
  50. package/src/types/api/evmGetAddress.ts +7 -3
  51. package/src/types/api/evmGetPublicKey.ts +6 -2
  52. package/src/types/api/evmSignTransaction.ts +9 -4
  53. package/src/types/api/searchDevices.ts +3 -2
  54. package/src/types/device.ts +9 -0
@@ -1,8 +1,9 @@
1
- import { Address, GetAddress } from '@onekeyfe/hd-transport/src/types/messages';
1
+ import { GetAddress } from '@onekeyfe/hd-transport/src/types/messages';
2
2
  import { BaseMethod } from './BaseMethod';
3
+ import { BTCAddress } from '../types/api/btcGetAddress';
3
4
  export default class BTCGetAddress extends BaseMethod<GetAddress[]> {
4
5
  hasBundle: boolean;
5
6
  init(): void;
6
- run(): Promise<Address | Address[]>;
7
+ run(): Promise<BTCAddress | BTCAddress[]>;
7
8
  }
8
9
  //# sourceMappingURL=BTCGetAddress.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BTCGetAddress.d.ts","sourceRoot":"","sources":["../../src/api/BTCGetAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAC;AAGhF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK1C,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU,CAAC,UAAU,EAAE,CAAC;IACjE,SAAS,UAAS;IAElB,IAAI;IA4CE,GAAG;CAeV"}
1
+ {"version":3,"file":"BTCGetAddress.d.ts","sourceRoot":"","sources":["../../src/api/BTCGetAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAC;AAGvE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAuB,MAAM,4BAA4B,CAAC;AAG7E,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU,CAAC,UAAU,EAAE,CAAC;IACjE,SAAS,UAAS;IAElB,IAAI;IA4CE,GAAG;CAkBV"}
@@ -1,8 +1,9 @@
1
- import { GetPublicKey, PublicKey } from '@onekeyfe/hd-transport/src/types/messages';
1
+ import { GetPublicKey } from '@onekeyfe/hd-transport/src/types/messages';
2
2
  import { BaseMethod } from './BaseMethod';
3
+ import { BTCPublicKey } from '../types/api/btcGetPublicKey';
3
4
  export default class BTCGetPublicKey extends BaseMethod<GetPublicKey[]> {
4
5
  hasBundle: boolean;
5
6
  init(): void;
6
- run(): Promise<PublicKey | PublicKey[]>;
7
+ run(): Promise<BTCPublicKey | BTCPublicKey[]>;
7
8
  }
8
9
  //# sourceMappingURL=BTCGetPublicKey.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BTCGetPublicKey.d.ts","sourceRoot":"","sources":["../../src/api/BTCGetPublicKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,2CAA2C,CAAC;AAGpF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK1C,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,UAAU,CAAC,YAAY,EAAE,CAAC;IACrE,SAAS,UAAS;IAElB,IAAI;IA2CE,GAAG;CAeV"}
1
+ {"version":3,"file":"BTCGetPublicKey.d.ts","sourceRoot":"","sources":["../../src/api/BTCGetPublicKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAGzE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,UAAU,CAAC,YAAY,EAAE,CAAC;IACrE,SAAS,UAAS;IAElB,IAAI;IA2CE,GAAG;CAkBV"}
@@ -1,8 +1,9 @@
1
- import { EthereumAddress, EthereumGetAddress } from '@onekeyfe/hd-transport/src/types/messages';
1
+ import { EthereumGetAddress } from '@onekeyfe/hd-transport/src/types/messages';
2
2
  import { BaseMethod } from './BaseMethod';
3
+ import { EVMAddress } from '../types/api/evmGetAddress';
3
4
  export default class EvmGetAddress extends BaseMethod<EthereumGetAddress[]> {
4
5
  hasBundle: boolean;
5
6
  init(): void;
6
- run(): Promise<EthereumAddress | EthereumAddress[]>;
7
+ run(): Promise<EVMAddress | EVMAddress[]>;
7
8
  }
8
9
  //# sourceMappingURL=EVMGetAddress.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EVMGetAddress.d.ts","sourceRoot":"","sources":["../../src/api/EVMGetAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAGhG,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU,CAAC,kBAAkB,EAAE,CAAC;IACzE,SAAS,UAAS;IAElB,IAAI;IA4BE,GAAG;CAeV"}
1
+ {"version":3,"file":"EVMGetAddress.d.ts","sourceRoot":"","sources":["../../src/api/EVMGetAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAG/E,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAuB,MAAM,4BAA4B,CAAC;AAE7E,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU,CAAC,kBAAkB,EAAE,CAAC;IACzE,SAAS,UAAS;IAElB,IAAI;IA4BE,GAAG;CAoBV"}
@@ -1,8 +1,9 @@
1
- import { EthereumGetPublicKey, EthereumPublicKey } from '@onekeyfe/hd-transport/src/types/messages';
1
+ import { EthereumGetPublicKey } from '@onekeyfe/hd-transport/src/types/messages';
2
2
  import { BaseMethod } from './BaseMethod';
3
+ import { EVMPublicKey } from '../types/api/evmGetPublicKey';
3
4
  export default class EVMGetPublicKey extends BaseMethod<EthereumGetPublicKey[]> {
4
5
  hasBundle: boolean;
5
6
  init(): void;
6
- run(): Promise<EthereumPublicKey | EthereumPublicKey[]>;
7
+ run(): Promise<EVMPublicKey | EVMPublicKey[]>;
7
8
  }
8
9
  //# sourceMappingURL=EVMGetPublicKey.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EVMGetPublicKey.d.ts","sourceRoot":"","sources":["../../src/api/EVMGetPublicKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAGpG,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,UAAU,CAAC,oBAAoB,EAAE,CAAC;IAC7E,SAAS,UAAS;IAElB,IAAI;IA4BE,GAAG;CAmBV"}
1
+ {"version":3,"file":"EVMGetPublicKey.d.ts","sourceRoot":"","sources":["../../src/api/EVMGetPublicKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAGjF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAyB,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEnF,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,UAAU,CAAC,oBAAoB,EAAE,CAAC;IAC7E,SAAS,UAAS;IAElB,IAAI;IA4BE,GAAG;CAsBV"}
@@ -1,11 +1,6 @@
1
1
  import { EthereumTxRequest } from '@onekeyfe/hd-transport/src/types/messages';
2
2
  import { BaseMethod } from './BaseMethod';
3
- import { EVMTransaction, EVMTransactionEIP1559 } from '../types/api/evmSignTransaction';
4
- declare type EVMSignedTx = {
5
- v: string;
6
- r: string;
7
- s: string;
8
- };
3
+ import { EVMSignedTx, EVMTransaction, EVMTransactionEIP1559 } from '../types/api/evmSignTransaction';
9
4
  export default class EVMSignTransaction extends BaseMethod {
10
5
  addressN: number[];
11
6
  isEIP1559: boolean;
@@ -16,5 +11,4 @@ export default class EVMSignTransaction extends BaseMethod {
16
11
  evmSignTxEip1559: (addressN: number[], tx: EVMTransactionEIP1559) => Promise<EVMSignedTx>;
17
12
  run(): Promise<EVMSignedTx>;
18
13
  }
19
- export {};
20
14
  //# sourceMappingURL=EVMSignTransaction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EVMSignTransaction.d.ts","sourceRoot":"","sources":["../../src/api/EVMSignTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAClB,MAAM,2CAA2C,CAAC;AAInD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAEL,cAAc,EACd,qBAAqB,EACtB,MAAM,iCAAiC,CAAC;AAKzC,aAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,UAAU;IACxD,QAAQ,EAAE,MAAM,EAAE,CAAM;IAExB,SAAS,UAAS;IAElB,WAAW,EAAE,cAAc,GAAG,qBAAqB,GAAG,SAAS,CAAC;IAEhE,IAAI;IAmCJ,gBAAgB,YACL,iBAAiB,QACpB,MAAM,YACF,MAAM,GAAG,SAAS,KAC3B,QAAQ,WAAW,CAAC,CA4BrB;IAEF,SAAS,aAAoB,MAAM,EAAE,MAAM,cAAc,0BAuCvD;IAEF,gBAAgB,aAAoB,MAAM,EAAE,MAAM,qBAAqB,0BAyCrE;IAEI,GAAG;CASV"}
1
+ {"version":3,"file":"EVMSignTransaction.d.ts","sourceRoot":"","sources":["../../src/api/EVMSignTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAClB,MAAM,2CAA2C,CAAC;AAInD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EACL,WAAW,EAEX,cAAc,EACd,qBAAqB,EACtB,MAAM,iCAAiC,CAAC;AAKzC,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,UAAU;IACxD,QAAQ,EAAE,MAAM,EAAE,CAAM;IAExB,SAAS,UAAS;IAElB,WAAW,EAAE,cAAc,GAAG,qBAAqB,GAAG,SAAS,CAAC;IAEhE,IAAI;IAmCJ,gBAAgB,YACL,iBAAiB,QACpB,MAAM,YACF,MAAM,GAAG,SAAS,KAC3B,QAAQ,WAAW,CAAC,CA4BrB;IAEF,SAAS,aAAoB,MAAM,EAAE,MAAM,cAAc,0BAuCvD;IAEF,gBAAgB,aAAoB,MAAM,EAAE,MAAM,qBAAqB,0BAyCrE;IAEI,GAAG;CASV"}
@@ -7,6 +7,7 @@ export default class GetFeatures extends BaseMethod {
7
7
  se_ver: string;
8
8
  serial_no: string;
9
9
  onekey_version: string;
10
+ ble_name: string;
10
11
  ble_ver: string;
11
12
  ble_enable: boolean;
12
13
  major_version: number;
@@ -1 +1 @@
1
- {"version":3,"file":"GetFeatures.d.ts","sourceRoot":"","sources":["../../src/api/GetFeatures.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,UAAU;IACjD,IAAI;IAIJ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGJ"}
1
+ {"version":3,"file":"GetFeatures.d.ts","sourceRoot":"","sources":["../../src/api/GetFeatures.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,UAAU;IACjD,IAAI;IAIJ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGJ"}
@@ -5,6 +5,7 @@ export default class SearchDevices extends BaseMethod {
5
5
  init(): void;
6
6
  run(): Promise<{
7
7
  connectId: string;
8
+ deviceType: string;
8
9
  path: string;
9
10
  session?: string | null | undefined;
10
11
  debugSession?: string | null | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"SearchDevices.d.ts","sourceRoot":"","sources":["../../src/api/SearchDevices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,eAAe,MAAM,2BAA2B,CAAC;AAKxD,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU;IACnD,SAAS,CAAC,EAAE,eAAe,CAAC;IAE5B,IAAI;IAIE,GAAG;;;;;;;;;CA0BV"}
1
+ {"version":3,"file":"SearchDevices.d.ts","sourceRoot":"","sources":["../../src/api/SearchDevices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,eAAe,MAAM,2BAA2B,CAAC;AAKxD,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU;IACnD,SAAS,CAAC,EAAE,eAAe,CAAC;IAE5B,IAAI;IAIE,GAAG;;;;;;;;;;CA+BV"}
@@ -8,5 +8,6 @@ export declare const isSegwitPath: (path: Array<number>) => boolean;
8
8
  export declare const isBech32Path: (path: Array<number>) => boolean;
9
9
  export declare const getScriptType: (path: Array<number>) => InputScriptType;
10
10
  export declare const getOutputScriptType: (path?: number[] | undefined) => ChangeOutputScriptType;
11
+ export declare const serializedPath: (path: Array<number>) => string;
11
12
  export declare const validatePath: (path: string | Array<number>, length?: number, base?: boolean) => Array<number>;
12
13
  //# sourceMappingURL=pathUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pathUtils.d.ts","sourceRoot":"","sources":["../../../src/api/helpers/pathUtils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAGpG,eAAO,MAAM,WAAW,aAAa,CAAC;AACtC,eAAO,MAAM,UAAU,MAAO,MAAM,KAAG,MAAiC,CAAC;AACzE,eAAO,MAAM,YAAY,MAAO,MAAM,KAAG,MAAkC,CAAC;AAQ5E,eAAO,MAAM,SAAS,SAAU,MAAM,KAAG,MAAM,MAAM,CAuBpD,CAAC;AAEF,eAAO,MAAM,cAAc,SAAU,MAAM,MAAM,CAAC,KAAG,OACF,CAAC;AAEpD,eAAO,MAAM,YAAY,SAAU,MAAM,MAAM,CAAC,KAAG,OACA,CAAC;AAEpD,eAAO,MAAM,YAAY,SAAU,MAAM,MAAM,CAAC,KAAG,OACA,CAAC;AAEpD,eAAO,MAAM,aAAa,SAAU,MAAM,MAAM,CAAC,KAAG,eAcnD,CAAC;AAEF,eAAO,MAAM,mBAAmB,mCAAsB,sBAmBrD,CAAC;AAEF,eAAO,MAAM,YAAY,SACjB,MAAM,GAAG,MAAM,MAAM,CAAC,sCAG3B,MAAM,MAAM,CAoBd,CAAC"}
1
+ {"version":3,"file":"pathUtils.d.ts","sourceRoot":"","sources":["../../../src/api/helpers/pathUtils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAA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YAAY,IAAI,OAAO;IAIvB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;CAqBrD;AAED,eAAe,MAAM,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import EventEmitter, { EventEmitter as EventEmitter$1 } from 'events';
2
- import { OneKeyDeviceInfo, Messages, Transport } from '@onekeyfe/hd-transport';
2
+ import { Messages, Transport, OneKeyDeviceInfo } from '@onekeyfe/hd-transport';
3
3
  export { Messages as PROTO } from '@onekeyfe/hd-transport';
4
- import { EthereumAddress, EthereumPublicKey, EthereumMessageSignature, Success as Success$1, Address, MultisigRedeemScriptType, InputScriptType, PublicKey, MessageSignature, TxInputType, TxOutputType, PrevInput, TxOutputBinType, TxInput, RecoveryDeviceType } from '@onekeyfe/hd-transport/src/types/messages';
4
+ import { EthereumPublicKey, EthereumMessageSignature, Success as Success$1, Address, MultisigRedeemScriptType, InputScriptType, PublicKey, MessageSignature, TxInputType, TxOutputType, PrevInput, TxOutputBinType, TxInput, RecoveryDeviceType, SafetyCheckLevel } from '@onekeyfe/hd-transport/src/types/messages';
5
5
 
6
6
  interface CommonParams {
7
7
  keepSession?: boolean;
@@ -23,8 +23,6 @@ declare const on: <T extends string, P extends (...args: any[]) => any>(type: T,
23
23
  declare const off: (type: any, fn: any) => void;
24
24
  declare const removeAllListeners: (type: any) => void;
25
25
 
26
- declare function searchDevices(): Response<OneKeyDeviceInfo[]>;
27
-
28
26
  declare const ERROR_CODES: {
29
27
  Method_InvalidParameter: string;
30
28
  Call_API: string;
@@ -141,6 +139,7 @@ declare type KnownDevice = {
141
139
  deviceType: IDeviceType;
142
140
  path: string;
143
141
  label: string;
142
+ name: string;
144
143
  error?: typeof undefined;
145
144
  mode: DeviceMode;
146
145
  features: Messages.Features;
@@ -148,6 +147,13 @@ declare type KnownDevice = {
148
147
  bleFirmwareVersion: IVersionArray | null;
149
148
  firmwareVersion: IVersionArray | null;
150
149
  };
150
+ declare type SearchDevice = {
151
+ connectId: string | null;
152
+ uuid: string;
153
+ deviceId: string | null;
154
+ deviceType: IDeviceType;
155
+ name: string;
156
+ };
151
157
  declare type Device$1 = KnownDevice;
152
158
  declare type Features = Messages.Features;
153
159
  declare type IDeviceType = 'classic' | 'mini' | 'touch' | 'pro';
@@ -155,6 +161,8 @@ declare type IDeviceFirmwareStatus = 'valid' | 'outdated' | 'required' | 'unknow
155
161
  declare type IDeviceBLEFirmwareStatus = 'valid' | 'outdated' | 'required' | 'unknown' | 'none';
156
162
  declare type ITransportStatus = 'valid' | 'outdated';
157
163
 
164
+ declare function searchDevices(): Response<SearchDevice[]>;
165
+
158
166
  declare function getFeatures(connectId?: string): Response<Features>;
159
167
 
160
168
  declare function checkFirmwareRelease(connectId?: string): Response<IDeviceFirmwareStatus>;
@@ -202,23 +210,30 @@ declare type TransportReleaseStatus = 'valid' | 'outdated';
202
210
 
203
211
  declare function checkTransportRelease(): Response<TransportReleaseStatus>;
204
212
 
213
+ declare type EVMAddress = {
214
+ path: string;
215
+ address: string;
216
+ };
205
217
  declare type EVMGetAddressParams = {
206
218
  path: string | number[];
207
219
  showOnOneKey?: boolean;
208
220
  };
209
- declare function evmGetAddress(connectId: string, params: CommonParams & EVMGetAddressParams): Response<EthereumAddress>;
221
+ declare function evmGetAddress(connectId: string, params: CommonParams & EVMGetAddressParams): Response<EVMAddress>;
210
222
  declare function evmGetAddress(connectId: string, params: CommonParams & {
211
223
  bundle?: EVMGetAddressParams[];
212
- }): Response<Array<EthereumAddress>>;
224
+ }): Response<Array<EVMAddress>>;
213
225
 
226
+ declare type EVMPublicKey = {
227
+ path: string;
228
+ } & EthereumPublicKey;
214
229
  declare type EVMGetPublicKeyParams = {
215
230
  path: string | number[];
216
231
  showOnOneKey?: boolean;
217
232
  };
218
- declare function evmGetPublicKey(connectId: string, params: CommonParams & EVMGetPublicKeyParams): Response<EthereumPublicKey>;
233
+ declare function evmGetPublicKey(connectId: string, params: CommonParams & EVMGetPublicKeyParams): Response<EVMPublicKey>;
219
234
  declare function evmGetPublicKey(connectId: string, params: CommonParams & {
220
235
  bundle?: EVMGetPublicKeyParams[];
221
- }): Response<Array<EthereumPublicKey>>;
236
+ }): Response<Array<EVMPublicKey>>;
222
237
 
223
238
  declare type EVMSignMessageParams = {
224
239
  path: string | number[];
@@ -233,7 +248,12 @@ declare type EVMSignMessageEIP712Params = {
233
248
  };
234
249
  declare function evmSignMessageEIP712(connectId: string, params: CommonParams & EVMSignMessageEIP712Params): Response<EthereumMessageSignature>;
235
250
 
236
- interface EVMTransaction {
251
+ declare type EVMSignedTx = {
252
+ v: string;
253
+ r: string;
254
+ s: string;
255
+ };
256
+ declare type EVMTransaction = {
237
257
  to: string;
238
258
  value: string;
239
259
  gasPrice: string;
@@ -244,7 +264,7 @@ interface EVMTransaction {
244
264
  data?: string;
245
265
  chainId: number;
246
266
  txType?: number;
247
- }
267
+ };
248
268
  declare type EVMAccessList = {
249
269
  address: string;
250
270
  storageKeys: string[];
@@ -265,7 +285,7 @@ declare type EVMSignTransactionParams = {
265
285
  path: string | number[];
266
286
  transaction: EVMTransaction | EVMTransactionEIP1559;
267
287
  };
268
- declare function evmSignTransaction(connectId: string, params: CommonParams & EVMSignTransactionParams): Response<EthereumMessageSignature>;
288
+ declare function evmSignTransaction(connectId: string, params: CommonParams & EVMSignTransactionParams): Response<EVMSignedTx>;
269
289
 
270
290
  declare type EthereumSignTypedDataTypeProperty = {
271
291
  name: string;
@@ -305,6 +325,9 @@ declare type EVMVerifyMessageParams = {
305
325
  };
306
326
  declare function evmVerifyMessage(connectId: string, params: CommonParams & EVMVerifyMessageParams): Response<Success$1>;
307
327
 
328
+ declare type BTCAddress = {
329
+ path: string;
330
+ } & Address;
308
331
  declare type BTCGetAddressParams = {
309
332
  path: string | number[];
310
333
  coin?: string;
@@ -312,21 +335,24 @@ declare type BTCGetAddressParams = {
312
335
  multisig?: MultisigRedeemScriptType;
313
336
  scriptType?: InputScriptType;
314
337
  };
315
- declare function btcGetAddress(connectId: string, params: CommonParams & BTCGetAddressParams): Response<Address>;
338
+ declare function btcGetAddress(connectId: string, params: CommonParams & BTCGetAddressParams): Response<BTCAddress>;
316
339
  declare function btcGetAddress(connectId: string, params: CommonParams & {
317
340
  bundle?: BTCGetAddressParams[];
318
- }): Response<Array<Address>>;
341
+ }): Response<Array<BTCAddress>>;
319
342
 
343
+ declare type BTCPublicKey = {
344
+ path: string;
345
+ } & PublicKey;
320
346
  declare type BTCGetPublicKeyParams = {
321
347
  path: string | number[];
322
348
  coin?: string;
323
349
  showOnOneKey?: boolean;
324
350
  scriptType?: InputScriptType;
325
351
  };
326
- declare function btcGetPublicKey(connectId: string, params: CommonParams & BTCGetPublicKeyParams): Response<PublicKey>;
352
+ declare function btcGetPublicKey(connectId: string, params: CommonParams & BTCGetPublicKeyParams): Response<BTCPublicKey>;
327
353
  declare function btcGetPublicKey(connectId: string, params: CommonParams & {
328
354
  bundle?: BTCGetPublicKeyParams[];
329
- }): Response<Array<PublicKey>>;
355
+ }): Response<Array<BTCPublicKey>>;
330
356
 
331
357
  declare type BTCSignMessageParams = {
332
358
  path: string | number[];
@@ -441,7 +467,19 @@ declare type DeviceChangePinParams = {
441
467
  };
442
468
  declare function deviceChangePin(connectId: string, params: CommonParams & DeviceChangePinParams): Response<Success$1>;
443
469
 
444
- declare function deviceSettings(connectId: string): Response<Success$1>;
470
+ declare type DeviceSettingsParams = {
471
+ language?: string;
472
+ label?: string;
473
+ usePassphrase?: boolean;
474
+ homescreen?: string;
475
+ passphraseSource?: number;
476
+ autoLockDelayMs?: number;
477
+ displayRotation?: number;
478
+ passphraseAlwaysOnDevice?: boolean;
479
+ safetyChecks?: SafetyCheckLevel;
480
+ experimentalFeatures?: boolean;
481
+ };
482
+ declare function deviceSettings(connectId: string, params: CommonParams & DeviceSettingsParams): Response<Success$1>;
445
483
 
446
484
  declare type DeviceFlagsParams = {
447
485
  flags?: number;
@@ -820,4 +858,4 @@ declare class DataManager {
820
858
 
821
859
  declare const HardwareSdk: ({ init, call, dispose, eventEmitter, uiResponse, cancel, }: InjectApi) => CoreApi;
822
860
 
823
- export { AssetsMap, CORE_EVENT, CallMethod, CallMethodAnyResponse, CallMethodKeys, CallMethodPayload, CallMethodResponse, CallMethodUnion, CommonParams, ConnectSettings, Core, CoreApi, CoreMessage, DEFAULT_PRIORITY, DEVICE, DataManager, Deferred, Device$1 as Device, DeviceButtonRequestPayload, DeviceMode, DeviceStatus, DeviceTypeMap, errors as ERRORS, Features, FirmwareRange, FirmwareRelease, IBLEFirmwareReleaseInfo, IDeviceBLEFirmwareStatus, IDeviceFirmwareStatus, IDeviceType, IFRAME, IFirmwareReleaseInfo, IFrameBridge, IFrameCallMessage, IFrameEvent, IFrameEventMessage, IFrameInit, ILocale, ITransportStatus, IVersionArray, KnownDevice, MethodResponseMessage, PostMessageEvent, RESPONSE_EVENT, ReleaseInfo, RemoteConfigResponse, Response, Success, TransportReleaseStatus, UI_EVENT, UI_REQUEST, UI_RESPONSE, UiEvent, UiEventMessage, UiPromise, UiPromiseResponse, UiRequestDeviceAction, UiResponseEvent, UiResponseMessage, UiResponsePin, UnavailableCapabilities, UnavailableCapability, Unsuccessful, VersionArray, corsValidator, create, createErrorMessage, createIFrameMessage, createResponseMessage, createUiMessage, createUiResponse, HardwareSdk as default, enableLog, getEnv, getTimeStamp, httpRequest, init as initCore, initLog, isValidVersionArray, isValidVersionString, normalizeVersionArray, parseConnectSettings, parseMessage, versionCompare, versionSplit };
861
+ export { AssetsMap, CORE_EVENT, CallMethod, CallMethodAnyResponse, CallMethodKeys, CallMethodPayload, CallMethodResponse, CallMethodUnion, CommonParams, ConnectSettings, Core, CoreApi, CoreMessage, DEFAULT_PRIORITY, DEVICE, DataManager, Deferred, Device$1 as Device, DeviceButtonRequestPayload, DeviceMode, DeviceStatus, DeviceTypeMap, errors as ERRORS, Features, FirmwareRange, FirmwareRelease, IBLEFirmwareReleaseInfo, IDeviceBLEFirmwareStatus, IDeviceFirmwareStatus, IDeviceType, IFRAME, IFirmwareReleaseInfo, IFrameBridge, IFrameCallMessage, IFrameEvent, IFrameEventMessage, IFrameInit, ILocale, ITransportStatus, IVersionArray, KnownDevice, MethodResponseMessage, PostMessageEvent, RESPONSE_EVENT, ReleaseInfo, RemoteConfigResponse, Response, SearchDevice, Success, TransportReleaseStatus, UI_EVENT, UI_REQUEST, UI_RESPONSE, UiEvent, UiEventMessage, UiPromise, UiPromiseResponse, UiRequestDeviceAction, UiResponseEvent, UiResponseMessage, UiResponsePin, UnavailableCapabilities, UnavailableCapability, Unsuccessful, VersionArray, corsValidator, create, createErrorMessage, createIFrameMessage, createResponseMessage, createUiMessage, createUiResponse, HardwareSdk as default, enableLog, getEnv, getTimeStamp, httpRequest, init as initCore, initLog, isValidVersionArray, isValidVersionString, normalizeVersionArray, parseConnectSettings, parseMessage, versionCompare, versionSplit };
package/dist/index.js CHANGED
@@ -10107,6 +10107,9 @@ class Device extends events.exports {
10107
10107
  deviceType: getDeviceType(this.features),
10108
10108
  deviceId: this.features.device_id || null,
10109
10109
  path: this.originalDescriptor.path,
10110
+ name: this.features.ble_name ||
10111
+ this.features.label ||
10112
+ `OneKey ${getDeviceType(this.features).toUpperCase()}`,
10110
10113
  label: getDeviceLabel(this.features),
10111
10114
  mode: this.getMode(),
10112
10115
  features: this.features,
@@ -10440,7 +10443,7 @@ class SearchDevices extends BaseMethod {
10440
10443
  const devicesDescriptor = (_c = deviceDiff === null || deviceDiff === void 0 ? void 0 : deviceDiff.descriptors) !== null && _c !== void 0 ? _c : [];
10441
10444
  const env = DataManager.getSettings('env');
10442
10445
  if (env === 'react-native') {
10443
- return devicesDescriptor.map(device => (Object.assign(Object.assign({}, device), { connectId: device.id })));
10446
+ return devicesDescriptor.map(device => (Object.assign(Object.assign({}, device), { connectId: device.id, deviceType: 'classic' })));
10444
10447
  }
10445
10448
  const devices = [];
10446
10449
  try {
@@ -10540,6 +10543,17 @@ const getOutputScriptType = (path) => {
10540
10543
  return 'PAYTOADDRESS';
10541
10544
  }
10542
10545
  };
10546
+ const serializedPath = (path) => {
10547
+ const pathStr = path
10548
+ .map((p) => {
10549
+ if (p & HD_HARDENED) {
10550
+ return `${p & ~HD_HARDENED}'`;
10551
+ }
10552
+ return p;
10553
+ })
10554
+ .join('/');
10555
+ return `m/${pathStr}`;
10556
+ };
10543
10557
  const validatePath = (path, length = 0, base = false) => {
10544
10558
  let valid;
10545
10559
  if (typeof path === 'string') {
@@ -10945,7 +10959,7 @@ class BTCGetAddress extends BaseMethod {
10945
10959
  for (let i = 0; i < this.params.length; i++) {
10946
10960
  const param = this.params[i];
10947
10961
  const res = yield this.device.commands.typedCall('GetAddress', 'Address', Object.assign({}, param));
10948
- responses.push(res.message);
10962
+ responses.push(Object.assign({ path: serializedPath(param.address_n) }, res.message));
10949
10963
  }
10950
10964
  return Promise.resolve(this.hasBundle ? responses : responses[0]);
10951
10965
  });
@@ -10996,7 +11010,7 @@ class BTCGetPublicKey extends BaseMethod {
10996
11010
  for (let i = 0; i < this.params.length; i++) {
10997
11011
  const param = this.params[i];
10998
11012
  const res = yield this.device.commands.typedCall('GetPublicKey', 'PublicKey', Object.assign({}, param));
10999
- responses.push(res.message);
11013
+ responses.push(Object.assign({ path: serializedPath(param.address_n) }, res.message));
11000
11014
  }
11001
11015
  return Promise.resolve(this.hasBundle ? responses : responses[0]);
11002
11016
  });
@@ -11662,7 +11676,11 @@ class EvmGetAddress extends BaseMethod {
11662
11676
  for (let i = 0; i < this.params.length; i++) {
11663
11677
  const param = this.params[i];
11664
11678
  const res = yield this.device.commands.typedCall('EthereumGetAddress', 'EthereumAddress', Object.assign({}, param));
11665
- responses.push(res.message);
11679
+ const { address } = res.message;
11680
+ responses.push({
11681
+ path: serializedPath(param.address_n),
11682
+ address,
11683
+ });
11666
11684
  }
11667
11685
  return Promise.resolve(this.hasBundle ? responses : responses[0]);
11668
11686
  });
@@ -11701,7 +11719,7 @@ class EVMGetPublicKey extends BaseMethod {
11701
11719
  for (let i = 0; i < this.params.length; i++) {
11702
11720
  const param = this.params[i];
11703
11721
  const res = yield this.device.commands.typedCall('EthereumGetPublicKey', 'EthereumPublicKey', Object.assign({}, param));
11704
- responses.push(res.message);
11722
+ responses.push(Object.assign({ path: serializedPath(param.address_n) }, res.message));
11705
11723
  }
11706
11724
  return Promise.resolve(this.hasBundle ? responses : responses[0]);
11707
11725
  });
@@ -1,5 +1,8 @@
1
1
  import { Address, InputScriptType, MultisigRedeemScriptType } from '@onekeyfe/hd-transport/src/types/messages';
2
2
  import type { CommonParams, Response } from '../params';
3
+ export declare type BTCAddress = {
4
+ path: string;
5
+ } & Address;
3
6
  export declare type BTCGetAddressParams = {
4
7
  path: string | number[];
5
8
  coin?: string;
@@ -7,8 +10,8 @@ export declare type BTCGetAddressParams = {
7
10
  multisig?: MultisigRedeemScriptType;
8
11
  scriptType?: InputScriptType;
9
12
  };
10
- export declare function btcGetAddress(connectId: string, params: CommonParams & BTCGetAddressParams): Response<Address>;
13
+ export declare function btcGetAddress(connectId: string, params: CommonParams & BTCGetAddressParams): Response<BTCAddress>;
11
14
  export declare function btcGetAddress(connectId: string, params: CommonParams & {
12
15
  bundle?: BTCGetAddressParams[];
13
- }): Response<Array<Address>>;
16
+ }): Response<Array<BTCAddress>>;
14
17
  //# sourceMappingURL=btcGetAddress.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"btcGetAddress.d.ts","sourceRoot":"","sources":["../../../src/types/api/btcGetAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,eAAe,EACf,wBAAwB,EACzB,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,oBAAY,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EA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,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC"}
@@ -1,13 +1,16 @@
1
1
  import { InputScriptType, PublicKey } from '@onekeyfe/hd-transport/src/types/messages';
2
2
  import type { CommonParams, Response } from '../params';
3
+ export declare type BTCPublicKey = {
4
+ path: string;
5
+ } & PublicKey;
3
6
  export declare type BTCGetPublicKeyParams = {
4
7
  path: string | number[];
5
8
  coin?: string;
6
9
  showOnOneKey?: boolean;
7
10
  scriptType?: InputScriptType;
8
11
  };
9
- export declare function btcGetPublicKey(connectId: string, params: CommonParams & BTCGetPublicKeyParams): Response<PublicKey>;
12
+ export declare function btcGetPublicKey(connectId: string, params: CommonParams & BTCGetPublicKeyParams): Response<BTCPublicKey>;
10
13
  export declare function btcGetPublicKey(connectId: string, params: CommonParams & {
11
14
  bundle?: BTCGetPublicKeyParams[];
12
- }): Response<Array<PublicKey>>;
15
+ }): Response<Array<BTCPublicKey>>;
13
16
  //# sourceMappingURL=btcGetPublicKey.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"btcGetPublicKey.d.ts","sourceRoot":"","sources":["../../../src/types/api/btcGetPublicKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,2CAA2C,CAAC;AACvF,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,oBAAY,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,eAAe,CAAC;CAC9B,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GAAG,qBAAqB,GAC3C,QAAQ,CAAC,SAAS,CAAC,CAAC;AAEvB,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GAAG;IAAE,MAAM,CAAC,EAAE,qBAAqB,EAAE,CAAA;CAAE,GAC1D,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"btcGetPublicKey.d.ts","sourceRoot":"","sources":["../../../src/types/api/btcGetPublicKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,2CAA2C,CAAC;AACvF,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,oBAAY,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,SAAS,CAAC;AAEd,oBAAY,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,eAAe,CAAC;CAC9B,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GAAG,qBAAqB,GAC3C,QAAQ,CAAC,YAAY,CAAC,CAAC;AAE1B,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GAAG;IAAE,MAAM,CAAC,EAAE,qBAAqB,EAAE,CAAA;CAAE,GAC1D,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { SafetyCheckLevel, Success } from '@onekeyfe/hd-transport/src/types/messages';
2
- import type { Response } from '../params';
2
+ import type { CommonParams, Response } from '../params';
3
3
  export declare type DeviceSettingsParams = {
4
4
  language?: string;
5
5
  label?: string;
@@ -12,5 +12,5 @@ export declare type DeviceSettingsParams = {
12
12
  safetyChecks?: SafetyCheckLevel;
13
13
  experimentalFeatures?: boolean;
14
14
  };
15
- export declare function deviceSettings(connectId: string): Response<Success>;
15
+ export declare function deviceSettings(connectId: string, params: CommonParams & DeviceSettingsParams): Response<Success>;
16
16
  //# sourceMappingURL=deviceSettings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deviceSettings.d.ts","sourceRoot":"","sources":["../../../src/types/api/deviceSettings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AACtF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1C,oBAAY,oBAAoB,GAAG;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC"}
1
+ {"version":3,"file":"deviceSettings.d.ts","sourceRoot":"","sources":["../../../src/types/api/deviceSettings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AACtF,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,oBAAY,oBAAoB,GAAG;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GAAG,oBAAoB,GAC1C,QAAQ,CAAC,OAAO,CAAC,CAAC"}
@@ -1,11 +1,14 @@
1
- import { EthereumAddress } from '@onekeyfe/hd-transport/src/types/messages';
2
1
  import type { CommonParams, Response } from '../params';
2
+ export declare type EVMAddress = {
3
+ path: string;
4
+ address: string;
5
+ };
3
6
  export declare type EVMGetAddressParams = {
4
7
  path: string | number[];
5
8
  showOnOneKey?: boolean;
6
9
  };
7
- export declare function evmGetAddress(connectId: string, params: CommonParams & EVMGetAddressParams): Response<EthereumAddress>;
10
+ export declare function evmGetAddress(connectId: string, params: CommonParams & EVMGetAddressParams): Response<EVMAddress>;
8
11
  export declare function evmGetAddress(connectId: string, params: CommonParams & {
9
12
  bundle?: EVMGetAddressParams[];
10
- }): Response<Array<EthereumAddress>>;
13
+ }): Response<Array<EVMAddress>>;
11
14
  //# sourceMappingURL=evmGetAddress.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"evmGetAddress.d.ts","sourceRoot":"","sources":["../../../src/types/api/evmGetAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,oBAAY,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,aAAa,CACnC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GAAG,mBAAmB,GACzC,QAAQ,CAAC,eAAe,CAAC,CAAC;AAE7B,MAAM,CAAC,OAAO,UAAU,aAAa,CACnC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GAAG;IAAE,MAAM,CAAC,EAAE,mBAAmB,EAAE,CAAA;CAAE,GACxD,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"evmGetAddress.d.ts","sourceRoot":"","sources":["../../../src/types/api/evmGetAddress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,oBAAY,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,oBAAY,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,aAAa,CACnC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GAAG,mBAAmB,GACzC,QAAQ,CAAC,UAAU,CAAC,CAAC;AAExB,MAAM,CAAC,OAAO,UAAU,aAAa,CACnC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GAAG;IAAE,MAAM,CAAC,EAAE,mBAAmB,EAAE,CAAA;CAAE,GACxD,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC"}
@@ -1,11 +1,14 @@
1
1
  import { EthereumPublicKey } from '@onekeyfe/hd-transport/src/types/messages';
2
2
  import type { CommonParams, Response } from '../params';
3
+ export declare type EVMPublicKey = {
4
+ path: string;
5
+ } & EthereumPublicKey;
3
6
  export declare type EVMGetPublicKeyParams = {
4
7
  path: string | number[];
5
8
  showOnOneKey?: boolean;
6
9
  };
7
- export declare function evmGetPublicKey(connectId: string, params: CommonParams & EVMGetPublicKeyParams): Response<EthereumPublicKey>;
10
+ export declare function evmGetPublicKey(connectId: string, params: CommonParams & EVMGetPublicKeyParams): Response<EVMPublicKey>;
8
11
  export declare function evmGetPublicKey(connectId: string, params: CommonParams & {
9
12
  bundle?: EVMGetPublicKeyParams[];
10
- }): Response<Array<EthereumPublicKey>>;
13
+ }): Response<Array<EVMPublicKey>>;
11
14
  //# sourceMappingURL=evmGetPublicKey.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"evmGetPublicKey.d.ts","sourceRoot":"","sources":["../../../src/types/api/evmGetPublicKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,oBAAY,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GAAG,qBAAqB,GAC3C,QAAQ,CAAC,iBAAiB,CAAC,CAAC;AAE/B,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GAAG;IAAE,MAAM,CAAC,EAAE,qBAAqB,EAAE,CAAA;CAAE,GAC1D,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"evmGetPublicKey.d.ts","sourceRoot":"","sources":["../../../src/types/api/evmGetPublicKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,oBAAY,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,iBAAiB,CAAC;AAEtB,oBAAY,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GAAG,qBAAqB,GAC3C,QAAQ,CAAC,YAAY,CAAC,CAAC;AAE1B,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GAAG;IAAE,MAAM,CAAC,EAAE,qBAAqB,EAAE,CAAA;CAAE,GAC1D,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC"}
@@ -1,6 +1,10 @@
1
- import { EthereumMessageSignature } from '@onekeyfe/hd-transport/src/types/messages';
2
1
  import type { CommonParams, Response } from '../params';
3
- export interface EVMTransaction {
2
+ export declare type EVMSignedTx = {
3
+ v: string;
4
+ r: string;
5
+ s: string;
6
+ };
7
+ export declare type EVMTransaction = {
4
8
  to: string;
5
9
  value: string;
6
10
  gasPrice: string;
@@ -11,7 +15,7 @@ export interface EVMTransaction {
11
15
  data?: string;
12
16
  chainId: number;
13
17
  txType?: number;
14
- }
18
+ };
15
19
  export declare type EVMAccessList = {
16
20
  address: string;
17
21
  storageKeys: string[];
@@ -32,5 +36,5 @@ export declare type EVMSignTransactionParams = {
32
36
  path: string | number[];
33
37
  transaction: EVMTransaction | EVMTransactionEIP1559;
34
38
  };
35
- export declare function evmSignTransaction(connectId: string, params: CommonParams & EVMSignTransactionParams): Response<EthereumMessageSignature>;
39
+ export declare function evmSignTransaction(connectId: string, params: CommonParams & EVMSignTransactionParams): Response<EVMSignedTx>;
36
40
  //# sourceMappingURL=evmSignTransaction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"evmSignTransaction.d.ts","sourceRoot":"","sources":["../../../src/types/api/evmSignTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,SAAS,CAAC;IAChC,oBAAoB,CAAC,EAAE,OAAO,SAAS,CAAC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,oBAAY,aAAa,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAEF,oBAAY,qBAAqB,GAAG;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,SAAS,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,UAAU,CAAC,EAAE,aAAa,EAAE,CAAC;CAC9B,CAAC;AAEF,oBAAY,wBAAwB,GAAG;IACrC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,WAAW,EAAE,cAAc,GAAG,qBAAqB,CAAC;CACrD,CAAC;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AU,CAAC,EAAE,aAAa,EAAE,CAAC;CAC9B,CAAC;AAEF,oBAAY,wBAAwB,GAAG;IACrC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,WAAW,EAAE,cAAc,GAAG,qBAAqB,CAAC;CACrD,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GAAG,wBAAwB,GAC9C,QAAQ,CAAC,WAAW,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- import { OneKeyDeviceInfo as DeviceDescriptor } from '@onekeyfe/hd-transport';
1
+ import { SearchDevice } from '../device';
2
2
  import { Response } from '../params';
3
- export declare function searchDevices(): Response<DeviceDescriptor[]>;
3
+ export declare function searchDevices(): Response<SearchDevice[]>;
4
4
  //# sourceMappingURL=searchDevices.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"searchDevices.d.ts","sourceRoot":"","sources":["../../../src/types/api/searchDevices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,IAAI,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,MAAM,CAAC,OAAO,UAAU,aAAa,IAAI,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAC"}
1
+ {"version":3,"file":"searchDevices.d.ts","sourceRoot":"","sources":["../../../src/types/api/searchDevices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,MAAM,CAAC,OAAO,UAAU,aAAa,IAAI,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC"}
@@ -13,6 +13,7 @@ export declare type KnownDevice = {
13
13
  deviceType: IDeviceType;
14
14
  path: string;
15
15
  label: string;
16
+ name: string;
16
17
  error?: typeof undefined;
17
18
  mode: DeviceMode;
18
19
  features: PROTO.Features;
@@ -20,6 +21,13 @@ export declare type KnownDevice = {
20
21
  bleFirmwareVersion: IVersionArray | null;
21
22
  firmwareVersion: IVersionArray | null;
22
23
  };
24
+ export declare type SearchDevice = {
25
+ connectId: string | null;
26
+ uuid: string;
27
+ deviceId: string | null;
28
+ deviceType: IDeviceType;
29
+ name: string;
30
+ };
23
31
  export declare type Device = KnownDevice;
24
32
  export declare type Features = PROTO.Features;
25
33
  export declare type IDeviceType = 'classic' | 'mini' | 'touch' | 'pro';
@@ -1 +1 @@
1
- {"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../src/types/device.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,oBAAY,YAAY,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,CAAC;AAE7D,oBAAY,UAAU,GAAG,QAAQ,GAAG,YAAY,GAAG,YAAY,GAAG,UAAU,CAAC;AAE7E,oBAAY,qBAAqB,GAC7B,eAAe,GACf,YAAY,GACZ,iBAAiB,GACjB,yBAAyB,CAAC;AAE9B,oBAAY,uBAAuB,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,qBAAqB,CAAA;CAAE,CAAC;AAE/E,oBAAY,WAAW,GAAG;IACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,WAAW,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,SAAS,CAAC;IACzB,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC;IACzB,uBAAuB,EAAE,uBAAuB,CAAC;IACjD,kBAAkB,EAAE,aAAa,GAA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,OAAO,SAAS,CAAC;IACzB,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC;IACzB,uBAAuB,EAAE,uBAAuB,CAAC;IACjD,kBAAkB,EAAE,aAAa,GAAG,IAAI,CAAC;IACzC,eAAe,EAAE,aAAa,GAAG,IAAI,CAAC;CACvC,CAAC;AAEF,oBAAY,YAAY,GAAG;IACzB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,WAAW,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAgCF,oBAAY,MAAM,GAAG,WAAW,CAAC;AAEjC,oBAAY,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;AAEtC,oBAAY,WAAW,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AAE/D,oBAAY,qBAAqB,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;AAE3F,oBAAY,wBAAwB,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;AAE9F,oBAAY,gBAAgB,GAAG,OAAO,GAAG,UAAU,CAAC"}
@@ -5,6 +5,7 @@ export declare const getDeviceType: (features?: {
5
5
  se_ver: string;
6
6
  serial_no: string;
7
7
  onekey_version: string;
8
+ ble_name: string;
8
9
  ble_ver: string;
9
10
  ble_enable: boolean;
10
11
  major_version: number;
@@ -1 +1 @@
1
- {"version":3,"file":"deviceFeaturesUtils.d.ts","sourceRoot":"","sources":["../../src/utils/deviceFeaturesUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAErE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAA0B,WASnD,CAAC;AAEF,eAAO,MAAM,aAAa,aAAc,QAAQ,WAM/C,CAAC;AAEF,eAAO,MAAM,cAAc,aAAc,QAAQ,WAOhD,CAAC;AAKF,eAAO,MAAM,wBAAwB,aAAc,QAAQ,kBAK1D,CAAC;AAKF,eAAO,MAAM,2BAA2B,aAAc,QAAQ,KAAG,aAAa,GAAG,IAKhF,CAAC"}
1
+ {"version":3,"file":"deviceFeaturesUtils.d.ts","sourceRoot":"","sources":["../../src/utils/deviceFeaturesUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAErE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAA0B,WASnD,CAAC;AAEF,eAAO,MAAM,aAAa,aAAc,QAAQ,WAM/C,CAAC;AAEF,eAAO,MAAM,cAAc,aAAc,QAAQ,WAOhD,CAAC;AAKF,eAAO,MAAM,wBAAwB,aAAc,QAAQ,kBAK1D,CAAC;AAKF,eAAO,MAAM,2BAA2B,aAAc,QAAQ,KAAG,aAAa,GAAG,IAKhF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-core",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "> TODO: description",
5
5
  "author": "OneKey",
6
6
  "homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
@@ -25,7 +25,7 @@
25
25
  "url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
26
26
  },
27
27
  "dependencies": {
28
- "@onekeyfe/hd-transport": "*",
28
+ "@onekeyfe/hd-transport": "^0.0.2",
29
29
  "axios": "^0.27.2",
30
30
  "bignumber.js": "^9.0.2",
31
31
  "parse-uri": "^1.0.7",
@@ -35,5 +35,5 @@
35
35
  "@types/parse-uri": "^1.0.0",
36
36
  "@types/semver": "^7.3.9"
37
37
  },
38
- "gitHead": "20ce0ad2bd0388f9286be7b08cb76d94946a48c1"
38
+ "gitHead": "a28144ec2bdc835cb6af342fe1599f7a0cdc779f"
39
39
  }
@@ -1,9 +1,9 @@
1
- import { Address, GetAddress } from '@onekeyfe/hd-transport/src/types/messages';
1
+ import { GetAddress } from '@onekeyfe/hd-transport/src/types/messages';
2
2
  import { UI_REQUEST } from '../constants/ui-request';
3
- import { getScriptType, validatePath } from './helpers/pathUtils';
3
+ import { getScriptType, serializedPath, validatePath } from './helpers/pathUtils';
4
4
  import { BaseMethod } from './BaseMethod';
5
5
  import { validateParams } from './helpers/paramsValidator';
6
- import { BTCGetAddressParams } from '../types/api/btcGetAddress';
6
+ import { BTCAddress, BTCGetAddressParams } from '../types/api/btcGetAddress';
7
7
  import { getCoinInfo } from './helpers/btcParamsUtils';
8
8
 
9
9
  export default class BTCGetAddress extends BaseMethod<GetAddress[]> {
@@ -54,7 +54,7 @@ export default class BTCGetAddress extends BaseMethod<GetAddress[]> {
54
54
  }
55
55
 
56
56
  async run() {
57
- const responses: Address[] = [];
57
+ const responses: BTCAddress[] = [];
58
58
 
59
59
  for (let i = 0; i < this.params.length; i++) {
60
60
  const param = this.params[i];
@@ -63,7 +63,10 @@ export default class BTCGetAddress extends BaseMethod<GetAddress[]> {
63
63
  ...param,
64
64
  });
65
65
 
66
- responses.push(res.message);
66
+ responses.push({
67
+ path: serializedPath(param.address_n),
68
+ ...res.message,
69
+ });
67
70
  }
68
71
 
69
72
  return Promise.resolve(this.hasBundle ? responses : responses[0]);
@@ -1,10 +1,11 @@
1
- import { GetPublicKey, PublicKey } from '@onekeyfe/hd-transport/src/types/messages';
1
+ import { GetPublicKey } from '@onekeyfe/hd-transport/src/types/messages';
2
2
  import { UI_REQUEST } from '../constants/ui-request';
3
- import { getScriptType, validatePath } from './helpers/pathUtils';
3
+ import { getScriptType, serializedPath, validatePath } from './helpers/pathUtils';
4
4
  import { BaseMethod } from './BaseMethod';
5
5
  import { validateParams } from './helpers/paramsValidator';
6
6
  import { BTCGetAddressParams } from '../types/api/btcGetAddress';
7
7
  import { getCoinInfo } from './helpers/btcParamsUtils';
8
+ import { BTCPublicKey } from '../types/api/btcGetPublicKey';
8
9
 
9
10
  export default class BTCGetPublicKey extends BaseMethod<GetPublicKey[]> {
10
11
  hasBundle = false;
@@ -53,7 +54,7 @@ export default class BTCGetPublicKey extends BaseMethod<GetPublicKey[]> {
53
54
  }
54
55
 
55
56
  async run() {
56
- const responses: PublicKey[] = [];
57
+ const responses: BTCPublicKey[] = [];
57
58
 
58
59
  for (let i = 0; i < this.params.length; i++) {
59
60
  const param = this.params[i];
@@ -62,7 +63,10 @@ export default class BTCGetPublicKey extends BaseMethod<GetPublicKey[]> {
62
63
  ...param,
63
64
  });
64
65
 
65
- responses.push(res.message);
66
+ responses.push({
67
+ path: serializedPath(param.address_n),
68
+ ...res.message,
69
+ });
66
70
  }
67
71
 
68
72
  return Promise.resolve(this.hasBundle ? responses : responses[0]);
@@ -1,9 +1,9 @@
1
- import { EthereumAddress, EthereumGetAddress } from '@onekeyfe/hd-transport/src/types/messages';
1
+ import { EthereumGetAddress } from '@onekeyfe/hd-transport/src/types/messages';
2
2
  import { UI_REQUEST } from '../constants/ui-request';
3
- import { validatePath } from './helpers/pathUtils';
3
+ import { serializedPath, validatePath } from './helpers/pathUtils';
4
4
  import { BaseMethod } from './BaseMethod';
5
5
  import { validateParams } from './helpers/paramsValidator';
6
- import { EVMGetAddressParams } from '../types/api/evmGetAddress';
6
+ import { EVMAddress, EVMGetAddressParams } from '../types/api/evmGetAddress';
7
7
 
8
8
  export default class EvmGetAddress extends BaseMethod<EthereumGetAddress[]> {
9
9
  hasBundle = false;
@@ -37,7 +37,7 @@ export default class EvmGetAddress extends BaseMethod<EthereumGetAddress[]> {
37
37
  }
38
38
 
39
39
  async run() {
40
- const responses: EthereumAddress[] = [];
40
+ const responses: EVMAddress[] = [];
41
41
 
42
42
  for (let i = 0; i < this.params.length; i++) {
43
43
  const param = this.params[i];
@@ -46,7 +46,12 @@ export default class EvmGetAddress extends BaseMethod<EthereumGetAddress[]> {
46
46
  ...param,
47
47
  });
48
48
 
49
- responses.push(res.message);
49
+ const { address } = res.message;
50
+
51
+ responses.push({
52
+ path: serializedPath(param.address_n),
53
+ address,
54
+ });
50
55
  }
51
56
 
52
57
  return Promise.resolve(this.hasBundle ? responses : responses[0]);
@@ -1,9 +1,9 @@
1
- import { EthereumGetPublicKey, EthereumPublicKey } from '@onekeyfe/hd-transport/src/types/messages';
1
+ import { EthereumGetPublicKey } from '@onekeyfe/hd-transport/src/types/messages';
2
2
  import { UI_REQUEST } from '../constants/ui-request';
3
- import { validatePath } from './helpers/pathUtils';
3
+ import { serializedPath, validatePath } from './helpers/pathUtils';
4
4
  import { BaseMethod } from './BaseMethod';
5
5
  import { validateParams } from './helpers/paramsValidator';
6
- import { EVMGetPublicKeyParams } from '../types/api/evmGetPublicKey';
6
+ import { EVMGetPublicKeyParams, EVMPublicKey } from '../types/api/evmGetPublicKey';
7
7
 
8
8
  export default class EVMGetPublicKey extends BaseMethod<EthereumGetPublicKey[]> {
9
9
  hasBundle = false;
@@ -37,7 +37,7 @@ export default class EVMGetPublicKey extends BaseMethod<EthereumGetPublicKey[]>
37
37
  }
38
38
 
39
39
  async run() {
40
- const responses: EthereumPublicKey[] = [];
40
+ const responses: EVMPublicKey[] = [];
41
41
 
42
42
  for (let i = 0; i < this.params.length; i++) {
43
43
  const param = this.params[i];
@@ -50,7 +50,10 @@ export default class EVMGetPublicKey extends BaseMethod<EthereumGetPublicKey[]>
50
50
  }
51
51
  );
52
52
 
53
- responses.push(res.message);
53
+ responses.push({
54
+ path: serializedPath(param.address_n),
55
+ ...res.message,
56
+ });
54
57
  }
55
58
 
56
59
  return Promise.resolve(this.hasBundle ? responses : responses[0]);
@@ -9,6 +9,7 @@ import { validatePath } from './helpers/pathUtils';
9
9
  import { BaseMethod } from './BaseMethod';
10
10
  import { SchemaParam, validateParams } from './helpers/paramsValidator';
11
11
  import {
12
+ EVMSignedTx,
12
13
  EVMSignTransactionParams,
13
14
  EVMTransaction,
14
15
  EVMTransactionEIP1559,
@@ -17,12 +18,6 @@ import { cutString } from './helpers/stringUtils';
17
18
  import { formatAnyHex, stripHexStartZeroes } from './helpers/hexUtils';
18
19
  import { ERRORS } from '../constants';
19
20
 
20
- type EVMSignedTx = {
21
- v: string;
22
- r: string;
23
- s: string;
24
- };
25
-
26
21
  export default class EVMSignTransaction extends BaseMethod {
27
22
  addressN: number[] = [];
28
23
 
@@ -23,7 +23,12 @@ export default class SearchDevices extends BaseMethod {
23
23
  * to avoid device pairing
24
24
  */
25
25
  if (env === 'react-native') {
26
- return devicesDescriptor.map(device => ({ ...device, connectId: device.id }));
26
+ return devicesDescriptor.map(device => ({
27
+ ...device,
28
+ connectId: device.id,
29
+ // 蓝牙场景只有 classic 能被搜索到
30
+ deviceType: 'classic',
31
+ }));
27
32
  }
28
33
 
29
34
  const devices = [];
@@ -84,6 +84,19 @@ export const getOutputScriptType = (path?: number[]): ChangeOutputScriptType =>
84
84
  }
85
85
  };
86
86
 
87
+ export const serializedPath = (path: Array<number>): string => {
88
+ const pathStr = path
89
+ .map((p: number) => {
90
+ if (p & HD_HARDENED) {
91
+ return `${p & ~HD_HARDENED}'`;
92
+ }
93
+ return p;
94
+ })
95
+ .join('/');
96
+
97
+ return `m/${pathStr}`;
98
+ };
99
+
87
100
  export const validatePath = (
88
101
  path: string | Array<number>,
89
102
  length = 0,
@@ -119,6 +119,10 @@ export class Device extends EventEmitter {
119
119
  /** ID for current seeds, will clear after replace a new seed at device */
120
120
  deviceId: this.features.device_id || null,
121
121
  path: this.originalDescriptor.path,
122
+ name:
123
+ this.features.ble_name ||
124
+ this.features.label ||
125
+ `OneKey ${getDeviceType(this.features).toUpperCase()}`,
122
126
  label: getDeviceLabel(this.features),
123
127
  mode: this.getMode(),
124
128
  features: this.features,
@@ -5,6 +5,10 @@ import {
5
5
  } from '@onekeyfe/hd-transport/src/types/messages';
6
6
  import type { CommonParams, Response } from '../params';
7
7
 
8
+ export type BTCAddress = {
9
+ path: string;
10
+ } & Address;
11
+
8
12
  export type BTCGetAddressParams = {
9
13
  path: string | number[];
10
14
  coin?: string;
@@ -16,9 +20,9 @@ export type BTCGetAddressParams = {
16
20
  export declare function btcGetAddress(
17
21
  connectId: string,
18
22
  params: CommonParams & BTCGetAddressParams
19
- ): Response<Address>;
23
+ ): Response<BTCAddress>;
20
24
 
21
25
  export declare function btcGetAddress(
22
26
  connectId: string,
23
27
  params: CommonParams & { bundle?: BTCGetAddressParams[] }
24
- ): Response<Array<Address>>;
28
+ ): Response<Array<BTCAddress>>;
@@ -1,6 +1,10 @@
1
1
  import { InputScriptType, PublicKey } from '@onekeyfe/hd-transport/src/types/messages';
2
2
  import type { CommonParams, Response } from '../params';
3
3
 
4
+ export type BTCPublicKey = {
5
+ path: string;
6
+ } & PublicKey;
7
+
4
8
  export type BTCGetPublicKeyParams = {
5
9
  path: string | number[];
6
10
  coin?: string;
@@ -11,9 +15,9 @@ export type BTCGetPublicKeyParams = {
11
15
  export declare function btcGetPublicKey(
12
16
  connectId: string,
13
17
  params: CommonParams & BTCGetPublicKeyParams
14
- ): Response<PublicKey>;
18
+ ): Response<BTCPublicKey>;
15
19
 
16
20
  export declare function btcGetPublicKey(
17
21
  connectId: string,
18
22
  params: CommonParams & { bundle?: BTCGetPublicKeyParams[] }
19
- ): Response<Array<PublicKey>>;
23
+ ): Response<Array<BTCPublicKey>>;
@@ -1,5 +1,5 @@
1
1
  import { SafetyCheckLevel, Success } from '@onekeyfe/hd-transport/src/types/messages';
2
- import type { Response } from '../params';
2
+ import type { CommonParams, Response } from '../params';
3
3
 
4
4
  export type DeviceSettingsParams = {
5
5
  language?: string;
@@ -14,4 +14,7 @@ export type DeviceSettingsParams = {
14
14
  experimentalFeatures?: boolean;
15
15
  };
16
16
 
17
- export declare function deviceSettings(connectId: string): Response<Success>;
17
+ export declare function deviceSettings(
18
+ connectId: string,
19
+ params: CommonParams & DeviceSettingsParams
20
+ ): Response<Success>;
@@ -1,6 +1,10 @@
1
- import { EthereumAddress } from '@onekeyfe/hd-transport/src/types/messages';
2
1
  import type { CommonParams, Response } from '../params';
3
2
 
3
+ export type EVMAddress = {
4
+ path: string;
5
+ address: string;
6
+ };
7
+
4
8
  export type EVMGetAddressParams = {
5
9
  path: string | number[];
6
10
  showOnOneKey?: boolean;
@@ -9,9 +13,9 @@ export type EVMGetAddressParams = {
9
13
  export declare function evmGetAddress(
10
14
  connectId: string,
11
15
  params: CommonParams & EVMGetAddressParams
12
- ): Response<EthereumAddress>;
16
+ ): Response<EVMAddress>;
13
17
 
14
18
  export declare function evmGetAddress(
15
19
  connectId: string,
16
20
  params: CommonParams & { bundle?: EVMGetAddressParams[] }
17
- ): Response<Array<EthereumAddress>>;
21
+ ): Response<Array<EVMAddress>>;
@@ -1,6 +1,10 @@
1
1
  import { EthereumPublicKey } from '@onekeyfe/hd-transport/src/types/messages';
2
2
  import type { CommonParams, Response } from '../params';
3
3
 
4
+ export type EVMPublicKey = {
5
+ path: string;
6
+ } & EthereumPublicKey;
7
+
4
8
  export type EVMGetPublicKeyParams = {
5
9
  path: string | number[];
6
10
  showOnOneKey?: boolean;
@@ -9,9 +13,9 @@ export type EVMGetPublicKeyParams = {
9
13
  export declare function evmGetPublicKey(
10
14
  connectId: string,
11
15
  params: CommonParams & EVMGetPublicKeyParams
12
- ): Response<EthereumPublicKey>;
16
+ ): Response<EVMPublicKey>;
13
17
 
14
18
  export declare function evmGetPublicKey(
15
19
  connectId: string,
16
20
  params: CommonParams & { bundle?: EVMGetPublicKeyParams[] }
17
- ): Response<Array<EthereumPublicKey>>;
21
+ ): Response<Array<EVMPublicKey>>;
@@ -1,7 +1,12 @@
1
- import { EthereumMessageSignature } from '@onekeyfe/hd-transport/src/types/messages';
2
1
  import type { CommonParams, Response } from '../params';
3
2
 
4
- export interface EVMTransaction {
3
+ export type EVMSignedTx = {
4
+ v: string;
5
+ r: string;
6
+ s: string;
7
+ };
8
+
9
+ export type EVMTransaction = {
5
10
  to: string;
6
11
  value: string;
7
12
  gasPrice: string;
@@ -12,7 +17,7 @@ export interface EVMTransaction {
12
17
  data?: string;
13
18
  chainId: number;
14
19
  txType?: number;
15
- }
20
+ };
16
21
 
17
22
  export type EVMAccessList = {
18
23
  address: string;
@@ -40,4 +45,4 @@ export type EVMSignTransactionParams = {
40
45
  export declare function evmSignTransaction(
41
46
  connectId: string,
42
47
  params: CommonParams & EVMSignTransactionParams
43
- ): Response<EthereumMessageSignature>;
48
+ ): Response<EVMSignedTx>;
@@ -1,4 +1,5 @@
1
- import { OneKeyDeviceInfo as DeviceDescriptor } from '@onekeyfe/hd-transport';
1
+ import { SearchDevice } from '../device';
2
+
2
3
  import { Response } from '../params';
3
4
 
4
- export declare function searchDevices(): Response<DeviceDescriptor[]>;
5
+ export declare function searchDevices(): Response<SearchDevice[]>;
@@ -20,6 +20,7 @@ export type KnownDevice = {
20
20
  deviceType: IDeviceType;
21
21
  path: string;
22
22
  label: string;
23
+ name: string;
23
24
  error?: typeof undefined;
24
25
  mode: DeviceMode;
25
26
  features: PROTO.Features;
@@ -28,6 +29,14 @@ export type KnownDevice = {
28
29
  firmwareVersion: IVersionArray | null;
29
30
  };
30
31
 
32
+ export type SearchDevice = {
33
+ connectId: string | null;
34
+ uuid: string;
35
+ deviceId: string | null;
36
+ deviceType: IDeviceType;
37
+ name: string;
38
+ };
39
+
31
40
  // export type UnknownDevice = {
32
41
  // type: 'unacquired';
33
42
  // id?: null;