From 840d96b05f04c0a562c82f6f0a31a2a00121f9ea Mon Sep 17 00:00:00 2001 From: MMGen Date: Fri, 1 Jun 2018 17:55:53 +0000 Subject: [PATCH] eth/obj.py,eth/tw.py,obj.py,tw.py: small fixes --- mmgen/altcoins/eth/obj.py | 2 +- mmgen/altcoins/eth/tw.py | 4 ++-- mmgen/obj.py | 3 ++- mmgen/tw.py | 11 ++++++----- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/mmgen/altcoins/eth/obj.py b/mmgen/altcoins/eth/obj.py index dd4868f5..8a27ca11 100755 --- a/mmgen/altcoins/eth/obj.py +++ b/mmgen/altcoins/eth/obj.py @@ -27,7 +27,7 @@ from mmgen.color import * from mmgen.obj import * class ETHAmt(BTCAmt): max_prec = 18 - max_amt = 999999999 # TODO + max_amt = None wei = Decimal('0.000000000000000001') Kwei = Decimal('0.000000000000001') Mwei = Decimal('0.000000000001') diff --git a/mmgen/altcoins/eth/tw.py b/mmgen/altcoins/eth/tw.py index 94d88e24..c74d072c 100755 --- a/mmgen/altcoins/eth/tw.py +++ b/mmgen/altcoins/eth/tw.py @@ -106,8 +106,8 @@ class EthereumTwUnspentOutputs(TwUnspentOutputs): show_txid = False can_group = False hdr_fmt = 'TRACKED ACCOUNTS (sort order: {})\nTotal {}: {}' - wide_hdr_title = 'Account balances' - dump_fn = 'balances-' + g.coin + desc = 'account balances' + dump_fn_pfx = 'balances' prompt = """ Sort options: [a]mount, a[d]dress, [A]ge, [r]everse, [M]mgen addr Display options: show [D]ays, show [m]mgen addr, r[e]draw screen diff --git a/mmgen/obj.py b/mmgen/obj.py index f0922d4d..1a5e6c18 100755 --- a/mmgen/obj.py +++ b/mmgen/obj.py @@ -328,7 +328,8 @@ class BTCAmt(Decimal,Hilite,InitErrors): assert type(num) is not t,"number is of forbidden type '{}'".format(t.__name__) me = Decimal.__new__(cls,str(num)) assert me.normalize().as_tuple()[-1] >= -cls.max_prec,'too many decimal places in coin amount' - assert me <= cls.max_amt,'coin amount too large (>{})'.format(cls.max_amt) + if cls.max_amt: + assert me <= cls.max_amt,'{}: coin amount too large (>{})'.format(me,cls.max_amt) assert me >= 0,'coin amount cannot be negative' return me except Exception as e: diff --git a/mmgen/tw.py b/mmgen/tw.py index e5082cfb..15d4bb31 100755 --- a/mmgen/tw.py +++ b/mmgen/tw.py @@ -32,8 +32,8 @@ class TwUnspentOutputs(MMGenObject): show_txid = True can_group = True hdr_fmt = 'UNSPENT OUTPUTS (sort order: {}) Total {}: {}' - wide_hdr_title = 'Unspent outputs' - dump_fn = 'listunspent-' + g.coin + desc = 'unspent outputs' + dump_fn_pfx = 'listunspent' prompt = """ Sort options: [t]xid, [a]mount, a[d]dress, [A]ge, [r]everse, [M]mgen addr Display options: show [D]ays, [g]roup, show [m]mgen addr, r[e]draw screen @@ -256,7 +256,7 @@ watch-only wallet using '{}-addrimport' and then re-run this program. fs = '{} ({} UTC)\nSort order: {}\n{}\n\nTotal {}: {}\n' self.fmt_print = fs.format( - self.wide_hdr_title, + capfirst(self.desc), make_timestr(), ' '.join(self.sort_info(include_group=False)), '\n'.join(out), @@ -324,8 +324,9 @@ watch-only wallet using '{}-addrimport' and then re-run this program. elif reply == 'm': self.show_mmid = not self.show_mmid elif reply == 'p': msg('') - of = '{}[{}].out'.format(self.dump_fn,','.join(self.sort_info(include_group=False)).lower()) - write_data_to_file(of,self.format_for_printing(),'unspent outputs listing') + of = '{}-{}[{}].out'.format(self.dump_fn_pfx,g.coin, + ','.join(self.sort_info(include_group=False)).lower()) + write_data_to_file(of,self.format_for_printing(),'{} listing'.format(self.desc)) m = yellow("Data written to '{}'".format(of)) msg('\n{}\n{}\n\n{}'.format(self.fmt_display,m,prompt)) continue