Yyugal41735

Ethers/6/Providers

No description available

ethers.jsmigration
Public
1 executions

Run locally

npx codemod Ethers/6/Providers

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 evolve your codebase?

Build tailored, compiler-aware skills to assess, plan, and automate complex codebase changes.