Unable to call function from smart contract using web3.js

Viewed 18

I am trying to call a function from my smart contract using web3 and react. Here is my code.

app.js
    const project=new web3.eth.Contract(Mycontractabi.abi,networkData.address);
    const retailer=await project.getretailer.call();
    console.log(retailer);

contract:
    address public  retailer
    function getretailer() public view returns (address)
    {
        return retailer;
    }

Kindly point out what is wrong as I am not able to get retailer address as desired by the code

0 Answers
Related