Improve mining pool interface, added GoBrrr pool, Public Pool and Satoshi Radio pool

This commit is contained in:
Djuri 2024-12-20 04:00:09 +01:00
parent f613c7e9a1
commit aeee5238b3
19 changed files with 274 additions and 26 deletions

View file

@ -1,15 +1,15 @@
// src/noderunners/noderunners_pool.cpp
#include "noderunners_pool.hpp"
void NodeRunnersPool::prepareRequest(HTTPClient& http) const {
void NoderunnersPool::prepareRequest(HTTPClient& http) const {
// Empty as NodeRunners doesn't need special headers
}
std::string NodeRunnersPool::getApiUrl() const {
std::string NoderunnersPool::getApiUrl() const {
return "https://pool.noderunners.network/api/v1/users/" + poolUser;
}
PoolStats NodeRunnersPool::parseResponse(const JsonDocument& doc) const {
PoolStats NoderunnersPool::parseResponse(const JsonDocument& doc) const {
std::string hashrateStr = doc["hashrate1m"].as<std::string>();
char unit = hashrateStr.back();
std::string value = hashrateStr.substr(0, hashrateStr.size() - 1);
@ -22,7 +22,7 @@ PoolStats NodeRunnersPool::parseResponse(const JsonDocument& doc) const {
};
}
LogoData NodeRunnersPool::getLogo() const {
LogoData NoderunnersPool::getLogo() const {
return LogoData {
.data = epd_icons_allArray[6],
.width = 122,
@ -30,7 +30,10 @@ LogoData NodeRunnersPool::getLogo() const {
};
}
int NodeRunnersPool::getHashrateMultiplier(char unit) {
int NoderunnersPool::getHashrateMultiplier(char unit) {
if (unit == '0')
return 0;
static const std::unordered_map<char, int> multipliers = {
{'Z', 21}, {'E', 18}, {'P', 15}, {'T', 12},
{'G', 9}, {'M', 6}, {'K', 3}

View file

@ -4,7 +4,7 @@
#include "lib/mining_pool/mining_pool_interface.hpp"
#include <icons/icons.h>
class NodeRunnersPool : public MiningPoolInterface {
class NoderunnersPool : public MiningPoolInterface {
public:
void setPoolUser(const std::string& user) override { poolUser = user; }
@ -14,7 +14,9 @@ public:
LogoData getLogo() const override;
bool supportsDailyEarnings() const override { return false; }
std::string getDailyEarningsLabel() const override { return ""; }
bool hasLogo() const override { return true; }
std::string getDisplayLabel() const override { return "NODE/RUNNERS"; } // Fallback if needed
private:
protected:
static int getHashrateMultiplier(char unit);
};