formatEther

Learn about the formatEther utils method

Learn about the formatEther utils method

Introduction

The formatEther method is used to format a value in wei to a more human-readable string representation in ether.

Usage

The formatEther method can be used to format a value in Wei to Ether. This can be useful when working with Ether amounts in your code. Here’s an example of how you can use it:

Javascript
1const { Utils } = require("alchemy-sdk");
2
3let weiValue = "1000000000000000000";
4let formattedEther = Utils.formatEther(weiValue);
5console.log(formattedEther); // '1.0 ETH'