Skip to content

Commit 805b45d

Browse files
committed
update
1 parent 6f770f5 commit 805b45d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

ethcoder/typed_data_json.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,16 @@ func (t *TypedData) jsonEncodeMessageValues(typeName string, message map[string]
8686

8787
func (t *TypedData) jsonEncodeValue(fieldType string, value interface{}) (interface{}, error) {
8888
// Handle bytes/bytes32
89-
if fieldType == "bytes" || fieldType == "bytes32" {
89+
if strings.HasPrefix(fieldType, "bytes") {
9090
switch v := value.(type) {
9191
case []byte:
9292
return "0x" + common.Bytes2Hex(v), nil
93+
case [8]byte:
94+
return "0x" + common.Bytes2Hex(v[:]), nil
95+
case [16]byte:
96+
return "0x" + common.Bytes2Hex(v[:]), nil
97+
case [24]byte:
98+
return "0x" + common.Bytes2Hex(v[:]), nil
9399
case [32]byte:
94100
return "0x" + common.Bytes2Hex(v[:]), nil
95101
}

0 commit comments

Comments
 (0)