From a8d19c6a5f638d6db0b1a62733b6072550140055 Mon Sep 17 00:00:00 2001 From: Sam Barnes Date: Fri, 4 Oct 2019 11:37:24 -0500 Subject: [PATCH] Add get_pegnet_balances --- README.md | 18 ++++++++++++++---- fat_py/client.py | 4 ++++ requirements.txt | 1 + 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e285f87..4787367 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,18 @@ Kinda ugly, very alpha. ## Usage ``` -import fat_py -fatd = fat_py.FATd() -fatd.get_sync_status() +>>> import fat_py +>>> fatd = fat_py.FATd() +>>> fatd.get_sync_status() {'syncheight': 62, 'factomheight': 62} -``` \ No newline at end of file +``` + +Get PegNet Balances +``` +>>> import fat_py +>>> from factom_keys.fct import FactoidAddress +>>> fatd = fat_py.FATd() +>>> address = FactoidAddress(address_string="FA2jK2HcLnRdS94dEcU27rF3meoJfpUcZPSinpb7AwQvPRY6RL1Q") +>>> fatd.get_pegnet_balances(address) +{'PEG': 0, 'pADA': 0, 'pBNB': 0, 'pBRL': 0, 'pCAD': 0, 'pCHF': 0, 'pCNY': 0, 'pDAS': 0, 'pDCR': 0, 'pETH': 0, 'pEUR': 0, 'pFCT': 0, 'pGBP': 0, 'pHKD': 0, 'pINR': 0, 'pJPY': 0, 'pKRW': 0, 'pLTC': 0, 'pMXN': 0, 'pPHP': 0, 'pRVN': 0, 'pSGD': 0, 'pUSD': 0, 'pXAG': 0, 'pXAU': 0, 'pXBC': 0, 'pXBT': 0, 'pXLM': 0, 'pXMR': 0, 'pZEC': 0} +``` diff --git a/fat_py/client.py b/fat_py/client.py index afb7e9a..d089a73 100644 --- a/fat_py/client.py +++ b/fat_py/client.py @@ -1,6 +1,7 @@ import random import string from urllib.parse import urljoin +from factom_keys.fct import FactoidAddress from .errors import handle_error_response from .session import APISession @@ -72,3 +73,6 @@ def get_sync_status(self): """Retrieve the current sync status of the node.""" return self._request("get-sync-status") + def get_pegnet_balances(self, address: FactoidAddress): + """Retrieve all current pegnet balances for the given address""" + return self._request("get-pegnet-balances", {"address": address.to_string()}) diff --git a/requirements.txt b/requirements.txt index 663bd1f..55a6266 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ +factom-keys requests \ No newline at end of file