package rpc import ( "context" "github.com/woop-chain/woop/core" "github.com/woop-chain/woop/eth/rpc" "github.com/woop-chain/woop/wiki" ) type PreimagesService struct { wiki *wiki.Woop } // NewPreimagesAPI creates a new API for the RPC interface func NewPreimagesAPI(wiki *wiki.Woop, version string) rpc.API { var service interface{} = &PreimagesService{wiki} return rpc.API{ Namespace: version, Version: APIVersion, Service: service, Public: true, } } func (s *PreimagesService) Export(ctx context.Context, path string) error { // these are by default not blocking return core.ExportPreimages(s.wiki.BlockChain, path) } func (s *PreimagesService) Verify(ctx context.Context) (uint64, error) { currentBlock := s.wiki.CurrentBlock() // these are by default not blocking return core.VerifyPreimages(currentBlock.Header(), s.wiki.BlockChain) }