rpc

package
v0.4.7-rc5 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: Apache-2.0 Imports: 62 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Accounts

func Accounts(clientCtx client.Context) ([]common.Address, error)

func DefaultGethNodeConfig

func DefaultGethNodeConfig() *node.Config

DefaultConfig returns the default configuration for the provider.

func GetAPIs

func GetAPIs(clientCtx client.Context, wsClient *rpcclient.WSClient, logger log.Logger, apiBackend *BackendImpl) []rpc.API

func NewNode

func NewNode(config *node.Config) (types.NetworkingStack, error)

Node creates a new NetworkingStack instance.

Types

type ArtelaService

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

func NewArtelaService

func NewArtelaService(
	ctx *server.Context,
	clientCtx client.Context,
	wsClient *rpcclient.WSClient,
	cfg *Config,
	stack types.NetworkingStack,
	am *accounts.Manager,
	logger log.Logger,
) *ArtelaService

func (*ArtelaService) APIs

func (art *ArtelaService) APIs() []rpc.API

func (*ArtelaService) Shutdown

func (art *ArtelaService) Shutdown() error

func (*ArtelaService) Start

func (art *ArtelaService) Start() error

Start start the ethereum JsonRPC service

type BackendImpl

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

backend represents the backend for the JSON-RPC service.

func NewBackend

func NewBackend(
	ctx *server.Context,
	clientCtx client.Context,
	artela *ArtelaService,
	extRPCEnabled bool,
	cfg *Config,
	logger log.Logger,
) *BackendImpl

NewBackend create the backend instance

func (*BackendImpl) Accounts

func (b *BackendImpl) Accounts() []common.Address

func (*BackendImpl) ArtBlockByNumber

func (b *BackendImpl) ArtBlockByNumber(_ context.Context, number rpc.BlockNumber) (*rpctypes.Block, error)

func (*BackendImpl) BaseFee

func (b *BackendImpl) BaseFee(blockRes *tmrpctypes.ResultBlockResults) (*big.Int, error)

func (*BackendImpl) BlockBloom

func (b *BackendImpl) BlockBloom(blockRes *tmrpctypes.ResultBlockResults) (ethtypes.Bloom, error)

func (*BackendImpl) BlockByHash

func (b *BackendImpl) BlockByHash(_ context.Context, hash common.Hash) (*rpctypes.Block, error)

func (*BackendImpl) BlockByNumber

func (b *BackendImpl) BlockByNumber(_ context.Context, number rpc.BlockNumber) (*ethtypes.Block, error)

func (*BackendImpl) BlockByNumberOrHash

func (b *BackendImpl) BlockByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*rpctypes.Block, error)

func (*BackendImpl) BlockFromCosmosBlock

func (b *BackendImpl) BlockFromCosmosBlock(resBlock *tmrpctypes.ResultBlock, blockRes *tmrpctypes.ResultBlockResults) (*rpctypes.Block, error)

func (*BackendImpl) BlockNumber

func (b *BackendImpl) BlockNumber() (hexutil.Uint64, error)

func (*BackendImpl) BlockTimeByNumber

func (b *BackendImpl) BlockTimeByNumber(blockNum int64) (uint64, error)

func (*BackendImpl) BloomStatus

func (b *BackendImpl) BloomStatus() (uint64, uint64)

func (*BackendImpl) ChainConfig

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

func (*BackendImpl) ChainDb

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

func (*BackendImpl) ClientVersion

func (b *BackendImpl) ClientVersion() string

ClientVersion returns the current client version.

func (*BackendImpl) CosmosBlockByHash

func (b *BackendImpl) CosmosBlockByHash(blockHash common.Hash) (*tmrpctypes.ResultBlock, error)

func (*BackendImpl) CosmosBlockByNumber

func (b *BackendImpl) CosmosBlockByNumber(blockNum rpc.BlockNumber) (*tmrpctypes.ResultBlock, error)

func (*BackendImpl) CosmosBlockResultByNumber

func (b *BackendImpl) CosmosBlockResultByNumber(height *int64) (*tmrpctypes.ResultBlockResults, error)

func (*BackendImpl) CurrentBlock

func (b *BackendImpl) CurrentBlock() *rpctypes.Block

func (*BackendImpl) CurrentHeader

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

func (*BackendImpl) DoCall

func (*BackendImpl) Engine

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

func (*BackendImpl) EstimateGas

func (b *BackendImpl) EstimateGas(ctx context.Context, args ethapi.TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash) (hexutil.Uint64, error)

func (*BackendImpl) EthMsgsFromCosmosBlock

func (b *BackendImpl) EthMsgsFromCosmosBlock(resBlock *tmrpctypes.ResultBlock, blockRes *tmrpctypes.ResultBlockResults) []*txs.MsgEthereumTx

func (*BackendImpl) ExtRPCEnabled

func (b *BackendImpl) ExtRPCEnabled() bool

