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 ¶
- type Announcement
- type Config
- type ElectronMessage
- type GUI
- func (gui *GUI) GetAnnouncement() (Announcement, error)
- func (gui *GUI) GetPool(id int) (PoolData, error)
- func (gui *GUI) GetPoolList() ([]PoolData, error)
- func (gui *GUI) GetPoolTemplate(withChangeOption bool) (*template.Template, error)
- func (gui *GUI) GetStats(poolID int, hashrate float64, mid string) (string, error)
- func (gui *GUI) Run() error
- func (gui *GUI) SaveConfig(config Config) error
- type GlobalStats
- type PoolData
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) GetPoolList ¶
GetPoolList returns the list of pools available to the GUI miner
func (*GUI) GetPoolTemplate ¶
GetPoolTemplate returns the template for rendering a pool block
func (*GUI) GetStats ¶
GetStats returns stats for the interface. It requires the miner's hashrate to calculate XTL per dat
func (*GUI) SaveConfig ¶
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"` VolumeBTCSquare string `json:"volume_btcsquare"` 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