From 7d822aeec0e5588bf49383b2cd955dd14cb63fca Mon Sep 17 00:00:00 2001 From: vtexier <vit@free.fr> Date: Sun, 16 Dec 2018 13:16:44 +0100 Subject: [PATCH] Add blockchain/with/revoked and blockchain/branches in bma api --- duniterpy/api/bma/blockchain.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/duniterpy/api/bma/blockchain.py b/duniterpy/api/bma/blockchain.py index 1a2d3902..ab1fb973 100644 --- a/duniterpy/api/bma/blockchain.py +++ b/duniterpy/api/bma/blockchain.py @@ -342,6 +342,14 @@ DIFFICULTIES_SCHEMA = { ] } +BRANCHES_SCHEMA = { + "type": "object", + "properties": { + "blocks": BLOCKS_SCHEMA + } +} + + async def parameters(client: Client) -> dict: """ GET the blockchain parameters used by this node @@ -439,6 +447,16 @@ async def difficulties(client: Client) -> dict: return await client.get(MODULE + '/difficulties', schema=DIFFICULTIES_SCHEMA) +async def branches(client: Client) -> list: + """ + GET current branches of the node (top block of each branch) + + :param client: Client to connect to the api + :return: + """ + return await client.get(MODULE + '/branches', schema=BRANCHES_SCHEMA) + + async def newcomers(client: Client) -> dict: """ GET the block numbers containing newcomers @@ -489,6 +507,16 @@ async def leavers(client: Client) -> dict: return await client.get(MODULE + '/with/leavers', schema=BLOCK_NUMBERS_SCHEMA) +async def revoked(client: Client) -> dict: + """ + GET the block numbers containing revoked members. + + :param client: Client to connect to the api + :return: + """ + return await client.get(MODULE + '/with/excluded', schema=BLOCK_NUMBERS_SCHEMA) + + async def excluded(client: Client) -> dict: """ GET the block numbers containing excluded -- GitLab