Documentation
¶
Index ¶
- Constants
- func SetPrecision(prec uint)
- type Unit
- func NewEther(value *big.Float) *Unit
- func NewFinney(value *big.Float) *Unit
- func NewGWei(value *big.Float) *Unit
- func NewKWei(value *big.Float) *Unit
- func NewMWei(value *big.Float) *Unit
- func NewSzabo(value *big.Float) *Unit
- func NewWei(value *big.Int) *Unit
- func ParseUnit(value *big.Float, unit string) (*Unit, error)
Constants ¶
const (
Ether = 1
)
const (
Finney = 1e3
)
const (
GWei = 1e9
)
const (
KWei = 1e15
)
const (
MWei = 1e12
)
const (
Szabo = 1e6
)
const (
Wei = 1e18
)
Variables ¶
This section is empty.
Functions ¶
func SetPrecision ¶
func SetPrecision(prec uint)
SetPrecision set the precision value for big.Float. Decrease value for faster conversion. Increase value if you need to work with very small or very large numbers. It is very easy to understand that you need to increase this value. For example: if you convert 1e1000 number and receive not zeros in the end of number then increase value.
Types ¶
type Unit ¶
Unit store value in Wei unit. Wei should be always big.Int.
func NewEther ¶
NewEther create instance of Unit with convert Ether to Wei units and returns pointer to it. Then you can use Unit for get the value in supported units.
func NewFinney ¶
NewFinney create instance of Unit with convert Finney to Wei units and returns pointer to it. Then you can use Unit for get the value in supported units.
func NewGWei ¶
NewGWei create instance of Unit with convert GWei to Wei units and returns pointer to it. Then you can use Unit for get the value in supported units.
func NewKWei ¶
NewKWei create instance of Unit with convert KWei to Wei units and returns pointer to it. Then you can use Unit for get the value in supported units.
func NewMWei ¶
NewMWei create instance of Unit with convert MWei to Wei units and returns pointer to it. Then you can use Unit for get the value in supported units.
func NewSzabo ¶
NewSzabo create instance of Unit with convert Szabo to Wei units and returns pointer to it. Then you can use Unit for get the value in supported units.