How can I read smart contract mapping in my frontend with ethers js?

Viewed 73

I wrote this command to return uint corresponding to the address in solidity.

mapping(address => uint256) public votesOf;

Now I want to read this in my frontend. I have used following code but it isn't working.

async function get_voting_results() {
const vote_result = await contract.isVoted["0xF2F823bAA7CABe76b35ad97a5039c20D36edd9a2"]
console.log(vote_result)
}

I've also tried using tuples but didn't make any change. Note I am using ethers js. Thank you

0 Answers
Related