filters

package
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2022 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Overview

Package filters is a generated GoMock package.

Package filters is a generated GoMock package.

Package filters implements an ethereum filtering system for block, transactions and log events.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	ChainDb() ethdb.Database
	HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error)
	HeaderByHash(ctx context.Context, blockHash common.Hash) (*types.Header, error)
	GetReceipts(ctx context.Context, blockHash common.Hash) (types.Receipts, error)
	GetLogs(ctx context.Context, blockHash common.Hash) ([][]*types.Log, error)
	GetBorBlockReceipt(ctx context.Context, blockHash common.Hash) (*types.Receipt, error)
	GetBorBlockLogs(ctx context.Context, blockHash common.Hash) ([]*types.Log, error)

	SubscribeNewTxsEvent(chan<- core.NewTxsEvent) event.Subscription
	SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription
	SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription
	SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription
	SubscribePendingLogsEvent(ch chan<- []*types.Log) event.Subscription

	BloomStatus() (uint64, uint64)
	ServiceFilter(ctx context.Context, session *bloombits.MatcherSession)

	SubscribeStateSyncEvent(ch chan<- core.StateSyncEvent) event.Subscription
}

type BorBlockLogsFilter

type BorBlockLogsFilter struct {
	// contains filtered or unexported fields
}

BorBlockLogsFilter can be used to retrieve and filter logs.

func NewBorBlockLogsFilter

func NewBorBlockLogsFilter(backend Backend, sprint uint64, block common.Hash, addresses []common.Address, topics [][]common.Hash) *BorBlockLogsFilter

NewBorBlockLogsFilter creates a new filter which directly inspects the contents of a block to figure out whether it is interesting or not.

func NewBorBlockLogsRangeFilter

func NewBorBlockLogsRangeFilter(backend Backend, sprint uint64, begin, end int64, addresses []common.Address, topics [][]common.Hash) *BorBlockLogsFilter

NewBorBlockLogsRangeFilter creates a new filter which uses a bloom filter on blocks to figure out whether a particular block is interesting or not.

func (*BorBlockLogsFilter) Logs

func (f *BorBlockLogsFilter) Logs(ctx context.Context) ([]*types.Log, error)

Logs searches the blockchain for matching log entries, returning all from the first block that contains matches, updating the start of the filter accordingly.

type EventSystem

type EventSystem struct {
	// contains filtered or unexported fields
}

EventSystem creates subscriptions, processes events and broadcasts them to the subscription which match the subscription criteria.

func NewEventSystem

func NewEventSystem(backend Backend, lightMode bool) *EventSystem

NewEventSystem creates a new manager that listens for event on the given mux, parses and filters them. It uses the all map to retrieve filter changes. The work loop holds its own index that is used to forward events to filters.

The returned manager has a loop that needs to be stopped with the Stop function or by stopping the given mux.

func (*EventSystem) SubscribeLogs

func (es *EventSystem) SubscribeLogs(crit ethereum.FilterQuery, logs chan []*types.Log) (*Subscription, error)

SubscribeLogs creates a subscription that will write all logs matching the given criteria to the given logs channel. Default value for the from and to block is "latest". If the fromBlock > toBlock an error is returned.

func (*EventSystem) SubscribeNewDeposits

func (es *EventSystem) SubscribeNewDeposits(data chan *types.StateSyncData) *Subscription

SubscribeNewDeposits creates a subscription that writes details about the new state sync events (from mainchain to Bor)

func (*EventSystem) SubscribeNewHeads

func (es *EventSystem) SubscribeNewHeads(headers chan *types.Header) *Subscription

SubscribeNewHeads creates a subscription that writes the header of a block that is imported in the chain.

func (*EventSystem) SubscribePendingTxs

func (es *EventSystem) SubscribePendingTxs(hashes chan []common.Hash) *Subscription

SubscribePendingTxs creates a subscription that writes transaction hashes for transactions that enter the transaction pool.

type Filter

type Filter struct {
	// contains filtered or unexported fields
}

Filter can be used to retrieve and filter logs.

func NewBlockFilter

