diff options
author | Péter Szilágyi <peterke@gmail.com> | 2018-01-05 18:39:24 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-01-24 16:54:13 +0800 |
commit | 1bf508b449ebd42653f521ada92c782e8cb664d2 (patch) | |
tree | 1895aeb44d68b189a40a4023ca4869b1f3d1b955 /accounts/abi/bind/backend.go | |
parent | 02aeb3d76652a4c0451e5c3734e6881aefe46249 (diff) | |
download | go-tangerine-1bf508b449ebd42653f521ada92c782e8cb664d2.tar go-tangerine-1bf508b449ebd42653f521ada92c782e8cb664d2.tar.gz go-tangerine-1bf508b449ebd42653f521ada92c782e8cb664d2.tar.bz2 go-tangerine-1bf508b449ebd42653f521ada92c782e8cb664d2.tar.lz go-tangerine-1bf508b449ebd42653f521ada92c782e8cb664d2.tar.xz go-tangerine-1bf508b449ebd42653f521ada92c782e8cb664d2.tar.zst go-tangerine-1bf508b449ebd42653f521ada92c782e8cb664d2.zip |
accounts/abi/bind: support event filtering in abigen
Diffstat (limited to 'accounts/abi/bind/backend.go')
-rw-r--r-- | accounts/abi/bind/backend.go | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/accounts/abi/bind/backend.go b/accounts/abi/bind/backend.go index a7ca7bfc0..ca60cc1b4 100644 --- a/accounts/abi/bind/backend.go +++ b/accounts/abi/bind/backend.go @@ -52,12 +52,6 @@ type ContractCaller interface { CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error) } -// DeployBackend wraps the operations needed by WaitMined and WaitDeployed. -type DeployBackend interface { - TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) - CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error) -} - // PendingContractCaller defines methods to perform contract calls on the pending state. // Call will try to discover this interface when access to the pending state is requested. // If the backend does not support the pending state, Call returns ErrNoPendingState. @@ -90,8 +84,29 @@ type ContractTransactor interface { SendTransaction(ctx context.Context, tx *types.Transaction) error } +// ContractFilterer defines the methods needed to access log events using one-off +// queries or continuous event subscriptions. +type ContractFilterer interface { + // FilterLogs executes a log filter operation, blocking during execution and + // returning all the results in one batch. + // + // TODO(karalabe): Deprecate when the subscription one can return past data too. + FilterLogs(ctx context.Context, query ethereum.FilterQuery) ([]types.Log, error) + + // SubscribeFilterLogs creates a background log filtering operation, returning + // a subscription immediately, which can be used to stream the found events. + SubscribeFilterLogs(ctx context.Context, query ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error) +} + +// DeployBackend wraps the operations needed by WaitMined and WaitDeployed. +type DeployBackend interface { + TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) + CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error) +} + // ContractBackend defines the methods needed to work with contracts on a read-write basis. type ContractBackend interface { ContractCaller ContractTransactor + ContractFilterer } |