tracking wallet views: move module loading to tw.view
This commit is contained in:
parent
20b250ef98
commit
6da4063544
7 changed files with 9 additions and 17 deletions
|
|
@ -1 +1 @@
|
|||
13.3.dev18
|
||||
13.3.dev19
|
||||
|
|
|
|||
|
|
@ -21,19 +21,14 @@ class EthereumTwRPC(TwRPC):
|
|||
|
||||
async def get_addr_label_pairs(self,twmmid=None):
|
||||
|
||||
wallet = self.wallet or await TrackingWallet(self.proto,mode='w')
|
||||
|
||||
ret = [(
|
||||
TwLabel( self.proto, mmid + ' ' + d['comment'] ),
|
||||
CoinAddr( self.proto, d['addr'] )
|
||||
) for mmid,d in wallet.mmid_ordered_dict.items() ]
|
||||
) for mmid,d in self.wallet.mmid_ordered_dict.items() ]
|
||||
|
||||
if twmmid:
|
||||
ret = [e for e in ret if e[0].mmid == twmmid]
|
||||
|
||||
if wallet is not self.wallet:
|
||||
del wallet
|
||||
|
||||
return ret or None
|
||||
|
||||
class EthereumTokenTwRPC(EthereumTwRPC):
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ class TwAddresses(TwView):
|
|||
showused = 1 # tristate: 0:no, 1:yes, 2:all
|
||||
all_labels = False
|
||||
no_data_errmsg = 'No addresses in tracking wallet!'
|
||||
mod_subpath = 'tw.addresses'
|
||||
|
||||
class display_type(TwView.display_type):
|
||||
|
||||
|
|
@ -71,9 +72,6 @@ class TwAddresses(TwView):
|
|||
def coinaddr_list(self):
|
||||
return [d.addr for d in self.data]
|
||||
|
||||
def __new__(cls,proto,*args,**kwargs):
|
||||
return MMGenObject.__new__(proto.base_proto_subclass(cls,'tw.addresses'))
|
||||
|
||||
async def __init__(self,proto,minconf=1,mmgen_addrs='',get_data=False):
|
||||
|
||||
await super().__init__(proto)
|
||||
|
|
|
|||
|
|
@ -28,9 +28,6 @@ class TwTxHistory(TwView):
|
|||
need_column_widths = False
|
||||
item_separator = '\n\n'
|
||||
|
||||
def __new__(cls,proto,*args,**kwargs):
|
||||
return MMGenObject.__new__(proto.base_proto_subclass(cls,'tw.txhistory'))
|
||||
|
||||
has_wallet = False
|
||||
show_txid = False
|
||||
show_unconfirmed = False
|
||||
|
|
@ -38,6 +35,7 @@ class TwTxHistory(TwView):
|
|||
update_widths_on_age_toggle = True
|
||||
print_output_types = ('squeezed','detail')
|
||||
filters = ('show_unconfirmed',)
|
||||
mod_subpath = 'tw.txhistory'
|
||||
|
||||
async def __init__(self,proto,sinceblock=0):
|
||||
await super().__init__(proto)
|
||||
|
|
|
|||
|
|
@ -45,9 +45,6 @@ class TwUnspentOutputs(TwView):
|
|||
class detail(TwView.display_type.detail):
|
||||
cols = ('num','txid','vout','addr','mmid','amt','amt2','block','date_time','comment')
|
||||
|
||||
def __new__(cls,proto,*args,**kwargs):
|
||||
return MMGenObject.__new__(proto.base_proto_subclass(cls,'tw.unspent'))
|
||||
|
||||
show_mmid = True
|
||||
no_rpcdata_errmsg = """
|
||||
No spendable outputs found! Import addresses with balances into your
|
||||
|
|
@ -55,6 +52,7 @@ class TwUnspentOutputs(TwView):
|
|||
"""
|
||||
update_widths_on_age_toggle = False
|
||||
print_output_types = ('detail',)
|
||||
mod_subpath = 'tw.unspent'
|
||||
|
||||
class MMGenTwUnspentOutput(MMGenListItem):
|
||||
txid = ListItemAttr(CoinTxID)
|
||||
|
|
|
|||
|
|
@ -111,6 +111,9 @@ class TwView(MMGenObject,metaclass=AsyncInit):
|
|||
Please resize your screen to at least {} characters and hit any key:
|
||||
"""
|
||||
|
||||
def __new__(cls,proto,*args,**kwargs):
|
||||
return MMGenObject.__new__(proto.base_proto_subclass(cls,cls.mod_subpath))
|
||||
|
||||
async def __init__(self,proto):
|
||||
self.proto = proto
|
||||
self.rpc = await rpc_init(proto)
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ from mmgen.seedsplit import *
|
|||
from mmgen.addr import *
|
||||
from mmgen.addrlist import *
|
||||
from mmgen.addrdata import *
|
||||
from mmgen.tw.view import *
|
||||
from mmgen.tw.shared import *
|
||||
from mmgen.amt import *
|
||||
from mmgen.key import *
|
||||
from mmgen.rpc import IPPort
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue