rpcapi

package
v2.0.0-rc.14 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Overview

Copyright (c) 2023-2024 Nibi, Inc.

Copyright (c) 2023-2024 Nibi, Inc.

Copyright (c) 2023-2024 Nibi, Inc.

Copyright (c) 2023-2024 Nibi, Inc.

Copyright (c) 2023-2024 Nibi, Inc.

Copyright (c) 2023-2024 Nibi, Inc.

Copyright (c) 2023-2024 Nibi, Inc.

Copyright (c) 2023-2024 Nibi, Inc.

Copyright (c) 2023-2024 Nibi, Inc.

Copyright (c) 2023-2024 Nibi, Inc.

Copyright (c) 2023-2024 Nibi, Inc.

Index

Constants

View Source
const (
	// Cosmos namespaces
	NamespaceCosmos = "cosmos"

	// Ethereum namespaces
	NamespaceWeb3   = "web3"
	NamespaceEth    = "eth"
	NamespaceNet    = "net"
	NamespaceTxPool = "txpool"
	NamespaceDebug  = "debug"
)

RPC namespaces and API version

Variables

This section is empty.

Functions

func FilterLogs

func FilterLogs(logs []*gethcore.Log, fromBlock, toBlock *big.Int, addresses []common.Address, topics [][]common.Hash) []*gethcore.Log

FilterLogs creates a slice of logs matching the given criteria. [] -> anything [A] -> A in first position of log topics, anything after [null, B] -> anything in first position, B in second position [A, B] -> A in first position and B in second position [[A, B], [A, B]] -> A or B in first position, A or B in second position

func GetRPCAPIs

func GetRPCAPIs(ctx *server.Context,
	clientCtx client.Context,
	tmWSClient *rpcclient.WSClient,
	allowUnprotectedTxs bool,
	indexer eth.EVMTxIndexer,
	selectedAPIs []string,
) []rpc.API

GetRPCAPIs returns the list of all APIs

func ParseBloomFromEvents

func ParseBloomFromEvents(events []abci.Event) (bloom gethcore.Bloom, err error)

ParseBloomFromEvents iterates through the slice of events

Types

type APICreator

type APICreator = func(
	ctx *server.Context,
	clientCtx client.Context,
	tendermintWebsocketClient *rpcclient.WSClient,
	allowUnprotectedTxs bool,
	indexer eth.EVMTxIndexer,
) []rpc.API

APICreator creates the JSON-RPC API implementations.

type APIWeb3

type APIWeb3 struct{}

APIWeb3 is the web3_ prefixed set of APIs in the Web3 JSON-RPC spec.

func NewImplWeb3API

func NewImplWeb3API() *APIWeb3

NewImplWeb3API creates an instance of the Web3 API.

func (*APIWeb3) ClientVersion

func (a *APIWeb3) ClientVersion() string

ClientVersion returns the client version in the Web3 user agent format.

func (*APIWeb3) Sha3

func (a *APIWeb3) Sha3(input string) hexutil.Bytes

Sha3 returns the keccak-256 hash of the passed-in input.

type BloomIV

type BloomIV struct {
	I [3]uint
	V [3]byte
}

BloomIV represents the bit indexes and value inside the bloom filter that belong to some key.

type ErrorMessageJSON

type ErrorMessageJSON struct {
	Code    *big.Int `json:"code"`
	Message string   `json:"message"`
}

type ErrorResponseJSON

type ErrorResponseJSON struct {
	Jsonrpc string            `json:"jsonrpc"`
	Error   *ErrorMessageJSON `json:"error"`
	ID      *big.Int          `json:"id"`
}

type EthAPI

type EthAPI struct {
	// contains filtered or unexported fields
}

EthAPI is the eth_ prefixed set of APIs in the Web3 JSON-RPC spec.

func NewImplEthAPI

func NewImplEthAPI(logger log.Logger, backend *backend.Backend) *EthAPI

NewImplEthAPI creates an instance of the public ETH Web3 API.

func (*EthAPI) Accounts

func (e *EthAPI) Accounts() ([]common.Address, error)

Accounts returns the list of accounts available to this node.

func (*EthAPI) BlockNumber

func (e *EthAPI) BlockNumber() (hexutil.Uint64, error)

BlockNumber returns the current block number.

func (*EthAPI) Call

