From 9b033c5fffd2838bcca9ebfeb725f12f1d352aa8 Mon Sep 17 00:00:00 2001 From: IronGauntlets Date: Wed, 20 Nov 2024 11:45:28 +0000 Subject: [PATCH] Return EventFilterer from Events() on Blockchain --- blockchain/blockchain.go | 4 ++-- mocks/mock_blockchain.go | 4 ++-- rpc/events.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/blockchain/blockchain.go b/blockchain/blockchain.go index 918683b020..0200fe3297 100644 --- a/blockchain/blockchain.go +++ b/blockchain/blockchain.go @@ -44,7 +44,7 @@ type Reader interface { BlockCommitmentsByNumber(blockNumber uint64) (*core.BlockCommitments, error) - EventFilter(from *felt.Felt, keys [][]felt.Felt) (*EventFilter, error) + EventFilter(from *felt.Felt, keys [][]felt.Felt) (EventFilterer, error) Pending() (Pending, error) @@ -844,7 +844,7 @@ func (b *Blockchain) StateAtBlockHash(blockHash *felt.Felt) (core.StateReader, S } // EventFilter returns an EventFilter object that is tied to a snapshot of the blockchain -func (b *Blockchain) EventFilter(from *felt.Felt, keys [][]felt.Felt) (*EventFilter, error) { +func (b *Blockchain) EventFilter(from *felt.Felt, keys [][]felt.Felt) (EventFilterer, error) { b.listener.OnRead("EventFilter") txn, err := b.database.NewTransaction(false) if err != nil { diff --git a/mocks/mock_blockchain.go b/mocks/mock_blockchain.go index 6b02248259..b42b38232f 100644 --- a/mocks/mock_blockchain.go +++ b/mocks/mock_blockchain.go @@ -119,10 +119,10 @@ func (mr *MockReaderMockRecorder) BlockHeaderByNumber(arg0 any) *gomock.Call { } // EventFilter mocks base method. -func (m *MockReader) EventFilter(arg0 *felt.Felt, arg1 [][]felt.Felt) (*blockchain.EventFilter, error) { +func (m *MockReader) EventFilter(arg0 *felt.Felt, arg1 [][]felt.Felt) (blockchain.EventFilterer, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EventFilter", arg0, arg1) - ret0, _ := ret[0].(*blockchain.EventFilter) + ret0, _ := ret[0].(blockchain.EventFilterer) ret1, _ := ret[1].(error) return ret0, ret1 } diff --git a/rpc/events.go b/rpc/events.go index 002c0e077b..7a322fde1e 100644 --- a/rpc/events.go +++ b/rpc/events.go @@ -191,7 +191,7 @@ func (h *Handler) unsubscribe(sub *subscription, id uint64) { h.mu.Unlock() } -func setEventFilterRange(filter *blockchain.EventFilter, fromID, toID *BlockID, latestHeight uint64) error { +func setEventFilterRange(filter blockchain.EventFilterer, fromID, toID *BlockID, latestHeight uint64) error { set := func(filterRange blockchain.EventFilterRange, id *BlockID) error { if id == nil { return nil