I am tryin to call a function of a contract. I am hosting a local node with hardhat, to which I obviously deploy the contract. Connecting MetaMask and all works without a problem. In the console I can also see, that the contract gets called on the node. In the documenation it says that the returned value should be the actual integer. But I am only getting the following output:
Object { _hex: "0x042deee8d42de3f0", _isBigNumber: true }
The contract call looks like this:
const contractAddress = "address",
const abi = ["function getBalance() public view returns (uint256)"]
const provider = new ethers.providers.Web3Provider(window.ethereum)
await provider.send("eth_requestAccounts", [])
let contract = new ethers.Contract(contractAddress, abi, provider)
const balance = await contract.getBalance()
console.log("Balance: ", balance)
How can I get the actual integer value?