mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 01:13:45 +00:00
Merge pull request #31 from maticnetwork/abi-fix
fix abigen to create pure/view methods
This commit is contained in:
commit
9e2f108071
1 changed files with 9 additions and 7 deletions
|
|
@ -117,6 +117,7 @@ func (abi *ABI) UnmarshalJSON(data []byte) error {
|
|||
Type string
|
||||
Name string
|
||||
Constant bool
|
||||
StateMutability string
|
||||
Anonymous bool
|
||||
Inputs []Argument
|
||||
Outputs []Argument
|
||||
|
|
@ -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,
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue