making adjustments so that local app works with prod db

This commit is contained in:
lza_menace 2020-10-06 01:41:05 -07:00
parent 7c169ffb46
commit 994271653c
2 changed files with 11 additions and 1 deletions

View file

@ -33,7 +33,7 @@ def read(id):
post = Post.get(id=id)
comments = Comment.select().where(Comment.post==post.id)
if wallet.connected:
address = wallet.addresses(account=post.account_index)[0]
address = wallet.get_address(account=post.account_index)
transfers = wallet.transfers(account=post.account_index)
else:
address = "?"

View file

@ -72,11 +72,21 @@ class Wallet(object):
if addr_indices:
qdata['address_index'] = addr_indices
_addresses = self.make_wallet_rpc('get_address', qdata)
if 'message' in _addresses:
return None
addresses = [None] * (max(map(operator.itemgetter('address_index'), _addresses['addresses'])) + 1)
for _addr in _addresses['addresses']:
addresses[_addr['address_index']] = _addr['address']
return addresses
def get_address(self, account):
qdata = {'account_index': account}
_addresses = self.make_wallet_rpc('get_address', qdata)
if 'address' in _addresses:
return _addresses['address']
else:
return None
def new_address(self, account, label=None):
data = {'account_index': account, 'label': label}
_address = self.make_wallet_rpc('create_address', data)