diff --git a/duniterpy/api/bma/blockchain.py b/duniterpy/api/bma/blockchain.py index a76e587bec03fe57602d0c0783f1c6742e806db2..87ed3203eecc8fd3dddc8fa4f2b82fa2ec51d42f 100644 --- a/duniterpy/api/bma/blockchain.py +++ b/duniterpy/api/bma/blockchain.py @@ -303,6 +303,38 @@ HARDSHIP_SCHEMA = { "required": ["block", "level"] } +DIFFICULTIES_SCHEMA = { + "type": "object", + "properties": { + "block": { + "type": "number" + }, + "levels": { + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "uid": { + "type": "string" + }, + "level": { + "type": "number" + } + }, + "required": [ + "uid", + "level" + ] + } + ] + } + }, + "required": [ + "block", + "levels" + ] +} async def parameters(client: Client) -> dict: """ @@ -391,6 +423,16 @@ async def hardship(client: Client, pubkey: str) -> dict: return await client.get(MODULE + '/hardship/%s' % pubkey, schema=HARDSHIP_SCHEMA) +async def difficulties(client: Client) -> dict: + """ + GET difficulties levels for members into current window for writing next block + + :param client: Client to connect to the api + :return: + """ + return await client.get(MODULE + '/difficulties', schema=DIFFICULTIES_SCHEMA) + + async def newcomers(client: Client) -> dict: """ GET the block numbers containing newcomers