hpool

package module
v0.0.0-...-b87f4e8 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2022 License: MIT Imports: 10 Imported by: 2

README

go-hpool

Documentation

Overview

Package Hpool is an implementation of the Hpool API in Golang.

Index

Constants

View Source
const (
	API_BASE = "https://www.hpool.in/api" // Hpool API endpoint
)

Variables

View Source
var ErrUnauthorizedAccess = errors.New("Unauthorized access")

Functions

func NewClient

func NewClient(accessToken string) (c *client)

NewClient return a new Hpool HTTP client

func NewClientWithCustomHttpConfig

func NewClientWithCustomHttpConfig(accessToken string, httpClient *http.Client) (c *client)

NewClientWithCustomHttpConfig returns a new Hpool HTTP client using the predefined http client

func NewClientWithCustomTimeout

func NewClientWithCustomTimeout(accessToken string, timeout time.Duration) (c *client)

NewClient returns a new Hpool HTTP client with custom timeout

Types

type Assets

type Assets struct {
	Balance           float64 `json:"balance,string"`
	CooperationAmount float64 `json:"cooperation_amount,string"`
	DepositAmount     float64 `json:"deposit_amount,string"`
	FreezeBalance     float64 `json:"freeze_balance,string"`
	Name              string  `json:"name"`
	Type              string  `json:"type"`
	TotalAssets       float64 `json:"total_assets,string"`
	WithdrawAmount    float64 `json:"withdraw_amount,string"`
}

type Hpool

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

hpool represent a hpool client

func New

func New(accessToken string) *Hpool

New returns an instantiated hpool struct

func NewWithCustomHttpClient

func NewWithCustomHttpClient(accessToken string, httpClient *http.Client) *Hpool

NewWithCustomHttpClient returns an instantiated hpool struct with custom http client

func NewWithCustomTimeout

func NewWithCustomTimeout(accessToken string, timeout time.Duration) *Hpool

NewWithCustomTimeout returns an instantiated hpool struct with custom timeout

func (*Hpool) Miners

func (i *Hpool) Miners(pool string) (miners []Miner, err error)

func (*Hpool) MiningIncome

func (i *Hpool) MiningIncome(pool string) (miningIncomes []MiningIncome, err error)

func (*Hpool) Plots

func (i *Hpool) Plots(pool string) (plots []Plot, err error)

func (*Hpool) PoolDetail

func (i *Hpool) PoolDetail(pool string) (poolDetail Pool, err error)

func (*Hpool) PoolList

func (i *Hpool) PoolList(poolType PoolType) (pools []Pool, err error)

func (*Hpool) SetDebug

func (i *Hpool) SetDebug(enable bool)

set enable/disable http request/response dump

func (*Hpool) Totalassets

func (i *Hpool) Totalassets() (assets []Assets, err error)

type Miner

type Miner struct {
	Name       string `json:"miner_name"`
	Id         string `json:"id"`
	Capacity   int    `json:"capacity"`
	Online     bool   `json:"online"`
	UpdateTime int    `json:"update_time"`
}

type MiningIncome

type MiningIncome struct {
	Amount     float64 `json:"amount,string"`
	Coin       string  `json:"coin"`
	Name       string  `json:"name"`
	Type       string  `json:"type"`
	RecordTime int     `json:"record_time"`
}

type Plot

type Plot struct {
	Capacity  int64  `json:"capacity"`
	PublicKey string `json:"public_key"`
	Size      int64  `json:"size"`
	Status    string `json:"status"`
	Uuid      string `json:"uuid"`
	UpdatedAt int    `json:"updated_at"`
}

type Pool

type Pool struct {
	ApiKey                          string  `json:"api_key"`
	BlockReward                     float64 `json:"block_reward,string"`
	BlockTime                       int     `json:"block_time"`
	Capacity                        int     `json:"capacity"`
	Coin                            string  `json:"coin"`
	DepositMortgageBalance          float64 `json:"deposit_mortgage_balance,string"`
	DepositMortgageEffectiveBalance float64 `json:"deposit_mortgage_effective_balance,string"`
	DepositMortgageFreeBalance      float64 `json:"deposit_mortgage_free_balance,string"`
	DepositRate                     float64 `json:"deposit_rate,string"`
	Fee                             float64 `json:"fee"`
	LoanMortgageBalance             float64 `json:"loan_mortgage_balance,string"`
	Mortgage                        float64 `json:"mortgage,string"`
	Name                            string  `json:"name"`
	Offline                         int     `json:"offline"`
	Online                          int     `json:"online"`
	PaymentTime                     string  `json:"payment_time"`
	PointDepositBalance             float64 `json:"point_deposit_balance,string"`
	PoolAddress                     string  `json:"pool_address"`
	PoolIncome                      float64 `json:"pool_income,string"`
	PoolType                        string  `json:"pool_type"`
	PreviousIncomePb                float64 `json:"previous_income_pb,string"`
	TheoryMortgageBalance           float64 `json:"theory_mortgage_balance,string"`
	Type                            string  `json:"type"`
	UndistributedIncome             float64 `json:"undistributed_income,string"`
}

type PoolType

type PoolType int
const (
	Opened PoolType = iota + 1
	All
)

func (PoolType) String

func (w PoolType) String() string

Jump to

Keyboard shortcuts

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