From 26dd4666355df69881458aa15e37e0bf37c18932 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Wed, 9 Nov 2022 13:05:07 +0000 Subject: [PATCH] listaddresses: showbtcaddrs -> showcoinaddrs --- mmgen/proto/btc/tw/addrs.py | 4 ++-- mmgen/proto/btc/tw/json.py | 2 +- mmgen/proto/eth/tw/addrs.py | 4 ++-- mmgen/tool/rpc.py | 20 ++++++++++---------- mmgen/tw/addrs.py | 8 ++++---- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/mmgen/proto/btc/tw/addrs.py b/mmgen/proto/btc/tw/addrs.py index 599e7eac..2db98902 100755 --- a/mmgen/proto/btc/tw/addrs.py +++ b/mmgen/proto/btc/tw/addrs.py @@ -24,7 +24,7 @@ class BitcoinTwAddrList(TwAddrList,BitcoinTwCommon): has_age = True - async def __init__(self,proto,usr_addr_list,minconf,showempty,showbtcaddrs,all_labels,wallet=None): + async def __init__(self,proto,usr_addr_list,minconf,showempty,showcoinaddrs,all_labels,wallet=None): self.rpc = await rpc_init(proto) self.proto = proto @@ -42,5 +42,5 @@ class BitcoinTwAddrList(TwAddrList,BitcoinTwCommon): continue if label.mmid not in self: self[label.mmid] = { 'amt':proto.coin_amt('0'), 'lbl':label, 'addr':'' } - if showbtcaddrs: + if showcoinaddrs: self[label.mmid]['addr'] = CoinAddr(proto,addr) diff --git a/mmgen/proto/btc/tw/json.py b/mmgen/proto/btc/tw/json.py index b1dacd40..6eff0a60 100755 --- a/mmgen/proto/btc/tw/json.py +++ b/mmgen/proto/btc/tw/json.py @@ -72,7 +72,7 @@ class BitcoinTwJSON(TwJSON): usr_addr_list = None, minconf = 0, showempty = True, - showbtcaddrs = True, + showcoinaddrs = True, all_labels = False ) return self._addrlist diff --git a/mmgen/proto/eth/tw/addrs.py b/mmgen/proto/eth/tw/addrs.py index 37f21475..a058cb9d 100755 --- a/mmgen/proto/eth/tw/addrs.py +++ b/mmgen/proto/eth/tw/addrs.py @@ -26,7 +26,7 @@ class EthereumTwAddrList(TwAddrList): has_age = False - async def __init__(self,proto,usr_addr_list,minconf,showempty,showbtcaddrs,all_labels,wallet=None): + async def __init__(self,proto,usr_addr_list,minconf,showempty,showcoinaddrs,all_labels,wallet=None): from ....tw.common import TwLabel from ....tw.ctl import TrackingWallet @@ -47,7 +47,7 @@ class EthereumTwAddrList(TwAddrList): if not label.comment or not all_labels: continue self[label.mmid] = {'amt': self.proto.coin_amt('0'), 'lbl': label } - if showbtcaddrs: + if showcoinaddrs: self[label.mmid]['addr'] = CoinAddr(self.proto,d['addr']) self[label.mmid]['lbl'].mmid.confs = None self[label.mmid]['amt'] += bal diff --git a/mmgen/tool/rpc.py b/mmgen/tool/rpc.py index efc1dcf7..745c4622 100755 --- a/mmgen/tool/rpc.py +++ b/mmgen/tool/rpc.py @@ -46,22 +46,22 @@ class tool_cmd(tool_cmd_base): async def listaddress(self, mmgen_addr:str, - minconf: 'minimum number of confirmations' = 1, - showbtcaddr: 'display coin address in addition to MMGen ID' = True, - age_fmt: 'format for the Age/Date column ' + options_annot_str(TwCommon.age_fmts) = 'confs' ): + minconf: 'minimum number of confirmations' = 1, + showcoinaddr: 'display coin address in addition to MMGen ID' = True, + age_fmt: 'format for the Age/Date column ' + options_annot_str(TwCommon.age_fmts) = 'confs' ): "list the specified MMGen address in the tracking wallet and its balance" return await self.listaddresses( - mmgen_addrs = mmgen_addr, - minconf = minconf, - showbtcaddrs = showbtcaddr, - age_fmt = age_fmt ) + mmgen_addrs = mmgen_addr, + minconf = minconf, + showcoinaddrs = showcoinaddr, + age_fmt = age_fmt ) async def listaddresses(self, mmgen_addrs: 'hyphenated range or comma-separated list of addresses' = '', minconf: 'minimum number of confirmations' = 1, pager: 'send output to pager' = False, - showbtcaddrs: 'display coin addresses in addition to MMGen IDs' = True, + showcoinaddrs:'display coin addresses in addition to MMGen IDs' = True, showempty: 'show addresses with no balances' = True, all_labels: 'show all addresses with labels' = False, age_fmt: 'format for the Age/Date column ' + options_annot_str(TwCommon.age_fmts) = 'confs', @@ -90,11 +90,11 @@ class tool_cmd(tool_cmd_base): usr_addr_list = [MMGenID(self.proto,f'{a[0]}:{i}') for i in AddrIdxList(a[1])] from ..tw.addrs import TwAddrList - al = await TwAddrList( self.proto, usr_addr_list, minconf, showempty, showbtcaddrs, all_labels ) + al = await TwAddrList( self.proto, usr_addr_list, minconf, showempty, showcoinaddrs, all_labels ) if not al: from ..util import die die(0,('No tracked addresses with balances!','No tracked addresses!')[showempty]) - return await al.format( showbtcaddrs, sort, show_age, age_fmt or 'confs' ) + return await al.format( showcoinaddrs, sort, show_age, age_fmt or 'confs' ) async def twops(self, obj,pager,reverse,detail,sort,age_fmt,interactive,show_mmid): diff --git a/mmgen/tw/addrs.py b/mmgen/tw/addrs.py index a4062406..2e4c373a 100755 --- a/mmgen/tw/addrs.py +++ b/mmgen/tw/addrs.py @@ -38,12 +38,12 @@ class TwAddrList(MMGenDict,TwCommon,metaclass=AsyncInit): def coinaddr_list(self): return [self[k]['addr'] for k in self] - async def format(self,showbtcaddrs,sort,show_age,age_fmt): + async def format(self,showcoinaddrs,sort,show_age,age_fmt): if not self.has_age: show_age = False if age_fmt not in self.age_fmts: die( 'BadAgeFormat', f'{age_fmt!r}: invalid age format (must be one of {self.age_fmts!r})' ) - fs = '{mid}' + ('',' {addr}')[showbtcaddrs] + ' {cmt} {amt}' + ('',' {age}')[show_age] + fs = '{mid}' + ('',' {addr}')[showcoinaddrs] + ' {cmt} {amt}' + ('',' {age}')[show_age] mmaddrs = [k for k in self.keys() if k.type == 'mmgen'] max_mmid_len = max(len(k) for k in mmaddrs) + 2 if mmaddrs else 10 max_cmt_width = max(max(v['lbl'].comment.screen_width for v in self.values()),7) @@ -74,7 +74,7 @@ class TwAddrList(MMGenDict,TwCommon,metaclass=AsyncInit): yield fs.format( mid=MMGenID.fmtc('MMGenID',width=max_mmid_len), - addr=(CoinAddr.fmtc('ADDRESS',width=addr_width) if showbtcaddrs else None), + addr=(CoinAddr.fmtc('ADDRESS',width=addr_width) if showcoinaddrs else None), cmt=TwComment.fmtc('COMMENT',width=max_cmt_width+1), amt='BALANCE'.ljust(max_fp_len+4), age=age_fmt.upper(), @@ -95,7 +95,7 @@ class TwAddrList(MMGenDict,TwCommon,metaclass=AsyncInit): e = self[mmid] yield fs.format( mid=MMGenID.fmtc(mmid_disp,width=max_mmid_len,color=True), - addr=(e['addr'].fmt(color=True,width=addr_width) if showbtcaddrs else None), + addr=(e['addr'].fmt(color=True,width=addr_width) if showcoinaddrs else None), cmt=e['lbl'].comment.fmt(width=max_cmt_width,color=True,nullrepl='-'), amt=e['amt'].fmt('4.{}'.format(max(max_fp_len,3)),color=True), age=self.age_disp(mmid,age_fmt) if show_age and hasattr(mmid,'confs') else '-'