diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-18 18:44:17 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-18 18:44:17 +0800 |
commit | cd52ef315cf4d65cfb5282f72d795849266e3ab5 (patch) | |
tree | e3817114a096514a59cfa12fe614c7e6bf85a354 | |
parent | 142e81258cd7b77226d706c84f93da417aaaf426 (diff) | |
download | go-tangerine-cd52ef315cf4d65cfb5282f72d795849266e3ab5.tar go-tangerine-cd52ef315cf4d65cfb5282f72d795849266e3ab5.tar.gz go-tangerine-cd52ef315cf4d65cfb5282f72d795849266e3ab5.tar.bz2 go-tangerine-cd52ef315cf4d65cfb5282f72d795849266e3ab5.tar.lz go-tangerine-cd52ef315cf4d65cfb5282f72d795849266e3ab5.tar.xz go-tangerine-cd52ef315cf4d65cfb5282f72d795849266e3ab5.tar.zst go-tangerine-cd52ef315cf4d65cfb5282f72d795849266e3ab5.zip |
Added Hex methods
-rw-r--r-- | common/types.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/common/types.go b/common/types.go index da46db874..38044d5c8 100644 --- a/common/types.go +++ b/common/types.go @@ -27,6 +27,7 @@ func HexToHash(s string) Hash { return BytesToHash(FromHex(s)) } func (h Hash) Str() string { return string(h[:]) } func (h Hash) Bytes() []byte { return h[:] } func (h Hash) Big() *big.Int { return Bytes2Big(h[:]) } +func (h Hash) Hex() string { return "0x" + Bytes2Hex(h[:]) } // Sets the hash to the value of b. If b is larger than len(h) it will panic func (h *Hash) SetBytes(b []byte) { @@ -65,6 +66,7 @@ func (a Address) Str() string { return string(a[:]) } func (a Address) Bytes() []byte { return a[:] } func (a Address) Big() *big.Int { return Bytes2Big(a[:]) } func (a Address) Hash() Hash { return BytesToHash(a[:]) } +func (a Address) Hex() string { return "0x" + Bytes2Hex(a[:]) } // Sets the address to the value of b. If b is larger than len(a) it will panic func (a *Address) SetBytes(b []byte) { |