mmgen-xmrwallet: new txview operation
This commit is contained in:
parent
f4c3eaccd3
commit
164ef9d266
5 changed files with 57 additions and 3 deletions
|
|
@ -1 +1 @@
|
|||
13.3.dev3
|
||||
13.3.dev4
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ opts_data = {
|
|||
'[opts] transfer <xmr_keyaddrfile> TRANSFER_SPEC',
|
||||
'[opts] sweep <xmr_keyaddrfile> SWEEP_SPEC',
|
||||
'[opts] relay <TX_file>',
|
||||
'[opts] txview <TX_file> ...',
|
||||
],
|
||||
'options': """
|
||||
-h, --help Print this help message
|
||||
|
|
@ -86,6 +87,8 @@ sweep - sweep funds in specified wallet:account to new address in same
|
|||
account or new account in another wallet
|
||||
relay - relay a transaction from a transaction file created using 'sweep'
|
||||
or 'transfer' with the --no-relay option
|
||||
txview - view a transaction file or files created using 'sweep' or
|
||||
'transfer' with the --no-relay option
|
||||
|
||||
|
||||
'CREATE', 'SYNC' AND 'LIST' OPERATION NOTES
|
||||
|
|
@ -190,6 +193,10 @@ $ mmgen-xmrwallet new *.akeys.mmenc 2
|
|||
|
||||
Create a new address in account 1 of wallet 2, with label:
|
||||
$ mmgen-xmrwallet new *.akeys.mmenc 2:1,"from ABC exchange"
|
||||
|
||||
View all the XMR transaction files in the current directory, sending output
|
||||
to pager:
|
||||
$ mmgen-xmrwallet --pager txview *XMR*.sigtx
|
||||
"""
|
||||
},
|
||||
'code': {
|
||||
|
|
@ -217,6 +224,8 @@ wallets = spec = ''
|
|||
if op == 'relay':
|
||||
if len(cmd_args) != 0:
|
||||
opts.usage()
|
||||
elif op == 'txview':
|
||||
infile = [infile] + cmd_args
|
||||
elif op in ('create','sync','list'):
|
||||
if len(cmd_args) not in (0,1):
|
||||
opts.usage()
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ class MoneroMMGenTX:
|
|||
|
||||
class MoneroWalletOps:
|
||||
|
||||
ops = ('create','sync','list','new','transfer','sweep','relay')
|
||||
ops = ('create','sync','list','new','transfer','sweep','relay','txview')
|
||||
opts = (
|
||||
'wallet_dir',
|
||||
'daemon',
|
||||
|
|
@ -959,3 +959,15 @@ class MoneroWalletOps:
|
|||
die( 'RPCFailure', repr(res) )
|
||||
else:
|
||||
die(1,'Exiting at user request')
|
||||
|
||||
class txview(base):
|
||||
name = 'txview'
|
||||
|
||||
async def main(self):
|
||||
stdout_or_pager(
|
||||
'\n'.join(
|
||||
tx.get_info() for tx in
|
||||
sorted(
|
||||
(MoneroMMGenTX.Signed(fn) for fn in uarg.infile),
|
||||
key = lambda x: x.data.sign_time )
|
||||
))
|
||||
|
|
|
|||
21
test/ref/monero/3EBD06-2D6E3B-XMR[0.74].testnet.sigtx
Normal file
21
test/ref/monero/3EBD06-2D6E3B-XMR[0.74].testnet.sigtx
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"MoneroMMGenTX": {
|
||||
"base_chksum": "3ebd06",
|
||||
"full_chksum": "2d6e3b",
|
||||
"data": {
|
||||
"op": "sweep",
|
||||
"create_time": 1665169030,
|
||||
"sign_time": 1665169030,
|
||||
"network": "testnet",
|
||||
"seed_id": "FE3C6545",
|
||||
"source": "2:1:None",
|
||||
"dest": "3:0:0",
|
||||
"dest_address": "56VQ9M6k3C2H7awPLUcUKA86fkh4NqqJ3SQhVnFw7odfRVj3Xkpb3rv4J18o7c5KUBa36eCNpGDo16nKPvJgYHorEuu9WZj",
|
||||
"txid": "63ca48f93968788d7756328e55947f50c939ef764d5049ad7d43c03c7202f779",
|
||||
"amount": "0.74",
|
||||
"fee": "0.002",
|
||||
"blob": "deadbeef",
|
||||
"metadata": null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -32,9 +32,11 @@ class TestSuiteMisc(TestSuiteBase):
|
|||
tmpdir_nums = [99]
|
||||
passthru_opts = ('daemon_data_dir','rpc_port')
|
||||
cmd_group = (
|
||||
('rpc_backends', 'RPC backends'),
|
||||
('rpc_backends', 'RPC backends'),
|
||||
('xmrwallet_txview', "'mmgen-xmrwallet' txview"),
|
||||
)
|
||||
need_daemon = True
|
||||
color = True
|
||||
|
||||
def rpc_backends(self):
|
||||
backends = g.autoset_opts['rpc_backend'][1]
|
||||
|
|
@ -42,6 +44,16 @@ class TestSuiteMisc(TestSuiteBase):
|
|||
t = self.spawn_chk('mmgen-tool',[f'--rpc-backend={b}','daemon_version'],extra_desc=f'({b})')
|
||||
return t
|
||||
|
||||
def xmrwallet_txview(self):
|
||||
t = self.spawn(f'mmgen-xmrwallet',['txview','test/ref/monero/3EBD06-2D6E3B-XMR[0.74].testnet.sigtx'])
|
||||
res = strip_ansi_escapes(t.read()).replace('\r','')
|
||||
for s in (
|
||||
'Amount: 0.74 XMR',
|
||||
'Dest: 56VQ9M6k',
|
||||
):
|
||||
assert s in res, s
|
||||
return t
|
||||
|
||||
class TestSuiteHelp(TestSuiteBase):
|
||||
'help, info and usage screens'
|
||||
networks = ('btc','ltc','bch','eth','xmr')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue