api

package
v0.0.0-...-5f6c549 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2023 License: MIT Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const DefaultPaginationCount = 10
View Source
const DefaultPaginationStart = 0

Variables

This section is empty.

Functions

func StartAPI

func StartAPI(port int) error

StartAPI configures and starts REST API server

Types

type API

type API struct {
	HTTP     *echo.Echo
	Validate *validator.Validate
}

func (*API) GetPaginationParams

func (api *API) GetPaginationParams(c echo.Context) (*PaginationParams, error)

GetPaginationParams parses and validates pagination params

type ErrorResponse

type ErrorResponse struct {
	Result bool   `json:"result"`
	Code   int    `json:"code"`
	Error  string `json:"error"`
}

type PaginationParams

type PaginationParams struct {
	Start int `json:"start" validate:"min=0"`
	Count int `json:"count" validate:"min=0"`
}

type PaginationResponse

type PaginationResponse struct {
	PaginationParams
	Total int `json:"total"`
}

type StakersResponse

type StakersResponse struct {
	Result []*schema.StakingRecord `json:"result"`
	PaginationResponse
}

type StakingResponse

type StakingResponse struct {
	schema.ValidatorsNumber
}

type SupplyResponse

type SupplyResponse struct {
	schema.ACME
	Staked            int64      `json:"staked"`
	Circulating       int64      `json:"circulating"`
	TotalTokens       float64    `json:"totalTokens"`
	MaxTokens         float64    `json:"maxTokens"`
	StakedTokens      float64    `json:"stakedTokens"`
	CirculatingTokens float64    `json:"circulatingTokens"`
	UpdatedAt         *time.Time `json:"updatedAt"`
}

Jump to

Keyboard shortcuts

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