This commit is contained in:
Lorenzo Manacorda 2018-04-03 15:08:05 +00:00 committed by GitHub
commit a48bf04e37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -143,8 +143,14 @@ func BytesToAddress(b []byte) Address {
a.SetBytes(b)
return a
}
// StringToAddress converts an arbitrary string into an Address.
func StringToAddress(s string) Address { return BytesToAddress([]byte(s)) }
// BigToAddress converts an arbitary *big.Int into an Address.
func BigToAddress(b *big.Int) Address { return BytesToAddress(b.Bytes()) }
// HexToAddress converts a string containing an address into an Address.
func HexToAddress(s string) Address { return BytesToAddress(FromHex(s)) }
// IsHexAddress verifies whether a string can represent a valid hex-encoded