Documentation ¶
Index ¶
- Constants
- Variables
- func EncodeToHex(b []byte) string
- func EncodeUintToHex(i uint64) string
- func ParseBigInt(str string) *big.Int
- func ParseHexBytes(str string) ([]byte, error)
- func ParseUint64orHex(str string) (uint64, error)
- type Utils
- func (u *Utils) DifferentAddress(a, b common.Address) bool
- func (u *Utils) EncodeFunctionSignature(funcName string) []byte
- func (u *Utils) Equal(x, y *big.Int) bool
- func (u *Utils) Greater(x, y *big.Int) bool
- func (u *Utils) HexToUint64(str string) (uint64, error)
- func (u *Utils) LeftPadBytes(slice []byte, l int) []byte
- func (u *Utils) Less(x, y *big.Int) bool
- func (u *Utils) SameAddress(a, b common.Address) bool
- func (u *Utils) ToDecimals(val uint64, decimals int64) *big.Int
- func (u *Utils) ToHex(n *big.Int) string
- func (u *Utils) ToWei(value uint64, ethUnit string) *big.Int
Constants ¶
View Source
const ( UnitWeiValue = int64(1) // wei UnitKWeiValue = int64(3) // Kwei (babbage) UnitMWeiValue = int64(6) // Mwei (lovelace) UnitGWeiValue = int64(9) // Gwei (shannon) UnitMicroEtherValue = int64(12) // microether (szabo) UnitMilliEtherValue = int64(15) // milliether (finney) UnitEtherValue = int64(18) // ether )
Reference: https://ethdocs.org/en/latest/ether.html
View Source
const ( UnitWei = "wei" UnitKWei = "kwei" UnitMWei = "mwei" UnitGWei = "gwei" UnitMicroEther = "szabo" UnitMilliEther = "finney" UnitEther = "ether" )
Variables ¶
View Source
var ( EthUnit = map[string]int64{ UnitWei: UnitWeiValue, UnitKWei: UnitKWeiValue, UnitMWei: UnitMWeiValue, UnitGWei: UnitGWeiValue, UnitMicroEther: UnitMicroEtherValue, UnitMilliEther: UnitMilliEtherValue, UnitEther: UnitEtherValue, } )
Functions ¶
func EncodeToHex ¶
func EncodeUintToHex ¶
func ParseBigInt ¶
func ParseHexBytes ¶
func ParseUint64orHex ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.