backend

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReleasesAPI = "https://api.github.com/repos/vegaprotocol/vegawallet-desktop/releases"
	ReleasesURL = "https://github.com/vegaprotocol/vegawallet-desktop/releases"
)
View Source
const NewInteractionEvent = "new_interaction"
View Source
const (
	ReloadingEntireApplicationRequired = "reloading_entire_application_required"
)

Variables

View Source
var (
	ErrTraceIDIsRequired = errors.New("a trace ID is required for an interaction")
	ErrNameIsRequired    = errors.New("a name is required for an interaction")
)
View Source
var (
	ErrBackendNotStarted   = errors.New("the application backend is not started")
	ErrAppIsNotInitialised = errors.New("the application has not been initialised")
)
View Source
var (
	ErrContextCanceled       = errors.New("context canceled")
	ErrServiceAlreadyRunning = errors.New("the service is already running")
)
View Source
var DefaultNetworks = []DefaultNetwork{
	{
		Name: "mainnet1",
		URL:  "https://raw.githubusercontent.com/vegaprotocol/networks/master/mainnet1/mainnet1.toml",
	}, {
		Name: "testnet2",
		URL:  "https://raw.githubusercontent.com/vegaprotocol/networks/master/testnet2/testnet2.toml",
	}, {
		Name: "fairground",
		URL:  "https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/fairground/vegawallet-fairground.toml",
	},
}
View Source
var ErrAPIv1Unsupported = errors.New("sending transactions through the API v1 is no longer supported")

Functions

This section is empty.

Types

type DefaultNetwork

type DefaultNetwork struct {
	Name string
	URL  string
}

type GetCurrentServiceInfo

type GetCurrentServiceInfo struct {
	URL               string `json:"url"`
	LogFilePath       string `json:"logFilePath"`
	IsRunning         bool   `json:"isRunning"`
	LatestHealthState string `json:"latestHealthState"`
}

type GetVersionResponse

type GetVersionResponse struct {
	Version       string                                       `json:"version"`
	GitHash       string                                       `json:"gitHash"`
	Backend       *wversion.GetSoftwareVersionResponse         `json:"backend"`
	Compatibility *wversion.CheckSoftwareCompatibilityResponse `json:"networksCompatibility"`
}

type Handler

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

func NewHandler

func NewHandler(icon []byte) *Handler

func (*Handler) APIV2DeleteAPIToken

func (h *Handler) APIV2DeleteAPIToken(token string) error

func (*Handler) APIV2DescribeAPIToken

func (h *Handler) APIV2DescribeAPIToken(token string) (connections.TokenDescription, error)

func (*Handler) APIV2GenerateAPIToken

func (h *Handler) APIV2GenerateAPIToken(params connections.GenerateAPITokenParams) (connections.Token, error)

func (*Handler) APIV2ListAPITokens

func (h *Handler) APIV2ListAPITokens() (connections.ListAPITokensResult, error)

func (*Handler) AppMenu

func (h *Handler) AppMenu() *menu.Menu

func (*Handler) DOMReady

func (h *Handler) DOMReady(_ context.Context)

DOMReady is called after the front-end dom has been loaded

func (*Handler) GetAppConfig

func (h *Handler) GetAppConfig() (app.Config, error)

GetAppConfig return the application configuration.

func (*Handler) GetCurrentServiceInfo

func (h *Handler) GetCurrentServiceInfo() (GetCurrentServiceInfo, error)

func (*Handler) GetLatestRelease

func (h *Handler) GetLatestRelease() (LatestRelease, error)

func (*Handler) GetServiceConfig

func (h *Handler) GetServiceConfig() (*service.Config, error)

func (*Handler) GetVersion

func (h *Handler) GetVersion() (*GetVersionResponse, error)

func (*Handler) InitialiseApp

func (h *Handler) InitialiseApp(req *InitialiseAppRequest) error

func (*Handler) IsAppInitialised

func (h *Handler) IsAppInitialised() (bool, error)

func (*Handler) RespondToInteraction

func (h *Handler) RespondToInteraction(interaction interactor.Interaction) error

func (*Handler) SearchForExistingConfiguration