func NewBlockFilter(backend Backend, block common.Hash, addresses []common.Address, topics [][]common.Hash) *Filter

NewBlockFilter creates a new filter which directly inspects the contents of a block to figure out whether it is interesting or not.

func NewRangeFilter

func NewRangeFilter(backend Backend, begin, end int64, addresses []common.Address, topics [][]common.Hash) *Filter

NewRangeFilter creates a new filter which uses a bloom filter on blocks to figure out whether a particular block is interesting or not.

func (*Filter) Logs

func (f *Filter) Logs(ctx context.Context) ([]*types.Log, error)

Logs searches the blockchain for matching log entries, returning all from the first block that contains matches, updating the start of the filter accordingly.

type FilterCriteria

type FilterCriteria ethereum.FilterQuery

FilterCriteria represents a request to create a new filter. Same as ethereum.FilterQuery but with UnmarshalJSON() method.

func (*FilterCriteria) UnmarshalJSON

func (args *FilterCriteria) UnmarshalJSON(data []byte) error

UnmarshalJSON sets *args fields with given data.

type MockBackend

type MockBackend struct {
	// contains filtered or unexported fields
}

MockBackend is a mock of Backend interface.

func NewMockBackend

func NewMockBackend(ctrl *gomock.Controller) *MockBackend

NewMockBackend creates a new mock instance.

func (*MockBackend) BloomStatus

func (m *MockBackend) BloomStatus() (uint64, uint64)

BloomStatus mocks base method.

func (*MockBackend) ChainDb

func (m *MockBackend) ChainDb() ethdb.Database

ChainDb mocks base method.

func (*MockBackend) EXPECT

func (m *MockBackend) EXPECT() *MockBackendMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockBackend) GetBorBlockLogs

func (m *MockBackend) GetBorBlockLogs(arg0 context.Context, arg1 common.Hash) ([]*types.Log, error)

GetBorBlockLogs mocks base method.

func (*MockBackend) GetBorBlockReceipt

func (m *MockBackend) GetBorBlockReceipt(arg0 context.Context, arg1 common.Hash) (*types.Receipt, error)

GetBorBlockReceipt mocks base method.

func (*MockBackend) GetLogs

func (m *MockBackend) GetLogs(arg0 context.Context, arg1 common.Hash) ([][]*types.Log, error)

GetLogs mocks base method.

func (*MockBackend) GetReceipts

func (m *MockBackend) GetReceipts(arg0 context.Context, arg1 common.Hash) (types.Receipts, error)

GetReceipts mocks base method.

func (*MockBackend) HeaderByHash

func (m *MockBackend) HeaderByHash(arg0 context.Context, arg1 common.Hash) (*types.Header, error)

HeaderByHash mocks base method.

func (*MockBackend) HeaderByNumber

func (m *MockBackend) HeaderByNumber(arg0 context.Context, arg1 rpc.BlockNumber) (*types.Header, error)

HeaderByNumber mocks base method.

func (*MockBackend) ServiceFilter

func (m *MockBackend) ServiceFilter(arg0 context.Context, arg1 *bloombits.MatcherSession)

ServiceFilter mocks base method.

func (*MockBackend) SubscribeChainEvent

func (m *MockBackend) SubscribeChainEvent(arg0 chan<- core.ChainEvent) event.Subscription

SubscribeChainEvent mocks base method.

func (*MockBackend) SubscribeLogsEvent

func (m *MockBackend) SubscribeLogsEvent(arg0 chan<- []*types.Log) event.Subscription

SubscribeLogsEvent mocks base method.

func (*MockBackend) SubscribeNewTxsEvent

func (m *MockBackend) SubscribeNewTxsEvent(arg0 chan<- core.NewTxsEvent) event.Subscription

SubscribeNewTxsEvent mocks base method.

func (*MockBackend) SubscribePendingLogsEvent

func (m *MockBackend) SubscribePendingLogsEvent(arg0 chan<- []*types.Log) event.Subscription

SubscribePendingLogsEvent mocks base method.

func (*MockBackend) SubscribeRemovedLogsEvent

func (m *MockBackend) SubscribeRemovedLogsEvent(arg0 chan<- core.RemovedLogsEvent) event.Subscription

SubscribeRemovedLogsEvent mocks base method.

func (*MockBackend) SubscribeStateSyncEvent

func (m *MockBackend) SubscribeStateSyncEvent(arg0 chan<- core.StateSyncEvent) event.Subscription

SubscribeStateSyncEvent mocks base method.

type MockBackendMockRecorder

type MockBackendMockRecorder struct {
	// contains filtered or unexported fields
}

MockBackendMockRecorder is the mock recorder for MockBackend.

func (*MockBackendMockRecorder) BloomStatus

func (mr *MockBackendMockRecorder) BloomStatus() *gomock.Call

BloomStatus indicates an expected call of BloomStatus.

func (*MockBackendMockRecorder) ChainDb

func (mr *MockBackendMockRecorder) ChainDb() *gomock.Call

ChainDb indicates an expected call of ChainDb.

func (*MockBackendMockRecorder) GetBorBlockLogs

func (mr *MockBackendMockRecorder) GetBorBlockLogs(arg0, arg1 interface{}) *gomock.Call

GetBorBlockLogs indicates an expected call of GetBorBlockLogs.

func (*MockBackendMockRecorder) GetBorBlockReceipt

func (mr *MockBackendMockRecorder) GetBorBlockReceipt(arg0, arg1 interface{}) *gomock.Call

GetBorBlockReceipt indicates an expected call of GetBorBlockReceipt.

func (*MockBackendMockRecorder) GetLogs

func (mr *MockBackendMockRecorder) GetLogs(arg0, arg1 interface{}) *gomock.Call

GetLogs indicates an expected call of GetLogs.

func (*MockBackendMockRecorder) GetReceipts

func (mr *MockBackendMockRecorder) GetReceipts(arg0, arg1 interface{}) *gomock.Call

GetReceipts indicates an expected call of GetReceipts.

func (*MockBackendMockRecorder) HeaderByHash

func (mr *MockBackendMockRecorder) HeaderByHash(arg0, arg1 interface{}) *gomock.Call

HeaderByHash indicates an expected call of HeaderByHash.

func (*MockBackendMockRecorder) HeaderByNumber

func (mr *MockBackendMockRecorder) HeaderByNumber(arg0, arg1 interface{}) *gomock.Call

HeaderByNumber indicates an expected call of HeaderByNumber.

func (*MockBackendMockRecorder) ServiceFilter

func (mr *MockBackendMockRecorder) ServiceFilter(arg0, arg1 interface{}) *gomock.Call

ServiceFilter indicates an expected call of ServiceFilter.

func (*MockBackendMockRecorder) SubscribeChainEvent

func (mr *MockBackendMockRecorder) SubscribeChainEvent(arg0 interface{}) *gomock.Call

SubscribeChainEvent indicates an expected call of SubscribeChainEvent.

func (*MockBackendMockRecorder) SubscribeLogsEvent

func (mr *MockBackendMockRecorder) SubscribeLogsEvent(arg0 interface{}) *gomock.Call

SubscribeLogsEvent indicates an expected call of SubscribeLogsEvent.

func (*MockBackendMockRecorder) SubscribeNewTxsEvent

func (mr *MockBackendMockRecorder) SubscribeNewTxsEvent(arg0 interface{}) *gomock.Call

SubscribeNewTxsEvent indicates an expected call of SubscribeNewTxsEvent.

func (*MockBackendMockRecorder) SubscribePendingLogsEvent

func (mr *MockBackendMockRecorder) SubscribePendingLogsEvent(arg0 interface{}) *gomock.Call

SubscribePendingLogsEvent indicates an expected call of SubscribePendingLogsEvent.

func (*MockBackendMockRecorder) SubscribeRemovedLogsEvent

func (mr *MockBackendMockRecorder) SubscribeRemovedLogsEvent(arg0 interface{}) *gomock.Call

SubscribeRemovedLogsEvent indicates an expected call of SubscribeRemovedLogsEvent.

func (*MockBackendMockRecorder) SubscribeStateSyncEvent

