diff --git a/common/types.go b/common/types.go index c693518c1a..faa602fc77 100644 --- a/common/types.go +++ b/common/types.go @@ -175,6 +175,10 @@ func BigToAddress(b *big.Int) Address { return BytesToAddress(b.Bytes()) } // If s is larger than len(h), s will be cropped from the left. func HexToAddress(s string) Address { return BytesToAddress(FromHex(s)) } +// StringToAddress returns Address with byte values of s. +// If s is larger than len(h), s will be cropped from the left. +func StringToAddress(s string) Address { return BytesToAddress([]byte(s)) } + // IsHexAddress verifies whether a string can represent a valid hex-encoded // Ethereum address or not. func IsHexAddress(s string) bool {