@onekeyfe/hd-core 0.2.7 → 0.2.9

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 (93) hide show
  1. package/dist/api/BaseMethod.d.ts.map +1 -1
  2. package/dist/api/cardano/CardanoGetAddress.d.ts +8 -0
  3. package/dist/api/cardano/CardanoGetAddress.d.ts.map +1 -0
  4. package/dist/api/cardano/CardanoGetPublicKey.d.ts +8 -0
  5. package/dist/api/cardano/CardanoGetPublicKey.d.ts.map +1 -0
  6. package/dist/api/cardano/CardanoSignTransaction.d.ts +9 -0
  7. package/dist/api/cardano/CardanoSignTransaction.d.ts.map +1 -0
  8. package/dist/api/cardano/helper/addressParameters.d.ts +7 -0
  9. package/dist/api/cardano/helper/addressParameters.d.ts.map +1 -0
  10. package/dist/api/cardano/helper/auxiliaryData.d.ts +5 -0
  11. package/dist/api/cardano/helper/auxiliaryData.d.ts.map +1 -0
  12. package/dist/api/cardano/helper/cardanoInputs.d.ts +14 -0
  13. package/dist/api/cardano/helper/cardanoInputs.d.ts.map +1 -0
  14. package/dist/api/cardano/helper/cardanoOutputs.d.ts +11 -0
  15. package/dist/api/cardano/helper/cardanoOutputs.d.ts.map +1 -0
  16. package/dist/api/cardano/helper/certificate.d.ts +9 -0
  17. package/dist/api/cardano/helper/certificate.d.ts.map +1 -0
  18. package/dist/api/cardano/helper/token.d.ts +3 -0
  19. package/dist/api/cardano/helper/token.d.ts.map +1 -0
  20. package/dist/api/cardano/helper/utils.d.ts +3 -0
  21. package/dist/api/cardano/helper/utils.d.ts.map +1 -0
  22. package/dist/api/cardano/helper/witnesses.d.ts +5 -0
  23. package/dist/api/cardano/helper/witnesses.d.ts.map +1 -0
  24. package/dist/api/firmware/uploadFirmware.d.ts.map +1 -1
  25. package/dist/api/helpers/paramsValidator.d.ts +2 -1
  26. package/dist/api/helpers/paramsValidator.d.ts.map +1 -1
  27. package/dist/api/index.d.ts +6 -0
  28. package/dist/api/index.d.ts.map +1 -1
  29. package/dist/api/sui/SuiGetAddress.d.ts +18 -0
  30. package/dist/api/sui/SuiGetAddress.d.ts.map +1 -0
  31. package/dist/api/sui/SuiGetPublicKey.d.ts +21 -0
  32. package/dist/api/sui/SuiGetPublicKey.d.ts.map +1 -0
  33. package/dist/api/sui/SuiSignTransaction.d.ts +15 -0
  34. package/dist/api/sui/SuiSignTransaction.d.ts.map +1 -0
  35. package/dist/core/index.d.ts.map +1 -1
  36. package/dist/device/Device.d.ts +1 -0
  37. package/dist/device/Device.d.ts.map +1 -1
  38. package/dist/index.d.ts +233 -3
  39. package/dist/index.js +1203 -97
  40. package/dist/inject.d.ts.map +1 -1
  41. package/dist/types/api/cardano.d.ts +158 -0
  42. package/dist/types/api/cardano.d.ts.map +1 -0
  43. package/dist/types/api/cardanoGetAddress.d.ts +33 -0
  44. package/dist/types/api/cardanoGetAddress.d.ts.map +1 -0
  45. package/dist/types/api/cardanoGetPublicKey.d.ts +23 -0
  46. package/dist/types/api/cardanoGetPublicKey.d.ts.map +1 -0
  47. package/dist/types/api/cardanoSignTransaction.d.ts +4 -0
  48. package/dist/types/api/cardanoSignTransaction.d.ts.map +1 -0
  49. package/dist/types/api/export.d.ts +3 -0
  50. package/dist/types/api/export.d.ts.map +1 -1
  51. package/dist/types/api/index.d.ts +12 -0
  52. package/dist/types/api/index.d.ts.map +1 -1
  53. package/dist/types/api/suiGetAddress.d.ts +15 -0
  54. package/dist/types/api/suiGetAddress.d.ts.map +1 -0
  55. package/dist/types/api/suiGetPublicKey.d.ts +14 -0
  56. package/dist/types/api/suiGetPublicKey.d.ts.map +1 -0
  57. package/dist/types/api/suiSignTransaction.d.ts +11 -0
  58. package/dist/types/api/suiSignTransaction.d.ts.map +1 -0
  59. package/dist/utils/patch.d.ts +1 -1
  60. package/dist/utils/patch.d.ts.map +1 -1
  61. package/package.json +4 -4
  62. package/src/api/BaseMethod.ts +7 -1
  63. package/src/api/btc/helpers/signtxLegacy.ts +1 -1
  64. package/src/api/cardano/CardanoGetAddress.ts +87 -0
  65. package/src/api/cardano/CardanoGetPublicKey.ts +55 -0
  66. package/src/api/cardano/CardanoSignTransaction.ts +309 -0
  67. package/src/api/cardano/helper/addressParameters.ts +118 -0
  68. package/src/api/cardano/helper/auxiliaryData.ts +74 -0
  69. package/src/api/cardano/helper/cardanoInputs.ts +56 -0
  70. package/src/api/cardano/helper/cardanoOutputs.ts +89 -0
  71. package/src/api/cardano/helper/certificate.ts +199 -0
  72. package/src/api/cardano/helper/token.ts +43 -0
  73. package/src/api/cardano/helper/utils.ts +17 -0
  74. package/src/api/cardano/helper/witnesses.ts +63 -0
  75. package/src/api/firmware/uploadFirmware.ts +1 -3
  76. package/src/api/helpers/paramsValidator.ts +19 -1
  77. package/src/api/index.ts +8 -0
  78. package/src/api/sui/SuiGetAddress.ts +97 -0
  79. package/src/api/sui/SuiGetPublicKey.ts +63 -0
  80. package/src/api/sui/SuiSignTransaction.ts +48 -0
  81. package/src/core/index.ts +1 -0
  82. package/src/data/messages/messages.json +217 -69
  83. package/src/device/Device.ts +5 -0
  84. package/src/inject.ts +14 -0
  85. package/src/types/api/cardano.ts +186 -0
  86. package/src/types/api/cardanoGetAddress.ts +47 -0
  87. package/src/types/api/cardanoGetPublicKey.ts +33 -0
  88. package/src/types/api/cardanoSignTransaction.ts +8 -0
  89. package/src/types/api/export.ts +4 -0
  90. package/src/types/api/index.ts +22 -0
  91. package/src/types/api/suiGetAddress.ts +24 -0
  92. package/src/types/api/suiGetPublicKey.ts +23 -0
  93. package/src/types/api/suiSignTransaction.ts +17 -0
