common

package
v0.0.0-...-cbc3fee Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2022 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BalanceIsValid

func BalanceIsValid(balance *big.Int) (bool, error)

BalanceIsValid will return an error and a boolean

func BalanceMustBeValid

func BalanceMustBeValid(balance *big.Int) bool

BalanceMustBeValid will panic in case there is an error when processing the balance

func GetAddressFromPrivateKey

func GetAddressFromPrivateKey(
	privateKey *ecdsa.PrivateKey,
) (address common.Address, err error)

func IsValidAddress

func IsValidAddress(iaddress interface{}) bool

IsValidAddress validate hex address

func IsZeroAddress

func IsZeroAddress(iaddress interface{}) bool

IsZeroAddress validate if it's a 0 address

func MustGetAddressFromPrivateKey

func MustGetAddressFromPrivateKey(privateKey *ecdsa.PrivateKey) common.Address

func SafeBalanceIsValid

func SafeBalanceIsValid(balance *big.Int) bool

SafeBalanceIsValid Use this function when you want to behave with a normal bool check

func ValidateAddress

func ValidateAddress(address interface{}) bool

ValidateAddress will check that the address format is correct and that it is not a zero address

func ValidateAddresses

func ValidateAddresses(addresses []interface{}) (
	[]interface{},
	[]interface{},
	bool,
)

Types

type PrivateAddress

type PrivateAddress string

func (PrivateAddress) IsValid

func (a PrivateAddress) IsValid() bool

func (*PrivateAddress) ToECDSA

func (a *PrivateAddress) ToECDSA() (pk *ecdsa.PrivateKey, err error)

func (PrivateAddress) ToString

func (a PrivateAddress) ToString() string

type RawAddress

type RawAddress string

RawAddress Used for declaring ethereum addresses that is not common.Address type

func (RawAddress) IsValid

func (a RawAddress) IsValid() bool

func (RawAddress) ToCommonAddress

func (a RawAddress) ToCommonAddress() common.Address

func (RawAddress) ToString

func (a RawAddress) ToString() string

Jump to

Keyboard shortcuts

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