func (e *EthAPI) Call(args evm.JsonTxArgs,
	blockNrOrHash rpc.BlockNumberOrHash,
	_ *rpc.StateOverride,
) (hexutil.Bytes, error)

Call performs a raw contract call.

func (*EthAPI) ChainId

func (e *EthAPI) ChainId() (*hexutil.Big, error)

ChainId is the EIP-155 replay-protection chain id for the current ethereum chain config.

func (*EthAPI) EstimateGas

func (e *EthAPI) EstimateGas(
	args evm.JsonTxArgs, blockNrOptional *rpc.BlockNumber,
) (hexutil.Uint64, error)

EstimateGas returns an estimate of gas usage for the given smart contract call.

func (*EthAPI) FeeHistory

func (e *EthAPI) FeeHistory(blockCount gethrpc.DecimalOrHex,
	lastBlock gethrpc.BlockNumber,
	rewardPercentiles []float64,
) (*rpc.FeeHistoryResult, error)

func (*EthAPI) FillTransaction

func (e *EthAPI) FillTransaction(
	args evm.JsonTxArgs,
) (*rpc.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 (*EthAPI) GasPrice

func (e *EthAPI) GasPrice() (*hexutil.Big, error)

GasPrice returns the current gas price based on Ethermint's gas price oracle.

func (*EthAPI) GetBalance

func (e *EthAPI) GetBalance(
	address common.Address, blockNrOrHash rpc.BlockNumberOrHash,
) (*hexutil.Big, error)

GetBalance returns the provided account's balance up to the provided block number.

func (*EthAPI) GetBlockByHash

func (e *EthAPI) GetBlockByHash(hash common.Hash, fullTx bool) (map[string]any, error)

GetBlockByHash returns the block identified by hash.

func (*EthAPI) GetBlockByNumber

func (e *EthAPI) GetBlockByNumber(ethBlockNum rpc.BlockNumber, fullTx bool) (map[string]any, error)

GetBlockByNumber returns the block identified by number.

func (*EthAPI) GetBlockTransactionCountByHash

func (e *EthAPI) GetBlockTransactionCountByHash(hash common.Hash) *hexutil.Uint

GetBlockTransactionCountByHash returns the number of transactions in the block identified by hash.

func (*EthAPI) GetBlockTransactionCountByNumber

func (e *EthAPI) GetBlockTransactionCountByNumber(
	blockNum rpc.BlockNumber,
) *hexutil.Uint

GetBlockTransactionCountByNumber returns the number of transactions in the block identified by number.

func (*EthAPI) GetCode

func (e *EthAPI) GetCode(
	address common.Address, blockNrOrHash rpc.BlockNumberOrHash,
) (hexutil.Bytes, error)

GetCode returns the contract code at the given address and block number.

func (*EthAPI) GetPendingTransactions

func (e *EthAPI) GetPendingTransactions() ([]*rpc.EthTxJsonRPC, error)

GetPendingTransactions returns the transactions that are in the transaction pool and have a from address that is one of the accounts this node manages.

func (*EthAPI) GetProof

func (e *EthAPI) GetProof(address common.Address,
	storageKeys []string,
	blockNrOrHash rpc.BlockNumberOrHash,
) (*rpc.AccountResult, error)

GetProof returns an account object with proof and any storage proofs

func (*EthAPI) GetStorageAt

func (e *EthAPI) GetStorageAt(
	address common.Address, key string, blockNrOrHash rpc.BlockNumberOrHash,
) (hexutil.Bytes, error)

GetStorageAt returns the contract storage at the given address, block number, and key.

func (*EthAPI) GetTransactionByBlockHashAndIndex

func (e *EthAPI) GetTransactionByBlockHashAndIndex(
	hash common.Hash, idx hexutil.Uint,
) (*rpc.EthTxJsonRPC, error)

GetTransactionByBlockHashAndIndex returns the transaction identified by hash and index.

func (*EthAPI) GetTransactionByBlockNumberAndIndex

func (e *EthAPI) GetTransactionByBlockNumberAndIndex(
	blockNum rpc.BlockNumber, idx hexutil.Uint,
) (*rpc.EthTxJsonRPC, error)

GetTransactionByBlockNumberAndIndex returns the transaction identified by number and index.

func (*EthAPI) GetTransactionByHash

func (e *EthAPI) GetTransactionByHash(hash common.Hash) (*rpc.EthTxJsonRPC, error)

GetTransactionByHash returns the transaction identified by hash.

func (*EthAPI) GetTransactionCount

func (e *EthAPI) GetTransactionCount(
	address common.Address, blockNrOrHash rpc.BlockNumberOrHash,
) (*hexutil.Uint64, error)

GetTransactionCount returns the number of transactions at the given address up to the given block number.

func (*EthAPI) GetTransactionLogs

func (e *EthAPI) GetTransactionLogs(txHash common.Hash) ([]*gethcore.Log, error)

GetTransactionLogs returns the logs given a transaction hash.

func (*EthAPI) GetTransactionReceipt

func (e *EthAPI) GetTransactionReceipt(
	hash common.Hash,
) (*backend.TransactionReceipt, error)

GetTransactionReceipt returns the transaction receipt identified by hash.

func (*EthAPI) GetUncleByBlockHashAndIndex

func (e *EthAPI) GetUncleByBlockHashAndIndex(
	_ common.Hash, _ hexutil.Uint,
) map[string]any

GetUncleByBlockHashAndIndex returns the uncle identified by hash and index. Always returns nil.

func (*EthAPI) GetUncleByBlockNumberAndIndex

func (e *EthAPI) GetUncleByBlockNumberAndIndex(
	_, _ hexutil.Uint,
) map[string]any

GetUncleByBlockNumberAndIndex returns the uncle identified by number and index. Always returns nil.

func (*EthAPI) GetUncleCountByBlockHash

func (e *EthAPI) GetUncleCountByBlockHash(_ common.Hash) hexutil.Uint

GetUncleCountByBlockHash returns the number of uncles in the block identified by hash. Always zero.

func (*EthAPI) GetUncleCountByBlockNumber

func (e *EthAPI) GetUncleCountByBlockNumber(_ rpc.BlockNumber) hexutil.Uint

GetUncleCountByBlockNumber returns the number of uncles in the block identified by number. Always zero.

func (*EthAPI) MaxPriorityFeePerGas

func (e *EthAPI) MaxPriorityFeePerGas() (*hexutil.Big, error)

MaxPriorityFeePerGas returns a suggestion for a gas tip cap for dynamic fee transactions.

func (*EthAPI) ProtocolVersion

func (e *EthAPI) ProtocolVersion() hexutil.Uint

ProtocolVersion returns the supported Ethereum protocol version.

func (*EthAPI) SendRawTransaction

func (e *EthAPI) SendRawTransaction(data hexutil.Bytes) (common.Hash, error)

SendRawTransaction send a raw Ethereum transaction.

func (*EthAPI) Syncing

func (e *EthAPI) Syncing() (any, 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 pears. 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 EventSubscriber

type EventSubscriber struct {
	Logger     log.Logger
	Ctx        context.Context
	TmWSClient *rpcclient.WSClient

	// light client mode
	LightMode bool

	Index      FilterIndex
	TopicChans map[string]chan<- coretypes.ResultEvent
	IndexMux   *sync.RWMutex

	// Channels
	Install   chan *Subscription // install filter for event notification
	Uninstall chan *Subscription // remove filter for event notification
	EventBus  pubsub.EventBus
}

EventSubscriber creates subscriptions, processes events and broadcasts them to the subscription which match the subscription criteria using the Tendermint's RPC client.

func NewEventSubscriber

func NewEventSubscriber(
	logger log.Logger,
	tmWSClient *rpcclient.WSClient,
) *EventSubscriber

NewEventSubscriber creates a new manager that listens for event on the given mux, parses and filters them. It uses the all map to retrieve filter changes. The work loop holds its own index that is used to forward events to filters.

The returned manager has a loop that needs to be stopped with the Stop function or by stopping the given mux.

func (*EventSubscriber) EventLoop

func (es *EventSubscriber) EventLoop()

EventLoop (un)installs filters and processes mux events.

func (*EventSubscriber) SubscribeLogs

SubscribeLogs creates a subscription that will write all logs matching the given criteria to the given logs channel. Default value for the from and to block is "latest". If the fromBlock > toBlock an error is returned.

func (EventSubscriber) SubscribeNewHeads

func (es EventSubscriber) SubscribeNewHeads() (*Subscription, pubsub.UnsubscribeFunc, error)

SubscribeNewHeads subscribes to new block headers events.

func (EventSubscriber) SubscribePendingTxs

func (es EventSubscriber) SubscribePendingTxs() (*Subscription, pubsub.UnsubscribeFunc, error)

SubscribePendingTxs subscribes to new pending transactions events from the mempool.

func (*EventSubscriber) WithContext

func (es *EventSubscriber) WithContext(ctx context.Context)

WithContext sets a new context to the EventSystem. This is required to set a timeout context when a new filter is intantiated.

type Filter

type Filter struct {
	// contains filtered or unexported fields
}

Filter can be used to retrieve and filter logs.

func NewBlockFilter

func NewBlockFilter(logger log.Logger, backend rpcbackend.Backend, criteria filters.FilterCriteria) *Filter

NewBlockFilter creates a new filter which directly inspects the contents of a block to figure out whether it is interesting or not.

func NewRangeFilter

func NewRangeFilter(logger log.Logger, backend rpcbackend.Backend, begin, end int64, addresses []common.Address, topics [][]common.Hash) *Filter

NewRangeFilter creates a new filter which uses a bloom filter on blocks to figure out whether a particular block is interesting or not.

func (*Filter) Logs

func (f *Filter) Logs(_ context.Context, logLimit int, blockLimit int64) ([]*gethcore.Log, error)

Logs searches the blockchain for matching log entries, returning all from the first block that contains matches, updating the start of the filter accordingly.

type FilterIndex

type FilterIndex map[filters.Type]map[gethrpc.ID]*Subscription

type FiltersAPI

type FiltersAPI struct {
	// contains filtered or unexported fields
}

FiltersAPI offers support to create and manage filters. This will allow external clients to retrieve various information related to the Ethereum protocol such as blocks, transactions and logs.

func NewImplFiltersAPI

func NewImplFiltersAPI(
	logger log.Logger,
	clientCtx client.Context,
	tmWSClient *rpcclient.WSClient,
	backend *rpcbackend.Backend,
) *FiltersAPI

NewImplFiltersAPI returns a new FiltersAPI instance.

func (*FiltersAPI) GetFilterChanges

func (api *FiltersAPI) GetFilterChanges(id gethrpc.ID) (any, error)

GetFilterChanges returns the logs for the filter with the given id since last time it was called. This can be used for polling.

For pending transaction and block filters the result is []common.Hash. (pending)Log filters return []Log.

This function implements the "eth_getFilterChanges" JSON-RPC service method. https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getfilterchanges

func (*FiltersAPI) GetFilterLogs

func (api *FiltersAPI) GetFilterLogs(ctx context.Context, id gethrpc.ID) ([]*gethcore.Log, error)

GetFilterLogs returns the logs for the filter with the given id. If the filter could not be found an empty array of logs is returned.

This function implements the "eth_getFilterLogs" JSON-RPC service method. https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getfilterlogs

func (*FiltersAPI) GetLogs

func (api *FiltersAPI) GetLogs(
	ctx context.Context, crit filters.FilterCriteria,
) ([]*gethcore.Log, error)

GetLogs returns logs matching the given argument that are stored within the state. This function implements the "eth_getLogs" JSON-RPC service method. https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getlogs

func (*FiltersAPI) Logs

Logs creates a subscription that fires for all new log that match the given filter criteria. Implements "eth_logs".

func (*FiltersAPI) NewBlockFilter

func (api *FiltersAPI) NewBlockFilter() gethrpc.ID

NewBlockFilter creates a filter that fetches blocks that are imported into the chain. It is part of the filter package since polling goes with eth_getFilterChanges.

https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newblockfilter

func (*FiltersAPI) NewFilter

func (api *FiltersAPI) NewFilter(criteria filters.FilterCriteria) (gethrpc.ID, error)

NewFilter creates a new filter and returns the filter id. It can be used to retrieve logs when the state changes. This method cannot be used to fetch logs that are already stored in the state.

Default criteria for the from and to block are "latest". Using "latest" as block number will return logs for mined blocks. Using "pending" as block number returns logs for not yet mined (pending) blocks. In case logs are removed (chain reorg) previously returned logs are returned again but with the removed property set to true.

In case "fromBlock" > "toBlock" an error is returned.

https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newfilter

func (*FiltersAPI) NewHeads

func (api *FiltersAPI) NewHeads(ctx context.Context) (*gethrpc.Subscription, error)

NewHeads send a notification each time a new block (and thus, block header) is added to the chain.

func (*FiltersAPI) NewPendingTransactionFilter

func (api *FiltersAPI) NewPendingTransactionFilter() gethrpc.ID

NewPendingTransactionFilter creates a filter that fetches pending transaction hashes as transactions enter the pending state.

It is part of the filter package because this filter can be used through the `eth_getFilterChanges` polling method that is also used for log filters.

https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newPendingTransactionFilter

func (*FiltersAPI) NewPendingTransactions

func (api *FiltersAPI) NewPendingTransactions(ctx context.Context) (*gethrpc.Subscription, error)

NewPendingTransactions creates a subscription that is triggered each time a transaction enters the transaction pool and was signed from one of the transactions this nodes manages.

func (*FiltersAPI) UninstallFilter

func (api *FiltersAPI) UninstallFilter(id gethrpc.ID) bool

UninstallFilter removes the filter with the given filter id.

https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_uninstallfilter

type IEthAPI

type IEthAPI interface {
	// Getting Blocks
	//
	// Retrieves information from a particular block in the blockchain.
	BlockNumber() (hexutil.Uint64, error)
	GetBlockByNumber(ethBlockNum rpc.BlockNumber, fullTx bool) (map[string]any, error)
	GetBlockByHash(hash common.Hash, fullTx bool) (map[string]any, error)
	GetBlockTransactionCountByHash(hash common.Hash) *hexutil.Uint
	GetBlockTransactionCountByNumber(blockNum rpc.BlockNumber) *hexutil.Uint

	// Reading Transactions
	//
	// Retrieves information on the state data for addresses regardless of whether
	// it is a user or a smart contract.
	GetTransactionByHash(hash common.Hash) (*rpc.EthTxJsonRPC, error)
	GetTransactionCount(address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Uint64, error)
	GetTransactionReceipt(hash common.Hash) (*backend.TransactionReceipt, error)
	GetTransactionByBlockHashAndIndex(hash common.Hash, idx hexutil.Uint) (*rpc.EthTxJsonRPC, error)
	GetTransactionByBlockNumberAndIndex(blockNum rpc.BlockNumber, idx hexutil.Uint) (*rpc.EthTxJsonRPC, error)

	// Writing Transactions
	//
	// Allows developers to both send ETH from one address to another, write data
	// on-chain, and interact with smart contracts.
	SendRawTransaction(data hexutil.Bytes) (common.Hash, error)

	// Account Information
	//
	// Returns information regarding an address's stored on-chain data.
	Accounts() ([]common.Address, error)
	GetBalance(
		address common.Address, blockNrOrHash rpc.BlockNumberOrHash,
	) (*hexutil.Big, error)
	GetStorageAt(
		address common.Address, key string, blockNrOrHash rpc.BlockNumberOrHash,
	) (hexutil.Bytes, error)
	GetCode(
		address common.Address, blockNrOrHash rpc.BlockNumberOrHash,
	) (hexutil.Bytes, error)
	GetProof(
		address common.Address, storageKeys []string, blockNrOrHash rpc.BlockNumberOrHash,
	) (*rpc.AccountResult, error)

	// EVM/Smart Contract Execution
	//
	// Allows developers to read data from the blockchain which includes executing
	// smart contracts. However, no data is published to the Ethereum network.
	Call(
		args evm.JsonTxArgs, blockNrOrHash rpc.BlockNumberOrHash, _ *rpc.StateOverride,
	) (hexutil.Bytes, error)

	// Chain Information
	//
	// Returns information on the Ethereum network and internal settings.
	ProtocolVersion() hexutil.Uint
	GasPrice() (*hexutil.Big, error)
	EstimateGas(
		args evm.JsonTxArgs, blockNrOptional *rpc.BlockNumber,
	) (hexutil.Uint64, error)
	FeeHistory(
		blockCount gethrpc.DecimalOrHex, lastBlock gethrpc.BlockNumber, rewardPercentiles []float64,
	) (*rpc.FeeHistoryResult, error)
	MaxPriorityFeePerGas() (*hexutil.Big, error)
	ChainId() (*hexutil.Big, error)

	// Getting Uncles
	//
	// Returns information on uncle blocks are which are network rejected blocks
	// and replaced by a canonical block instead.
	GetUncleByBlockHashAndIndex(
		hash common.Hash, idx hexutil.Uint,
	) map[string]any
	GetUncleByBlockNumberAndIndex(
		number, idx hexutil.Uint,
	) map[string]any
	GetUncleCountByBlockHash(hash common.Hash) hexutil.Uint
	GetUncleCountByBlockNumber(blockNum rpc.BlockNumber) hexutil.Uint

	// Other
	Syncing() (any, error)
	GetTransactionLogs(txHash common.Hash) ([]*gethcore.Log, error)
	FillTransaction(
		args evm.JsonTxArgs,
	) (*rpc.SignTransactionResult, error)
	GetPendingTransactions() ([]*rpc.EthTxJsonRPC, error)
}

Ethereum API: Allows connection to a full node of the Nibiru blockchain network via Nibiru EVM. Developers can interact with on-chain EVM data and send different types of transactions to the network by utilizing the endpoints provided by the API. The API follows a JSON-RPC standard. If not otherwise specified, the interface is derived from the Alchemy Ethereum API: https://docs.alchemy.com/alchemy/apis/ethereum

type NetAPI

type NetAPI struct {
	// contains filtered or unexported fields
}

NetAPI is the eth_ prefixed set of APIs in the Web3 JSON-RPC spec.

func NewImplNetAPI

func NewImplNetAPI(clientCtx client.Context) *NetAPI

NewImplNetAPI creates an instance of the public Net Web3 API.

func (*NetAPI) Listening

func (s *NetAPI) Listening() bool

Listening returns if client is actively listening for network connections.

func (*NetAPI) PeerCount

func (s *NetAPI) PeerCount() int

PeerCount returns the number of peers currently connected to the client.

func (*NetAPI) Version

func (s *NetAPI) Version() string

Version returns the current ethereum protocol version.

type Subscription

type Subscription struct {
	Id      rpc.ID
	Typ     filters.Type
	Event   string
	Created time.Time

	Logs      chan []*gethcore.Log
	Hashes    chan []common.Hash
	Headers   chan *gethcore.Header
	Installed chan struct{} // closed when the filter is installed
	// Consensus result event channel
	EventCh <-chan coretypes.ResultEvent
	ErrCh   chan error
	// contains filtered or unexported fields
}

Subscription defines a wrapper for the private subscription

func MakeSubscription

func MakeSubscription(id, event string) *Subscription

func (*Subscription) Error

func (s *Subscription) Error() <-chan error

Error returns the error channel

func (Subscription) ID

func (s Subscription) ID() rpc.ID

ID returns the underlying subscription RPC identifier.

func (*Subscription) Unsubscribe

func (s *Subscription) Unsubscribe(es *EventSubscriber)

Unsubscribe from the current subscription to Tendermint Websocket. It sends an error to the subscription error channel if unsubscribe fails.

type SubscriptionNotification

type SubscriptionNotification struct {
	Jsonrpc string              `json:"jsonrpc"`
	Method  string              `json:"method"`
	Params  *SubscriptionResult `json:"params"`
}

type SubscriptionResponseJSON

type SubscriptionResponseJSON struct {
	Jsonrpc string  `json:"jsonrpc"`
	Result  any     `json:"result"`
	ID      float64 `json:"id"`
}

type SubscriptionResult

type SubscriptionResult struct {
	Subscription gethrpc.ID `json:"subscription"`
	Result       any        `json:"result"`
}

type TxPoolAPI

type TxPoolAPI struct {
	// contains filtered or unexported fields
}

TxPoolAPI offers and API for the transaction pool. It only operates on data that is non-confidential.

func NewImplTxPoolAPI

func NewImplTxPoolAPI(logger log.Logger) *TxPoolAPI

NewImplTxPoolAPI creates a new tx pool service that gives information about the transaction pool.

func (*TxPoolAPI) Content

func (api *TxPoolAPI) Content() (
	map[string]map[string]map[string]*rpc.EthTxJsonRPC, error,
)

Content returns the transactions contained within the transaction pool

func (*TxPoolAPI) Inspect

func (api *TxPoolAPI) Inspect() (map[string]map[string]map[string]string, error)

Inspect returns the content of the transaction pool and flattens it into an

func (*TxPoolAPI) Status

func (api *TxPoolAPI) Status() map[string]hexutil.Uint

Status returns the number of pending and queued transaction in the pool.

type WebsocketsServer

type WebsocketsServer interface {
	Start()
}

func NewWebsocketsServer

func NewWebsocketsServer(
	clientCtx client.Context,
	logger log.Logger,
	tmWSClient *rpcclient.WSClient,
	cfg *config.Config,
) WebsocketsServer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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