@onekeyfe/hd-core 0.2.11 → 0.2.13

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 (44) hide show
  1. package/dist/api/cardano/CardanoSignMessage.d.ts +14 -0
  2. package/dist/api/cardano/CardanoSignMessage.d.ts.map +1 -0
  3. package/dist/api/cardano/CardanoSignTransaction.d.ts.map +1 -1
  4. package/dist/api/cardano/helper/auxiliaryData.d.ts.map +1 -1
  5. package/dist/api/cardano/helper/cardanoInputs.d.ts.map +1 -1
  6. package/dist/api/cardano/helper/cardanoOutputs.d.ts.map +1 -1
  7. package/dist/api/cardano/helper/certificate.d.ts.map +1 -1
  8. package/dist/api/cardano/helper/witnesses.d.ts.map +1 -1
  9. package/dist/api/device/DeviceUploadResource.d.ts.map +1 -1
  10. package/dist/api/index.d.ts +1 -0
  11. package/dist/api/index.d.ts.map +1 -1
  12. package/dist/index.d.ts +14 -3
  13. package/dist/index.js +455 -268
  14. package/dist/inject.d.ts.map +1 -1
  15. package/dist/types/api/cardano.d.ts.map +1 -1
  16. package/dist/types/api/cardanoSignMessage.d.ts +16 -0
  17. package/dist/types/api/cardanoSignMessage.d.ts.map +1 -0
  18. package/dist/types/api/index.d.ts +2 -0
  19. package/dist/types/api/index.d.ts.map +1 -1
  20. package/dist/utils/homescreen.d.ts +231 -0
  21. package/dist/utils/homescreen.d.ts.map +1 -0
  22. package/dist/utils/index.d.ts +1 -0
  23. package/dist/utils/index.d.ts.map +1 -1
  24. package/dist/utils/patch.d.ts +1 -1
  25. package/dist/utils/patch.d.ts.map +1 -1
  26. package/package.json +4 -4
  27. package/src/api/cardano/CardanoGetAddress.ts +1 -1
  28. package/src/api/cardano/CardanoGetPublicKey.ts +1 -1
  29. package/src/api/cardano/CardanoSignMessage.ts +58 -0
  30. package/src/api/cardano/CardanoSignTransaction.ts +2 -7
  31. package/src/api/cardano/helper/auxiliaryData.ts +4 -0
  32. package/src/api/cardano/helper/cardanoInputs.ts +0 -2
  33. package/src/api/cardano/helper/cardanoOutputs.ts +0 -1
  34. package/src/api/cardano/helper/certificate.ts +0 -2
  35. package/src/api/cardano/helper/witnesses.ts +0 -2
  36. package/src/api/device/DeviceUploadResource.ts +3 -1
  37. package/src/api/index.ts +1 -0
  38. package/src/data/messages/messages.json +281 -368
  39. package/src/inject.ts +2 -0
  40. package/src/types/api/cardano.ts +0 -1
  41. package/src/types/api/cardanoSignMessage.ts +22 -0
  42. package/src/types/api/index.ts +2 -0
  43. package/src/utils/homescreen.ts +237 -0
  44. package/src/utils/index.ts +2 -0
@@ -115,7 +115,6 @@ export default class CardanoSignTransaction extends BaseMethod<any> {
115
115
  collateralInputsWithPath = payload.collateralInputs.map(transformCollateralInput);
116
116
  }
117
117
 
118
- // @ts-expect-error
119
118
  let requiredSigners: PROTO.CardanoTxRequiredSigner[] = [];
