@onekeyfe/hd-core 0.1.58 → 0.2.0
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/FirmwareUpdateV2.d.ts +1 -0
- package/dist/api/FirmwareUpdateV2.d.ts.map +1 -1
- package/dist/api/algo/AlgoGetAddress.d.ts +14 -0
- package/dist/api/algo/AlgoGetAddress.d.ts.map +1 -0
- package/dist/api/algo/AlgoSignTransaction.d.ts +16 -0
- package/dist/api/algo/AlgoSignTransaction.d.ts.map +1 -0
- package/dist/api/aptos/AptosSignMessage.d.ts +13 -0
- package/dist/api/aptos/AptosSignMessage.d.ts.map +1 -0
- package/dist/api/cosmos/CosmosGetAddress.d.ts +14 -0
- package/dist/api/cosmos/CosmosGetAddress.d.ts.map +1 -0
- package/dist/api/cosmos/CosmosSignTransaction.d.ts +16 -0
- package/dist/api/cosmos/CosmosSignTransaction.d.ts.map +1 -0
- package/dist/api/index.d.ts +5 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +1 -1
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/index.d.ts +69 -4
- package/dist/index.js +453 -7
- package/dist/inject.d.ts.map +1 -1
- package/dist/types/api/algoGetAddress.d.ts +14 -0
- package/dist/types/api/algoGetAddress.d.ts.map +1 -0
- package/dist/types/api/algoSignTransaction.d.ts +11 -0
- package/dist/types/api/algoSignTransaction.d.ts.map +1 -0
- package/dist/types/api/aptosSignMessage.d.ts +20 -0
- package/dist/types/api/aptosSignMessage.d.ts.map +1 -0
- package/dist/types/api/cosmosGetAddress.d.ts +14 -0
- package/dist/types/api/cosmosGetAddress.d.ts.map +1 -0
- package/dist/types/api/cosmosSignTransaction.d.ts +11 -0
- package/dist/types/api/cosmosSignTransaction.d.ts.map +1 -0
- package/dist/types/api/export.d.ts +5 -0
- package/dist/types/api/export.d.ts.map +1 -1
- package/dist/types/api/firmwareUpdate.d.ts +1 -0
- package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +10 -0
- package/dist/types/api/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/FirmwareUpdateV2.ts +7 -2
- package/src/api/algo/AlgoGetAddress.ts +68 -0
- package/src/api/algo/AlgoSignTransaction.ts +51 -0
- package/src/api/aptos/AptosSignMessage.ts +78 -0
- package/src/api/cosmos/CosmosGetAddress.ts +68 -0
- package/src/api/cosmos/CosmosSignTransaction.ts +51 -0
- package/src/api/index.ts +7 -0
- package/src/core/index.ts +24 -3
- package/src/data/messages/messages.json +173 -0
- package/src/data-manager/DataManager.ts +5 -3
- package/src/inject.ts +12 -0
- package/src/types/api/algoGetAddress.ts +23 -0
- package/src/types/api/algoSignTransaction.ts +17 -0
- package/src/types/api/aptosSignMessage.ts +26 -0
- package/src/types/api/aptosSignTransaction.ts +1 -1
- package/src/types/api/cosmosGetAddress.ts +23 -0
- package/src/types/api/cosmosSignTransaction.ts +17 -0
- package/src/types/api/export.ts +7 -0
- package/src/types/api/firmwareUpdate.ts +1 -0
- package/src/types/api/index.ts +20 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { CosmosSignTx as HardwareCosmosSignTx } from '@onekeyfe/hd-transport';
|
|
2
|
+
import { serializedPath, validatePath } from '../helpers/pathUtils';
|
|
3
|
+
import { BaseMethod } from '../BaseMethod';
|
|
4
|
+
import { validateParams } from '../helpers/paramsValidator';
|
|
5
|
+
import { CosmosSignTransactionParams } from '../../types';
|
|
6
|
+
import { formatAnyHex } from '../helpers/hexUtils';
|
|
7
|
+
|
|
8
|
+
export default class CosmosSignTransaction extends BaseMethod<HardwareCosmosSignTx> {
|
|
9
|
+
hasBundle = false;
|
|
10
|
+
|
|
11
|
+
init() {
|
|
12
|
+
this.checkDeviceId = true;
|
|
13
|
+
this.allowDeviceMode = [...this.allowDeviceMode];
|
|
14
|
+
|
|
15
|
+
// check payload
|
|
16
|
+
validateParams(this.payload, [
|
|
17
|
+
{ name: 'path', required: true },
|
|
18
|
+
{ name: 'rawTx', type: 'hexString', required: true },
|
|
19
|
+
]);
|
|
20
|
+
|
|
21
|
+
// init params
|
|
22
|
+
const { path, rawTx } = this.payload as CosmosSignTransactionParams;
|
|
23
|
+
const addressN = validatePath(path, 3);
|
|
24
|
+
|
|
25
|
+
this.params = {
|
|
26
|
+
address_n: addressN,
|
|
27
|
+
raw_tx: formatAnyHex(rawTx),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
getVersionRange() {
|
|
32
|
+
return {
|
|
33
|
+
model_mini: {
|
|
34
|
+
min: '2.6.0',
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async run() {
|
|
40
|
+
const res = await this.device.commands.typedCall('CosmosSignTx', 'CosmosSignedTx', {
|
|
41
|
+
...this.params,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const { signature } = res.message;
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
path: serializedPath(this.params.address_n),
|
|
48
|
+
signature,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
package/src/api/index.ts
CHANGED
|
@@ -68,3 +68,10 @@ export { default as nearSignTransaction } from './near/NearSignTransaction';
|
|
|
68
68
|
export { default as aptosGetAddress } from './aptos/AptosGetAddress';
|
|
69
69
|
export { default as aptosGetPublicKey } from './aptos/AptosGetPublicKey';
|
|
70
70
|
export { default as aptosSignTransaction } from './aptos/AptosSignTransaction';
|
|
71
|
+
export { default as aptosSignMessage } from './aptos/AptosSignMessage';
|
|
72
|
+
|
|
73
|
+
export { default as algoGetAddress } from './algo/AlgoGetAddress';
|
|
74
|
+
export { default as algoSignTransaction } from './algo/AlgoSignTransaction';
|
|
75
|
+
|
|
76
|
+
export { default as cosmosGetAddress } from './cosmos/CosmosGetAddress';
|
|
77
|
+
export { default as cosmosSignTransaction } from './cosmos/CosmosSignTransaction';
|
package/src/core/index.ts
CHANGED
|
@@ -19,7 +19,7 @@ import { DeviceList } from '../device/DeviceList';
|
|
|
19
19
|
import { DevicePool } from '../device/DevicePool';
|
|
20
20
|
import { findMethod } from '../api/utils';
|
|
21
21
|
import { DataManager } from '../data-manager';
|
|
22
|
-
import { enableLog, getLogger, LoggerNames, setLoggerPostMessage } from '../utils';
|
|
22
|
+
import { enableLog, getLogger, LoggerNames, setLoggerPostMessage, wait } from '../utils';
|
|
23
23
|
import {
|
|
24
24
|
CoreMessage,
|
|
25
25
|
createResponseMessage,
|
|
@@ -387,6 +387,26 @@ function initDeviceForBle(method: BaseMethod) {
|
|
|
387
387
|
return device;
|
|
388
388
|
}
|
|
389
389
|
|
|
390
|
+
/**
|
|
391
|
+
* If the Bluetooth connection times out, retry 6 times
|
|
392
|
+
*/
|
|
393
|
+
let bleTimeoutRetry = 0;
|
|
394
|
+
async function connectDeviceForBle(method: BaseMethod, device: Device) {
|
|
395
|
+
try {
|
|
396
|
+
await device.acquire();
|
|
397
|
+
await device.initialize(parseInitOptions(method));
|
|
398
|
+
} catch (err) {
|
|
399
|
+
if (err.errorCode === HardwareErrorCode.BleTimeoutError && bleTimeoutRetry <= 5) {
|
|
400
|
+
bleTimeoutRetry += 1;
|
|
401
|
+
Log.debug(`Bletooth connect timeout and will retry, retry count: ${bleTimeoutRetry}`);
|
|
402
|
+
await wait(3000);
|
|
403
|
+
await connectDeviceForBle(method, device);
|
|
404
|
+
} else {
|
|
405
|
+
throw err;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
|
|
390
410
|
type IPollFn<T> = (time?: number) => T;
|
|
391
411
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
392
412
|
const ensureConnected = async (method: BaseMethod, pollingId: number) => {
|
|
@@ -455,8 +475,8 @@ const ensureConnected = async (method: BaseMethod, pollingId: number) => {
|
|
|
455
475
|
* Bluetooth should call initialize here
|
|
456
476
|
*/
|
|
457
477
|
if (env === 'react-native') {
|
|
458
|
-
|
|
459
|
-
await
|
|
478
|
+
bleTimeoutRetry = 0;
|
|
479
|
+
await connectDeviceForBle(method, device);
|
|
460
480
|
}
|
|
461
481
|
resolve(device);
|
|
462
482
|
return;
|
|
@@ -470,6 +490,7 @@ const ensureConnected = async (method: BaseMethod, pollingId: number) => {
|
|
|
470
490
|
HardwareErrorCode.BleLocationServicesDisabled,
|
|
471
491
|
HardwareErrorCode.BleDeviceNotBonded,
|
|
472
492
|
HardwareErrorCode.BleCharacteristicNotifyError,
|
|
493
|
+
HardwareErrorCode.BleTimeoutError,
|
|
473
494
|
HardwareErrorCode.BleWriteCharacteristicError,
|
|
474
495
|
HardwareErrorCode.BleAlreadyConnected,
|
|
475
496
|
HardwareErrorCode.FirmwareUpdateLimitOneDevice,
|
|
@@ -1,5 +1,55 @@
|
|
|
1
1
|
{
|
|
2
2
|
"nested": {
|
|
3
|
+
"AlgorandGetAddress": {
|
|
4
|
+
"fields": {
|
|
5
|
+
"address_n": {
|
|
6
|
+
"rule": "repeated",
|
|
7
|
+
"type": "uint32",
|
|
8
|
+
"id": 1,
|
|
9
|
+
"options": {
|
|
10
|
+
"packed": false
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"show_display": {
|
|
14
|
+
"type": "bool",
|
|
15
|
+
"id": 3
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"AlgorandAddress": {
|
|
20
|
+
"fields": {
|
|
21
|
+
"address": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"id": 1
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"AlgorandSignTx": {
|
|
28
|
+
"fields": {
|
|
29
|
+
"address_n": {
|
|
30
|
+
"rule": "repeated",
|
|
31
|
+
"type": "uint32",
|
|
32
|
+
"id": 1,
|
|
33
|
+
"options": {
|
|
34
|
+
"packed": false
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"raw_tx": {
|
|
38
|
+
"rule": "required",
|
|
39
|
+
"type": "bytes",
|
|
40
|
+
"id": 2
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"AlgorandSignedTx": {
|
|
45
|
+
"fields": {
|
|
46
|
+
"signature": {
|
|
47
|
+
"rule": "required",
|
|
48
|
+
"type": "bytes",
|
|
49
|
+
"id": 1
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
3
53
|
"AptosGetAddress": {
|
|
4
54
|
"fields": {
|
|
5
55
|
"address_n": {
|
|
@@ -55,6 +105,65 @@
|
|
|
55
105
|
}
|
|
56
106
|
}
|
|
57
107
|
},
|
|
108
|
+
"AptosSignMessage": {
|
|
109
|
+
"fields": {
|
|
110
|
+
"address_n": {
|
|
111
|
+
"rule": "repeated",
|
|
112
|
+
"type": "uint32",
|
|
113
|
+
"id": 1,
|
|
114
|
+
"options": {
|
|
115
|
+
"packed": false
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"payload": {
|
|
119
|
+
"rule": "required",
|
|
120
|
+
"type": "AptosMessagePayload",
|
|
121
|
+
"id": 2
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"nested": {
|
|
125
|
+
"AptosMessagePayload": {
|
|
126
|
+
"fields": {
|
|
127
|
+
"address": {
|
|
128
|
+
"type": "string",
|
|
129
|
+
"id": 2
|
|
130
|
+
},
|
|
131
|
+
"chain_id": {
|
|
132
|
+
"type": "string",
|
|
133
|
+
"id": 3
|
|
134
|
+
},
|
|
135
|
+
"application": {
|
|
136
|
+
"type": "string",
|
|
137
|
+
"id": 4
|
|
138
|
+
},
|
|
139
|
+
"nonce": {
|
|
140
|
+
"rule": "required",
|
|
141
|
+
"type": "string",
|
|
142
|
+
"id": 5
|
|
143
|
+
},
|
|
144
|
+
"message": {
|
|
145
|
+
"rule": "required",
|
|
146
|
+
"type": "string",
|
|
147
|
+
"id": 6
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"AptosMessageSignature": {
|
|
154
|
+
"fields": {
|
|
155
|
+
"signature": {
|
|
156
|
+
"rule": "required",
|
|
157
|
+
"type": "bytes",
|
|
158
|
+
"id": 1
|
|
159
|
+
},
|
|
160
|
+
"address": {
|
|
161
|
+
"rule": "required",
|
|
162
|
+
"type": "string",
|
|
163
|
+
"id": 2
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
},
|
|
58
167
|
"BinanceGetAddress": {
|
|
59
168
|
"fields": {
|
|
60
169
|
"address_n": {
|
|
@@ -2827,6 +2936,60 @@
|
|
|
2827
2936
|
}
|
|
2828
2937
|
}
|
|
2829
2938
|
},
|
|
2939
|
+
"CosmosGetAddress": {
|
|
2940
|
+
"fields": {
|
|
2941
|
+
"address_n": {
|
|
2942
|
+
"rule": "repeated",
|
|
2943
|
+
"type": "uint32",
|
|
2944
|
+
"id": 1,
|
|
2945
|
+
"options": {
|
|
2946
|
+
"packed": false
|
|
2947
|
+
}
|
|
2948
|
+
},
|
|
2949
|
+
"hrp": {
|
|
2950
|
+
"type": "string",
|
|
2951
|
+
"id": 2
|
|
2952
|
+
},
|
|
2953
|
+
"show_display": {
|
|
2954
|
+
"type": "bool",
|
|
2955
|
+
"id": 3
|
|
2956
|
+
}
|
|
2957
|
+
}
|
|
2958
|
+
},
|
|
2959
|
+
"CosmosAddress": {
|
|
2960
|
+
"fields": {
|
|
2961
|
+
"address": {
|
|
2962
|
+
"type": "string",
|
|
2963
|
+
"id": 1
|
|
2964
|
+
}
|
|
2965
|
+
}
|
|
2966
|
+
},
|
|
2967
|
+
"CosmosSignTx": {
|
|
2968
|
+
"fields": {
|
|
2969
|
+
"address_n": {
|
|
2970
|
+
"rule": "repeated",
|
|
2971
|
+
"type": "uint32",
|
|
2972
|
+
"id": 1,
|
|
2973
|
+
"options": {
|
|
2974
|
+
"packed": false
|
|
2975
|
+
}
|
|
2976
|
+
},
|
|
2977
|
+
"raw_tx": {
|
|
2978
|
+
"rule": "required",
|
|
2979
|
+
"type": "bytes",
|
|
2980
|
+
"id": 2
|
|
2981
|
+
}
|
|
2982
|
+
}
|
|
2983
|
+
},
|
|
2984
|
+
"CosmosSignedTx": {
|
|
2985
|
+
"fields": {
|
|
2986
|
+
"signature": {
|
|
2987
|
+
"rule": "required",
|
|
2988
|
+
"type": "bytes",
|
|
2989
|
+
"id": 1
|
|
2990
|
+
}
|
|
2991
|
+
}
|
|
2992
|
+
},
|
|
2830
2993
|
"CipherKeyValue": {
|
|
2831
2994
|
"fields": {
|
|
2832
2995
|
"address_n": {
|
|
@@ -8508,6 +8671,8 @@
|
|
|
8508
8671
|
"MessageType_AptosAddress": 10601,
|
|
8509
8672
|
"MessageType_AptosSignTx": 10602,
|
|
8510
8673
|
"MessageType_AptosSignedTx": 10603,
|
|
8674
|
+
"MessageType_AptosSignMessage": 10604,
|
|
8675
|
+
"MessageType_AptosMessageSignature": 10605,
|
|
8511
8676
|
"MessageType_WebAuthnListResidentCredentials": 800,
|
|
8512
8677
|
"MessageType_WebAuthnCredentials": 801,
|
|
8513
8678
|
"MessageType_WebAuthnAddResidentCredential": 802,
|
|
@@ -8548,6 +8713,14 @@
|
|
|
8548
8713
|
"MessageType_NearAddress": 10702,
|
|
8549
8714
|
"MessageType_NearSignTx": 10703,
|
|
8550
8715
|
"MessageType_NearSignedTx": 10704,
|
|
8716
|
+
"MessageType_CosmosGetAddress": 10800,
|
|
8717
|
+
"MessageType_CosmosAddress": 10801,
|
|
8718
|
+
"MessageType_CosmosSignTx": 10802,
|
|
8719
|
+
"MessageType_CosmosSignedTx": 10803,
|
|
8720
|
+
"MessageType_AlgorandGetAddress": 10900,
|
|
8721
|
+
"MessageType_AlgorandAddress": 10901,
|
|
8722
|
+
"MessageType_AlgorandSignTx": 10902,
|
|
8723
|
+
"MessageType_AlgorandSignedTx": 10903,
|
|
8551
8724
|
"MessageType_DeviceBackToBoot": 903,
|
|
8552
8725
|
"MessageType_DeviceInfoSettings": 10001,
|
|
8553
8726
|
"MessageType_GetDeviceInfo": 10002,
|
|
@@ -68,7 +68,7 @@ export default class DataManager {
|
|
|
68
68
|
* Touch、Pro System UI Resource Update
|
|
69
69
|
* ** Interval upgrade is not considered **
|
|
70
70
|
*/
|
|
71
|
-
static getSysResourcesLatestRelease = (features: Features) => {
|
|
71
|
+
static getSysResourcesLatestRelease = (features: Features, forcedUpdateRes?: boolean) => {
|
|
72
72
|
const deviceType = getDeviceType(features);
|
|
73
73
|
const deviceFirmwareVersion = getDeviceFirmwareVersion(features);
|
|
74
74
|
|
|
@@ -76,8 +76,10 @@ export default class DataManager {
|
|
|
76
76
|
|
|
77
77
|
const targetDeviceConfigList = this.deviceMap[deviceType]?.firmware ?? [];
|
|
78
78
|
const currentVersion = deviceFirmwareVersion.join('.');
|
|
79
|
-
const targetDeviceConfig = targetDeviceConfigList.filter(
|
|
80
|
-
|
|
79
|
+
const targetDeviceConfig = targetDeviceConfigList.filter(item =>
|
|
80
|
+
forcedUpdateRes
|
|
81
|
+
? !!item.resource
|
|
82
|
+
: semver.gt(item.version.join('.'), currentVersion) && !!item.resource
|
|
81
83
|
);
|
|
82
84
|
|
|
83
85
|
return findLatestRelease(targetDeviceConfig)?.resource;
|
package/src/inject.ts
CHANGED
|
@@ -175,8 +175,20 @@ export const inject = ({
|
|
|
175
175
|
call({ ...params, connectId, deviceId, method: 'aptosGetAddress' }),
|
|
176
176
|
aptosGetPublicKey: (connectId, deviceId, params) =>
|
|
177
177
|
call({ ...params, connectId, deviceId, method: 'aptosGetPublicKey' }),
|
|
178
|
+
aptosSignMessage: (connectId, deviceId, params) =>
|
|
179
|
+
call({ ...params, connectId, deviceId, method: 'aptosSignMessage' }),
|
|
178
180
|
aptosSignTransaction: (connectId, deviceId, params) =>
|
|
179
181
|
call({ ...params, connectId, deviceId, method: 'aptosSignTransaction' }),
|
|
182
|
+
|
|
183
|
+
algoGetAddress: (connectId, deviceId, params) =>
|
|
184
|
+
call({ ...params, connectId, deviceId, method: 'algoGetAddress' }),
|
|
185
|
+
algoSignTransaction: (connectId, deviceId, params) =>
|
|
186
|
+
call({ ...params, connectId, deviceId, method: 'algoSignTransaction' }),
|
|
187
|
+
|
|
188
|
+
cosmosGetAddress: (connectId, deviceId, params) =>
|
|
189
|
+
call({ ...params, connectId, deviceId, method: 'cosmosGetAddress' }),
|
|
190
|
+
cosmosSignTransaction: (connectId, deviceId, params) =>
|
|
191
|
+
call({ ...params, connectId, deviceId, method: 'cosmosSignTransaction' }),
|
|
180
192
|
};
|
|
181
193
|
return api;
|
|
182
194
|
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AlgorandAddress as HardwareAlgoGetAddress } from '@onekeyfe/hd-transport';
|
|
2
|
+
import type { CommonParams, Response } from '../params';
|
|
3
|
+
|
|
4
|
+
export type AlgoAddress = {
|
|
5
|
+
path: string;
|
|
6
|
+
} & HardwareAlgoGetAddress;
|
|
7
|
+
|
|
8
|
+
export type AlgoGetAddressParams = {
|
|
9
|
+
path: string | number[];
|
|
10
|
+
showOnOneKey?: boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export declare function algoGetAddress(
|
|
14
|
+
connectId: string,
|
|
15
|
+
deviceId: string,
|
|
16
|
+
params: CommonParams & AlgoGetAddressParams
|
|
17
|
+
): Response<AlgoAddress>;
|
|
18
|
+
|
|
19
|
+
export declare function algoGetAddress(
|
|
20
|
+
connectId: string,
|
|
21
|
+
deviceId: string,
|
|
22
|
+
params: CommonParams & { bundle?: AlgoGetAddressParams[] }
|
|
23
|
+
): Response<Array<AlgoAddress>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AlgorandSignedTx as HardwareAlgorandSignedTx } from '@onekeyfe/hd-transport';
|
|
2
|
+
import type { CommonParams, Response } from '../params';
|
|
3
|
+
|
|
4
|
+
export type AlgoSignedTx = {
|
|
5
|
+
path: string;
|
|
6
|
+
} & HardwareAlgorandSignedTx;
|
|
7
|
+
|
|
8
|
+
export type AlgoSignTransactionParams = {
|
|
9
|
+
path: string | number[];
|
|
10
|
+
rawTx?: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export declare function algoSignTransaction(
|
|
14
|
+
connectId: string,
|
|
15
|
+
deviceId: string,
|
|
16
|
+
params: CommonParams & AlgoSignTransactionParams
|
|
17
|
+
): Response<AlgoSignedTx>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AptosMessageSignature as HardwareAptosMessageSignature } from '@onekeyfe/hd-transport';
|
|
2
|
+
import type { CommonParams, Response } from '../params';
|
|
3
|
+
|
|
4
|
+
export type AptosMessageSignature = {
|
|
5
|
+
path: string;
|
|
6
|
+
fullMessage: string;
|
|
7
|
+
} & HardwareAptosMessageSignature;
|
|
8
|
+
|
|
9
|
+
declare type AptosMessagePayload = {
|
|
10
|
+
address?: string;
|
|
11
|
+
chainId?: string;
|
|
12
|
+
application?: string;
|
|
13
|
+
nonce: string;
|
|
14
|
+
message: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type AptosSignMessageParams = {
|
|
18
|
+
path: string | number[];
|
|
19
|
+
payload: AptosMessagePayload;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export declare function aptosSignMessage(
|
|
23
|
+
connectId: string,
|
|
24
|
+
deviceId: string,
|
|
25
|
+
params: CommonParams & AptosSignMessageParams
|
|
26
|
+
): Response<AptosMessageSignature>;
|
|
@@ -13,5 +13,5 @@ export type AptosSignTransactionParams = {
|
|
|
13
13
|
export declare function aptosSignTransaction(
|
|
14
14
|
connectId: string,
|
|
15
15
|
deviceId: string,
|
|
16
|
-
params: CommonParams & AptosSignTransactionParams
|
|
16
|
+
params: CommonParams & AptosSignTransactionParams
|
|
17
17
|
): Response<AptosSignedTx>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CosmosAddress as HardwareCosmosAddress } from '@onekeyfe/hd-transport';
|
|
2
|
+
import type { CommonParams, Response } from '../params';
|
|
3
|
+
|
|
4
|
+
export type CosmosAddress = {
|
|
5
|
+
path: string;
|
|
6
|
+
} & HardwareCosmosAddress;
|
|
7
|
+
|
|
8
|
+
export type CosmosGetAddressParams = {
|
|
9
|
+
path: string | number[];
|
|
10
|
+
showOnOneKey?: boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export declare function cosmosGetAddress(
|
|
14
|
+
connectId: string,
|
|
15
|
+
deviceId: string,
|
|
16
|
+
params: CommonParams & CosmosGetAddressParams
|
|
17
|
+
): Response<CosmosAddress>;
|
|
18
|
+
|
|
19
|
+
export declare function cosmosGetAddress(
|
|
20
|
+
connectId: string,
|
|
21
|
+
deviceId: string,
|
|
22
|
+
params: CommonParams & { bundle?: CosmosGetAddressParams[] }
|
|
23
|
+
): Response<Array<CosmosAddress>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CosmosSignedTx as HardwareCosmosSignedTx } from '@onekeyfe/hd-transport';
|
|
2
|
+
import type { CommonParams, Response } from '../params';
|
|
3
|
+
|
|
4
|
+
export type CosmosSignedTx = {
|
|
5
|
+
path: string;
|
|
6
|
+
} & HardwareCosmosSignedTx;
|
|
7
|
+
|
|
8
|
+
export type CosmosSignTransactionParams = {
|
|
9
|
+
path: string | number[];
|
|
10
|
+
rawTx?: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export declare function cosmosSignTransaction(
|
|
14
|
+
connectId: string,
|
|
15
|
+
deviceId: string,
|
|
16
|
+
params: CommonParams & CosmosSignTransactionParams
|
|
17
|
+
): Response<CosmosSignedTx>;
|
package/src/types/api/export.ts
CHANGED
|
@@ -97,4 +97,11 @@ export type { NearSignTransactionParams } from './nearSignTransaction';
|
|
|
97
97
|
|
|
98
98
|
export type { AptosAddress, AptosGetAddressParams } from './aptosGetAddress';
|
|
99
99
|
export type { AptosPublicKey, AptosGetPublicKeyParams } from './aptosGetPublicKey';
|
|
100
|
+
export type { AptosMessageSignature, AptosSignMessageParams } from './aptosSignMessage';
|
|
100
101
|
export type { AptosSignedTx, AptosSignTransactionParams } from './aptosSignTransaction';
|
|
102
|
+
|
|
103
|
+
export type { AlgoAddress, AlgoGetAddressParams } from './algoGetAddress';
|
|
104
|
+
export type { AlgoSignedTx, AlgoSignTransactionParams } from './algoSignTransaction';
|
|
105
|
+
|
|
106
|
+
export type { CosmosAddress, CosmosGetAddressParams } from './cosmosGetAddress';
|
|
107
|
+
export type { CosmosSignedTx, CosmosSignTransactionParams } from './cosmosSignTransaction';
|
package/src/types/api/index.ts
CHANGED
|
@@ -72,8 +72,15 @@ import { nearSignTransaction } from './nearSignTransaction';
|
|
|
72
72
|
|
|
73
73
|
import { aptosGetAddress } from './aptosGetAddress';
|
|
74
74
|
import { aptosGetPublicKey } from './aptosGetPublicKey';
|
|
75
|
+
import { aptosSignMessage } from './aptosSignMessage';
|
|
75
76
|
import { aptosSignTransaction } from './aptosSignTransaction';
|
|
76
77
|
|
|
78
|
+
import { algoGetAddress } from './algoGetAddress';
|
|
79
|
+
import { algoSignTransaction } from './algoSignTransaction';
|
|
80
|
+
|
|
81
|
+
import { cosmosGetAddress } from './cosmosGetAddress';
|
|
82
|
+
import { cosmosSignTransaction } from './cosmosSignTransaction';
|
|
83
|
+
|
|
77
84
|
export * from './export';
|
|
78
85
|
|
|
79
86
|
export type CoreApi = {
|
|
@@ -195,5 +202,18 @@ export type CoreApi = {
|
|
|
195
202
|
*/
|
|
196
203
|
aptosGetAddress: typeof aptosGetAddress;
|
|
197
204
|
aptosGetPublicKey: typeof aptosGetPublicKey;
|
|
205
|
+
aptosSignMessage: typeof aptosSignMessage;
|
|
198
206
|
aptosSignTransaction: typeof aptosSignTransaction;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Algo function
|
|
210
|
+
*/
|
|
211
|
+
algoGetAddress: typeof algoGetAddress;
|
|
212
|
+
algoSignTransaction: typeof algoSignTransaction;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Cosmos function
|
|
216
|
+
*/
|
|
217
|
+
cosmosGetAddress: typeof cosmosGetAddress;
|
|
218
|
+
cosmosSignTransaction: typeof cosmosSignTransaction;
|
|
199
219
|
};
|