Ethers/6/Importing

1.0.0Last update Aug 25, 2024
by@yugal41735

This codemod helps in tranformation, related to some import packages.

In v5, the project was maintained as a large set of sub-packages managed as a monorepo.

In v6 all imports are available in the root package, and for those who wish to have finer-grained control, the pkg.exports makes certain folders available directly.

Example

Before

import { InfuraProvider } from '@ethersproject/providers';

After

import { InfuraProvider } from 'ethers/providers';

,

Before

// in v5, some packages were grouped behind an additional property
import { providers } from "ethers"
// And then we could retrieve the below package
const { InfuraProvider } = providers;
// PS: this codemod transforms the above line only,
// import line in this before claus had to be removed manually

After

// Everything is available on the root package
import { InfuraProvider } from 'ethers';

Build custom codemods

Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community

background illustrationGet Started Now