@@ -246,52 +246,36 @@ export default class AccessListEIP2930Transaction extends BaseTransaction<Access
246
246
/**
247
247
* Returns a Buffer Array of the raw Buffers of this transaction, in order.
248
248
*
249
- * Note that if you want to use this function in a tx type independent way
250
- * to then use the raw data output for tx instantiation with
251
- * `Tx.fromValuesArray()` you should set the `asList` parameter to `true` -
252
- * which is ignored on a legacy tx but provides the correct format on
253
- * a typed tx.
254
- *
255
- * To prepare a tx to be added as block data with `Block.fromValuesArray()`
256
- * just use the plain `raw()` method.
257
- *
258
- * @param asList - By default, this method returns a concatenated Buffer
259
- * If this is not desired, then set this to `true`, to get a Buffer array.
249
+ * Use `serialize()` to add to block data for `Block.fromValuesArray()`.
260
250
*/
261
- raw ( asList = false ) : Buffer [ ] | Buffer {
262
- const base = < Buffer [ ] > [
251
+ raw ( ) : Buffer [ ] {
252
+ return [
263
253
bnToRlp ( this . chainId ) ,
264
254
bnToRlp ( this . nonce ) ,
265
255
bnToRlp ( this . gasPrice ) ,
266
256
bnToRlp ( this . gasLimit ) ,
267
257
this . to !== undefined ? this . to . buf : Buffer . from ( [ ] ) ,
268
258
bnToRlp ( this . value ) ,
269
259
this . data ,
270
- this . accessList ,
260
+ < any > this . accessList ,
271
261
this . v !== undefined ? bnToRlp ( this . v ) : Buffer . from ( [ ] ) ,
272
262
this . r !== undefined ? bnToRlp ( this . r ) : Buffer . from ( [ ] ) ,
273
263
this . s !== undefined ? bnToRlp ( this . s ) : Buffer . from ( [ ] ) ,
274
264
]
275
- if ( ! asList ) {
276
- return Buffer . concat ( [ Buffer . from ( '01' , 'hex' ) , rlp . encode ( base ) ] )
277
- } else {
278
- return base
279
- }
280
265
}
281
266
282
267
/**
283
- * Returns the encoding of the transaction. For typed transaction, this is the raw Buffer.
284
- * In Transaction, this is a Buffer array.
268
+ * Returns the serialized encoding of the transaction.
285
269
*/
286
270
serialize ( ) : Buffer {
287
- return < Buffer > this . raw ( )
271
+ return Buffer . concat ( [ Buffer . from ( '01' , 'hex' ) , rlp . encode ( this . raw ( ) ) ] )
288
272
}
289
273
290
274
/**
291
275
* Computes a sha3-256 hash of the serialized unsigned tx, which is used to sign the transaction.
292
276
*/
293
277
getMessageToSign ( ) {
294
- const base = this . raw ( true ) . slice ( 0 , 8 )
278
+ const base = this . raw ( ) . slice ( 0 , 8 )
295
279
return keccak256 ( Buffer . concat ( [ Buffer . from ( '01' , 'hex' ) , rlp . encode ( base ) ] ) )
296
280
}
297
281
0 commit comments