Skip to content

Commit

Permalink
Update RPC to be an alias
Browse files Browse the repository at this point in the history
  • Loading branch information
stwiname committed Sep 10, 2024
1 parent 5f17a5f commit 6a035d2
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions eth/filters/api_subql.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/internal/ethapi"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rpc"
)

Expand Down Expand Up @@ -61,11 +62,6 @@ type SubqlAPI struct {
backend ethapi.Backend
}

type DataInfo struct {
StartBlock int `json:"startBlock"`
EndBlock int `json:"endBlock"`
}

type Capability struct {
AvailableBlocks []struct {
StartHeight int `json:"startHeight"`
Expand Down Expand Up @@ -123,23 +119,11 @@ func NewSubqlApi(sys *FilterSystem, backend ethapi.Backend) *SubqlAPI {
return api
}

func (api *SubqlAPI) DataInfo(ctx context.Context) (*DataInfo, error) {
// This is an alias for `admin_getDesiredConfig`
func (api *SubqlAPI) DataInfo(ctx context.Context) (*params.ChainDataConfig, error) {
config := rawdb.ReadChainDataConfig(api.backend.ChainDb())

start := 0
if config.DesiredChainDataStart != nil {
start = int(*config.DesiredChainDataStart)
}

end := 0
if config.DesiredChainDataEnd != nil {
end = int(*config.DesiredChainDataEnd)
}

return &DataInfo{
StartBlock: start,
EndBlock: end,
}, nil
return config, nil
}

func (api *SubqlAPI) FilterBlocksCapabilities(ctx context.Context) (*Capability, error) {
Expand Down

0 comments on commit 6a035d2

Please sign in to comment.