Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CachedLogs ¶
type CachedLogs struct {
// contains filtered or unexported fields
}
CachedLogs caches Ethereum logs in memory up to a certain range.
func NewCachedLogs ¶
func NewCachedLogs(getter LogsGetter, cacheMaxRange, getterMaxRange uint64) *CachedLogs
NewCachedLogs creates a new CachedLogs instance.
The getter provides logs for the requested block range. The cacheMaxRange is the maximum number of blocks that can be cached. The getterMaxRange is the maximum number of blocks that can be requested from the getter in a single call. If zero, the getter is called once for the entire range.
type ERC20 ¶
type ERC20 struct {
// contains filtered or unexported fields
}
func (*ERC20) GetDetails ¶
func (*ERC20) GetSymbolAndDecimals ¶
type LogsGetter ¶
type LogsGetter interface {
GetLogs(ctx context.Context, fromBlock, toBlock uint64) ([]types.Log, error)
}
LogsGetter is an interface that provides Ethereum logs for a given block range.
type LogsIterator ¶
type LogsIterator struct {
// contains filtered or unexported fields
}
LogsIterator provides methods to iterate over Ethereum logs in batches.
func NewLogsIterator ¶
func NewLogsIterator(client LogsIteratorRPC, batchSize uint64, query types.FilterLogsQuery) *LogsIterator
NewLogsIterator creates a new LogsIterator instance.
func (*LogsIterator) IterateRange ¶
func (i *LogsIterator) IterateRange(ctx context.Context, blocks uint64, fn func(ctx context.Context, log types.Log) (bool, error)) error
IterateRange iterates over logs within the specified block range. It calls the provided function for each log and stops iteration if the function returns false.
Method is not thread safe.
func (*LogsIterator) IterateSince ¶
func (i *LogsIterator) IterateSince(ctx context.Context, since time.Time, fn func(ctx context.Context, log types.Log) (bool, error)) error
IterateSince iterates over logs until the specified time. It calls the provided function for each log and stops iteration if the function returns false.
Note, since logs don't have timestamps, only the timestamp of the oldest block in the batch is checked against the since time. This means some logs might be returned even if they are older than the specified time.
Method is not thread safe.