server

package
v0.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetGinDefaults

func SetGinDefaults(cfg *config.Config)

SetGinDefaults changes Gin behavior base on application environment

Types

type BlockResponse

type BlockResponse struct {
	Block        *model.Block        `json:"block"`
	Creator      *model.Account      `json:"creator"`
	Transactions []model.Transaction `json:"transactions"`
	SnarkJobs    []model.SnarkJob    `json:"snark_jobs"`
}

type HealthResponse

type HealthResponse struct {
	Healthy bool `json:"healthy"`
}

type HeightResponse

type HeightResponse struct {
	Height uint64    `json:"height"`
	Time   time.Time `json:"time"`
}

type LedgerRequest added in v0.7.0

type LedgerRequest struct {
	Epoch *int `form:"epoch"`
}

type LedgerResponse

type LedgerResponse struct {
	Ledger  *model.Ledger       `json:"ledger"`
	Records []model.LedgerEntry `json:"entries"`
}

type Server

type Server struct {
	*gin.Engine
	// contains filtered or unexported fields
}

Server handles HTTP requests

func New

func New(db *store.Store, cfg *config.Config, logger *logrus.Logger) *Server

New returns a new server instance

func (*Server) GetAccount

func (s *Server) GetAccount(c *gin.Context)

GetAccount returns account for by hash or ID

func (*Server) GetBlock

func (s *Server) GetBlock(c *gin.Context)

GetBlock returns a single block

func (*Server) GetBlockStats

func (s *Server) GetBlockStats(c *gin.Context)

GetBlockStats returns block stats for an interval

func (*Server) GetBlockTimes

func (s *Server) GetBlockTimes(c *gin.Context)

GetBlockTimes returns avg block times info

func (*Server) GetBlockTransactions

func (s *Server) GetBlockTransactions(c *gin.Context)

func (*Server) GetBlocks

func (s *Server) GetBlocks(c *gin.Context)

GetBlocks returns a list of available blocks matching the filter

func (*Server) GetCurrentBlock

func (s *Server) GetCurrentBlock(c *gin.Context)

GetCurrentBlock returns the current blockchain height

func (*Server) GetCurrentHeight

func (s *Server) GetCurrentHeight(c *gin.Context)

GetCurrentHeight returns the current blockchain height

func (*Server) GetDelegations

func (s *Server) GetDelegations(c *gin.Context)

GetDelegations rendes all existing delegations

func (Server) GetHealth

func (s Server) GetHealth(c *gin.Context)

GetHealth renders the server health status

func (*Server) GetLedger

func (s *Server) GetLedger(c *gin.Context)

GetLedger records the current epoch ledger records

func (*Server) GetLedgers added in v0.7.0

func (s *Server) GetLedgers(c *gin.Context)

GetLedgers returns a list of all existing ledgers

func (*Server) GetPendingTransactions added in v0.9.3

func (s *Server) GetPendingTransactions(c *gin.Context)

GetPendingTransactions returns transactions by height

func (*Server) GetSnarkers

func (s *Server) GetSnarkers(c *gin.Context)

GetSnarkers renders all existing snarkers

func (Server) GetStatus

func (s Server) GetStatus(c *gin.Context)

GetStatus returns the status of the service

func (*Server) GetTransaction

func (s *Server) GetTransaction(c *gin.Context)

GetTransaction returns a single transaction details

func (*Server) GetTransactions

func (s *Server) GetTransactions(c *gin.Context)

GetTransactions returns transactions by height

func (*Server) GetValidator

func (s *Server) GetValidator(c *gin.Context)

GetValidator renders the validator details

func (*Server) GetValidatorStats

func (s *Server) GetValidatorStats(c *gin.Context)

GetValidatorStats renders validator stats for a given time bucket

func (*Server) GetValidators

func (s *Server) GetValidators(c *gin.Context)

GetValidators rendes all existing validators

type StatusResponse

type StatusResponse struct {
	AppName         string    `json:"app_name"`
	AppVersion      string    `json:"app_version"`
	GitCommit       string    `json:"git_commit"`
	GoVersion       string    `json:"go_version"`
	NodeVersion     string    `json:"node_version,omitempty"`
	NodeStatus      string    `json:"node_status,omitempty"`
	NodeError       bool      `json:"node_error"`
	SyncStatus      string    `json:"sync_status"`
	LastBlockTime   time.Time `json:"last_block_time"`
	LastBlockHeight uint64    `json:"last_block_height"`
}

type ValidatorResponse

type ValidatorResponse struct {
	Validator   *model.Validator      `json:"validator"`
	Account     *model.Account        `json:"account"`
	Delegations []model.Delegation    `json:"delegations"`
	Stats       []model.ValidatorStat `json:"stats"`
	StatsHourly []model.ValidatorStat `json:"stats_hourly"`
	StatsDaily  []model.ValidatorStat `json:"stats_daily"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL