@onekeyfe/hd-core 0.0.2 → 0.0.5

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 (161) hide show
  1. package/dist/api/{BTCGetAddress.d.ts → btc/BTCGetAddress.d.ts} +2 -2
  2. package/dist/api/btc/BTCGetAddress.d.ts.map +1 -0
  3. package/dist/api/{BTCGetPublicKey.d.ts → btc/BTCGetPublicKey.d.ts} +2 -2
  4. package/dist/api/btc/BTCGetPublicKey.d.ts.map +1 -0
  5. package/dist/api/{BTCSignMessage.d.ts → btc/BTCSignMessage.d.ts} +1 -1
  6. package/dist/api/btc/BTCSignMessage.d.ts.map +1 -0
  7. package/dist/api/{BTCSignTransaction.d.ts → btc/BTCSignTransaction.d.ts} +3 -3
  8. package/dist/api/btc/BTCSignTransaction.d.ts.map +1 -0
  9. package/dist/api/{BTCVerifyMessage.d.ts → btc/BTCVerifyMessage.d.ts} +1 -1
  10. package/dist/api/btc/BTCVerifyMessage.d.ts.map +1 -0
  11. package/dist/api/{helpers → btc/helpers}/btcParamsUtils.d.ts +0 -0
  12. package/dist/api/btc/helpers/btcParamsUtils.d.ts.map +1 -0
  13. package/dist/api/{helpers/btc → btc/helpers}/signtx.d.ts +0 -0
  14. package/dist/api/{helpers/btc → btc/helpers}/signtx.d.ts.map +1 -1
  15. package/dist/api/{helpers/btc → btc/helpers}/signtxLegacy.d.ts +0 -0
  16. package/dist/api/{helpers/btc → btc/helpers}/signtxLegacy.d.ts.map +1 -1
  17. package/dist/api/{DeviceBackup.d.ts → device/DeviceBackup.d.ts} +1 -1
  18. package/dist/api/device/DeviceBackup.d.ts.map +1 -0
  19. package/dist/api/{DeviceChangePin.d.ts → device/DeviceChangePin.d.ts} +1 -1
  20. package/dist/api/device/DeviceChangePin.d.ts.map +1 -0
  21. package/dist/api/{DeviceFlags.d.ts → device/DeviceFlags.d.ts} +1 -1
  22. package/dist/api/device/DeviceFlags.d.ts.map +1 -0
  23. package/dist/api/{DeviceRebootToBootloader.d.ts → device/DeviceRebootToBootloader.d.ts} +1 -1
  24. package/dist/api/device/DeviceRebootToBootloader.d.ts.map +1 -0
  25. package/dist/api/{DeviceRecovery.d.ts → device/DeviceRecovery.d.ts} +1 -1
  26. package/dist/api/device/DeviceRecovery.d.ts.map +1 -0
  27. package/dist/api/{DeviceReset.d.ts → device/DeviceReset.d.ts} +1 -1
  28. package/dist/api/device/DeviceReset.d.ts.map +1 -0
  29. package/dist/api/{DeviceSettings.d.ts → device/DeviceSettings.d.ts} +1 -1
  30. package/dist/api/device/DeviceSettings.d.ts.map +1 -0
  31. package/dist/api/{DeviceUpdateReboot.d.ts → device/DeviceUpdateReboot.d.ts} +1 -1
  32. package/dist/api/device/DeviceUpdateReboot.d.ts.map +1 -0
  33. package/dist/api/{DeviceWipe.d.ts → device/DeviceWipe.d.ts} +1 -1
  34. package/dist/api/device/DeviceWipe.d.ts.map +1 -0
  35. package/dist/api/{EVMGetAddress.d.ts → evm/EVMGetAddress.d.ts} +2 -2
  36. package/dist/api/evm/EVMGetAddress.d.ts.map +1 -0
  37. package/dist/api/{EVMGetPublicKey.d.ts → evm/EVMGetPublicKey.d.ts} +2 -2
  38. package/dist/api/evm/EVMGetPublicKey.d.ts.map +1 -0
  39. package/dist/api/{EVMSignMessage.d.ts → evm/EVMSignMessage.d.ts} +1 -1
  40. package/dist/api/evm/EVMSignMessage.d.ts.map +1 -0
  41. package/dist/api/{EVMSignMessageEIP712.d.ts → evm/EVMSignMessageEIP712.d.ts} +1 -1
  42. package/dist/api/evm/EVMSignMessageEIP712.d.ts.map +1 -0
  43. package/dist/api/{EVMSignTransaction.d.ts → evm/EVMSignTransaction.d.ts} +2 -2
  44. package/dist/api/evm/EVMSignTransaction.d.ts.map +1 -0
  45. package/dist/api/{EVMSignTypedData.d.ts → evm/EVMSignTypedData.d.ts} +3 -3
  46. package/dist/api/evm/EVMSignTypedData.d.ts.map +1 -0
  47. package/dist/api/{EVMVerifyMessage.d.ts → evm/EVMVerifyMessage.d.ts} +1 -1
  48. package/dist/api/evm/EVMVerifyMessage.d.ts.map +1 -0
  49. package/dist/api/helpers/pathUtils.d.ts +0 -1
  50. package/dist/api/helpers/pathUtils.d.ts.map +1 -1
  51. package/dist/api/index.d.ts +26 -21
  52. package/dist/api/index.d.ts.map +1 -1
  53. package/dist/api/starcoin/StarcoinGetAddress.d.ts +9 -0
  54. package/dist/api/starcoin/StarcoinGetAddress.d.ts.map +1 -0
  55. package/dist/api/starcoin/StarcoinGetPublicKey.d.ts +9 -0
  56. package/dist/api/starcoin/StarcoinGetPublicKey.d.ts.map +1 -0
  57. package/dist/api/starcoin/StarcoinSignMessage.d.ts +10 -0
  58. package/dist/api/starcoin/StarcoinSignMessage.d.ts.map +1 -0
  59. package/dist/api/starcoin/StarcoinSignTransaction.d.ts +10 -0
  60. package/dist/api/starcoin/StarcoinSignTransaction.d.ts.map +1 -0
  61. package/dist/api/starcoin/StarcoinVerifyMessage.d.ts +9 -0
  62. package/dist/api/starcoin/StarcoinVerifyMessage.d.ts.map +1 -0
  63. package/dist/core/index.d.ts.map +1 -1
  64. package/dist/events/core.d.ts +2 -1
  65. package/dist/events/core.d.ts.map +1 -1
  66. package/dist/events/device.d.ts +15 -0
  67. package/dist/events/device.d.ts.map +1 -1
  68. package/dist/events/ui-request.d.ts +13 -1
  69. package/dist/events/ui-request.d.ts.map +1 -1
  70. package/dist/index.d.ts +167 -28
  71. package/dist/index.js +335 -148
  72. package/dist/inject.d.ts.map +1 -1
  73. package/dist/types/api/btcSignTransaction.d.ts +2 -2
  74. package/dist/types/api/btcSignTransaction.d.ts.map +1 -1
  75. package/dist/types/api/export.d.ts +23 -0
  76. package/dist/types/api/export.d.ts.map +1 -0
  77. package/dist/types/api/index.d.ts +11 -0
  78. package/dist/types/api/index.d.ts.map +1 -1
  79. package/dist/types/api/init.d.ts +1 -1
  80. package/dist/types/api/init.d.ts.map +1 -1
  81. package/dist/types/api/starcoinGetAddress.d.ts +14 -0
  82. package/dist/types/api/starcoinGetAddress.d.ts.map +1 -0
  83. package/dist/types/api/starcoinGetPublicKey.d.ts +14 -0
  84. package/dist/types/api/starcoinGetPublicKey.d.ts.map +1 -0
  85. package/dist/types/api/starcoinSignMessage.d.ts +8 -0
  86. package/dist/types/api/starcoinSignMessage.d.ts.map +1 -0
  87. package/dist/types/api/starcoinSignTransaction.d.ts +8 -0
  88. package/dist/types/api/starcoinSignTransaction.d.ts.map +1 -0
  89. package/dist/types/api/starcoinVerifyMessage.d.ts +9 -0
  90. package/dist/types/api/starcoinVerifyMessage.d.ts.map +1 -0
  91. package/dist/utils/index.d.ts +2 -0
  92. package/dist/utils/index.d.ts.map +1 -1
  93. package/package.json +3 -3
  94. package/src/api/{BTCGetAddress.ts → btc/BTCGetAddress.ts} +5 -5
  95. package/src/api/{BTCGetPublicKey.ts → btc/BTCGetPublicKey.ts} +8 -8
  96. package/src/api/{BTCSignMessage.ts → btc/BTCSignMessage.ts} +5 -5
  97. package/src/api/{BTCSignTransaction.ts → btc/BTCSignTransaction.ts} +8 -8
  98. package/src/api/{BTCVerifyMessage.ts → btc/BTCVerifyMessage.ts} +4 -4
  99. package/src/api/{helpers → btc/helpers}/btcParamsUtils.ts +3 -3
  100. package/src/api/{helpers/btc → btc/helpers}/signtx.ts +0 -0
  101. package/src/api/{helpers/btc → btc/helpers}/signtxLegacy.ts +0 -0
  102. package/src/api/{DeviceBackup.ts → device/DeviceBackup.ts} +1 -1
  103. package/src/api/{DeviceChangePin.ts → device/DeviceChangePin.ts} +2 -2
  104. package/src/api/{DeviceFlags.ts → device/DeviceFlags.ts} +2 -2
  105. package/src/api/{DeviceRebootToBootloader.ts → device/DeviceRebootToBootloader.ts} +1 -1
  106. package/src/api/{DeviceRecovery.ts → device/DeviceRecovery.ts} +2 -2
  107. package/src/api/{DeviceReset.ts → device/DeviceReset.ts} +2 -2
  108. package/src/api/{DeviceSettings.ts → device/DeviceSettings.ts} +2 -2
  109. package/src/api/{DeviceUpdateReboot.ts → device/DeviceUpdateReboot.ts} +1 -1
  110. package/src/api/{DeviceWipe.ts → device/DeviceWipe.ts} +1 -1
  111. package/src/api/{EVMGetAddress.ts → evm/EVMGetAddress.ts} +5 -5
  112. package/src/api/{EVMGetPublicKey.ts → evm/EVMGetPublicKey.ts} +5 -5
  113. package/src/api/{EVMSignMessage.ts → evm/EVMSignMessage.ts} +5 -5
  114. package/src/api/{EVMSignMessageEIP712.ts → evm/EVMSignMessageEIP712.ts} +5 -5
  115. package/src/api/{EVMSignTransaction.ts → evm/EVMSignTransaction.ts} +9 -9
  116. package/src/api/{EVMSignTypedData.ts → evm/EVMSignTypedData.ts} +8 -8
  117. package/src/api/{EVMVerifyMessage.ts → evm/EVMVerifyMessage.ts} +4 -4
  118. package/src/api/helpers/pathUtils.ts +1 -1
  119. package/src/api/index.ts +26 -21
  120. package/src/api/starcoin/StarcoinGetAddress.ts +57 -0
  121. package/src/api/starcoin/StarcoinGetPublicKey.ts +64 -0
  122. package/src/api/starcoin/StarcoinSignMessage.ts +40 -0
  123. package/src/api/starcoin/StarcoinSignTransaction.ts +36 -0
  124. package/src/api/starcoin/StarcoinVerifyMessage.ts +33 -0
  125. package/src/core/index.ts +25 -0
  126. package/src/events/core.ts +8 -1
  127. package/src/events/device.ts +27 -0
  128. package/src/events/ui-request.ts +16 -1
  129. package/src/inject.ts +12 -1
  130. package/src/types/api/btcSignTransaction.ts +1 -2
  131. package/src/types/api/export.ts +43 -0
  132. package/src/types/api/index.ts +13 -0
  133. package/src/types/api/init.ts +1 -1
  134. package/src/types/api/starcoinGetAddress.ts +21 -0
  135. package/src/types/api/starcoinGetPublicKey.ts +21 -0
  136. package/src/types/api/starcoinSignMessage.ts +12 -0
  137. package/src/types/api/starcoinSignTransaction.ts +12 -0
  138. package/src/types/api/starcoinVerifyMessage.ts +13 -0
  139. package/src/utils/index.ts +2 -0
  140. package/dist/api/BTCGetAddress.d.ts.map +0 -1
  141. package/dist/api/BTCGetPublicKey.d.ts.map +0 -1
  142. package/dist/api/BTCSignMessage.d.ts.map +0 -1
  143. package/dist/api/BTCSignTransaction.d.ts.map +0 -1
  144. package/dist/api/BTCVerifyMessage.d.ts.map +0 -1
  145. package/dist/api/DeviceBackup.d.ts.map +0 -1
  146. package/dist/api/DeviceChangePin.d.ts.map +0 -1
  147. package/dist/api/DeviceFlags.d.ts.map +0 -1
  148. package/dist/api/DeviceRebootToBootloader.d.ts.map +0 -1
  149. package/dist/api/DeviceRecovery.d.ts.map +0 -1
  150. package/dist/api/DeviceReset.d.ts.map +0 -1
  151. package/dist/api/DeviceSettings.d.ts.map +0 -1
  152. package/dist/api/DeviceUpdateReboot.d.ts.map +0 -1
  153. package/dist/api/DeviceWipe.d.ts.map +0 -1
  154. package/dist/api/EVMGetAddress.d.ts.map +0 -1
  155. package/dist/api/EVMGetPublicKey.d.ts.map +0 -1
  156. package/dist/api/EVMSignMessage.d.ts.map +0 -1
  157. package/dist/api/EVMSignMessageEIP712.d.ts.map +0 -1
  158. package/dist/api/EVMSignTransaction.d.ts.map +0 -1
  159. package/dist/api/EVMSignTypedData.d.ts.map +0 -1
  160. package/dist/api/EVMVerifyMessage.d.ts.map +0 -1
  161. package/dist/api/helpers/btcParamsUtils.d.ts.map +0 -1
