Skip to content

Commit

Permalink
Add get_pegnet_balances
Browse files Browse the repository at this point in the history
  • Loading branch information
sambarnes committed Oct 4, 2019
1 parent d0f8fd0 commit a8d19c6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}
```
```

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}
```
4 changes: 4 additions & 0 deletions fat_py/client.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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()})
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
factom-keys
requests

0 comments on commit a8d19c6

Please sign in to comment.