Documentation
¶
Index ¶
- type ApiCoinConfig
- type ApiPoolPaymentProcessingConfig
- type BalanceChange
- type BalanceChangeRes
- type Block
- type BlockFoundMessage
- type BlockMessage
- type BlockUnlockProgressMessage
- type BlockUnlockedMessage
- type BlockchainStats
- type BlocksRes
- type ChainHeightMessage
- type Client
- func (c *Client) GetMiner(ctx context.Context, id, addr string, params ...map[string]string) (*MinerStats, int, error)
- func (c *Client) GetMinerBalanceChanges(ctx context.Context, id, addr string, params ...map[string]string) (*BalanceChangeRes, int, error)
- func (c *Client) GetMinerDailyEarnings(ctx context.Context, id, addr string, params ...map[string]string) (*DailyEarningRes, int, error)
- func (c *Client) GetMinerPayments(ctx context.Context, id, addr string, params ...map[string]string) (*PaymentRes, int, error)
- func (c *Client) GetMinerPerformance(ctx context.Context, id, addr string, params ...map[string]string) ([]*WorkerStats, int, error)
- func (c *Client) GetMinerSettings(ctx context.Context, id, addr string) (*MinerSettings, int, error)
- func (c *Client) GetMiners(ctx context.Context, id string, params ...map[string]string) ([]*MinerPerformanceStats, int, error)
- func (c *Client) GetPerformance(ctx context.Context, id string, params ...map[string]string) ([]*PoolPerformance, int, error)
- func (c *Client) GetPool(ctx context.Context, id string) (*PoolInfo, int, error)
- func (c *Client) GetPoolBlocks(ctx context.Context, id string, params ...map[string]string) (*BlocksRes, int, error)
- func (c *Client) GetPoolPayments(ctx context.Context, id string, params ...map[string]string) (*PaymentRes, int, error)
- func (c *Client) GetPools(ctx context.Context) ([]*PoolInfo, int, error)
- func (c *Client) PostMinerSettings(ctx context.Context, id, addr string, settings *MinerSettingsUpdateReq) (*MinerSettings, int, error)
- func (c *Client) UnmarshalMiner(ctx context.Context, id, addr string, res any, params ...map[string]string) (int, error)
- func (c *Client) UnmarshalMinerBalanceChanges(ctx context.Context, id, addr string, res any, params ...map[string]string) (int, error)
- func (c *Client) UnmarshalMinerDailyEarnings(ctx context.Context, id, addr string, res any, params ...map[string]string) (int, error)
- func (c *Client) UnmarshalMinerPayments(ctx context.Context, id, addr string, res any, params ...map[string]string) (int, error)
- func (c *Client) UnmarshalMinerPerformance(ctx context.Context, id, addr string, res any, params ...map[string]string) (int, error)
- func (c *Client) UnmarshalMinerSettings(ctx context.Context, id, addr string, res any) (int, error)
- func (c *Client) UnmarshalMiners(ctx context.Context, id string, res any, params ...map[string]string) (int, error)
- func (c *Client) UnmarshalPool(ctx context.Context, id string, res any) (int, error)
- func (c *Client) UnmarshalPoolBlocks(ctx context.Context, id string, res any, params ...map[string]string) (int, error)
- func (c *Client) UnmarshalPoolPayments(ctx context.Context, id string, res any, params ...map[string]string) (int, error)
- func (c *Client) UnmarshalPoolPerformance(ctx context.Context, id string, res any, params ...map[string]string) (int, error)
- func (c *Client) UnmarshalPools(ctx context.Context, res any) (int, error)
- func (c *Client) UnmarshalPostMinerSettings(ctx context.Context, id, addr string, settings any, res any) (int, error)
- type ClientOpts
- type DailyEarning
- type DailyEarningRes
- type HashRateUpdateMessage
- type Meta
- type MinerPerformanceStats
- type MinerSettings
- type MinerSettingsUpdateReq
- type MinerStats
- type Payment
- type PaymentMessage
- type PaymentRes
- type PoolEndpoint
- type PoolInfo
- type PoolPerformance
- type PoolShareBasedBanningConfig
- type PoolStats
- type RawMessage
- type TCPProxyProtocolConfig
- type VarDiffConfig
- type WebsocketMsg
- type WorkerPerformanceStats
- type WorkerStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiCoinConfig ¶
type ApiCoinConfig struct { Type string `json:"type"` Name string `json:"name"` Symbol string `json:"symbol"` Website string `json:"website"` Family string `json:"family"` Algorithm string `json:"algorithm"` Twitter string `json:"twitter"` Discord string `json:"discord"` Telegram string `json:"telegram"` CanonicalName string `json:"canonicalName"` }
type BalanceChange ¶
type BalanceChangeRes ¶ added in v0.2.1
type BalanceChangeRes struct { *Meta Result []*BalanceChange `json:"result"` }
type Block ¶
type Block struct { PoolID string `json:"poolId"` BlockHeight int64 `json:"blockHeight"` NetworkDifficulty float64 `json:"networkDifficulty"` Status string `json:"status"` Type string `json:"type"` ConfirmationProgress float64 `json:"confirmationProgress"` Effort float64 `json:"effort"` TransactionConfirmationData string `json:"transactionConfirmationData"` Reward float64 `json:"reward"` InfoLink string `json:"infoLink"` Hash string `json:"hash"` Miner string `json:"miner"` Source string `json:"source"` Created string `json:"created"` }
type BlockFoundMessage ¶
type BlockFoundMessage struct { BlockMessage Miner string `json:"miner"` MinerExplorerLink string `json:"minerExplorerLink"` Source string `json:"source"` }
type BlockMessage ¶
type BlockUnlockProgressMessage ¶
type BlockUnlockProgressMessage struct { BlockMessage Progress float64 `json:"progress"` Effort float64 `json:"effort"` }
type BlockUnlockedMessage ¶
type BlockUnlockedMessage struct { BlockMessage BlockType string `json:"blockType"` BlockHash string `json:"blockHash"` Reward float64 `json:"reward"` Effort float64 `json:"effort"` Miner string `json:"miner"` ExplorerLink string `json:"explorerLink"` MinerExplorerLink string `json:"minerExplorerLink"` }
type BlockchainStats ¶
type BlockchainStats struct { NetworkType string `json:"networkType"` NetworkHashrate float64 `json:"networkHashrate"` NetworkDifficulty float64 `json:"networkDifficulty"` NextNetworkTarget string `json:"nextNetworkTarget"` NextNetworkBits string `json:"nextNetworkBits"` LastNetworkBlockTime string `json:"lastNetworkBlockTime"` BlockHeight int64 `json:"blockHeight"` ConnectedPeers int32 `json:"connectedPeers"` RewardType string `json:"rewardType"` }
type ChainHeightMessage ¶
type ChainHeightMessage struct {
BlockMessage
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a client for the miningcore API.
func New ¶
func New(url string, opts ...ClientOpts) *Client
New creates a new client for the miningcore API.
func (*Client) GetMiner ¶
func (c *Client) GetMiner(ctx context.Context, id, addr string, params ...map[string]string) (*MinerStats, int, error)
GetMiner returns information about a specific miner from a pool. This endpoints allows to specify the performance mode using the`perfMode` parameter. Possible values are:
"Hour" "Day" "Month"
func (*Client) GetMinerBalanceChanges ¶
func (c *Client) GetMinerBalanceChanges(ctx context.Context, id, addr string, params ...map[string]string) (*BalanceChangeRes, int, error)
GetMinerBalanceChanges returns a list of balance changes of a miner. This endpoint implements pagination using the `page` and `perPage` parameters.
func (*Client) GetMinerDailyEarnings ¶
func (c *Client) GetMinerDailyEarnings(ctx context.Context, id, addr string, params ...map[string]string) (*DailyEarningRes, int, error)
GetMinerDailyEarnings returns a list of daily earnings of a miner. This endpoint implements pagination using the `page` and `perPage` parameters.
func (*Client) GetMinerPayments ¶
func (c *Client) GetMinerPayments(ctx context.Context, id, addr string, params ...map[string]string) (*PaymentRes, int, error)
GetMinerPayments returns a list of payments of a miner. This endpoint implements pagination using the `page` and `perPage` parameters.
func (*Client) GetMinerPerformance ¶ added in v0.3.1
func (c *Client) GetMinerPerformance(ctx context.Context, id, addr string, params ...map[string]string) ([]*WorkerStats, int, error)
GetMinerPerformance returns a list of performance samples of a miner. This endpoints allows to specify the sample range using the`sampleRange` parameter. Possible values are:
"Hour" "Day" "Month"
func (*Client) GetMinerSettings ¶ added in v0.2.0
func (c *Client) GetMinerSettings(ctx context.Context, id, addr string) (*MinerSettings, int, error)
GetMinerSettings returns the current miner settings of a pool.
func (*Client) GetMiners ¶ added in v0.2.0
func (c *Client) GetMiners(ctx context.Context, id string, params ...map[string]string) ([]*MinerPerformanceStats, int, error)
GetMiners returns a list of all miners from a pool. This endpoint implements pagination using the `page` and `perPage` parameters.
func (*Client) GetPerformance ¶ added in v0.2.0
func (c *Client) GetPerformance(ctx context.Context, id string, params ...map[string]string) ([]*PoolPerformance, int, error)
GetPerformance returns a list of performance stats of a pool. This endpoint allows to specify the sample range using the `r` parameter and the sample interval using the `i` parameter. Possible values for `r` are:
"Hour" "Day" "Month"
Possible values for `i` are:
"Hour" "Day"
func (*Client) GetPoolBlocks ¶
func (c *Client) GetPoolBlocks(ctx context.Context, id string, params ...map[string]string) (*BlocksRes, int, error)
GetPoolBlocks returns a list of blocks found by a pool. This endpoint implements pagination using the `page` and `perPage` parameters.
func (*Client) GetPoolPayments ¶
func (c *Client) GetPoolPayments(ctx context.Context, id string, params ...map[string]string) (*PaymentRes, int, error)
GetPoolPayments returns a list of payments made by a pool. This endpoint implements pagination using the `page` and `perPage` parameters.
func (*Client) PostMinerSettings ¶ added in v0.2.0
func (c *Client) PostMinerSettings(ctx context.Context, id, addr string, settings *MinerSettingsUpdateReq) (*MinerSettings, int, error)
PostMinerSettings updates the miner settings of a pool.
func (*Client) UnmarshalMiner ¶ added in v0.3.0
func (*Client) UnmarshalMinerBalanceChanges ¶ added in v0.3.0
func (*Client) UnmarshalMinerDailyEarnings ¶ added in v0.3.0
func (*Client) UnmarshalMinerPayments ¶ added in v0.3.0
func (*Client) UnmarshalMinerPerformance ¶ added in v0.3.1
func (*Client) UnmarshalMinerSettings ¶ added in v0.3.0
func (*Client) UnmarshalMiners ¶ added in v0.3.0
func (*Client) UnmarshalPool ¶ added in v0.3.0
func (*Client) UnmarshalPoolBlocks ¶ added in v0.3.0
func (*Client) UnmarshalPoolPayments ¶ added in v0.3.0
func (*Client) UnmarshalPoolPerformance ¶ added in v0.3.0
func (*Client) UnmarshalPools ¶ added in v0.3.0
type ClientOpts ¶
type ClientOpts func(*Client)
ClientOpts are options for the client.
func WithJSONDecoder ¶ added in v0.3.3
func WithJSONDecoder(decoder func(data []byte, v interface{}) error) ClientOpts
WithJSONDecoder sets the JSON decoder for the client.
func WithJSONEncoder ¶ added in v0.3.3
func WithJSONEncoder(encoder func(v interface{}) ([]byte, error)) ClientOpts
WithJSONEncoder sets the JSON encoder for the client.
func WithTimeout ¶
func WithTimeout(t time.Duration) ClientOpts
WithTimout sets the default request timeout
func WithoutTLSVerfiy ¶
func WithoutTLSVerfiy() ClientOpts
WithoutTLSVerify disables TLS verification.
type DailyEarning ¶
type DailyEarningRes ¶ added in v0.2.1
type DailyEarningRes struct { *Meta Result []*DailyEarning `json:"result"` }
type HashRateUpdateMessage ¶
type MinerPerformanceStats ¶
type MinerSettings ¶ added in v0.2.0
type MinerSettings struct {
PaymentThreshold float64 `json:"paymentThreshold"`
}
type MinerSettingsUpdateReq ¶ added in v0.2.0
type MinerSettingsUpdateReq struct { IPAddress string `json:"ipAddress"` Settings *MinerSettings `json:"settings"` }
type MinerStats ¶
type MinerStats struct { PendingBalance float64 `json:"pendingBalance"` TotalPaid float64 `json:"totalPaid"` TodayPaid float64 `json:"todayPaid"` LastPayment string `json:"lastPayment"` LastPaymentLink string `json:"lastPaymentLink"` Performance *WorkerStats `json:"performance"` PerformanceSamples []*WorkerStats `json:"performanceSamples"` }
type Payment ¶
type Payment struct { Coin string `json:"coin,omitempty"` Address string `json:"address,omitempty"` AddressInfoLink string `json:"addressInfoLink,omitempty"` Amount float64 `json:"amount,omitempty"` TransactionConfirmationData string `json:"transactionConfirmationData,omitempty"` TransactionInfoLink string `json:"transactionInfoLink,omitempty"` Created string `json:"created,omitempty"` }
type PaymentMessage ¶
type PaymentMessage struct { PoolID string `json:"poolId"` Symbol string `json:"symbol"` TxFee float64 `json:"txFee"` TxIDs []string `json:"txIds"` TxExplorerLinks []string `json:"txExplorerLinks"` RecipientsCount int `json:"recipientsCount"` Amount float64 `json:"amount"` Error error `json:"error"` }
type PaymentRes ¶ added in v0.2.1
type PoolEndpoint ¶
type PoolEndpoint struct { ListenAddress string `json:"listenAddress"` Name string `json:"name"` Difficulty float64 `json:"difficulty"` TCPProxyProtocol *TCPProxyProtocolConfig `json:"tcpProxyProtocol"` VarDiff *VarDiffConfig `json:"varDiff"` TLS bool `json:"tls"` TLSAuto bool `json:"tlsAuto"` TLSPfxFile string `json:"tlsPfxFile"` TLSPfxPassword string `json:"tlsPfxPassword"` }
type PoolInfo ¶
type PoolInfo struct { ID string `json:"id"` Coin *ApiCoinConfig `json:"coin"` Ports map[string]PoolEndpoint `json:"ports"` PaymentProcessing *ApiPoolPaymentProcessingConfig `json:"paymentProcessing"` ClientConnectionTimeout int32 `json:"clientConnectionTimeout"` JobRebroadcastTimeout int32 `json:"jobRebroadcastTimeout"` BlockRefreshInterval int32 `json:"blockRefreshInterval"` PoolFeePercent float64 `json:"poolFeePercent"` Address string `json:"address"` AddressInfoLink string `json:"addressInfoLink"` PoolStats *PoolStats `json:"poolStats"` NetworkStats *BlockchainStats `json:"networkStats"` TopMiners []*MinerPerformanceStats `json:"topMiners"` TotalPaid float64 `json:"totalPaid"` TotalBlocks int32 `json:"totalBlocks"` LastPoolBlockTime string `json:"lastPoolBlockTime"` APIEndpoint string `json:"apiEndpoint"` }
type PoolPerformance ¶ added in v0.2.0
type PoolShareBasedBanningConfig ¶
type PoolShareBasedBanningConfig struct {}
type RawMessage ¶
type RawMessage struct {
Type string `json:"type"`
}
type TCPProxyProtocolConfig ¶
type VarDiffConfig ¶
type WebsocketMsg ¶
type WebsocketMsg string
const ( WsBlockFound WebsocketMsg = "blockfound" WsNewChainHeight WebsocketMsg = "newchainheight" WsPayment WebsocketMsg = "payment" WsBlockUnlockedProgress WebsocketMsg = "blockunlockedprogress" WsHashrateUpdated WebsocketMsg = "hashrateupdated" )
type WorkerPerformanceStats ¶
type WorkerStats ¶
type WorkerStats struct { Created string `json:"created"` Workers map[string]*WorkerPerformanceStats `json:"workers"` }