From 805b45d653d26b4857fc52aa3d49fc60e96ac6f9 Mon Sep 17 00:00:00 2001 From: Peter Kieltyka Date: Thu, 19 Dec 2024 11:24:02 -0500 Subject: [PATCH] update --- ethcoder/typed_data_json.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ethcoder/typed_data_json.go b/ethcoder/typed_data_json.go index 8046984..6d8645b 100644 --- a/ethcoder/typed_data_json.go +++ b/ethcoder/typed_data_json.go @@ -86,10 +86,16 @@ func (t *TypedData) jsonEncodeMessageValues(typeName string, message map[string] func (t *TypedData) jsonEncodeValue(fieldType string, value interface{}) (interface{}, error) { // Handle bytes/bytes32 - if fieldType == "bytes" || fieldType == "bytes32" { + if strings.HasPrefix(fieldType, "bytes") { switch v := value.(type) { case []byte: return "0x" + common.Bytes2Hex(v), nil + case [8]byte: + return "0x" + common.Bytes2Hex(v[:]), nil + case [16]byte: + return "0x" + common.Bytes2Hex(v[:]), nil + case [24]byte: + return "0x" + common.Bytes2Hex(v[:]), nil case [32]byte: return "0x" + common.Bytes2Hex(v[:]), nil }