Documentation
¶
Index ¶
- func MustServeGRPC(ctx context.Context, wg *sync.WaitGroup, config Config, store store.Readable)
- func MustServeRPC(ctx context.Context, wg *sync.WaitGroup, config Config, store store.Readable)
- type Api
- func (api *Api) GetBlock(bhon types.BlockHashOrNumber, isFull bool) (types.Lazy[*ethTypes.Block], error)
- func (api *Api) GetTrace(txHash common.Hash, index uint) (types.Lazy[*ethTypes.LocalizedTrace], error)
- func (api *Api) GetTransactionByHash(txHash common.Hash) (types.Lazy[*ethTypes.TransactionDetail], error)
- func (api *Api) GetTransactionByIndex(bhon types.BlockHashOrNumber, txIndex uint32) (types.Lazy[*ethTypes.TransactionDetail], error)
- func (api *Api) GetTransactionReceipt(txHash common.Hash) (types.Lazy[*ethTypes.Receipt], error)
- func (api *Api) GetTransactionTraces(txHash common.Hash) (types.Lazy[[]ethTypes.LocalizedTrace], error)
- type ApiProto
- func (api *ApiProto) GetBlock(ctx context.Context, req *pb.GetBlockRequest) (*pb.DataResponse, error)
- func (api *ApiProto) GetBlockReceipts(ctx context.Context, req *pb.BlockId) (*pb.DataResponse, error)
- func (api *ApiProto) GetBlockTraces(ctx context.Context, req *pb.BlockId) (*pb.DataResponse, error)
- func (api *ApiProto) GetBlockTransactionCount(ctx context.Context, req *pb.BlockId) (*pb.GetBlockTransactionCountResponse, error)
- func (api *ApiProto) GetTransactionByHash(ctx context.Context, req *pb.TransactionId) (*pb.DataResponse, error)
- func (api *ApiProto) GetTransactionByIndex(ctx context.Context, req *pb.GetTransactionByIndexRequest) (*pb.DataResponse, error)
- func (api *ApiProto) GetTransactionReceipt(ctx context.Context, req *pb.TransactionId) (*pb.DataResponse, error)
- func (api *ApiProto) GetTransactionTraces(ctx context.Context, req *pb.TransactionId) (*pb.DataResponse, error)
- type Client
- func (c *Client) GetBlock(bhon types.BlockHashOrNumber, isFull bool) (types.Lazy[*ethTypes.Block], error)
- func (c *Client) GetBlockReceipts(bhon types.BlockHashOrNumber) (types.Lazy[[]ethTypes.Receipt], error)
- func (c *Client) GetBlockTraces(bhon types.BlockHashOrNumber) (types.Lazy[[]ethTypes.LocalizedTrace], error)
- func (c *Client) GetBlockTransactionCount(bhon types.BlockHashOrNumber) (int64, error)
- func (c *Client) GetTrace(txHash common.Hash, index uint) (types.Lazy[*ethTypes.LocalizedTrace], error)
- func (c *Client) GetTransactionByHash(txHash common.Hash) (types.Lazy[*ethTypes.TransactionDetail], error)
- func (c *Client) GetTransactionByIndex(bhon types.BlockHashOrNumber, txIndex uint32) (types.Lazy[*ethTypes.TransactionDetail], error)
- func (c *Client) GetTransactionReceipt(txHash common.Hash) (types.Lazy[*ethTypes.Receipt], error)
- func (c *Client) GetTransactionTraces(txHash common.Hash) (types.Lazy[[]ethTypes.LocalizedTrace], error)
- func (c *Client) String() string
- type ClientProto
- func (c *ClientProto) GetBlock(bhon types.BlockHashOrNumber, isFull bool) (types.Lazy[*ethTypes.Block], error)
- func (c *ClientProto) GetBlockReceipts(bhon types.BlockHashOrNumber) (types.Lazy[[]ethTypes.Receipt], error)
- func (c *ClientProto) GetBlockTraces(bhon types.BlockHashOrNumber) (types.Lazy[[]ethTypes.LocalizedTrace], error)
- func (c *ClientProto) GetBlockTransactionCount(bhon types.BlockHashOrNumber) (int64, error)
- func (c *ClientProto) GetTrace(txHash common.Hash, index uint) (types.Lazy[*ethTypes.LocalizedTrace], error)
- func (c *ClientProto) GetTransactionByHash(txHash common.Hash) (types.Lazy[*ethTypes.TransactionDetail], error)
- func (c *ClientProto) GetTransactionByIndex(bhon types.BlockHashOrNumber, txIndex uint32) (types.Lazy[*ethTypes.TransactionDetail], error)
- func (c *ClientProto) GetTransactionReceipt(txHash common.Hash) (types.Lazy[*ethTypes.Receipt], error)
- func (c *ClientProto) GetTransactionTraces(txHash common.Hash) (types.Lazy[[]ethTypes.LocalizedTrace], error)
- func (c *ClientProto) String() string
- type Config
- type Interface
- type Metrics
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustServeGRPC ¶
MustServeGRPC starts gRPC service and wait for graceful shutdown.
Types ¶
type Api ¶
Api is the eth RPC implementation.
func (*Api) GetTransactionByHash ¶
func (*Api) GetTransactionByIndex ¶
func (api *Api) GetTransactionByIndex(bhon types.BlockHashOrNumber, txIndex uint32) (types.Lazy[*ethTypes.TransactionDetail], error)
func (*Api) GetTransactionReceipt ¶
func (*Api) GetTransactionTraces ¶
type ApiProto ¶
type ApiProto struct {
pb.UnimplementedEthServer
// contains filtered or unexported fields
}
ApiProto is the eth gRPC implementation.
func NewApiProto ¶
func (*ApiProto) GetBlock ¶
func (api *ApiProto) GetBlock(ctx context.Context, req *pb.GetBlockRequest) (*pb.DataResponse, error)
func (*ApiProto) GetBlockReceipts ¶
func (*ApiProto) GetBlockTraces ¶
func (*ApiProto) GetBlockTransactionCount ¶
func (*ApiProto) GetTransactionByHash ¶
func (api *ApiProto) GetTransactionByHash(ctx context.Context, req *pb.TransactionId) (*pb.DataResponse, error)
func (*ApiProto) GetTransactionByIndex ¶
func (api *ApiProto) GetTransactionByIndex(ctx context.Context, req *pb.GetTransactionByIndexRequest) (*pb.DataResponse, error)
func (*ApiProto) GetTransactionReceipt ¶
func (api *ApiProto) GetTransactionReceipt(ctx context.Context, req *pb.TransactionId) (*pb.DataResponse, error)
func (*ApiProto) GetTransactionTraces ¶
func (api *ApiProto) GetTransactionTraces(ctx context.Context, req *pb.TransactionId) (*pb.DataResponse, error)
type Client ¶
type Client struct {
*providers.MiddlewarableProvider
// contains filtered or unexported fields
}
Client is the RPC client to interact with RPC server.
func (*Client) GetBlockReceipts ¶
func (*Client) GetBlockTraces ¶
func (c *Client) GetBlockTraces(bhon types.BlockHashOrNumber) (types.Lazy[[]ethTypes.LocalizedTrace], error)
func (*Client) GetBlockTransactionCount ¶
func (c *Client) GetBlockTransactionCount(bhon types.BlockHashOrNumber) (int64, error)
func (*Client) GetTransactionByHash ¶
func (*Client) GetTransactionByIndex ¶
func (c *Client) GetTransactionByIndex(bhon types.BlockHashOrNumber, txIndex uint32) (types.Lazy[*ethTypes.TransactionDetail], error)
func (*Client) GetTransactionReceipt ¶
func (*Client) GetTransactionTraces ¶
type ClientProto ¶
type ClientProto struct {
// contains filtered or unexported fields
}
func NewClientProto ¶
func NewClientProto(url string, timeout ...time.Duration) (*ClientProto, error)
func (*ClientProto) GetBlock ¶
func (c *ClientProto) GetBlock(bhon types.BlockHashOrNumber, isFull bool) (types.Lazy[*ethTypes.Block], error)
func (*ClientProto) GetBlockReceipts ¶
func (c *ClientProto) GetBlockReceipts(bhon types.BlockHashOrNumber) (types.Lazy[[]ethTypes.Receipt], error)
func (*ClientProto) GetBlockTraces ¶
func (c *ClientProto) GetBlockTraces(bhon types.BlockHashOrNumber) (types.Lazy[[]ethTypes.LocalizedTrace], error)
func (*ClientProto) GetBlockTransactionCount ¶
func (c *ClientProto) GetBlockTransactionCount(bhon types.BlockHashOrNumber) (int64, error)
func (*ClientProto) GetTrace ¶
func (c *ClientProto) GetTrace(txHash common.Hash, index uint) (types.Lazy[*ethTypes.LocalizedTrace], error)
func (*ClientProto) GetTransactionByHash ¶
func (c *ClientProto) GetTransactionByHash(txHash common.Hash) (types.Lazy[*ethTypes.TransactionDetail], error)
func (*ClientProto) GetTransactionByIndex ¶
func (c *ClientProto) GetTransactionByIndex(bhon types.BlockHashOrNumber, txIndex uint32) (types.Lazy[*ethTypes.TransactionDetail], error)
func (*ClientProto) GetTransactionReceipt ¶
func (*ClientProto) GetTransactionTraces ¶
func (c *ClientProto) GetTransactionTraces(txHash common.Hash) (types.Lazy[[]ethTypes.LocalizedTrace], error)
func (*ClientProto) String ¶
func (c *ClientProto) String() string
type Config ¶
type Config struct {
Endpoint string `default:":38545"`
Cors []string `default:"[*]"`
VirtualHosts []string `default:"[*]"`
JwtSecretHex string // without 0x prefix
LruCacheSize int `default:"4096"`
Proto struct {
Endpoint string `default:":48545"`
MaxMessageSize int `default:"67108864"` // 64MB
}
}
func DefaultConfig ¶
func DefaultConfig() (config Config)
type Interface ¶
type Interface interface {
// GetBlock returns block for the given block hash or number. If not found, returns nil.
GetBlock(bhon types.BlockHashOrNumber, isFull bool) (types.Lazy[*ethTypes.Block], error)
// GetBlockTransactionCount returns the transaction count for the given block hash or number. If not found, returns -1.
GetBlockTransactionCount(bhon types.BlockHashOrNumber) (int64, error)
// GetTransactionByHash returns transaction for the given transaction hash. If not found, returns nil.
GetTransactionByHash(txHash common.Hash) (types.Lazy[*ethTypes.TransactionDetail], error)
// GetTransactionByIndex returns transaction for the given block hash or number along with transaction index. If not found, returns nil.
GetTransactionByIndex(bhon types.BlockHashOrNumber, txIndex uint32) (types.Lazy[*ethTypes.TransactionDetail], error)
// GetTransactionReceipt returns receipt for the given transaction hash. If not found, returns nil.
GetTransactionReceipt(txHash common.Hash) (types.Lazy[*ethTypes.Receipt], error)
// GetBlockReceipts returns all block receipts for the given block hash or number. If not found, returns nil.
GetBlockReceipts(bhon types.BlockHashOrNumber) (types.Lazy[[]ethTypes.Receipt], error)
// GetTransactionTraces returns all transaction traces for the given transaction hash. If not found, returns nil.
GetTransactionTraces(txHash common.Hash) (types.Lazy[[]ethTypes.LocalizedTrace], error)
// GetBlockTraces returns all block traces for the given block hash or number. If not found, returns nil.
GetBlockTraces(bhon types.BlockHashOrNumber) (types.Lazy[[]ethTypes.LocalizedTrace], error)
// GetTrace returns single trace for the given transaction hash at specified index. If not found, returns nil.
GetTrace(txHash common.Hash, index uint) (types.Lazy[*ethTypes.LocalizedTrace], error)
}
var NotFoundImpl Interface = notFoundImpl{}
type Metrics ¶
type Metrics struct{}
func (*Metrics) GetBlockHitCache ¶
func (m *Metrics) GetBlockHitCache(isFull bool) metricsUtil.Percentage
func (*Metrics) GetBlockIsFull ¶
func (m *Metrics) GetBlockIsFull() metricsUtil.Percentage
Source Files
¶
Click to show internal directories.
Click to hide internal directories.