@@ -27,6 +27,12 @@ import { deviceChangePin } from './deviceChangePin';
27
27
  import { deviceSettings } from './deviceSettings';
28
28
  import { deviceFlags } from './deviceFlags';
29
29
  import { deviceUpdateReboot } from './deviceUpdateReboot';
30
+ import { starcoinGetAddress } from './starcoinGetAddress';
31
+ import { starcoinGetPublicKey } from './starcoinGetPublicKey';
32
+ import { starcoinSignMessage } from './starcoinSignMessage';
33
+ import { starcoinSignTransaction } from './starcoinSignTransaction';
34
+ import { starcoinVerifyMessage } from './starcoinVerifyMessage';
35
+ export * from './export';
30
36
  export declare type CoreApi = {
31
37
  init: typeof init;
32
38
  on: typeof on;
@@ -62,5 +68,10 @@ export declare type CoreApi = {
62
68
  btcSignMessage: typeof btcSignMessage;
63
69
  btcSignTransaction: typeof btcSignTransaction;
64
70
  btcVerifyMessage: typeof btcVerifyMessage;
71
+ starcoinGetAddress: typeof starcoinGetAddress;
72
+ starcoinGetPublicKey: typeof starcoinGetPublicKey;
73
+ starcoinSignMessage: typeof starcoinSignMessage;
74
+ starcoinSignTransaction: typeof starcoinSignTransaction;
75
+ starcoinVerifyMessage: typeof starcoinVerifyMessage;
65
76
  };
66
77
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,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e,EAAE,OAAO,eAAe,CAAC;IACxC,cAAc,EAAE,OAAO,cAAc,CAAC;IACtC,oBAAoB,EAAE,OAAO,oBAAoB,CAAC;IAClD,kBAAkB,EAAE,OAAO,kBAAkB,CAAC;IAC9C,gBAAgB,EAAE,OAAO,gBAAgB,CAAC;IAC1C,gBAAgB,EAAE,OAAO,gBAAgB,CAAC;IAE1C,aAAa,EAAE,OAAO,aAAa,CAAC;IACpC,eAAe,EAAE,OAAO,eAAe,CAAC;IACxC,cAAc,EAAE,OAAO,cAAc,CAAC;IACtC,kBAAkB,EAAE,OAAO,kBAAkB,CAAC;IAC9C,gBAAgB,EAAE,OAAO,gBAAgB,CAAC;IAE1C,kBAAkB,EAAE,OAAO,kBAAkB,CAAC;IAC9C,oBAAoB,EAAE,OAAO,oBAAoB,CAAC;IAClD,mBAAmB,EAAE,OAAO,mBAAmB,CAAC;IAChD,uBAAuB,EAAE,OAAO,uBAAuB,CAAC;IACxD,qBAAqB,EAAE,OAAO,qBAAqB,CAAC;CACrD,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import type { ConnectSettings } from '../settings';
2
- export declare function init(settings: Partial<ConnectSettings>): Promise<void> | void;
2
+ export declare function init(settings: Partial<ConnectSettings>): Promise<boolean>;
3
3
  //# sourceMappingURL=init.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/types/api/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/types/api/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { StarcoinAddress as HardwareStarcoinAddress } from '@onekeyfe/hd-transport/src/types/messages';
2
+ import type { CommonParams, Response } from '../params';
3
+ export declare type StarcoinAddress = {
4
+ path: string;
5
+ } & HardwareStarcoinAddress;
6
+ export declare type StarcoinGetAddressParams = {
7
+ path: string | number[];
8
+ showOnOneKey?: boolean;
9
+ };
10
+ export declare function starcoinGetAddress(connectId: string, params: CommonParams & StarcoinGetAddressParams): Response<StarcoinAddress>;
11
+ export declare function starcoinGetAddress(connectId: string, params: CommonParams & {
12
+ bundle?: StarcoinGetAddressParams[];
13
+ }): Response<Array<StarcoinAddress>>;
14
+ //# sourceMappingURL=starcoinGetAddress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"starcoinGetAddress.d.ts","sourceRoot":"","sources":["../../../src/types/api/starcoinGetAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,IAAI,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AACvG,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,oBAAY,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,uBAAuB,CAAC;AAE5B,oBAAY,wBAAwB,GAAG;IACrC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GAAG,wBAAwB,GAC9C,QAAQ,CAAC,eAAe,CAAC,CAAC;AAE7B,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GAAG;IAAE,MAAM,CAAC,EAAE,wBAAwB,EAAE,CAAA;CAAE,GAC7D,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { StarcoinPublicKey as HardwareStarcoinPublicKey } from '@onekeyfe/hd-transport/src/types/messages';
2
+ import type { CommonParams, Response } from '../params';
3
+ export declare type StarcoinPublicKey = {
4
+ path: string;
5
+ } & HardwareStarcoinPublicKey;
6
+ export declare type StarcoinGetPublicKeyParams = {
7
+ path: string | number[];
8
+ showOnOneKey?: boolean;
9
+ };
10
+ export declare function starcoinGetPublicKey(connectId: string, params: CommonParams & StarcoinGetPublicKeyParams): Response<StarcoinPublicKey>;
11
+ export declare function starcoinGetPublicKey(connectId: string, params: CommonParams & {
12
+ bundle?: StarcoinGetPublicKeyParams[];
13
+ }): Response<Array<StarcoinPublicKey>>;
14
+ //# sourceMappingURL=starcoinGetPublicKey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"starcoinGetPublicKey.d.ts","sourceRoot":"","sources":["../../../src/types/api/starcoinGetPublicKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,IAAI,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AAC3G,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,oBAAY,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,yBAAyB,CAAC;AAE9B,oBAAY,0BAA0B,GAAG;IACvC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAC1C,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GAAG,0BAA0B,GAChD,QAAQ,CAAC,iBAAiB,CAAC,CAAC;AAE/B,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAC1C,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GAAG;IAAE,MAAM,CAAC,EAAE,0BAA0B,EAAE,CAAA;CAAE,GAC/D,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { StarcoinMessageSignature } from '@onekeyfe/hd-transport/src/types/messages';
2
+ import type { CommonParams, Response } from '../params';
3
+ export declare type StarcoinSignMessageParams = {
4
+ path: string | number[];
5
+ messageHex: string;
6
+ };
7
+ export declare function starcoinSignMessage(connectId: string, params: CommonParams & StarcoinSignMessageParams): Response<StarcoinMessageSignature>;
8
+ //# sourceMappingURL=starcoinSignMessage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"starcoinSignMessage.d.ts","sourceRoot":"","sources":["../../../src/types/api/starcoinSignMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,oBAAY,yBAAyB,GAAG;IACtC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,mBAAmB,CACzC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GAAG,yBAAyB,GAC/C,QAAQ,CAAC,wBAAwB,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { StarcoinSignedTx } from '@onekeyfe/hd-transport/src/types/messages';
2
+ import type { CommonParams, Response } from '../params';
3
+ export declare type StarcoinSignTransactionParams = {
4
+ path: string | number[];
5
+ rawTx: string;
6
+ };
7
+ export declare function starcoinSignTransaction(connectId: string, params: CommonParams & StarcoinSignTransactionParams): Response<StarcoinSignedTx>;
8
+ //# sourceMappingURL=starcoinSignTransaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"starcoinSignTransaction.d.ts","sourceRoot":"","sources":["../../../src/types/api/starcoinSignTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,oBAAY,6BAA6B,GAAG;IAC1C,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAC7C,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GAAG,6BAA6B,GACnD,QAAQ,CAAC,gBAAgB,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { Success } from '@onekeyfe/hd-transport/src/types/messages';
2
+ import type { CommonParams, Response } from '../params';
3
+ export declare type StarcoinVerifyMessageParams = {
4
+ publicKey: string;
5
+ messageHex: string;
6
+ signature: string;
7
+ };
8
+ export declare function starcoinVerifyMessage(connectId: string, params: CommonParams & StarcoinVerifyMessageParams): Response<Success>;
9
+ //# sourceMappingURL=starcoinVerifyMessage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"starcoinVerifyMessage.d.ts","sourceRoot":"","sources":["../../../src/types/api/starcoinVerifyMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,oBAAY,2BAA2B,GAAG;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAC3C,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GAAG,2BAA2B,GACjD,QAAQ,CAAC,OAAO,CAAC,CAAC"}
@@ -2,5 +2,7 @@ import { initLog, enableLog } from './logger';
2
2
  export * from './assets';
3
3
  export * from './versionUtils';
4
4
  export * from './deferred';
5
+ export { getDeviceType, getDeviceUUID, getDeviceLabel } from './deviceFeaturesUtils';
6
+ export { getHDPath, getScriptType } from '../api/helpers/pathUtils';
5
7
  export { initLog, enableLog };
6
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE9C,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAE3B,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE9C,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEpE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-core",
3
- "version": "0.0.2",
3
+ "version": "0.0.5",
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": "^0.0.2",
28
+ "@onekeyfe/hd-transport": "^0.0.5",
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": "a28144ec2bdc835cb6af342fe1599f7a0cdc779f"
38
+ "gitHead": "24d2a28fd3f2e7fda4c21742e968bce764985615"
39
39
  }
