mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
Add StateMutability ABI parameters to check if const or not
This commit is contained in:
parent
3bb6815fc1
commit
4fcca64cbd
1 changed files with 9 additions and 7 deletions
|
|
@ -111,6 +111,7 @@ func (abi *ABI) UnmarshalJSON(data []byte) error {
|
|||
Type string
|
||||
Name string
|
||||
Constant bool
|
||||
StateMutability string
|
||||
Anonymous bool
|
||||
Inputs []Argument
|
||||
Outputs []Argument
|
||||
|
|
@ -134,10 +135,11 @@ 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,
|
||||
RawName: field.Name,
|
||||
Const: field.Constant,
|
||||
Const: isConst,
|
||||
Inputs: field.Inputs,
|
||||
Outputs: field.Outputs,
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue