Files
dejo-node/internal/api/handler.go
2025-06-17 18:26:14 -03:00

34 lines
751 B
Go

package api
import (
"dejo_node/internal/staking"
"dejo_node/internal/storage"
"dejo_node/internal/transactions"
"net/http"
)
type Handler struct {
Store *storage.BlockStore
StakingStore *staking.StakingStore
Mempool *transactions.Mempool
}
func NewHandler() *Handler {
return &Handler{}
}
func (h *Handler) SetStores(blockStore *storage.BlockStore, stakingStore *staking.StakingStore, mempool *transactions.Mempool) {
h.Store = blockStore
h.StakingStore = stakingStore
h.Mempool = mempool
}
func (h *Handler) Ping(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
w.Write([]byte("pong"))
}
func (h *Handler) HandleConsensus(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
}