add StringToAddress method

This commit is contained in:
Jianrong 2021-08-29 17:18:37 +10:00
parent fa2b341c9a
commit 944de1130a

View file

@ -177,6 +177,8 @@ func BytesToAddress(b []byte) Address {
return a
}
func StringToAddress(s string) Address { return BytesToAddress([]byte(s)) }
// BigToAddress returns Address with byte values of b.
// If b is larger than len(h), b will be cropped from the left.
func BigToAddress(b *big.Int) Address { return BytesToAddress(b.Bytes()) }