mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-24 12:37:16 +00:00
287a3d1d6c
I added a way to get canonical receipts through block hash under the erigon name space #6229 Tested: BlockHash: 0xb5d50393734894e02a94a500a5a5aade9c66f388438aeed8d7775b3b344745f1 <img width="1727" alt="Screenshot 2022-12-12 at 22 16 18" src="https://user-images.githubusercontent.com/19207637/207166860-436ecf26-a777-4b2f-8377-22acec732486.png">
63 lines
2.5 KiB
Go
63 lines
2.5 KiB
Go
package commands
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/ledgerwatch/erigon/eth/filters"
|
|
ethFilters "github.com/ledgerwatch/erigon/eth/filters"
|
|
|
|
"github.com/ledgerwatch/erigon-lib/kv"
|
|
"github.com/ledgerwatch/erigon/common"
|
|
"github.com/ledgerwatch/erigon/common/hexutil"
|
|
"github.com/ledgerwatch/erigon/core/types"
|
|
"github.com/ledgerwatch/erigon/p2p"
|
|
"github.com/ledgerwatch/erigon/rpc"
|
|
"github.com/ledgerwatch/erigon/turbo/rpchelper"
|
|
)
|
|
|
|
// ErigonAPI Erigon specific routines
|
|
type ErigonAPI interface {
|
|
// System related (see ./erigon_system.go)
|
|
Forks(ctx context.Context) (Forks, error)
|
|
BlockNumber(ctx context.Context, rpcBlockNumPtr *rpc.BlockNumber) (hexutil.Uint64, error)
|
|
|
|
// Blocks related (see ./erigon_blocks.go)
|
|
GetHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, error)
|
|
GetHeaderByHash(_ context.Context, hash common.Hash) (*types.Header, error)
|
|
GetBlockByTimestamp(ctx context.Context, timeStamp rpc.Timestamp, fullTx bool) (map[string]interface{}, error)
|
|
GetBalanceChangesInBlock(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (map[common.Address]*hexutil.Big, error)
|
|
|
|
// Receipt related (see ./erigon_receipts.go)
|
|
GetLogsByHash(ctx context.Context, hash common.Hash) ([][]*types.Log, error)
|
|
//GetLogsByNumber(ctx context.Context, number rpc.BlockNumber) ([][]*types.Log, error)
|
|
GetLogs(ctx context.Context, crit ethFilters.FilterCriteria) (types.ErigonLogs, error)
|
|
GetLatestLogs(ctx context.Context, crit filters.FilterCriteria, logOptions ethFilters.LogFilterOptions) (types.ErigonLogs, error)
|
|
// Gets cannonical block receipt through hash. If the block is not cannonical returns error
|
|
GetBlockReceiptsByBlockHash(ctx context.Context, cannonicalBlockHash common.Hash) ([]map[string]interface{}, error)
|
|
|
|
// WatchTheBurn / reward related (see ./erigon_issuance.go)
|
|
WatchTheBurn(ctx context.Context, blockNr rpc.BlockNumber) (Issuance, error)
|
|
|
|
// CumulativeChainTraffic / related to chain traffic (see ./erigon_cumulative_index.go)
|
|
CumulativeChainTraffic(ctx context.Context, blockNr rpc.BlockNumber) (ChainTraffic, error)
|
|
|
|
// NodeInfo returns a collection of metadata known about the host.
|
|
NodeInfo(ctx context.Context) ([]p2p.NodeInfo, error)
|
|
}
|
|
|
|
// ErigonImpl is implementation of the ErigonAPI interface
|
|
type ErigonImpl struct {
|
|
*BaseAPI
|
|
db kv.RoDB
|
|
ethBackend rpchelper.ApiBackend
|
|
}
|
|
|
|
// NewErigonAPI returns ErigonImpl instance
|
|
func NewErigonAPI(base *BaseAPI, db kv.RoDB, eth rpchelper.ApiBackend) *ErigonImpl {
|
|
return &ErigonImpl{
|
|
BaseAPI: base,
|
|
db: db,
|
|
ethBackend: eth,
|
|
}
|
|
}
|