Browse Source

minor fixes and cleanups

The MMGen Project 3 weeks ago
parent
commit
dc30edba48

+ 3 - 3
mmgen/main_txcreate.py

@@ -72,13 +72,13 @@ opts_data = {
 		'usage': lambda cfg, proto, help_notes, s: s.format(
 			u_args = help_notes('txcreate_args')),
 		'options': lambda cfg, proto, help_notes, s: s.format(
+			cfg    = cfg,
+			cu     = proto.coin,
 			a_info = help_notes('account_info_desc'),
 			fu     = help_notes('rel_fee_desc'),
 			fl     = help_notes('fee_spec_letters'),
 			fe_all = fmt_list(cfg._autoset_opts['fee_estimate_mode'].choices, fmt='no_spc'),
-			fe_dfl = cfg._autoset_opts['fee_estimate_mode'].choices[0],
-			cu     = proto.coin,
-			cfg    = cfg),
+			fe_dfl = cfg._autoset_opts['fee_estimate_mode'].choices[0]),
 		'notes': lambda cfg, help_notes, s: s.format(
 			c      = help_notes('txcreate'),
 			F      = help_notes('fee'),

+ 4 - 4
mmgen/main_txdo.py

@@ -107,6 +107,7 @@ column below:
 		'options': lambda cfg, proto, help_notes, s: s.format(
 			gc      = gc,
 			cfg     = cfg,
+			cu      = proto.coin,
 			pnm     = gc.proj_name,
 			pnl     = gc.proj_name.lower(),
 			a_info  = help_notes('account_info_desc'),
@@ -114,12 +115,11 @@ column below:
 			coin_id = help_notes('coin_id'),
 			fu      = help_notes('rel_fee_desc'),
 			fl      = help_notes('fee_spec_letters'),
+			dsl     = help_notes('dfl_seed_len'),
 			ss      = help_notes('dfl_subseeds'),
 			ss_max  = SubSeedIdxRange.max_idx,
 			fe_all  = fmt_list(cfg._autoset_opts['fee_estimate_mode'].choices, fmt='no_spc'),
-			fe_dfl  = cfg._autoset_opts['fee_estimate_mode'].choices[0],
-			dsl     = help_notes('dfl_seed_len'),
-			cu      = proto.coin),
+			fe_dfl  = cfg._autoset_opts['fee_estimate_mode'].choices[0]),
 		'notes': lambda cfg, help_notes, s: s.format(
 			c       = help_notes('txcreate'),
 			F       = help_notes('fee'),
@@ -159,7 +159,7 @@ async def main():
 		tx4 = await SentTX(cfg=cfg, data=tx3.__dict__)
 		if await tx4.send():
 			tx4.file.write(ask_overwrite=False, ask_write=False)
-			tx4.print_contract_addr()
+			tx4.post_write()
 	else:
 		die(2, 'Transaction could not be signed')
 

+ 1 - 1
mmgen/main_txsend.py

@@ -120,6 +120,6 @@ async def main():
 			outdir        = asi.txauto_dir if cfg.autosign else None,
 			ask_overwrite = False,
 			ask_write     = False)
-		tx2.print_contract_addr()
+		tx2.post_write()
 
 async_run(main())

+ 1 - 1
mmgen/proto/btc/tx/base.py

@@ -176,7 +176,7 @@ class Base(TxBase.Base):
 
 	class Output(TxBase.Base.Output): # output contains either addr or data, but not both
 		addr = ListItemAttr(CoinAddr, include_proto=True) # ImmutableAttr in parent cls
-		data = ListItemAttr(OpReturnData, include_proto=True, typeconv=True) # type None in parent cls
+		data = ListItemAttr(OpReturnData, include_proto=True) # type None in parent cls
 
 	class InputList(TxBase.Base.InputList):
 

+ 1 - 1
mmgen/proto/btc/tx/online.py

@@ -72,7 +72,7 @@ class OnlineSigned(Signed, TxBase.OnlineSigned):
 		self.add_blockcount()
 		return True
 
-	def print_contract_addr(self):
+	def post_write(self):
 		pass
 
 class Sent(TxBase.Sent, OnlineSigned):

+ 1 - 1
mmgen/proto/eth/tx/online.py

@@ -54,7 +54,7 @@ class OnlineSigned(Signed, TxBase.OnlineSigned):
 
 		return True
 
-	def print_contract_addr(self):
+	def post_write(self):
 		if 'token_addr' in self.txobj:
 			msg('Contract address: {}'.format(self.txobj['token_addr'].hl(0)))
 

+ 1 - 1
test/cmdtest_d/ct_help.py

@@ -26,7 +26,7 @@ class CmdTestHelp(CmdTestBase):
 	passthru_opts = ('daemon_data_dir', 'rpc_port', 'coin', 'testnet')
 	cmd_group = (
 		('usage1',            (1, 'usage message (via --usage)', [])),
-		('usage2',            (1, 'usage message (via --usage)', [])),
+		('usage2',            (1, 'usage message (via --usage, with --coin)', [])),
 		('usage3',            (1, 'usage message (via bad invocation)', [])),
 		('usage4',            (1, 'usage message (via bad invocation, with --coin)', [])),
 		('version',           (1, 'version message', [])),

+ 2 - 4
test/cmdtest_d/ct_swap.py

@@ -14,8 +14,6 @@ test.cmdtest_d.ct_swap: asset swap tests for the cmdtest.py test suite
 
 from .ct_regtest import CmdTestRegtest, rt_data, dfl_wcls, rt_pw
 
-rtFundAmt = rtFee = None # ruff
-
 sample1 = '=:ETH.ETH:0x86d526d6624AbC0178cF7296cD538Ecc080A95F1:0/1/0'
 sample2 = '00010203040506'
 
@@ -73,7 +71,7 @@ class CmdTestSwap(CmdTestRegtest):
 		return self.addrimport('bob', mmtypes=['S', 'B'])
 
 	def fund_bob(self):
-		return self.fund_wallet('bob', 'B', rtFundAmt)
+		return self.fund_wallet('bob', 'B', '500')
 
 	def data_tx1_create(self):
 		return self._data_tx_create('1', 'B:2', 'B:3', 'data', sample1)
@@ -121,7 +119,7 @@ class CmdTestSwap(CmdTestRegtest):
 	def _data_tx_do(self, src, dest, chg, pfx, sample, view):
 		t = self.user_txdo(
 			user         = 'bob',
-			fee          = rtFee[0],
+			fee          = '30s',
 			outputs_cl   = [f'{self.sid}:{dest},1', f'{self.sid}:{chg}', f'{pfx}:{sample}'],
 			outputs_list = src,
 			add_comment  = 'Transaction with OP_RETURN data',