feature: add mara rpc API.

This commit is contained in:
Upstream Data
2024-08-20 08:37:40 -06:00
parent 168d68d0b2
commit 63522aad81
2 changed files with 36 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ from pyasic.errors import APIError
from pyasic.miners.data import DataFunction, DataLocations, DataOptions, WebAPICommand
from pyasic.miners.device.firmware import MaraFirmware
from pyasic.misc import merge_dicts
from pyasic.rpc.marathon import MaraRPCAPI
from pyasic.web.marathon import MaraWebAPI
MARA_DATA_LOC = DataLocations(
@@ -64,6 +65,8 @@ MARA_DATA_LOC = DataLocations(
class MaraMiner(MaraFirmware):
_rpc_cls = MaraRPCAPI
rpc: MaraRPCAPI
_web_cls = MaraWebAPI
web: MaraWebAPI

33
pyasic/rpc/marathon.py Normal file
View File

@@ -0,0 +1,33 @@
from pyasic.rpc.base import BaseMinerRPCAPI
class MaraRPCAPI(BaseMinerRPCAPI):
"""An abstraction of the MaraFW API.
Each method corresponds to an API command in MaraFW.
No documentation for this API is currently publicly available.
Additionally, every command not included here just returns the result of the `summary` command.
This class abstracts use of the MaraFW API, as well as the
methods for sending commands to it. The `self.send_command()`
function handles sending a command to the miner asynchronously, and
as such is the base for many of the functions in this class, which
rely on it to send the command for them.
"""
async def summary(self):
return await self.send_command("summary")
async def devs(self):
return await self.send_command("devs")
async def pools(self):
return await self.send_command("pools")
async def stats(self):
return await self.send_command("stats")
async def version(self):
return await self.send_command("version")