core

package
v0.0.12-rc.1 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2020 License: AGPL-3.0 Imports: 9 Imported by: 68

Documentation

Index

Constants

View Source
const (
	KOVAN_NETWORK_ID = 42
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockChain

type BlockChain interface {
	ContractDataFetcher
	GetEthLogsWithCustomQuery(query ethereum.FilterQuery) ([]types.Log, error)
	GetHeaderByNumber(blockNumber int64) (Header, error)
	GetHeadersByNumbers(blockNumbers []int64) ([]Header, 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 EventLog added in v0.1.0

type EventLog struct {
	ID          int64
	HeaderID    int64 `db:"header_id"`
	Log         types.Log
	Transformed bool
}
type Header struct {
	Id          int64
	BlockNumber int64 `db:"block_number"`
	Hash        string
	Raw         []byte
	Timestamp   string `db:"block_timestamp"`
}

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.Uint64 `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              []ReceiptLog
	StateRoot         string `db:"state_root"`
	Status            int
	TxHash            string `db:"tx_hash"`
	Rlp               []byte `db:"rlp"`
}

type ReceiptLog added in v0.1.0

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

type RpcClient

type RpcClient interface {
	CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
	BatchCall(batch []client.BatchElem) error
	IpcPath() string
	Subscribe(namespace string, payloadChan interface{}, args ...interface{}) (*rpc.ClientSubscription, 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 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