evmrpc

package
v0.0.38 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: Apache-2.0 Imports: 71 Imported by: 0

Documentation

Index

Constants

View Source
const GasUsedRatio float64 = 0.5

Since we use a static base fee, we want GasUsedRatio returned in RPC queries to reflect the fact that base fee would never change, which is only true if the block is exactly half-utilized.

View Source
const JwtExpiryTimeout = 60 * time.Second
View Source
const LatestCtxHeight int64 = -1
View Source
const LocalAddress = "0.0.0.0"
View Source
const NewHeadsListenerBuffer = 10
View Source
const SleepInterval = 5 * time.Second
View Source
const SubscriberPrefix = "evm.rpc."
View Source
const TxSearchPerPage = 10
View Source
const UnconfirmedTxQueryMaxPage = 20
View Source
const UnconfirmedTxQueryPerPage = 30

Variables

View Source
var BitMasks = [8]uint8{1, 2, 4, 8, 16, 32, 64, 128}
View Source
var DefaultConfig = Config{
	HTTPEnabled:             true,
	HTTPPort:                8545,
	WSEnabled:               true,
	WSPort:                  8546,
	ReadTimeout:             rpc.DefaultHTTPTimeouts.ReadTimeout,
	ReadHeaderTimeout:       rpc.DefaultHTTPTimeouts.ReadHeaderTimeout,
	WriteTimeout:            rpc.DefaultHTTPTimeouts.WriteTimeout,
	IdleTimeout:             rpc.DefaultHTTPTimeouts.IdleTimeout,
	SimulationGasLimit:      10_000_000,
	SimulationEVMTimeout:    60 * time.Second,
	CORSOrigins:             "*",
	WSOrigins:               "*",
	FilterTimeout:           120 * time.Second,
	CheckTxTimeout:          5 * time.Second,
	MaxTxPoolTxs:            1000,
	Slow:                    false,
	DenyList:                make([]string, 0),
	MaxLogNoBlock:           10000,
	MaxBlocksForLog:         2000,
	MaxSubscriptionsNewHead: 10000,
	EnableTestAPI:           false,
}

Functions

func CalculatePercentiles

func CalculatePercentiles(rewardPercentiles []float64, GasAndRewards []GasAndReward, totalEVMGasUsed uint64) []*hexutil.Big

Following go-ethereum implementation Specifically, the reward value at a percentile of p% will be the reward value of the lowest-rewarded transaction such that the sum of its gasUsed value and gasUsed values of all lower-rewarded transactions is no less than (total gasUsed * p%).

func CheckPath

func CheckPath(r *http.Request, path string) bool

CheckPath checks whether a given request URL matches a given path prefix.

func CheckTimeouts

func CheckTimeouts(timeouts *rpc.HTTPTimeouts)

CheckTimeouts ensures that timeout values are meaningful

func CheckVersion

func CheckVersion(ctx sdk.Context, k *keeper.Keeper) error

func EncodeFilters

func EncodeFilters(addresses []common.Address, topics [][]common.Hash) (res [][]bloomIndexes)

res: AND on outer level, OR on mid level, AND on inner level (i.e. all 3 bits)

func EncodeTmBlock

func EncodeTmBlock(
	ctx sdk.Context,
	block *coretypes.ResultBlock,
	blockRes *coretypes.ResultBlockResults,
	k *keeper.Keeper,
	txDecoder sdk.TxDecoder,
	fullTx bool,
) (map[string]interface{}, error)

func FullBloom

func FullBloom() ethtypes.Bloom

func GetBlockNumberByNrOrHash

func GetBlockNumberByNrOrHash(ctx context.Context, tmClient rpcclient.Client, blockNrOrHash rpc.BlockNumberOrHash) (*int64, error)

func GetEvmTxIndex

func GetEvmTxIndex(txs tmtypes.Txs, txIndex uint32, decoder sdk.TxDecoder) (index int, found bool)

