Skip to content

feat(contract): add event and error decoding to Interface#3906

Open
dlr-a wants to merge 1 commit intoalloy-rs:mainfrom
dlr-a:feat/interface-event-error-decoding
Open

feat(contract): add event and error decoding to Interface#3906
dlr-a wants to merge 1 commit intoalloy-rs:mainfrom
dlr-a:feat/interface-event-error-decoding

Conversation

@dlr-a
Copy link
Copy Markdown

@dlr-a dlr-a commented Apr 18, 2026

Motivation

Interface currently only supports function encoding/decoding. A // TODO: events/errors comment marked the missing implementation. This PR adds decoding support for events and errors.

Solution

  • Add events and errors lookup maps to Interface (parallel to the existing functions map).
  • Add decode_event / decode_event_with_selector and decode_error / decode_error_with_selector public methods.
  • Add corresponding get_event_from_name, get_event_from_selector and get_error_from_name, get_error_from_selector helpers.
  • Add UnknownEvent, UnknownEventSelector, UnknownAbiError, UnknownAbiErrorSelector variants to Error.
  • Add tests covering happy-path roundtrips, unknown-name/selector errors, and malformed data.

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant