minor cleanups

This commit is contained in:
The MMGen Project 2022-11-12 13:34:40 +00:00
commit e7d75ff60d
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
8 changed files with 14 additions and 19 deletions

View file

@ -9,7 +9,7 @@
# https://gitlab.com/mmgen/mmgen
"""
proto.btc.twctl: Bitcoin base protocol tracking wallet control class
proto.btc.tw.ctl: Bitcoin base protocol tracking wallet control class
"""
from ....globalvars import g

View file

@ -9,7 +9,7 @@
# https://gitlab.com/mmgen/mmgen
"""
proto.btc.twuo: Bitcoin base protocol tracking wallet unspent outputs class
proto.btc.tw.unspent: Bitcoin base protocol tracking wallet unspent outputs class
"""
from ....tw.unspent import TwUnspentOutputs

View file

@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
proto.eth.twuo: Ethereum tracking wallet unspent outputs class
proto.eth.tw.unspent: Ethereum tracking wallet unspent outputs class
"""
from ....tw.shared import TwLabel

View file

@ -22,7 +22,7 @@ from ..color import red,green
from .view import TwView
from .shared import TwMMGenID
class TwAddresses(MMGenObject,TwView,metaclass=AsyncInit):
class TwAddresses(TwView,metaclass=AsyncInit):
hdr_lbl = 'tracking wallet addresses'
desc = 'address list'

View file

@ -20,17 +20,11 @@
twctl: Tracking wallet control class for the MMGen suite
"""
import asyncio,json
import json
from collections import namedtuple
from ..globalvars import g
from ..util import (
msg,
msg_r,
qmsg,
dmsg,
suf,
die )
from ..util import msg,msg_r,qmsg,dmsg,suf,die
from ..base_obj import AsyncInit
from ..objmethods import MMGenObject
from ..obj import TwComment,get_obj
@ -329,6 +323,7 @@ class TrackingWallet(MMGenObject,metaclass=AsyncInit):
msg(f'done\n{len(ret)} addresses imported')
else:
if gather: # this seems to provide little performance benefit
import asyncio
await asyncio.gather(*(do_import(*d) for d in out))
else:
for d in out:

View file

@ -21,7 +21,7 @@ from ..obj import CoinTxID,MMGenList,Int
from ..rpc import rpc_init
from .view import TwView
class TwTxHistory(MMGenObject,TwView,metaclass=AsyncInit):
class TwTxHistory(TwView,metaclass=AsyncInit):
class display_type(TwView.display_type):

View file

@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
twuo: Tracking wallet unspent outputs class for the MMGen suite
tw.unspent: Tracking wallet unspent outputs class for the MMGen suite
"""
from ..globalvars import g
@ -38,7 +38,7 @@ from ..rpc import rpc_init
from .view import TwView
from .shared import TwMMGenID,get_tw_label
class TwUnspentOutputs(MMGenObject,TwView,metaclass=AsyncInit):
class TwUnspentOutputs(TwView,metaclass=AsyncInit):
class display_type(TwView.display_type):
@ -51,6 +51,7 @@ class TwUnspentOutputs(MMGenObject,TwView,metaclass=AsyncInit):
def __new__(cls,proto,*args,**kwargs):
return MMGenObject.__new__(proto.base_proto_subclass(cls,'tw','unspent'))
show_mmid = True
txid_w = 64
no_rpcdata_errmsg = """
No spendable outputs found! Import addresses with balances into your
@ -84,7 +85,6 @@ class TwUnspentOutputs(MMGenObject,TwView,metaclass=AsyncInit):
async def __init__(self,proto,minconf=1,addrs=[]):
self.proto = proto
self.show_mmid = True
self.minconf = minconf
self.addrs = addrs
self.rpc = await rpc_init(proto)
@ -178,7 +178,7 @@ class TwUnspentOutputs(MMGenObject,TwView,metaclass=AsyncInit):
for n,d in enumerate(data):
yield fs.format(
n = str(n+1)+')',
n = str(n+1) + ')',
t = (CoinTxID.fmtc('|' + '.'*(cw.txid-1),color=color) if d.skip == 'txid'
else d.txid.truncate(width=cw.txid,color=color)) if cw.txid else None,
v = ' ' + d.vout.fmt(width=cw.vout-1,color=color) if cw.vout else None,
@ -201,7 +201,7 @@ class TwUnspentOutputs(MMGenObject,TwView,metaclass=AsyncInit):
a = 'Address',
m = 'MMGenID',
A = 'Amt({})'.format(self.proto.dcoin),
B = 'Amt({})'.format(self.proto.coin) if cw.amt2 else None,
B = 'Amt({})'.format(self.proto.coin),
b = 'Block',
D = 'Date/Time',
c = 'Comment' ).rstrip()

View file

@ -30,7 +30,7 @@ from ..color import nocolor,yellow,green,red,blue
from ..util import msg,msg_r,fmt,die,capfirst,make_timestr
# base class for TwUnspentOutputs,TwAddresses,TwTxHistory:
class TwView:
class TwView(MMGenObject):
dates_set = False
cols = None