-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
51 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package proposer | ||
|
||
import ( | ||
"context" | ||
|
||
gethrpc "github.com/ethereum/go-ethereum/rpc" | ||
"github.com/succinctlabs/op-succinct-go/proposer/db" | ||
"github.com/succinctlabs/op-succinct-go/proposer/db/ent" | ||
"github.com/succinctlabs/op-succinct-go/proposer/db/ent/proofrequest" | ||
) | ||
|
||
// Define a new Proofs API that will provider the Proofs API to the RPC server | ||
type ProofsAPI struct { | ||
db *db.ProofDB | ||
} | ||
|
||
func NewProofsAPI(dbPath string, useCachedDb bool) (*ProofsAPI, error) { | ||
db, err := db.InitDB(dbPath, useCachedDb) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return &ProofsAPI{ | ||
db: db, | ||
}, nil | ||
} | ||
|
||
// GetProofsAPI returns the ProofsAPI struct | ||
func GetProofsAPI(api *ProofsAPI) gethrpc.API { | ||
return gethrpc.API{ | ||
Namespace: "proofs", | ||
Service: api, | ||
} | ||
} | ||
|
||
func (pa *ProofsAPI) GetSpanProof(ctx context.Context, startBlock, endBlock uint64) ([]*ent.ProofRequest, error) { | ||
preqs, err := pa.db.GetProofRequestsWithBlockRangeAndStatus(proofrequest.TypeSPAN, startBlock, endBlock, proofrequest.StatusCOMPLETE) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return preqs, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters