You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 24, 2022. It is now read-only.
If I define a contract with an overloaded function, then try to call the function from the parity.js contract instance, I can only access one of the functions by name.
e.g.
contractC {
function myFunc(addressa) { return; }
function myFunc(addressa, uintb) { return; }
}
// after getting contract instancestheContract.instance.myFunc.call({},['0x0']);// errors due to missing property in arraytheContract.instance.myFunc.call({},['0x0',22]);// works fine
Workaround right now is to use the function signature bytes, (something like theContract.instance.be45fd62.call) which are different for each of the functions.
The code that causes this behaviour is here, where the value of the property corresponding to the function name is overwritten.
One possible fix would be to make contract.instance.myFunc dynamically determine which signature should be called based on the types of the arguments, and then call with the correct function signature based on that. The issue I see with this approach is that js is not typed the same way solidity is, so inferring the types may not be accurate.
Edit:
Seems like web3 handles it like this (setting key as func(argType1,argType2)), and this (choosing the function with the correct "shape" of parameters, if only one such function exists).
The text was updated successfully, but these errors were encountered:
From parity-js/api#8
If I define a contract with an overloaded function, then try to call the function from the parity.js contract instance, I can only access one of the functions by name.
e.g.
Workaround right now is to use the function signature bytes, (something like
theContract.instance.be45fd62.call
) which are different for each of the functions.The code that causes this behaviour is here, where the value of the property corresponding to the function name is overwritten.
One possible fix would be to make
contract.instance.myFunc
dynamically determine which signature should be called based on the types of the arguments, and then call with the correct function signature based on that. The issue I see with this approach is that js is not typed the same way solidity is, so inferring the types may not be accurate.Edit:
Seems like web3 handles it like this (setting key as
func(argType1,argType2)
), and this (choosing the function with the correct "shape" of parameters, if only one such function exists).The text was updated successfully, but these errors were encountered: