@@ -34,23 +34,25 @@ import { transactionBuilder } from './transaction_builder.js';
3434
3535const getEthereumjsTxDataFromTransaction = (
3636 transaction : FormatType < PopulatedUnsignedTransaction , typeof ETH_DATA_FORMAT > ,
37- ) => {
38- const txData = { ...transaction } ;
39-
40- const aliases = [
41- [ 'input' , 'data' ] ,
42- [ 'gas' , 'gasLimit' ] ,
43- ] as const ;
44-
45- for ( const [ oldField , newField ] of aliases ) {
46- if ( typeof txData [ oldField ] !== 'undefined' ) {
47- txData [ newField ] = txData [ oldField ] ! ;
48- delete txData [ oldField ] ;
49- }
50- }
51-
52- return txData ;
53- } ;
37+ ) => ( {
38+ ...transaction ,
39+ gasPrice : transaction . gasPrice ,
40+ gasLimit : transaction . gasLimit ?? transaction . gas ,
41+ to : transaction . to ,
42+ value : transaction . value ,
43+ data : transaction . data ?? transaction . input ,
44+ type : transaction . type ,
45+ chainId : transaction . chainId ,
46+ accessList : (
47+ transaction as FormatType < PopulatedUnsignedEip2930Transaction , typeof ETH_DATA_FORMAT >
48+ ) . accessList ,
49+ maxPriorityFeePerGas : (
50+ transaction as FormatType < PopulatedUnsignedEip1559Transaction , typeof ETH_DATA_FORMAT >
51+ ) . maxPriorityFeePerGas ,
52+ maxFeePerGas : (
53+ transaction as FormatType < PopulatedUnsignedEip1559Transaction , typeof ETH_DATA_FORMAT >
54+ ) . maxFeePerGas ,
55+ } ) ;
5456
5557const getEthereumjsTransactionOptions = (
5658 transaction : FormatType < PopulatedUnsignedTransaction , typeof ETH_DATA_FORMAT > ,
0 commit comments