feature: add mara rpc API.
This commit is contained in:
@@ -7,6 +7,7 @@ from pyasic.errors import APIError
|
|||||||
from pyasic.miners.data import DataFunction, DataLocations, DataOptions, WebAPICommand
|
from pyasic.miners.data import DataFunction, DataLocations, DataOptions, WebAPICommand
|
||||||
from pyasic.miners.device.firmware import MaraFirmware
|
from pyasic.miners.device.firmware import MaraFirmware
|
||||||
from pyasic.misc import merge_dicts
|
from pyasic.misc import merge_dicts
|
||||||
|
from pyasic.rpc.marathon import MaraRPCAPI
|
||||||
from pyasic.web.marathon import MaraWebAPI
|
from pyasic.web.marathon import MaraWebAPI
|
||||||
|
|
||||||
MARA_DATA_LOC = DataLocations(
|
MARA_DATA_LOC = DataLocations(
|
||||||
@@ -64,6 +65,8 @@ MARA_DATA_LOC = DataLocations(
|
|||||||
|
|
||||||
|
|
||||||
class MaraMiner(MaraFirmware):
|
class MaraMiner(MaraFirmware):
|
||||||
|
_rpc_cls = MaraRPCAPI
|
||||||
|
rpc: MaraRPCAPI
|
||||||
_web_cls = MaraWebAPI
|
_web_cls = MaraWebAPI
|
||||||
web: MaraWebAPI
|
web: MaraWebAPI
|
||||||
|
|
||||||
|
|||||||
33
pyasic/rpc/marathon.py
Normal file
33
pyasic/rpc/marathon.py
Normal 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")
|
||||||
Reference in New Issue
Block a user