Documentation ¶
Index ¶
- func FormatWei(i *big.Int) string
- type Eth
- func (e *Eth) Cmp(y *Eth) int
- func (e *Eth) IsZero() bool
- func (e Eth) MarshalJSON() ([]byte, error)
- func (e *Eth) MarshalText() ([]byte, error)
- func (e *Eth) Scan(value interface{}) error
- func (e *Eth) SetInt64(w int64) *Eth
- func (e *Eth) SetString(s string, base int) (*Eth, bool)
- func (e *Eth) String() string
- func (*Eth) Symbol() string
- func (e *Eth) ToInt() *big.Int
- func (e *Eth) UnmarshalJSON(data []byte) error
- func (e *Eth) UnmarshalText(text []byte) error
- func (e Eth) Value() (driver.Value, error)
- type Wei
- func (w *Wei) Add(y *Wei) *Wei
- func (w *Wei) AddPercentage(percentage uint16) *Wei
- func (w *Wei) Cmp(y *Wei) int
- func (w *Wei) Equal(y *Wei) bool
- func (w *Wei) Int64() int64
- func (w *Wei) IsNegative() bool
- func (w *Wei) IsZero() bool
- func (w *Wei) MarshalText() ([]byte, error)
- func (w *Wei) Mul(y *big.Int) *Wei
- func (w *Wei) Scan(value interface{}) error
- func (w *Wei) String() string
- func (w *Wei) Sub(y *Wei) *Wei
- func (w *Wei) Text(suffix string) string
- func (w *Wei) ToInt() *big.Int
- func (w *Wei) UnmarshalText(b []byte) error
- func (w Wei) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Eth ¶
Eth contains a field to represent the smallest units of ETH
func NewEthValue ¶
NewEthValue returns a new struct to represent ETH from it's smallest unit (wei)
func NewEthValueS ¶
NewEthValueS returns a new struct to represent ETH from a string value of Eth (not wei) the underlying value is still wei
func (Eth) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (*Eth) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*Eth) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
func (*Eth) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type Wei ¶
Wei extends ubig.Big to implement encoding.TextMarshaler and encoding.TextUnmarshaler with support for unit suffixes, as well as additional functions
func Ether ¶
func Ether[T constraints.Signed](n T) *Wei
func GWei ¶
func GWei[T constraints.Signed](n T) *Wei
func NewWeiI ¶
func NewWeiI[T constraints.Signed](i T) *Wei
func UEther ¶
func UEther[T constraints.Signed](n T) *Wei
UEther converts units of micro-ether (terawei) into wei