From 4a567e89006881b3ac1e81db6673eaf5734d4418 Mon Sep 17 00:00:00 2001 From: Roshan <48975233+Pythonberg1997@users.noreply.github.com> Date: Fri, 21 Jul 2023 10:33:03 +0800 Subject: [PATCH] chore: implement base64 encoding in EIP712 (#248) --- x/auth/tx/eip712.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/x/auth/tx/eip712.go b/x/auth/tx/eip712.go index bdafec6e1a..f84fc38f29 100644 --- a/x/auth/tx/eip712.go +++ b/x/auth/tx/eip712.go @@ -2,6 +2,7 @@ package tx import ( "bytes" + "encoding/base64" "encoding/json" "fmt" "math/big" @@ -475,7 +476,8 @@ func cleanTypesAndMsgValue(typedData apitypes.Types, primaryType string, msgValu newValue := make(map[string]interface{}) bz, _ := json.Marshal(anyValue) newValue["type"] = anyValue["@type"] - newValue["value"] = bz + base64Str := base64.StdEncoding.EncodeToString(bz) // base64 encode to keep consistency with js-sdk + newValue["value"] = []byte(base64Str) msgValue[encName[:len(encName)-3]] = newValue typedData[primaryType][i].Name = encName[:len(encName)-3] typedData[primaryType][i].Type = "TypeAny"