amount

package
v0.0.0-...-8e9f79f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2018 License: LGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Zero = &Amount{Number: big.NewInt(0)}

Functions

This section is empty.

Types

type Amount

type Amount struct {
	Number *big.Int //wei
}

func FromEther

func FromEther(ether float64) *Amount

BUG:ether浮点数不能超过20位

func FromHex

func FromHex(hex string) (*Amount, error)

func NewAmount

func NewAmount(i interface{}) *Amount

func (*Amount) FormatEther

func (a *Amount) FormatEther(decimals float64) float64

FormatEther 返回浮点数 单位:ETH

func (*Amount) Mul

func (a *Amount) Mul(b uint64) *Amount

func (*Amount) ParseEther

func (a *Amount) ParseEther() *big.Int

ParseEther 返回整数 单位:Wei

func (Amount) ToEtherStr

func (a Amount) ToEtherStr(decimals float64) string

ToEtherStr 返回基于eth的小数字符串 单位:ETH

func (*Amount) ToHex

func (a *Amount) ToHex() string

func (*Amount) ToWei

func (a *Amount) ToWei() *big.Int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL