WeiFormatter
in package
WeiFormatter class for parsing back and forth human-readable format with specific denominations of ether, most commonly used for WEI.
Tags
Table of Contents
Methods
- fromHuman() : OOGmp
- Converts a value from human format.
- fromWei() : string
- Converts Wei to another format.
- normalizeNumberString() : string
Methods
fromHuman()
Converts a value from human format.
public
static fromHuman(float|int|string|OOGmp $human[, int|string|EtherFormats $format = EtherFormats::ETHER ]) : OOGmp
Parameters
- $human : float|int|string|OOGmp
-
The input human value.
- $format : int|string|EtherFormats = EtherFormats::ETHER
-
The input format.
Return values
OOGmp —The value in Wei.
fromWei()
Converts Wei to another format.
public
static fromWei(int|string|OOGmp $wei, int $finalDecimals[, int|string|EtherFormats $format = EtherFormats::ETHER ]) : string
Parameters
- $wei : int|string|OOGmp
-
The input value in Wei.
- $finalDecimals : int
-
The final decimal places to keep.
- $format : int|string|EtherFormats = EtherFormats::ETHER
-
The output format.
Return values
string —The converted value.
normalizeNumberString()
private
static normalizeNumberString(float|int|string|OOGmp $value, int $decimals) : string
Parameters
- $value : float|int|string|OOGmp
- $decimals : int