clef: fix chainId key being present in domain map (#19303)
This PR fixes this, moving domain.ChainId from the map's initializer down to a separate if statement which checks the existance of ChainId's value, similar to the rest of the fields, before adding it. I've also included a new test to demonstrate the issue
This commit is contained in:
committed by
Martin Holst Swende
parent
5b947c5004
commit
f538d15241
@ -894,8 +894,10 @@ func (domain *TypedDataDomain) validate() error {
|
||||
|
||||
// Map is a helper function to generate a map version of the domain
|
||||
func (domain *TypedDataDomain) Map() map[string]interface{} {
|
||||
dataMap := map[string]interface{}{
|
||||
"chainId": domain.ChainId,
|
||||
dataMap := map[string]interface{}{}
|
||||
|
||||
if domain.ChainId != nil {
|
||||
dataMap["chainId"] = domain.ChainId
|
||||
}
|
||||
|
||||
if len(domain.Name) > 0 {
|
||||
|
Reference in New Issue
Block a user