tw, tx: minor fixes and cleanups
This commit is contained in:
parent
3bfad0c1d0
commit
ff38069843
5 changed files with 33 additions and 20 deletions
|
|
@ -130,8 +130,9 @@ if cfg.list_assets:
|
|||
Msg('AVAILABLE SWAP ASSETS:\n' + sp.SwapAsset('BTC', 'send').fmt_assets_data(indent=' '))
|
||||
sys.exit(0)
|
||||
|
||||
if not (cfg.info or cfg.contract_data) and len(cfg._args) < {'tx': 1, 'swaptx': 2}[target]:
|
||||
cfg._usage()
|
||||
if not (cfg.info or cfg.contract_data):
|
||||
if len(cfg._args) < {'tx': 1, 'swaptx': 2}[target]:
|
||||
cfg._usage()
|
||||
|
||||
async def main():
|
||||
|
||||
|
|
|
|||
|
|
@ -22,11 +22,12 @@ class MoneroTwUnspentOutputs(MoneroTwView, TwUnspentOutputs):
|
|||
desc = 'spendable accounts'
|
||||
include_empty = False
|
||||
|
||||
prompt_fs_in = [
|
||||
'Sort options: [a]mount, [A]ge, a[d]dr, [M]mgen addr, [r]everse',
|
||||
'Display options: r[e]draw screen',
|
||||
'View/Print: pager [v]iew, [w]ide pager view, [p]rint to file{s}',
|
||||
'Actions: [q]uit menu, add [l]abel, [R]efresh balances:']
|
||||
extra_key_mappings = {
|
||||
'R': 'a_sync_wallets',
|
||||
'A': 's_age'}
|
||||
async def __init__(self, cfg, proto, *, minconf=1, addrs=[], tx=None):
|
||||
self.prompt_fs_in = [
|
||||
'Sort options: [a]mount, [A]ge, a[d]dr, [M]mgen addr, [r]everse',
|
||||
'View/Print: pager [v]iew, [w]ide pager view, [p]rint to file{s}',
|
||||
'Actions: [q]uit menu, add [l]abel, r[e]draw, [R]efresh balances:']
|
||||
self.extra_key_mappings = {
|
||||
'R': 'a_sync_wallets',
|
||||
'A': 's_age'}
|
||||
await super().__init__(cfg, proto, minconf=minconf, addrs=addrs, tx=tx)
|
||||
|
|
|
|||
|
|
@ -41,15 +41,21 @@ class New(Base, TxNew):
|
|||
msg(f'Account number must be an integer between 1 and {len(accts_data)} inclusive')
|
||||
|
||||
async def compat_create(self):
|
||||
|
||||
if True:
|
||||
op = 'transfer'
|
||||
i = self.inputs[0]
|
||||
o = self.outputs[0]
|
||||
spec = f'{i.idx}:{i.acct_idx}:{o.addr},{o.amt}'
|
||||
|
||||
from ....xmrwallet import op as xmrwallet_op
|
||||
i = self.inputs[0]
|
||||
o = self.outputs[0]
|
||||
op = xmrwallet_op(
|
||||
'transfer',
|
||||
op,
|
||||
self.cfg,
|
||||
None,
|
||||
None,
|
||||
spec = f'{i.idx}:{i.acct_idx}:{o.addr},{o.amt}',
|
||||
spec = spec,
|
||||
compat_call = True)
|
||||
|
||||
await op.restart_wallet_daemon()
|
||||
return await op.main()
|
||||
|
|
|
|||
|
|
@ -588,6 +588,12 @@ class TwView(MMGenObject, metaclass=AsyncInit):
|
|||
self.key_mappings.update(self.scroll_keys[sys.platform])
|
||||
return self.key_mappings
|
||||
|
||||
def cleanup(add_nl=False):
|
||||
if add_nl:
|
||||
msg('')
|
||||
if self.scroll:
|
||||
self.term.set('echo')
|
||||
|
||||
scroll = self.scroll = self.cfg.scroll
|
||||
|
||||
key_mappings = make_key_mappings(scroll)
|
||||
|
|
@ -635,10 +641,7 @@ class TwView(MMGenObject, metaclass=AsyncInit):
|
|||
arg = action_methods[ch]
|
||||
await func(self, arg) if isAsync(func) else func(self, arg)
|
||||
case 'q':
|
||||
msg('')
|
||||
if self.scroll:
|
||||
self.term.set('echo')
|
||||
return
|
||||
return cleanup(add_nl=True)
|
||||
case _:
|
||||
if not scroll:
|
||||
msg_r('\ninvalid keypress ')
|
||||
|
|
@ -704,7 +707,7 @@ class TwView(MMGenObject, metaclass=AsyncInit):
|
|||
|
||||
@enable_echo
|
||||
async def run(self, parent, action_method):
|
||||
await parent.post_action_cleanup(await action_method(parent))
|
||||
return await parent.post_action_cleanup(await action_method(parent))
|
||||
|
||||
async def a_print_detail(self, parent):
|
||||
return await self._print(parent, output_type='detail')
|
||||
|
|
@ -780,7 +783,7 @@ class TwView(MMGenObject, metaclass=AsyncInit):
|
|||
break
|
||||
await asyncio.sleep(0.5)
|
||||
|
||||
await parent.post_action_cleanup(ret)
|
||||
return await parent.post_action_cleanup(ret)
|
||||
|
||||
async def i_balance_refresh(self, parent, idx, acct_addr_idx=None):
|
||||
if not parent.keypress_confirm(
|
||||
|
|
|
|||
|
|
@ -530,6 +530,8 @@ class New(Base):
|
|||
await self.update_vault_output(self.vault_output.amt)
|
||||
|
||||
if self.is_compat:
|
||||
del self.twctl
|
||||
del self.twuo.twctl
|
||||
return await self.compat_create()
|
||||
|
||||
await self.create_serialized(locktime=locktime) # creates self.txid too
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue