Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit f87e165

Browse files
fix: revert the changes and just spread extra fields
1 parent 7e57cbe commit f87e165

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

packages/web3-eth/src/utils/prepare_transaction_for_signing.ts

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,25 @@ import { transactionBuilder } from './transaction_builder.js';
3434

3535
const 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

5557
const getEthereumjsTransactionOptions = (
5658
transaction: FormatType<PopulatedUnsignedTransaction, typeof ETH_DATA_FORMAT>,

0 commit comments

Comments
 (0)