func (h *Handler) SearchForExistingConfiguration() (*SearchForExistingConfigurationResponse, error)

SearchForExistingConfiguration searches for existing wallets and networks. This endpoint should be used to help the user to restore existing wallet setup in the app.

func (*Handler) Shutdown

func (h *Handler) Shutdown(_ context.Context)

Shutdown is called during application termination

func (*Handler) StartService

func (h *Handler) StartService(req *StartServiceRequest) (err error)

func (*Handler) Startup

func (h *Handler) Startup(ctx context.Context)

Startup is called during application startup

func (*Handler) StartupBackend

func (h *Handler) StartupBackend() (err error)

func (*Handler) StopService

func (h *Handler) StopService()

func (*Handler) SubmitWalletAPIRequest

func (h *Handler) SubmitWalletAPIRequest(request jsonrpc.Request) (*jsonrpc.Response, error)

func (*Handler) UpdateAppConfig

func (h *Handler) UpdateAppConfig(updatedConfig app.Config) error

UpdateAppConfig update the application configuration. This requires a restart to take effect.

func (*Handler) UpdateServiceConfig

func (h *Handler) UpdateServiceConfig(cfg service.Config) error

type HealthCheckStatus

type HealthCheckStatus string
const (
	// UnknownStatus is used when the service health check is not yet known.
	UnknownStatus HealthCheckStatus = "unknown_status"

	// ServiceIsHealthy is sent when the service is healthy.
	// This event can be emitted every 15 seconds.
	ServiceIsHealthy HealthCheckStatus = "service_is_healthy"

	// ServiceIsUnhealthy is sent when the service is unhealthy, meaning we could
	// connect but the endpoint didn't answer what we expected.
	// This event can be emitted every 15 seconds.
	ServiceIsUnhealthy HealthCheckStatus = "service_is_unhealthy"

	// ServiceUnreachable is sent when no service is not running anymore.
	// This event can be emitted every 15 seconds.
	ServiceUnreachable HealthCheckStatus = "service_unreachable"

	// ServiceStopped is sent when the service has been stopped by the user.
	// This event is emitted once per service lifecycle.
	// If emitted, the `ServiceStoppedWithError` is not be emitted.
	ServiceStopped = "service_stopped"

	// ServiceStoppedWithError is sent when the service unexpectedly stopped,
	// like an internal crash, of a fail to bind the port.
	// This event is emitted once per service lifecycle.
	// If emitted, the `ServiceStopped` is not be emitted.
	ServiceStoppedWithError = "service_stopped_with_error"
)

type InitialiseAppRequest

type InitialiseAppRequest struct {
	VegaHome string `json:"vegaHome"`
}

type LatestRelease

type LatestRelease struct {
	Version string `json:"version"`
	URL     string `json:"url"`
}

type SearchForExistingConfigurationResponse

type SearchForExistingConfigurationResponse struct {
	Wallets  []string `json:"wallets"`
	Networks []string `json:"networks"`
}

type ServiceStarter

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

func NewServiceStarter

func NewServiceStarter(vegaPaths paths.Paths, log *zap.Logger, svcStore *svcStoreV1.Store, walletStore walletapi.WalletStore, netStore walletapi.NetworkStore, connectionsManager *connections.Manager) (*ServiceStarter, error)

func (*ServiceStarter) Close

func (s *ServiceStarter) Close()

func (*ServiceStarter) Info

func (*ServiceStarter) IsServiceRunning

func (s *ServiceStarter) IsServiceRunning() bool

func (*ServiceStarter) ServiceHealth

func (s *ServiceStarter) ServiceHealth() HealthCheckStatus

func (*ServiceStarter) StartService

func (s *ServiceStarter) StartService(ctx context.Context, network string) (err error)

func (*ServiceStarter) StopService

func (s *ServiceStarter) StopService()

type StartServiceRequest

type StartServiceRequest struct {
	Network        string `json:"network"`
	NoVersionCheck bool   `json:"noVersionCheck"`
}

func (StartServiceRequest) Check

func (r StartServiceRequest) Check() error

Jump to

Keyboard shortcuts

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