Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions mobius_client_python/blockchain/account.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from stellar_base.keypair import Keypair
from ..client import Client


class Account(object):
def __init__(self, account, keypair):
self.account = account
Expand All @@ -20,7 +21,7 @@ def reload(self):

return True

def trust_line_exsists(self,asset=None):
def trust_line_exsists(self, asset=None):
if not asset:
asset = self.client.get_stellar_asset()
balance = dict(self.find_balance(asset))
Expand All @@ -31,9 +32,8 @@ def next_sequence_value(self):
account = self.get_info()
return int(account['sequence']) + 1

def balance(self,asset=None):
if not asset:
asset = self.client.get_stellar_asset()
def balance(self, asset=None):
asset = self.client.get_stellar_asset()
return float(self.find_balance(asset)['balance'])

def get_keypair(self):
Expand All @@ -42,11 +42,11 @@ def get_keypair(self):
def get_info(self):
return self.account

def authorized(self,keypair):
def authorized(self, keypair):
return self.find_signer(public_key=keypair.address().decode())

def balance_match(self, asset, balance):
balance = dict(balance) # Bugfix for python 3.5
balance = dict(balance) # Bugfix for python 3.5
if asset.is_native():
return balance['asset_type'] == 'native'
else:
Expand All @@ -55,9 +55,9 @@ def balance_match(self, asset, balance):
asset_issuer_addr = Keypair.from_address(asset.issuer).address().decode()
return asset_code == asset.code and issuer == asset_issuer_addr

def find_balance(self,asset):
def find_balance(self, asset):
for item in self.account['balances']:
if self.balance_match(asset,item) == True:
if self.balance_match(asset, item):
return item

def find_signer(self,public_key):
Expand Down
2 changes: 1 addition & 1 deletion mobius_client_python/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def get_stellar_asset(self):
if self.stellar_asset:
return self.stellar_asset

stellar_asset = Asset(self.asset_code,self.get_asset_issuer())
stellar_asset = Asset(self.asset_code, self.get_asset_issuer())
self.stellar_asset = stellar_asset

return self.stellar_asset
Expand Down