0
function getDetails(address publicKey) public view returns (Organization memory) {
    return s.getOrg(publicKey);
}

function getDetails(string calldata orgID) external view returns (Organization memory) {
    return s.getOrg(orgID);
}

so when i call this function from remix it works like charm but when i try to call it from my DAPP with web3 it shows error

invalid address (arg="publicKey", coderType="address", value="653e4140-da2205-13331e9-d44495f4-53a781aaaa1a23")

1

Javascript doesn't support polymorphism on the parameters when calling a function. With web3.js v1.xx you can specify the signature of the method you want to call. https://web3js.readthedocs.io/en/v1.2.0/web3-eth-contract.html#id12

myContract.methods['getDetails(string)'](..)

o

myContract.methods['getDetails(address)'](..)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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