diff --git a/accounts/abi/abi.go b/accounts/abi/abi.go index ba242b14e588..5a6cb007342e 100644 --- a/accounts/abi/abi.go +++ b/accounts/abi/abi.go @@ -114,12 +114,13 @@ func (abi ABI) UnpackIntoMap(v map[string]interface{}, name string, data []byte) // UnmarshalJSON implements json.Unmarshaler interface func (abi *ABI) UnmarshalJSON(data []byte) error { var fields []struct { - Type string - Name string - Constant bool - Anonymous bool - Inputs []Argument - Outputs []Argument + Type string + Name string + Constant bool + StateMutability string + Anonymous bool + Inputs []Argument + Outputs []Argument } if err := json.Unmarshal(data, &fields); err != nil { @@ -142,9 +143,10 @@ func (abi *ABI) UnmarshalJSON(data []byte) error { name = fmt.Sprintf("%s%d", field.Name, idx) _, ok = abi.Methods[name] } + isConst := field.Constant || field.StateMutability == "pure" || field.StateMutability == "view" abi.Methods[name] = Method{ Name: name, - Const: field.Constant, + Const: isConst, Inputs: field.Inputs, Outputs: field.Outputs, }