gui

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2019 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Overview

Package gui implements the communication and control parts of the GUI miner. It constructs and launches the Electron front-end as well as listen for events from the front-end

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Announcement

type Announcement struct {
	ID         int       `json:"id"`
	Text       string    `json:"text"`
	Link       string    `json:"link"`
	DateString string    `json:"date"`
	Date       time.Time `json:"-"`
	Ann        bool      `json:"ann"`
}

Announcement is the structure returned is an announcement is made available

type Config

type Config struct {
	// APIEndpoint is the web endpoint where stats and pools are retrieved from
	APIEndpoint string `json:"api_endpoint"`
	// Address to mine to
	Address string `json:"address"`
	// PoolID selected on startup
	PoolID int `json:"pool"`
	// Mid is the miner identifier
	Mid string `json:"mid"`
	// Miner is the config for the miner
	Miner miner.Config `json:"miner"`
}

Config contains the basic configuration for a miner

type ElectronMessage

type ElectronMessage struct {
	Data string `json:"data"`
}

ElectronMessage is marshalled and sent to the UI

type GUI

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

GUI implements the core control for the GUI miner

func New

func New(
	appName string,
	config *Config,
	asset bootstrap.Asset,
	restoreAssets bootstrap.RestoreAssets,
	apiEndpoint string,
	workingDir string,
	isDebug bool) (*GUI, error)

New creates a new instance of the miner application

func (*GUI) GetAnnouncement

func (gui *GUI) GetAnnouncement() (Announcement, error)

GetAnnouncement returns the announcement if available

func (*GUI) GetPool

func (gui *GUI) GetPool(id int) (PoolData, error)

GetPool returns a single pool's information

func (*GUI) GetPoolList

func (gui *GUI) GetPoolList() ([]PoolData, error)

GetPoolList returns the list of pools available to the GUI miner

func (*GUI) GetPoolTemplate

func (gui *GUI) GetPoolTemplate(withChangeOption bool) (*template.Template, error)

GetPoolTemplate returns the template for rendering a pool block

func (*GUI) GetStats

func (gui *GUI) GetStats(
	poolID int,
	hashrate float64,
	mid string) (string, error)

GetStats returns stats for the interface. It requires the miner's hashrate to calculate XTL per dat

func (*GUI) Run

func (gui *GUI) Run() error

Run the miner!

func (*GUI) SaveConfig

func (gui *GUI) SaveConfig(config Config) error

SaveConfig saves the configuration to disk

type GlobalStats

type GlobalStats struct {
	Pool        PoolData `json:"pool"`
	Circulation string   `json:"circulation"`
	LastBlock   struct {
		ID         int    `json:"id"`
		Height     int    `json:"height"`
		Difficulty int    `json:"difficulty"`
		TxCount    int    `json:"tx_count"`
		Reward     string `json:"reward"`
		Timestamp  string `json:"timestamp"`
	} `json:"last_block"`
	Difficulty      string `json:"difficulty"`
	Height          string `json:"height"`
	VolumeCrex      string `json:"volume_crex"`
	VolumeTradeogre string `json:"volume_tradeogre"`
	Volume          string `json:"volume"`
	Price           string `json:"price"`
	MarketCap       string `json:"market_cap"`
	Records         struct {
		Price  string `json:"price"`
		Volume string `json:"volume"`
	} `json:"records"`
	XtlPerDay string `json:"xtl_per_day"`
	Hashrate  string `json:"hashrate"`
	// PoolHTML is injected before sending the update to the front-end. Avoids
	// having to send extra packets
	PoolHTML string `json:"pool_html"`
}

GlobalStats contains the current stats for the network, trading and selected mining pool

type PoolData

type PoolData struct {
	ID             int    `json:"id"`
	Rank           int    `json:"rank"`
	APIType        string `json:"api_type"`
	Name           string `json:"name"`
	URL            string `json:"url"`
	Endpoint       string `json:"endpoint"`
	Hashrate       string `json:"hashrate"`
	Miners         string `json:"miners"`
	LastBlock      string `json:"last_block"`
	Config         string `json:"config"`
	IsEnabled      int    `json:"is_enabled"`
	DisplayInMiner int    `json:"display_in_miner"`
	LastUpdate     string `json:"last_update"`
}

PoolData contains the parsed JSON data from the pool list

Directories

Path Synopsis
Package miner implements various Stellite-compatible miners that can be used by the GUI
Package miner implements various Stellite-compatible miners that can be used by the GUI

Jump to

Keyboard shortcuts

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