Assess, plan, evolve.
Reusable compiler-aware skills that help coding agents understand, plan, and safely evolve your codebase.
15 packages
EtherMod — automatically migrate ethers.js v5 to v6. Handles utils/providers namespace flattening, BigNumber → bigint, Web3Provider → BrowserProvider, and import cleanup.
- ethers
- web3
- +4
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 provider = new ethers.providers.Web3Provider(window.ethereum); ``` ### After ```ts provider = new ethers.BrowserProvider(window.ethereum); ``` Method for broadcasting transactions to the network has changed ### Before ```ts provider.sendTransaction(signedTx); ``` ### After ```ts provider.broadcastTransaction(signedTx); ``` 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 provider = new StaticJsonRpcProvider(url, network); ``` ### After ```ts // This method is involved in tranformation // v6: If you know the network ahead of time and wish to avoid even a single eth_chainId call provider = new JsonRpcProvider(url, network, { staticNetwork: network, }); // If you want to transform your StaticJsonRpcProvider into below method you have to do it manually // v6: If you want the network automatically detected, this will query eth_chainId only once provider = new JsonRpcProvider(url, undefined, { staticNetwork: true, }); ``` 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 await provider.getGasPrice(); ``` ### After ```ts (await provider.getFeeData()).gasPrice; ```
- ethers.js
- migration
This codemod migrates **BigNumber** in v5 to **BigInt** in v6 in **ethers.js** library. It also changes the syntax for addition, and checking equality according to v6. ## Example ### Before ```ts // Using BigNumber in v5 value = BigNumber.from("1000"); // Adding two values in v5 sum = value1.add(value2); // Checking equality in v5 isEqual = value1.eq(value2); ``` ### After ```ts // Using BigInt in v6 value = BigInt("1000"); // Addition, keep in mind, both values must be a BigInt sum = value1 + value2; // Checking equality isEqual = value1 == value2; ```
- ethers.js
Migrate Ethers.js v5 to v6 with Rigorous Math Sentinel
- ethers
- web3
- +2
This codemod does tranformation based on changes in the utils in ethers.js ## Example Byte32 string helpers ### Before ```ts bytes32 = ethers.utils.formatBytes32String(text); text = ethers.utils.parseBytes32String(bytes32); ``` ### After ```ts bytes32 = ethers.encodeBytes32String(text); text = ethers.decodeBytes32String(bytes32); ``` Constants ### Before ```ts ethers.constants.AddressZero; ethers.constants.HashZero; ``` ### After ```ts ethers.ZeroAddress; ethers.ZeroHash; ``` Data Manipulation ### Before ```ts slice = ethers.utils.hexDataSlice(value, start, end); padded = ethers.utils.hexZeroPad(value, length); hex = hexlify(35); ``` ### After ```ts slice = ethers.dataSlice(value, start, end); padded = ethers.zeroPadValue(value, length); // v6; converting numbers to hexstrings hex = toBeHex(35); ``` Deafult AbiCoder ### Before ```ts // In v5, it is a property of AbiCoder coder = AbiCoder.defaultAbiCoder; ``` ### After ```ts // In v6, it is a static function on AbiCoder coder = AbiCoder.defaultAbiCoder(); ``` Hex Conversion ### Before ```ts hex = ethers.utils.hexValue(value); array = ethers.utils.arrayify(value); ``` ### After ```ts hex = ethers.toQuantity(value); array = ethers.getBytes(value); ``` Solidity non-standard packed ### Before ```ts ethers.utils.solidityPack(types, values); ethers.utils.solidityKeccak256(types, values); ethers.utils.soliditySha256(types, values); ``` ### After ```ts ethers.solidityPacked(types, values); ethers.solidityPackedKeccak256(types, values); ethers.solidityPackedSha256(types, values); ``` Property Manipulation ### Before ```ts ethers.utils.defineReadOnly(obj, "name", value); ``` ### After ```ts ethers.defineProperties(obj, { name: value }); ``` Above were some transformation, that were done in utilities section of ethers, now below are some cleanups and breaking changes. PS: These changes are not done using codemod. **Fetching content** Basic Fetch with Json ### Before ```ts data = await ethers.utils.fetchJson(url, json, processFunc); ``` ### After ```ts const req = new ethers.FetchRequest(url); req.body = json; req.processFunc = processFunc; const resp = await req.send(); data = resp.bodyJson; // or resp.bodyText / resp.body depending on the desired format ``` Fetch with Connection Overrides: ### Before ```ts req = { url: url, user: "username", password: "password", // etc. properties have FetchRequest equivalents }; data = await ethers.utils.fetchJson(req, json, processFunc); ``` ### After ```ts const req = new ethers.FetchRequest(url); req.setCredentials("username", "password"); req.body = json; req.processFunc = processFunc; const resp = await req.send(); data = resp.bodyJson; // or resp.bodyText / resp.body depending on the desired format ```
- ethers.js
- migration
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 ```ts import { InfuraProvider } from "@ethersproject/providers"; ``` ### After ```ts import { InfuraProvider } from "ethers/providers"; ``` , ### Before ```ts // 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 ```ts // Everything is available on the root package import { InfuraProvider } from "ethers"; ```
- ethers.js
- migration
The Signature is now a class which facilitates all the parsing and serializing. ## Example ### Before ```ts splitSig = splitSignature(sigBytes); ``` ### After ```ts splitSig = ethers.Signature.from(sigBytes); ``` , ### Before ```ts sigBytes = joinSignature(splitSig); ``` ### After ```ts sigBytes = ethers.Signature.from(splitSig).serialized; ```
- ethers.js
- migration
Automatically migrates ethers.js v5 code to v6 using jssg. Supports JavaScript and TypeScript.
- upgrade
- breaking-change
- +2
Migrate ethers.js v5 BigNumber to native BigInt (ethers v6)
- transformation
- migration
- +5
Automates 90.3% of the ethers.js v5 to v6 migration. Handles BigNumber to bigint, utils namespace, provider renames, constants, contract method buckets, and more.
Automated migration from ethers.js v5 to v6. Covers 80%+ of deterministic changes: import paths, namespace flattening, BigNumber→bigint, contract patterns, provider/signer renames, and utility function updates.
- ethers
- ethersjs
- +8
Automated migration from ethers.js v5 to v6. Covers 80%+ of deterministic changes: import paths, namespace flattening, BigNumber→bigint, contract patterns, provider/signer renames, and utility function updates.
- ethers
- ethersjs
- +8
Ready to evolve your codebase?
Build tailored, compiler-aware skills to assess, plan, and automate complex codebase changes.