types

package
v0.18.15 Latest Latest
Warning

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

Go to latest
Published: May 17, 2022 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EarliestBlockNumber = 0
	LatestBlockNumber   = -1
	PendingBlockNumber  = -2
	// InitialBlockNumber as tendermint starts at 1 for genesis
	InitialBlockNumber = 1
)

Variables

This section is empty.

Functions

func BlockMaxGasFromConsensusParams

func BlockMaxGasFromConsensusParams(tmClient rpcclient.Client) (uint64, error)

BlockMaxGasFromConsensusParams returns the gas limit for the latest block from the chain consensus params.

func EthTransactionsFromTendermint

func EthTransactionsFromTendermint(block *tmtypes.Block, fullTx bool) ([]interface{}, uint64, error)

EthTransactionsFromTendermint returns a slice of ethereum transaction hashes and the total gas usage from a set of tendermint block transactions.

func GetBlockBloom

func GetBlockBloom(events []abci.Event) vm.Bloom

GetBlockBloom from tm events

func GetBlockCumulativeGas

func GetBlockCumulativeGas(block *tmtypes.Block, idx int) uint64

GetBlockCumulativeGas returns the cumulative gas used on a block up to a given transaction index. The returned gas used includes the gas from both the SDK and EVM module transactions.

func NewRevertError

func NewRevertError(result *vm.ExecutionResult) *revertError

func ParseLegacyTx

func ParseLegacyTx(tmTx tmtypes.Tx) (*action.SignedTx, error)

ParseLegacyTx is used to parse the signed tx for old OneLedger tx types

func StateAndHeaderByNumberOrHash

func StateAndHeaderByNumberOrHash(blockStore *store.BlockStore, blockNrOrHash rpc.BlockNumberOrHash) (int64, error)

Types

type Block

type Block struct {
	Number           hexutil.Uint64      `json:"number"`
	Hash             common.Hash         `json:"hash"`
	ParentHash       common.Hash         `json:"parentHash"`
	Nonce            ethtypes.BlockNonce `json:"nonce"`
	Sha3Uncles       common.Hash         `json:"sha3Uncles"`
	LogsBloom        vm.Bloom            `json:"logsBloom"`
	TransactionsRoot common.Hash         `json:"transactionsRoot"`
	StateRoot        common.Hash         `json:"stateRoot"`
	Miner            common.Address      `json:"miner"`
	MixHash          common.Hash         `json:"mixHash"`
	Difficulty       hexutil.Uint64      `json:"difficulty"`
	TotalDifficulty  hexutil.Uint64      `json:"totalDifficulty"`
	ExtraData        hexutil.Bytes       `json:"extraData"`
	Size             hexutil.Uint64      `json:"size"`
	GasLimit         *hexutil.Big        `json:"gasLimit"`
	GasUsed          *hexutil.Big        `json:"gasUsed"`
	Timestamp        hexutil.Uint64      `json:"timestamp"`
	Uncles           []common.Hash       `json:"uncles"`
	ReceiptsRoot     common.Hash         `json:"receiptsRoot"`
	Transactions     []interface{}       `json:"transactions"`
}

Block represents a block returned to RPC clients.

func EthBlockFromTendermint

func EthBlockFromTendermint(block *tmtypes.Block, fullTx bool) (*Block, error)

EthBlockFromTendermint returns a JSON-RPC compatible Ethereum blockfrom a given Tendermint block.

type CallArgs

type CallArgs struct {
	From     common.Address  `json:"from"`
	To       *common.Address `json:"to"`
	Gas      hexutil.Uint64  `json:"gas"`
	GasPrice *hexutil.Big    `json:"gasPrice"`
	Value    *hexutil.Big    `json:"value"`
	Data     hexutil.Bytes   `json:"data"`
}

CallArgs represents the arguments for a call.

type EthService

type EthService interface {
	Web3Service
	GetBlockStore() *store.BlockStore
	GetStateDB() *vm.CommitStateDB
}
type Header 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       vm.Bloom            `json:"logsBloom"        gencodec:"required"`
	Difficulty  *big.Int            `json:"difficulty"       gencodec:"required"`
	Number      *big.Int            `json:"number"           gencodec:"required"`
	GasLimit    *big.Int            `json:"gasLimit"         gencodec:"required"`
	GasUsed     *big.Int            `json:"gasUsed"          gencodec:"required"`
	Time        uint64              `json:"timestamp"        gencodec:"required"`
	Extra       []byte              `json:"extraData"        gencodec:"required"`
	Hash        common.Hash         `json:"hash"`
	Size        uint64              `json:"size"`
	MixDigest   common.Hash         `json:"mixHash"`
	Nonce       ethtypes.BlockNonce `json:"nonce"`
}

