2020-10-18 19:44:28 +00:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2021-07-29 11:53:13 +00:00
|
|
|
"github.com/ledgerwatch/erigon-lib/kv"
|
2021-05-20 18:25:53 +00:00
|
|
|
"github.com/ledgerwatch/erigon/common"
|
|
|
|
"github.com/ledgerwatch/erigon/core/types"
|
|
|
|
"github.com/ledgerwatch/erigon/rpc"
|
2020-10-18 19:44:28 +00:00
|
|
|
)
|
|
|
|
|
2021-05-26 10:35:39 +00:00
|
|
|
// ErigonAPI Erigon specific routines
|
|
|
|
type ErigonAPI interface {
|
|
|
|
// System related (see ./erigon_system.go)
|
2020-10-25 21:34:00 +00:00
|
|
|
Forks(ctx context.Context) (Forks, error)
|
2020-10-18 19:44:28 +00:00
|
|
|
|
2021-05-26 10:35:39 +00:00
|
|
|
// Blocks related (see ./erigon_blocks.go)
|
2020-10-20 21:16:28 +00:00
|
|
|
GetHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, error)
|
2020-10-18 19:44:28 +00:00
|
|
|
GetHeaderByHash(_ context.Context, hash common.Hash) (*types.Header, error)
|
|
|
|
|
2021-05-26 10:35:39 +00:00
|
|
|
// Receipt related (see ./erigon_receipts.go)
|
2020-10-18 19:44:28 +00:00
|
|
|
GetLogsByHash(ctx context.Context, hash common.Hash) ([][]*types.Log, error)
|
2020-10-24 17:03:52 +00:00
|
|
|
//GetLogsByNumber(ctx context.Context, number rpc.BlockNumber) ([][]*types.Log, error)
|
2020-10-20 21:16:28 +00:00
|
|
|
|
2021-05-26 10:35:39 +00:00
|
|
|
// Issuance / reward related (see ./erigon_issuance.go)
|
2020-10-24 17:03:52 +00:00
|
|
|
// BlockReward(ctx context.Context, blockNr rpc.BlockNumber) (Issuance, error)
|
|
|
|
// UncleReward(ctx context.Context, blockNr rpc.BlockNumber) (Issuance, error)
|
2020-10-20 21:16:28 +00:00
|
|
|
Issuance(ctx context.Context, blockNr rpc.BlockNumber) (Issuance, error)
|
2020-10-18 19:44:28 +00:00
|
|
|
}
|
|
|
|
|
2021-05-26 10:35:39 +00:00
|
|
|
// ErigonImpl is implementation of the ErigonAPI interface
|
|
|
|
type ErigonImpl struct {
|
2021-01-02 19:28:22 +00:00
|
|
|
*BaseAPI
|
2021-07-28 02:47:38 +00:00
|
|
|
db kv.RoDB
|
2020-10-18 19:44:28 +00:00
|
|
|
}
|
|
|
|
|
2021-05-26 10:35:39 +00:00
|
|
|
// NewErigonAPI returns ErigonImpl instance
|
2021-07-28 02:47:38 +00:00
|
|
|
func NewErigonAPI(base *BaseAPI, db kv.RoDB) *ErigonImpl {
|
2021-05-26 10:35:39 +00:00
|
|
|
return &ErigonImpl{
|
2021-05-17 12:15:19 +00:00
|
|
|
BaseAPI: base,
|
2021-02-21 08:38:00 +00:00
|
|
|
db: db,
|
2020-10-18 19:44:28 +00:00
|
|
|
}
|
|
|
|
}
|