utils

package
v0.0.0-...-57b9f6b Latest Latest
Warning

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

Go to latest
Published: May 21, 2021 License: LGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeToHex

func EncodeToHex(b []byte) string

func EncodeUintToHex

func EncodeUintToHex(i uint64) string

func Ether

func Ether(i uint64) *big.Int

Ether converts a value to the ether unit with 18 decimals

func ParseBigInt

func ParseBigInt(str string) *big.Int

func ParseHexBytes

func ParseHexBytes(str string) ([]byte, error)

func ParseUint64orHex

func ParseUint64orHex(str string) (uint64, error)

Types

type EtherUnit

type EtherUnit int
const (
	EtherUnitNoEther EtherUnit = iota
	EtherUnitWei
	EtherUnitKWei
	EtherUnitMWei
	EtherUnitGWei
	EtherUnitSzabo
	EtherUnitFinney
	EtherUnitEther
)

type Utils

type Utils struct{}

func NewUtils

func NewUtils() *Utils

func (*Utils) DifferentAddress

func (u *Utils) DifferentAddress(a, b common.Address) bool

func (*Utils) EncodeFunctionSignature

func (u *Utils) EncodeFunctionSignature(funcName string) []byte

func (*Utils) FromWei

func (u *Utils) FromWei(wei *big.Int) *big.Float

func (*Utils) FromWeiWithUnit

func (u *Utils) FromWeiWithUnit(wei *big.Int, unit EtherUnit) *big.Float

func (*Utils) HexToUint64

func (u *Utils) HexToUint64(str string) (uint64, error)

func (*Utils) LeftPadBytes

func (u *Utils) LeftPadBytes(slice []byte, l int) []byte

func (*Utils) SameAddress

func (u *Utils) SameAddress(a, b common.Address) bool

func (*Utils) ToDecimals

func (u *Utils) ToDecimals(val uint64, decimals int64) *big.Int

func (*Utils) ToGWei

func (u *Utils) ToGWei(val float64) *big.Int

func (*Utils) ToHex

func (u *Utils) ToHex(n *big.Int) string

func (*Utils) ToWei

func (u *Utils) ToWei(val float64) *big.Int

Jump to

Keyboard shortcuts

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