Documentation ¶
Index ¶
- Constants
- Variables
- func AccessList(ctx context.Context, b Backend, blockNrOrHash rpc.BlockNumberOrHash, ...) (acl types.AccessList, gasUsed uint64, vmErr error, err error)
- func DoEstimateGas(ctx context.Context, b Backend, args TransactionArgs, ...) (hexutil.Uint64, error)
- func GetAPIs(apiBackend Backend) []rpc.API
- func RPCMarshalBlock(block *types.Block, yuBlock *yutypes.Block, inclTx bool, fullTx bool, ...) map[string]interface{}
- func RPCMarshalHeader(head *types.Header) map[string]interface{}
- func StartupEthRPC(chain *kernel.Kernel, cfg *evm.GethConfig)
- func SubmitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (common.Hash, error)
- func YuTxn2EthTxn(yuSignedTxn *yutypes.SignedTxn) (*types.Transaction, error)
- type AccountResult
- type AddrLocker
- type Backend
- type BatchTx
- type BlockChainAPI
- func (s *BlockChainAPI) BlockNumber() hexutil.Uint64
- func (s *BlockChainAPI) Call(ctx context.Context, args TransactionArgs, ...) (hexutil.Bytes, error)
- func (api *BlockChainAPI) ChainId() *hexutil.Big
- func (s *BlockChainAPI) CreateAccessList(ctx context.Context, args TransactionArgs, ...) (*accessListResult, error)
- func (s *BlockChainAPI) EstimateGas(ctx context.Context, args TransactionArgs, ...) (hexutil.Uint64, error)
- func (s *BlockChainAPI) GetBalance(ctx context.Context, address common.Address, ...) (*hexutil.Big, error)
- func (s *BlockChainAPI) GetBlockByHash(ctx context.Context, hash common.Hash, fullTx bool) (map[string]interface{}, error)
- func (s *BlockChainAPI) GetBlockByNumber(ctx context.Context, number rpc.BlockNumber, fullTx bool) (map[string]interface{}, error)
- func (s *BlockChainAPI) GetBlockReceipts(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) ([]map[string]interface{}, error)
- func (s *BlockChainAPI) GetCode(ctx context.Context, address common.Address, ...) (hexutil.Bytes, error)
- func (s *BlockChainAPI) GetHeaderByHash(ctx context.Context, hash common.Hash) map[string]interface{}
- func (s *BlockChainAPI) GetHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (map[string]interface{}, error)
- func (s *BlockChainAPI) GetProof(ctx context.Context, address common.Address, storageKeys []string, ...) (*AccountResult, error)
- func (s *BlockChainAPI) GetStorageAt(ctx context.Context, address common.Address, hexKey string, ...) (hexutil.Bytes, error)
- func (s *BlockChainAPI) GetUncleByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) (map[string]interface{}, error)
- func (s *BlockChainAPI) GetUncleByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) (map[string]interface{}, error)
- func (s *BlockChainAPI) GetUncleCountByBlockHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint
- func (s *BlockChainAPI) GetUncleCountByBlockNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint
- type BlockOverrides
- type ChainContext
- type ChainContextBackend
- type DebugAPI
- func (api *DebugAPI) ChaindbCompact() error
- func (api *DebugAPI) ChaindbProperty(property string) (string, error)
- func (api *DebugAPI) GetRawBlock(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)
- func (api *DebugAPI) GetRawHeader(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)
- func (api *DebugAPI) GetRawReceipts(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) ([]hexutil.Bytes, error)
- func (api *DebugAPI) GetRawTransaction(ctx context.Context, hash common.Hash) (hexutil.Bytes, error)
- func (api *DebugAPI) PrintBlock(ctx context.Context, number uint64) (string, error)
- func (api *DebugAPI) SetHead(number hexutil.Uint64)
- type EthAPIBackend
- func (e *EthAPIBackend) AccountManager() *accounts.Manager
- func (e *EthAPIBackend) BlobBaseFee(ctx context.Context) *big.Int
- func (e *EthAPIBackend) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, *yutypes.Block, error)
- func (e *EthAPIBackend) BlockByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Block, *yutypes.Block, error)
- func (e *EthAPIBackend) BlockByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*types.Block, *yutypes.Block, error)
- func (e *EthAPIBackend) BloomStatus() (uint64, uint64)
- func (e *EthAPIBackend) Call(ctx context.Context, args TransactionArgs, ...) (hexutil.Bytes, error)
- func (e *EthAPIBackend) ChainConfig() *params.ChainConfig
- func (e *EthAPIBackend) ChainDb() ethdb.Database
- func (e *EthAPIBackend) CurrentBlock() *types.Header
- func (e *EthAPIBackend) CurrentHeader() *types.Header
- func (e *EthAPIBackend) Engine() consensus.Engine
- func (e *EthAPIBackend) ExtRPCEnabled() bool
- func (e *EthAPIBackend) FeeHistory(ctx context.Context, blockCount uint64, lastBlock rpc.BlockNumber, ...) (*big.Int, [][]*big.Int, []*big.Int, []float64, []*big.Int, []float64, error)
- func (e *EthAPIBackend) GetBody(ctx context.Context, hash common.Hash, number rpc.BlockNumber) (*types.Body, error)
- func (e *EthAPIBackend) GetEVM(ctx context.Context, msg *core.Message, state *state.StateDB, ...) *vm.EVM
- func (e *EthAPIBackend) GetLogs(ctx context.Context, blockHash common.Hash, number uint64) ([][]*types.Log, error)
- func (e *EthAPIBackend) GetPoolNonce(ctx context.Context, addr common.Address) (uint64, error)
- func (e *EthAPIBackend) GetPoolTransaction(txHash common.Hash) (*types.Transaction, error)
- func (e *EthAPIBackend) GetPoolTransactions() (types.Transactions, error)
- func (e *EthAPIBackend) GetReceipts(ctx context.Context, blockHash common.Hash) (types.Receipts, error)
- func (e *EthAPIBackend) GetReceiptsForLog(ctx context.Context, blockHash common.Hash) (types.Receipts, error)
- func (e *EthAPIBackend) GetTd(ctx context.Context, hash common.Hash) *big.Int
- func (e *EthAPIBackend) GetTransaction(ctx context.Context, txHash common.Hash) (bool, *types.Transaction, common.Hash, uint64, uint64, error)
- func (e *EthAPIBackend) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, *yutypes.Header, error)
- func (e *EthAPIBackend) HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, *yutypes.Header, error)
- func (e *EthAPIBackend) HeaderByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*types.Header, *yutypes.Header, error)
- func (e *EthAPIBackend) Pending() (*types.Block, types.Receipts, *state.StateDB)
- func (e *EthAPIBackend) RPCEVMTimeout() time.Duration
- func (e *EthAPIBackend) RPCGasCap() uint64
- func (e *EthAPIBackend) RPCTxFeeCap() float64
- func (e *EthAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error
- func (e *EthAPIBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession)
- func (e *EthAPIBackend) SetHead(number uint64)
- func (e *EthAPIBackend) StateAndHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*state.StateDB, *types.Header, error)
- func (e *EthAPIBackend) StateAndHeaderByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*state.StateDB, *types.Header, error)
- func (e *EthAPIBackend) Stats() (pending int, queued int)
- func (e *EthAPIBackend) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription
- func (e *EthAPIBackend) SubscribeChainHeadEvent(ch chan<- core.ChainHeadEvent) event.Subscription
- func (e *EthAPIBackend) SubscribeChainSideEvent(ch chan<- core.ChainSideEvent) event.Subscription
- func (e *EthAPIBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription
- func (e *EthAPIBackend) SubscribeNewTxsEvent(events chan<- core.NewTxsEvent) event.Subscription
- func (e *EthAPIBackend) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription
- func (e *EthAPIBackend) SuggestGasTipCap(ctx context.Context) (*big.Int, error)
- func (e *EthAPIBackend) SyncProgress() ethereum.SyncProgress
- func (e *EthAPIBackend) TxPoolContent() (map[common.Address][]*types.Transaction, ...)
- func (e *EthAPIBackend) TxPoolContentFrom(addr common.Address) ([]*types.Transaction, []*types.Transaction)
- func (e *EthAPIBackend) UnprotectedAllowed() bool
- type EthGasPrice
- type EthRPC
- type EthereumAPI
- func (s *EthereumAPI) BlobBaseFee(ctx context.Context) *hexutil.Big
- func (s *EthereumAPI) FeeHistory(ctx context.Context, blockCount math.HexOrDecimal64, lastBlock rpc.BlockNumber, ...) (result *feeHistoryResult, err error)
- func (s *EthereumAPI) GasPrice(ctx context.Context) (result *hexutil.Big, err error)
- func (s *EthereumAPI) GetLogs(ctx context.Context, crit FilterCriteria) (results []*types.Log, err error)
- func (s *EthereumAPI) MaxPriorityFeePerGas(ctx context.Context) (*hexutil.Big, error)
- func (s *EthereumAPI) Syncing() (interface{}, error)
- type FakeEngine
- func (f FakeEngine) APIs(chain consensus.ChainHeaderReader) []rpc.API
- func (f FakeEngine) Author(header *types.Header) (common.Address, error)
- func (f FakeEngine) CalcDifficulty(chain consensus.ChainHeaderReader, time uint64, parent *types.Header) *big.Int
- func (f FakeEngine) Close() error
- func (f FakeEngine) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, ...)
- func (f FakeEngine) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, ...) (*types.Block, error)
- func (f FakeEngine) Prepare(chain consensus.ChainHeaderReader, header *types.Header) error
- func (f FakeEngine) Seal(chain consensus.ChainHeaderReader, block *types.Block, ...) error
- func (f FakeEngine) SealHash(header *types.Header) common.Hash
- func (f FakeEngine) VerifyHeader(chain consensus.ChainHeaderReader, header *types.Header) error
- func (f FakeEngine) VerifyHeaders(chain consensus.ChainHeaderReader, headers []*types.Header) (chan<- struct{}, <-chan error)
- func (f FakeEngine) VerifyUncles(chain consensus.ChainReader, block *types.Block) error
- type FilterCriteria
- type LogFilter
- type NetAPI
- type OverrideAccount
- type RPCTransaction
- type SignTransactionResult
- type StateOverride
- type StorageResult
- type TransactionAPI
- func (s *TransactionAPI) FillTransaction(ctx context.Context, args TransactionArgs) (*SignTransactionResult, error)
- func (s *TransactionAPI) GetBlockTransactionCountByHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint
- func (s *TransactionAPI) GetBlockTransactionCountByNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint
- func (s *TransactionAPI) GetRawTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) hexutil.Bytes
- func (s *TransactionAPI) GetRawTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) hexutil.Bytes
- func (s *TransactionAPI) GetRawTransactionByHash(ctx context.Context, hash common.Hash) (hexutil.Bytes, error)
- func (s *TransactionAPI) GetTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) *RPCTransaction
- func (s *TransactionAPI) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) *RPCTransaction
- func (s *TransactionAPI) GetTransactionByHash(ctx context.Context, hash common.Hash) (*RPCTransaction, error)
- func (s *TransactionAPI) GetTransactionCount(ctx context.Context, address common.Address, ...) (*hexutil.Uint64, error)
- func (s *TransactionAPI) GetTransactionReceipt(ctx context.Context, hash common.Hash) (map[string]interface{}, error)
- func (s *TransactionAPI) PendingTransactions() ([]*RPCTransaction, error)
- func (s *TransactionAPI) Resend(ctx context.Context, sendArgs TransactionArgs, gasPrice *hexutil.Big, ...) (common.Hash, error)
- func (s *TransactionAPI) SendBatchRawTransactions(ctx context.Context, inputs hexutil.Bytes) (txHashes []common.Hash, err error)
- func (s *TransactionAPI) SendRawTransaction(ctx context.Context, input hexutil.Bytes) (txHash common.Hash, err error)
- func (s *TransactionAPI) SendTransaction(ctx context.Context, args TransactionArgs) (common.Hash, error)
- func (s *TransactionAPI) Sign(addr common.Address, data hexutil.Bytes) (hexutil.Bytes, error)
- func (s *TransactionAPI) SignTransaction(ctx context.Context, args TransactionArgs) (*SignTransactionResult, error)
- type TransactionArgs
- func (args *TransactionArgs) CallDefaults(globalGasCap uint64, baseFee *big.Int, chainID *big.Int) error
- func (args *TransactionArgs) IsEIP4844() bool
- func (args *TransactionArgs) ToMessage(baseFee *big.Int) *core.Message
- func (args *TransactionArgs) ToTransaction(v, r, s *big.Int) *types.Transaction
- type Web3API
Constants ¶
const ( TypeLbl = "type" TypeCountLbl = "count" TypeStatusLbl = "status" )
const SolidityTripod = "solidity"
Variables ¶
var ( EthApiBackendCounter = prometheus.NewCounterVec( prometheus.CounterOpts{ Namespace: "reddio", Subsystem: "eth_api_backend", Name: "op_counter", Help: "Total Operator number of counter", }, []string{TypeLbl}, ) )
Functions ¶
func AccessList ¶
func AccessList(ctx context.Context, b Backend, blockNrOrHash rpc.BlockNumberOrHash, args TransactionArgs) (acl types.AccessList, gasUsed uint64, vmErr error, err error)
AccessList creates an access list for the given transaction. If the accesslist creation fails an error is returned. If the transaction itself fails, an vmErr is returned.
func DoEstimateGas ¶
func DoEstimateGas(ctx context.Context, b Backend, args TransactionArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *StateOverride, gasCap uint64) (hexutil.Uint64, error)
DoEstimateGas returns the lowest possible gas limit that allows the transaction to run successfully at block `blockNrOrHash`. It returns error if the transaction would revert, or if there are unexpected failures. The gas limit is capped by both `args.Gas` (if non-nil & non-zero) and `gasCap` (if non-zero).
func RPCMarshalBlock ¶
func RPCMarshalBlock(block *types.Block, yuBlock *yutypes.Block, inclTx bool, fullTx bool, config *params.ChainConfig) map[string]interface{}
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 .
func StartupEthRPC ¶
func StartupEthRPC(chain *kernel.Kernel, cfg *evm.GethConfig)
func SubmitTransaction ¶
SubmitTransaction is a helper function that submits tx to txPool and logs a message.
func YuTxn2EthTxn ¶
func YuTxn2EthTxn(yuSignedTxn *yutypes.SignedTxn) (*types.Transaction, error)
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 AddrLocker ¶
type AddrLocker struct {
// contains filtered or unexported fields
}
func (*AddrLocker) LockAddr ¶
func (l *AddrLocker) LockAddr(address common.Address)
LockAddr locks an account's mutex. This is used to prevent another tx getting the same nonce until the lock is released. The mutex prevents the (an identical nonce) from being read again during the time that the first transaction is being signed.
func (*AddrLocker) UnlockAddr ¶
func (l *AddrLocker) UnlockAddr(address common.Address)
UnlockAddr unlocks the mutex of the given account.
type Backend ¶
type Backend interface { // General Ethereum API SyncProgress() ethereum.SyncProgress SuggestGasTipCap(ctx context.Context) (*big.Int, error) FeeHistory(ctx context.Context, blockCount uint64, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*big.Int, [][]*big.Int, []*big.Int, []float64, []*big.Int, []float64, error) BlobBaseFee(ctx context.Context) *big.Int ChainDb() ethdb.Database AccountManager() *accounts.Manager ExtRPCEnabled() bool RPCGasCap() uint64 // global gas cap for eth_call over rpc: DoS protection RPCEVMTimeout() time.Duration // global timeout for eth_call over rpc: DoS protection RPCTxFeeCap() float64 // global tx fee cap for all transaction related APIs UnprotectedAllowed() bool // allows only for EIP155 transactions. // Blockchain API SetHead(number uint64) HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, *yutypes.Header, error) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, *yutypes.Header, error) HeaderByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*types.Header, *yutypes.Header, error) CurrentHeader() *types.Header CurrentBlock() *types.Header BlockByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Block, *yutypes.Block, error) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, *yutypes.Block, error) BlockByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*types.Block, *yutypes.Block, error) StateAndHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*state.StateDB, *types.Header, error) StateAndHeaderByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*state.StateDB, *types.Header, error) Pending() (*types.Block, types.Receipts, *state.StateDB) GetReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error) GetTd(ctx context.Context, hash common.Hash) *big.Int GetEVM(ctx context.Context, msg *core.Message, state *state.StateDB, header *types.Header, vmConfig *vm.Config, blockCtx *vm.BlockContext) *vm.EVM SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription SubscribeChainHeadEvent(ch chan<- core.ChainHeadEvent) event.Subscription SubscribeChainSideEvent(ch chan<- core.ChainSideEvent) event.Subscription // Transaction pool API SendTx(ctx context.Context, signedTx *types.Transaction) error Call(ctx context.Context, args TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash, overrides *StateOverride, blockOverrides *BlockOverrides) (hexutil.Bytes, error) GetTransaction(ctx context.Context, txHash common.Hash) (bool, *types.Transaction, common.Hash, uint64, uint64, error) GetPoolTransactions() (types.Transactions, error) GetPoolTransaction(txHash common.Hash) (*types.Transaction, error) GetPoolNonce(ctx context.Context, addr common.Address) (uint64, error) Stats() (pending int, queued int) TxPoolContent() (map[common.Address][]*types.Transaction, map[common.Address][]*types.Transaction) TxPoolContentFrom(addr common.Address) ([]*types.Transaction, []*types.Transaction) SubscribeNewTxsEvent(chan<- core.NewTxsEvent) event.Subscription ChainConfig() *params.ChainConfig Engine() consensus.Engine // This is copied from filters.Backend // eth/filters needs to be initialized from this backend type, so methods needed by // it must also be included here. GetBody(ctx context.Context, hash common.Hash, number rpc.BlockNumber) (*types.Body, error) GetLogs(ctx context.Context, blockHash common.Hash, number uint64) ([][]*types.Log, error) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription BloomStatus() (uint64, uint64) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession) }
Backend interface provides the common API services (that are provided by both full and light clients) with access to necessary functions.
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) BlockNumber ¶
func (s *BlockChainAPI) BlockNumber() hexutil.Uint64
BlockNumber returns the block number of the chain head.
func (*BlockChainAPI) Call ¶
func (s *BlockChainAPI) Call(ctx context.Context, args TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash, overrides *StateOverride, blockOverrides *BlockOverrides) (hexutil.Bytes, error)
Call executes the given transaction on the state for the given block number.
Additionally, the caller can specify a batch of contract for fields overriding.
Note, this function doesn't make and changes in the state/blockchain and is useful to execute and retrieve values.
func (*BlockChainAPI) ChainId ¶
func (api *BlockChainAPI) ChainId() *hexutil.Big
ChainId is the EIP-155 replay-protection chain id for the current Ethereum chain config.
Note, this method does not conform to EIP-695 because the configured chain ID is always returned, regardless of the current head block. We used to return an error when the chain wasn't synced up to a block where EIP-155 is enabled, but this behavior caused issues in CL clients.
func (*BlockChainAPI) CreateAccessList ¶
func (s *BlockChainAPI) CreateAccessList(ctx context.Context, args TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash) (*accessListResult, error)
CreateAccessList creates an EIP-2930 type AccessList for the given transaction. Reexec and BlockNrOrHash can be specified to create the accessList on top of a certain state.
func (*BlockChainAPI) EstimateGas ¶
func (s *BlockChainAPI) EstimateGas(ctx context.Context, args TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash, overrides *StateOverride) (hexutil.Uint64, error)
EstimateGas returns the lowest possible gas limit that allows the transaction to run successfully at block `blockNrOrHash`, or the latest block if `blockNrOrHash` is unspecified. It returns error if the transaction would revert or if there are unexpected failures. The returned value is capped by both `args.Gas` (if non-nil & non-zero) and the backend's RPCGasCap configuration (if non-zero). Note: Required blob gas is not computed in this method.
func (*BlockChainAPI) GetBalance ¶
func (s *BlockChainAPI) GetBalance(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Big, error)
GetBalance returns the amount of wei for the given address in the state of the given block number. The rpc.LatestBlockNumber and rpc.PendingBlockNumber meta block numbers are also allowed.
func (*BlockChainAPI) GetBlockByHash ¶
func (s *BlockChainAPI) GetBlockByHash(ctx context.Context, hash common.Hash, fullTx bool) (map[string]interface{}, error)
GetBlockByHash returns the requested block. When fullTx is true all transactions in the block are returned in full detail, otherwise only the transaction hash is returned.
func (*BlockChainAPI) GetBlockByNumber ¶
func (s *BlockChainAPI) GetBlockByNumber(ctx context.Context, number rpc.BlockNumber, fullTx bool) (map[string]interface{}, error)
GetBlockByNumber returns the requested canonical block.
- When blockNr is -1 the chain pending block is returned.
- When blockNr is -2 the chain latest block is returned.
- When blockNr is -3 the chain finalized block is returned.
- When blockNr is -4 the chain safe block is returned.
- When fullTx is true all transactions in the block are returned, otherwise only the transaction hash is returned.
func (*BlockChainAPI) GetBlockReceipts ¶
func (s *BlockChainAPI) GetBlockReceipts(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) ([]map[string]interface{}, error)
GetBlockReceipts returns the block receipts for the given block hash or number or tag.
func (*BlockChainAPI) GetCode ¶
func (s *BlockChainAPI) GetCode(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)
GetCode returns the code stored at the given address in the state for the given block number.
func (*BlockChainAPI) GetHeaderByHash ¶
func (s *BlockChainAPI) GetHeaderByHash(ctx context.Context, hash common.Hash) map[string]interface{}
GetHeaderByHash returns the requested header by hash.
func (*BlockChainAPI) GetHeaderByNumber ¶
func (s *BlockChainAPI) GetHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (map[string]interface{}, error)
GetHeaderByNumber returns the requested canonical block header.
- When blockNr is -1 the chain pending header is returned.
- When blockNr is -2 the chain latest header is returned.
- When blockNr is -3 the chain finalized header is returned.
- When blockNr is -4 the chain safe header is returned.
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.
func (*BlockChainAPI) GetStorageAt ¶
func (s *BlockChainAPI) GetStorageAt(ctx context.Context, address common.Address, hexKey string, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)
GetStorageAt returns the storage from the state at the given address, key and block number. The rpc.LatestBlockNumber and rpc.PendingBlockNumber meta block numbers are also allowed.
func (*BlockChainAPI) GetUncleByBlockHashAndIndex ¶
func (s *BlockChainAPI) GetUncleByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) (map[string]interface{}, error)
GetUncleByBlockHashAndIndex returns the uncle block for the given block hash and index.
func (*BlockChainAPI) GetUncleByBlockNumberAndIndex ¶
func (s *BlockChainAPI) GetUncleByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) (map[string]interface{}, error)
GetUncleByBlockNumberAndIndex returns the uncle block for the given block hash and index.
func (*BlockChainAPI) GetUncleCountByBlockHash ¶
func (s *BlockChainAPI) GetUncleCountByBlockHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint
GetUncleCountByBlockHash returns number of uncles in the block for the given block hash
func (*BlockChainAPI) GetUncleCountByBlockNumber ¶
func (s *BlockChainAPI) GetUncleCountByBlockNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint
GetUncleCountByBlockNumber returns number of uncles in the block for the given block number
type BlockOverrides ¶
type BlockOverrides struct { Number *hexutil.Big Difficulty *hexutil.Big Time *hexutil.Uint64 GasLimit *hexutil.Uint64 Coinbase *common.Address Random *common.Hash BaseFee *hexutil.Big BlobBaseFee *hexutil.Big }
BlockOverrides is a set of header fields to override.
func (*BlockOverrides) Apply ¶
func (diff *BlockOverrides) Apply(blockCtx *vm.BlockContext)
Apply overrides the given header fields into the given block context.
type ChainContext ¶
type ChainContext struct {
// contains filtered or unexported fields
}
ChainContext is an implementation of core.ChainContext. It's main use-case is instantiating a vm.BlockContext without having access to the BlockChain object.
func NewChainContext ¶
func NewChainContext(ctx context.Context, backend ChainContextBackend) *ChainContext
NewChainContext creates a new ChainContext object.
func (*ChainContext) Engine ¶
func (context *ChainContext) Engine() consensus.Engine
type ChainContextBackend ¶
type ChainContextBackend interface { Engine() consensus.Engine HeaderByNumber(context.Context, rpc.BlockNumber) (*types.Header, *yutypes.Header, error) }
ChainContextBackend provides methods required to implement ChainContext.
type DebugAPI ¶
type DebugAPI struct {
// contains filtered or unexported fields
}
DebugAPI is the collection of Ethereum APIs exposed over the debugging namespace.
func NewDebugAPI ¶
NewDebugAPI creates a new instance of DebugAPI.
func (*DebugAPI) ChaindbCompact ¶
ChaindbCompact flattens the entire key-value database into a single level, removing all unused slots and merging all keys.
func (*DebugAPI) ChaindbProperty ¶
ChaindbProperty returns leveldb properties of the key-value database.
func (*DebugAPI) GetRawBlock ¶
func (api *DebugAPI) GetRawBlock(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)
GetRawBlock retrieves the RLP encoded for a single block.
func (*DebugAPI) GetRawHeader ¶
func (api *DebugAPI) GetRawHeader(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)
GetRawHeader retrieves the RLP encoding for a single header.
func (*DebugAPI) GetRawReceipts ¶
func (api *DebugAPI) GetRawReceipts(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) ([]hexutil.Bytes, error)
GetRawReceipts retrieves the binary-encoded receipts of a single block.
func (*DebugAPI) GetRawTransaction ¶
func (api *DebugAPI) GetRawTransaction(ctx context.Context, hash common.Hash) (hexutil.Bytes, error)
GetRawTransaction returns the bytes of the transaction for the given hash.
func (*DebugAPI) PrintBlock ¶
PrintBlock retrieves a block and returns its pretty printed form.
type EthAPIBackend ¶
type EthAPIBackend struct {
// contains filtered or unexported fields
}
func (*EthAPIBackend) AccountManager ¶
func (e *EthAPIBackend) AccountManager() *accounts.Manager
func (*EthAPIBackend) BlobBaseFee ¶
func (e *EthAPIBackend) BlobBaseFee(ctx context.Context) *big.Int
BlobBaseFee Move to ethrpc/gasprice.go func (e *EthAPIBackend) FeeHistory(ctx context.Context, blockCount uint64, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*big.Int, [][]*big.Int, []*big.Int, []float64, []*big.Int, []float64, error) {}
func (*EthAPIBackend) BlockByHash ¶
func (*EthAPIBackend) BlockByNumber ¶
func (e *EthAPIBackend) BlockByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Block, *yutypes.Block, error)
func (*EthAPIBackend) BlockByNumberOrHash ¶
func (e *EthAPIBackend) BlockByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*types.Block, *yutypes.Block, error)
func (*EthAPIBackend) BloomStatus ¶
func (e *EthAPIBackend) BloomStatus() (uint64, uint64)
func (*EthAPIBackend) Call ¶
func (e *EthAPIBackend) Call(ctx context.Context, args TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash, overrides *StateOverride, blockOverrides *BlockOverrides) (hexutil.Bytes, error)
func (*EthAPIBackend) ChainConfig ¶
func (e *EthAPIBackend) ChainConfig() *params.ChainConfig
func (*EthAPIBackend) ChainDb ¶
func (e *EthAPIBackend) ChainDb() ethdb.Database
func (*EthAPIBackend) CurrentBlock ¶
func (e *EthAPIBackend) CurrentBlock() *types.Header
func (*EthAPIBackend) CurrentHeader ¶
func (e *EthAPIBackend) CurrentHeader() *types.Header
func (*EthAPIBackend) Engine ¶
func (e *EthAPIBackend) Engine() consensus.Engine
func (*EthAPIBackend) ExtRPCEnabled ¶
func (e *EthAPIBackend) ExtRPCEnabled() bool
func (*EthAPIBackend) FeeHistory ¶
func (*EthAPIBackend) GetBody ¶
func (e *EthAPIBackend) GetBody(ctx context.Context, hash common.Hash, number rpc.BlockNumber) (*types.Body, error)
func (*EthAPIBackend) GetPoolNonce ¶
func (*EthAPIBackend) GetPoolTransaction ¶
func (e *EthAPIBackend) GetPoolTransaction(txHash common.Hash) (*types.Transaction, error)
Similar to GetTransaction():
func (*EthAPIBackend) GetPoolTransactions ¶
func (e *EthAPIBackend) GetPoolTransactions() (types.Transactions, error)
func (*EthAPIBackend) GetReceipts ¶
func (*EthAPIBackend) GetReceiptsForLog ¶
func (*EthAPIBackend) GetTransaction ¶
func (*EthAPIBackend) HeaderByHash ¶
func (*EthAPIBackend) HeaderByNumber ¶
func (e *EthAPIBackend) HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, *yutypes.Header, error)
func (*EthAPIBackend) HeaderByNumberOrHash ¶
func (e *EthAPIBackend) HeaderByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*types.Header, *yutypes.Header, error)
func (*EthAPIBackend) RPCEVMTimeout ¶
func (e *EthAPIBackend) RPCEVMTimeout() time.Duration
func (*EthAPIBackend) RPCGasCap ¶
func (e *EthAPIBackend) RPCGasCap() uint64
func (*EthAPIBackend) RPCTxFeeCap ¶
func (e *EthAPIBackend) RPCTxFeeCap() float64
func (*EthAPIBackend) SendTx ¶
func (e *EthAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error
func (*EthAPIBackend) ServiceFilter ¶
func (e *EthAPIBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession)
func (*EthAPIBackend) SetHead ¶
func (e *EthAPIBackend) SetHead(number uint64)
func (*EthAPIBackend) StateAndHeaderByNumber ¶
func (e *EthAPIBackend) StateAndHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*state.StateDB, *types.Header, error)
func (*EthAPIBackend) StateAndHeaderByNumberOrHash ¶
func (e *EthAPIBackend) StateAndHeaderByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*state.StateDB, *types.Header, error)
func (*EthAPIBackend) Stats ¶
func (e *EthAPIBackend) Stats() (pending int, queued int)
func (*EthAPIBackend) SubscribeChainEvent ¶
func (e *EthAPIBackend) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription
func (*EthAPIBackend) SubscribeChainHeadEvent ¶
func (e *EthAPIBackend) SubscribeChainHeadEvent(ch chan<- core.ChainHeadEvent) event.Subscription
func (*EthAPIBackend) SubscribeChainSideEvent ¶
func (e *EthAPIBackend) SubscribeChainSideEvent(ch chan<- core.ChainSideEvent) event.Subscription
func (*EthAPIBackend) SubscribeLogsEvent ¶
func (e *EthAPIBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription
func (*EthAPIBackend) SubscribeNewTxsEvent ¶
func (e *EthAPIBackend) SubscribeNewTxsEvent(events chan<- core.NewTxsEvent) event.Subscription
func (*EthAPIBackend) SubscribeRemovedLogsEvent ¶
func (e *EthAPIBackend) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription
func (*EthAPIBackend) SuggestGasTipCap ¶
SuggestTipCap returns a tip cap so that newly created transaction can have a very high chance to be included in the following blocks.
Note, for legacy transactions and the legacy eth_gasPrice RPC call, it will be necessary to add the basefee to the returned number to fall back to the legacy behavior.
func (*EthAPIBackend) SyncProgress ¶
func (e *EthAPIBackend) SyncProgress() ethereum.SyncProgress
func (*EthAPIBackend) TxPoolContent ¶
func (e *EthAPIBackend) TxPoolContent() (map[common.Address][]*types.Transaction, map[common.Address][]*types.Transaction)
func (*EthAPIBackend) TxPoolContentFrom ¶
func (e *EthAPIBackend) TxPoolContentFrom(addr common.Address) ([]*types.Transaction, []*types.Transaction)
func (*EthAPIBackend) UnprotectedAllowed ¶
func (e *EthAPIBackend) UnprotectedAllowed() bool
type EthGasPrice ¶
type EthGasPrice struct {
// contains filtered or unexported fields
}
Oracle recommends gas prices based on the content of recent blocks. Suitable for both light and full clients.
func NewEthGasPrice ¶
func NewEthGasPrice(backend Backend) *EthGasPrice
type EthereumAPI ¶
type EthereumAPI struct {
// contains filtered or unexported fields
}
EthereumAPI provides an API to access Ethereum related information.
func NewEthereumAPI ¶
func NewEthereumAPI(b Backend) *EthereumAPI
NewEthereumAPI creates a new Ethereum protocol API.
func (*EthereumAPI) BlobBaseFee ¶
func (s *EthereumAPI) BlobBaseFee(ctx context.Context) *hexutil.Big
BlobBaseFee returns the base fee for blob gas at the current head.
func (*EthereumAPI) FeeHistory ¶
func (s *EthereumAPI) FeeHistory(ctx context.Context, blockCount math.HexOrDecimal64, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (result *feeHistoryResult, err error)
FeeHistory returns the fee market history.
func (*EthereumAPI) GasPrice ¶
GasPrice returns a suggestion for a gas price for legacy transactions.
func (*EthereumAPI) GetLogs ¶
func (s *EthereumAPI) GetLogs(ctx context.Context, crit FilterCriteria) (results []*types.Log, err error)
GetLogs from *FilterAPI
func (*EthereumAPI) MaxPriorityFeePerGas ¶
MaxPriorityFeePerGas returns a suggestion for a gas tip cap for dynamic fee transactions.
func (*EthereumAPI) Syncing ¶
func (s *EthereumAPI) Syncing() (interface{}, error)
Syncing returns false in case the node is currently not syncing with the network. It can be up-to-date or has not yet received the latest block headers from its peers. In case it is synchronizing: - startingBlock: block number this node started to synchronize from - currentBlock: block number this node is currently importing - highestBlock: block number of the highest block header this node has received from peers - pulledStates: number of state entries processed until now - knownStates: number of known state entries that still need to be pulled
type FakeEngine ¶
type FakeEngine struct{}
func (FakeEngine) APIs ¶
func (f FakeEngine) APIs(chain consensus.ChainHeaderReader) []rpc.API
APIs returns the RPC APIs this consensus engine provides.
func (FakeEngine) Author ¶
Author retrieves the Ethereum address of the account that minted the given block.
func (FakeEngine) CalcDifficulty ¶
func (f FakeEngine) CalcDifficulty(chain consensus.ChainHeaderReader, time uint64, parent *types.Header) *big.Int
CalcDifficulty is the difficulty adjustment algorithm.
func (FakeEngine) Close ¶
func (f FakeEngine) Close() error
Close terminates any background threads maintained by the consensus engine.
func (FakeEngine) Finalize ¶
func (f FakeEngine) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body)
Finalize runs any post-transaction state modifications.
func (FakeEngine) FinalizeAndAssemble ¶
func (f FakeEngine) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body, receipts []*types.Receipt) (*types.Block, error)
FinalizeAndAssemble runs any post-transaction state modifications and assembles the final block.
func (FakeEngine) Prepare ¶
func (f FakeEngine) Prepare(chain consensus.ChainHeaderReader, header *types.Header) error
Prepare initializes the consensus fields of a block header.
func (FakeEngine) Seal ¶
func (f FakeEngine) Seal(chain consensus.ChainHeaderReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error
Seal generates a new sealing request for the given input block.
func (FakeEngine) SealHash ¶
func (f FakeEngine) SealHash(header *types.Header) common.Hash
SealHash returns the hash of a block prior to it being sealed.
func (FakeEngine) VerifyHeader ¶
func (f FakeEngine) VerifyHeader(chain consensus.ChainHeaderReader, header *types.Header) error
VerifyHeader checks whether a header conforms to the consensus rules.
func (FakeEngine) VerifyHeaders ¶
func (f FakeEngine) VerifyHeaders(chain consensus.ChainHeaderReader, headers []*types.Header) (chan<- struct{}, <-chan error)
VerifyHeaders checks whether a batch of headers conforms to the consensus rules.
func (FakeEngine) VerifyUncles ¶
func (f FakeEngine) VerifyUncles(chain consensus.ChainReader, block *types.Block) error
VerifyUncles verifies that the given block's uncles conform to the consensus rules.
type FilterCriteria ¶
type FilterCriteria ethereum.FilterQuery
FilterCriteria represents a request to create a new filter. Same as ethereum.FilterQuery but with UnmarshalJSON() method.
func (*FilterCriteria) UnmarshalJSON ¶
func (args *FilterCriteria) UnmarshalJSON(data []byte) error
UnmarshalJSON sets *args fields with given data.
type LogFilter ¶
type LogFilter struct {
// contains filtered or unexported fields
}
func (*LogFilter) FilterLogs ¶
type NetAPI ¶
type NetAPI struct {
// contains filtered or unexported fields
}
NetAPI offers network related RPC methods
func (*NetAPI) Listening ¶
Listening returns an indication if the node is listening for network connections.
type OverrideAccount ¶
type OverrideAccount struct { Nonce *hexutil.Uint64 `json:"nonce"` Code *hexutil.Bytes `json:"code"` Balance **hexutil.Big `json:"balance"` State *map[common.Hash]common.Hash `json:"state"` StateDiff *map[common.Hash]common.Hash `json:"stateDiff"` }
OverrideAccount indicates the overriding fields of account during the execution of a message call. Note, state and stateDiff can't be specified at the same time. If state is set, message execution will only use the data in the given state. Otherwise if statDiff is set, all diff will be applied first and then execute the call message.
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"` }
RPCTransaction represents a transaction that will serialize to the RPC representation of a transaction
func NewRPCPendingTransaction ¶
func NewRPCPendingTransaction(tx *types.Transaction, current *types.Header, config *params.ChainConfig) *RPCTransaction
NewRPCPendingTransaction returns a pending transaction that will serialize to the RPC representation
type SignTransactionResult ¶
type SignTransactionResult struct { Raw hexutil.Bytes `json:"raw"` Tx *types.Transaction `json:"tx"` }
SignTransactionResult represents a RLP encoded signed transaction.
type StateOverride ¶
type StateOverride map[common.Address]OverrideAccount
StateOverride is the collection of overridden accounts.
type StorageResult ¶
type TransactionAPI ¶
type TransactionAPI struct {
// contains filtered or unexported fields
}
TransactionAPI exposes methods for reading and creating transaction data.
func NewTransactionAPI ¶
func NewTransactionAPI(b Backend, nonceLock *AddrLocker) *TransactionAPI
NewTransactionAPI creates a new RPC service with methods for interacting with transactions.
func (*TransactionAPI) FillTransaction ¶
func (s *TransactionAPI) FillTransaction(ctx context.Context, args TransactionArgs) (*SignTransactionResult, error)
FillTransaction fills the defaults (nonce, gas, gasPrice or 1559 fields) on a given unsigned transaction, and returns it to the caller for further processing (signing + broadcast).
func (*TransactionAPI) GetBlockTransactionCountByHash ¶
func (s *TransactionAPI) GetBlockTransactionCountByHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint
GetBlockTransactionCountByHash returns the number of transactions in the block with the given hash.
func (*TransactionAPI) GetBlockTransactionCountByNumber ¶
func (s *TransactionAPI) GetBlockTransactionCountByNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint
GetBlockTransactionCountByNumber returns the number of transactions in the block with the given block number.
func (*TransactionAPI) GetRawTransactionByBlockHashAndIndex ¶
func (s *TransactionAPI) GetRawTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) hexutil.Bytes
GetRawTransactionByBlockHashAndIndex returns the bytes of the transaction for the given block hash and index.
func (*TransactionAPI) GetRawTransactionByBlockNumberAndIndex ¶
func (s *TransactionAPI) GetRawTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) hexutil.Bytes
GetRawTransactionByBlockNumberAndIndex returns the bytes of the transaction for the given block number and index.
func (*TransactionAPI) GetRawTransactionByHash ¶
func (s *TransactionAPI) GetRawTransactionByHash(ctx context.Context, hash common.Hash) (hexutil.Bytes, error)
GetRawTransactionByHash returns the bytes of the transaction for the given hash.
func (*TransactionAPI) GetTransactionByBlockHashAndIndex ¶
func (s *TransactionAPI) GetTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) *RPCTransaction
GetTransactionByBlockHashAndIndex returns the transaction for the given block hash and index.
func (*TransactionAPI) GetTransactionByBlockNumberAndIndex ¶
func (s *TransactionAPI) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) *RPCTransaction
GetTransactionByBlockNumberAndIndex returns the transaction for the given block number and index.
func (*TransactionAPI) GetTransactionByHash ¶
func (s *TransactionAPI) GetTransactionByHash(ctx context.Context, hash common.Hash) (*RPCTransaction, error)
GetTransactionByHash returns the transaction for the given hash
func (*TransactionAPI) GetTransactionCount ¶
func (s *TransactionAPI) GetTransactionCount(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Uint64, error)
GetTransactionCount returns the number of transactions the given address has sent for the given block number
func (*TransactionAPI) GetTransactionReceipt ¶
func (s *TransactionAPI) GetTransactionReceipt(ctx context.Context, hash common.Hash) (map[string]interface{}, error)
GetTransactionReceipt returns the transaction receipt for the given transaction hash.
func (*TransactionAPI) PendingTransactions ¶
func (s *TransactionAPI) PendingTransactions() ([]*RPCTransaction, error)
PendingTransactions returns the transactions that are in the transaction pool and have a from address that is one of the accounts this node manages.
func (*TransactionAPI) Resend ¶
func (s *TransactionAPI) Resend(ctx context.Context, sendArgs TransactionArgs, gasPrice *hexutil.Big, gasLimit *hexutil.Uint64) (common.Hash, error)
Resend accepts an existing transaction and a new gas price and limit. It will remove the given transaction from the pool and reinsert it with the new gas price and limit.
func (*TransactionAPI) SendBatchRawTransactions ¶
func (*TransactionAPI) SendRawTransaction ¶
func (s *TransactionAPI) SendRawTransaction(ctx context.Context, input hexutil.Bytes) (txHash common.Hash, err error)
SendRawTransaction will add the signed transaction to the transaction pool. The sender is responsible for signing the transaction and using the correct nonce.
func (*TransactionAPI) SendTransaction ¶
func (s *TransactionAPI) SendTransaction(ctx context.Context, args TransactionArgs) (common.Hash, error)
SendTransaction creates a transaction for the given argument, sign it and submit it to the transaction pool.
func (*TransactionAPI) Sign ¶
Sign calculates an ECDSA signature for: keccak256("\x19Ethereum Signed Message:\n" + len(message) + message).
Note, the produced signature conforms to the secp256k1 curve R, S and V values, where the V value will be 27 or 28 for legacy reasons.
The account associated with addr must be unlocked.
func (*TransactionAPI) SignTransaction ¶
func (s *TransactionAPI) SignTransaction(ctx context.Context, args TransactionArgs) (*SignTransactionResult, error)
SignTransaction will sign the given transaction with the from account. The node needs to have the private key of the account corresponding with the given from address and it needs to be unlocked.
type TransactionArgs ¶
type TransactionArgs struct { From *common.Address `json:"from"` To *common.Address `json:"to"` Gas *hexutil.Uint64 `json:"gas"` GasPrice *hexutil.Big `json:"gasPrice"` MaxFeePerGas *hexutil.Big `json:"maxFeePerGas"` MaxPriorityFeePerGas *hexutil.Big `json:"maxPriorityFeePerGas"` Value *hexutil.Big `json:"value"` Nonce *hexutil.Uint64 `json:"nonce"` // We accept "data" and "input" for backwards-compatibility reasons. // "input" is the newer name and should be preferred by clients. // Issue detail: https://github.com/ethereum/go-ethereum/issues/15628 Data *hexutil.Bytes `json:"data"` Input *hexutil.Bytes `json:"input"` // Introduced by AccessListTxType transaction. AccessList *types.AccessList `json:"accessList,omitempty"` ChainID *hexutil.Big `json:"chainId,omitempty"` // For BlobTxType BlobFeeCap *hexutil.Big `json:"maxFeePerBlobGas"` BlobHashes []common.Hash `json:"blobVersionedHashes,omitempty"` // For BlobTxType transactions with blob sidecar Blobs []kzg4844.Blob `json:"blobs"` Commitments []kzg4844.Commitment `json:"commitments"` Proofs []kzg4844.Proof `json:"proofs"` // contains filtered or unexported fields }
TransactionArgs represents the arguments to construct a new transaction or a message call.
func NewTxArgsFromTx ¶
func NewTxArgsFromTx(tx *types.Transaction) *TransactionArgs
func (*TransactionArgs) CallDefaults ¶
func (args *TransactionArgs) CallDefaults(globalGasCap uint64, baseFee *big.Int, chainID *big.Int) error
CallDefaults sanitizes the transaction arguments, often filling in zero values, for the purpose of eth_call class of RPC methods.
func (*TransactionArgs) IsEIP4844 ¶
func (args *TransactionArgs) IsEIP4844() bool
IsEIP4844 returns an indicator if the args contains EIP4844 fields.
func (*TransactionArgs) ToMessage ¶
func (args *TransactionArgs) ToMessage(baseFee *big.Int) *core.Message
ToMessage converts the transaction arguments to the Message type used by the core evm. This method is used in calls and traces that do not require a real live transaction. Assumes that fields are not nil, i.e. setDefaults or CallDefaults has been called.
func (*TransactionArgs) ToTransaction ¶
func (args *TransactionArgs) ToTransaction(v, r, s *big.Int) *types.Transaction
ToTransaction converts the arguments to a transaction. This assumes that setDefaults has been called.
type Web3API ¶
type Web3API struct {
// contains filtered or unexported fields
}