func (*BackendImpl) FeeHistory

func (b *BackendImpl) FeeHistory(blockCount uint64, lastBlock rpc.BlockNumber,
	rewardPercentiles []float64,
) (*rpctypes.FeeHistoryResult, error)

func (*BackendImpl) GasPrice

func (b *BackendImpl) GasPrice(ctx context.Context) (*hexutil.Big, error)

func (*BackendImpl) GetBalance

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

func (*BackendImpl) GetBlockByNumber

func (b *BackendImpl) GetBlockByNumber(blockNum rpc.BlockNumber, fullTx bool) (map[string]interface{}, error)

func (*BackendImpl) GetBody

func (b *BackendImpl) GetBody(ctx context.Context, hash common.Hash,
	number rpc.BlockNumber,
) (*ethtypes.Body, error)

GetBody retrieves the block body.

func (*BackendImpl) GetCode

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

func (*BackendImpl) GetEVM

func (b *BackendImpl) GetEVM(ctx context.Context, msg *core.Message, state *state.StateDB,
	header *ethtypes.Header, vmConfig *vm.Config, _ *vm.BlockContext,
) (*vm.EVM, func() error)

func (*BackendImpl) GetLogs

func (b *BackendImpl) GetLogs(
	_ context.Context, blockHash common.Hash, number uint64,
) ([][]*ethtypes.Log, error)

GetLogs returns the logs.

func (*BackendImpl) GetPoolNonce

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

func (*BackendImpl) GetPoolTransaction

func (b *BackendImpl) GetPoolTransaction(txHash common.Hash) *ethtypes.Transaction

func (*BackendImpl) GetPoolTransactions

func (b *BackendImpl) GetPoolTransactions() (ctypes.Transactions, error)

func (*BackendImpl) GetReceipts

func (b *BackendImpl) GetReceipts(_ context.Context, hash common.Hash) (types.Receipts, error)

GetReceipts get receipts by block hash

func (*BackendImpl) GetSender

func (b *BackendImpl) GetSender(msg *txs.MsgEthereumTx, chainID *big.Int) (from common.Address, err error)

GetSender extracts the sender address from the signature values using the latest signer for the given chainID.

func (*BackendImpl) GetStorageAt

func (b *BackendImpl) 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 (*BackendImpl) GetTd

func (b *BackendImpl) GetTd(_ context.Context, hash common.Hash) *big.Int

func (*BackendImpl) GetTransaction

func (b *BackendImpl) GetTransaction(ctx context.Context, txHash common.Hash) (*ethapi.RPCTransaction, error)

func (*BackendImpl) GetTransactionCount

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

func (*BackendImpl) GetTransactionReceipt

func (b *BackendImpl) GetTransactionReceipt(ctx context.Context, hash common.Hash) (map[string]interface{}, error)

GetTransactionReceipt get receipt by transaction hash

func (*BackendImpl) GetTxByEthHash

func (b *BackendImpl) GetTxByEthHash(hash common.Hash) (*types.TxResult, error)

func (*BackendImpl) GlobalMinGasPrice

func (b *BackendImpl) GlobalMinGasPrice() (sdktypes.Dec, error)

GlobalMinGasPrice returns MinGasPrice param from FeeMarket

func (*BackendImpl) HeaderByHash

func (b *BackendImpl) HeaderByHash(_ context.Context, hash common.Hash) (*ethtypes.Header, error)

func (*BackendImpl) HeaderByNumber

func (b *BackendImpl) HeaderByNumber(_ context.Context, number rpc.BlockNumber) (*ethtypes.Header, error)

func (*BackendImpl) HeaderByNumberOrHash

func (b *BackendImpl) HeaderByNumberOrHash(ctx context.Context,
	blockNrOrHash rpc.BlockNumberOrHash,
) (*ethtypes.Header, error)

func (*BackendImpl) ImportRawKey

func (b *BackendImpl) ImportRawKey(privkey, password string) (common.Address, error)

func (*BackendImpl) Listening

func (b *BackendImpl) Listening() bool

func (*BackendImpl) NewAccount

func (b *BackendImpl) NewAccount(password string) (common.AddressEIP55, error)

func (*BackendImpl) PeerCount

func (b *BackendImpl) PeerCount() hexutil.Uint

func (*BackendImpl) PendingBlockAndReceipts

func (b *BackendImpl) PendingBlockAndReceipts() (*ethtypes.Block, types.Receipts)

func (*BackendImpl) PendingTransactions

func (b *BackendImpl) PendingTransactions() ([]*sdktypes.Tx, error)

func (*BackendImpl) RPCBlockRangeCap

func (b *BackendImpl) RPCBlockRangeCap() int32

RPCBlockRangeCap defines the max block range allowed for `eth_getLogs` query.

func (*BackendImpl) RPCEVMTimeout

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

func (*BackendImpl) RPCFilterCap

func (b *BackendImpl) RPCFilterCap() int32

