Skip to content

Commit

Permalink
Add EventFilterer
Browse files Browse the repository at this point in the history
The main reason for adding this interface is for testing as it is quite
challenging to find events in a particular order.
  • Loading branch information
IronGauntlets committed Nov 20, 2024
1 parent 7286fe7 commit e4203e3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions blockchain/event_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/binary"
"errors"
"fmt"
"io"
"math"

"github.com/NethermindEth/juno/core"
Expand All @@ -14,6 +15,15 @@ import (

var errChunkSizeReached = errors.New("chunk size reached")

type EventFilterer interface {
io.Closer

Events(cToken *ContinuationToken, chunkSize uint64) ([]*FilteredEvent, *ContinuationToken, error)
SetRangeEndBlockByNumber(filterRange EventFilterRange, blockNumber uint64) error
SetRangeEndBlockByHash(filterRange EventFilterRange, blockHash *felt.Felt) error
WithLimit(limit uint) *EventFilter
}

type EventFilter struct {
txn db.Transaction
fromBlock uint64
Expand Down

0 comments on commit e4203e3

Please sign in to comment.