@onekeyfe/hd-core 1.1.9-alpha.0 → 1.1.9
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/evm/EVMSignTransaction.d.ts +2 -3
- 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/data-manager/DataManager.d.ts +1 -1
- package/dist/index.d.ts +4 -29
- package/dist/index.js +13 -192
- package/dist/inject.d.ts.map +1 -1
- package/dist/types/api/evmSignTransaction.d.ts +1 -26
- package/dist/types/api/evmSignTransaction.d.ts.map +1 -1
- package/dist/types/settings.d.ts +1 -1
- package/dist/utils/deviceFeaturesUtils.d.ts +1 -1
- package/package.json +4 -4
- package/src/api/evm/EVMSignTransaction.ts +4 -25
- package/src/api/evm/latest/signTransaction.ts +4 -79
- package/src/data/messages/messages.json +0 -125
- package/src/data-manager/DataManager.ts +1 -1
- package/src/inject.ts +4 -3
- package/src/types/api/evmSignTransaction.ts +1 -29
- package/src/types/settings.ts +1 -1
- package/src/utils/deviceFeaturesUtils.ts +9 -9
- package/__tests__/evmSignTransactionEIP7702.test.ts +0 -216
- package/validate-eip7702.js +0 -120
package/validate-eip7702.js
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
// Simple validation script for EIP7702 types
|
|
2
|
-
console.log('Validating EIP7702 implementation...');
|
|
3
|
-
|
|
4
|
-
// Test 1: Check if types are properly defined
|
|
5
|
-
try {
|
|
6
|
-
const { EVMTransactionEIP7702, EVMAuthorization, EVMAuthorizationSignature } = require('./dist/types');
|
|
7
|
-
console.log('✓ Types imported successfully');
|
|
8
|
-
} catch (error) {
|
|
9
|
-
console.log('✗ Type import failed:', error.message);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// Test 2: Validate transaction structure
|
|
13
|
-
const sampleTransaction = {
|
|
14
|
-
to: '0x7314e0f1c0e28474bdb6be3e2c3e0453255188f8',
|
|
15
|
-
value: '0xf4240',
|
|
16
|
-
gasLimit: '0x5208',
|
|
17
|
-
nonce: '0x0',
|
|
18
|
-
data: '0x',
|
|
19
|
-
chainId: 1,
|
|
20
|
-
maxFeePerGas: '0xbebc200',
|
|
21
|
-
maxPriorityFeePerGas: '0x9502f900',
|
|
22
|
-
accessList: [],
|
|
23
|
-
authorizationList: [
|
|
24
|
-
{
|
|
25
|
-
chainId: 1,
|
|
26
|
-
address: '0x80296FF8D1ED46f8e3C7992664D13B833504c2Bb',
|
|
27
|
-
nonce: '0x0',
|
|
28
|
-
signature: {
|
|
29
|
-
yParity: 0,
|
|
30
|
-
r: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
31
|
-
s: '0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321',
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
console.log('✓ Sample EIP7702 transaction structure is valid');
|
|
38
|
-
|
|
39
|
-
// Test 3: Check message definitions
|
|
40
|
-
try {
|
|
41
|
-
const fs = require('fs');
|
|
42
|
-
const messagesPath = './src/data/messages/messages.json';
|
|
43
|
-
const messages = JSON.parse(fs.readFileSync(messagesPath, 'utf8'));
|
|
44
|
-
|
|
45
|
-
if (messages.nested.EthereumSignTxEIP7702OneKey) {
|
|
46
|
-
console.log('✓ EthereumSignTxEIP7702OneKey message definition found');
|
|
47
|
-
} else {
|
|
48
|
-
console.log('✗ EthereumSignTxEIP7702OneKey message definition not found');
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (messages.nested.EthereumAuthorizationOneKey) {
|
|
52
|
-
console.log('✓ EthereumAuthorizationOneKey message definition found');
|
|
53
|
-
} else {
|
|
54
|
-
console.log('✗ EthereumAuthorizationOneKey message definition not found');
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (messages.nested.EthereumAuthorizationSignature) {
|
|
58
|
-
console.log('✓ EthereumAuthorizationSignature message definition found');
|
|
59
|
-
} else {
|
|
60
|
-
console.log('✗ EthereumAuthorizationSignature message definition not found');
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Check MessageType enum
|
|
64
|
-
const messageTypes = messages.nested.MessageType.values;
|
|
65
|
-
if (messageTypes.MessageType_EthereumSignTxEIP7702OneKey) {
|
|
66
|
-
console.log('✓ MessageType_EthereumSignTxEIP7702OneKey enum found with value:', messageTypes.MessageType_EthereumSignTxEIP7702OneKey);
|
|
67
|
-
} else {
|
|
68
|
-
console.log('✗ MessageType_EthereumSignTxEIP7702OneKey enum not found');
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
} catch (error) {
|
|
72
|
-
console.log('✗ Message validation failed:', error.message);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// Test 4: Validate example data
|
|
76
|
-
try {
|
|
77
|
-
const fs = require('fs');
|
|
78
|
-
const examplePath = '../connect-examples/expo-example/src/data/ethereum.ts';
|
|
79
|
-
const exampleContent = fs.readFileSync(examplePath, 'utf8');
|
|
80
|
-
|
|
81
|
-
if (exampleContent.includes('authorizationList')) {
|
|
82
|
-
console.log('✓ EIP7702 examples found in ethereum.ts');
|
|
83
|
-
} else {
|
|
84
|
-
console.log('✗ EIP7702 examples not found in ethereum.ts');
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (exampleContent.includes('EIP-7702')) {
|
|
88
|
-
console.log('✓ EIP-7702 description found in examples');
|
|
89
|
-
} else {
|
|
90
|
-
console.log('✗ EIP-7702 description not found in examples');
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
} catch (error) {
|
|
94
|
-
console.log('✗ Example validation failed:', error.message);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
console.log('\nValidation complete!');
|
|
98
|
-
console.log('\nEIP7702 Implementation Summary:');
|
|
99
|
-
console.log('- ✓ Added EthereumSignTxEIP7702OneKey message type');
|
|
100
|
-
console.log('- ✓ Added EthereumAuthorizationOneKey and EthereumAuthorizationSignature types');
|
|
101
|
-
console.log('- ✓ Added MessageType_EthereumSignTxEIP7702OneKey enum (20120)');
|
|
102
|
-
console.log('- ✓ Updated EthereumTxRequestOneKey with authorization_signatures field');
|
|
103
|
-
console.log('- ✓ Added EVMTransactionEIP7702, EVMAuthorization, EVMAuthorizationSignature types');
|
|
104
|
-
console.log('- ✓ Implemented evmSignTxEip7702 function in signTransaction.ts');
|
|
105
|
-
console.log('- ✓ Updated EVMSignTransaction class to support EIP7702');
|
|
106
|
-
console.log('- ✓ Added comprehensive examples in ethereum.ts');
|
|
107
|
-
console.log('- ✓ Created test cases for validation');
|
|
108
|
-
|
|
109
|
-
console.log('\nCompatibility with OKX Implementation:');
|
|
110
|
-
console.log('- ✓ Supports authorization_list with multiple authorizations');
|
|
111
|
-
console.log('- ✓ Compatible with OKX WalletCore contract addresses');
|
|
112
|
-
console.log('- ✓ Supports both signed and unsigned authorizations');
|
|
113
|
-
console.log('- ✓ Includes access_list support for gas optimization');
|
|
114
|
-
console.log('- ✓ Uses EIP-1559 fee structure (maxFeePerGas, maxPriorityFeePerGas)');
|
|
115
|
-
|
|
116
|
-
console.log('\nNext Steps:');
|
|
117
|
-
console.log('1. Build the project: yarn build');
|
|
118
|
-
console.log('2. Test with actual hardware wallet');
|
|
119
|
-
console.log('3. Verify compatibility with OKX smart contract wallet');
|
|
120
|
-
console.log('4. Update firmware to support EIP7702 message types');
|