Documentation ¶
Index ¶
- Constants
- Variables
- func RPCErrorResponse(code int, message string, err error) (interface{}, types.Error)
- func RPCErrorResponseWithData(code int, message string, data *[]byte, err error) (interface{}, types.Error)
- type Config
- type DBTxManager
- type DBTxScopedFn
- type DBTxer
- type DebugEndpoints
- func (d *DebugEndpoints) TraceBatchByNumber(httpRequest *http.Request, number types.BatchNumber, cfg *traceConfig) (interface{}, types.Error)
- func (d *DebugEndpoints) TraceBlockByHash(hash types.ArgHash, cfg *traceConfig) (interface{}, types.Error)
- func (d *DebugEndpoints) TraceBlockByNumber(number types.BlockNumber, cfg *traceConfig) (interface{}, types.Error)
- func (d *DebugEndpoints) TraceTransaction(hash types.ArgHash, cfg *traceConfig) (interface{}, types.Error)
- type EthEndpoints
- func (e *EthEndpoints) BlockNumber() (interface{}, types.Error)
- func (e *EthEndpoints) Call(arg *types.TxArgs, blockArg *types.BlockNumberOrHash) (interface{}, types.Error)
- func (e *EthEndpoints) ChainId() (interface{}, types.Error)
- func (e *EthEndpoints) EstimateGas(arg *types.TxArgs, blockArg *types.BlockNumberOrHash) (interface{}, types.Error)
- func (e *EthEndpoints) GasPrice() (interface{}, types.Error)
- func (e *EthEndpoints) GetBalance(address types.ArgAddress, blockArg *types.BlockNumberOrHash) (interface{}, types.Error)
- func (e *EthEndpoints) GetBlockByHash(hash types.ArgHash, fullTx bool) (interface{}, types.Error)
- func (e *EthEndpoints) GetBlockByNumber(number types.BlockNumber, fullTx bool) (interface{}, types.Error)
- func (e *EthEndpoints) GetBlockTransactionCountByHash(hash types.ArgHash) (interface{}, types.Error)
- func (e *EthEndpoints) GetBlockTransactionCountByNumber(number *types.BlockNumber) (interface{}, types.Error)
- func (e *EthEndpoints) GetCode(address types.ArgAddress, blockArg *types.BlockNumberOrHash) (interface{}, types.Error)
- func (e *EthEndpoints) GetCompilers() (interface{}, types.Error)
- func (e *EthEndpoints) GetFilterChanges(filterID string) (interface{}, types.Error)
- func (e *EthEndpoints) GetFilterLogs(filterID string) (interface{}, types.Error)
- func (e *EthEndpoints) GetLogs(filter LogFilter) (interface{}, types.Error)
- func (e *EthEndpoints) GetStorageAt(address types.ArgAddress, storageKeyStr string, ...) (interface{}, types.Error)
- func (e *EthEndpoints) GetTransactionByBlockHashAndIndex(hash types.ArgHash, index types.Index) (interface{}, types.Error)
- func (e *EthEndpoints) GetTransactionByBlockNumberAndIndex(number *types.BlockNumber, index types.Index) (interface{}, types.Error)
- func (e *EthEndpoints) GetTransactionByHash(hash types.ArgHash) (interface{}, types.Error)
- func (e *EthEndpoints) GetTransactionCount(address types.ArgAddress, blockArg *types.BlockNumberOrHash) (interface{}, types.Error)
- func (e *EthEndpoints) GetTransactionReceipt(hash types.ArgHash) (interface{}, types.Error)
- func (e *EthEndpoints) GetUncleByBlockHashAndIndex(hash types.ArgHash, index types.Index) (interface{}, types.Error)
- func (e *EthEndpoints) GetUncleByBlockNumberAndIndex(number types.BlockNumber, index types.Index) (interface{}, types.Error)
- func (e *EthEndpoints) GetUncleCountByBlockHash(hash types.ArgAddress) (interface{}, types.Error)
- func (e *EthEndpoints) GetUncleCountByBlockNumber(number types.BlockNumber) (interface{}, types.Error)
- func (e *EthEndpoints) NewBlockFilter() (interface{}, types.Error)
- func (e *EthEndpoints) NewFilter(filter LogFilter) (interface{}, types.Error)
- func (e *EthEndpoints) NewPendingTransactionFilter() (interface{}, types.Error)
- func (e *EthEndpoints) ProtocolVersion() (interface{}, types.Error)
- func (e *EthEndpoints) SendRawTransaction(httpRequest *http.Request, input string) (interface{}, types.Error)
- func (e *EthEndpoints) Subscribe(wsConn *concurrentWsConn, name string, logFilter *LogFilter) (interface{}, types.Error)
- func (e *EthEndpoints) Syncing() (interface{}, types.Error)
- func (e *EthEndpoints) UninstallFilter(filterID string) (interface{}, types.Error)
- func (e *EthEndpoints) Unsubscribe(wsConn *concurrentWsConn, filterID string) (interface{}, types.Error)
- type Filter
- type FilterType
- type Handler
- type LogFilter
- type NetEndpoints
- type Server
- type Service
- type Storage
- func (s *Storage) GetAllBlockFiltersWithWSConn() map[string]*Filter
- func (s *Storage) GetAllLogFiltersWithWSConn() map[string]*Filter
- func (s *Storage) GetFilter(filterID string) (*Filter, error)
- func (s *Storage) Lock()
- func (s *Storage) NewBlockFilter(wsConn *concurrentWsConn) (string, error)
- func (s *Storage) NewLogFilter(wsConn *concurrentWsConn, filter LogFilter) (string, error)
- func (s *Storage) NewPendingTransactionFilter(wsConn *concurrentWsConn) (string, error)
- func (s *Storage) UninstallFilter(filterID string) error
- func (s *Storage) UninstallFilterByWSConn(wsConn *concurrentWsConn) error
- func (s *Storage) Unlock()
- func (s *Storage) UpdateFilterLastPoll(filterID string) error
- type StructLogRes
- type TxPoolEndpoints
- type Web3Endpoints
- type WebSocketsConfig
- type ZKEVMEndpoints
- func (z *ZKEVMEndpoints) BatchNumber() (interface{}, types.Error)
- func (z *ZKEVMEndpoints) BatchNumberByBlockNumber(blockNumber types.ArgUint64) (interface{}, types.Error)
- func (z *ZKEVMEndpoints) ConsolidatedBlockNumber() (interface{}, types.Error)
- func (z *ZKEVMEndpoints) GetBatchByNumber(batchNumber types.BatchNumber, fullTx bool) (interface{}, types.Error)
- func (z *ZKEVMEndpoints) GetFullBlockByHash(hash types.ArgHash, fullTx bool) (interface{}, types.Error)
- func (z *ZKEVMEndpoints) GetFullBlockByNumber(number types.BlockNumber, fullTx bool) (interface{}, types.Error)
- func (z *ZKEVMEndpoints) IsBlockConsolidated(blockNumber types.ArgUint64) (interface{}, types.Error)
- func (z *ZKEVMEndpoints) IsBlockVirtualized(blockNumber types.ArgUint64) (interface{}, types.Error)
- func (z *ZKEVMEndpoints) VerifiedBatchNumber() (interface{}, types.Error)
- func (z *ZKEVMEndpoints) VirtualBatchNumber() (interface{}, types.Error)
Constants ¶
const ( // FilterTypeLog represents a filter of type log. FilterTypeLog = "log" // FilterTypeBlock represents a filter of type block. FilterTypeBlock = "block" // FilterTypePendingTx represent a filter of type pending Tx. FilterTypePendingTx = "pendingTx" )
const ( // APIEth represents the eth API prefix. APIEth = "eth" // APINet represents the net API prefix. APINet = "net" // APIDebug represents the debug API prefix. APIDebug = "debug" // APIZKEVM represents the zkevm API prefix. APIZKEVM = "zkevm" // APITxPool represents the txpool API prefix. APITxPool = "txpool" // APIWeb3 represents the web3 API prefix. APIWeb3 = "web3" )
const ( // DefaultSenderAddress is the address that jRPC will use // to communicate with the state for eth_EstimateGas and eth_Call when // the From field is not specified because it is optional DefaultSenderAddress = "0x1111111111111111111111111111111111111111" )
Variables ¶
var ErrFilterInvalidPayload = errors.New("invalid argument 0: cannot specify both BlockHash and FromBlock/ToBlock, choose one or the other")
ErrFilterInvalidPayload indicates there is an invalid payload when creating a filter
var ErrNotFound = errors.New("object not found")
ErrNotFound represent a not found error.
Functions ¶
func RPCErrorResponse ¶ added in v0.0.990
RPCErrorResponse formats error to be returned through RPC
Types ¶
type Config ¶
type Config struct { // Host defines the network adapter that will be used to serve the HTTP requests Host string `mapstructure:"Host"` // Port defines the port to serve the endpoints via HTTP Port int `mapstructure:"Port"` // ReadTimeout is the HTTP server read timeout // check net/http.server.ReadTimeout and net/http.server.ReadHeaderTimeout ReadTimeout types.Duration `mapstructure:"ReadTimeout"` // WriteTimeout is the HTTP server write timeout // check net/http.server.WriteTimeout WriteTimeout types.Duration `mapstructure:"WriteTimeout"` // MaxRequestsPerIPAndSecond defines how much requests a single IP can // send within a single second MaxRequestsPerIPAndSecond float64 `mapstructure:"MaxRequestsPerIPAndSecond"` // SequencerNodeURI is used allow Non-Sequencer nodes // to relay transactions to the Sequencer node SequencerNodeURI string `mapstructure:"SequencerNodeURI"` // MaxCumulativeGasUsed is the max gas allowed per batch MaxCumulativeGasUsed uint64 // WebSockets configuration WebSockets WebSocketsConfig `mapstructure:"WebSockets"` // EnableL2SuggestedGasPricePolling enables polling of the L2 gas price to block tx in the RPC with lower gas price. EnableL2SuggestedGasPricePolling bool `mapstructure:"EnableL2SuggestedGasPricePolling"` // TraceBatchUseHTTPS enables, in the debug_traceBatchByNum endpoint, the use of the HTTPS protocol (instead of HTTP) // to do the parallel requests to RPC.debug_traceTransaction endpoint TraceBatchUseHTTPS bool `mapstructure:"TraceBatchUseHTTPS"` }
Config represents the configuration of the json rpc
type DBTxManager ¶ added in v0.0.990
type DBTxManager struct{}
DBTxManager allows to do scopped DB txs
func (*DBTxManager) NewDbTxScope ¶ added in v0.0.990
func (f *DBTxManager) NewDbTxScope(db DBTxer, scopedFn DBTxScopedFn) (interface{}, types.Error)
NewDbTxScope function to initiate DB scopped txs
type DBTxScopedFn ¶ added in v0.0.990
DBTxScopedFn function to do scopped DB txs
type DebugEndpoints ¶
type DebugEndpoints struct {
// contains filtered or unexported fields
}
DebugEndpoints is the debug jsonrpc endpoint
func NewDebugEndpoints ¶ added in v0.0.990
func NewDebugEndpoints(cfg Config, state types.StateInterface, etherman types.EthermanInterface) *DebugEndpoints
NewDebugEndpoints returns DebugEndpoints
func (*DebugEndpoints) TraceBatchByNumber ¶ added in v0.0.990
func (d *DebugEndpoints) TraceBatchByNumber(httpRequest *http.Request, number types.BatchNumber, cfg *traceConfig) (interface{}, types.Error)
TraceBatchByNumber creates a response for debug_traceBatchByNumber request. this endpoint tries to help clients to get traces at once for all the transactions attached to the same batch.
IMPORTANT: in order to take advantage of the infrastructure automatically scaling, instead of parallelizing the trace transaction internally and pushing all the load to a single jRPC and Executor instance, the code will redirect the trace transaction requests to the same url, making them external calls, so we can process in parallel with multiple jRPC and Executor instances.
the request flow will work as follows: -> user do a trace batch request -> jRPC balancer picks a jRPC server to handle the trace batch request -> picked jRPC sends parallel trace transaction requests for each transaction in the batch -> jRPC balancer sends each request to a different jRPC to handle the trace transaction requests -> picked jRPC server group trace transaction responses from other jRPC servers -> picked jRPC respond the initial request to the user with all the tx traces
func (*DebugEndpoints) TraceBlockByHash ¶
func (d *DebugEndpoints) TraceBlockByHash(hash types.ArgHash, cfg *traceConfig) (interface{}, types.Error)
TraceBlockByHash creates a response for debug_traceBlockByHash request. See https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debugtraceblockbyhash
func (*DebugEndpoints) TraceBlockByNumber ¶
func (d *DebugEndpoints) TraceBlockByNumber(number types.BlockNumber, cfg *traceConfig) (interface{}, types.Error)
TraceBlockByNumber creates a response for debug_traceBlockByNumber request. See https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debugtraceblockbynumber
func (*DebugEndpoints) TraceTransaction ¶
func (d *DebugEndpoints) TraceTransaction(hash types.ArgHash, cfg *traceConfig) (interface{}, types.Error)
TraceTransaction creates a response for debug_traceTransaction request. See https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debugtracetransaction
type EthEndpoints ¶
type EthEndpoints struct {
// contains filtered or unexported fields
}
EthEndpoints contains implementations for the "eth" RPC endpoints
func NewEthEndpoints ¶ added in v0.0.990
func NewEthEndpoints(cfg Config, chainID uint64, p types.PoolInterface, s types.StateInterface, etherman types.EthermanInterface, storage storageInterface) *EthEndpoints
NewEthEndpoints creates an new instance of Eth
func (*EthEndpoints) BlockNumber ¶
func (e *EthEndpoints) BlockNumber() (interface{}, types.Error)
BlockNumber returns current block number
func (*EthEndpoints) Call ¶
func (e *EthEndpoints) Call(arg *types.TxArgs, blockArg *types.BlockNumberOrHash) (interface{}, types.Error)
Call executes a new message call immediately and returns the value of executed contract and potential error. Note, this function doesn't make any changes in the state/blockchain and is useful to execute view/pure methods and retrieve values.
func (*EthEndpoints) ChainId ¶
func (e *EthEndpoints) ChainId() (interface{}, types.Error)
ChainId returns the chain id of the client
func (*EthEndpoints) EstimateGas ¶
func (e *EthEndpoints) EstimateGas(arg *types.TxArgs, blockArg *types.BlockNumberOrHash) (interface{}, types.Error)
EstimateGas generates and returns an estimate of how much gas is necessary to allow the transaction to complete. The transaction will not be added to the blockchain. Note that the estimate may be significantly more than the amount of gas actually used by the transaction, for a variety of reasons including EVM mechanics and node performance.
func (*EthEndpoints) GasPrice ¶
func (e *EthEndpoints) GasPrice() (interface{}, types.Error)
GasPrice returns the average gas price based on the last x blocks
func (*EthEndpoints) GetBalance ¶
func (e *EthEndpoints) GetBalance(address types.ArgAddress, blockArg *types.BlockNumberOrHash) (interface{}, types.Error)
GetBalance returns the account's balance at the referenced block
func (*EthEndpoints) GetBlockByHash ¶
GetBlockByHash returns information about a block by hash
func (*EthEndpoints) GetBlockByNumber ¶
func (e *EthEndpoints) GetBlockByNumber(number types.BlockNumber, fullTx bool) (interface{}, types.Error)
GetBlockByNumber returns information about a block by block number
func (*EthEndpoints) GetBlockTransactionCountByHash ¶
func (e *EthEndpoints) GetBlockTransactionCountByHash(hash types.ArgHash) (interface{}, types.Error)
GetBlockTransactionCountByHash returns the number of transactions in a block from a block matching the given block hash.
func (*EthEndpoints) GetBlockTransactionCountByNumber ¶
func (e *EthEndpoints) GetBlockTransactionCountByNumber(number *types.BlockNumber) (interface{}, types.Error)
GetBlockTransactionCountByNumber returns the number of transactions in a block from a block matching the given block number.
func (*EthEndpoints) GetCode ¶
func (e *EthEndpoints) GetCode(address types.ArgAddress, blockArg *types.BlockNumberOrHash) (interface{}, types.Error)
GetCode returns account code at given block number
func (*EthEndpoints) GetCompilers ¶
func (e *EthEndpoints) GetCompilers() (interface{}, types.Error)
GetCompilers eth_getCompilers
func (*EthEndpoints) GetFilterChanges ¶
func (e *EthEndpoints) GetFilterChanges(filterID string) (interface{}, types.Error)
GetFilterChanges polling method for a filter, which returns an array of logs which occurred since last poll.
func (*EthEndpoints) GetFilterLogs ¶
func (e *EthEndpoints) GetFilterLogs(filterID string) (interface{}, types.Error)
GetFilterLogs returns an array of all logs matching filter with given id.
func (*EthEndpoints) GetLogs ¶
func (e *EthEndpoints) GetLogs(filter LogFilter) (interface{}, types.Error)
GetLogs returns a list of logs accordingly to the provided filter
func (*EthEndpoints) GetStorageAt ¶
func (e *EthEndpoints) GetStorageAt(address types.ArgAddress, storageKeyStr string, blockArg *types.BlockNumberOrHash) (interface{}, types.Error)
GetStorageAt gets the value stored for an specific address and position
func (*EthEndpoints) GetTransactionByBlockHashAndIndex ¶
func (e *EthEndpoints) GetTransactionByBlockHashAndIndex(hash types.ArgHash, index types.Index) (interface{}, types.Error)
GetTransactionByBlockHashAndIndex returns information about a transaction by block hash and transaction index position.
func (*EthEndpoints) GetTransactionByBlockNumberAndIndex ¶
func (e *EthEndpoints) GetTransactionByBlockNumberAndIndex(number *types.BlockNumber, index types.Index) (interface{}, types.Error)
GetTransactionByBlockNumberAndIndex returns information about a transaction by block number and transaction index position.
func (*EthEndpoints) GetTransactionByHash ¶
func (e *EthEndpoints) GetTransactionByHash(hash types.ArgHash) (interface{}, types.Error)
GetTransactionByHash returns a transaction by his hash
func (*EthEndpoints) GetTransactionCount ¶
func (e *EthEndpoints) GetTransactionCount(address types.ArgAddress, blockArg *types.BlockNumberOrHash) (interface{}, types.Error)
GetTransactionCount returns account nonce
func (*EthEndpoints) GetTransactionReceipt ¶
func (e *EthEndpoints) GetTransactionReceipt(hash types.ArgHash) (interface{}, types.Error)
GetTransactionReceipt returns a transaction receipt by his hash
func (*EthEndpoints) GetUncleByBlockHashAndIndex ¶
func (e *EthEndpoints) GetUncleByBlockHashAndIndex(hash types.ArgHash, index types.Index) (interface{}, types.Error)
GetUncleByBlockHashAndIndex returns information about a uncle of a block by hash and uncle index position
func (*EthEndpoints) GetUncleByBlockNumberAndIndex ¶
func (e *EthEndpoints) GetUncleByBlockNumberAndIndex(number types.BlockNumber, index types.Index) (interface{}, types.Error)
GetUncleByBlockNumberAndIndex returns information about a uncle of a block by number and uncle index position
func (*EthEndpoints) GetUncleCountByBlockHash ¶
func (e *EthEndpoints) GetUncleCountByBlockHash(hash types.ArgAddress) (interface{}, types.Error)
GetUncleCountByBlockHash returns the number of uncles in a block matching the given block hash
func (*EthEndpoints) GetUncleCountByBlockNumber ¶
func (e *EthEndpoints) GetUncleCountByBlockNumber(number types.BlockNumber) (interface{}, types.Error)
GetUncleCountByBlockNumber returns the number of uncles in a block matching the given block number
func (*EthEndpoints) NewBlockFilter ¶
func (e *EthEndpoints) NewBlockFilter() (interface{}, types.Error)
NewBlockFilter creates a filter in the node, to notify when a new block arrives. To check if the state has changed, call eth_getFilterChanges.
func (*EthEndpoints) NewFilter ¶
func (e *EthEndpoints) NewFilter(filter LogFilter) (interface{}, types.Error)
NewFilter creates a filter object, based on filter options, to notify when the state changes (logs). To check if the state has changed, call eth_getFilterChanges.
func (*EthEndpoints) NewPendingTransactionFilter ¶
func (e *EthEndpoints) NewPendingTransactionFilter() (interface{}, types.Error)
NewPendingTransactionFilter creates a filter in the node, to notify when new pending transactions arrive. To check if the state has changed, call eth_getFilterChanges.
func (*EthEndpoints) ProtocolVersion ¶
func (e *EthEndpoints) ProtocolVersion() (interface{}, types.Error)
ProtocolVersion returns the protocol version.
func (*EthEndpoints) SendRawTransaction ¶
func (e *EthEndpoints) SendRawTransaction(httpRequest *http.Request, input string) (interface{}, types.Error)
SendRawTransaction has two different ways to handle new transactions: - for Sequencer nodes it tries to add the tx to the pool - for Non-Sequencer nodes it relays the Tx to the Sequencer node
func (*EthEndpoints) Subscribe ¶
func (e *EthEndpoints) Subscribe(wsConn *concurrentWsConn, name string, logFilter *LogFilter) (interface{}, types.Error)
Subscribe Creates a new subscription over particular events. The node will return a subscription id. For each event that matches the subscription a notification with relevant data is sent together with the subscription id.
func (*EthEndpoints) Syncing ¶
func (e *EthEndpoints) Syncing() (interface{}, types.Error)
Syncing returns an object with data about the sync status or false. https://eth.wiki/json-rpc/API#eth_syncing
func (*EthEndpoints) UninstallFilter ¶
func (e *EthEndpoints) UninstallFilter(filterID string) (interface{}, types.Error)
UninstallFilter uninstalls a filter with given id.
func (*EthEndpoints) Unsubscribe ¶
func (e *EthEndpoints) Unsubscribe(wsConn *concurrentWsConn, filterID string) (interface{}, types.Error)
Unsubscribe uninstalls the filter based on the provided filterID
type Filter ¶
type Filter struct { ID string Type FilterType Parameters interface{} LastPoll time.Time WsConn *concurrentWsConn // contains filtered or unexported fields }
Filter represents a filter used by subscriptions to be used when a new L2 block is detected to select the correct requested data
func (*Filter) EnqueueSubscriptionDataToBeSent ¶ added in v0.3.4
EnqueueSubscriptionDataToBeSent enqueues subscription data to be sent via web sockets connection
func (*Filter) SendEnqueuedSubscriptionData ¶ added in v0.3.4
func (f *Filter) SendEnqueuedSubscriptionData()
SendEnqueuedSubscriptionData consumes all the enqueued subscription data and sends it via web sockets connection.
type FilterType ¶
type FilterType string
FilterType express the type of the filter, block, logs, pending transactions
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler manage services to handle jsonrpc requests
Services are public structures containing public methods matching the name of the jsonrpc method.
Services must be registered with a prefix to identify the service and its methods, for example a service registered with a prefix `eth` will have all the public methods exposed as eth_<methodName> through the json rpc server.
Go public methods requires the first char of its name to be in uppercase, but the exposition of the method will consider it to lower case, for example a method `func MyMethod()` provided by the service registered with `eth` prefix will be triggered when the method eth_myMethod is specified
the public methods must follow the conventions: - return interface{}, rpcError - if the method depend on a Web Socket connection, it must be the first parameters as f(*websocket.Conn) - parameter types must match the type of the data provided for the method
check the `eth.go` file for more example on how the methods are implemented
func (*Handler) Handle ¶
Handle is the function that knows which and how a function should be executed when a JSON RPC request is received
func (*Handler) HandleWs ¶
func (h *Handler) HandleWs(reqBody []byte, wsConn *concurrentWsConn, httpReq *http.Request) ([]byte, error)
HandleWs handle websocket requests
func (*Handler) RemoveFilterByWsConn ¶
func (h *Handler) RemoveFilterByWsConn(wsConn *concurrentWsConn)
RemoveFilterByWsConn uninstalls the filter attached to this websocket connection
type LogFilter ¶
type LogFilter struct { BlockHash *common.Hash FromBlock *types.BlockNumber ToBlock *types.BlockNumber Addresses []common.Address Topics [][]common.Hash Since *time.Time }
LogFilter is a filter for logs
func (*LogFilter) MarshalJSON ¶
MarshalJSON allows to customize the JSON representation.
func (*LogFilter) UnmarshalJSON ¶
UnmarshalJSON decodes a json object
type NetEndpoints ¶
type NetEndpoints struct {
// contains filtered or unexported fields
}
NetEndpoints contains implementations for the "net" RPC endpoints
func NewNetEndpoints ¶ added in v0.0.990
func NewNetEndpoints(cfg Config, chainID uint64) *NetEndpoints
NewNetEndpoints returns NetEndpoints
func (*NetEndpoints) Version ¶
func (n *NetEndpoints) Version() (interface{}, types.Error)
Version returns the current network id
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is an API backend to handle RPC requests
func NewServer ¶
func NewServer( cfg Config, chainID uint64, p types.PoolInterface, s types.StateInterface, storage storageInterface, services []Service, ) *Server
NewServer returns the JsonRPC server
type Service ¶ added in v0.0.990
type Service struct { Name string Service interface{} }
Service implementation of a service an it's name
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage uses memory to store the data related to the json rpc server
func NewStorage ¶
func NewStorage() *Storage
NewStorage creates and initializes an instance of Storage
func (*Storage) GetAllBlockFiltersWithWSConn ¶
GetAllBlockFiltersWithWSConn returns an array with all filter that have a web socket connection and are filtering by new blocks
func (*Storage) GetAllLogFiltersWithWSConn ¶
GetAllLogFiltersWithWSConn returns an array with all filter that have a web socket connection and are filtering by new logs
func (*Storage) NewBlockFilter ¶
NewBlockFilter persists a new block log filter
func (*Storage) NewLogFilter ¶
NewLogFilter persists a new log filter
func (*Storage) NewPendingTransactionFilter ¶
NewPendingTransactionFilter persists a new pending transaction filter
func (*Storage) UninstallFilter ¶
UninstallFilter deletes a filter by its id
func (*Storage) UninstallFilterByWSConn ¶
UninstallFilterByWSConn deletes all filters connected to the provided web socket connection
func (*Storage) UpdateFilterLastPoll ¶
UpdateFilterLastPoll updates the last poll to now
type StructLogRes ¶
type StructLogRes struct { Pc uint64 `json:"pc"` Op string `json:"op"` Gas uint64 `json:"gas"` GasCost uint64 `json:"gasCost"` Depth int `json:"depth"` Error string `json:"error,omitempty"` Stack *[]types.ArgBig `json:"stack,omitempty"` Memory *[]string `json:"memory,omitempty"` Storage *map[string]string `json:"storage,omitempty"` RefundCounter uint64 `json:"refund,omitempty"` }
StructLogRes represents the debug trace information for each opcode
type TxPoolEndpoints ¶
type TxPoolEndpoints struct{}
TxPoolEndpoints is the txpool jsonrpc endpoint
func (*TxPoolEndpoints) Content ¶
func (e *TxPoolEndpoints) Content() (interface{}, types.Error)
Content creates a response for txpool_content request. See https://geth.ethereum.org/docs/rpc/ns-txpool#txpool_content.
type Web3Endpoints ¶
type Web3Endpoints struct { }
Web3Endpoints contains implementations for the "web3" RPC endpoints
func (*Web3Endpoints) ClientVersion ¶
func (e *Web3Endpoints) ClientVersion() (interface{}, types.Error)
ClientVersion returns the client version.
type WebSocketsConfig ¶
type WebSocketsConfig struct { // Enabled defines if the WebSocket requests are enabled or disabled Enabled bool `mapstructure:"Enabled"` // Host defines the network adapter that will be used to serve the WS requests Host string `mapstructure:"Host"` // Port defines the port to serve the endpoints via WS Port int `mapstructure:"Port"` }
WebSocketsConfig has parameters to config the rpc websocket support
type ZKEVMEndpoints ¶
type ZKEVMEndpoints struct {
// contains filtered or unexported fields
}
ZKEVMEndpoints contains implementations for the "zkevm" RPC endpoints
func NewZKEVMEndpoints ¶ added in v0.0.990
func NewZKEVMEndpoints(cfg Config, state types.StateInterface, etherman types.EthermanInterface) *ZKEVMEndpoints
NewZKEVMEndpoints returns ZKEVMEndpoints
func (*ZKEVMEndpoints) BatchNumber ¶
func (z *ZKEVMEndpoints) BatchNumber() (interface{}, types.Error)
BatchNumber returns the latest trusted batch number
func (*ZKEVMEndpoints) BatchNumberByBlockNumber ¶
func (z *ZKEVMEndpoints) BatchNumberByBlockNumber(blockNumber types.ArgUint64) (interface{}, types.Error)
BatchNumberByBlockNumber returns the batch number from which the passed block number is created
func (*ZKEVMEndpoints) ConsolidatedBlockNumber ¶
func (z *ZKEVMEndpoints) ConsolidatedBlockNumber() (interface{}, types.Error)
ConsolidatedBlockNumber returns last block number related to the last verified batch
func (*ZKEVMEndpoints) GetBatchByNumber ¶
func (z *ZKEVMEndpoints) GetBatchByNumber(batchNumber types.BatchNumber, fullTx bool) (interface{}, types.Error)
GetBatchByNumber returns information about a batch by batch number
func (*ZKEVMEndpoints) GetFullBlockByHash ¶ added in v0.0.990
func (z *ZKEVMEndpoints) GetFullBlockByHash(hash types.ArgHash, fullTx bool) (interface{}, types.Error)
GetFullBlockByHash returns information about a block by hash
func (*ZKEVMEndpoints) GetFullBlockByNumber ¶ added in v0.0.990
func (z *ZKEVMEndpoints) GetFullBlockByNumber(number types.BlockNumber, fullTx bool) (interface{}, types.Error)
GetFullBlockByNumber returns information about a block by block number
func (*ZKEVMEndpoints) IsBlockConsolidated ¶
func (z *ZKEVMEndpoints) IsBlockConsolidated(blockNumber types.ArgUint64) (interface{}, types.Error)
IsBlockConsolidated returns the consolidation status of a provided block number
func (*ZKEVMEndpoints) IsBlockVirtualized ¶
func (z *ZKEVMEndpoints) IsBlockVirtualized(blockNumber types.ArgUint64) (interface{}, types.Error)
IsBlockVirtualized returns the virtualization status of a provided block number
func (*ZKEVMEndpoints) VerifiedBatchNumber ¶
func (z *ZKEVMEndpoints) VerifiedBatchNumber() (interface{}, types.Error)
VerifiedBatchNumber returns the latest verified batch number
func (*ZKEVMEndpoints) VirtualBatchNumber ¶
func (z *ZKEVMEndpoints) VirtualBatchNumber() (interface{}, types.Error)
VirtualBatchNumber returns the latest virtualized batch number