webapi

package
v0.0.0-...-faf87da Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: ISC Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Recovery

func Recovery(log slog.Logger) gin.HandlerFunc

Recovery returns a middleware that recovers from any panics which occur in request handlers. It logs the panic, a stack trace, and the full request details. It also ensure the client receives a 500 response rather than no response at all.

func Start

func Start(shutdownCtx context.Context, requestShutdown func(), shutdownWg *sync.WaitGroup,
	listen string, vdb *database.VspDatabase, log slog.Logger, dcrd rpc.DcrdConnect,
	wallets rpc.WalletConnect, config Config) error

Types

type Config

type Config struct {
	VSPFee               float64
	NetParams            *chaincfg.Params
	BlockExplorerURL     string
	FeeAccountName       string
	SupportEmail         string
	VspClosed            bool
	VspClosedMsg         string
	AdminPass            string
	Debug                bool
	Designation          string
	MaxVoteChangeRecords int
	VspdVersion          string
}

type DcrdStatus

type DcrdStatus struct {
	Host            string `json:"host"`
	Connected       bool   `json:"connected"`
	BestBlockError  bool   `json:"bestblockerror"`
	BestBlockHeight uint32 `json:"bestblockheight"`
}

DcrdStatus describes the current status of the local instance of dcrd used by vspd. This is used by the admin.html template, and also serialized to JSON for the /admin/status endpoint.

type Node

type Node interface {
	ExistsLiveTicket(ticketHash string) (bool, error)
	GetRawTransaction(txHash string) (*dcrdtypes.TxRawResult, error)
}

Node is satisfied by *rpc.DcrdRPC and retrieves data from the blockchain.

type Server

type Server struct {
	// contains filtered or unexported fields
}

type WalletStatus

type WalletStatus struct {
	Connected       bool   `json:"connected"`
	InfoError       bool   `json:"infoerror"`
	DaemonConnected bool   `json:"daemonconnected"`
	VoteVersion     uint32 `json:"voteversion"`
	Unlocked        bool   `json:"unlocked"`
	Voting          bool   `json:"voting"`
	BestBlockError  bool   `json:"bestblockerror"`
	BestBlockHeight int64  `json:"bestblockheight"`
}

WalletStatus describes the current status of a single voting wallet. This is used by the admin.html template, and also serialized to JSON for the /admin/status endpoint.

Jump to

Keyboard shortcuts

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