Documentation
¶
Index ¶
- Constants
- Variables
- func FromDecimal(balance *big.Float, decimals int) *big.Int
- func GenRandEVMAddr() string
- func GenRandEVMHash() string
- func HexToByte32(hexString string) ([32]byte, error)
- func SanitizeEthAddr(addr string) (string, error)
- func SanitizeEthHash(hash string) (string, error)
- func ToDecimal(balance *big.Int, decimals int) *big.Float
Constants ¶
View Source
const ( EthAddrRegex = `^0x[0-9|a-f|A-F]{40}$` EthHashRegex = `^0x[0-9|a-f|A-F]{64}$` )
View Source
const SolidityIntSize uint = 256
SolidityIntSize is the size of a Solidity int in bits.
Variables ¶
View Source
var ( EthAddrExp = regexp.MustCompile(EthAddrRegex) EthHashExp = regexp.MustCompile(EthHashRegex) ErrInvalidEthAddr = fmt.Errorf("invalid ethereum address") ErrInvalidEthHash = fmt.Errorf("invalid ethereum hash") )
Functions ¶
func GenRandEVMAddr ¶
func GenRandEVMAddr() string
GenRandEVMAddr generates a random Ethereum address using non-cryptographic randomness
func GenRandEVMHash ¶
func GenRandEVMHash() string
GenRandEVMHash generates a random Ethereum hash using non-cryptographic randomness
func HexToByte32 ¶
func SanitizeEthAddr ¶
SanitizeEthAddr returns a valid Ethereum address or an error if the address is invalid. will add the 0x prefix if it's missing, and lowercase the input.
func SanitizeEthHash ¶
SanitizeEthHash returns a valid Ethereum hash or an error if the hash is invalid. will add the 0x prefix if it's missing, and lowercase the input.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.