Documentation
¶
Index ¶
- func RPCMarshalBlock(ctx context.Context, block *types.Block, inclTx bool, fullTx bool, ...) (map[string]interface{}, error)
- func RPCMarshalHeader(head *types.Header) map[string]interface{}
- func SimpleRPCMarshalBlock(block *types.Block, fullTx bool, chainID *big.Int) (map[string]interface{}, error)
- type AccountResult
- type Backend
- type BlockChainAPI
- type RPCTransaction
- type StorageResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RPCMarshalBlock ¶
func RPCMarshalBlock(ctx context.Context, block *types.Block, inclTx bool, fullTx bool, config *params.ChainConfig, backend Backend) (map[string]interface{}, error)
RPCMarshalBlock converts the given block to the RPC output which depends on fullTx. If inclTx is true transactions are returned. When fullTx is true the returned block contains full transaction details, otherwise it will only contain transaction hashes.
func RPCMarshalHeader ¶
RPCMarshalHeader converts the given header to the RPC output .
Types ¶
type AccountResult ¶
type AccountResult struct { Address common.Address `json:"address"` AccountProof []string `json:"accountProof"` Balance *hexutil.Big `json:"balance"` CodeHash common.Hash `json:"codeHash"` Nonce hexutil.Uint64 `json:"nonce"` StorageHash common.Hash `json:"storageHash"` StorageProof []StorageResult `json:"storageProof"` }
AccountResult structs for GetProof
type Backend ¶
type Backend interface { ChainConfig() *params.ChainConfig GetReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error) HeaderByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*types.Header, error) HistoricalRPCService() *rpc.Client StateAndHeaderByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*state.StateDB, *types.Header, error) }
type BlockChainAPI ¶
type BlockChainAPI struct {
// contains filtered or unexported fields
}
BlockChainAPI provides an API to access Ethereum blockchain data.
func NewBlockChainAPI ¶
func NewBlockChainAPI(b Backend) *BlockChainAPI
NewBlockChainAPI creates a new Ethereum blockchain API.
func (*BlockChainAPI) GetProof ¶
func (s *BlockChainAPI) GetProof(ctx context.Context, address common.Address, storageKeys []string, blockNrOrHash rpc.BlockNumberOrHash) (*AccountResult, error)
GetProof returns the Merkle-proof for a given account and optionally some storage keys.
type RPCTransaction ¶
type RPCTransaction 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"` GasFeeCap *hexutil.Big `json:"maxFeePerGas,omitempty"` GasTipCap *hexutil.Big `json:"maxPriorityFeePerGas,omitempty"` MaxFeePerBlobGas *hexutil.Big `json:"maxFeePerBlobGas,omitempty"` 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"` Type hexutil.Uint64 `json:"type"` Accesses *types.AccessList `json:"accessList,omitempty"` ChainID *hexutil.Big `json:"chainId,omitempty"` BlobVersionedHashes []common.Hash `json:"blobVersionedHashes,omitempty"` V *hexutil.Big `json:"v"` R *hexutil.Big `json:"r"` S *hexutil.Big `json:"s"` YParity *hexutil.Uint64 `json:"yParity,omitempty"` // deposit-tx only SourceHash *common.Hash `json:"sourceHash,omitempty"` Mint *hexutil.Big `json:"mint,omitempty"` IsSystemTx *bool `json:"isSystemTx,omitempty"` // deposit-tx post-Canyon only DepositReceiptVersion *hexutil.Uint64 `json:"depositReceiptVersion,omitempty"` }
RPCTransaction represents a transaction that will serialize to the RPC representation of a transaction