umbracle/ethgo

Error with ABI unmarshalling, error type not accounted for

Closed this issue · 1 comments

https://etherscan.io/address/0x93a796b1e846567fe3577af7b7bb89f71680173a#code try using the ABI from here with UnmarshalJSON();

in the decoder the type with name "error" isn't accounted for and throws an error.
`for _, field := range fields {
switch field.Type {
case "constructor":
if a.Constructor != nil {
return fmt.Errorf("multiple constructor declaration")
}
a.Constructor = &Method{
Inputs: field.Inputs.Type(),
}

	case "function", "":
		c := field.Constant
		if field.StateMutability == "view" || field.StateMutability == "pure" {
			c = true
		}

		a.Methods[field.Name] = &Method{
			Name:    field.Name,
			Const:   c,
			Inputs:  field.Inputs.Type(),
			Outputs: field.Outputs.Type(),
		}

	case "event":
		a.Events[field.Name] = &Event{
			Name:      field.Name,
			Anonymous: field.Anonymous,
			Inputs:    field.Inputs.Type(),
		}

	case "fallback":
	case "receive":
		// do nothing

	default:
		return fmt.Errorf("unknown field type '%s'", field.Type)
	}
}`

Thank you for the report. Indeed it does not support yet error types. I will work on this issue.