Header represents a block header in the Ethereum blockchain.

func EthHeaderFromTendermint

func EthHeaderFromTendermint(block *tmtypes.Block) (*Header, error)

EthHeaderFromTendermint is an util function that returns an Ethereum Header from a tendermint Block header.

type LogReceipt

type LogReceipt struct {
	Bloom           vm.Bloom
	Logs            []*ethtypes.Log
	Status          uint64
	ContractAddress *common.Address
}

func GetTxEthLogs

func GetTxEthLogs(res *abci.ResponseDeliverTx, txIndex uint32) *LogReceipt

GetTxEthLogs substract logs from deliver response

type Transaction

type Transaction struct {
	BlockHash        *common.Hash    `json:"blockHash"`
	BlockNumber      *hexutil.Big    `json:"blockNumber"`
	From             common.Address  `json:"from"`
	Gas              hexutil.Uint64  `json:"gas"`
	GasPrice         *hexutil.Big    `json:"gasPrice"`
	Hash             common.Hash     `json:"hash"`
	Input            hexutil.Bytes   `json:"input"`
	Nonce            hexutil.Uint64  `json:"nonce"`
	To               *common.Address `json:"to"`
	TransactionIndex *hexutil.Uint64 `json:"transactionIndex"`
	Value            hexutil.Big     `json:"value"`
	V                *hexutil.Big    `json:"v"`
	R                *common.Hash    `json:"r"`
	S                *common.Hash    `json:"s"`
}

Transaction represents a transaction returned to RPC clients.

func LegacyRawBlockAndTxToEthTx

func LegacyRawBlockAndTxToEthTx(tmBlock *tmtypes.Block, tmTx *tmtypes.Tx, chainID *big.Int, txIndex *hexutil.Uint64) (*Transaction, error)

LegacyRawBlockAndTxToEthTx returns a eth Transaction compatible from the legacy tx structure.

type TransactionReceipt

type TransactionReceipt struct {
	// Consensus fields: These fields are defined by the Yellow Paper
	Status            hexutil.Uint64  `json:"status"`
	CumulativeGasUsed hexutil.Uint64  `json:"cumulativeGasUsed"`
	LogsBloom         vm.Bloom        `json:"logsBloom"`
	Logs              []*ethtypes.Log `json:"logs"`

	// Implementation fields: These fields are added by geth when processing a transaction.
	// They are stored in the chain database.
	TransactionHash common.Hash     `json:"transactionHash"`
	ContractAddress *common.Address `json:"contractAddress"`
	GasUsed         hexutil.Uint64  `json:"gasUsed"`

	// Inclusion information: These fields provide information about the inclusion of the
	// transaction corresponding to this receipt.
	BlockHash        common.Hash    `json:"blockHash"`
	BlockNumber      hexutil.Big    `json:"blockNumber"`
	TransactionIndex hexutil.Uint64 `json:"transactionIndex"`

	// sender and receiver (contract or EOA) addresses
	From common.Address  `json:"from"`
	To   *common.Address `json:"to"`
}

TransactionReceipt represents a mined transaction returned to RPC clients.

type Web3Context

type Web3Context interface {
	// propagation structures
	GetLogger() *log.Logger
	GetNode() *consensus.Node
	GetBlockStore() *store.BlockStore
	GetEventBus() *types.EventBus
	GetMempool() mempool.Mempool
	GetGenesisDoc() *types.GenesisDoc
	GetConsensusReactor() *cs.Reactor
	GetSwitch() *p2p.Switch
	GetContractStore() *evm.ContractStore
	GetAccountKeeper() balance.AccountKeeper
	GetFeePool() *fees.Store
	GetNodeContext() *node.Context
	GetConfig() *config.Server

	// service registry
	RegisterService(name string, srv Web3Service)
	ServiceList() map[string]Web3Service
}

Web3Context interface to define required elements for the API Context

type Web3Service

type Web3Service interface{}

Web3Service interface define service

Jump to

Keyboard shortcuts

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