Skip to content
This repository has been archived by the owner on Mar 24, 2021. It is now read-only.
/ twominers Public archive

A Golang wrapper for the 2miners API.

License

Notifications You must be signed in to change notification settings

stdfox/twominers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

This repository is no longer maintained

Issue reports and pull requests will not be attended.

twominers

A Golang wrapper for the 2miners API.

Documentation

Full API Documentation can be found at https://apidoc.2miners.com

All APIs return JSON format. Current API version: 2.0.0

Installation

go get github.com/stdfox/twominers

Importing

import (
    "github.com/stdfox/twominers"
)

Example

package main

import (
	"fmt"

	"github.com/stdfox/twominers"
)

func main() {
	client := twominers.New()

	account, err := client.GetAccounts(twominers.XMR, "WALLET_ID")
	if err != nil {
		panic(err)
	}

	fmt.Printf("Hashrate: %d, Payments Total: %d\n", account.Hashrate, account.PaymentsTotal)

	blocks, err := client.GetBlocks(twominers.XMR)
	if err != nil {
		panic(err)
	}

	fmt.Printf("Matured Total: %d\n", blocks.MaturedTotal)

	miners, err := client.GetMiners(twominers.XMR)
	if err != nil {
		panic(err)
	}

	fmt.Printf("Hashrate: %f, Miners Total: %d\n", miners.Hashrate, miners.MinersTotal)

	payments, err := client.GetPayments(twominers.XMR)
	if err != nil {
		panic(err)
	}

	fmt.Printf("Payments Total: %d\n", payments.PaymentsTotal)

	stats, err := client.GetStats(twominers.XMR)
	if err != nil {
		panic(err)
	}

	fmt.Printf("Candidates Total: %d\n", stats.CandidatesTotal)
}
$ go run main.go
Hashrate: 117528, Round Shares: 2835, Payments Total: 0
Matured Total: 134, Orphan Rate: 0.000000
Hashrate: 510126.000000, Miners Total: 82
Payments Total: 691
Candidates Total: 0

License

MIT License

About

A Golang wrapper for the 2miners API.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages