mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
accounts/abi/bind use subscribeFilterLogs, typos
This commit is contained in:
parent
f51cf573b5
commit
c0e521ce4c
1 changed files with 1 additions and 18 deletions
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue