From 5a5f974c5c214049adf237a535d5b1f89b6abe07 Mon Sep 17 00:00:00 2001 From: Dayong Wang Date: Mon, 26 Oct 2020 19:33:13 +0800 Subject: [PATCH 1/2] new bytes --- types/types.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/types.go b/types/types.go index ea381d8..9fc3aa1 100644 --- a/types/types.go +++ b/types/types.go @@ -128,3 +128,8 @@ func NewUint(x uint) *hexutil.Uint { n1 := hexutil.Uint(x) return &n1 } + +// NewBytes creates a hexutil.Bytes with specified input value. +func NewBytes(input []byte) hexutil.Bytes { + return hexutil.Bytes(input) +} From cbdbf746d0c627279324ab7fbdad48ba1ce83198 Mon Sep 17 00:00:00 2001 From: Dayong Wang Date: Mon, 26 Oct 2020 19:39:29 +0800 Subject: [PATCH 2/2] update HexStringToBytes --- utils/utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/utils.go b/utils/utils.go index 84db4f7..696ae01 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -31,7 +31,7 @@ func IsNil(i interface{}) bool { } // HexStringToBytes converts hex string to bytes -func HexStringToBytes(hexStr string) ([]byte, error) { +func HexStringToBytes(hexStr string) (hexutil.Bytes, error) { if !Has0xPrefix(hexStr) { hexStr = "0x" + hexStr }