I do not have the json interface as ABI, how can I construct the calldata?

This does not work because encodeFunctionCall does not accept string as method signature:

web3.eth.abi.encodeFunctionCall('upgradeToAndCall(address, bytes memory)', [arg1, arg2])

Does anyone know?

P.S: It's weird that encodeFunctionSignature accepts string as method signature

1 Answer 1


Instead of encodeFunctionCalll, you can use function(parameters).encodeABI()

Check here: https://web3js.readthedocs.io/en/v1.2.11/web3-eth-contract.html#methods-mymethod-encodeabi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.