Gets the EVM tx index based on the tx index (typically from receipt.TransactionIndex Essentially loops through and calculates the index if we ignore cosmos txs

func MatchFilters

func MatchFilters(bloom ethtypes.Bloom, filters [][]bloomIndexes) bool

TODO: parallelize if filters too large

func NewGzipHandler

func NewGzipHandler(next http.Handler) http.Handler

func NewHTTPHandlerStack

func NewHTTPHandlerStack(srv http.Handler, cors []string, vhosts []string, JwtSecret []byte) http.Handler

NewHTTPHandlerStack returns wrapped http-related handlers

func NewWSConnectionHandler

func NewWSConnectionHandler(handler http.Handler) http.Handler

func NewWSHandlerStack

func NewWSHandlerStack(srv http.Handler, JwtSecret []byte) http.Handler

NewWSHandlerStack returns a wrapped ws-related handler.

func RegisterApis

func RegisterApis(logger log.Logger, apis []rpc.API, modules []string, srv *rpc.Server) error

RegisterApis checks the given modules' availability, generates an allowlist based on the allowed modules, and then registers all of the APIs exposed by the services.

func StartHTTPEndpoint

func StartHTTPEndpoint(endpoint string, timeouts rpc.HTTPTimeouts, handler http.Handler) (*http.Server, net.Addr, error)

StartHTTPEndpoint starts the HTTP RPC endpoint.

Types

type AccessListResult

type AccessListResult struct {
	Accesslist *ethtypes.AccessList `json:"accessList"`
	Error      string               `json:"error,omitempty"`
	GasUsed    hexutil.Uint64       `json:"gasUsed"`
}

type AssociateRequest

type AssociateRequest struct {
	R             string `json:"r"`
	S             string `json:"s"`
	V             string `json:"v"`
	CustomMessage string `json:"custom_message"`
}

type AssociationAPI

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

func NewAssociationAPI

func NewAssociationAPI(tmClient rpcclient.Client, k *keeper.Keeper, ctxProvider func(int64) sdk.Context, txDecoder sdk.TxDecoder, sendAPI *SendAPI, connectionType ConnectionType) *AssociationAPI

func (*AssociationAPI) Associate

func (t *AssociationAPI) Associate(ctx context.Context, req *AssociateRequest) (returnErr error)

func (*AssociationAPI) GetEVMAddress

func (t *AssociationAPI) GetEVMAddress(_ context.Context, seiAddress string) (result string, returnErr error)

func (*AssociationAPI) GetSeiAddress

func (t *AssociationAPI) GetSeiAddress(_ context.Context, ethAddress common.Address) (result string, returnErr error)

type Backend

type Backend struct {
	*eth.EthAPIBackend
	// contains filtered or unexported fields
}

func NewBackend

func NewBackend(ctxProvider func(int64) sdk.Context, keeper *keeper.Keeper, txDecoder sdk.TxDecoder, tmClient rpcclient.Client, config *SimulateConfig) *Backend

func (Backend) BlockByHash

func (b Backend) BlockByHash(ctx context.Context, hash common.Hash) (*ethtypes.Block, error)

func (Backend) BlockByNumber

func (b Backend) BlockByNumber(ctx context.Context, bn rpc.BlockNumber) (*ethtypes.Block, error)

func (*Backend) ChainConfig

func (b *Backend) ChainConfig() *params.ChainConfig

func (*Backend) ChainDb

func (b *Backend) ChainDb() ethdb.Database

func (*Backend) CurrentHeader

func (b *Backend) CurrentHeader() *ethtypes.Header

func (*Backend) Engine

func (b *Backend) Engine() consensus.Engine

func (*Backend) GetEVM

func (b *Backend) GetEVM(_ context.Context, msg *core.Message, stateDB vm.StateDB, _ *ethtypes.Header, vmConfig *vm.Config, blockCtx *vm.BlockContext) *vm.EVM

func (*Backend) GetPoolNonce

func (b *Backend) GetPoolNonce(_ context.Context, addr common.Address) (uint64, error)

func (*Backend) GetTransaction

func (b *Backend) GetTransaction(ctx context.Context, txHash common.Hash) (tx *ethtypes.Transaction, blockHash common.Hash, blockNumber uint64, index uint64, err error)

func (*Backend) HeaderByNumber

func (b *Backend) HeaderByNumber(ctx context.Context, bn rpc.BlockNumber) (*ethtypes.Header, error)

func (*Backend) RPCEVMTimeout

func (b *Backend) RPCEVMTimeout() time.Duration

func (*Backend) RPCGasCap

func (b *Backend) RPCGasCap() uint64

func (*Backend) StateAndHeaderByNumberOrHash

func (b *Backend) StateAndHeaderByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (vm.StateDB, *ethtypes.Header, error)

func (*Backend) StateAtBlock

func (b *Backend) StateAtBlock(ctx context.Context, block *ethtypes.Block, reexec uint64, base vm.StateDB, readOnly bool, preferDisk bool) (vm.StateDB, tracers.StateReleaseFunc, error)

func (*Backend) StateAtTransaction

func (b *Backend) StateAtTransaction(ctx context.Context, block *ethtypes.Block, txIndex int, reexec uint64) (*ethtypes.Transaction, vm.BlockContext, vm.StateDB, tracers.StateReleaseFunc, error)

func (*Backend) SuggestGasTipCap

func (b *Backend) SuggestGasTipCap(context.Context) (*big.Int, error)

type BlockAPI

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

func NewBlockAPI

func NewBlockAPI(tmClient rpcclient.Client, k *keeper.Keeper, ctxProvider func(int64) sdk.Context, txConfig client.TxConfig, connectionType ConnectionType) *BlockAPI

func (*BlockAPI) GetBlockByHash

func (a *BlockAPI) GetBlockByHash(ctx context.Context, blockHash common.Hash, fullTx bool) (result map[string]interface{}, returnErr error)

func (*BlockAPI) GetBlockByNumber

func (a *BlockAPI) GetBlockByNumber(ctx context.Context, number rpc.BlockNumber, fullTx bool) (result map[string]interface{}, returnErr error)

func (*BlockAPI) GetBlockReceipts

func (a *BlockAPI) GetBlockReceipts(ctx context.Context, number rpc.BlockNumber) (result []map[string]interface{}, returnErr error)

func (*BlockAPI) GetBlockTransactionCountByHash

func (a *BlockAPI) GetBlockTransactionCountByHash(ctx context.Context, blockHash common.Hash) (result *hexutil.Uint, returnErr error)

func (*BlockAPI) GetBlockTransactionCountByNumber

func (a *BlockAPI) GetBlockTransactionCountByNumber(ctx context.Context, number rpc.BlockNumber) (result *hexutil.Uint, returnErr error)

type Config

type Config struct {
	// controls whether an HTTP EVM server is enabled
	HTTPEnabled bool `mapstructure:"http_enabled"`
	HTTPPort    int  `mapstructure:"http_port"`

	// controls whether a websocket server is enabled
	WSEnabled bool `mapstructure:"ws_enabled"`
	WSPort    int  `mapstructure:"ws_port"`

	// ReadTimeout is the maximum duration for reading the entire
	// request, including the body.
	//
	// Because ReadTimeout does not let Handlers make per-request
	// decisions on each request body's acceptable deadline or
	// upload rate, most users will prefer to use
	// ReadHeaderTimeout. It is valid to use them both.
	ReadTimeout time.Duration `mapstructure:"read_timeout"`

	// ReadHeaderTimeout is the amount of time allowed to read
	// request headers. The connection's read deadline is reset
	// after reading the headers and the Handler can decide what
	// is considered too slow for the body. If ReadHeaderTimeout
	// is zero, the value of ReadTimeout is used. If both are
	// zero, there is no timeout.
	ReadHeaderTimeout time.Duration `mapstructure:"read_header_timeout"`

	// WriteTimeout is the maximum duration before timing out
	// writes of the response. It is reset whenever a new
	// request's header is read. Like ReadTimeout, it does not
	// let Handlers make decisions on a per-request basis.
	WriteTimeout time.Duration `mapstructure:"write_timeout"`

	// IdleTimeout is the maximum amount of time to wait for the
	// next request when keep-alives are enabled. If IdleTimeout
	// is zero, the value of ReadTimeout is used. If both are
	// zero, ReadHeaderTimeout is used.
	IdleTimeout time.Duration `mapstructure:"idle_timeout"`

	// Maximum gas limit for simulation
	SimulationGasLimit uint64 `mapstructure:"simulation_gas_limit"`

	// Timeout for EVM call in simulation
	SimulationEVMTimeout time.Duration `mapstructure:"simulation_evm_timeout"`

	// list of CORS allowed origins, separated by comma
	CORSOrigins string `mapstructure:"cors_origins"`

	// list of WS origins, separated by comma
	WSOrigins string `mapstructure:"ws_origins"`

	// timeout for filters
	FilterTimeout time.Duration `mapstructure:"filter_timeout"`

	// checkTx timeout for sig verify
	CheckTxTimeout time.Duration `mapstructure:"checktx_timeout"`

	// max number of txs to pull from mempool
	MaxTxPoolTxs uint64 `mapstructure:"max_tx_pool_txs"`

	// controls whether to have txns go through one by one
	Slow bool `mapstructure:"slow"`

	// Deny list defines list of methods that EVM RPC should fail fast
	DenyList []string `mapstructure:"deny_list"`

	// max number of logs returned if block range is open-ended
	MaxLogNoBlock int64 `mapstructure:"max_log_no_block"`

	// max number of blocks to query logs for
	MaxBlocksForLog int64 `mapstructure:"max_blocks_for_log"`

	// max number of concurrent NewHead subscriptions
	MaxSubscriptionsNewHead uint64 `mapstructure:"max_subscriptions_new_head"`

	// test api enables certain override apis for integration test situations
	EnableTestAPI bool `mapstructure:"enable_test_api"`
}

EVMRPC Config defines configurations for EVM RPC server on this node

func ReadConfig

func ReadConfig(opts servertypes.AppOptions) (Config, error)

type ConnectionType

type ConnectionType string
var ConnectionTypeHTTP ConnectionType = "http"
var ConnectionTypeWS ConnectionType = "websocket"

type DebugAPI

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

func NewDebugAPI

func NewDebugAPI(tmClient rpcclient.Client, k *keeper.Keeper, ctxProvider func(int64) sdk.Context, txDecoder sdk.TxDecoder, config *SimulateConfig, connectionType ConnectionType) *DebugAPI

func (*DebugAPI) TraceBlockByHash

func (api *DebugAPI) TraceBlockByHash(ctx context.Context, hash common.Hash, config *tracers.TraceConfig) (interface{}, error)

func (*DebugAPI) TraceBlockByNumber

func (api *DebugAPI) TraceBlockByNumber(ctx context.Context, number rpc.BlockNumber, config *tracers.TraceConfig) (interface{}, error)

func (*DebugAPI) TraceTransaction

func (api *DebugAPI) TraceTransaction(ctx context.Context, hash common.Hash, config *tracers.TraceConfig) (interface{}, error)

type EVMServer

type EVMServer interface {
	Start() error
}

func NewEVMHTTPServer

func NewEVMHTTPServer(
	logger log.Logger,
	config Config,
	tmClient rpcclient.Client,
	k *keeper.Keeper,
	ctxProvider func(int64) sdk.Context,
	txConfig client.TxConfig,
	homeDir string,
) (EVMServer, error)

func NewEVMWebSocketServer

func NewEVMWebSocketServer(
	logger log.Logger,
	config Config,
	tmClient rpcclient.Client,
	k *keeper.Keeper,
	ctxProvider func(int64) sdk.Context,
	txConfig client.TxConfig,
	homeDir string,
) (EVMServer, error)

type EchoAPI

type EchoAPI struct{}

func NewEchoAPI

func NewEchoAPI() *EchoAPI

func (*EchoAPI) Echo

func (a *EchoAPI) Echo(data string) string

type Engine

type Engine struct {
	*ethash.Ethash
	// contains filtered or unexported fields
}

func (*Engine) Author

func (e *Engine) Author(*ethtypes.Header) (common.Address, error)

type EventItemDataWrapper

type EventItemDataWrapper struct {
	Type  string          `json:"type"`
	Value json.RawMessage `json:"value"`
}

type FeeHistoryResult

type FeeHistoryResult struct {
	OldestBlock  *hexutil.Big     `json:"oldestBlock"`
	Reward       [][]*hexutil.Big `json:"reward,omitempty"`
	BaseFee      []*hexutil.Big   `json:"baseFeePerGas,omitempty"`
	GasUsedRatio []float64        `json:"gasUsedRatio"`
}

type FilterAPI

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

func NewFilterAPI

func NewFilterAPI(tmClient rpcclient.Client, logFetcher *LogFetcher, filterConfig *FilterConfig, connectionType ConnectionType) *FilterAPI

func (*FilterAPI) GetFilterChanges

func (a *FilterAPI) GetFilterChanges(
	ctx context.Context,
	filterID ethrpc.ID,
) (res interface{}, err error)

func (*FilterAPI) GetFilterLogs

func (a *FilterAPI) GetFilterLogs(
	ctx context.Context,
	filterID ethrpc.ID,
) (res []*ethtypes.Log, err error)

func (*FilterAPI) GetLogs

func (a *FilterAPI) GetLogs(
	ctx context.Context,
	crit filters.FilterCriteria,
) (res []*ethtypes.Log, err error)

func (*FilterAPI) NewBlockFilter

func (a *FilterAPI) NewBlockFilter(
	_ context.Context,
) (id ethrpc.ID, err error)

func (*FilterAPI) NewFilter

func (a *FilterAPI) NewFilter(
	_ context.Context,
	crit filters.FilterCriteria,
) (id ethrpc.ID, err error)

func (*FilterAPI) UninstallFilter

func (a *FilterAPI) UninstallFilter(
	_ context.Context,
	filterID ethrpc.ID,
) (res bool)

type FilterConfig

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

type FilterType

type FilterType byte
const (
	UnknownSubscription FilterType = iota
	LogsSubscription
	BlocksSubscription
)

type GasAndReward

type GasAndReward struct {
	GasUsed uint64
	Reward  *big.Int
}

type HTTPConfig

type HTTPConfig struct {
	Modules            []string
	CorsAllowedOrigins []string
	Vhosts             []string
	DenyList           []string

	RPCEndpointConfig
	// contains filtered or unexported fields
}

HTTPConfig is the JSON-RPC/HTTP configuration.

type HTTPServer

type HTTPServer struct {
	HTTPConfig HTTPConfig

	// WebSocket handler things.
	WsConfig WsConfig
	// contains filtered or unexported fields
}

func NewHTTPServer

func NewHTTPServer(log log.Logger, timeouts rpc.HTTPTimeouts) *HTTPServer

func (*HTTPServer) EnableRPC

func (h *HTTPServer) EnableRPC(apis []rpc.API, config HTTPConfig) error

EnableRPC turns on JSON-RPC over HTTP on the server.

func (*HTTPServer) EnableWS

func (h *HTTPServer) EnableWS(apis []rpc.API, config WsConfig) error

EnableWS turns on JSON-RPC over WebSocket on the server.

func (*HTTPServer) ListenAddr

func (h *HTTPServer) ListenAddr() string

listenAddr returns the listening address of the server.

func (*HTTPServer) ServeHTTP

func (h *HTTPServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*HTTPServer) SetListenAddr

func (h *HTTPServer) SetListenAddr(host string, port int) error

SetListenAddr configures the listening address of the server. The address can only be set while the server isn't running.

func (*HTTPServer) Start

func (h *HTTPServer) Start() error

start starts the HTTP server if it is enabled and not already running.

func (*HTTPServer) Stop

func (h *HTTPServer) Stop()

stop shuts down the HTTP server.

type InfoAPI

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

func NewInfoAPI

func NewInfoAPI(tmClient rpcclient.Client, k *keeper.Keeper, ctxProvider func(int64) sdk.Context, txDecoder sdk.TxDecoder, homeDir string, maxBlocks int64, connectionType ConnectionType) *InfoAPI

func (*InfoAPI) Accounts

func (i *InfoAPI) Accounts() (result []common.Address, returnErr error)

func (*InfoAPI) BlockNumber

func (i *InfoAPI) BlockNumber() hexutil.Uint64

func (*InfoAPI) ChainId

func (i *InfoAPI) ChainId() *hexutil.Big

func (*InfoAPI) Coinbase

func (i *InfoAPI) Coinbase() (common.Address, error)

func (*InfoAPI) FeeHistory

func (i *InfoAPI) FeeHistory(ctx context.Context, blockCount math.HexOrDecimal64, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (result *FeeHistoryResult, returnErr error)

lastBlock is inclusive

func (*InfoAPI) GasPrice

func (i *InfoAPI) GasPrice(ctx context.Context) (result *hexutil.Big, returnErr error)

type LogFetcher

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

func (*LogFetcher) FindBlockesByBloom

func (f *LogFetcher) FindBlockesByBloom(begin, end int64, filters [][]bloomIndexes) (res []int64)

func (*LogFetcher) FindLogsByBloom

func (f *LogFetcher) FindLogsByBloom(height int64, filters [][]bloomIndexes) (res []*ethtypes.Log)

func (*LogFetcher) GetLogsByFilters

func (f *LogFetcher) GetLogsByFilters(ctx context.Context, crit filters.FilterCriteria, lastToHeight int64) ([]*ethtypes.Log, int64, error)

func (*LogFetcher) GetLogsForBlock

func (f *LogFetcher) GetLogsForBlock(ctx context.Context, block *coretypes.ResultBlock, crit filters.FilterCriteria, filters [][]bloomIndexes) []*ethtypes.Log

func (*LogFetcher) IsLogExactMatch

func (f *LogFetcher) IsLogExactMatch(log *ethtypes.Log, crit filters.FilterCriteria) bool

type NetAPI

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

func NewNetAPI

func NewNetAPI(tmClient rpcclient.Client, k *keeper.Keeper, ctxProvider func(int64) sdk.Context, txDecoder sdk.TxDecoder, connectionType ConnectionType) *NetAPI

func (*NetAPI) Version

func (i *NetAPI) Version() string

type ProofResult

type ProofResult struct {
	Address      common.Address     `json:"address"`
	HexValues    []string           `json:"hexValues"`
	StorageProof []*crypto.ProofOps `json:"storageProof"`
}

Result structs for GetProof This differs from go-ethereum AccountResult in two ways: 1. Proof object is an iavl proof, not a trie proof 2. Per-account fields are excluded because there is no per-account root

type QueryBuilder

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

func NewBlockQueryBuilder

func NewBlockQueryBuilder() *QueryBuilder

func NewHeadQueryBuilder

func NewHeadQueryBuilder() *QueryBuilder

func (*QueryBuilder) Build

func (q *QueryBuilder) Build() string

type RPCEndpointConfig

type RPCEndpointConfig struct {
	JwtSecret []byte // optional JWT secret
	// contains filtered or unexported fields
}

type RevertError

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

RevertError is an API error that encompasses an EVM revertal with JSON error code and a binary data blob.

func NewRevertError

func NewRevertError(result *core.ExecutionResult) *RevertError

func (*RevertError) ErrorCode

func (e *RevertError) ErrorCode() int

ErrorCode returns the JSON error code for a revertal. See: https://github.com/ethereum/wiki/wiki/JSON-RPC-Error-Codes-Improvement-Proposal

func (*RevertError) ErrorData

func (e *RevertError) ErrorData() interface{}

ErrorData returns the hex encoded revert reason.

type SendAPI

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

func NewSendAPI

func NewSendAPI(tmClient rpcclient.Client, txConfig client.TxConfig, sendConfig *SendConfig, k *keeper.Keeper, ctxProvider func(int64) sdk.Context, homeDir string, simulateConfig *SimulateConfig, connectionType ConnectionType) *SendAPI

func (*SendAPI) SendRawTransaction

func (s *SendAPI) SendRawTransaction(ctx context.Context, input hexutil.Bytes) (hash common.Hash, err error)

func (*SendAPI) SendTransaction

func (s *SendAPI) SendTransaction(ctx context.Context, args ethapi.TransactionArgs) (result common.Hash, returnErr error)

func (*SendAPI) SignTransaction

func (s *SendAPI) SignTransaction(_ context.Context, args apitypes.SendTxArgs, _ *string) (result *ethapi.SignTransactionResult, returnErr error)

type SendConfig

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

type SimulateConfig

type SimulateConfig struct {
	GasCap     uint64
	EVMTimeout time.Duration
}

type SimulationAPI

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

func NewSimulationAPI

func NewSimulationAPI(
	ctxProvider func(int64) sdk.Context,
	keeper *keeper.Keeper,
	txDecoder sdk.TxDecoder,
	tmClient rpcclient.Client,
	config *SimulateConfig,
	connectionType ConnectionType,
) *SimulationAPI

func (*SimulationAPI) Call

func (s *SimulationAPI) Call(ctx context.Context, args ethapi.TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash, overrides *ethapi.StateOverride, blockOverrides *ethapi.BlockOverrides) (result hexutil.Bytes, returnErr error)

func (*SimulationAPI) CreateAccessList

func (s *SimulationAPI) CreateAccessList(ctx context.Context, args ethapi.TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash) (result *AccessListResult, returnErr error)

func (*SimulationAPI) EstimateGas

func (s *SimulationAPI) EstimateGas(ctx context.Context, args ethapi.TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash, overrides *ethapi.StateOverride) (result hexutil.Uint64, returnErr error)

type StateAPI

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

func NewStateAPI

func NewStateAPI(tmClient rpcclient.Client, k *keeper.Keeper, ctxProvider func(int64) sdk.Context, connectionType ConnectionType) *StateAPI

func (*StateAPI) GetBalance

func (a *StateAPI) GetBalance(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (result *hexutil.Big, returnErr error)

func (*StateAPI) GetCode

func (a *StateAPI) GetCode(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (result hexutil.Bytes, returnErr error)

func (*StateAPI) GetNonce

func (a *StateAPI) GetNonce(_ context.Context, address common.Address) uint64

func (*StateAPI) GetProof

func (a *StateAPI) GetProof(ctx context.Context, address common.Address, storageKeys []string, blockNrOrHash rpc.BlockNumberOrHash) (result *ProofResult, returnErr error)

func (*StateAPI) GetStorageAt

func (a *StateAPI) GetStorageAt(ctx context.Context, address common.Address, hexKey string, blockNrOrHash rpc.BlockNumberOrHash) (result hexutil.Bytes, returnErr error)

type SubInfo

type SubInfo struct {
	Query          string
	SubscriptionCh <-chan coretypes.ResultEvent
}

type SubscriberID

type SubscriberID uint64

type SubscriptionAPI

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

func NewSubscriptionAPI

func NewSubscriptionAPI(tmClient rpcclient.Client, logFetcher *LogFetcher, subscriptionConfig *SubscriptionConfig, filterConfig *FilterConfig, connectionType ConnectionType) *SubscriptionAPI

func (*SubscriptionAPI) Logs

func (a *SubscriptionAPI) Logs(ctx context.Context, filter *filters.FilterCriteria) (s *rpc.Subscription, err error)

func (*SubscriptionAPI) NewHeads

func (a *SubscriptionAPI) NewHeads(ctx context.Context) (s *rpc.Subscription, err error)

type SubscriptionConfig

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

type SubscriptionManager

type SubscriptionManager struct {
	NextID           SubscriberID
	SubscriptionInfo map[SubscriberID]SubInfo
	// contains filtered or unexported fields
}

func NewSubscriptionManager

func NewSubscriptionManager(tmClient rpcclient.Client) *SubscriptionManager

func (*SubscriptionManager) Subscribe

func (s *SubscriptionManager) Subscribe(ctx context.Context, q *QueryBuilder, limit int) (SubscriberID, <-chan coretypes.ResultEvent, error)

func (*SubscriptionManager) Unsubscribe

func (s *SubscriptionManager) Unsubscribe(ctx context.Context, id SubscriberID) error

type TestAPI

type TestAPI struct{}

func NewTestAPI

func NewTestAPI() *TestAPI

func (*TestAPI) IncrementPointerVersion

func (a *TestAPI) IncrementPointerVersion(pointerType string, offset int16) error

type TransactionAPI

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

func NewTransactionAPI

func NewTransactionAPI(tmClient rpcclient.Client, k *keeper.Keeper, ctxProvider func(int64) sdk.Context, txConfig client.TxConfig, homeDir string, connectionType ConnectionType) *TransactionAPI

func (*TransactionAPI) GetTransactionByBlockHashAndIndex

func (t *TransactionAPI) GetTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) (result *ethapi.RPCTransaction, returnErr error)

func (*TransactionAPI) GetTransactionByBlockNumberAndIndex

func (t *TransactionAPI) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) (result *ethapi.RPCTransaction, returnErr error)

func (*TransactionAPI) GetTransactionByHash

func (t *TransactionAPI) GetTransactionByHash(ctx context.Context, hash common.Hash) (result *ethapi.RPCTransaction, returnErr error)

func (*TransactionAPI) GetTransactionCount

func (t *TransactionAPI) GetTransactionCount(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (result *hexutil.Uint64, returnErr error)

func (*TransactionAPI) GetTransactionErrorByHash

func (t *TransactionAPI) GetTransactionErrorByHash(_ context.Context, hash common.Hash) (result string, returnErr error)

func (*TransactionAPI) GetTransactionReceipt

func (t *TransactionAPI) GetTransactionReceipt(ctx context.Context, hash common.Hash) (result map[string]interface{}, returnErr error)

func (*TransactionAPI) GetVMError

func (t *TransactionAPI) GetVMError(hash common.Hash) (result string, returnErr error)

func (*TransactionAPI) Sign

func (t *TransactionAPI) Sign(addr common.Address, data hexutil.Bytes) (result hexutil.Bytes, returnErr error)

type TxPoolAPI

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

func NewTxPoolAPI

func NewTxPoolAPI(tmClient rpcclient.Client, k *keeper.Keeper, ctxProvider func(int64) sdk.Context, txDecoder sdk.TxDecoder, txPoolConfig *TxPoolConfig, connectionType ConnectionType) *TxPoolAPI

func (*TxPoolAPI) Content

func (t *TxPoolAPI) Content(ctx context.Context) (result map[string]map[string]map[string]*ethapi.RPCTransaction, returnErr error)

For now, we put all unconfirmed txs in pending and none in queued

type TxPoolConfig

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

type Web3API

type Web3API struct{}

func (*Web3API) ClientVersion

func (w *Web3API) ClientVersion() string

type WsConfig

type WsConfig struct {
	Origins []string
	Modules []string

	RPCEndpointConfig
	// contains filtered or unexported fields
}

WsConfig is the JSON-RPC/Websocket configuration

Jump to

Keyboard shortcuts

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