gui

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 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 Config

type Config struct {
	// APIEndpoint is the web endpoint where stats and pools are retrieved from
	APIEndpoint string `json:"api_endpoint"`
	// CoinType is the type of the coin the miner is currently minning
	CoinType string `json:"coin_type"`
	// CoinAlgo is the algo of the coin the miner is currently minning
	CoinAlgo string `json:"coin_algo"`
	// This is only for xmrig
	XmrigAlgo string `json:"xmrig_algo"`
	// This is only for xmrig
	XmrigVariant string `json:"xmrig_variant"`
	// 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"`
	// The type of hardware used for mining (1 = computer with CPU only, 2 = computer with GPU)
	HardwareType uint8 `json:"hardware_type"`
}

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,
	coinType string,
	coinAlgo string,
	XmrigAlgo string,
	XmrigVariant string,
	workingDir string,
	isDebug bool) (*GUI, error)

New creates a new instance of the miner application

func (*GUI) GetCoinContentJson

func (gui *GUI) GetCoinContentJson() (string, error)

GetCoinContent returns the content for all coins

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() (*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 BLOC 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"`
	Ticker      string   `json:"abbreviation"`
	Supply      string   `json:"maximum_supply"`
	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"`
	Volumes    []struct {
		Name  string `json:"name"`
		Value string `json:"value"`
		Unit  string `json:"unit"`
	} `json:"volumes"`
	Prices []struct {
		Name  string `json:"name"`
		Value string `json:"value"`
		Unit  string `json:"unit"`
	} `json:"prices"`
	Volume    string `json:"volume"`
	VolumeUsd string `json:"volume_usd"`
	Price     string `json:"price"`
	PriceUsd  string `json:"price_usd"`
	MarketCap string `json:"market_cap"`
	Records   struct {
		Price  string `json:"price"`
		Volume string `json:"volume"`
	} `json:"records"`
	CoinsPerDay string `json:"coins_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"`
	Fee            string `json:"fee"`
	Miners         string `json:"miners"`
	Payout         string `json:"payout"`
	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"`
	MiningPorts    struct {
		Cpu string `json:"cpu"`
		Gpu string `json:"gpu"`
	} `json:"mining_ports"`
}

PoolData contains the parsed JSON data from the pool list

Directories

Path Synopsis
Package miner implements various Bloc-compatible miners that can be used by the GUI
Package miner implements various Bloc-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