eth

package
v0.0.0-...-320257d Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	ChainID uint64
	// contains filtered or unexported fields
}

Client implements the ClientInterf that reads data from the Ethereum blockchain

func New

func New(opts Options) (*Client, error)

New loads a new Client

func (*Client) Sync

func (c *Client) Sync() error

Sync synchronizes the blocknums and events since the last synced block to the current one, and then live syncs the new ones

type ClientInterf

type ClientInterf interface {
	// Sync scans the contract activity since the given fromBlock until the
	// current block, storing in the database all the updates on the
	// Processess
	Start(fromBlock uint64) error
}

ClientInterf defines the interface that synchronizes with the Ethereum blockchain to obtain the processes data

type Options

type Options struct {
	EthURL       string
	SQLite       *db.SQLite
	ContractAddr common.Address
}

Options is used to pass the parameters to load a new Client

type TestEthClient

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

TestEthClient simulates an EthReader for testing purposes

func NewTestEthClient

func NewTestEthClient(sqlite *db.SQLite, startBlock uint64,
	blocks map[uint64][]TestEvent) *TestEthClient

NewTestEthClient returns a new TestEthClient with the given configuration

func (*TestEthClient) AdvanceBlock

func (e *TestEthClient) AdvanceBlock() error

AdvanceBlock simulates the advance of the EthBlockNum in the TestEthClient

func (*TestEthClient) Start

func (e *TestEthClient) Start(fromBlock uint64) error

Start implements the EthReader.Start method of the interface

type TestEvent

type TestEvent types.Process

TestEvent is used to simulate creation of new processes in the SmartContract

Jump to

Keyboard shortcuts

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