From 1df93d5c6c0f1e9d5c87d0d911e5bb4698d0c1d3 Mon Sep 17 00:00:00 2001 From: crStiv Date: Sat, 11 Jan 2025 23:21:05 +0100 Subject: [PATCH] Update types.go --- signer/core/apitypes/types.go | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/signer/core/apitypes/types.go b/signer/core/apitypes/types.go index 8f18db1fa0..bdf85c8ac3 100644 --- a/signer/core/apitypes/types.go +++ b/signer/core/apitypes/types.go @@ -498,18 +498,15 @@ func (typedData *TypedData) encodeArrayValue(encValue interface{}, encType strin arrayBuffer := new(bytes.Buffer) parsedType := strings.Split(encType, "[")[0] - - // Special handling for bytes arrays - if parsedType == "bytes" { - bytesValue, err := typedData.EncodePrimitiveValue(encType, encValue, depth) - if err != nil { - return nil, err - } - return bytesValue, nil - } - + for _, item := range arrayValue { - if reflect.TypeOf(item).Kind() == reflect.Slice || + if parsedType == "bytes" { + bytesValue, err := typedData.EncodePrimitiveValue(parsedType, item, depth) + if err != nil { + return nil, err + } + arrayBuffer.Write(bytesValue) + } else if reflect.TypeOf(item).Kind() == reflect.Slice || reflect.TypeOf(item).Kind() == reflect.Array { encodedData, err := typedData.encodeArrayValue(item, parsedType, depth+1) if err != nil {