@onekeyfe/hd-core 0.2.13 → 0.2.15
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/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 +0 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/index.d.ts +15 -13
- package/dist/index.js +272 -222
- package/dist/inject.d.ts.map +1 -1
- package/dist/types/api/cardano.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +0 -2
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/xrpSignTransaction.d.ts +15 -2
- package/dist/types/api/xrpSignTransaction.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 +2 -2
- package/src/api/cardano/CardanoSignTransaction.ts +7 -2
- package/src/api/cardano/helper/auxiliaryData.ts +0 -4
- package/src/api/cardano/helper/cardanoInputs.ts +2 -0
- package/src/api/cardano/helper/cardanoOutputs.ts +1 -0
- package/src/api/cardano/helper/certificate.ts +2 -0
- package/src/api/cardano/helper/witnesses.ts +2 -0
- package/src/api/device/DeviceUploadResource.ts +1 -3
- package/src/api/index.ts +0 -1
- package/src/data/messages/messages.json +368 -281
- package/src/data-manager/DataManager.ts +5 -1
- package/src/inject.ts +0 -2
- package/src/types/api/cardano.ts +1 -0
- package/src/types/api/index.ts +0 -2
- package/src/types/api/nearGetAddress.ts +2 -2
- package/src/types/api/xrpSignTransaction.ts +16 -2
- package/dist/api/cardano/CardanoSignMessage.d.ts +0 -14
- package/dist/api/cardano/CardanoSignMessage.d.ts.map +0 -1
- package/dist/types/api/cardanoSignMessage.d.ts +0 -16
- package/dist/types/api/cardanoSignMessage.d.ts.map +0 -1
- package/src/api/cardano/CardanoSignMessage.ts +0 -58
- package/src/types/api/cardanoSignMessage.ts +0 -22
|
@@ -177,7 +177,11 @@ export default class DataManager {
|
|
|
177
177
|
this.settings = settings;
|
|
178
178
|
try {
|
|
179
179
|
const { data } = await axios.get<RemoteConfigResponse>(
|
|
180
|
-
`https://data.onekey.so/config.json?noCache=${getTimeStamp()}
|
|
180
|
+
`https://data.onekey.so/config.json?noCache=${getTimeStamp()}`,
|
|
181
|
+
// because of iframe timeout is 10000
|
|
182
|
+
{
|
|
183
|
+
timeout: 7000,
|
|
184
|
+
}
|
|
181
185
|
);
|
|
182
186
|
this.deviceMap = {
|
|
183
187
|
classic: data.classic,
|
package/src/inject.ts
CHANGED
|
@@ -212,8 +212,6 @@ export const inject = ({
|
|
|
212
212
|
call({ ...params, connectId, deviceId, method: 'cardanoGetPublicKey' }),
|
|
213
213
|
cardanoSignTransaction: (connectId, deviceId, params) =>
|
|
214
214
|
call({ ...params, connectId, deviceId, method: 'cardanoSignTransaction' }),
|
|
215
|
-
cardanoSignMessage: (connectId, deviceId, params) =>
|
|
216
|
-
call({ ...params, connectId, deviceId, method: 'cardanoSignMessage' }),
|
|
217
215
|
};
|
|
218
216
|
return api;
|
|
219
217
|
};
|
package/src/types/api/cardano.ts
CHANGED
package/src/types/api/index.ts
CHANGED
|
@@ -93,7 +93,6 @@ import { suiSignTransaction } from './suiSignTransaction';
|
|
|
93
93
|
import { cardanoGetAddress } from './cardanoGetAddress';
|
|
94
94
|
import { cardanoGetPublicKey } from './cardanoGetPublicKey';
|
|
95
95
|
import { cardanoSignTransaction } from './cardanoSignTransaction';
|
|
96
|
-
import { cardanoSignMessage } from './cardanoSignMessage';
|
|
97
96
|
|
|
98
97
|
export * from './export';
|
|
99
98
|
|
|
@@ -252,5 +251,4 @@ export type CoreApi = {
|
|
|
252
251
|
cardanoGetAddress: typeof cardanoGetAddress;
|
|
253
252
|
cardanoGetPublicKey: typeof cardanoGetPublicKey;
|
|
254
253
|
cardanoSignTransaction: typeof cardanoSignTransaction;
|
|
255
|
-
cardanoSignMessage: typeof cardanoSignMessage;
|
|
256
254
|
};
|
|
@@ -13,11 +13,11 @@ export type NearGetAddressParams = {
|
|
|
13
13
|
export declare function nearGetAddress(
|
|
14
14
|
connectId: string,
|
|
15
15
|
deviceId: string,
|
|
16
|
-
params: CommonParams & NearGetAddressParams
|
|
16
|
+
params: CommonParams & NearGetAddressParams
|
|
17
17
|
): Response<NearAddress>;
|
|
18
18
|
|
|
19
19
|
export declare function nearGetAddress(
|
|
20
20
|
connectId: string,
|
|
21
21
|
deviceId: string,
|
|
22
|
-
params: CommonParams & { bundle?: NearGetAddressParams[] }
|
|
22
|
+
params: CommonParams & { bundle?: NearGetAddressParams[] }
|
|
23
23
|
): Response<Array<NearAddress>>;
|
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
import type { Messages } from '@onekeyfe/hd-transport';
|
|
2
2
|
import type { CommonParams, Response } from '../params';
|
|
3
3
|
|
|
4
|
+
export type XrpSignTransactionParams = Messages.RippleSignTx;
|
|
5
|
+
|
|
4
6
|
export type XrpSignTransactionResponse = {
|
|
5
7
|
serializedTx: string;
|
|
6
8
|
signature: string;
|
|
7
9
|
};
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
type XrpPayment = {
|
|
12
|
+
amount: string;
|
|
13
|
+
destination: string;
|
|
14
|
+
destinationTag?: number;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
type XrpTransaction = {
|
|
18
|
+
fee: string;
|
|
19
|
+
flags?: number;
|
|
20
|
+
sequence: number;
|
|
21
|
+
maxLedgerVersion?: number; // Proto: "last_ledger_sequence"
|
|
22
|
+
payment: XrpPayment;
|
|
23
|
+
};
|
|
10
24
|
|
|
11
25
|
export declare function xrpSignTransaction(
|
|
12
26
|
connectId: string,
|
|
13
27
|
deviceId: string,
|
|
14
|
-
params: CommonParams &
|
|
28
|
+
params: CommonParams & XrpTransaction
|
|
15
29
|
): Response<XrpSignTransactionResponse>;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { BaseMethod } from '../BaseMethod';
|
|
2
|
-
import { CardanoSignMessageParams } from '../../types/api/cardanoSignMessage';
|
|
3
|
-
export default class CardanoSignMessage extends BaseMethod<CardanoSignMessageParams> {
|
|
4
|
-
hasBundle?: boolean;
|
|
5
|
-
isCheck?: boolean;
|
|
6
|
-
init(): void;
|
|
7
|
-
getVersionRange(): {
|
|
8
|
-
model_mini: {
|
|
9
|
-
min: string;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
run(): Promise<import("packages/hd-transport/dist").CardanoMessageSignature>;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=CardanoSignMessage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CardanoSignMessage.d.ts","sourceRoot":"","sources":["../../../src/api/cardano/CardanoSignMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAE9E,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,UAAU,CAAC,wBAAwB,CAAC;IAClF,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,IAAI;IAyBJ,eAAe;;;;;IAWT,GAAG;CASV"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { CardanoMessageSignature } from '@onekeyfe/hd-transport';
|
|
2
|
-
import type { CommonParams, Response } from '../params';
|
|
3
|
-
export declare type CardanoSignMessageParams = {
|
|
4
|
-
address_n: number[];
|
|
5
|
-
message: string;
|
|
6
|
-
derivation_type: number;
|
|
7
|
-
network_id: number;
|
|
8
|
-
};
|
|
9
|
-
export declare type CardanoSignMessageMethodParams = {
|
|
10
|
-
path: string;
|
|
11
|
-
message: string;
|
|
12
|
-
derivationType: number;
|
|
13
|
-
networkId: number;
|
|
14
|
-
};
|
|
15
|
-
export declare function cardanoSignMessage(connectId: string, deviceId: string, params: CommonParams & CardanoSignMessageMethodParams): Response<CardanoMessageSignature>;
|
|
16
|
-
//# sourceMappingURL=cardanoSignMessage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cardanoSignMessage.d.ts","sourceRoot":"","sources":["../../../src/types/api/cardanoSignMessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,oBAAY,wBAAwB,GAAG;IACrC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,oBAAY,8BAA8B,GAAG;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,YAAY,GAAG,8BAA8B,GACpD,QAAQ,CAAC,uBAAuB,CAAC,CAAC"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { BaseMethod } from '../BaseMethod';
|
|
2
|
-
import { PROTO } from '../../constants';
|
|
3
|
-
import { UI_REQUEST } from '../../constants/ui-request';
|
|
4
|
-
import { validateParams } from '../helpers/paramsValidator';
|
|
5
|
-
import { validatePath } from '../helpers/pathUtils';
|
|
6
|
-
import { CardanoSignMessageParams } from '../../types/api/cardanoSignMessage';
|
|
7
|
-
|
|
8
|
-
export default class CardanoSignMessage extends BaseMethod<CardanoSignMessageParams> {
|
|
9
|
-
hasBundle?: boolean;
|
|
10
|
-
|
|
11
|
-
isCheck?: boolean;
|
|
12
|
-
|
|
13
|
-
init() {
|
|
14
|
-
this.checkDeviceId = true;
|
|
15
|
-
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
16
|
-
|
|
17
|
-
const { payload } = this;
|
|
18
|
-
validateParams(payload, [
|
|
19
|
-
{ name: 'path', type: 'string', required: true },
|
|
20
|
-
{ name: 'message', type: 'string', required: true },
|
|
21
|
-
{ name: 'derivationType', type: 'number' },
|
|
22
|
-
{ name: 'networkId', type: 'number', required: true },
|
|
23
|
-
]);
|
|
24
|
-
|
|
25
|
-
const addressN = validatePath(payload.path, 3);
|
|
26
|
-
|
|
27
|
-
this.params = {
|
|
28
|
-
address_n: addressN,
|
|
29
|
-
message: payload.message,
|
|
30
|
-
derivation_type:
|
|
31
|
-
typeof payload.derivationType !== 'undefined'
|
|
32
|
-
? payload.derivationType
|
|
33
|
-
: PROTO.CardanoDerivationType.ICARUS,
|
|
34
|
-
network_id: payload.networkId,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
getVersionRange() {
|
|
39
|
-
return {
|
|
40
|
-
model_mini: {
|
|
41
|
-
min: '2.10.0',
|
|
42
|
-
},
|
|
43
|
-
// model_touch: {
|
|
44
|
-
// min: '3.5.0',
|
|
45
|
-
// },
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
async run() {
|
|
50
|
-
const res = await this.device.commands.typedCall(
|
|
51
|
-
'CardanoSignMessage',
|
|
52
|
-
'CardanoMessageSignature',
|
|
53
|
-
this.params
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
return res.message;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { CardanoMessageSignature } from '@onekeyfe/hd-transport';
|
|
2
|
-
import type { CommonParams, Response } from '../params';
|
|
3
|
-
|
|
4
|
-
export type CardanoSignMessageParams = {
|
|
5
|
-
address_n: number[];
|
|
6
|
-
message: string;
|
|
7
|
-
derivation_type: number;
|
|
8
|
-
network_id: number;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export type CardanoSignMessageMethodParams = {
|
|
12
|
-
path: string;
|
|
13
|
-
message: string;
|
|
14
|
-
derivationType: number;
|
|
15
|
-
networkId: number;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export declare function cardanoSignMessage(
|
|
19
|
-
connectId: string,
|
|
20
|
-
deviceId: string,
|
|
21
|
-
params: CommonParams & CardanoSignMessageMethodParams
|
|
22
|
-
): Response<CardanoMessageSignature>;
|