@@ -0,0 +1,47 @@
1
+ import type { CardanoAddressParametersType } from '@onekeyfe/hd-transport';
2
+ import type { CommonParams, Response } from '../params';
3
+ import type { CardanoAddressParameters } from './cardano';
4
+
5
+ export type CardanoGetAddressMethodParams = {
6
+ addressParameters: CardanoAddressParameters;
7
+ networkId: number;
8
+ /**
9
+ * Testnet cip34:0-1097911063
10
+ * Mainnet cip34:1-764824073
11
+ */
12
+ protocolMagic: number;
13
+ derivationType: number;
14
+ address: string;
15
+ showOnOneKey: boolean;
16
+ };
17
+
18
+ export type CardanoGetAddressParams = {
19
+ address_parameters: CardanoAddressParametersType;
20
+ network_id: number;
21
+ protocol_magic: number;
22
+ derivation_type: number;
23
+ address: string;
24
+ show_display: boolean;
25
+ };
26
+
27
+ export type CardanoAddress = {
28
+ addressParameters: CardanoAddressParameters;
29
+ protocolMagic: number;
30
+ networkId: number;
31
+ serializedPath: string;
32
+ serializedStakingPath: string;
33
+ address: string;
34
+ xpub: string;
35
+ };
36
+
37
+ export declare function cardanoGetAddress(
38
+ connectId: string,
39
+ deviceId: string,
40
+ params: CommonParams & CardanoGetAddressMethodParams
41
+ ): Response<CardanoAddress>;
42
+
43
+ export declare function cardanoGetAddress(
44
+ connectId: string,
45
+ deviceId: string,
46
+ params: CommonParams & { bundle?: CardanoGetAddressMethodParams[] }
47
+ ): Response<CardanoAddress[]>;
@@ -0,0 +1,33 @@
1
+ import type { CommonParams, Response } from '../params';
2
+ import { PROTO } from '../../constants';
3
+
4
+ export type CardanoPublicKey = {
5
+ path: number[];
6
+ serializedPath: string;
7
+ publicKey: string;
8
+ node: PROTO.HDNodeType;
9
+ };
10
+
11
+ export type CardanoPublicKeyParams = {
12
+ address_n: number[];
13
+ derivation_type: number;
14
+ show_display: boolean;
15
+ };
16
+
17
+ export type CardanoPublicKeyMethodParams = {
18
+ path: string | number[];
19
+ derivationType?: number;
20
+ showOnOneKey?: boolean;
21
+ };
22
+
23
+ export declare function cardanoGetPublicKey(
24
+ connectId: string,
25
+ deviceId: string,
26
+ params: CommonParams & CardanoPublicKeyMethodParams
27
+ ): Response<CardanoPublicKey>;
28
+
29
+ export declare function cardanoGetPublicKey(
30
+ connectId: string,
31
+ deviceId: string,
32
+ params: CommonParams & { bundle?: CardanoPublicKeyMethodParams[] }
33
+ ): Response<CardanoPublicKey[]>;
@@ -0,0 +1,8 @@
1
+ import type { CommonParams, Response } from '../params';
2
+ import type { CardanoSignTransaction, CardanoSignedTxData } from './cardano';
3
+
4
+ export declare function cardanoSignTransaction(
5
+ connectId: string,
6
+ deviceId: string,
7
+ params: CommonParams & CardanoSignTransaction
8
+ ): Response<CardanoSignedTxData>;
@@ -106,3 +106,7 @@ export type { AlgoSignedTx, AlgoSignTransactionParams } from './algoSignTransact
106
106
  export type { CosmosAddress, CosmosGetAddressParams } from './cosmosGetAddress';