120
119
  if (payload.requiredSigners) {
121
120
  requiredSigners = payload.requiredSigners.map((requiredSigner: any) => {
@@ -123,7 +122,6 @@ export default class CardanoSignTransaction extends BaseMethod<any> {
123
122
  return {
124
123
  key_path: requiredSigner.keyPath ? validatePath(requiredSigner.keyPath, 3) : undefined,
125
124
  key_hash: requiredSigner.keyHash,
126
- // @ts-expect-error
127
125
  } as PROTO.CardanoTxRequiredSigner;
128
126
  });
129
127
  }
@@ -132,7 +130,6 @@ export default class CardanoSignTransaction extends BaseMethod<any> {
132
130
  ? transformOutput(payload.collateralReturn)
133
131
  : undefined;
134
132
 
135
- // @ts-expect-error
136
133
  let referenceInputs: PROTO.CardanoTxReferenceInput[] = [];
137
134
  if (payload.referenceInputs) {
138
135
  referenceInputs = payload.referenceInputs.map(transformReferenceInput);
@@ -170,7 +167,7 @@ export default class CardanoSignTransaction extends BaseMethod<any> {
170
167
  derivationType:
171
168
  typeof payload.derivationType !== 'undefined'
172
169
  ? payload.derivationType
173
- : PROTO.CardanoDerivationType.ICARUS_TREZOR,
170
+ : PROTO.CardanoDerivationType.ICARUS,
174
171
  includeNetworkId: payload.includeNetworkId,
175
172
  };
176
173
  }
@@ -251,6 +248,7 @@ export default class CardanoSignTransaction extends BaseMethod<any> {
251
248
  type: auxiliaryDataType,
252
249
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
253
250
  auxiliaryDataHash: message.auxiliary_data_hash!,
251
+ // @ts-expect-error
254
252
  catalystSignature: message.catalyst_signature,
255
253
  };
256
254
  }
@@ -273,12 +271,10 @@ export default class CardanoSignTransaction extends BaseMethod<any> {
273
271
  }
274
272
  // collateral inputs
275
273
  for (const { collateralInput } of this.params.collateralInputsWithPath) {
276
- // @ts-expect-error
277
274
  await typedCall('CardanoTxCollateralInput', 'CardanoTxItemAck', collateralInput);
278
275
  }
279
276
  // required signers
280
277
  for (const requiredSigner of this.params.requiredSigners) {
281
- // @ts-expect-error
282
278
  await typedCall('CardanoTxRequiredSigner', 'CardanoTxItemAck', requiredSigner);
283
279
  }
284
280
  // collateral return
@@ -287,7 +283,6 @@ export default class CardanoSignTransaction extends BaseMethod<any> {
287
283
  }
288
284
  // reference inputs
289
285
  for (const referenceInput of this.params.referenceInputs) {
290
- // @ts-expect-error
291
286
  await typedCall('CardanoTxReferenceInput', 'CardanoTxItemAck', referenceInput);
292
287
  }
293
288
  // witnesses
@@ -13,6 +13,7 @@ import { PROTO } from '../../../constants';
13
13
 
14
14
  const transformCatalystRegistrationParameters = (
15
15
  catalystRegistrationParameters: CardanoCatalystRegistrationParameters
16
+ // @ts-expect-error
16
17
  ): PROTO.CardanoCatalystRegistrationParametersType => {
17
18
  validateParams(catalystRegistrationParameters, [
18
19
  { name: 'votingPublicKey', type: 'string', required: true },
@@ -50,6 +51,7 @@ export const transformAuxiliaryData = (
50
51
 
51
52
  return {
52
53
  hash: auxiliaryData.hash,
54
+ // @ts-expect-error
53
55
  catalyst_registration_parameters: catalystRegistrationParameters,
54
56
  };
55
57
  };
@@ -57,6 +59,7 @@ export const transformAuxiliaryData = (
57
59
  export const modifyAuxiliaryDataForBackwardsCompatibility = (
58
60
  auxiliary_data: PROTO.CardanoTxAuxiliaryData
59
61
  ): PROTO.CardanoTxAuxiliaryData => {
62
+ // @ts-expect-error
60
63
  const { catalyst_registration_parameters } = auxiliary_data;
61
64
  if (catalyst_registration_parameters) {
62
65
  catalyst_registration_parameters.reward_address_parameters =
@@ -66,6 +69,7 @@ export const modifyAuxiliaryDataForBackwardsCompatibility = (
66
69
 
67
70
  return {
68
71
  ...auxiliary_data,
72
+ // @ts-expect-error
69
73
  catalyst_registration_parameters,
70
74
  };
71
75
  }
@@ -10,7 +10,6 @@ export type InputWithPath = {
10
10
  };
11
11
 
12
12
  export type CollateralInputWithPath = {
13
- // @ts-expect-error
14
13
  collateralInput: PROTO.CardanoTxCollateralInput;
15
14
  path?: Path;
16
15
  };
@@ -43,7 +42,6 @@ export const transformCollateralInput = (collateralInput: any): CollateralInputW
43
42
  };
44
43
  };
45
44
 
46
- // @ts-expect-error
47
45
  export const transformReferenceInput = (referenceInput: any): PROTO.CardanoTxReferenceInput => {
48
46
  validateParams(referenceInput, [
49
47
  { name: 'prev_hash', type: 'string', required: true },
@@ -27,7 +27,6 @@ export const transformOutput = (output: any): OutputWithData => {
27
27
  output: {
28
28
  amount: output.amount,
29
29
  asset_groups_count: 0,
30
- // @ts-expect-error
31
30
  datum_hash: output.datumHash,
32
31
  format: output.format,
33
32
  inline_datum_size: output.inlineDatum ? hexStringByteLength(output.inlineDatum) : undefined,
@@ -130,7 +130,6 @@ const transformPoolParameters = (
130
130
  validatePoolParameters(poolParameters);
131
131
 
132
132
  return {
133
- // @ts-expect-error
134
133
  poolParameters: {
135
134
  pool_id: poolParameters.poolId,
136
135
  vrf_key_hash: poolParameters.vrfKeyHash,
@@ -188,7 +187,6 @@ export const transformCertificate = (
188
187
  type: certificate.type,
189
188
  path: certificate.path ? validatePath(certificate.path, 5) : undefined,
190
189
  script_hash: certificate.scriptHash,
191
- // @ts-expect-error
192
190
  key_hash: certificate.keyHash,
193
191
  pool: certificate.pool,
194
192
  pool_parameters: poolParameters,
@@ -7,7 +7,6 @@ export const gatherWitnessPaths = (
7
7
  certificatesWithPoolOwnersAndRelays: CertificateWithPoolOwnersAndRelays[],
8
8
  withdrawals: PROTO.CardanoTxWithdrawal[],
9
9
  collateralInputsWithPath: CollateralInputWithPath[],
10
- // @ts-expect-error
11
10
  requiredSigners: PROTO.CardanoTxRequiredSigner[],
12
11
  additionalWitnessRequests: Path[],
13
12
  signingMode: PROTO.CardanoTxSigningMode
@@ -43,7 +42,6 @@ export const gatherWitnessPaths = (
43
42
  }
44
43
 
45
44
  // gather Plutus-related paths
46
- // @ts-expect-error
47
45
  if (signingMode === PROTO.CardanoTxSigningMode.PLUTUS_TRANSACTION) {
48
46
  collateralInputsWithPath.forEach(({ path }) => {
49
47
  if (path) _insert(path);
@@ -32,6 +32,7 @@ export default class DeviceUploadResource extends BaseMethod<ResourceUpload> {
32
32
  { name: 'thumbnailDataHex', type: 'string', required: true },
33
33
  { name: 'resType', type: 'number', required: true },
34
34
  { name: 'nftMetaData', type: 'string' },
35
+ { name: 'file_name_no_ext', type: 'boolean' },
35
36
  ]);
36
37
 
37
38
  const { suffix, dataHex, thumbnailDataHex, resType, nftMetaData } = this
@@ -48,7 +49,8 @@ export default class DeviceUploadResource extends BaseMethod<ResourceUpload> {
48
49
  data_length: this.paramsData.data.byteLength,
49
50
  zoom_data_length: this.paramsData.thumbnailData.byteLength,
50
51
  res_type: resType,
51
- nft_meta_data: nftMetaData,
52
+ nft_metadata: nftMetaData,
53
+ file_name_no_ext: this.payload.file_name_no_ext,
52
54
  };
53
55
  }
54
56
 
package/src/api/index.ts CHANGED
@@ -89,3 +89,4 @@ export { default as suiSignTransaction } from './sui/SuiSignTransaction';
89
89
  export { default as cardanoGetAddress } from './cardano/CardanoGetAddress';
90
90
  export { default as cardanoGetPublicKey } from './cardano/CardanoGetPublicKey';
91
91
  export { default as cardanoSignTransaction } from './cardano/CardanoSignTransaction';
92
+ export { default as cardanoSignMessage } from './cardano/CardanoSignMessage';