@@ -73,11 +73,12 @@ export default class AccessListEIP2930Transaction extends BaseTransaction<Access
73
73
}
74
74
75
75
const values = rlp . decode ( serialized . slice ( 1 ) )
76
+
76
77
if ( ! Array . isArray ( values ) ) {
77
78
throw new Error ( 'Invalid serialized tx input: must be array' )
78
79
}
79
80
80
- return AccessListEIP2930Transaction . fromValuesArray ( values , opts )
81
+ return AccessListEIP2930Transaction . fromValuesArray ( values as any , opts )
81
82
}
82
83
83
84
/**
@@ -99,16 +100,15 @@ export default class AccessListEIP2930Transaction extends BaseTransaction<Access
99
100
* The format is:
100
101
* chainId, nonce, gasPrice, gasLimit, to, value, data, access_list, yParity (v), senderR (r), senderS (s)
101
102
*/
102
- public static fromValuesArray ( values : ( Buffer | AccessListBuffer ) [ ] , opts : TxOptions = { } ) {
103
+ public static fromValuesArray ( values : AccessListEIP2930ValuesArray , opts : TxOptions = { } ) {
103
104
if ( values . length !== 8 && values . length !== 11 ) {
104
105
throw new Error (
105
106
'Invalid EIP-2930 transaction. Only expecting 8 values (for unsigned tx) or 11 values (for signed tx).'
106
107
)
107
108
}
108
109
109
- const [ chainId , nonce , gasPrice , gasLimit , to , value , data , accessList , v , r , s ] = <
110
- AccessListEIP2930ValuesArray
111
- > values
110
+ const [ chainId , nonce , gasPrice , gasLimit , to , value , data , accessList , v , r , s ] = values
111
+
112
112
const emptyBuffer = Buffer . from ( [ ] )
113
113
114
114
return new AccessListEIP2930Transaction (
@@ -147,7 +147,6 @@ export default class AccessListEIP2930Transaction extends BaseTransaction<Access
147
147
let usedAccessList
148
148
if ( accessList && isAccessList ( accessList ) ) {
149
149
this . AccessListJSON = accessList
150
-
151
150
const newAccessList : AccessListBuffer = [ ]
152
151
153
152
for ( let i = 0 ; i < accessList . length ; i ++ ) {
@@ -248,7 +247,7 @@ export default class AccessListEIP2930Transaction extends BaseTransaction<Access
248
247
*
249
248
* Use `serialize()` to add to block data for `Block.fromValuesArray()`.
250
249
*/
251
- raw ( ) : Buffer [ ] {
250
+ raw ( ) : AccessListEIP2930ValuesArray {
252
251
return [
253
252
bnToRlp ( this . chainId ) ,
254
253
bnToRlp ( this . nonce ) ,
@@ -257,7 +256,7 @@ export default class AccessListEIP2930Transaction extends BaseTransaction<Access
257
256
this . to !== undefined ? this . to . buf : Buffer . from ( [ ] ) ,
258
257
bnToRlp ( this . value ) ,
259
258
this . data ,
260
- < any > this . accessList ,
259
+ this . accessList ,
261
260
this . v !== undefined ? bnToRlp ( this . v ) : Buffer . from ( [ ] ) ,
262
261
this . r !== undefined ? bnToRlp ( this . r ) : Buffer . from ( [ ] ) ,
263
262
this . s !== undefined ? bnToRlp ( this . s ) : Buffer . from ( [ ] ) ,
@@ -268,15 +267,16 @@ export default class AccessListEIP2930Transaction extends BaseTransaction<Access
268
267
* Returns the serialized encoding of the transaction.
269
268
*/
270
269
serialize ( ) : Buffer {
271
- return Buffer . concat ( [ Buffer . from ( '01' , 'hex' ) , rlp . encode ( this . raw ( ) ) ] )
270
+ const base = this . raw ( )
271
+ return Buffer . concat ( [ Buffer . from ( '01' , 'hex' ) , rlp . encode ( base as any ) ] )
272
272
}
273
273
274
274
/**
275
275
* Computes a sha3-256 hash of the serialized unsigned tx, which is used to sign the transaction.
276
276
*/
277
277
getMessageToSign ( ) {
278
278
const base = this . raw ( ) . slice ( 0 , 8 )
279
- return keccak256 ( Buffer . concat ( [ Buffer . from ( '01' , 'hex' ) , rlp . encode ( base ) ] ) )
279
+ return keccak256 ( Buffer . concat ( [ Buffer . from ( '01' , 'hex' ) , rlp . encode ( base as any ) ] ) )
280
280
}
281
281
282
282
/**
0 commit comments