107
107
  export type { CosmosPublicKey, CosmosGetPublicKeyParams } from './cosmosGetPublicKey';
108
108
  export type { CosmosSignedTx, CosmosSignTransactionParams } from './cosmosSignTransaction';
109
+
110
+ export type { SuiAddress, SuiGetAddressParams } from './suiGetAddress';
111
+ export type { SuiPublicKey, SuiGetPublicKeyParams } from './suiGetPublicKey';
112
+ export type { SuiSignedTx, SuiSignTransactionParams } from './suiSignTransaction';
@@ -86,6 +86,14 @@ import { cosmosSignTransaction } from './cosmosSignTransaction';
86
86
  import { xrpGetAddress } from './xrpGetAddress';
87
87
  import { xrpSignTransaction } from './xrpSignTransaction';
88
88
 
89
+ import { suiGetAddress } from './suiGetAddress';
90
+ import { suiGetPublicKey } from './suiGetPublicKey';
91
+ import { suiSignTransaction } from './suiSignTransaction';
92
+
93
+ import { cardanoGetAddress } from './cardanoGetAddress';
94
+ import { cardanoGetPublicKey } from './cardanoGetPublicKey';
95
+ import { cardanoSignTransaction } from './cardanoSignTransaction';
96
+
89
97
  export * from './export';
90
98
 
91
99
  export type CoreApi = {
@@ -229,4 +237,18 @@ export type CoreApi = {
229
237
  */
230
238
  xrpGetAddress: typeof xrpGetAddress;
231
239
  xrpSignTransaction: typeof xrpSignTransaction;
240
+
241
+ /**
242
+ * SUI function
243
+ */
244
+ suiGetAddress: typeof suiGetAddress;
245
+ suiGetPublicKey: typeof suiGetPublicKey;
246
+ suiSignTransaction: typeof suiSignTransaction;
247
+
248
+ /**
249
+ * Cardano function
250
+ */
251
+ cardanoGetAddress: typeof cardanoGetAddress;
252
+ cardanoGetPublicKey: typeof cardanoGetPublicKey;
253
+ cardanoSignTransaction: typeof cardanoSignTransaction;
232
254
  };
@@ -0,0 +1,24 @@
1
+ import { SuiAddress as HardwareSuiAddress } from '@onekeyfe/hd-transport';
2
+ import type { CommonParams, Response } from '../params';
3
+
4
+ export type SuiAddress = {
5
+ path: string;
6
+ publicKey?: string;
7
+ } & HardwareSuiAddress;
8
+
9
+ export type SuiGetAddressParams = {
10
+ path: string | number[];
11
+ showOnOneKey?: boolean;
12
+ };
13
+
14
+ export declare function suiGetAddress(
15
+ connectId: string,
16
+ deviceId: string,
17
+ params: CommonParams & HardwareSuiAddress
18
+ ): Response<SuiAddress>;
19
+
20
+ export declare function suiGetAddress(
21
+ connectId: string,
22
+ deviceId: string,
23
+ params: CommonParams & { bundle?: HardwareSuiAddress[] }
24
+ ): Response<Array<SuiAddress>>;
@@ -0,0 +1,23 @@
1
+ import type { CommonParams, Response } from '../params';
2
+
3
+ export type SuiPublicKey = {
4
+ path: string;
5
+ publicKey: string;
6
+ };
7
+
8
+ export type SuiGetPublicKeyParams = {
9
+ path: string | number[];
10
+ showOnOneKey?: boolean;
11
+ };
12
+
13
+ export declare function suiGetPublicKey(
14
+ connectId: string,
15
+ deviceId: string,
16
+ params: CommonParams & SuiGetPublicKeyParams
17
+ ): Response<SuiPublicKey>;
18
+
19
+ export declare function suiGetPublicKey(
20
+ connectId: string,
21
+ deviceId: string,
22
+ params: CommonParams & { bundle?: SuiGetPublicKeyParams[] }
23
+ ): Response<Array<SuiPublicKey>>;
@@ -0,0 +1,17 @@
1
+ import { AptosSignedTx as HardwareAptosSignedTx } from '@onekeyfe/hd-transport';
2
+ import type { CommonParams, Response } from '../params';
3
+
4
+ export type SuiSignedTx = {
5
+ path: string;
6
+ } & HardwareAptosSignedTx;
7
+
8
+ export type SuiSignTransactionParams = {
9
+ path: string | number[];
10
+ rawTx?: string;
11
+ };
12
+
13
+ export declare function suiSignTransaction(
14
+ connectId: string,
15
+ deviceId: string,
16
+ params: CommonParams & SuiSignTransactionParams
17
+ ): Response<SuiSignedTx>;