wevm / abitype

Strict TypeScript types for Ethereum ABIs
https://abitype.dev
MIT License
479 stars 42 forks source link

parseAbi fails when the human readable ABI contains a `fallback()` function #253

Open joaquim-verges opened 2 weeks ago

joaquim-verges commented 2 weeks ago

Describe the bug

Works fine with receive(), but fallback() throws an error. See steps to reproduce below.

Link to Minimal Reproducible Example

No response

Steps To Reproduce

    const abi = formatAbi([
      {
        stateMutability: "payable",
        type: "fallback",
        inputs: [],
        outputs: [],
      },
    ]);
    const abi2 = parseAbi(abi);
    // throws
    // UnknownSignatureError: Unknown signature.
    // Details: fallback()
    // Version: abitype@1.0.5

Package Version

1.0.5

TypeScript Version

5.0.4

Check existing issues

Anything else?

No response

Raiden1411 commented 16 hours ago

This was changed in #229 but the format function change wasn't made to accommodate to those changes. See here.

You can create a PR with these changes if you want.