feat: add Address.Bytes32() (#572)

This commit is contained in:
HAOYUatHZ 2023-11-20 17:13:33 +08:00 committed by GitHub
parent f9d396cf57
commit 8f446dd407
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -245,6 +245,12 @@ func (a Address) Cmp(other Address) int {
// Bytes gets the string representation of the underlying address.
func (a Address) Bytes() []byte { return a[:] }
func (a Address) Bytes32() []byte {
ret := make([]byte, 32)
copy(ret, a.Bytes())
return ret
}
// Big converts an address to a big integer.
func (a Address) Big() *big.Int { return new(big.Int).SetBytes(a[:]) }