@@ -1,9 +1,9 @@
1
1
  import { GetAddress } from '@onekeyfe/hd-transport/src/types/messages';
2
- import { UI_REQUEST } from '../constants/ui-request';
3
- import { getScriptType, serializedPath, validatePath } from './helpers/pathUtils';
4
- import { BaseMethod } from './BaseMethod';
5
- import { validateParams } from './helpers/paramsValidator';
6
- import { BTCAddress, BTCGetAddressParams } from '../types/api/btcGetAddress';
2
+ import { UI_REQUEST } from '../../constants/ui-request';
3
+ import { getScriptType, serializedPath, validatePath } from '../helpers/pathUtils';
4
+ import { BaseMethod } from '../BaseMethod';
5
+ import { validateParams } from '../helpers/paramsValidator';
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[]> {
@@ -1,11 +1,11 @@
1
1
  import { GetPublicKey } from '@onekeyfe/hd-transport/src/types/messages';
2
- import { UI_REQUEST } from '../constants/ui-request';
3
- import { getScriptType, serializedPath, validatePath } from './helpers/pathUtils';
4
- import { BaseMethod } from './BaseMethod';
5
- import { validateParams } from './helpers/paramsValidator';
6
- import { BTCGetAddressParams } from '../types/api/btcGetAddress';
2
+ import { UI_REQUEST } from '../../constants/ui-request';
3
+ import { getScriptType, serializedPath, validatePath } from '../helpers/pathUtils';
4
+ import { BaseMethod } from '../BaseMethod';
5
+ import { validateParams } from '../helpers/paramsValidator';
6
+ import { BTCGetAddressParams } from '../../types/api/btcGetAddress';
7
7
  import { getCoinInfo } from './helpers/btcParamsUtils';
8
- import { BTCPublicKey } from '../types/api/btcGetPublicKey';
8
+ import { BTCPublicKey } from '../../types/api/btcGetPublicKey';
9
9
 
10
10
  export default class BTCGetPublicKey extends BaseMethod<GetPublicKey[]> {
11
11
  hasBundle = false;
@@ -13,8 +13,8 @@ export default class BTCGetPublicKey extends BaseMethod<GetPublicKey[]> {
13
13
  init() {
14
14
  this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.INITIALIZE];
15
15
 
16
- const hasBundle = Object.prototype.hasOwnProperty.call(this.payload, 'bundle');
17
- const payload = hasBundle ? this.payload : { bundle: [this.payload] };
16
+ this.hasBundle = Object.prototype.hasOwnProperty.call(this.payload, 'bundle');
17
+ const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
18
18
 
19
19
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
20
20
 
@@ -1,9 +1,9 @@
1
1
  import { SignMessage } from '@onekeyfe/hd-transport/src/types/messages';
2
- import { UI_REQUEST } from '../constants/ui-request';
3
- import { validatePath } from './helpers/pathUtils';
4
- import { BaseMethod } from './BaseMethod';
5
- import { validateParams } from './helpers/paramsValidator';
6
- import { formatAnyHex } from './helpers/hexUtils';
2
+ import { UI_REQUEST } from '../../constants/ui-request';
3
+ import { validatePath } from '../helpers/pathUtils';
4
+ import { BaseMethod } from '../BaseMethod';
5
+ import { validateParams } from '../helpers/paramsValidator';
6
+ import { formatAnyHex } from '../helpers/hexUtils';
7
7
  import { getCoinAndScriptType } from './helpers/btcParamsUtils';
8
8
 
9
9
  export default class BTCSignMessage extends BaseMethod<SignMessage> {
@@ -1,18 +1,18 @@
1
1
  import { TxInputType, TxOutputType } from '@onekeyfe/hd-transport/src/types/messages';
2
2
 
3
- import { UI_REQUEST } from '../constants/ui-request';
4
- import { getOutputScriptType, isSegwitPath, validatePath } from './helpers/pathUtils';
5
- import { BaseMethod } from './BaseMethod';
6
- import { validateParams } from './helpers/paramsValidator';
3
+ import { UI_REQUEST } from '../../constants/ui-request';
4
+ import { getOutputScriptType, isSegwitPath, validatePath } from '../helpers/pathUtils';
5
+ import { BaseMethod } from '../BaseMethod';
6
+ import { validateParams } from '../helpers/paramsValidator';
7
7
  import {
8
8
  AccountAddresses,
9
9
  BTCSignTransactionParams,
10
10
  RefTransaction,
11
11
  TransactionOptions,
12
- } from '../types/api/btcSignTransaction';
13
- import { ERRORS } from '../constants';
14
- import signtx from './helpers/btc/signtx';
15
- import signtxLegacy from './helpers/btc/signtxLegacy';
12
+ } from '../../types/api/btcSignTransaction';
13
+ import { ERRORS } from '../../constants';
14
+ import signtx from './helpers/signtx';
15
+ import signtxLegacy from './helpers/signtxLegacy';
16
16
  import { getCoinInfo } from './helpers/btcParamsUtils';
17
17
 
18
18
  type Params = {
@@ -1,9 +1,9 @@
1
1
  import { VerifyMessage } from '@onekeyfe/hd-transport/src/types/messages';
2
- import { UI_REQUEST } from '../constants/ui-request';
2
+ import { UI_REQUEST } from '../../constants/ui-request';
3
3
 
4
- import { BaseMethod } from './BaseMethod';
5
- import { validateParams } from './helpers/paramsValidator';
6
- import { formatAnyHex } from './helpers/hexUtils';
4
+ import { BaseMethod } from '../BaseMethod';
5
+ import { validateParams } from '../helpers/paramsValidator';
6
+ import { formatAnyHex } from '../helpers/hexUtils';
7
7
  import { getCoinInfo } from './helpers/btcParamsUtils';
8
8
 
9
9
  export default class BTCVerifyMessage extends BaseMethod<VerifyMessage> {
@@ -1,6 +1,6 @@
1
- import { ERRORS } from '../../constants';
2
- import { getScriptType, isMultisigPath, fromHardened } from './pathUtils';
3
- import bitcoin from '../../data/coins/bitcoin.json';
1
+ import { ERRORS } from '../../../constants';
2
+ import { getScriptType, isMultisigPath, fromHardened } from '../../helpers/pathUtils';
3
+ import bitcoin from '../../../data/coins/bitcoin.json';
4
4
 
5
5
  export type BitcoinInfo = {
6
6
  name: string;
File without changes
@@ -1,5 +1,5 @@
1
1
  import { BackupDevice } from '@onekeyfe/hd-transport/src/types/messages';
2
- import { BaseMethod } from './BaseMethod';
2
+ import { BaseMethod } from '../BaseMethod';
3
3
 
4
4
  export default class DeviceBackup extends BaseMethod<BackupDevice> {
5
5
  init() {}
@@ -1,6 +1,6 @@
1
1
  import { ChangePin } from '@onekeyfe/hd-transport/src/types/messages';
2
- import { BaseMethod } from './BaseMethod';
3
- import { validateParams } from './helpers/paramsValidator';
2
+ import { BaseMethod } from '../BaseMethod';
3
+ import { validateParams } from '../helpers/paramsValidator';
4
4
 
5
5
  export default class DeviceChangePin extends BaseMethod<ChangePin> {
6
6
  init() {
@@ -1,6 +1,6 @@
1
1
  import { ApplyFlags } from '@onekeyfe/hd-transport/src/types/messages';
2
- import { BaseMethod } from './BaseMethod';
3
- import { validateParams } from './helpers/paramsValidator';
2
+ import { BaseMethod } from '../BaseMethod';
3
+ import { validateParams } from '../helpers/paramsValidator';
4
4
 
5
5
  export default class DeviceFlags extends BaseMethod<ApplyFlags> {
6
6
  init() {
@@ -1,5 +1,5 @@
1
1
  import { RebootToBootloader } from '@onekeyfe/hd-transport/src/types/messages';
2
- import { BaseMethod } from './BaseMethod';
2
+ import { BaseMethod } from '../BaseMethod';
3
3
 
4
4
  // Reboot BootLoader
5
5
  export default class DeviceRebootToBootloader extends BaseMethod<RebootToBootloader> {
@@ -1,6 +1,6 @@
1
1
  import { RecoveryDevice } from '@onekeyfe/hd-transport/src/types/messages';
2
- import { BaseMethod } from './BaseMethod';
3
- import { validateParams } from './helpers/paramsValidator';
2
+ import { BaseMethod } from '../BaseMethod';
3
+ import { validateParams } from '../helpers/paramsValidator';
4
4
 
5
5
  export default class DeviceRecovery extends BaseMethod<RecoveryDevice> {
6
6
  init() {
@@ -1,6 +1,6 @@
1
1
  import { ResetDevice } from '@onekeyfe/hd-transport/src/types/messages';
2
- import { BaseMethod } from './BaseMethod';
3
- import { validateParams } from './helpers/paramsValidator';
2
+ import { BaseMethod } from '../BaseMethod';
3
+ import { validateParams } from '../helpers/paramsValidator';
4
4
 
5
5
  export default class DeviceReset extends BaseMethod<ResetDevice> {
6
6
  init() {
@@ -1,6 +1,6 @@
1
1
  import { ApplySettings } from '@onekeyfe/hd-transport/src/types/messages';
2
- import { BaseMethod } from './BaseMethod';
3
- import { validateParams } from './helpers/paramsValidator';
2
+ import { BaseMethod } from '../BaseMethod';
3
+ import { validateParams } from '../helpers/paramsValidator';
4
4
 
5
5
  export default class DeviceSettings extends BaseMethod<ApplySettings> {
6
6
  init() {
@@ -1,5 +1,5 @@
1
1
  import { BixinReboot } from '@onekeyfe/hd-transport/src/types/messages';
2
- import { BaseMethod } from './BaseMethod';
2
+ import { BaseMethod } from '../BaseMethod';
3
3
 
4
4
  // Upload hint Reboot BootLoader
5
5
  export default class DeviceUpdateReboot extends BaseMethod<BixinReboot> {
@@ -1,5 +1,5 @@
1
1
  import { WipeDevice } from '@onekeyfe/hd-transport/src/types/messages';
2
- import { BaseMethod } from './BaseMethod';
2
+ import { BaseMethod } from '../BaseMethod';
3
3
 
4
4
  export default class DeviceWipe extends BaseMethod<WipeDevice> {
5
5
  init() {}
@@ -1,9 +1,9 @@
1
1
  import { EthereumGetAddress } from '@onekeyfe/hd-transport/src/types/messages';
2
- import { UI_REQUEST } from '../constants/ui-request';
3
- import { serializedPath, validatePath } from './helpers/pathUtils';
4
- import { BaseMethod } from './BaseMethod';
5
- import { validateParams } from './helpers/paramsValidator';
6
- import { EVMAddress, EVMGetAddressParams } from '../types/api/evmGetAddress';
2
+ import { UI_REQUEST } from '../../constants/ui-request';
3
+ import { serializedPath, validatePath } from '../helpers/pathUtils';
4
+ import { BaseMethod } from '../BaseMethod';
5
+ import { validateParams } from '../helpers/paramsValidator';
6
+ import { EVMAddress, EVMGetAddressParams } from '../../types/api/evmGetAddress';
7
7
 
8
8
  export default class EvmGetAddress extends BaseMethod<EthereumGetAddress[]> {
9
9
  hasBundle = false;
@@ -1,9 +1,9 @@
1
1
  import { EthereumGetPublicKey } from '@onekeyfe/hd-transport/src/types/messages';
2
- import { UI_REQUEST } from '../constants/ui-request';
3
- import { serializedPath, validatePath } from './helpers/pathUtils';
4
- import { BaseMethod } from './BaseMethod';
5
- import { validateParams } from './helpers/paramsValidator';
6
- import { EVMGetPublicKeyParams, EVMPublicKey } from '../types/api/evmGetPublicKey';
2
+ import { UI_REQUEST } from '../../constants/ui-request';
3
+ import { serializedPath, validatePath } from '../helpers/pathUtils';
4
+ import { BaseMethod } from '../BaseMethod';
5
+ import { validateParams } from '../helpers/paramsValidator';
6
+ import { EVMGetPublicKeyParams, EVMPublicKey } from '../../types/api/evmGetPublicKey';
7
7
 
8
8
  export default class EVMGetPublicKey extends BaseMethod<EthereumGetPublicKey[]> {
9
9
  hasBundle = false;
@@ -1,9 +1,9 @@
1
1
  import { EthereumSignMessage } from '@onekeyfe/hd-transport/src/types/messages';
2
- import { UI_REQUEST } from '../constants/ui-request';
3
- import { validatePath } from './helpers/pathUtils';
4
- import { BaseMethod } from './BaseMethod';
5
- import { validateParams } from './helpers/paramsValidator';
6
- import { formatAnyHex } from './helpers/hexUtils';
2
+ import { UI_REQUEST } from '../../constants/ui-request';
3
+ import { validatePath } from '../helpers/pathUtils';
4
+ import { BaseMethod } from '../BaseMethod';
5
+ import { validateParams } from '../helpers/paramsValidator';
6
+ import { formatAnyHex } from '../helpers/hexUtils';
7
7
 
8
8
  export default class EVMSignMessage extends BaseMethod<EthereumSignMessage> {
9
9
  init() {
@@ -1,9 +1,9 @@
1
1
  import { EthereumSignMessageEIP712 } from '@onekeyfe/hd-transport/src/types/messages';
2
- import { UI_REQUEST } from '../constants/ui-request';
3
- import { validatePath } from './helpers/pathUtils';
4
- import { BaseMethod } from './BaseMethod';
5
- import { validateParams } from './helpers/paramsValidator';
6
- import { formatAnyHex } from './helpers/hexUtils';
2
+ import { UI_REQUEST } from '../../constants/ui-request';
3
+ import { validatePath } from '../helpers/pathUtils';
4
+ import { BaseMethod } from '../BaseMethod';
5
+ import { validateParams } from '../helpers/paramsValidator';
6
+ import { formatAnyHex } from '../helpers/hexUtils';
7
7
 
8
8
  export default class EVMSignMessageEIP712 extends BaseMethod<EthereumSignMessageEIP712> {
9
9
  init() {
@@ -4,19 +4,19 @@ import {
4
4
  EthereumTxRequest,
5
5
  } from '@onekeyfe/hd-transport/src/types/messages';
6
6
 
7
- import { UI_REQUEST } from '../constants/ui-request';
8
- import { validatePath } from './helpers/pathUtils';
9
- import { BaseMethod } from './BaseMethod';
10
- import { SchemaParam, validateParams } from './helpers/paramsValidator';
7
+ import { UI_REQUEST } from '../../constants/ui-request';
8
+ import { validatePath } from '../helpers/pathUtils';
9
+ import { BaseMethod } from '../BaseMethod';
10
+ import { SchemaParam, validateParams } from '../helpers/paramsValidator';
11
11
  import {
12
12
  EVMSignedTx,
13
13
  EVMSignTransactionParams,
14
14
  EVMTransaction,
15
15
  EVMTransactionEIP1559,
16
- } from '../types/api/evmSignTransaction';
17
- import { cutString } from './helpers/stringUtils';
18
- import { formatAnyHex, stripHexStartZeroes } from './helpers/hexUtils';
19
- import { ERRORS } from '../constants';
16
+ } from '../../types/api/evmSignTransaction';
17
+ import { cutString } from '../helpers/stringUtils';
18
+ import { formatAnyHex, stripHexStartZeroes } from '../helpers/hexUtils';
19
+ import { ERRORS } from '../../constants';
20
20
 
21
21
  export default class EVMSignTransaction extends BaseMethod {
22
22
  addressN: number[] = [];
@@ -70,7 +70,7 @@ export default class EVMSignTransaction extends BaseMethod {
70
70
  const r = request.signature_r;
71
71
  const s = request.signature_s;
72
72
 
73
- if (!v || !r || !s) {
73
+ if (v == null || r == null || s == null) {
74
74
  throw ERRORS.TypedError('Runtime', 'processTxRequest: Unexpected request');
75
75
  }
76
76
 
@@ -3,17 +3,17 @@ import {
3
3
  EthereumTypedDataStructAck,
4
4
  MessageKey,
5
5
  } from '@onekeyfe/hd-transport/src/types/messages';
6
- import { UI_REQUEST } from '../constants/ui-request';
7
- import { validatePath } from './helpers/pathUtils';
8
- import { BaseMethod } from './BaseMethod';
9
- import { validateParams } from './helpers/paramsValidator';
10
- import { formatAnyHex } from './helpers/hexUtils';
11
- import { ERRORS } from '../constants';
12
- import { encodeData, getFieldType, parseArrayType } from './helpers/typeNameUtils';
6
+ import { UI_REQUEST } from '../../constants/ui-request';
7
+ import { validatePath } from '../helpers/pathUtils';
8
+ import { BaseMethod } from '../BaseMethod';
9
+ import { validateParams } from '../helpers/paramsValidator';
10
+ import { formatAnyHex } from '../helpers/hexUtils';
11
+ import { ERRORS } from '../../constants';
12
+ import { encodeData, getFieldType, parseArrayType } from '../helpers/typeNameUtils';
13
13
  import {
14
14
  EthereumSignTypedDataMessage,
15
15
  EthereumSignTypedDataTypes,
16
- } from '../types/api/evmSignTypedData';
16
+ } from '../../types/api/evmSignTypedData';
17
17
 
18
18
  export type EVMSignTypedDataParams = {
19
19
  addressN: number[];
@@ -1,8 +1,8 @@
1
1
  import { EthereumVerifyMessage } from '@onekeyfe/hd-transport/src/types/messages';
2
- import { UI_REQUEST } from '../constants/ui-request';
3
- import { BaseMethod } from './BaseMethod';
4
- import { validateParams } from './helpers/paramsValidator';
5
- import { formatAnyHex } from './helpers/hexUtils';
2
+ import { UI_REQUEST } from '../../constants/ui-request';
3
+ import { BaseMethod } from '../BaseMethod';
4
+ import { validateParams } from '../helpers/paramsValidator';
5
+ import { formatAnyHex } from '../helpers/hexUtils';
6
6
 
7
7
  export default class EVMSignMessage extends BaseMethod<EthereumVerifyMessage> {
8
8
  init() {
@@ -3,7 +3,7 @@
3
3
  import { ChangeOutputScriptType, InputScriptType } from '@onekeyfe/hd-transport/src/types/messages';
4
4
  import { ERRORS } from '../../constants';
5
5
 
6
- export const HD_HARDENED = 0x80000000;
6
+ const HD_HARDENED = 0x80000000;
7
7
  export const toHardened = (n: number): number => (n | HD_HARDENED) >>> 0;
8
8
  export const fromHardened = (n: number): number => (n & ~HD_HARDENED) >>> 0;
9
9
 
package/src/api/index.ts CHANGED
@@ -1,26 +1,31 @@
1
1
  export { default as searchDevices } from './SearchDevices';
2
2
  export { default as getFeatures } from './GetFeatures';
3
- export { default as btcGetAddress } from './BTCGetAddress';
4
- export { default as btcGetPublicKey } from './BTCGetPublicKey';
5
- export { default as btcSignMessage } from './BTCSignMessage';
6
- export { default as btcSignTransaction } from './BTCSignTransaction';
7
- export { default as btcVerifyMessage } from './BTCVerifyMessage';
3
+ export { default as btcGetAddress } from './btc/BTCGetAddress';
4
+ export { default as btcGetPublicKey } from './btc/BTCGetPublicKey';
5
+ export { default as btcSignMessage } from './btc/BTCSignMessage';
6
+ export { default as btcSignTransaction } from './btc/BTCSignTransaction';
7
+ export { default as btcVerifyMessage } from './btc/BTCVerifyMessage';
8
8
  export { default as checkFirmwareRelease } from './CheckFirmwareRelease';
9
9
  export { default as checkBLEFirmwareRelease } from './CheckBLEFirmwareRelease';
10
10
  export { default as checkTransportRelease } from './CheckTransportRelease';
11
- export { default as deviceBackup } from './DeviceBackup';
12
- export { default as deviceChangePin } from './DeviceChangePin';
13
- export { default as deviceFlags } from './DeviceFlags';
14
- export { default as deviceRebootToBootloader } from './DeviceRebootToBootloader';
15
- export { default as deviceRecovery } from './DeviceRecovery';
16
- export { default as deviceReset } from './DeviceReset';
17
- export { default as deviceSettings } from './DeviceSettings';
18
- export { default as deviceUpdateReboot } from './DeviceUpdateReboot';
19
- export { default as deviceWipe } from './DeviceWipe';
20
- export { default as evmGetAddress } from './EVMGetAddress';
21
- export { default as evmGetPublicKey } from './EVMGetPublicKey';
22
- export { default as evmSignMessage } from './EVMSignMessage';
23
- export { default as evmSignMessageEIP712 } from './EVMSignMessageEIP712';
24
- export { default as evmSignTransaction } from './EVMSignTransaction';
25
- export { default as evmSignTypedData } from './EVMSignTypedData';
26
- export { default as evmVerifyMessage } from './EVMVerifyMessage';
11
+ export { default as deviceBackup } from './device/DeviceBackup';
12
+ export { default as deviceChangePin } from './device/DeviceChangePin';
13
+ export { default as deviceFlags } from './device/DeviceFlags';
14
+ export { default as deviceRebootToBootloader } from './device/DeviceRebootToBootloader';
15
+ export { default as deviceRecovery } from './device/DeviceRecovery';
16
+ export { default as deviceReset } from './device/DeviceReset';
17
+ export { default as deviceSettings } from './device/DeviceSettings';
18
+ export { default as deviceUpdateReboot } from './device/DeviceUpdateReboot';
19
+ export { default as deviceWipe } from './device/DeviceWipe';
20
+ export { default as evmGetAddress } from './evm/EVMGetAddress';
21
+ export { default as evmGetPublicKey } from './evm/EVMGetPublicKey';
22
+ export { default as evmSignMessage } from './evm/EVMSignMessage';
23
+ export { default as evmSignMessageEIP712 } from './evm/EVMSignMessageEIP712';
24
+ export { default as evmSignTransaction } from './evm/EVMSignTransaction';
25
+ export { default as evmSignTypedData } from './evm/EVMSignTypedData';
26
+ export { default as evmVerifyMessage } from './evm/EVMVerifyMessage';
27
+ export { default as starcoinGetAddress } from './starcoin/StarcoinGetAddress';
28
+ export { default as starcoinGetPublicKey } from './starcoin/StarcoinGetPublicKey';
29
+ export { default as starcoinSignMessage } from './starcoin/StarcoinSignMessage';
30
+ export { default as starcoinSignTransaction } from './starcoin/StarcoinSignTransaction';
31
+ export { default as starcoinVerifyMessage } from './starcoin/StarcoinVerifyMessage';