Skip to content

Commit

Permalink
fix: bytes type error with EIP712
Browse files Browse the repository at this point in the history
  • Loading branch information
pythonberg1997 committed Jan 12, 2023
1 parent 7c062ed commit ed21e90
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions x/auth/tx/eip712.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,16 @@ func cleanTypesAndMsgValue(typedData apitypes.Types, primaryType string, msgValu
for i := 0; i < len(msgValue[encName].([]interface{})); i++ {
cleanTypesAndMsgValue(typedData, encType[:len(encType)-2], msgValue[encName].([]interface{})[i].(map[string]interface{}))
}
} else if encType == "bytes[]" {
byteList, ok := encValue.([]interface{})
if !ok {
continue
}
newBytesList := make([]interface{}, len(byteList))
for j, item := range byteList {
newBytesList[j] = []byte(item.(string))
}
msgValue[encName] = newBytesList
}
case typedData[encType] != nil:
subType, ok := msgValue[encName].(map[string]interface{})
Expand All @@ -496,6 +506,10 @@ func cleanTypesAndMsgValue(typedData apitypes.Types, primaryType string, msgValu
msgValue[encName] = "0"
}
}
case encType == "bytes":
if reflect.TypeOf(encValue).Kind() == reflect.String {
msgValue[encName] = []byte(encValue.(string))
}
}
}

Expand Down

0 comments on commit ed21e90

Please sign in to comment.