Skip to content

Commit

Permalink
follow-up prev commit, handle missing token types
Browse files Browse the repository at this point in the history
  • Loading branch information
jcramer committed Jan 30, 2021
1 parent 3560f06 commit f7bf6f5
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -1933,13 +1933,20 @@ def fmt_slp_amt(v, decimals):
if v is None:
return '--'
if decimals == "?":
return '?'
decimals = 0
return format_satoshis(v, decimal_point=int(decimals), is_diff=True)

def get_token_info(token_id):
return self.token_types.get(token_id, {
'class': '?',
'decimals': 0,
'name': 'unknown'
})

slp_h = dict((tx_hash, { \
'value': fmt_slp_amt(delta, self.token_types[token_id]['decimals']), \
'value': fmt_slp_amt(delta, get_token_info(token_id)['decimals']), \
'token_id': token_id, \
'name': self.token_types[token_id]['name'] \
'name': get_token_info(token_id)['name'] \
}) for tx_hash, _, _, _, delta, token_id in _slp_h)

def get_slp_tx(tx_hash):
Expand Down

0 comments on commit f7bf6f5

Please sign in to comment.