I am trying to call a pure function via ethers js and store the data in a variable. Now I supposed that variable to contain the return value from the contract, but instead, that variable contains transaction data, also when I call the function using the frontend button metamask pops up with gas fees. Possible fixes I tried:
- Checked the abi file if it stateMutability is pure or not.
- Used callStatic but it makes the contract's function name undefined.
Sharing the exact line link https://github.com/Zartaj0/BasicSignature/blob/2b020c3f2901c43340abf250cbe0d1101965692b/Frontend/src/VerifyMessage.js#L29
I am using local hardhat node for deployment. The contract is fine and everything is fine. The problem is, the function call should return the data without transaction from contract function but it creates a transaction. What can be the wrong thing I am doing?