TypeChain icon indicating copy to clipboard operation
TypeChain copied to clipboard

Compile errors with generated code on ABI containing "gas" field

Open joshlang opened this issue 2 years ago • 0 comments

When copy/pasting an ABI from Etherscan, it helpfully includes a gas field. For example, search 0xB9fC157394Af804a3578134A6585C0dc9cc990d4 on etherscan, click "Contract" and scroll down to find the contract ABI.

Typechain processes it, but spits out code that won't compile (incompatible type assignment)

However, if I preprocess the abi by removing all the gas fields, everything works just fine.

(example of what I use to preprocess)

function fixAbi(abi) {
    for (const item of abi) {
        if (item.gas) { delete item.gas }
    }
}

joshlang avatar Oct 03 '22 00:10 joshlang