From 944de1130a3bef8382e05a70ec509d96f9bc04e5 Mon Sep 17 00:00:00 2001 From: Jianrong Date: Sun, 29 Aug 2021 17:18:37 +1000 Subject: [PATCH] add StringToAddress method --- common/types.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/types.go b/common/types.go index 8d098a36bc..e0915dbdd4 100644 --- a/common/types.go +++ b/common/types.go @@ -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()) }