@onekeyfe/hd-core 1.1.10-alpha.2 → 1.1.10-alpha.4
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/aptos/AptosSignInMessage.d.ts +13 -0
- package/dist/api/aptos/AptosSignInMessage.d.ts.map +1 -0
- package/dist/api/evm/EVMSignTransaction.d.ts +15 -2
- package/dist/api/evm/EVMSignTransaction.d.ts.map +1 -1
- package/dist/api/evm/latest/signTransaction.d.ts +10 -3
- package/dist/api/evm/latest/signTransaction.d.ts.map +1 -1
- package/dist/api/evm/legacyV1/signTransaction.d.ts +4 -3
- package/dist/api/evm/legacyV1/signTransaction.d.ts.map +1 -1
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/tron/TronSignMessage.d.ts +5 -0
- package/dist/api/tron/TronSignMessage.d.ts.map +1 -1
- package/dist/index.d.ts +47 -3
- package/dist/index.js +314 -16
- package/dist/inject.d.ts.map +1 -1
- package/dist/types/api/aptosSignInMessage.d.ts +11 -0
- package/dist/types/api/aptosSignInMessage.d.ts.map +1 -0
- package/dist/types/api/evmSignTransaction.d.ts +27 -1
- package/dist/types/api/evmSignTransaction.d.ts.map +1 -1
- package/dist/types/api/export.d.ts +3 -1
- package/dist/types/api/export.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +2 -0
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/tronSignMessage.d.ts +1 -0
- package/dist/types/api/tronSignMessage.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 +5 -5
- package/src/api/aptos/AptosSignInMessage.ts +54 -0
- package/src/api/evm/EVMSignTransaction.ts +52 -5
- package/src/api/evm/latest/signTransaction.ts +101 -7
- package/src/api/evm/legacyV1/signTransaction.ts +25 -12
- package/src/api/index.ts +1 -0
- package/src/api/tron/TronSignMessage.ts +32 -1
- package/src/data/messages/messages.json +161 -5
- package/src/inject.ts +2 -0
- package/src/types/api/aptosSignInMessage.ts +17 -0
- package/src/types/api/evmSignTransaction.ts +30 -1
- package/src/types/api/export.ts +8 -0
- package/src/types/api/index.ts +2 -0
- package/src/types/api/tronSignMessage.ts +1 -0
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EthereumSignTx,
|
|
3
3
|
EthereumSignTxEIP1559,
|
|
4
|
+
EthereumSignTxEIP7702OneKey,
|
|
4
5
|
EthereumTxRequestOneKey,
|
|
5
6
|
MessageResponse,
|
|
6
7
|
TypedCall,
|
|
7
8
|
} from '@onekeyfe/hd-transport';
|
|
8
9
|
import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
9
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
EVMSignedTx,
|
|
12
|
+
EVMTransaction,
|
|
13
|
+
EVMTransactionEIP1559,
|
|
14
|
+
EVMTransactionEIP7702,
|
|
15
|
+
} from '../../../types';
|
|
10
16
|
import { cutString } from '../../helpers/stringUtils';
|
|
11
|
-
import { stripHexStartZeroes } from '../../helpers/hexUtils';
|
|
17
|
+
import { stripHexStartZeroes, addHexPrefix } from '../../helpers/hexUtils';
|
|
12
18
|
|
|
13
19
|
export const processTxRequest = async ({
|
|
14
20
|
typedCall,
|
|
@@ -27,6 +33,7 @@ export const processTxRequest = async ({
|
|
|
27
33
|
let v = request.signature_v;
|
|
28
34
|
const r = request.signature_r;
|
|
29
35
|
const s = request.signature_s;
|
|
36
|
+
const authorizationSignatures = request.authorization_signatures;
|
|
30
37
|
|
|
31
38
|
if (v == null || r == null || s == null) {
|
|
32
39
|
throw ERRORS.TypedError(
|
|
@@ -40,11 +47,22 @@ export const processTxRequest = async ({
|
|
|
40
47
|
v += 2 * chainId + 35;
|
|
41
48
|
}
|
|
42
49
|
|
|
43
|
-
|
|
50
|
+
const result: any = {
|
|
44
51
|
v: `0x${v.toString(16)}`,
|
|
45
52
|
r: `0x${r}`,
|
|
46
53
|
s: `0x${s}`,
|
|
47
|
-
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// Add authorization signatures for EIP7702 transactions
|
|
57
|
+
if (authorizationSignatures && authorizationSignatures.length > 0) {
|
|
58
|
+
result.authorizationSignatures = authorizationSignatures.map(sig => ({
|
|
59
|
+
yParity: sig.y_parity,
|
|
60
|
+
r: sig.r,
|
|
61
|
+
s: sig.s,
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return Promise.resolve(result);
|
|
48
66
|
}
|
|
49
67
|
|
|
50
68
|
const [first, rest] = cutString(data, request.data_length * 2);
|
|
@@ -180,17 +198,93 @@ export const evmSignTxEip1559 = async ({
|
|
|
180
198
|
|
|
181
199
|
return processTxRequest({ typedCall, request: response.message, data: rest, supportTrezor });
|
|
182
200
|
};
|
|
201
|
+
|
|
202
|
+
export const evmSignTxEip7702 = async ({
|
|
203
|
+
typedCall,
|
|
204
|
+
addressN,
|
|
205
|
+
tx,
|
|
206
|
+
supportTrezor,
|
|
207
|
+
}: {
|
|
208
|
+
typedCall: TypedCall;
|
|
209
|
+
addressN: number[];
|
|
210
|
+
tx: EVMTransactionEIP7702;
|
|
211
|
+
supportTrezor?: boolean;
|
|
212
|
+
}) => {
|
|
213
|
+
const {
|
|
214
|
+
to,
|
|
215
|
+
value,
|
|
216
|
+
gasLimit,
|
|
217
|
+
nonce,
|
|
218
|
+
data,
|
|
219
|
+
chainId,
|
|
220
|
+
maxFeePerGas,
|
|
221
|
+
maxPriorityFeePerGas,
|
|
222
|
+
accessList,
|
|
223
|
+
authorizationList,
|
|
224
|
+
} = tx;
|
|
225
|
+
|
|
226
|
+
const length = data == null ? 0 : data.length / 2;
|
|
227
|
+
|
|
228
|
+
const [first, rest] = cutString(data, 1024 * 2);
|
|
229
|
+
|
|
230
|
+
const message: EthereumSignTxEIP7702OneKey = {
|
|
231
|
+
address_n: addressN,
|
|
232
|
+
nonce: stripHexStartZeroes(nonce),
|
|
233
|
+
max_gas_fee: stripHexStartZeroes(maxFeePerGas),
|
|
234
|
+
max_priority_fee: stripHexStartZeroes(maxPriorityFeePerGas),
|
|
235
|
+
gas_limit: stripHexStartZeroes(gasLimit),
|
|
236
|
+
to,
|
|
237
|
+
value: stripHexStartZeroes(value),
|
|
238
|
+
data_length: length,
|
|
239
|
+
data_initial_chunk: first,
|
|
240
|
+
chain_id: chainId,
|
|
241
|
+
access_list: (accessList || []).map(a => ({
|
|
242
|
+
address: a.address,
|
|
243
|
+
storage_keys: a.storageKeys,
|
|
244
|
+
})),
|
|
245
|
+
authorization_list: authorizationList.map(auth => ({
|
|
246
|
+
address_n: auth.addressN || [],
|
|
247
|
+
chain_id: auth.chainId,
|
|
248
|
+
address: addHexPrefix(auth.address),
|
|
249
|
+
nonce: stripHexStartZeroes(auth.nonce),
|
|
250
|
+
signature: auth.signature
|
|
251
|
+
? {
|
|
252
|
+
y_parity: auth.signature.yParity,
|
|
253
|
+
r: auth.signature.r,
|
|
254
|
+
s: auth.signature.s,
|
|
255
|
+
}
|
|
256
|
+
: undefined,
|
|
257
|
+
})),
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
let response;
|
|
261
|
+
if (supportTrezor) {
|
|
262
|
+
// Note: Trezor doesn't support EIP7702 yet, this is for future compatibility
|
|
263
|
+
throw ERRORS.TypedError(HardwareErrorCode.RuntimeError, 'EIP7702 not supported by Trezor');
|
|
264
|
+
} else {
|
|
265
|
+
response = await typedCall('EthereumSignTxEIP7702OneKey', 'EthereumTxRequestOneKey', message);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
return processTxRequest({ typedCall, request: response.message, data: rest, supportTrezor });
|
|
269
|
+
};
|
|
270
|
+
|
|
183
271
|
export const signTransaction = async ({
|
|
184
272
|
typedCall,
|
|
185
273
|
isEIP1559,
|
|
274
|
+
isEIP7702,
|
|
186
275
|
addressN,
|
|
187
276
|
tx,
|
|
188
277
|
}: {
|
|
189
278
|
addressN: number[];
|
|
190
|
-
tx: EVMTransaction | EVMTransactionEIP1559;
|
|
279
|
+
tx: EVMTransaction | EVMTransactionEIP1559 | EVMTransactionEIP7702;
|
|
191
280
|
isEIP1559: boolean;
|
|
281
|
+
isEIP7702?: boolean;
|
|
192
282
|
typedCall: TypedCall;
|
|
193
|
-
}) =>
|
|
194
|
-
|
|
283
|
+
}) => {
|
|
284
|
+
if (isEIP7702) {
|
|
285
|
+
return evmSignTxEip7702({ typedCall, addressN, tx: tx as EVMTransactionEIP7702 });
|
|
286
|
+
}
|
|
287
|
+
return isEIP1559
|
|
195
288
|
? evmSignTxEip1559({ typedCall, addressN, tx: tx as EVMTransactionEIP1559 })
|
|
196
289
|
: evmSignTx({ typedCall, addressN, tx: tx as EVMTransaction });
|
|
290
|
+
};
|
|
@@ -1,23 +1,36 @@
|
|
|
1
1
|
import { TypedCall } from '@onekeyfe/hd-transport';
|
|
2
|
-
import { EVMTransaction, EVMTransactionEIP1559 } from '../../../types';
|
|
3
|
-
import { evmSignTx, evmSignTxEip1559 } from '../latest/signTransaction';
|
|
2
|
+
import { EVMTransaction, EVMTransactionEIP1559, EVMTransactionEIP7702 } from '../../../types';
|
|
3
|
+
import { evmSignTx, evmSignTxEip1559, evmSignTxEip7702 } from '../latest/signTransaction';
|
|
4
4
|
|
|
5
5
|
export const signTransaction = async ({
|
|
6
6
|
typedCall,
|
|
7
7
|
isEIP1559,
|
|
8
|
+
isEIP7702,
|
|
8
9
|
addressN,
|
|
9
10
|
tx,
|
|
10
11
|
}: {
|
|
11
12
|
addressN: number[];
|
|
12
|
-
tx: EVMTransaction | EVMTransactionEIP1559;
|
|
13
|
+
tx: EVMTransaction | EVMTransactionEIP1559 | EVMTransactionEIP7702;
|
|
13
14
|
isEIP1559: boolean;
|
|
15
|
+
isEIP7702: boolean;
|
|
14
16
|
typedCall: TypedCall;
|
|
15
|
-
}) =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
}) => {
|
|
18
|
+
if (isEIP7702) {
|
|
19
|
+
return evmSignTxEip7702({
|
|
20
|
+
typedCall,
|
|
21
|
+
addressN,
|
|
22
|
+
tx: tx as EVMTransactionEIP7702,
|
|
23
|
+
supportTrezor: true,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
if (isEIP1559) {
|
|
27
|
+
return evmSignTxEip1559({
|
|
28
|
+
typedCall,
|
|
29
|
+
addressN,
|
|
30
|
+
tx: tx as EVMTransactionEIP1559,
|
|
31
|
+
supportTrezor: true,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return evmSignTx({ typedCall, addressN, tx: tx as EVMTransaction, supportTrezor: true });
|
|
36
|
+
};
|
package/src/api/index.ts
CHANGED
|
@@ -91,6 +91,7 @@ export { default as aptosGetAddress } from './aptos/AptosGetAddress';
|
|
|
91
91
|
export { default as aptosGetPublicKey } from './aptos/AptosGetPublicKey';
|
|
92
92
|
export { default as aptosSignTransaction } from './aptos/AptosSignTransaction';
|
|
93
93
|
export { default as aptosSignMessage } from './aptos/AptosSignMessage';
|
|
94
|
+
export { default as aptosSignInMessage } from './aptos/AptosSignInMessage';
|
|
94
95
|
|
|
95
96
|
export { default as algoGetAddress } from './algo/AlgoGetAddress';
|
|
96
97
|
export { default as algoSignTransaction } from './algo/AlgoSignTransaction';
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
TronSignMessage as HardwareTronSignMessage,
|
|
3
|
+
TronMessageType,
|
|
4
|
+
} from '@onekeyfe/hd-transport';
|
|
5
|
+
import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
2
6
|
import { UI_REQUEST } from '../../constants/ui-request';
|
|
3
7
|
import { validatePath } from '../helpers/pathUtils';
|
|
4
8
|
import { BaseMethod } from '../BaseMethod';
|
|
@@ -14,15 +18,26 @@ export default class TronSignMessage extends BaseMethod<HardwareTronSignMessage>
|
|
|
14
18
|
validateParams(this.payload, [
|
|
15
19
|
{ name: 'path', required: true },
|
|
16
20
|
{ name: 'messageHex', type: 'hexString', required: true },
|
|
21
|
+
{ name: 'messageType', type: 'string' },
|
|
17
22
|
]);
|
|
18
23
|
|
|
19
24
|
const { path, messageHex } = this.payload;
|
|
20
25
|
const addressN = validatePath(path, 3);
|
|
21
26
|
|
|
27
|
+
if (this.payload.messageType === 'V1' || this.payload.messageType == null) {
|
|
28
|
+
throw ERRORS.TypedError(
|
|
29
|
+
HardwareErrorCode.DeviceNotSupportMethod,
|
|
30
|
+
'not support tron message v1'
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const messageType = TronMessageType.V2;
|
|
35
|
+
|
|
22
36
|
// init params
|
|
23
37
|
this.params = {
|
|
24
38
|
address_n: addressN,
|
|
25
39
|
message: stripHexPrefix(messageHex),
|
|
40
|
+
message_type: messageType,
|
|
26
41
|
};
|
|
27
42
|
}
|
|
28
43
|
|
|
@@ -34,7 +49,23 @@ export default class TronSignMessage extends BaseMethod<HardwareTronSignMessage>
|
|
|
34
49
|
};
|
|
35
50
|
}
|
|
36
51
|
|
|
52
|
+
getMessageV2VersionRange() {
|
|
53
|
+
return {
|
|
54
|
+
pro: {
|
|
55
|
+
min: '4.16.0',
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
37
60
|
async run() {
|
|
61
|
+
this.checkFeatureVersionLimit(
|
|
62
|
+
() => this.params.message_type === TronMessageType.V2,
|
|
63
|
+
() => this.getMessageV2VersionRange(),
|
|
64
|
+
{
|
|
65
|
+
strictCheckDeviceSupport: true,
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
|
|
38
69
|
const response = await this.device.commands.typedCall(
|
|
39
70
|
'TronSignMessage',
|
|
40
71
|
'TronMessageSignature',
|
|
@@ -341,6 +341,23 @@
|
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
343
|
},
|
|
344
|
+
"AptosSignSIWAMessage": {
|
|
345
|
+
"fields": {
|
|
346
|
+
"address_n": {
|
|
347
|
+
"rule": "repeated",
|
|
348
|
+
"type": "uint32",
|
|
349
|
+
"id": 1,
|
|
350
|
+
"options": {
|
|
351
|
+
"packed": false
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
"siwa_payload": {
|
|
355
|
+
"rule": "required",
|
|
356
|
+
"type": "string",
|
|
357
|
+
"id": 2
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
},
|
|
344
361
|
"BenfenGetAddress": {
|
|
345
362
|
"fields": {
|
|
346
363
|
"address_n": {
|
|
@@ -5241,6 +5258,20 @@
|
|
|
5241
5258
|
}
|
|
5242
5259
|
}
|
|
5243
5260
|
},
|
|
5261
|
+
"EthereumAccessListOneKey": {
|
|
5262
|
+
"fields": {
|
|
5263
|
+
"address": {
|
|
5264
|
+
"rule": "required",
|
|
5265
|
+
"type": "string",
|
|
5266
|
+
"id": 1
|
|
5267
|
+
},
|
|
5268
|
+
"storage_keys": {
|
|
5269
|
+
"rule": "repeated",
|
|
5270
|
+
"type": "bytes",
|
|
5271
|
+
"id": 2
|
|
5272
|
+
}
|
|
5273
|
+
}
|
|
5274
|
+
},
|
|
5244
5275
|
"EthereumSignTxEIP1559OneKey": {
|
|
5245
5276
|
"fields": {
|
|
5246
5277
|
"address_n": {
|
|
@@ -5305,19 +5336,124 @@
|
|
|
5305
5336
|
"type": "EthereumAccessListOneKey",
|
|
5306
5337
|
"id": 11
|
|
5307
5338
|
}
|
|
5339
|
+
}
|
|
5340
|
+
},
|
|
5341
|
+
"EthereumAuthorizationSignature": {
|
|
5342
|
+
"fields": {
|
|
5343
|
+
"y_parity": {
|
|
5344
|
+
"rule": "required",
|
|
5345
|
+
"type": "uint32",
|
|
5346
|
+
"id": 1
|
|
5347
|
+
},
|
|
5348
|
+
"r": {
|
|
5349
|
+
"rule": "required",
|
|
5350
|
+
"type": "bytes",
|
|
5351
|
+
"id": 2
|
|
5352
|
+
},
|
|
5353
|
+
"s": {
|
|
5354
|
+
"rule": "required",
|
|
5355
|
+
"type": "bytes",
|
|
5356
|
+
"id": 3
|
|
5357
|
+
}
|
|
5358
|
+
}
|
|
5359
|
+
},
|
|
5360
|
+
"EthereumSignTxEIP7702OneKey": {
|
|
5361
|
+
"fields": {
|
|
5362
|
+
"address_n": {
|
|
5363
|
+
"rule": "repeated",
|
|
5364
|
+
"type": "uint32",
|
|
5365
|
+
"id": 1,
|
|
5366
|
+
"options": {
|
|
5367
|
+
"packed": false
|
|
5368
|
+
}
|
|
5369
|
+
},
|
|
5370
|
+
"nonce": {
|
|
5371
|
+
"rule": "required",
|
|
5372
|
+
"type": "bytes",
|
|
5373
|
+
"id": 2
|
|
5374
|
+
},
|
|
5375
|
+
"max_gas_fee": {
|
|
5376
|
+
"rule": "required",
|
|
5377
|
+
"type": "bytes",
|
|
5378
|
+
"id": 3
|
|
5379
|
+
},
|
|
5380
|
+
"max_priority_fee": {
|
|
5381
|
+
"rule": "required",
|
|
5382
|
+
"type": "bytes",
|
|
5383
|
+
"id": 4
|
|
5384
|
+
},
|
|
5385
|
+
"gas_limit": {
|
|
5386
|
+
"rule": "required",
|
|
5387
|
+
"type": "bytes",
|
|
5388
|
+
"id": 5
|
|
5389
|
+
},
|
|
5390
|
+
"to": {
|
|
5391
|
+
"rule": "required",
|
|
5392
|
+
"type": "string",
|
|
5393
|
+
"id": 6
|
|
5394
|
+
},
|
|
5395
|
+
"value": {
|
|
5396
|
+
"rule": "required",
|
|
5397
|
+
"type": "bytes",
|
|
5398
|
+
"id": 7
|
|
5399
|
+
},
|
|
5400
|
+
"data_initial_chunk": {
|
|
5401
|
+
"type": "bytes",
|
|
5402
|
+
"id": 8,
|
|
5403
|
+
"options": {
|
|
5404
|
+
"default": ""
|
|
5405
|
+
}
|
|
5406
|
+
},
|
|
5407
|
+
"data_length": {
|
|
5408
|
+
"rule": "required",
|
|
5409
|
+
"type": "uint32",
|
|
5410
|
+
"id": 9
|
|
5411
|
+
},
|
|
5412
|
+
"chain_id": {
|
|
5413
|
+
"rule": "required",
|
|
5414
|
+
"type": "uint64",
|
|
5415
|
+
"id": 10
|
|
5416
|
+
},
|
|
5417
|
+
"access_list": {
|
|
5418
|
+
"rule": "repeated",
|
|
5419
|
+
"type": "EthereumAccessListOneKey",
|
|
5420
|
+
"id": 11
|
|
5421
|
+
},
|
|
5422
|
+
"authorization_list": {
|
|
5423
|
+
"rule": "repeated",
|
|
5424
|
+
"type": "EthereumAuthorizationOneKey",
|
|
5425
|
+
"id": 12
|
|
5426
|
+
}
|
|
5308
5427
|
},
|
|
5309
5428
|
"nested": {
|
|
5310
|
-
"
|
|
5429
|
+
"EthereumAuthorizationOneKey": {
|
|
5311
5430
|
"fields": {
|
|
5431
|
+
"address_n": {
|
|
5432
|
+
"rule": "repeated",
|
|
5433
|
+
"type": "uint32",
|
|
5434
|
+
"id": 1,
|
|
5435
|
+
"options": {
|
|
5436
|
+
"packed": false
|
|
5437
|
+
}
|
|
5438
|
+
},
|
|
5439
|
+
"chain_id": {
|
|
5440
|
+
"rule": "required",
|
|
5441
|
+
"type": "uint64",
|
|
5442
|
+
"id": 2
|
|
5443
|
+
},
|
|
5312
5444
|
"address": {
|
|
5313
5445
|
"rule": "required",
|
|
5314
5446
|
"type": "string",
|
|
5315
|
-
"id":
|
|
5447
|
+
"id": 3
|
|
5316
5448
|
},
|
|
5317
|
-
"
|
|
5318
|
-
"rule": "
|
|
5449
|
+
"nonce": {
|
|
5450
|
+
"rule": "required",
|
|
5319
5451
|
"type": "bytes",
|
|
5320
|
-
"id":
|
|
5452
|
+
"id": 4
|
|
5453
|
+
},
|
|
5454
|
+
"signature": {
|
|
5455
|
+
"type": "EthereumAuthorizationSignature",
|
|
5456
|
+
"id": 5
|
|
5321
5457
|
}
|
|
5322
5458
|
}
|
|
5323
5459
|
}
|
|
@@ -5340,6 +5476,11 @@
|
|
|
5340
5476
|
"signature_s": {
|
|
5341
5477
|
"type": "bytes",
|
|
5342
5478
|
"id": 4
|
|
5479
|
+
},
|
|
5480
|
+
"authorization_signatures": {
|
|
5481
|
+
"rule": "repeated",
|
|
5482
|
+
"type": "EthereumAuthorizationSignature",
|
|
5483
|
+
"id": 10
|
|
5343
5484
|
}
|
|
5344
5485
|
}
|
|
5345
5486
|
},
|
|
@@ -11581,6 +11722,12 @@
|
|
|
11581
11722
|
}
|
|
11582
11723
|
}
|
|
11583
11724
|
},
|
|
11725
|
+
"TronMessageType": {
|
|
11726
|
+
"values": {
|
|
11727
|
+
"V1": 1,
|
|
11728
|
+
"V2": 2
|
|
11729
|
+
}
|
|
11730
|
+
},
|
|
11584
11731
|
"TronSignMessage": {
|
|
11585
11732
|
"fields": {
|
|
11586
11733
|
"address_n": {
|
|
@@ -11595,6 +11742,13 @@
|
|
|
11595
11742
|
"rule": "required",
|
|
11596
11743
|
"type": "bytes",
|
|
11597
11744
|
"id": 2
|
|
11745
|
+
},
|
|
11746
|
+
"message_type": {
|
|
11747
|
+
"type": "TronMessageType",
|
|
11748
|
+
"id": 3,
|
|
11749
|
+
"options": {
|
|
11750
|
+
"default": "V1"
|
|
11751
|
+
}
|
|
11598
11752
|
}
|
|
11599
11753
|
}
|
|
11600
11754
|
},
|
|
@@ -11914,6 +12068,7 @@
|
|
|
11914
12068
|
"MessageType_EthereumSignTypedHashOneKey": 20117,
|
|
11915
12069
|
"MessageType_EthereumGnosisSafeTxAck": 20118,
|
|
11916
12070
|
"MessageType_EthereumGnosisSafeTxRequest": 20119,
|
|
12071
|
+
"MessageType_EthereumSignTxEIP7702OneKey": 20120,
|
|
11917
12072
|
"MessageType_NEMGetAddress": 67,
|
|
11918
12073
|
"MessageType_NEMAddress": 68,
|
|
11919
12074
|
"MessageType_NEMSignTx": 69,
|
|
@@ -12055,6 +12210,7 @@
|
|
|
12055
12210
|
"MessageType_AptosSignedTx": 10603,
|
|
12056
12211
|
"MessageType_AptosSignMessage": 10604,
|
|
12057
12212
|
"MessageType_AptosMessageSignature": 10605,
|
|
12213
|
+
"MessageType_AptosSignSIWAMessage": 10606,
|
|
12058
12214
|
"MessageType_WebAuthnListResidentCredentials": 800,
|
|
12059
12215
|
"MessageType_WebAuthnCredentials": 801,
|
|
12060
12216
|
"MessageType_WebAuthnAddResidentCredential": 802,
|
package/src/inject.ts
CHANGED
|
@@ -288,6 +288,8 @@ export const createCoreApi = (
|
|
|
288
288
|
call({ ...params, connectId, deviceId, method: 'aptosGetPublicKey' }),
|
|
289
289
|
aptosSignMessage: (connectId, deviceId, params) =>
|
|
290
290
|
call({ ...params, connectId, deviceId, method: 'aptosSignMessage' }),
|
|
291
|
+
aptosSignInMessage: (connectId, deviceId, params) =>
|
|
292
|
+
call({ ...params, connectId, deviceId, method: 'aptosSignInMessage' }),
|
|
291
293
|
aptosSignTransaction: (connectId, deviceId, params) =>
|
|
292
294
|
call({ ...params, connectId, deviceId, method: 'aptosSignTransaction' }),
|
|
293
295
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AptosMessageSignature as HardwareAptosMessageSignature } from '@onekeyfe/hd-transport';
|
|
2
|
+
import type { CommonParams, Response } from '../params';
|
|
3
|
+
|
|
4
|
+
export type AptosSignInMessageSignature = {
|
|
5
|
+
path: string;
|
|
6
|
+
} & HardwareAptosMessageSignature;
|
|
7
|
+
|
|
8
|
+
export type AptosSignInMessageParams = {
|
|
9
|
+
path: string | number[];
|
|
10
|
+
payload: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export declare function aptosSignInMessage(
|
|
14
|
+
connectId: string,
|
|
15
|
+
deviceId: string,
|
|
16
|
+
params: CommonParams & AptosSignInMessageParams
|
|
17
|
+
): Response<AptosSignInMessageSignature>;
|
|
@@ -4,6 +4,7 @@ export type EVMSignedTx = {
|
|
|
4
4
|
v: string;
|
|
5
5
|
r: string;
|
|
6
6
|
s: string;
|
|
7
|
+
authorizationSignatures?: EVMAuthorizationSignature[];
|
|
7
8
|
};
|
|
8
9
|
|
|
9
10
|
export type EVMTransaction = {
|
|
@@ -37,9 +38,37 @@ export type EVMTransactionEIP1559 = {
|
|
|
37
38
|
accessList?: EVMAccessList[];
|
|
38
39
|
};
|
|
39
40
|
|
|
41
|
+
export type EVMAuthorizationSignature = {
|
|
42
|
+
yParity: number;
|
|
43
|
+
r: string;
|
|
44
|
+
s: string;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export type EVMAuthorization = {
|
|
48
|
+
addressN?: number[];
|
|
49
|
+
chainId: number;
|
|
50
|
+
address: string;
|
|
51
|
+
nonce: string;
|
|
52
|
+
signature?: EVMAuthorizationSignature;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export type EVMTransactionEIP7702 = {
|
|
56
|
+
to: string;
|
|
57
|
+
value: string;
|
|
58
|
+
gasLimit: string;
|
|
59
|
+
gasPrice?: typeof undefined;
|
|
60
|
+
nonce: string;
|
|
61
|
+
data?: string;
|
|
62
|
+
chainId: number;
|
|
63
|
+
maxFeePerGas: string;
|
|
64
|
+
maxPriorityFeePerGas: string;
|
|
65
|
+
accessList?: EVMAccessList[];
|
|
66
|
+
authorizationList: EVMAuthorization[];
|
|
67
|
+
};
|
|
68
|
+
|
|
40
69
|
export type EVMSignTransactionParams = {
|
|
41
70
|
path: string | number[];
|
|
42
|
-
transaction: EVMTransaction | EVMTransactionEIP1559;
|
|
71
|
+
transaction: EVMTransaction | EVMTransactionEIP1559 | EVMTransactionEIP7702;
|
|
43
72
|
};
|
|
44
73
|
|
|
45
74
|
export declare function evmSignTransaction(
|
package/src/types/api/export.ts
CHANGED
|
@@ -36,6 +36,9 @@ export type { EVMSignMessageEIP712Params } from './evmSignMessageEIP712';
|
|
|
36
36
|
export type {
|
|
37
37
|
EVMTransaction,
|
|
38
38
|
EVMTransactionEIP1559,
|
|
39
|
+
EVMTransactionEIP7702,
|
|
40
|
+
EVMAuthorization,
|
|
41
|
+
EVMAuthorizationSignature,
|
|
39
42
|
EVMSignedTx,
|
|
40
43
|
EVMSignTransactionParams,
|
|
41
44
|
EVMAccessList,
|
|
@@ -115,6 +118,7 @@ export type { NearSignTransactionParams } from './nearSignTransaction';
|
|
|
115
118
|
export type { AptosAddress, AptosGetAddressParams } from './aptosGetAddress';
|
|
116
119
|
export type { AptosPublicKey, AptosGetPublicKeyParams } from './aptosGetPublicKey';
|
|
117
120
|
export type { AptosMessageSignature, AptosSignMessageParams } from './aptosSignMessage';
|
|
121
|
+
export type { AptosSignInMessageSignature, AptosSignInMessageParams } from './aptosSignInMessage';
|
|
118
122
|
export type { AptosSignedTx, AptosSignTransactionParams } from './aptosSignTransaction';
|
|
119
123
|
|
|
120
124
|
export type { AlgoAddress, AlgoGetAddressParams } from './algoGetAddress';
|
|
@@ -134,6 +138,10 @@ export type {
|
|
|
134
138
|
CardanoAddress,
|
|
135
139
|
CardanoGetAddressParams,
|
|
136
140
|
} from './cardanoGetAddress';
|
|
141
|
+
export type {
|
|
142
|
+
CardanoSignMessageMethodParams,
|
|
143
|
+
CardanoSignMessageParams,
|
|
144
|
+
} from './cardanoSignMessage';
|
|
137
145
|
export type { CardanoSignTransaction, CardanoSignedTxData } from './cardano';
|
|
138
146
|
|
|
139
147
|
export type { FilecoinAddress, FilecoinGetAddressParams } from './filecoinGetAddress';
|
package/src/types/api/index.ts
CHANGED
|
@@ -92,6 +92,7 @@ import { nearSignTransaction } from './nearSignTransaction';
|
|
|
92
92
|
import { aptosGetAddress } from './aptosGetAddress';
|
|
93
93
|
import { aptosGetPublicKey } from './aptosGetPublicKey';
|
|
94
94
|
import { aptosSignMessage } from './aptosSignMessage';
|
|
95
|
+
import { aptosSignInMessage } from './aptosSignInMessage';
|
|
95
96
|
import { aptosSignTransaction } from './aptosSignTransaction';
|
|
96
97
|
|
|
97
98
|
import { algoGetAddress } from './algoGetAddress';
|
|
@@ -309,6 +310,7 @@ export type CoreApi = {
|
|
|
309
310
|
aptosGetAddress: typeof aptosGetAddress;
|
|
310
311
|
aptosGetPublicKey: typeof aptosGetPublicKey;
|
|
311
312
|
aptosSignMessage: typeof aptosSignMessage;
|
|
313
|
+
aptosSignInMessage: typeof aptosSignInMessage;
|
|
312
314
|
aptosSignTransaction: typeof aptosSignTransaction;
|
|
313
315
|
|
|
314
316
|
/**
|