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.

Types for the overloaded ABI functions are not supported #5207

@nazarhussain

Description

@nazarhussain

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

If we have a contract with overloaded methods, the types does not support those.

contract FuncOverload {    
  address owner;    
  
  constructor() public {        
    owner = msg.sender;    
  }    
  
  function transfer(address _to, uint _amount) public returns (bool) {
    return doTransfer(_to, _amount);    
  }    
  function transfer(address _to) public returns (bool) {        
    return doTransfer(_to, 1 ether);
  }
}

Expected Behavior

The type should detect and throw error on compile time, if user pass different number of arguments for overloaded functions.

Steps to Reproduce

await myContract.methods.transer(address).send();
await myContract.methods.transer(address, 10000).send();

Web3.js Version

4.x

Environment

  • Operating System:
  • Browser:
  • Node.js Version:
  • NPM Version:

Anything Else?

In alpha release of 4.x the the behavior exists but the types does not support. For now use as any to bypass this check.

Metadata

Metadata

Assignees

No one assigned

    Labels

    4.x4.0 relatedBugAddressing a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions