Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Contract ¶
type ContractEvent ¶
type ContractEvent struct { // block in which the transaction was included BlockNumber uint64 // hash of the block in which the transaction was included BlockHash common.Hash // hash of the transaction TxHash common.Hash // contract which the event belongs to Contract *Contract // name of the contract event Name string // supplied by the contract, usually ABI-encoded Data []byte // The Removed field is true if this log was reverted due to a chain reorganisation. // You must pay attention to this field if you receive logs through a filter query. Removed bool }
type EthClient ¶
type EthClient interface { // SubscribeNewHead subscribes to notifications about the current blockchain head // on the given channel. SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error) // FilterLogs executes a filter query. FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error) // SubscribeFilterLogs subscribes to the results of a streaming filter query. SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error) // TransactionReceipt returns the receipt of a transaction by transaction hash. // Note that the receipt is not available for pending transactions. TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) // BlockByHash returns the given full block. // // Note that loading full blocks requires two requests. Use HeaderByHash // if you don't need all transactions or uncle headers. BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error) }
type EventListener ¶
type EventListener struct {
// contains filtered or unexported fields
}
func NewEventListener ¶
func NewEventListener(client EthClient, contracts []*Contract) *EventListener
func (*EventListener) Listen ¶
func (el *EventListener) Listen(fromBlock *big.Int, eventCh chan<- *ContractEvent, stop <-chan struct{}) error
func (*EventListener) Parse ¶
func (el *EventListener) Parse(l types.Log) *ContractEvent
Click to show internal directories.
Click to hide internal directories.