func (mr *MockBackendMockRecorder) SubscribeStateSyncEvent(arg0 interface{}) *gomock.Call

SubscribeStateSyncEvent indicates an expected call of SubscribeStateSyncEvent.

type MockDatabase

type MockDatabase struct {
	// contains filtered or unexported fields
}

MockDatabase is a mock of Database interface.

func NewMockDatabase

func NewMockDatabase(ctrl *gomock.Controller) *MockDatabase

NewMockDatabase creates a new mock instance.

func (*MockDatabase) Ancient

func (m *MockDatabase) Ancient(arg0 string, arg1 uint64) ([]byte, error)

Ancient mocks base method.

func (*MockDatabase) AncientRange

func (m *MockDatabase) AncientRange(arg0 string, arg1, arg2, arg3 uint64) ([][]byte, error)

AncientRange mocks base method.

func (*MockDatabase) AncientSize

func (m *MockDatabase) AncientSize(arg0 string) (uint64, error)

AncientSize mocks base method.

func (*MockDatabase) Ancients

func (m *MockDatabase) Ancients() (uint64, error)

Ancients mocks base method.

func (*MockDatabase) Close

func (m *MockDatabase) Close() error

Close mocks base method.

func (*MockDatabase) Compact

func (m *MockDatabase) Compact(arg0, arg1 []byte) error

Compact mocks base method.

func (*MockDatabase) Delete

func (m *MockDatabase) Delete(arg0 []byte) error

Delete mocks base method.

func (*MockDatabase) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockDatabase) Get

func (m *MockDatabase) Get(arg0 []byte) ([]byte, error)

Get mocks base method.

func (*MockDatabase) Has

func (m *MockDatabase) Has(arg0 []byte) (bool, error)

Has mocks base method.

func (*MockDatabase) HasAncient

func (m *MockDatabase) HasAncient(arg0 string, arg1 uint64) (bool, error)

HasAncient mocks base method.

func (*MockDatabase) MigrateTable

func (m *MockDatabase) MigrateTable(arg0 string, arg1 func([]byte) ([]byte, error)) error

MigrateTable mocks base method.

func (*MockDatabase) ModifyAncients

func (m *MockDatabase) ModifyAncients(arg0 func(ethdb.AncientWriteOp) error) (int64, error)

ModifyAncients mocks base method.

func (*MockDatabase) NewBatch

func (m *MockDatabase) NewBatch() ethdb.Batch

NewBatch mocks base method.

func (*MockDatabase) NewBatchWithSize

func (m *MockDatabase) NewBatchWithSize(arg0 int) ethdb.Batch

NewBatchWithSize mocks base method.

func (*MockDatabase) NewIterator

func (m *MockDatabase) NewIterator(arg0, arg1 []byte) ethdb.Iterator

NewIterator mocks base method.

func (*MockDatabase) NewSnapshot

func (m *MockDatabase) NewSnapshot() (ethdb.Snapshot, error)

NewSnapshot mocks base method.

func (*MockDatabase) Put

func (m *MockDatabase) Put(arg0, arg1 []byte) error

Put mocks base method.

func (*MockDatabase) ReadAncients

func (m *MockDatabase) ReadAncients(arg0 func(ethdb.AncientReader) error) error

ReadAncients mocks base method.

func (*MockDatabase) Stat

func (m *MockDatabase) Stat(arg0 string) (string, error)

Stat mocks base method.

func (*MockDatabase) Sync

func (m *MockDatabase) Sync() error

Sync mocks base method.

func (*MockDatabase) Tail

func (m *MockDatabase) Tail() (uint64, error)

Tail mocks base method.

func (*MockDatabase) TruncateHead

func (m *MockDatabase) TruncateHead(arg0 uint64) error

TruncateHead mocks base method.

func (*MockDatabase) TruncateTail

func (m *MockDatabase) TruncateTail(arg0 uint64) error

TruncateTail mocks base method.

type MockDatabaseMockRecorder

type MockDatabaseMockRecorder struct {
	// contains filtered or unexported fields
}

MockDatabaseMockRecorder is the mock recorder for MockDatabase.

func (*MockDatabaseMockRecorder) Ancient

