@onekeyfe/hd-core 1.1.10-alpha.1 → 1.1.10-alpha.3
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 +2 -5
- package/dist/api/evm/EVMSignTransaction.d.ts.map +1 -1
- package/dist/api/evm/latest/signTransaction.d.ts +3 -10
- package/dist/api/evm/latest/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 +21 -29
- package/dist/index.js +215 -205
- 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 +1 -27
- 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 +4 -4
- package/src/api/aptos/AptosSignInMessage.ts +54 -0
- package/src/api/evm/EVMSignTransaction.ts +5 -54
- package/src/api/evm/latest/signTransaction.ts +7 -101
- package/src/api/index.ts +1 -0
- package/src/api/tron/TronSignMessage.ts +32 -1
- package/src/data/messages/messages.json +156 -127
- package/src/inject.ts +2 -0
- package/src/types/api/aptosSignInMessage.ts +17 -0
- package/src/types/api/evmSignTransaction.ts +1 -30
- package/src/types/api/export.ts +5 -3
- package/src/types/api/index.ts +2 -0
- package/src/types/api/tronSignMessage.ts +1 -0
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EthereumSignTx,
|
|
3
3
|
EthereumSignTxEIP1559,
|
|
4
|
-
EthereumSignTxEIP7702OneKey,
|
|
5
4
|
EthereumTxRequestOneKey,
|
|
6
5
|
MessageResponse,
|
|
7
6
|
TypedCall,
|
|
8
7
|
} from '@onekeyfe/hd-transport';
|
|
9
8
|
import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
10
|
-
import {
|
|
11
|
-
EVMSignedTx,
|
|
12
|
-
EVMTransaction,
|
|
13
|
-
EVMTransactionEIP1559,
|
|
14
|
-
EVMTransactionEIP7702,
|
|
15
|
-
} from '../../../types';
|
|
9
|
+
import { EVMSignedTx, EVMTransaction, EVMTransactionEIP1559 } from '../../../types';
|
|
16
10
|
import { cutString } from '../../helpers/stringUtils';
|
|
17
|
-
import { stripHexStartZeroes
|
|
11
|
+
import { stripHexStartZeroes } from '../../helpers/hexUtils';
|
|
18
12
|
|
|
19
13
|
export const processTxRequest = async ({
|
|
20
14
|
typedCall,
|
|
@@ -33,7 +27,6 @@ export const processTxRequest = async ({
|
|
|
33
27
|
let v = request.signature_v;
|
|
34
28
|
const r = request.signature_r;
|
|
35
29
|
const s = request.signature_s;
|
|
36
|
-
const authorizationSignatures = request.authorization_signatures;
|
|
37
30
|
|
|
38
31
|
if (v == null || r == null || s == null) {
|
|
39
32
|
throw ERRORS.TypedError(
|
|
@@ -47,22 +40,11 @@ export const processTxRequest = async ({
|
|
|
47
40
|
v += 2 * chainId + 35;
|
|
48
41
|
}
|
|
49
42
|
|
|
50
|
-
|
|
43
|
+
return Promise.resolve({
|
|
51
44
|
v: `0x${v.toString(16)}`,
|
|
52
45
|
r: `0x${r}`,
|
|
53
46
|
s: `0x${s}`,
|
|
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);
|
|
47
|
+
});
|
|
66
48
|
}
|
|
67
49
|
|
|
68
50
|
const [first, rest] = cutString(data, request.data_length * 2);
|
|
@@ -198,93 +180,17 @@ export const evmSignTxEip1559 = async ({
|
|
|
198
180
|
|
|
199
181
|
return processTxRequest({ typedCall, request: response.message, data: rest, supportTrezor });
|
|
200
182
|
};
|
|
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
|
-
|
|
271
183
|
export const signTransaction = async ({
|
|
272
184
|
typedCall,
|
|
273
185
|
isEIP1559,
|
|
274
|
-
isEIP7702,
|
|
275
186
|
addressN,
|
|
276
187
|
tx,
|
|
277
188
|
}: {
|
|
278
189
|
addressN: number[];
|
|
279
|
-
tx: EVMTransaction | EVMTransactionEIP1559
|
|
190
|
+
tx: EVMTransaction | EVMTransactionEIP1559;
|
|
280
191
|
isEIP1559: boolean;
|
|
281
|
-
isEIP7702?: boolean;
|
|
282
192
|
typedCall: TypedCall;
|
|
283
|
-
}) =>
|
|
284
|
-
|
|
285
|
-
return evmSignTxEip7702({ typedCall, addressN, tx: tx as EVMTransactionEIP7702 });
|
|
286
|
-
}
|
|
287
|
-
return isEIP1559
|
|
193
|
+
}) =>
|
|
194
|
+
isEIP1559
|
|
288
195
|
? evmSignTxEip1559({ typedCall, addressN, tx: tx as EVMTransactionEIP1559 })
|
|
289
196
|
: evmSignTx({ typedCall, addressN, tx: tx as EVMTransaction });
|
|
290
|
-
};
|
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
|
}
|
|
@@ -5454,127 +5590,6 @@
|
|
|
5454
5590
|
}
|
|
5455
5591
|
}
|
|
5456
5592
|
},
|
|
5457
|
-
"EthereumSignTxEIP7702OneKey": {
|
|
5458
|
-
"fields": {
|
|
5459
|
-
"address_n": {
|
|
5460
|
-
"rule": "repeated",
|
|
5461
|
-
"type": "uint32",
|
|
5462
|
-
"id": 1,
|
|
5463
|
-
"options": {
|
|
5464
|
-
"packed": false
|
|
5465
|
-
}
|
|
5466
|
-
},
|
|
5467
|
-
"nonce": {
|
|
5468
|
-
"rule": "required",
|
|
5469
|
-
"type": "bytes",
|
|
5470
|
-
"id": 2
|
|
5471
|
-
},
|
|
5472
|
-
"max_gas_fee": {
|
|
5473
|
-
"rule": "required",
|
|
5474
|
-
"type": "bytes",
|
|
5475
|
-
"id": 3
|
|
5476
|
-
},
|
|
5477
|
-
"max_priority_fee": {
|
|
5478
|
-
"rule": "required",
|
|
5479
|
-
"type": "bytes",
|
|
5480
|
-
"id": 4
|
|
5481
|
-
},
|
|
5482
|
-
"gas_limit": {
|
|
5483
|
-
"rule": "required",
|
|
5484
|
-
"type": "bytes",
|
|
5485
|
-
"id": 5
|
|
5486
|
-
},
|
|
5487
|
-
"to": {
|
|
5488
|
-
"rule": "required",
|
|
5489
|
-
"type": "string",
|
|
5490
|
-
"id": 6
|
|
5491
|
-
},
|
|
5492
|
-
"value": {
|
|
5493
|
-
"rule": "required",
|
|
5494
|
-
"type": "bytes",
|
|
5495
|
-
"id": 7
|
|
5496
|
-
},
|
|
5497
|
-
"data_initial_chunk": {
|
|
5498
|
-
"type": "bytes",
|
|
5499
|
-
"id": 8,
|
|
5500
|
-
"options": {
|
|
5501
|
-
"default": ""
|
|
5502
|
-
}
|
|
5503
|
-
},
|
|
5504
|
-
"data_length": {
|
|
5505
|
-
"rule": "required",
|
|
5506
|
-
"type": "uint32",
|
|
5507
|
-
"id": 9
|
|
5508
|
-
},
|
|
5509
|
-
"chain_id": {
|
|
5510
|
-
"rule": "required",
|
|
5511
|
-
"type": "uint64",
|
|
5512
|
-
"id": 10
|
|
5513
|
-
},
|
|
5514
|
-
"access_list": {
|
|
5515
|
-
"rule": "repeated",
|
|
5516
|
-
"type": "EthereumAccessListOneKey",
|
|
5517
|
-
"id": 11
|
|
5518
|
-
},
|
|
5519
|
-
"authorization_list": {
|
|
5520
|
-
"rule": "repeated",
|
|
5521
|
-
"type": "EthereumAuthorizationOneKey",
|
|
5522
|
-
"id": 12
|
|
5523
|
-
}
|
|
5524
|
-
},
|
|
5525
|
-
"nested": {
|
|
5526
|
-
"EthereumAuthorizationOneKey": {
|
|
5527
|
-
"fields": {
|
|
5528
|
-
"address_n": {
|
|
5529
|
-
"rule": "repeated",
|
|
5530
|
-
"type": "uint32",
|
|
5531
|
-
"id": 1,
|
|
5532
|
-
"options": {
|
|
5533
|
-
"packed": false
|
|
5534
|
-
}
|
|
5535
|
-
},
|
|
5536
|
-
"chain_id": {
|
|
5537
|
-
"rule": "required",
|
|
5538
|
-
"type": "uint64",
|
|
5539
|
-
"id": 2
|
|
5540
|
-
},
|
|
5541
|
-
"address": {
|
|
5542
|
-
"rule": "required",
|
|
5543
|
-
"type": "string",
|
|
5544
|
-
"id": 3
|
|
5545
|
-
},
|
|
5546
|
-
"nonce": {
|
|
5547
|
-
"rule": "required",
|
|
5548
|
-
"type": "bytes",
|
|
5549
|
-
"id": 4
|
|
5550
|
-
},
|
|
5551
|
-
"signature": {
|
|
5552
|
-
"type": "EthereumAuthorizationSignature",
|
|
5553
|
-
"id": 5
|
|
5554
|
-
}
|
|
5555
|
-
}
|
|
5556
|
-
}
|
|
5557
|
-
}
|
|
5558
|
-
},
|
|
5559
|
-
"EthereumAuthorizationSignature": {
|
|
5560
|
-
"fields": {
|
|
5561
|
-
"y_parity": {
|
|
5562
|
-
"rule": "required",
|
|
5563
|
-
"type": "uint32",
|
|
5564
|
-
"id": 1
|
|
5565
|
-
},
|
|
5566
|
-
"r": {
|
|
5567
|
-
"rule": "required",
|
|
5568
|
-
"type": "bytes",
|
|
5569
|
-
"id": 2
|
|
5570
|
-
},
|
|
5571
|
-
"s": {
|
|
5572
|
-
"rule": "required",
|
|
5573
|
-
"type": "bytes",
|
|
5574
|
-
"id": 3
|
|
5575
|
-
}
|
|
5576
|
-
}
|
|
5577
|
-
},
|
|
5578
5593
|
"EthereumSignMessageEIP712": {
|
|
5579
5594
|
"fields": {
|
|
5580
5595
|
"address_n": {
|
|
@@ -11707,6 +11722,12 @@
|
|
|
11707
11722
|
}
|
|
11708
11723
|
}
|
|
11709
11724
|
},
|
|
11725
|
+
"TronMessageType": {
|
|
11726
|
+
"values": {
|
|
11727
|
+
"V1": 1,
|
|
11728
|
+
"V2": 2
|
|
11729
|
+
}
|
|
11730
|
+
},
|
|
11710
11731
|
"TronSignMessage": {
|
|
11711
11732
|
"fields": {
|
|
11712
11733
|
"address_n": {
|
|
@@ -11721,6 +11742,13 @@
|
|
|
11721
11742
|
"rule": "required",
|
|
11722
11743
|
"type": "bytes",
|
|
11723
11744
|
"id": 2
|
|
11745
|
+
},
|
|
11746
|
+
"message_type": {
|
|
11747
|
+
"type": "TronMessageType",
|
|
11748
|
+
"id": 3,
|
|
11749
|
+
"options": {
|
|
11750
|
+
"default": "V1"
|
|
11751
|
+
}
|
|
11724
11752
|
}
|
|
11725
11753
|
}
|
|
11726
11754
|
},
|
|
@@ -12026,7 +12054,6 @@
|
|
|
12026
12054
|
"MessageType_EthereumAddressOneKey": 20103,
|
|
12027
12055
|
"MessageType_EthereumSignTxOneKey": 20104,
|
|
12028
12056
|
"MessageType_EthereumSignTxEIP1559OneKey": 20105,
|
|
12029
|
-
"MessageType_EthereumSignTxEIP7702OneKey": 20120,
|
|
12030
12057
|
"MessageType_EthereumTxRequestOneKey": 20106,
|
|
12031
12058
|
"MessageType_EthereumTxAckOneKey": 20107,
|
|
12032
12059
|
"MessageType_EthereumSignMessageOneKey": 20108,
|
|
@@ -12041,6 +12068,7 @@
|
|
|
12041
12068
|
"MessageType_EthereumSignTypedHashOneKey": 20117,
|
|
12042
12069
|
"MessageType_EthereumGnosisSafeTxAck": 20118,
|
|
12043
12070
|
"MessageType_EthereumGnosisSafeTxRequest": 20119,
|
|
12071
|
+
"MessageType_EthereumSignTxEIP7702OneKey": 20120,
|
|
12044
12072
|
"MessageType_NEMGetAddress": 67,
|
|
12045
12073
|
"MessageType_NEMAddress": 68,
|
|
12046
12074
|
"MessageType_NEMSignTx": 69,
|
|
@@ -12182,6 +12210,7 @@
|
|
|
12182
12210
|
"MessageType_AptosSignedTx": 10603,
|
|
12183
12211
|
"MessageType_AptosSignMessage": 10604,
|
|
12184
12212
|
"MessageType_AptosMessageSignature": 10605,
|
|
12213
|
+
"MessageType_AptosSignSIWAMessage": 10606,
|
|
12185
12214
|
"MessageType_WebAuthnListResidentCredentials": 800,
|
|
12186
12215
|
"MessageType_WebAuthnCredentials": 801,
|
|
12187
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,7 +4,6 @@ export type EVMSignedTx = {
|
|
|
4
4
|
v: string;
|
|
5
5
|
r: string;
|
|
6
6
|
s: string;
|
|
7
|
-
authorizationSignatures?: EVMAuthorizationSignature[];
|
|
8
7
|
};
|
|
9
8
|
|
|
10
9
|
export type EVMTransaction = {
|
|
@@ -38,37 +37,9 @@ export type EVMTransactionEIP1559 = {
|
|
|
38
37
|
accessList?: EVMAccessList[];
|
|
39
38
|
};
|
|
40
39
|
|
|
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
|
-
|
|
69
40
|
export type EVMSignTransactionParams = {
|
|
70
41
|
path: string | number[];
|
|
71
|
-
transaction: EVMTransaction | EVMTransactionEIP1559
|
|
42
|
+
transaction: EVMTransaction | EVMTransactionEIP1559;
|
|
72
43
|
};
|
|
73
44
|
|
|
74
45
|
export declare function evmSignTransaction(
|
package/src/types/api/export.ts
CHANGED
|
@@ -36,9 +36,6 @@ export type { EVMSignMessageEIP712Params } from './evmSignMessageEIP712';
|
|
|
36
36
|
export type {
|
|
37
37
|
EVMTransaction,
|
|
38
38
|
EVMTransactionEIP1559,
|
|
39
|
-
EVMTransactionEIP7702,
|
|
40
|
-
EVMAuthorization,
|
|
41
|
-
EVMAuthorizationSignature,
|
|
42
39
|
EVMSignedTx,
|
|
43
40
|
EVMSignTransactionParams,
|
|
44
41
|
EVMAccessList,
|
|
@@ -118,6 +115,7 @@ export type { NearSignTransactionParams } from './nearSignTransaction';
|
|
|
118
115
|
export type { AptosAddress, AptosGetAddressParams } from './aptosGetAddress';
|
|
119
116
|
export type { AptosPublicKey, AptosGetPublicKeyParams } from './aptosGetPublicKey';
|
|
120
117
|
export type { AptosMessageSignature, AptosSignMessageParams } from './aptosSignMessage';
|
|
118
|
+
export type { AptosSignInMessageSignature, AptosSignInMessageParams } from './aptosSignInMessage';
|
|
121
119
|
export type { AptosSignedTx, AptosSignTransactionParams } from './aptosSignTransaction';
|
|
122
120
|
|
|
123
121
|
export type { AlgoAddress, AlgoGetAddressParams } from './algoGetAddress';
|
|
@@ -137,6 +135,10 @@ export type {
|
|
|
137
135
|
CardanoAddress,
|
|
138
136
|
CardanoGetAddressParams,
|
|
139
137
|
} from './cardanoGetAddress';
|
|
138
|
+
export type {
|
|
139
|
+
CardanoSignMessageMethodParams,
|
|
140
|
+
CardanoSignMessageParams,
|
|
141
|
+
} from './cardanoSignMessage';
|
|
140
142
|
export type { CardanoSignTransaction, CardanoSignedTxData } from './cardano';
|
|
141
143
|
|
|
142
144
|
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
|
/**
|