accounts/abi/bind use subscribeFilterLogs, typos

This commit is contained in:
Marius van der Wijden 2019-12-13 01:56:03 +01:00 committed by GitHub
parent f51cf573b5
commit c0e521ce4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -166,7 +166,7 @@ func (c *BoundContract) Call(opts *CallOpts, result interface{}, method string,
// Transact invokes the (paid) contract method with params as input values. // Transact invokes the (paid) contract method with params as input values.
func (c *BoundContract) Transact(opts *TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { func (c *BoundContract) Transact(opts *TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
// Otherwise pack up the parameters and invoke the contract // Pack up the parameters and invoke the contract
input, err := c.abi.Pack(method, params...) input, err := c.abi.Pack(method, params...)
if err != nil { if err != nil {
return nil, err return nil, err
@ -269,24 +269,7 @@ func (c *BoundContract) FilterLogs(opts *FilterOpts, name string, query ...[]int
if opts.End != nil { if opts.End != nil {
config.ToBlock = new(big.Int).SetUint64(*opts.End) config.ToBlock = new(big.Int).SetUint64(*opts.End)
} }
/* TODO(karalabe): Replace the rest of the method below with this when supported
sub, err := c.filterer.SubscribeFilterLogs(ensureContext(opts.Context), config, logs) sub, err := c.filterer.SubscribeFilterLogs(ensureContext(opts.Context), config, logs)
*/
buff, err := c.filterer.FilterLogs(ensureContext(opts.Context), config)
if err != nil {
return nil, nil, err
}
sub, err := event.NewSubscription(func(quit <-chan struct{}) error {
for _, log := range buff {
select {
case logs <- log:
case <-quit:
return nil
}
}
return nil
}), nil
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }