types

package
v0.0.0-...-686de45 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2025 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Solana Errors
	ErrInvalidStatus        = errors.New("invalid status")
	ErrNoMetadata           = errors.New("no metadata")
	ErrTransactionOverboard = errors.New("transaction has gone overboard")

	// Database Errors
	ErrMustBePointer   = errors.New("must be a pointer")
	ErrNotFound        = errors.New("no matches found")
	ErrFilterCollision = errors.New("collision on filter")

	// HTTP Errors
	ErrNotJSON            = errors.New("not json")
	ErrInvalidCallbackURI = errors.New("invalid callback uri")
	ErrInvalidAmount      = errors.New("invalid amount")
	ErrTransactionSlipped = errors.New("transaction has slipped")

	ProperErrors = map[error]string{
		ErrInvalidStatus:        "Invalid confirmation status.",
		ErrNoMetadata:           "No metadata in transaction.",
		ErrTransactionOverboard: "Transaction has gone overboard, retry with bonded transactions.",
		ErrNotFound:             "No matches found in database.",
		ErrFilterCollision:      "Collision on filter query.",
		ErrNotJSON:              "Request contains invalid JSON. Please use application/json.",
		ErrInvalidCallbackURI:   "Invalid callback uri.",
		ErrInvalidAmount:        "Invalid amount to forward. Please provide a higher amount.",
		ErrTransactionSlipped:   "Transaction has slipped threshold, user has not sent enough funds.",
	}
)
View Source
var (
	Env    EnvVars
	Config ConfigVars
)

Functions

func BadRequest

func BadRequest(w http.ResponseWriter, reason error)

func Clear

func Clear()

func Forbidden

func Forbidden(w http.ResponseWriter, reason error)

func GInternalServerError

func GInternalServerError(w http.ResponseWriter)

func GetProperError

func GetProperError(err error) string

func HandleError

func HandleError(w http.ResponseWriter, status int, reason error)

func InternalServerError

func InternalServerError(w http.ResponseWriter, reason error)

func NotFound

func NotFound(w http.ResponseWriter, reason error)

func Run

func Run(name string, arg ...string)

func SetTitle

func SetTitle(format string, content ...interface{})

func Unauthorized

func Unauthorized(w http.ResponseWriter, reason error)

Types

type ConfigVars

type ConfigVars struct {
	RatelimitEvery int `json:"ratelimit_every"`
	RatelimitReset int `json:"ratelimit_reset"`
	Forwarder      struct {
		ForwardAddress       string  `json:"foward_address"`
		MinForward           float64 `json:"min_forward"`
		TransactionThreshold float64 `json:"transaction_threshold"`
	} `json:"forwarder"`
}

type EnvVars

type EnvVars struct {
	SOLANA_NET_HTTP string `json:"SOLANA_NET_HTTP" mapstructure:"SOLANA_NET_HTTP"`
	SOLANA_NET_WS   string `json:"SOLANA_NET_WS" mapstructure:"SOLANA_NET_WS"`
}

type ErrorResponse

type ErrorResponse struct {
	Success bool   `json:"success"`
	Status  int    `json:"status"`
	Message string `json:"message"`
}

Jump to

Keyboard shortcuts

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