Browse Source

mmgen-xmrwallet txview: add autosign support

The MMGen Project 1 year ago
parent
commit
db4cc3a679
3 changed files with 16 additions and 5 deletions
  1. 2 1
      mmgen/help/xmrwallet.py
  2. 3 3
      mmgen/main_xmrwallet.py
  3. 11 1
      mmgen/xmrwallet.py

+ 2 - 1
mmgen/help/xmrwallet.py

@@ -137,7 +137,8 @@ JSON and thus suitable for efficient incremental backup using git.
                           ‘TXVIEW’ OPERATION NOTES
                           ‘TXVIEW’ OPERATION NOTES
 
 
 Transactions are displayed in chronological order based on submit time or
 Transactions are displayed in chronological order based on submit time or
-creation time.
+creation time.  With --autosign, submitted transactions on the removable
+device are displayed.
 
 
 
 
                               SECURITY WARNING
                               SECURITY WARNING

+ 3 - 3
mmgen/main_xmrwallet.py

@@ -49,7 +49,7 @@ opts_data = {
 			'[opts] sweep    [xmr_keyaddrfile] SWEEP_SPEC',
 			'[opts] sweep    [xmr_keyaddrfile] SWEEP_SPEC',
 			'[opts] submit   [TX_file]',
 			'[opts] submit   [TX_file]',
 			'[opts] relay    <TX_file>',
 			'[opts] relay    <TX_file>',
-			'[opts] txview   <TX_file> ...',
+			'[opts] txview   [TX_file] ...',
 			'[opts] export-outputs    [wallets]',
 			'[opts] export-outputs    [wallets]',
 			'[opts] import-key-images [wallets]',
 			'[opts] import-key-images [wallets]',
 		],
 		],
@@ -113,7 +113,7 @@ cmd_args = cfg._args
 if cmd_args and cfg.autosign and (
 if cmd_args and cfg.autosign and (
 		cmd_args[0] in (
 		cmd_args[0] in (
 			MoneroWalletOps.kafile_arg_ops
 			MoneroWalletOps.kafile_arg_ops
-			+ ('export-outputs','import-key-images')
+			+ ('export-outputs','import-key-images','txview')
 		)
 		)
 		or len(cmd_args) == 1 and cmd_args[0] == 'submit'
 		or len(cmd_args) == 1 and cmd_args[0] == 'submit'
 	):
 	):
@@ -171,5 +171,5 @@ try:
 except Exception as e:
 except Exception as e:
 	ymsg(f'Unable to stop wallet daemon: {type(e).__name__}: {e}')
 	ymsg(f'Unable to stop wallet daemon: {type(e).__name__}: {e}')
 
 
-if cfg.autosign and not cfg.test_suite:
+if m.do_umount and cfg.autosign and not cfg.test_suite:
 	asi.do_umount()
 	asi.do_umount()

+ 11 - 1
mmgen/xmrwallet.py

@@ -616,6 +616,7 @@ class MoneroWalletOps:
 
 
 		opts = ('wallet_dir',)
 		opts = ('wallet_dir',)
 		trust_daemon = False
 		trust_daemon = False
+		do_umount = True
 
 
 		def __init__(self,cfg,uarg_tuple):
 		def __init__(self,cfg,uarg_tuple):
 
 
@@ -1812,12 +1813,21 @@ class MoneroWalletOps:
 				die(1,'Exiting at user request')
 				die(1,'Exiting at user request')
 
 
 	class txview(base):
 	class txview(base):
+		opts = ('watch_only','autosign')
+		do_umount = False
 
 
 		async def main(self):
 		async def main(self):
+			if self.cfg.autosign:
+				asi = get_autosign_obj(self.cfg,'xmr')
+				files = [f for f in asi.xmr_tx_dir.iterdir() if f.name.endswith('.'+MoneroMMGenTX.Submitted.ext)]
+			else:
+				files = uarg.infile
 			txs = sorted(
 			txs = sorted(
-				(MoneroMMGenTX.View( self.cfg, Path(fn) ) for fn in uarg.infile),
+				(MoneroMMGenTX.View( self.cfg, Path(fn) ) for fn in files),
 					key = lambda x: x.data.create_time
 					key = lambda x: x.data.create_time
 			)
 			)
+			if self.cfg.autosign:
+				asi.do_umount()
 			self.cfg._util.stdout_or_pager(
 			self.cfg._util.stdout_or_pager(
 				'\n'.join(tx.get_info() for tx in txs)
 				'\n'.join(tx.get_info() for tx in txs)
 			)
 			)