Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Throw a new error with the list of methods found compatible when calling an overloading smart contract method with inputs that fits more than one #6923

@Muhammad-Altabba

Description

@Muhammad-Altabba

In case of smart contract methods overloading, if there is more than one smart contract method that is compatible with a given input, the current code will use the first method mentioned in the ABI. This means for a smart contract method that accepts for example, either string or address, and the ABI of the method that accept string in the input exists before the other overloading function, then the code will use the string overloading even if the value provided was an address. This is because every address is a string. And the code currently handles it by picking just the first match of the overloading method found.

Expected behavior

For the above case, an error should be thrown because of ambiguity.

Actual behavior

In the mentioned case the current code just picks the first method found in the ABI and use it.

Where to change in the code

https://github.com/web3/web3.js/pull/6922/files#diff-7fa8f782e68ce845dbb6e8446b86041697fa427db5485b9c63bf689d0b32ed81R1091

Metadata

Metadata

Assignees

No one assigned

    Labels

    5.x5.0 related issuesStaleHas not received enough activity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions