@@ -71,8 +71,8 @@ export default class EIP2930Transaction extends BaseTransaction<EIP2930Transacti
71
71
return new EIP2930Transaction ( txData , opts )
72
72
}
73
73
74
- // Instantiate a transaction from the raw RLP serialized tx. This means that the RLP should start with 0x01.
75
- public static fromRlpSerializedTx ( serialized : Buffer , opts : TxOptions = { } ) {
74
+ // Instantiate a transaction from the serialized tx. This means that the Buffer should start with 0x01.
75
+ public static fromSerializedTx ( serialized : Buffer , opts : TxOptions = { } ) {
76
76
if ( serialized [ 0 ] !== 1 ) {
77
77
throw new Error (
78
78
`Invalid serialized tx input: not an EIP-2930 transaction (wrong tx type, expected: 1, received: ${ serialized [ 0 ] } `
@@ -87,6 +87,12 @@ export default class EIP2930Transaction extends BaseTransaction<EIP2930Transacti
87
87
return EIP2930Transaction . fromValuesArray ( values , opts )
88
88
}
89
89
90
+ // Instantiate a transaction from the serialized tx. This means that the Buffer should start with 0x01.
91
+ // Alias of fromSerializedTx
92
+ public static fromRlpSerializedTx ( serialized : Buffer , opts : TxOptions = { } ) {
93
+ return EIP2930Transaction . fromSerializedTx ( serialized , opts )
94
+ }
95
+
90
96
// Create a transaction from a values array.
91
97
// The format is: chainId, nonce, gasPrice, gasLimit, to, value, data, access_list, [yParity, senderR, senderS]
92
98
public static fromValuesArray ( values : ( Buffer | AccessListBuffer ) [ ] , opts : TxOptions = { } ) {
@@ -129,8 +135,6 @@ export default class EIP2930Transaction extends BaseTransaction<EIP2930Transacti
129
135
throw new Error ( 'EIP-2930 not enabled on Common' )
130
136
}
131
137
132
- // TODO: verify the signature.
133
-
134
138
// check the type of AccessList. If it's a JSON-type, we have to convert it to a buffer.
135
139
136
140
let usedAccessList
@@ -217,16 +221,7 @@ export default class EIP2930Transaction extends BaseTransaction<EIP2930Transacti
217
221
}
218
222
219
223
getMessageToSign ( ) {
220
- const base = [
221
- bnToRlp ( this . chainId ) ,
222
- bnToRlp ( this . nonce ) ,
223
- bnToRlp ( this . gasPrice ) ,
224
- bnToRlp ( this . gasLimit ) ,
225
- this . to !== undefined ? this . to . buf : Buffer . from ( [ ] ) ,
226
- bnToRlp ( this . value ) ,
227
- this . data ,
228
- this . accessList ,
229
- ]
224
+ const base = this . raw ( true ) . slice ( 0 , 8 )
230
225
return keccak256 ( Buffer . concat ( [ Buffer . from ( '01' , 'hex' ) , rlp . encode ( base ) ] ) )
231
226
}
232
227
@@ -322,7 +317,6 @@ export default class EIP2930Transaction extends BaseTransaction<EIP2930Transacti
322
317
}
323
318
324
319
public hash ( ) : Buffer {
325
- // TODO add decorator
326
320
if ( ! this . isSigned ( ) ) {
327
321
throw new Error ( 'Cannot call hash method if transaction is not signed' )
328
322
}
0 commit comments