RPCFilterCap is the limit for total number of filters that can be created

func (*BackendImpl) RPCGasCap

func (b *BackendImpl) RPCGasCap() uint64

func (*BackendImpl) RPCLogsCap

func (b *BackendImpl) RPCLogsCap() int32

RPCLogsCap defines the max number of results can be returned from single `eth_getLogs` query.

func (*BackendImpl) RPCMinGasPrice

func (b *BackendImpl) RPCMinGasPrice() int64

func (*BackendImpl) RPCTxFeeCap

func (b *BackendImpl) RPCTxFeeCap() float64

func (*BackendImpl) SendTx

func (b *BackendImpl) SendTx(ctx context.Context, signedTx *ethtypes.Transaction) error

func (*BackendImpl) ServiceFilter

func (b *BackendImpl) ServiceFilter(_ context.Context, _ *bloombits.MatcherSession)

func (*BackendImpl) SetHead

func (b *BackendImpl) SetHead(_ uint64)

func (*BackendImpl) Sign

func (b *BackendImpl) Sign(address common.Address, data hexutil.Bytes) (hexutil.Bytes, error)

Sign signs the provided data using the private key of address via Geth's signature standard.

func (*BackendImpl) SignTransaction

func (b *BackendImpl) SignTransaction(args *ethapi2.TransactionArgs) (*ethtypes.Transaction, error)

func (*BackendImpl) StateAndHeaderByNumber

func (b *BackendImpl) StateAndHeaderByNumber(
	ctx context.Context, number rpc.BlockNumber,
) (*state.StateDB, *ethtypes.Header, error)

func (*BackendImpl) StateAndHeaderByNumberOrHash

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

func (*BackendImpl) Stats

func (b *BackendImpl) Stats() (int, int)

func (*BackendImpl) SubscribeChainEvent

func (b *BackendImpl) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription

func (*BackendImpl) SubscribeChainHeadEvent

func (b *BackendImpl) SubscribeChainHeadEvent(ch chan<- core.ChainHeadEvent) event.Subscription

func (*BackendImpl) SubscribeChainSideEvent

func (b *BackendImpl) SubscribeChainSideEvent(ch chan<- core.ChainSideEvent) event.Subscription

func (*BackendImpl) SubscribeLogsEvent

func (b *BackendImpl) SubscribeLogsEvent(ch chan<- []*ethtypes.Log) event.Subscription

func (*BackendImpl) SubscribeNewTxsEvent

func (b *BackendImpl) SubscribeNewTxsEvent(ch chan<- core.NewTxsEvent) event.Subscription

func (*BackendImpl) SubscribePendingLogsEvent

func (b *BackendImpl) SubscribePendingLogsEvent(ch chan<- []*ethtypes.Log) event.Subscription

func (*BackendImpl) SubscribeRemovedLogsEvent

func (b *BackendImpl) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription

func (*BackendImpl) SuggestGasTipCap

func (b *BackendImpl) SuggestGasTipCap(baseFee *big.Int) (*big.Int, error)

func (*BackendImpl) SyncProgress

func (b *BackendImpl) SyncProgress() ethereum.SyncProgress

func (*BackendImpl) TxPoolContent

func (b *BackendImpl) TxPoolContent() (
	map[common.Address]ctypes.Transactions, map[common.Address]ctypes.Transactions,
)

func (*BackendImpl) TxPoolContentFrom

func (b *BackendImpl) TxPoolContentFrom(addr common.Address) (
	ctypes.Transactions, ctypes.Transactions,
)

func (*BackendImpl) UnprotectedAllowed

func (b *BackendImpl) UnprotectedAllowed() bool

func (*BackendImpl) Version

func (b *BackendImpl) Version() string

Version returns the current ethereum protocol version.

type Config

type Config struct {
	// AppCfg preserve the server config
	AppCfg *config.Config

	// Gas Price Oracle config.
	GPO *gasprice.Config

	// RPCGasCap is the global gas cap for eth-call variants.
	RPCGasCap uint64 `toml:""`

	// RPCEVMTimeout is the global timeout for eth-call.
	RPCEVMTimeout time.Duration `toml:""`

	// RPCTxFeeCap is the global transaction fee(price * gaslimit) cap for
	// send-transaction variants. The unit is ether.
	RPCTxFeeCap float64 `toml:""`
}

Config represents the configurable parameters for Polaris.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default JSON-RPC config.

func LoadConfigFromFilePath

func LoadConfigFromFilePath(filename string) (*Config, error)

LoadConfigFromFilePath reads in a Polaris config file from the fileystem.

type Node

type Node struct {
	*node.Node
}

Node Wrapers Ethereum Node

func (*Node) ExtRPCEnabled

func (n *Node) ExtRPCEnabled() bool

ExtRPCEnabled returns whether or not the external RPC service is enabled.

func (*Node) Start

func (n *Node) Start() error

Start starts the networking stack.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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