chia

package
v0.0.0-...-b1fe2b4 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteCountSI

func ByteCountSI(b uint64) string

func CreateSqlSchema

func CreateSqlSchema() error

func FetchChiaMap

func FetchChiaMap() error

func FetchChiaPrice

func FetchChiaPrice(coin_id int) error

func FetchCoinData

func FetchCoinData(coin_name string) (int, error)

func ParseDate

func ParseDate(date []byte) (time.Time, error)

func TableChiaMapInsert

func TableChiaMapInsert(id int, coin_id int, coin_rank int, coin_name string, symbol string, coin_ts string) error

func TableChiaPricesInsert

func TableChiaPricesInsert(data *CoinMarketCapSymbolResponse) error

Types

type ChiaBlockchainState

type ChiaBlockchainState struct {
	BlockchainState struct {
		Difficulty                  int  `json:"difficulty"`
		GenesisChallengeInitialized bool `json:"genesis_challenge_initialized"`
		MempoolSize                 int  `json:"mempool_size"`
		Peak                        struct {
			ChallengeBlockInfoHash string `json:"challenge_block_info_hash"`
			ChallengeVdfOutput     struct {
				Data string `json:"data"`
			} `json:"challenge_vdf_output"`
			Deficit                            int         `json:"deficit"`
			FarmerPuzzleHash                   string      `json:"farmer_puzzle_hash"`
			Fees                               int         `json:"fees"`
			FinishedChallengeSlotHashes        interface{} `json:"finished_challenge_slot_hashes"`
			FinishedInfusedChallengeSlotHashes interface{} `json:"finished_infused_challenge_slot_hashes"`
			FinishedRewardSlotHashes           interface{} `json:"finished_reward_slot_hashes"`
			HeaderHash                         string      `json:"header_hash"`
			Height                             int         `json:"height"`
			InfusedChallengeVdfOutput          struct {
				Data string `json:"data"`
			} `json:"infused_challenge_vdf_output"`
			Overflow                   bool   `json:"overflow"`
			PoolPuzzleHash             string `json:"pool_puzzle_hash"`
			PrevHash                   string `json:"prev_hash"`
			PrevTransactionBlockHash   string `json:"prev_transaction_block_hash"`
			PrevTransactionBlockHeight int    `json:"prev_transaction_block_height"`
			RequiredIters              int    `json:"required_iters"`
			RewardClaimsIncorporated   []struct {
				Amount         int64  `json:"amount"`
				ParentCoinInfo string `json:"parent_coin_info"`
				PuzzleHash     string `json:"puzzle_hash"`
			} `json:"reward_claims_incorporated"`
			RewardInfusionNewChallenge string      `json:"reward_infusion_new_challenge"`
			SignagePointIndex          int         `json:"signage_point_index"`
			SubEpochSummaryIncluded    interface{} `json:"sub_epoch_summary_included"`
			SubSlotIters               int         `json:"sub_slot_iters"`
			Timestamp                  int         `json:"timestamp"`
			TotalIters                 int         `json:"total_iters"`
			Weight                     int         `json:"weight"`
		} `json:"peak"`
		Space        uint64 `json:"space"`
		SubSlotIters int    `json:"sub_slot_iters"`
		Sync         struct {
			SyncMode           bool `json:"sync_mode"`
			SyncProgressHeight int  `json:"sync_progress_height"`
			SyncTipHeight      int  `json:"sync_tip_height"`
			Synced             bool `json:"synced"`
		} `json:"sync"`
	} `json:"blockchain_state"`
	Success bool `json:"success"`
}

type ChiaClient

type ChiaClient struct {
	HTTPClient *http.Client
}

func NewClient

func NewClient(CertificateFile string, PrivateKey string, CACertificatePath string) *ChiaClient

func (*ChiaClient) GetChiaBlockchainState

func (c *ChiaClient) GetChiaBlockchainState(url string) (ChiaBlockchainState, error)

func (*ChiaClient) GetChiaPlots

func (c *ChiaClient) GetChiaPlots(url string) (ChiaPlots, error)

func (*ChiaClient) GetChiaWallet

func (c *ChiaClient) GetChiaWallet(url string) (WalletBallance, error)

type ChiaCryptocurrencyMapResponse

type ChiaCryptocurrencyMapResponse struct {
	Data []struct {
		ID                  int         `json:"id"`
		Rank                int         `json:"rank"`
		Name                string      `json:"name"`
		Symbol              string      `json:"symbol"`
		Slug                string      `json:"slug"`
		IsActive            int         `json:"is_active"`
		FirstHistoricalData time.Time   `json:"first_historical_data"`
		LastHistoricalData  time.Time   `json:"last_historical_data"`
		Platform            interface{} `json:"platform"`
	} `json:"data"`
	Status struct {
		Timestamp    time.Time `json:"timestamp"`
		ErrorCode    int       `json:"error_code"`
		ErrorMessage string    `json:"error_message"`
		Elapsed      int       `json:"elapsed"`
		CreditCount  int       `json:"credit_count"`
	} `json:"status"`
}

type ChiaPlots

type ChiaPlots struct {
	Plots []struct {
		FileSize               int64       `json:"file_size"`
		Filename               string      `json:"filename"`
		PlotSeed               string      `json:"plot-seed"`
		PlotPublicKey          string      `json:"plot_public_key"`
		PoolContractPuzzleHash interface{} `json:"pool_contract_puzzle_hash"`
		PoolPublicKey          string      `json:"pool_public_key"`
		Size                   int         `json:"size"`
		TimeModified           float64     `json:"time_modified"`
	} `json:"plots"`
	FailedToOpenFilenames []interface{} `json:"failed_to_open_filenames"`
	NotFoundFilenames     []interface{} `json:"not_found_filenames"`
}

type ChiaTableDbResponse

type ChiaTableDbResponse struct {
	UpdateId         int64
	ChiaPrice        float64
	PercentChange1H  float64
	PercentChange24h float64
	TotalSupply      float64
}

func FetchChiaPriceDB

func FetchChiaPriceDB() *ChiaTableDbResponse

type CoinMarketCapSymbolResponse

type CoinMarketCapSymbolResponse struct {
	Status struct {
		Timestamp    time.Time   `json:"timestamp"`
		ErrorCode    int         `json:"error_code"`
		ErrorMessage interface{} `json:"error_message"`
		Elapsed      int         `json:"elapsed"`
		CreditCount  int         `json:"credit_count"`
		Notice       interface{} `json:"notice"`
	} `json:"status"`
	Data struct {
		Num9258 struct {
			ID                int           `json:"id"`
			Name              string        `json:"name"`
			Symbol            string        `json:"symbol"`
			Slug              string        `json:"slug"`
			NumMarketPairs    int           `json:"num_market_pairs"`
			DateAdded         time.Time     `json:"date_added"`
			Tags              []interface{} `json:"tags"`
			MaxSupply         interface{}   `json:"max_supply"`
			CirculatingSupply int           `json:"circulating_supply"`
			TotalSupply       int           `json:"total_supply"`
			IsActive          int           `json:"is_active"`
			Platform          interface{}   `json:"platform"`
			CmcRank           int           `json:"cmc_rank"`
			IsFiat            int           `json:"is_fiat"`
			LastUpdated       time.Time     `json:"last_updated"`
			Quote             struct {
				Usd struct {
					Price            float64   `json:"price"`
					Volume24H        float64   `json:"volume_24h"`
					PercentChange1H  float64   `json:"percent_change_1h"`
					PercentChange24H float64   `json:"percent_change_24h"`
					PercentChange7D  float64   `json:"percent_change_7d"`
					PercentChange30D int       `json:"percent_change_30d"`
					PercentChange60D int       `json:"percent_change_60d"`
					PercentChange90D int       `json:"percent_change_90d"`
					MarketCap        int       `json:"market_cap"`
					LastUpdated      time.Time `json:"last_updated"`
				} `json:"USD"`
			} `json:"quote"`
		} `json:"9258"`
	} `json:"data"`
}

type DiskSpace

type DiskSpace struct {
	TotalDiskSpace      string
	TotalDiskSpaceBytes uint64
	TotalFreeSpace      string
	TotalFreeSpaceBytes uint64
	TotalPercent        float64
}

func PrintUsage

func PrintUsage(path string) (*DiskSpace, error)

Prints disk usage

type Line

type Line struct {
	Rest       []byte
	Time       []byte
	Plots      int
	Block      []byte
	Proofs     int
	ParseTime  float64
	PlotsCount int
}

filename: line.lde 2021-05-21T20:36:36.960 harvester chia.harvester.harvester: INFO 4 plots were eligible for farming 8b1b2e42f0... Found 0 proofs. Time: 0.71902 s. Total 1509 plots

func ParseLogs

func ParseLogs(delay int) []Line

func (*Line) Extract

func (p *Line) Extract(line []byte) (bool, error)

Extract ...

type WalletBallance

type WalletBallance struct {
	Success       bool `json:"success"`
	WalletBalance struct {
		ConfirmedWalletBalance   int `json:"confirmed_wallet_balance"`
		MaxSendAmount            int `json:"max_send_amount"`
		PendingChange            int `json:"pending_change"`
		SpendableBalance         int `json:"spendable_balance"`
		UnconfirmedWalletBalance int `json:"unconfirmed_wallet_balance"`
		WalletID                 int `json:"wallet_id"`
	} `json:"wallet_balance"`
}

Jump to

Keyboard shortcuts

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