fiz: correções da pool
This commit is contained in:
@ -2,41 +2,25 @@ package api
|
||||
|
||||
import (
|
||||
"github.com/gorilla/mux"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func NewRouter(h *Handler) http.Handler {
|
||||
r := mux.NewRouter()
|
||||
|
||||
r.HandleFunc("/health", h.Health).Methods("GET")
|
||||
r.HandleFunc("/startup", h.Startup).Methods("GET")
|
||||
r.HandleFunc("/ready", h.Ready).Methods("GET")
|
||||
|
||||
// ⚡ Transações
|
||||
r.HandleFunc("/transaction", h.SendTransaction).Methods("POST")
|
||||
r.HandleFunc("/transaction/{hash}", h.GetTransactionByHash).Methods("GET")
|
||||
|
||||
// 🔐 Staking
|
||||
r.HandleFunc("/stake", h.StakeHandler).Methods("POST")
|
||||
r.HandleFunc("/unstake", h.UnstakeHandler).Methods("POST")
|
||||
r.HandleFunc("/stake/{address}", h.GetStakeInfo).Methods("GET")
|
||||
|
||||
// 🗳️ DAO
|
||||
r.HandleFunc("/dao/proposals", h.CreateProposal).Methods("POST")
|
||||
r.HandleFunc("/dao/proposals/{id}/vote", h.VoteProposal).Methods("POST")
|
||||
r.HandleFunc("/dao/proposals", h.ListProposals).Methods("GET")
|
||||
r.HandleFunc("/dao/proposals/{id}", h.GetProposal).Methods("GET")
|
||||
|
||||
// 💰 Accounts
|
||||
r.HandleFunc("/accounts/{address}", HandleGetBalance).Methods("GET")
|
||||
r.HandleFunc("/accounts/{address}/txs", HandleGetTransactionsByAddress).Methods("GET")
|
||||
|
||||
// 📦 Blocos
|
||||
func (h *Handler) RegisterRoutes(r *mux.Router) {
|
||||
// Rotas de blocos
|
||||
r.HandleFunc("/blocks", h.ListBlocks).Methods("GET")
|
||||
r.HandleFunc("/blocks/{height}", h.GetBlockByHeight).Methods("GET")
|
||||
|
||||
// ❤️ Heartbeat
|
||||
r.HandleFunc("/ping", HandlePing).Methods("GET")
|
||||
// Rotas de staking
|
||||
r.HandleFunc("/stake", h.Stake).Methods("POST")
|
||||
r.HandleFunc("/unstake", h.Unstake).Methods("POST")
|
||||
r.HandleFunc("/stake-info", h.GetStakeInfo).Methods("GET")
|
||||
|
||||
return r
|
||||
}
|
||||
// Rotas de transações
|
||||
r.HandleFunc("/tx", h.SubmitTransaction).Methods("POST")
|
||||
r.HandleFunc("/tx/{hash}", h.GetTransaction).Methods("GET")
|
||||
|
||||
// Rotas de consenso
|
||||
r.HandleFunc("/consensus", h.HandleConsensus).Methods("POST")
|
||||
|
||||
// Health check
|
||||
r.HandleFunc("/ping", h.Ping).Methods("GET")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user