minor fixes and cleanups

This commit is contained in:
The MMGen Project 2025-02-15 09:54:18 +00:00
commit dc30edba48
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
8 changed files with 14 additions and 16 deletions

View file

@ -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'),

View file

@ -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')

View file

@ -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())

View file

@ -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):

View file

@ -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):

View file

@ -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)))

View file

@ -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', [])),

View file

@ -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',