Documentation ¶
Index ¶
- func GWeiToString(input uint64, standard bool) string
- func StringToGWei(input string) (uint64, error)
- func StringToWei(input string) (*big.Int, error)
- func UnitToMultiplier(unit string) (*big.Int, error)
- func WeiToGWeiString(input *big.Int) string
- func WeiToString(input *big.Int, standard bool) string
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GWeiToString ¶ added in v1.1.0
GWeiToString turns a number of GWei in to a string. See WeiToString for details.
func StringToGWei ¶ added in v1.1.0
StringToGWei turns a string in to number of GWei. See StringToWei for details. Any part of the value below 1GWei in denomination is lost.
func StringToWei ¶
StringToWei turns a string in to number of Wei. The string can be a simple number of Wei, e.g. "1000000000000000" or it can be a number followed by a unit, e.g. "10 ether". Unit names are case-insensitive, and can be either given names (e.g. "finney") or metric names (e.g. "mlliether"). Note that this function expects use of the period as the decimal separator.
func UnitToMultiplier ¶
UnitToMultiplier takes the name of an Ethereum unit and returns a multiplier.
Example ¶
package main import ( "fmt" string2eth "github.com/wealdtech/go-string2eth" ) func main() { multiplier, err := string2eth.UnitToMultiplier("ether") if err != nil { return } fmt.Println(multiplier.Text(10)) }
Output: 1000000000000000000
func WeiToGWeiString ¶ added in v1.2.0
WeiToGWeiSTring turns a number of wei in to a Gwei string.
Types ¶
This section is empty.