@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.
- package/dist/api/cardano/CardanoSignMessage.d.ts +14 -0
- package/dist/api/cardano/CardanoSignMessage.d.ts.map +1 -0
- package/dist/api/cardano/CardanoSignTransaction.d.ts.map +1 -1
- package/dist/api/cardano/helper/auxiliaryData.d.ts.map +1 -1
- package/dist/api/cardano/helper/cardanoInputs.d.ts.map +1 -1
- package/dist/api/cardano/helper/cardanoOutputs.d.ts.map +1 -1
- package/dist/api/cardano/helper/certificate.d.ts.map +1 -1
- package/dist/api/cardano/helper/witnesses.d.ts.map +1 -1
- package/dist/api/device/DeviceUploadResource.d.ts.map +1 -1
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/index.d.ts +14 -3
- package/dist/index.js +455 -268
- package/dist/inject.d.ts.map +1 -1
- package/dist/types/api/cardano.d.ts.map +1 -1
- package/dist/types/api/cardanoSignMessage.d.ts +16 -0
- package/dist/types/api/cardanoSignMessage.d.ts.map +1 -0
- package/dist/types/api/index.d.ts +2 -0
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/utils/homescreen.d.ts +231 -0
- package/dist/utils/homescreen.d.ts.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/patch.d.ts +1 -1
- package/dist/utils/patch.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/cardano/CardanoGetAddress.ts +1 -1
- package/src/api/cardano/CardanoGetPublicKey.ts +1 -1
- package/src/api/cardano/CardanoSignMessage.ts +58 -0
- package/src/api/cardano/CardanoSignTransaction.ts +2 -7
- package/src/api/cardano/helper/auxiliaryData.ts +4 -0
- package/src/api/cardano/helper/cardanoInputs.ts +0 -2
- package/src/api/cardano/helper/cardanoOutputs.ts +0 -1
- package/src/api/cardano/helper/certificate.ts +0 -2
- package/src/api/cardano/helper/witnesses.ts +0 -2
- package/src/api/device/DeviceUploadResource.ts +3 -1
- package/src/api/index.ts +1 -0
- package/src/data/messages/messages.json +281 -368
- package/src/inject.ts +2 -0
- package/src/types/api/cardano.ts +0 -1
- package/src/types/api/cardanoSignMessage.ts +22 -0
- package/src/types/api/index.ts +2 -0
- package/src/utils/homescreen.ts +237 -0
- 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.
|
|
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
|
-
|
|
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';
|