watcher

package module
v0.0.0-...-b661cd2 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = os.ErrNotExist

Functions

This section is empty.

Types

type EthereumAPIClient

type EthereumAPIClient interface {
	GetTxByBlockNumberAndIndex(ctx context.Context, block *big.Int, index uint) (EthereumTx, error)
	GetBlockByNumber(context.Context, *big.Int) (EthereumBlock, error)
	GetLastBlockNumber(context.Context) (*big.Int, error)
	io.Closer
}

func NewEthereumInfuraClient

func NewEthereumInfuraClient(url string) (EthereumAPIClient, error)

type EthereumBlock

type EthereumBlock interface {
	Txs() []EthereumTx
	Number() *big.Int
}

type EthereumFinEvent

type EthereumFinEvent interface {
	Event
	WithTx
}

func NewEthereumFinEvent

func NewEthereumFinEvent(tx EthereumTx) (EthereumFinEvent, error)

type EthereumTx

type EthereumTx interface {
	Tx
	Index() uint
	EthereumTx() *types.Transaction
	Gas() *big.Int
	GasPrice() *big.Int
	GasFeeCap() *big.Int
	GasTipCap() *big.Int
}

func NewEthereumTx

func NewEthereumTx(tx *types.Transaction, sender *common.Address, block *big.Int, index uint) (EthereumTx, error)

type EthereumTxEvent

type EthereumTxEvent interface {
	Event
	WithTx
}

func NewEthereumTxEvent

func NewEthereumTxEvent(tx EthereumTx) (EthereumTxEvent, error)

type EthereumWatcher

type EthereumWatcher interface {
	Watcher
}

func NewEthereumWatcher

func NewEthereumWatcher(client EthereumAPIClient, nextBlockNum *big.Int, repo Repo) (EthereumWatcher, error)

type Event

type Event interface {
	Kind() string
	Net() string
	MarshalYAML() []byte
}

type EventLog

type EventLog interface {
	Emit(Event) error
	io.Closer
}

func NewFileEventLog

func NewFileEventLog(file *os.File) (EventLog, error)

type FinEvent

type FinEvent interface {
	Event
	TxID() []byte
}

type Repo

type Repo interface {
	StoreTxsByBlockID(Tx) error
	FindTxsByBlockID(blockID *big.Int) ([]Tx, error)
	PurgeTxsByBlockID(blockID *big.Int) error
}

func NewMemRepo

func NewMemRepo() (Repo, error)

type Tx

type Tx interface {
	Sender() []byte
	Receiver() []byte
	ID() []byte
	Amount() *big.Int
	Net() string
	Kind() string
	Block() *big.Int
}

type Watcher

type Watcher interface {
	Pull(ctx context.Context) ([]Event, error)
	io.Closer
}

type WithTx

type WithTx interface {
	Tx() Tx
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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