@@ -3,16 +3,18 @@ package filters
33import (
44 "context"
55 "encoding/json"
6+ "math"
7+ "math/big"
8+ "sort"
9+
610 "github.com/ethereum/go-ethereum"
711 "github.com/ethereum/go-ethereum/common"
812 "github.com/ethereum/go-ethereum/common/hexutil"
13+ "github.com/ethereum/go-ethereum/core/rawdb"
914 "github.com/ethereum/go-ethereum/core/types"
1015 "github.com/ethereum/go-ethereum/internal/ethapi"
1116 "github.com/ethereum/go-ethereum/log"
1217 "github.com/ethereum/go-ethereum/rpc"
13- "math"
14- "math/big"
15- "sort"
1618)
1719
1820type BlockResult struct {
@@ -59,6 +61,11 @@ type SubqlAPI struct {
5961 backend ethapi.Backend
6062}
6163
64+ type DataInfo struct {
65+ StartBlock int `json:"startBlock"`
66+ EndBlock int `json:"endBlock"`
67+ }
68+
6269type Capability struct {
6370 AvailableBlocks []struct {
6471 StartHeight int `json:"startHeight"`
@@ -116,6 +123,25 @@ func NewSubqlApi(sys *FilterSystem, backend ethapi.Backend) *SubqlAPI {
116123 return api
117124}
118125
126+ func (api * SubqlAPI ) DataInfo (ctx context.Context ) (* DataInfo , error ) {
127+ config := rawdb .ReadChainDataConfig (api .backend .ChainDb ())
128+
129+ start := 0
130+ if config .DesiredChainDataStart != nil {
131+ start = int (* config .DesiredChainDataStart )
132+ }
133+
134+ end := 0
135+ if config .DesiredChainDataEnd != nil {
136+ end = int (* config .DesiredChainDataEnd )
137+ }
138+
139+ return & DataInfo {
140+ StartBlock : start ,
141+ EndBlock : end ,
142+ }, nil
143+ }
144+
119145func (api * SubqlAPI ) FilterBlocksCapabilities (ctx context.Context ) (* Capability , error ) {
120146 res := & Capability {
121147 Filters : map [string ][]string {
0 commit comments