Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use web3.fromWei

Shulou Source: shulou.com Published: 2022-06-01 08:02:06 11月16日 Update

This article mainly explains "how to use web3.fromWei". Friends who are interested might as well take a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn how to use web3.fromWei.

The conversion between the currency units of Yi Tai Fong. Converts funds in wei to the value of the specified unit:

Call:

Web3.fromWei (number, unit)

Parameters:

Number:. Number | String | BigNumber-numeric or BigNumber.

Unit:. String-Unit string

The available values of monetary units are as follows

Kwei/ada

Mwei/babbage

Gwei/shannon

Szabo

Finney

Ether

Kether/grand/einstein

Mether

Gether

Tether

Return value:

String | BigNumber-A string in the form of a string or BigNumber, depending on the parameters passed in.

Example:

Var value = web3.fromWei ('21000000000000000,' finney'); console.log (value); / / "0.021" so far, I believe you have a better understanding of "how to use web3.fromWei". You might as well do it in practice! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Unit character string content parameter currency learning different practical deeper between interest practicality actual form simple operation numerical value number method more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Docker MySQL Redmi Apple