Been looking at Interface class of Ethers library https://docs.ethers.io/v5/api/utils/abi/interface/#Interface--creating

and would like to test it like below, but not sure how to import this class and FormatTypes from Ethers. I get now "Interface is not defined" using

import { ethers } from "ethers";
const iface = new Interface(humanReadableAbi);
jsonAbi = iface.format(FormatTypes.json);
JSON.stringify(JSON.parse(jsonAbi), null, 2);

1 Answer 1


Still getting grasp with JS and how libraries are structured. Found it out by inspecting code of ethers library. So for this it is

import { FormatTypes, Interface } from "@ethersproject/abi";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.