ethers.js icon indicating copy to clipboard operation
ethers.js copied to clipboard

Add support for linea_estimateGas

Open phoax opened this issue 1 year ago • 6 comments

Linea, a layer 2 blockchain, supports the Ethereum EIP-1559 gas price model, known for making transaction fees more predictable. Unlike the base Ethereum layer, Linea aims to offer a more stable and cost-effective approach to handling transaction fees. For detailed information, you can visit Linea's Gas Fees Documentation.

To further enhance the efficiency of transaction fee calculations, Linea has introduced a new RPC method designed to provide the best gas price estimates. This new method is documented in detail here.

The introduction of this new RPC method necessitates changes in how web3 libraries calculate gas prices. Traditionally, these libraries used the eth_gasPrice method. Linea's update shifts this approach to utilize the newly introduced linea_estimateGas method.

Detailed summary

  • Added linea_estimateGas plugin to calculate accurate gas price on Linea network
  • Updated getFeeData to pass the transaction data

phoax avatar Feb 13 '24 13:02 phoax

Hey @ricmoo, Do you have a rough idea when this PR might be reviewed? This would be super useful for users to get cheaper gas price on Linea. If there's anything we can do to make the review smoother, just let us know. Happy to help out! Thanks a lot for your time, and for the awesome work you do with ethers.js

arthur-remy avatar Mar 26 '24 17:03 arthur-remy

Hi @ricmoo,

I hope you're doing well. I wanted to kindly follow up on our PR regarding the gas price optimization for Linea users. We believe this feature could significantly benefit ethers.js users by facilitating cheaper gas prices.

If there's any additional information or adjustments needed to streamline the review process, please let us know. We're eager to contribute and make any necessary changes to align with the project's standards.

Thank you for your time and the amazing work you do with ethers.js. Looking forward to your feedback

wantedsystem avatar May 07 '24 14:05 wantedsystem

Heya!

I can review it this week. I have a minor version going out tonight, but will look into this to see if it needs a minor version bump or not.

ricmoo avatar Jun 03 '24 18:06 ricmoo

This change looks like it requires significant API changes (it is adding a parameter to .getFeeData signature, for example). But there is probably another way to fit this into the existing API. Keep in mind changing signatures requires fairly strong motivation.

Can you also not include the build files? It makes it much harder to compare the diff. Only changes to /src.ts should be in a PR.

ricmoo avatar Jun 03 '24 18:06 ricmoo

Hello @ricmoo i excluded the build files and added support pricing plugin to linea-sepolia

wantedsystem avatar Jun 04 '24 16:06 wantedsystem