ethers.utils.formatEther(10000000000, "ether") not working using ether.js

517 views Asked by At

**CODE : ** const balanceEther = await ethers.utils.formatEther(10000000000, "ether");

ISSUE I write this line of code nd it shows the error written below ..

ERROR : TypeError: Cannot read properties of undefined (reading 'formatEther')

According to me it should have to convert the value of Wei to Ether but its showing the error...

1

There are 1 answers

0
Ronak Bharadiya On BEST ANSWER

you can use formatUnits function for convert

const {ethers,formatUnits} =require('ethers');
console.log(formatUnits(1000000000000,"ether"));

this can help you for conversion