ethereum

package
v0.34.4 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2021 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const ConsumerScope = "EthereumConsumer"
View Source
const Scope = "Ethereum"

Variables

This section is empty.

Functions

func Consume

func Consume(client ThrottleClient, filter *chain.Filter, blockRange *rpcevents.BlockRange, config *chain.BlockConsumerConfig,
	logger *logging.Logger, consume func(block chain.Block) error) error

func NewThrottleClient added in v0.31.2

func NewThrottleClient(client EthClient, maxRequests int, timeBase time.Duration, logger *logging.Logger) *throttleClient

Types

type Block

type Block struct {
	Height       uint64
	Transactions []chain.Transaction
	// contains filtered or unexported fields
}

func (*Block) GetHeight

func (b *Block) GetHeight() uint64

func (*Block) GetMetadata

func (b *Block) GetMetadata(columns types.SQLColumnNames) (map[string]interface{}, error)

func (*Block) GetTxs

func (b *Block) GetTxs() []chain.Transaction

type Chain

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

func New

func New(client EthClient, filter *chain.Filter, consumerConfig *chain.BlockConsumerConfig,
	logger *logging.Logger) (*Chain, error)

We rely on this failing if the chain is not an Ethereum Chain

func (*Chain) Close

func (c *Chain) Close() error

func (*Chain) Connectivity

func (c *Chain) Connectivity() connectivity.State

func (*Chain) ConsumeBlocks

func (c *Chain) ConsumeBlocks(ctx context.Context, in *rpcevents.BlockRange, consumer func(chain.Block) error) error

func (*Chain) GetABI

func (c *Chain) GetABI(ctx context.Context, address crypto.Address) (string, error)

func (*Chain) GetChainID

func (c *Chain) GetChainID() string

func (*Chain) GetVersion

func (c *Chain) GetVersion() string

func (*Chain) StatusMessage

func (c *Chain) StatusMessage(ctx context.Context, lastProcessedHeight uint64) []interface{}

type EthClient added in v0.31.1

type EthClient interface {
	GetLogs(filter *ethclient.Filter) ([]*ethclient.EthLog, error)
	BlockNumber() (uint64, error)
	GetBlockByNumber(height string) (*ethclient.Block, error)
	NetVersion() (string, error)
	Web3ClientVersion() (string, error)
	Syncing() (bool, error)
}

type Event

type Event struct {
	exec.LogEvent
	Height uint64
	// Index of event in entire block (what ethereum provides us with
	IndexInBlock uint64
	// Index of event in transaction
	Index           uint64
	TransactionHash binary.HexBytes
}

func (*Event) Get

func (ev *Event) Get(key string) (value interface{}, ok bool)

func (*Event) GetAddress

func (ev *Event) GetAddress() crypto.Address

func (*Event) GetData

func (ev *Event) GetData() []byte

func (*Event) GetIndex

func (ev *Event) GetIndex() uint64

func (*Event) GetTopics

func (ev *Event) GetTopics() []binary.Word256

func (*Event) GetTransactionHash

func (ev *Event) GetTransactionHash() binary.HexBytes

type ThrottleClient added in v0.31.2

type ThrottleClient interface {
	EthClient
	Throttle()
}

type Throttler added in v0.31.2

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

func NewThrottler added in v0.31.2

func NewThrottler(maxRequests int, timeBase time.Duration, window time.Duration, logger *logging.Logger) *Throttler

func (*Throttler) Throttle added in v0.31.2

func (t *Throttler) Throttle()

type Transaction

type Transaction struct {
	Height uint64
	Index  uint64
	Hash   binary.HexBytes
	Events []chain.Event
}

func NewEthereumTransaction

func NewEthereumTransaction(log *Event) *Transaction

func (*Transaction) GetEvents

func (tx *Transaction) GetEvents() []chain.Event

func (*Transaction) GetException

func (tx *Transaction) GetException() *errors.Exception

func (*Transaction) GetHash

func (tx *Transaction) GetHash() binary.HexBytes

func (*Transaction) GetIndex

func (tx *Transaction) GetIndex() uint64

func (*Transaction) GetMetadata

func (tx *Transaction) GetMetadata(columns types.SQLColumnNames) (map[string]interface{}, error)

func (*Transaction) GetOrigin

func (tx *Transaction) GetOrigin() *chain.Origin

Jump to

Keyboard shortcuts

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