Skip to main content

sdk.fromwei

Home > @openformat/sdk > fromWei

fromWei() function

Convert a wei amount as a BigNumber to its decimal Ether representation (ETH) as a string.

Signature:

export declare function fromWei(amount: BigNumberish): string;

Parameters

ParameterTypeDescription
amountBigNumberishThe wei amount to be converted to decimal Ether.

Returns:

string

{string} The converted decimal Ether amount as a string.

Example

const weiAmount = "10000000000000000" const decimalAmount = fromWei(weiAmount); console.log(decimalAmount); // "0.01"