Skip to content

Commit

Permalink
Merge pull request #25 from wangdayong228/dev-new-bytes
Browse files Browse the repository at this point in the history
Add function for create hexutil.Bytes
  • Loading branch information
wangdayong228 authored Oct 26, 2020
2 parents 5c5da63 + cbdbf74 commit e493415
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
2 changes: 1 addition & 1 deletion utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit e493415

Please sign in to comment.