func (mr *MockDatabaseMockRecorder) Ancient(arg0, arg1 interface{}) *gomock.Call

Ancient indicates an expected call of Ancient.

func (*MockDatabaseMockRecorder) AncientRange

func (mr *MockDatabaseMockRecorder) AncientRange(arg0, arg1, arg2, arg3 interface{}) *gomock.Call

AncientRange indicates an expected call of AncientRange.

func (*MockDatabaseMockRecorder) AncientSize

func (mr *MockDatabaseMockRecorder) AncientSize(arg0 interface{}) *gomock.Call

AncientSize indicates an expected call of AncientSize.

func (*MockDatabaseMockRecorder) Ancients

func (mr *MockDatabaseMockRecorder) Ancients() *gomock.Call

Ancients indicates an expected call of Ancients.

func (*MockDatabaseMockRecorder) Close

func (mr *MockDatabaseMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close.

func (*MockDatabaseMockRecorder) Compact

func (mr *MockDatabaseMockRecorder) Compact(arg0, arg1 interface{}) *gomock.Call

Compact indicates an expected call of Compact.

func (*MockDatabaseMockRecorder) Delete

func (mr *MockDatabaseMockRecorder) Delete(arg0 interface{}) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockDatabaseMockRecorder) Get

func (mr *MockDatabaseMockRecorder) Get(arg0 interface{}) *gomock.Call

Get indicates an expected call of Get.

func (*MockDatabaseMockRecorder) Has

func (mr *MockDatabaseMockRecorder) Has(arg0 interface{}) *gomock.Call

Has indicates an expected call of Has.

func (*MockDatabaseMockRecorder) HasAncient

func (mr *MockDatabaseMockRecorder) HasAncient(arg0, arg1 interface{}) *gomock.Call

HasAncient indicates an expected call of HasAncient.

func (*MockDatabaseMockRecorder) MigrateTable

func (mr *MockDatabaseMockRecorder) MigrateTable(arg0, arg1 interface{}) *gomock.Call

MigrateTable indicates an expected call of MigrateTable.

func (*MockDatabaseMockRecorder) ModifyAncients

func (mr *MockDatabaseMockRecorder) ModifyAncients(arg0 interface{}) *gomock.Call

ModifyAncients indicates an expected call of ModifyAncients.

func (*MockDatabaseMockRecorder) NewBatch

func (mr *MockDatabaseMockRecorder) NewBatch() *gomock.Call

NewBatch indicates an expected call of NewBatch.

func (*MockDatabaseMockRecorder) NewBatchWithSize

func (mr *MockDatabaseMockRecorder) NewBatchWithSize(arg0 interface{}) *gomock.Call

NewBatchWithSize indicates an expected call of NewBatchWithSize.

func (*MockDatabaseMockRecorder) NewIterator

func (mr *MockDatabaseMockRecorder) NewIterator(arg0, arg1 interface{}) *gomock.Call

NewIterator indicates an expected call of NewIterator.

func (*MockDatabaseMockRecorder) NewSnapshot

func (mr *MockDatabaseMockRecorder) NewSnapshot() *gomock.Call

NewSnapshot indicates an expected call of NewSnapshot.

func (*MockDatabaseMockRecorder) Put

func (mr *MockDatabaseMockRecorder) Put(arg0, arg1 interface{}) *gomock.Call

Put indicates an expected call of Put.

func (*MockDatabaseMockRecorder) ReadAncients

func (mr *MockDatabaseMockRecorder) ReadAncients(arg0 interface{}) *gomock.Call

ReadAncients indicates an expected call of ReadAncients.

func (*MockDatabaseMockRecorder) Stat

func (mr *MockDatabaseMockRecorder) Stat(arg0 interface{}) *gomock.Call

Stat indicates an expected call of Stat.

func (*MockDatabaseMockRecorder) Sync

func (mr *MockDatabaseMockRecorder) Sync() *gomock.Call

Sync indicates an expected call of Sync.

func (*MockDatabaseMockRecorder) Tail

func (mr *MockDatabaseMockRecorder) Tail() *gomock.Call

Tail indicates an expected call of Tail.

