This commit is contained in:
cui 2026-05-21 21:53:43 -07:00 committed by GitHub
commit 8473ed0da5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -463,8 +463,12 @@ func (c *BoundContract) FilterLogs(opts *FilterOpts, name string, query ...[]any
if opts == nil {
opts = new(FilterOpts)
}
ev, ok := c.abi.Events[name]
if !ok {
return nil, nil, fmt.Errorf("event %q not found in the ABI", name)
}
// Append the event selector to the query parameters and construct the topic set
query = append([][]any{{c.abi.Events[name].ID}}, query...)
query = append([][]any{{ev.ID}}, query...)
topics, err := abi.MakeTopics(query...)
if err != nil {
return nil, nil, err
@ -508,8 +512,12 @@ func (c *BoundContract) WatchLogs(opts *WatchOpts, name string, query ...[]any)
if opts == nil {
opts = new(WatchOpts)
}
ev, ok := c.abi.Events[name]
if !ok {
return nil, nil, fmt.Errorf("event %q not found in the ABI", name)
}
// Append the event selector to the query parameters and construct the topic set
query = append([][]any{{c.abi.Events[name].ID}}, query...)
query = append([][]any{{ev.ID}}, query...)
topics, err := abi.MakeTopics(query...)
if err != nil {