@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,63 @@
1
+ import { UI_REQUEST } from '../../constants/ui-request';
2
+ import { serializedPath, validatePath } from '../helpers/pathUtils';
3
+ import { BaseMethod } from '../BaseMethod';
4
+ import { validateParams } from '../helpers/paramsValidator';
5
+ import { SuiGetAddressParams } from '../../types';
6
+
7
+ export default class SuiGetPublicKey extends BaseMethod<any> {
8
+ hasBundle = false;
9
+
10
+ init() {
11
+ this.checkDeviceId = true;
12
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.INITIALIZE];
13
+
14
+ this.hasBundle = !!this.payload?.bundle;
15
+ const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
16
+
17
+ // check payload
18
+ validateParams(payload, [{ name: 'bundle', type: 'array' }]);
19
+
20
+ // init params
21
+ this.params = [];
22
+ payload.bundle.forEach((batch: SuiGetAddressParams) => {
23
+ const addressN = validatePath(batch.path, 3);
24
+
25
+ validateParams(batch, [
26
+ { name: 'path', required: true },
27
+ { name: 'showOnOneKey', type: 'boolean' },
28
+ ]);
29
+
30
+ const showOnOneKey = batch.showOnOneKey ?? true;
31
+
32
+ this.params.push({
33
+ address_n: addressN,
34
+ show_display: showOnOneKey,
35
+ });
36
+ });
37
+ }
38
+
39
+ getVersionRange() {
40
+ return {
41
+ model_mini: {
42
+ min: '2.9.0',
43
+ },
44
+ model_touch: {
45
+ min: '3.5.0',
46
+ },
47
+ };
48
+ }
49
+
50
+ async run() {
51
+ const res = await this.device.commands.typedCall('BatchGetPublickeys', 'EcdsaPublicKeys', {
52
+ paths: this.params,
53
+ ecdsa_curve_name: 'ed25519',
54
+ });
55
+
56
+ const responses = res.message.public_keys.map((publicKey: string, index: number) => ({
57
+ path: serializedPath((this.params as unknown as any[])[index].address_n),
58
+ publicKey,
59
+ }));
60
+
61
+ return Promise.resolve(this.hasBundle ? responses : responses[0]);
62
+ }
63
+ }
@@ -0,0 +1,48 @@
1
+ import { SuiSignTx as HardwareSuiSignTx } from '@onekeyfe/hd-transport';
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
+
8
+ export default class SuiSignTransaction extends BaseMethod<HardwareSuiSignTx> {
9
+ init() {
10
+ this.checkDeviceId = true;
11
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.INITIALIZE];
12
+
13
+ // check payload
14
+ validateParams(this.payload, [
15
+ { name: 'path', required: true },
16
+ { name: 'rawTx', type: 'hexString', required: true },
17
+ ]);
18
+
19
+ const { path, rawTx } = this.payload;
20
+
21
+ const addressN = validatePath(path, 3);
22
+
23
+ // init params
24
+ this.params = {
25
+ address_n: addressN,
26
+ raw_tx: formatAnyHex(rawTx),
27
+ };
28
+ }
29
+
30
+ getVersionRange() {
31
+ return {
32
+ model_mini: {
33
+ min: '2.9.0',
34
+ },
35
+ model_touch: {
36
+ min: '3.5.0',
37
+ },
38
+ };
39
+ }
40
+
41
+ async run() {
42
+ const res = await this.device.commands.typedCall('SuiSignTx', 'SuiSignedTx', {
43
+ ...this.params,
44
+ });
45
+
46
+ return Promise.resolve(res.message);
47
+ }
48
+ }
package/src/core/index.ts CHANGED
@@ -45,6 +45,7 @@ const parseInitOptions = (method?: BaseMethod): InitOptions => ({
45
45
  initSession: method?.payload.initSession,
46
46
  passphraseState: method?.payload.passphraseState,
47
47
  deviceId: method?.payload.deviceId,
48
+ deriveCardano: method?.name.startsWith('cardano'),
48
49
  });
49
50
 
50
51
  let _core: Core;
@@ -1892,74 +1892,113 @@
1892
1892
  },
1893
1893
  "CardanoSignTxInit": {
1894
1894
  "fields": {
1895
- "signing_mode": {
1896
- "rule": "required",
1897
- "type": "CardanoTxSigningMode",
1898
- "id": 1
1899
- },
1900
- "protocol_magic": {
1901
- "rule": "required",
1902
- "type": "uint32",
1903
- "id": 2
1904
- },
1905
- "network_id": {
1906
- "rule": "required",
1907
- "type": "uint32",
1908
- "id": 3
1909
- },
1910
- "inputs_count": {
1911
- "rule": "required",
1912
- "type": "uint32",
1913
- "id": 4
1914
- },
1915
- "outputs_count": {
1916
- "rule": "required",
1917
- "type": "uint32",
1918
- "id": 5
1919
- },
1920
- "fee": {
1921
- "rule": "required",
1922
- "type": "uint64",
1923
- "id": 6
1924
- },
1925
- "ttl": {
1926
- "type": "uint64",
1927
- "id": 7
1928
- },
1929
- "certificates_count": {
1930
- "rule": "required",
1931
- "type": "uint32",
1932
- "id": 8
1933
- },
1934
- "withdrawals_count": {
1935
- "rule": "required",
1936
- "type": "uint32",
1937
- "id": 9
1938
- },
1939
- "has_auxiliary_data": {
1940
- "rule": "required",
1941
- "type": "bool",
1942
- "id": 10
1943
- },
1944
- "validity_interval_start": {
1945
- "type": "uint64",
1946
- "id": 11
1947
- },
1948
- "witness_requests_count": {
1949
- "rule": "required",
1950
- "type": "uint32",
1951
- "id": 12
1952
- },
1953
- "minting_asset_groups_count": {
1954
- "rule": "required",
1955
- "type": "uint32",
1956
- "id": 13
1957
- },
1958
- "derivation_type": {
1959
- "rule": "required",
1960
- "type": "CardanoDerivationType",
1961
- "id": 14
1962
- }
1895
+ "signing_mode": {
1896
+ "rule": "required",
1897
+ "type": "CardanoTxSigningMode",
1898
+ "id": 1
1899
+ },
1900
+ "protocol_magic": {
1901
+ "rule": "required",
1902
+ "type": "uint32",
1903
+ "id": 2
1904
+ },
1905
+ "network_id": {
1906
+ "rule": "required",
1907
+ "type": "uint32",
1908
+ "id": 3
1909
+ },
1910
+ "inputs_count": {
1911
+ "rule": "required",
1912
+ "type": "uint32",
1913
+ "id": 4
1914
+ },
1915
+ "outputs_count": {
1916
+ "rule": "required",
1917
+ "type": "uint32",
1918
+ "id": 5
1919
+ },
1920
+ "fee": {
1921
+ "rule": "required",
1922
+ "type": "uint64",
1923
+ "id": 6
1924
+ },
1925
+ "ttl": {
1926
+ "type": "uint64",
1927
+ "id": 7
1928
+ },
1929
+ "certificates_count": {
1930
+ "rule": "required",
1931
+ "type": "uint32",
1932
+ "id": 8
1933
+ },
1934
+ "withdrawals_count": {
1935
+ "rule": "required",
1936
+ "type": "uint32",
1937
+ "id": 9
1938
+ },
1939
+ "has_auxiliary_data": {
1940
+ "rule": "required",
1941
+ "type": "bool",
1942
+ "id": 10
1943
+ },
1944
+ "validity_interval_start": {
1945
+ "type": "uint64",
1946
+ "id": 11
1947
+ },
1948
+ "witness_requests_count": {
1949
+ "rule": "required",
1950
+ "type": "uint32",
1951
+ "id": 12
1952
+ },
1953
+ "minting_asset_groups_count": {
1954
+ "rule": "required",
1955
+ "type": "uint32",
1956
+ "id": 13
1957
+ },
1958
+ "derivation_type": {
1959
+ "rule": "required",
1960
+ "type": "CardanoDerivationType",
1961
+ "id": 14
1962
+ },
1963
+ "include_network_id": {
1964
+ "type": "bool",
1965
+ "id": 15,
1966
+ "options": {
1967
+ "default": false
1968
+ }
1969
+ },
1970
+ "script_data_hash": {
1971
+ "type": "bytes",
1972
+ "id": 16
1973
+ },
1974
+ "collateral_inputs_count": {
1975
+ "rule": "required",
1976
+ "type": "uint32",
1977
+ "id": 17
1978
+ },
1979
+ "required_signers_count": {
1980
+ "rule": "required",
1981
+ "type": "uint32",
1982
+ "id": 18
1983
+ },
1984
+ "has_collateral_return": {
1985
+ "type": "bool",
1986
+ "id": 19,
1987
+ "options": {
1988
+ "default": false
1989
+ }
1990
+ },
1991
+ "total_collateral": {
1992
+ "type": "uint64",
1993
+ "id": 20
1994
+ },
1995
+ "reference_inputs_count": {
1996
+ "type": "uint32",
1997
+ "id": 21,
1998
+ "options": {
1999
+ "default": 0
2000
+ }
2001
+ }
1963
2002
  }
1964
2003
  },
