mirror of
https://github.com/scroll-tech/scroll.git
synced 2026-01-23 12:58:15 -05:00
Co-authored-by: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com> Co-authored-by: colin <102356659+colinlyguo@users.noreply.github.com> Co-authored-by: colinlyguo <colinlyguo@gmail.com>
22 lines
550 B
Go
22 lines
550 B
Go
package l2
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/scroll-tech/go-ethereum/core/types"
|
|
)
|
|
|
|
// WatcherAPI watcher api service
|
|
type WatcherAPI interface {
|
|
GetTracesByBatchIndex(ctx context.Context, index uint64) ([]*types.BlockTrace, error)
|
|
}
|
|
|
|
// GetTracesByBatchIndex get traces by batch_id.
|
|
func (w *WatcherClient) GetTracesByBatchIndex(ctx context.Context, index uint64) ([]*types.BlockTrace, error) {
|
|
id, err := w.orm.GetBatchIDByIndex(index)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return w.orm.GetBlockTraces(map[string]interface{}{"batch_id": id})
|
|
}
|