core

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2019 License: AGPL-3.0 Imports: 8 Imported by: 49

Documentation

Index

Constants

View Source
const (
	KOVAN_NETWORK_ID = 42
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountDataFetcher

type AccountDataFetcher interface {
	GetAccountBalance(address common.Address, blockNumber *big.Int) (*big.Int, error)
}

type Block

type Block struct {
	Reward       string `db:"reward"`
	Difficulty   int64  `db:"difficulty"`
	ExtraData    string `db:"extra_data"`
	GasLimit     uint64 `db:"gas_limit"`
	GasUsed      uint64 `db:"gas_used"`
	Hash         string `db:"hash"`
	IsFinal      bool   `db:"is_final"`
	Miner        string `db:"miner"`
	Nonce        string `db:"nonce"`
	Number       int64  `db:"number"`
	ParentHash   string `db:"parent_hash"`
	Size         string `db:"size"`
	Time         int64  `db:"time"`
	Transactions []TransactionModel
	UncleHash    string `db:"uncle_hash"`
	UnclesReward string `db:"uncles_reward"`
	Uncles       []Uncle
}

type BlockChain

type BlockChain interface {
	ContractDataFetcher
	AccountDataFetcher
	GetBlockByNumber(blockNumber int64) (Block, error)
	GetEthLogsWithCustomQuery(query ethereum.FilterQuery) ([]types.Log, error)
	GetHeaderByNumber(blockNumber int64) (Header, error)
	GetHeaderByNumbers(blockNumbers []int64) ([]Header, error)
	GetLogs(contract Contract, startingBlockNumber *big.Int, endingBlockNumber *big.Int) ([]Log, error)
	GetTransactions(transactionHashes []common.Hash) ([]TransactionModel, error)
	LastBlock() (*big.Int, error)
	Node() Node
}

type Contract

type Contract struct {
	Abi          string
	Hash         string
	Transactions []TransactionModel
}

type ContractDataFetcher

type ContractDataFetcher interface {
	FetchContractData(abiJSON string, address string, method string, methodArgs []interface{}, result interface{}, blockNumber int64) error
}

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)
}
type Header struct {
	Id          int64
	BlockNumber int64 `db:"block_number"`
	Hash        string
	Raw         []byte
	Timestamp   string `db:"block_timestamp"`
}

type Log

type Log struct {
	BlockNumber int64
	TxHash      string
	Address     string
	Topics
	Index int64
	Data  string
}

type Node

type Node struct {
	GenesisBlock string
	NetworkID    float64
	ID           string
	ClientName   string
}

type NodeType

type NodeType int
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.Big   `json:"timestamp"        gencodec:"required"`
	Extra       hexutil.Bytes  `json:"extraData"        gencodec:"required"`
	Hash        common.Hash    `json:"hash"`
}

type ParityNodeInfo

type ParityNodeInfo struct {
	Track         string
	ParityVersion `json:"version"`
	Hash          string
}

func (ParityNodeInfo) String

func (pn ParityNodeInfo) String() string

type ParityVersion

type ParityVersion struct {
	Major int
	Minor int
	Patch int
}

type Receipt

type Receipt struct {
	Bloom             string
	ContractAddress   string `db:"contract_address"`
	CumulativeGasUsed uint64 `db:"cumulative_gas_used"`
	GasUsed           uint64 `db:"gas_used"`
	Logs              []Log
	StateRoot         string `db:"state_root"`
	Status            int
	TxHash            string `db:"tx_hash"`
	Rlp               []byte `db:"rlp"`
}

type RpcClient

type RpcClient interface {
	CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
	BatchCall(batch []client.BatchElem) error
	IpcPath() string
	SupportedModules() (map[string]string, error)
}

type RpcTransaction

type RpcTransaction struct {
	Nonce            string `json:"nonce"`
	GasPrice         string `json:"gasPrice"`
	GasLimit         string `json:"gas"`
	Recipient        string `json:"to"`
	Amount           string `json:"value"`
	Payload          string `json:"input"`
	V                string `json:"v"`
	R                string `json:"r"`
	S                string `json:"s"`
	Hash             string
	From             string
	TransactionIndex string `json:"transactionIndex"`
}

type Topics

type Topics [4]string

type TransactionModel

type TransactionModel struct {
	Data     []byte `db:"input_data"`
	From     string `db:"tx_from"`
	GasLimit uint64 `db:"gas_limit"`
	GasPrice int64  `db:"gas_price"`
	Hash     string
	Nonce    uint64
	Raw      []byte `db:"raw"`
	Receipt
	To      string `db:"tx_to"`
	TxIndex int64  `db:"tx_index"`
	Value   string
}

type Uncle

type Uncle struct {
	Id        int64
	Miner     string
	Reward    string
	Hash      string
	Timestamp string `db:"block_timestamp"`
	Raw       []byte
}

type WatchedEvent

type WatchedEvent struct {
	LogID       int64  `json:"log_id" db:"id"`
	Name        string `json:"name"`
	BlockNumber int64  `json:"block_number" db:"block_number"`
	Address     string `json:"address"`
	TxHash      string `json:"tx_hash" db:"tx_hash"`
	Index       int64  `json:"index"`
	Topic0      string `json:"topic0"`
	Topic1      string `json:"topic1"`
	Topic2      string `json:"topic2"`
	Topic3      string `json:"topic3"`
	Data        string `json:"data"`
}

Jump to

Keyboard shortcuts

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