From c54ba9b4356edea35cfd3f078c131c8335bfc44b Mon Sep 17 00:00:00 2001 From: Nguyen Khoi Nguyen Date: Fri, 19 Apr 2024 10:04:25 +0700 Subject: [PATCH] write a default 0x0 when encoutering missing struct data --- signer/core/apitypes/types.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/signer/core/apitypes/types.go b/signer/core/apitypes/types.go index 9113c091c5..ff74e08793 100644 --- a/signer/core/apitypes/types.go +++ b/signer/core/apitypes/types.go @@ -493,6 +493,10 @@ func (typedData *TypedData) EncodeData(primaryType string, data map[string]inter buffer.Write(crypto.Keccak256(arrayBuffer.Bytes())) } else if typedData.Types[field.Type] != nil { + if encValue == nil { + buffer.Write(common.Hash{}.Bytes()) + continue + } mapValue, ok := encValue.(map[string]interface{}) if !ok { return nil, dataMismatchError(encType, encValue)