eth

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2022 License: MIT, MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WatchHeadChanges

func WatchHeadChanges(ctx context.Context, src NewHeadSource, fn HeadSignalFn) (ethereum.Subscription, error)

WatchHeadChanges wraps a new-head subscription from NewHeadSource to feed the given Tracker

Types

type BlockByHashFn

type BlockByHashFn func(ctx context.Context, hash common.Hash) (*types.Block, error)

func (BlockByHashFn) BlockByHash

func (fn BlockByHashFn) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)

type BlockByHashSource

type BlockByHashSource interface {
	BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)
}

type BlockByNumFn

type BlockByNumFn func(ctx context.Context, number *big.Int) (*types.Block, error)

func (BlockByNumFn) BlockByNumber

func (fn BlockByNumFn) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)

type BlockByNumberSource

type BlockByNumberSource interface {
	BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
}

type BlockID

type BlockID struct {
	Hash   common.Hash
	Number uint64
}

func (BlockID) String

func (id BlockID) String() string

func (BlockID) TerminalString

func (id BlockID) TerminalString() string

TerminalString implements log.TerminalStringer, formatting a string for console output during logging.

type BlockLinkByNumber

type BlockLinkByNumber interface {
	BlockLinkByNumber(ctx context.Context, num uint64) (self BlockID, parent BlockID, err error)
}

BlockLinkByNumber Retrieves the *currently* canonical block-hash at the given block-height, and the parent before it. The results of this should not be cached, or the cache needs to be reorg-aware.

func CanonicalChain

func CanonicalChain(l1Src HeaderByNumberSource) BlockLinkByNumber

CanonicalChain presents the block-hashes by height by wrapping a header-source (useful due to lack of a direct JSON RPC endpoint)

type BlockLinkByNumberFn

type BlockLinkByNumberFn func(ctx context.Context, num uint64) (self BlockID, parent BlockID, err error)

BlockLinkByNumberFn implements BlockLinkByNumber to implement the interface as anonymous function

func (BlockLinkByNumberFn) BlockLinkByNumber

func (fn BlockLinkByNumberFn) BlockLinkByNumber(ctx context.Context, num uint64) (self BlockID, parent BlockID, err error)

type BlockSource

type BlockSource interface {
	BlockByHashSource
	BlockByNumberSource
}

type CombinedL1Source

type CombinedL1Source struct {
	// contains filtered or unexported fields
}

CombinedL1Source implements round-robin between multiple L1 sources, to divide concurrent requests to multiple endpoints

func (*CombinedL1Source) BlockByHash

func (cs *CombinedL1Source) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)

func (*CombinedL1Source) Close

func (cs *CombinedL1Source) Close()

func (*CombinedL1Source) HeaderByHash

func (cs *CombinedL1Source) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)

func (*CombinedL1Source) HeaderByNumber

func (cs *CombinedL1Source) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)

func (*CombinedL1Source) SubscribeNewHead

func (cs *CombinedL1Source) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)

func (*CombinedL1Source) TransactionReceipt

func (cs *CombinedL1Source) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)

type HeadSignal

type HeadSignal struct {
	Parent BlockID
	Self   BlockID
}

type HeadSignalFn

type HeadSignalFn func(sig HeadSignal)

HeadSignalFn is used as callback function to accept head-signals

type HeaderByHashFn

type HeaderByHashFn func(ctx context.Context, hash common.Hash) (*types.Header, error)

func (HeaderByHashFn) HeaderByHash

func (fn HeaderByHashFn) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)

type HeaderByHashSource

type HeaderByHashSource interface {
	HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)
}

type HeaderByNumberFn

type HeaderByNumberFn func(ctx context.Context, number *big.Int) (*types.Header, error)

func (HeaderByNumberFn) HeaderByNumber

func (fn HeaderByNumberFn) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)

type HeaderByNumberSource

type HeaderByNumberSource interface {
	HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
}

type L1Source

func NewCombinedL1Source

func NewCombinedL1Source(sources []L1Source) L1Source

type NewHeadFn

type NewHeadFn func(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)

func (NewHeadFn) SubscribeNewHead

func (fn NewHeadFn) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)

type NewHeadSource

type NewHeadSource interface {
	SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)
}

type ReceiptFn

type ReceiptFn func(ctx context.Context, txHash common.Hash) (*types.Receipt, error)

func (ReceiptFn) TransactionReceipt

func (fn ReceiptFn) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)

type ReceiptSource

type ReceiptSource interface {
	TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL