Documentation ¶
Overview ¶
Package address provides efficient utilities for easily working with Ethereum addresses.
Index ¶
- Constants
- Variables
- func CompareAddress(address0 common.Address, address1 common.Address) int
- func FromHex(address string) (addr common.Address)
- func FromHexes(src []string) (dst []common.Address)
- func FromString(address string) (addr common.Address)
- func FromStrings(src []string) (dst []common.Address)
- func IsDead(a common.Address) bool
- func IsEmpty(a common.Address) bool
- func IsValid(a common.Address) bool
- func IsZero(a common.Address) bool
- func Random() (addr common.Address)
- func RandomFromBytes() (addr common.Address)
- func RandomFromPrivateKey() common.Address
- func SortAddress(address0 common.Address, address1 common.Address) (common.Address, common.Address)
- func ToLower(a common.Address) string
- func ToLowers(src []common.Address) []string
- func ToString(a common.Address) string
- func ToStrings(src []common.Address) []string
Constants ¶
const ( // AddressLength is the expected length of the address AddressLength = common.AddressLength )
Variables ¶
var ( // Ether is the default address of the Ethereum's native currency. Ether = common.HexToAddress("0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE") // Zero is zero value of common.Address. Zero = common.Address{} // DeadWalletAddress is the defailt address of the dead wallet. DeadWalletAddress = common.HexToAddress("0x000000000000000000000000000000000000dead") // DeadAddresseses is the list of dead addresses. DeadAddresseses = map[common.Address]interface{}{ Zero: nil, DeadWalletAddress: nil, common.HexToAddress("0x0000000000000000000000000000000000000001"): nil, common.HexToAddress("0xdEAD000000000000000042069420694206942069"): nil, common.HexToAddress("0xdead000000000000000000000000000000000000"): nil, } // RandomGenerator is the address random generator function and used by address.Random() function. // // Default address random generator is cryptographically secure random number generator. RandomGenerator func() (addr common.Address) = RandomFromBytes )
Functions ¶
func CompareAddress ¶
CompareAddress returns -1 if address0 < address1 returns 0 if address0 == address1 returns 1 if address0 > address1
func FromString ¶
FromString safely converts a string to a common.Address.
func FromStrings ¶
FromStrings alias of FromHexes. safely converts string slice to a common.Address slice.
func Random ¶
Random returns a random common.Address. can be changed address random generator by RandomGenerator variable.
Default address random generator is use cryptographically secure random number generator.
func RandomFromBytes ¶
RandomFromBytes returns a random address from a random byte slice (via crypto/rand)
func RandomFromPrivateKey ¶
RandomFromPrivateKey returns a random address from a random private key
func SortAddress ¶
SortAddress for sorting two addresses by hex value.
Types ¶
This section is empty.