Browse Source

eth/obj.py,eth/tw.py,obj.py,tw.py: small fixes

MMGen 7 years ago
parent
commit
840d96b05f
4 changed files with 11 additions and 9 deletions
  1. 1 1
      mmgen/altcoins/eth/obj.py
  2. 2 2
      mmgen/altcoins/eth/tw.py
  3. 2 1
      mmgen/obj.py
  4. 6 5
      mmgen/tw.py

+ 1 - 1
mmgen/altcoins/eth/obj.py

@@ -27,7 +27,7 @@ from mmgen.color import *
 from mmgen.obj import *
 from mmgen.obj import *
 class ETHAmt(BTCAmt):
 class ETHAmt(BTCAmt):
 	max_prec = 18
 	max_prec = 18
-	max_amt = 999999999 # TODO
+	max_amt = None
 	wei     = Decimal('0.000000000000000001')
 	wei     = Decimal('0.000000000000000001')
 	Kwei    = Decimal('0.000000000000001')
 	Kwei    = Decimal('0.000000000000001')
 	Mwei    = Decimal('0.000000000001')
 	Mwei    = Decimal('0.000000000001')

+ 2 - 2
mmgen/altcoins/eth/tw.py

@@ -106,8 +106,8 @@ class EthereumTwUnspentOutputs(TwUnspentOutputs):
 	show_txid = False
 	show_txid = False
 	can_group = False
 	can_group = False
 	hdr_fmt = 'TRACKED ACCOUNTS (sort order: {})\nTotal {}: {}'
 	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 = """
 	prompt = """
 Sort options: [a]mount, a[d]dress, [A]ge, [r]everse, [M]mgen addr
 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
 Display options: show [D]ays, show [m]mgen addr, r[e]draw screen

+ 2 - 1
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__)
 					assert type(num) is not t,"number is of forbidden type '{}'".format(t.__name__)
 				me = Decimal.__new__(cls,str(num))
 				me = Decimal.__new__(cls,str(num))
 			assert me.normalize().as_tuple()[-1] >= -cls.max_prec,'too many decimal places in coin amount'
 			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'
 			assert me >= 0,'coin amount cannot be negative'
 			return me
 			return me
 		except Exception as e:
 		except Exception as e:

+ 6 - 5
mmgen/tw.py

@@ -32,8 +32,8 @@ class TwUnspentOutputs(MMGenObject):
 	show_txid = True
 	show_txid = True
 	can_group = True
 	can_group = True
 	hdr_fmt = 'UNSPENT OUTPUTS (sort order: {}) Total {}: {}'
 	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 = """
 	prompt = """
 Sort options: [t]xid, [a]mount, a[d]dress, [A]ge, [r]everse, [M]mgen addr
 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
 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'
 		fs = '{} ({} UTC)\nSort order: {}\n{}\n\nTotal {}: {}\n'
 		self.fmt_print = fs.format(
 		self.fmt_print = fs.format(
-				self.wide_hdr_title,
+				capfirst(self.desc),
 				make_timestr(),
 				make_timestr(),
 				' '.join(self.sort_info(include_group=False)),
 				' '.join(self.sort_info(include_group=False)),
 				'\n'.join(out),
 				'\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 == 'm': self.show_mmid = not self.show_mmid
 			elif reply == 'p':
 			elif reply == 'p':
 				msg('')
 				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))
 				m = yellow("Data written to '{}'".format(of))
 				msg('\n{}\n{}\n\n{}'.format(self.fmt_display,m,prompt))
 				msg('\n{}\n{}\n\n{}'.format(self.fmt_display,m,prompt))
 				continue
 				continue