Y

Ethers/6/Providers

How to Use
Run this codemod on your codebase using one of the following commands

The easiest way to run this codemod without installing anything globally:

Documentation

In addition to all the ethers.providers.* being moved to ethers.*, the biggest change developers need to keep in mind is that Web3Provider (which historically was used to wrap link-web3 providers) is now called BrowserProvider which is designed to wrap EIP-1193 providers, which is the standard that both modern Web3.js and injected providers offer.

Example

Before

ts

After

ts

Method for broadcasting transactions to the network has changed

Before

ts

After

ts

The StaticJsonRpcProvider in v5 is now integrated into the v6 JsonRpcProvider directly. When connecting to a network which cannot change its network, it is much more efficient to disable the automatic safety check ethers performs.

Before

ts

After

ts

Since the fees for Ethereum chains has become more complicated, all Fee parameters in v6 were coalesced into a single .getFeeData method. While gasPrice is no longer widely used in modern networks, when using a legacy network, it is available using that method.

Before

ts

After

ts

Ready to contribute?

Build your own codemod and share it with the community.