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.

contract method override types issues #6650

@luu-alex

Description

@luu-alex

We have an issue with the library with contract methods that are overriden, when there are multiple methods with the same name and different types, _createContractMethod will map the abi methods so that it will only use the first method type
issue is around here: https://github.com/web3/web3.js/blob/4.x/packages/web3-eth-contract/src/contract.ts#L1065
for example:

[
    ...,
    {
      inputs: [{ internalType: 'uint256', name: '_startTime', type: 'uint256' }],
      name: 'getPenaltyBP',
      outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
      stateMutability: 'view',
      type: 'function',
    },
    {
      inputs: [{ internalType: 'address', name: '_user', type: 'address' }],
      name: 'getPenaltyBP',
      outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
      stateMutability: 'view',
      type: 'function',
    },
]

calling contract.methods.getPenaltyBP("0xaceaEcB820Be3f147FF40d1C221B25F10ee8dd92").call().then(console.log) will result in the address converted into a uint and being encoded improperly

Expected behavior

contract.methods.getPenaltyBP("0xaceaEcB820Be3f147FF40d1C221B25F10ee8dd92").call().then(console.log) method should be encoded as an address

Actual behavior

Steps to reproduce the behavior

  1. [First step]
  2. [Second step]
  3. [and so on...]

Logs

Environment

Metadata

Metadata

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