Skip to content

Unable to get "maxFeePerGas" and "maxPriorityFeePerGas" for BNB chain #5050

@EricxStone

Description

@EricxStone

Ethers Version

6.15.0

Search Terms

BNB Chain, maxFeePerGas, maxPriorityFeePerGas

Describe the Problem

Unable to get maxFeePerGas and maxPriorityFeePerGas for BNB chain. The values returned are null. This issue only happens on BNB chain but not other major chains like Ethereum, Base, etc. It is not RPC specific too.

The fee data returned:

FeeData {
  gasPrice: 100000000n,
  maxFeePerGas: null,
  maxPriorityFeePerGas: null
}

If I downgrade the lib to Ethers v5, I am able to get the value.

{
  lastBaseFeePerGas: BigNumber { _hex: '0x00', _isBigNumber: true },
  maxFeePerGas: BigNumber { _hex: '0x59682f00', _isBigNumber: true },
  maxPriorityFeePerGas: BigNumber { _hex: '0x59682f00', _isBigNumber: true },
  gasPrice: BigNumber { _hex: '0x05f5e100', _isBigNumber: true }
}

Code Snippet

This is how I get the fee data:

const provider = new providers.StaticJsonRpcProvider({url, timeout}, parseInt("56"));
const gasFeeData: FeeData = await provider.getFeeData();

Contract ABI

Errors

Environment

node.js (v12 or newer)

Environment (Other)

No response

Metadata

Metadata

Assignees

Labels

investigateUnder investigation and may be a bug.v6Issues regarding v6

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions