core

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2020 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KOVAN_NETWORK_ID = 42
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EthClient

type EthClient interface {
	BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
	CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
	FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)
	HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
	TransactionSender(ctx context.Context, tx *types.Transaction, block common.Hash, index uint) (common.Address, error)
	TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
	BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
}

EthClient is a top level interface for an ethereum client

type Fetcher added in v0.1.0

type Fetcher interface {
	GetHeaderByNumber(blockNumber int64) (Header, error)
	GetHeadersByNumbers(blockNumbers []int64) ([]Header, error)
	LastBlock() (*big.Int, error)
	Node() Node
}

Fetcher is a top level interface for fetching ethereum data

type Header struct {
	ID          int64
	BlockNumber int64 `db:"block_number"`
	Hash        string
	Raw         []byte
	Timestamp   string `db:"block_timestamp"`
}

Header is the internal ethereum header type

type HeaderRepository added in v0.1.0

type HeaderRepository interface {
	CreateOrUpdateHeader(header Header) (int64, error)
	GetHeader(blockNumber int64) (Header, error)
	MissingBlockNumbers(startingBlockNumber, endingBlockNumber int64, nodeID string) ([]int64, error)
}

HeaderRepository is the top level interface for the Postgres header repository

type Node

type Node struct {
	GenesisBlock string
	NetworkID    string
	ChainID      uint64
	ID           string
	ClientName   string
}

Node holds params for the Ethereum client

type NodeType

type NodeType int

NodeType is an enum to represent different node types

const (
	GETH NodeType = iota
	PARITY
	INFURA
	GANACHE
)

type POAHeader

type POAHeader struct {
	ParentHash  common.Hash    `json:"parentHash"       gencodec:"required"`
	UncleHash   common.Hash    `json:"sha3Uncles"       gencodec:"required"`
	Coinbase    common.Address `json:"miner"            gencodec:"required"`
	Root        common.Hash    `json:"stateRoot"        gencodec:"required"`
	TxHash      common.Hash    `json:"transactionsRoot" gencodec:"required"`
	ReceiptHash common.Hash    `json:"receiptsRoot"     gencodec:"required"`
	Bloom       types.Bloom    `json:"logsBloom"        gencodec:"required"`
	Difficulty  *hexutil.Big   `json:"difficulty"       gencodec:"required"`
	Number      *hexutil.Big   `json:"number"           gencodec:"required"`
	GasLimit    hexutil.Uint64 `json:"gasLimit"         gencodec:"required"`
	GasUsed     hexutil.Uint64 `json:"gasUsed"          gencodec:"required"`
	Time        hexutil.Uint64 `json:"timestamp"        gencodec:"required"`
	Extra       hexutil.Bytes  `json:"extraData"        gencodec:"required"`
	Hash        common.Hash    `json:"hash"`
}

POAHeader is the internal POA ethereum header type

type RPCClient added in v0.1.0

type RPCClient interface {
	CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
	BatchCall(batch []client.BatchElem) error
	RPCPath() string
	SupportedModules() (map[string]string, error)
	Subscribe(namespace string, payloadChan interface{}, args ...interface{}) (*rpc.ClientSubscription, error)
}

RPCClient is the top level interface for an Ethereum RPC client

Jump to

Keyboard shortcuts

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