1965
2004
  "CardanoTxInput": {
@@ -5591,6 +5630,52 @@
5591
5630
  "RebootToBootloader": {
5592
5631
  "fields": {}
5593
5632
  },
5633
+ "RebootToBoardloader": {
5634
+ "fields": {}
5635
+ },
5636
+ "ListResDir": {
5637
+ "fields": {
5638
+ "path": {
5639
+ "rule": "required",
5640
+ "type": "string",
5641
+ "id": 1
5642
+ }
5643
+ }
5644
+ },
5645
+ "FileInfoList": {
5646
+ "fields": {
5647
+ "files": {
5648
+ "rule": "repeated",
5649
+ "type": "FileInfo",
5650
+ "id": 1
5651
+ }
5652
+ },
5653
+ "nested": {
5654
+ "FileInfo": {
5655
+ "fields": {
5656
+ "name": {
5657
+ "rule": "required",
5658
+ "type": "string",
5659
+ "id": 1
5660
+ },
5661
+ "size": {
5662
+ "rule": "required",
5663
+ "type": "uint64",
5664
+ "id": 2
5665
+ }
5666
+ }
5667
+ }
5668
+ }
5669
+ },
5670
+ "DeviceEraseSector": {
5671
+ "fields": {
5672
+ "sector": {
5673
+ "rule": "required",
5674
+ "type": "uint32",
5675
+ "id": 1
5676
+ }
5677
+ }
5678
+ },
5594
5679
  "MoneroTransactionSourceEntry": {
5595
5680
  "fields": {
5596
5681
  "outputs": {
@@ -7724,6 +7809,61 @@
7724
7809
  }
7725
7810
  }
7726
7811
  },
7812
+ "SuiGetAddress": {
7813
+ "fields": {
7814
+ "address_n": {
7815
+ "rule": "repeated",
7816
+ "type": "uint32",
7817
+ "id": 1,
7818
+ "options": {
7819
+ "packed": false
7820
+ }
7821
+ },
7822
+ "show_display": {
7823
+ "type": "bool",
7824
+ "id": 2
7825
+ }
7826
+ }
7827
+ },
7828
+ "SuiAddress": {
7829
+ "fields": {
7830
+ "address": {
7831
+ "type": "string",
7832
+ "id": 1
7833
+ }
7834
+ }
7835
+ },
7836
+ "SuiSignTx": {
7837
+ "fields": {
7838
+ "address_n": {
7839
+ "rule": "repeated",
7840
+ "type": "uint32",
7841
+ "id": 1,
7842
+ "options": {
7843
+ "packed": false
7844
+ }
7845
+ },
7846
+ "raw_tx": {
7847
+ "rule": "required",
7848
+ "type": "bytes",
7849
+ "id": 2
7850
+ }
7851
+ }
7852
+ },
7853
+ "SuiSignedTx": {
7854
+ "fields": {
7855
+ "public_key": {
7856
+ "rule": "required",
7857
+ "type": "bytes",
7858
+ "id": 1
7859
+ },
7860
+ "signature": {
7861
+ "rule": "required",
7862
+ "type": "bytes",
7863
+ "id": 2
7864
+ }
7865
+ }
7866
+ },
7727
7867
  "TezosGetAddress": {
7728
7868
  "fields": {
7729
7869
  "address_n": {
@@ -8721,6 +8861,10 @@
8721
8861
  "MessageType_AlgorandAddress": 10901,
8722
8862
  "MessageType_AlgorandSignTx": 10902,
8723
8863
  "MessageType_AlgorandSignedTx": 10903,
8864
+ "MessageType_SuiGetAddress": 11100,
8865
+ "MessageType_SuiAddress": 11101,
8866
+ "MessageType_SuiSignTx": 11102,
8867
+ "MessageType_SuiSignedTx": 11103,
8724
8868
  "MessageType_DeviceBackToBoot": 903,
8725
8869
  "MessageType_DeviceInfoSettings": 10001,
8726
8870
  "MessageType_GetDeviceInfo": 10002,
@@ -8741,7 +8885,11 @@
8741
8885
  "MessageType_ZoomRequest": 10019,
8742
8886
  "MessageType_ResourceRequest": 10020,
8743
8887
  "MessageType_ResourceAck": 10021,
8744
- "MessageType_ResourceUpdate": 10022
8888
+ "MessageType_ResourceUpdate": 10022,
8889
+ "MessageType_ListResDir": 10023,
8890
+ "MessageType_FileInfoList": 10024,
8891
+ "MessageType_RebootToBoardloader": 10025,
8892
+ "MessageType_DeviceEraseSector": 10026
8745
8893
  }
8746
8894
  },
8747
8895
  "google": {
@@ -32,6 +32,7 @@ export type InitOptions = {
32
32
  initSession?: boolean;
33
33
  deviceId?: string;
34
34
  passphraseState?: string;
35
+ deriveCardano?: boolean;
35
36
  };
36
37
 
37
38
  export type RunOptions = {
@@ -343,6 +344,10 @@ export class Device extends EventEmitter {
343
344
  payload.session_id = internalState;
344
345
  }
345
346
 
347
+ if (options?.deriveCardano) {
348
+ payload.derive_cardano = true;
349
+ }
350
+
346
351
  Log.debug('initialize payload:', payload);
347
352
 
348
353
  const { message } = await this.commands.typedCall('Initialize', 'Features', payload);
package/src/inject.ts CHANGED
@@ -198,6 +198,20 @@ export const inject = ({
198
198
  call({ ...params, connectId, deviceId, method: 'xrpGetAddress' }),
199
199
  xrpSignTransaction: (connectId, deviceId, params) =>
200
200
  call({ ...params, connectId, deviceId, method: 'xrpSignTransaction' }),
201
+
202
+ suiGetAddress: (connectId, deviceId, params) =>
203
+ call({ ...params, connectId, deviceId, method: 'suiGetAddress' }),
204
+ suiGetPublicKey: (connectId, deviceId, params) =>
205
+ call({ ...params, connectId, deviceId, method: 'suiGetPublicKey' }),
206
+ suiSignTransaction: (connectId, deviceId, params) =>
207
+ call({ ...params, connectId, deviceId, method: 'suiSignTransaction' }),
208
+
209
+ cardanoGetAddress: (connectId, deviceId, params) =>
210
+ call({ ...params, connectId, deviceId, method: 'cardanoGetAddress' }),
211
+ cardanoGetPublicKey: (connectId, deviceId, params) =>
212
+ call({ ...params, connectId, deviceId, method: 'cardanoGetPublicKey' }),
213
+ cardanoSignTransaction: (connectId, deviceId, params) =>
214
+ call({ ...params, connectId, deviceId, method: 'cardanoSignTransaction' }),
201
215
  };
202
216
  return api;
203
217
  };
@@ -0,0 +1,186 @@
1
+ import type { PROTO } from '../../constants';
2
+
3
+ export interface CardanoAddressParameters {
4
+ addressType: PROTO.CardanoAddressType;
5
+ path?: string | number[];
6
+ stakingPath?: string | number[];
7
+ stakingKeyHash?: string;
8
+ certificatePointer?: CardanoCertificatePointer;
9
+ paymentScriptHash?: string;
10
+ stakingScriptHash?: string;
11
+ }
12
+
13
+ export interface CardanoCertificatePointer {
14
+ blockIndex: number;
15
+ txIndex: number;
16
+ certificateIndex: number;
17
+ }
18
+
19
+ export interface CardanoToken {
20
+ assetNameBytes: string;
21
+ amount?: string;
22
+ mintAmount?: string;
23
+ }
24
+
25
+ export interface CardanoAssetGroup {
26
+ policyId: string;
27
+ tokenAmounts: CardanoToken[];
28
+ }
29
+
30
+ export type AssetGroupWithTokens = {
31
+ policyId: string;
32
+ tokens: PROTO.CardanoToken[];
33
+ };
34
+
35
+ export interface CardanoCertificate {
36
+ type: PROTO.CardanoCertificateType;
37
+ path?: string | number[];
38
+ pool?: string;
39
+ poolParameters?: CardanoPoolParameters;
40
+ scriptHash?: string;
41
+ keyHash?: string;
42
+ }
43
+
44
+ export type CertificateWithPoolOwnersAndRelays = {
45
+ certificate: PROTO.CardanoTxCertificate;
46
+ poolOwners: PROTO.CardanoPoolOwner[];
47
+ poolRelays: PROTO.CardanoPoolRelayParameters[];
48
+ };
49
+
50
+ export interface CardanoPoolOwner {
51
+ stakingKeyPath?: string | number[];
52
+ stakingKeyHash?: string;
53
+ }
54
+
55
+ export interface CardanoPoolRelay {
56
+ type: PROTO.CardanoPoolRelayType;
57
+ ipv4Address?: string;
58
+ ipv6Address?: string;
59
+ port?: number;
60
+ hostName?: string;
61
+ }
62
+
63
+ export interface CardanoPoolMetadata {
64
+ url: string;
65
+ hash: string;
66
+ }
67
+
68
+ export interface CardanoPoolMargin {
69
+ numerator: string;
70
+ denominator: string;
71
+ }
72
+
73
+ export interface CardanoPoolParameters {
74
+ poolId: string;
75
+ vrfKeyHash: string;
76
+ pledge: string;
77
+ cost: string;
78
+ margin: CardanoPoolMargin;
79
+ rewardAccount: string;
80
+ owners: CardanoPoolOwner[];
81
+ relays: CardanoPoolRelay[];
82
+ metadata: CardanoPoolMetadata;
83
+ }
84
+
85
+ export interface CardanoInput {
86
+ path?: string | number[];
87
+ prev_hash: string;
88
+ prev_index: number;
89
+ }
90
+
91
+ export type CardanoOutput = (
92
+ | {
93
+ addressParameters: CardanoAddressParameters;
94
+ }
95
+ | {
96
+ address: string;
97
+ }
98
+ ) & {
99
+ amount: string;
100
+ tokenBundle?: CardanoAssetGroup[];
101
+ datumHash?: string;
102
+ // @ts-expect-error
103
+ format?: PROTO.CardanoTxOutputSerializationFormat;
104
+ inlineDatum?: string;
105
+ referenceScript?: string;
106
+ };
107
+
108
+ export interface CardanoWithdrawal {
109
+ path?: string | number[];
110
+ amount: string;
111
+ scriptHash?: string;
112
+ keyHash?: string;
113
+ }
114
+
115
+ export type CardanoMint = CardanoAssetGroup[];
116
+
117
+ export interface CardanoCollateralInput {
118
+ path?: string | number[];
119
+ prev_hash: string;
120
+ prev_index: number;
121
+ }
122
+
123
+ export interface CardanoRequiredSigner {
124
+ keyPath?: string | number[];
125
+ keyHash?: string;
126
+ }
127
+
128
+ export interface CardanoReferenceInput {
129
+ prev_hash: string;
130
+ prev_index: number;
131
+ }
132
+
133
+ export interface CardanoCatalystRegistrationParameters {
134
+ votingPublicKey: string;
135
+ stakingPath: string | number[];
136
+ rewardAddressParameters: CardanoAddressParameters;
137
+ nonce: string;
138
+ }
139
+
140
+ export interface CardanoAuxiliaryData {
141
+ hash?: string;
142
+ catalystRegistrationParameters?: CardanoCatalystRegistrationParameters;
143
+ }
144
+
145
+ export interface CardanoSignTransaction {
146
+ inputs: CardanoInput[];
147
+ outputs: CardanoOutput[];
148
+ fee: string;
149
+ ttl?: string;
150
+ certificates?: CardanoCertificate[];
151
+ withdrawals?: CardanoWithdrawal[];
152
+ validityIntervalStart?: string;
153
+ auxiliaryData?: CardanoAuxiliaryData;
154
+ mint?: CardanoMint;
155
+ scriptDataHash?: string;
156
+ collateralInputs?: CardanoCollateralInput[];
157
+ requiredSigners?: CardanoRequiredSigner[];
158
+ collateralReturn?: CardanoOutput;
159
+ totalCollateral?: string;
160
+ referenceInputs?: CardanoReferenceInput[];
161
+ additionalWitnessRequests?: (string | number[])[];
162
+ protocolMagic: number;
163
+ networkId: number;
164
+ signingMode: PROTO.CardanoTxSigningMode;
165
+ derivationType?: PROTO.CardanoDerivationType;
166
+ includeNetworkId?: boolean;
167
+ }
168
+
169
+ export interface CardanoSignedTxWitness {
170
+ type: PROTO.CardanoTxWitnessType;
171
+ pubKey: string;
172
+ signature: string;
173
+ chainCode?: string;
174
+ }
175
+
176
+ export interface CardanoAuxiliaryDataSupplement {
177
+ type: PROTO.CardanoTxAuxiliaryDataSupplementType;
178
+ auxiliaryDataHash: string;
179
+ catalystSignature?: string;
180
+ }
181
+
182
+ export interface CardanoSignedTxData {
183
+ hash: string;
184
+ witnesses: CardanoSignedTxWitness[];
185
+ auxiliaryDataSupplement?: CardanoAuxiliaryDataSupplement;
186
+ }