func (*MockDatabaseMockRecorder) TruncateHead

func (mr *MockDatabaseMockRecorder) TruncateHead(arg0 interface{}) *gomock.Call

TruncateHead indicates an expected call of TruncateHead.

func (*MockDatabaseMockRecorder) TruncateTail

func (mr *MockDatabaseMockRecorder) TruncateTail(arg0 interface{}) *gomock.Call

TruncateTail indicates an expected call of TruncateTail.

type PublicFilterAPI

type PublicFilterAPI struct {
	// contains filtered or unexported fields
}

PublicFilterAPI offers support to create and manage filters. This will allow external clients to retrieve various information related to the Ethereum protocol such als blocks, transactions and logs.

func NewPublicFilterAPI

func NewPublicFilterAPI(backend Backend, lightMode bool, timeout time.Duration, borLogs bool) *PublicFilterAPI

NewPublicFilterAPI returns a new PublicFilterAPI instance.

func (*PublicFilterAPI) GetBorBlockLogs

func (api *PublicFilterAPI) GetBorBlockLogs(ctx context.Context, crit FilterCriteria) ([]*types.Log, error)

func (*PublicFilterAPI) GetFilterChanges

func (api *PublicFilterAPI) GetFilterChanges(id rpc.ID) (interface{}, error)

GetFilterChanges returns the logs for the filter with the given id since last time it was called. This can be used for polling.

For pending transaction and block filters the result is []common.Hash. (pending)Log filters return []Log.

https://eth.wiki/json-rpc/API#eth_getfilterchanges

func (*PublicFilterAPI) GetFilterLogs

func (api *PublicFilterAPI) GetFilterLogs(ctx context.Context, id rpc.ID) ([]*types.Log, error)

GetFilterLogs returns the logs for the filter with the given id. If the filter could not be found an empty array of logs is returned.

https://eth.wiki/json-rpc/API#eth_getfilterlogs

func (*PublicFilterAPI) GetLogs

func (api *PublicFilterAPI) GetLogs(ctx context.Context, crit FilterCriteria) ([]*types.Log, error)

GetLogs returns logs matching the given argument that are stored within the state.

https://eth.wiki/json-rpc/API#eth_getlogs

func (*PublicFilterAPI) Logs

Logs creates a subscription that fires for all new log that match the given filter criteria.

func (*PublicFilterAPI) NewBlockFilter

func (api *PublicFilterAPI) NewBlockFilter() rpc.ID

NewBlockFilter creates a filter that fetches blocks that are imported into the chain. It is part of the filter package since polling goes with eth_getFilterChanges.

https://eth.wiki/json-rpc/API#eth_newblockfilter

func (*PublicFilterAPI) NewDeposits

func (api *PublicFilterAPI) NewDeposits(ctx context.Context, crit ethereum.StateSyncFilter) (*rpc.Subscription, error)

NewDeposits send a notification each time a new deposit received from bridge.

func (*PublicFilterAPI) NewFilter

func (api *PublicFilterAPI) NewFilter(crit FilterCriteria) (rpc.ID, error)

NewFilter creates a new filter and returns the filter id. It can be used to retrieve logs when the state changes. This method cannot be used to fetch logs that are already stored in the state.

Default criteria for the from and to block are "latest". Using "latest" as block number will return logs for mined blocks. Using "pending" as block number returns logs for not yet mined (pending) blocks. In case logs are removed (chain reorg) previously returned logs are returned again but with the removed property set to true.

In case "fromBlock" > "toBlock" an error is returned.

https://eth.wiki/json-rpc/API#eth_newfilter

func (*PublicFilterAPI) NewHeads

func (api *PublicFilterAPI) NewHeads(ctx context.Context) (*rpc.Subscription, error)

NewHeads send a notification each time a new (header) block is appended to the chain.

func (*PublicFilterAPI) NewPendingTransactionFilter

func (api *PublicFilterAPI) NewPendingTransactionFilter() rpc.ID

NewPendingTransactionFilter creates a filter that fetches pending transaction hashes as transactions enter the pending state.

It is part of the filter package because this filter can be used through the `eth_getFilterChanges` polling method that is also used for log filters.

