Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6801 Fill gas price when baseFeePerGas==='0x0' #7050

Merged
merged 9 commits into from
May 22, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions packages/web3-eth/src/utils/get_transaction_gas_pricing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,17 @@
web3Context: Web3Context<EthExecutionAPI>,
returnFormat: ReturnFormat,
): Promise<FormatType<{ maxPriorityFeePerGas?: Numbers; maxFeePerGas?: Numbers }, ReturnFormat>> {
const block = await getBlock(web3Context, web3Context.defaultBlock, false, returnFormat);

const block = await getBlock(web3Context, web3Context.defaultBlock, false, ETH_DATA_FORMAT);
if (isNullish(block.baseFeePerGas)) throw new Eip1559NotSupportedError();

if (!isNullish(transaction.gasPrice)) {
let gasPrice: Numbers | undefined;
if (isNullish(transaction.gasPrice) && BigInt(block.baseFeePerGas) === BigInt(0)) {
gasPrice = await getGasPrice(web3Context, returnFormat);

Check warning on line 46 in packages/web3-eth/src/utils/get_transaction_gas_pricing.ts

View check run for this annotation

Codecov / codecov/patch

packages/web3-eth/src/utils/get_transaction_gas_pricing.ts#L46

Added line #L46 was not covered by tests
}
if (!isNullish(transaction.gasPrice) || !isNullish(gasPrice)) {
const convertedTransactionGasPrice = format(
{ format: 'uint' },
transaction.gasPrice as Numbers,
transaction.gasPrice ?? gasPrice,

Check warning on line 51 in packages/web3-eth/src/utils/get_transaction_gas_pricing.ts

View check run for this annotation

Codecov / codecov/patch

packages/web3-eth/src/utils/get_transaction_gas_pricing.ts#L51

Added line #L51 was not covered by tests
avkos marked this conversation as resolved.
Show resolved Hide resolved
returnFormat,
);

Expand Down
Loading