https://eth.wiki/json-rpc/API#eth_newpendingtransactionfilter

func (*PublicFilterAPI) NewPendingTransactions

func (api *PublicFilterAPI) NewPendingTransactions(ctx context.Context) (*rpc.Subscription, error)

NewPendingTransactions creates a subscription that is triggered each time a transaction enters the transaction pool and was signed from one of the transactions this nodes manages.

func (*PublicFilterAPI) SetChainConfig

func (api *PublicFilterAPI) SetChainConfig(chainConfig *params.ChainConfig)

SetChainConfig sets chain config

func (*PublicFilterAPI) UninstallFilter

func (api *PublicFilterAPI) UninstallFilter(id rpc.ID) bool

UninstallFilter removes the filter with the given filter id.

https://eth.wiki/json-rpc/API#eth_uninstallfilter

type Subscription

type Subscription struct {
	ID rpc.ID
	// contains filtered or unexported fields
}

Subscription is created when the client registers itself for a particular event.

func (*Subscription) Err

func (sub *Subscription) Err() <-chan error

Err returns a channel that is closed when unsubscribed.

func (*Subscription) Unsubscribe

func (sub *Subscription) Unsubscribe()

Unsubscribe uninstalls the subscription from the event broadcast loop.

type TestBackend

type TestBackend struct {
	DB ethdb.Database
	// contains filtered or unexported fields
}

func (*TestBackend) BloomStatus

func (b *TestBackend) BloomStatus() (uint64, uint64)

func (*TestBackend) ChainDb

func (b *TestBackend) ChainDb() ethdb.Database

func (*TestBackend) GetBorBlockLogs

func (b *TestBackend) GetBorBlockLogs(ctx context.Context, hash common.Hash) ([]*types.Log, error)

func (*TestBackend) GetBorBlockReceipt

func (b *TestBackend) GetBorBlockReceipt(ctx context.Context, hash common.Hash) (*types.Receipt, error)

func (*TestBackend) GetLogs

func (b *TestBackend) GetLogs(ctx context.Context, hash common.Hash) ([][]*types.Log, error)

func (*TestBackend) GetReceipts

func (b *TestBackend) GetReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error)

func (*TestBackend) HeaderByHash

func (b *TestBackend) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)

func (*TestBackend) HeaderByNumber

func (b *TestBackend) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error)

func (*TestBackend) ServiceFilter

func (b *TestBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession)

func (*TestBackend) SubscribeChainEvent

func (b *TestBackend) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription

func (*TestBackend) SubscribeLogsEvent

func (b *TestBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription

func (*TestBackend) SubscribeNewTxsEvent

func (b *TestBackend) SubscribeNewTxsEvent(ch chan<- core.NewTxsEvent) event.Subscription

func (*TestBackend) SubscribePendingLogsEvent

func (b *TestBackend) SubscribePendingLogsEvent(ch chan<- []*types.Log) event.Subscription

func (*TestBackend) SubscribeRemovedLogsEvent

func (b *TestBackend) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription

func (*TestBackend) SubscribeStateSyncEvent

func (b *TestBackend) SubscribeStateSyncEvent(ch chan<- core.StateSyncEvent) event.Subscription

type Type

type Type byte

Type determines the kind of filter and is used to put the filter in to the correct bucket when added.

const (
	// UnknownSubscription indicates an unknown subscription type
	UnknownSubscription Type = iota
	// LogsSubscription queries for new or removed (chain reorg) logs
	LogsSubscription
	// PendingLogsSubscription queries for logs in pending blocks
	PendingLogsSubscription
	// MinedAndPendingLogsSubscription queries for logs in mined and pending blocks.
	MinedAndPendingLogsSubscription
	// PendingTransactionsSubscription queries tx hashes for pending
	// transactions entering the pending state
	PendingTransactionsSubscription
	// BlocksSubscription queries hashes for blocks that are imported
	BlocksSubscription
	// StateSyncSubscription to listen main chain state
	StateSyncSubscription
	// LastIndexSubscription keeps track of the last index
	LastIndexSubscription
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL