Browse Source

proto.{btc,eth}.tw: module moves, class renames

    - proto.btc.tw.common -> proto.btc.tw.rpc
    - proto.eth.tw.common -> proto.eth.tw.rpc, proto.eth.tw.view

    - BitcoinTwCommon -> BitcoinTwRPC
    - EthereumTwCommon -> EthereumTwRPC, EthereumTwView
The MMGen Project 2 years ago
parent
commit
79bcc049a5

+ 2 - 2
mmgen/proto/btc/tw/addresses.py

@@ -17,9 +17,9 @@ from ....tw.shared import TwLabel
 from ....util import msg,msg_r
 from ....util import msg,msg_r
 from ....addr import CoinAddr
 from ....addr import CoinAddr
 from ....obj import NonNegativeInt,get_obj
 from ....obj import NonNegativeInt,get_obj
-from .common import BitcoinTwCommon
+from .rpc import BitcoinTwRPC
 
 
-class BitcoinTwAddresses(TwAddresses,BitcoinTwCommon):
+class BitcoinTwAddresses(TwAddresses,BitcoinTwRPC):
 
 
 	has_age = True
 	has_age = True
 	prompt = """
 	prompt = """

+ 2 - 2
mmgen/proto/btc/tw/ctl.py

@@ -15,9 +15,9 @@ proto.btc.twctl: Bitcoin base protocol tracking wallet control class
 from ....globalvars import g
 from ....globalvars import g
 from ....tw.ctl import TrackingWallet,write_mode
 from ....tw.ctl import TrackingWallet,write_mode
 from ....util import msg,msg_r,rmsg,vmsg,die,suf,fmt_list
 from ....util import msg,msg_r,rmsg,vmsg,die,suf,fmt_list
-from .common import BitcoinTwCommon
+from .rpc import BitcoinTwRPC
 
 
-class BitcoinTrackingWallet(TrackingWallet,BitcoinTwCommon):
+class BitcoinTrackingWallet(TrackingWallet,BitcoinTwRPC):
 
 
 	def init_empty(self):
 	def init_empty(self):
 		self.data = { 'coin': self.proto.coin, 'addresses': {} }
 		self.data = { 'coin': self.proto.coin, 'addresses': {} }

+ 2 - 2
mmgen/proto/btc/tw/common.py → mmgen/proto/btc/tw/rpc.py

@@ -9,7 +9,7 @@
 #   https://gitlab.com/mmgen/mmgen
 #   https://gitlab.com/mmgen/mmgen
 
 
 """
 """
-proto.btc.tw.common: Bitcoin base protocol tracking wallet dependency classes
+proto.btc.tw.rpc: Bitcoin base protocol tracking wallet RPC classes
 """
 """
 
 
 from ....addr import CoinAddr
 from ....addr import CoinAddr
@@ -17,7 +17,7 @@ from ....util import die,msg,rmsg
 from ....obj import MMGenList
 from ....obj import MMGenList
 from ....tw.shared import get_tw_label
 from ....tw.shared import get_tw_label
 
 
-class BitcoinTwCommon:
+class BitcoinTwRPC:
 
 
 	async def get_addr_label_pairs(self,twmmid=None):
 	async def get_addr_label_pairs(self,twmmid=None):
 		"""
 		"""

+ 3 - 3
mmgen/proto/btc/tw/txhistory.py

@@ -20,9 +20,9 @@ from ....addr import CoinAddr
 from ....util import msg,msg_r
 from ....util import msg,msg_r
 from ....color import nocolor,red,pink,gray
 from ....color import nocolor,red,pink,gray
 from ....obj import TwComment,CoinTxID,Int
 from ....obj import TwComment,CoinTxID,Int
-from .common import BitcoinTwCommon
+from .rpc import BitcoinTwRPC
 
 
-class BitcoinTwTransaction(BitcoinTwCommon):
+class BitcoinTwTransaction(BitcoinTwRPC):
 
 
 	def __init__(self,parent,proto,rpc,
 	def __init__(self,parent,proto,rpc,
 			idx,          # unique numeric identifier of this transaction in listing
 			idx,          # unique numeric identifier of this transaction in listing
@@ -221,7 +221,7 @@ class BitcoinTwTransaction(BitcoinTwCommon):
 				self.fee.to_unit(atomic_unit) // self.vsize,
 				self.fee.to_unit(atomic_unit) // self.vsize,
 				atomic_unit )) )
 				atomic_unit )) )
 
 
-class BitcoinTwTxHistory(TwTxHistory,BitcoinTwCommon):
+class BitcoinTwTxHistory(TwTxHistory,BitcoinTwRPC):
 
 
 	has_age = True
 	has_age = True
 	hdr_lbl = 'transaction history'
 	hdr_lbl = 'transaction history'

+ 3 - 2
mmgen/proto/eth/tw/addresses.py

@@ -15,9 +15,10 @@ proto.eth.tw.addresses: Ethereum base protocol tracking wallet address list clas
 from ....tw.addresses import TwAddresses
 from ....tw.addresses import TwAddresses
 from ....tw.ctl import TrackingWallet
 from ....tw.ctl import TrackingWallet
 from ....addr import CoinAddr
 from ....addr import CoinAddr
-from .common import EthereumTwCommon
+from .view import EthereumTwView
+from .rpc import EthereumTwRPC
 
 
-class EthereumTwAddresses(EthereumTwCommon,TwAddresses):
+class EthereumTwAddresses(EthereumTwView,EthereumTwRPC,TwAddresses):
 
 
 	has_age = False
 	has_age = False
 	prompt = """
 	prompt = """

+ 2 - 2
mmgen/proto/eth/tw/ctl.py

@@ -25,9 +25,9 @@ from ....tw.ctl import TrackingWallet,write_mode
 from ....addr import is_coin_addr,is_mmgen_id
 from ....addr import is_coin_addr,is_mmgen_id
 from ....amt import ETHAmt
 from ....amt import ETHAmt
 from ..contract import Token,TokenResolve
 from ..contract import Token,TokenResolve
-from .common import EthereumTwCommon
+from .rpc import EthereumTwRPC
 
 
-class EthereumTrackingWallet(EthereumTwCommon,TrackingWallet):
+class EthereumTrackingWallet(EthereumTwRPC,TrackingWallet):
 
 
 	caps = ('batch',)
 	caps = ('batch',)
 	data_key = 'accounts'
 	data_key = 'accounts'

+ 3 - 20
mmgen/proto/eth/tw/common.py → mmgen/proto/eth/tw/rpc.py

@@ -9,31 +9,14 @@
 #   https://gitlab.com/mmgen/mmgen
 #   https://gitlab.com/mmgen/mmgen
 
 
 """
 """
-proto.eth.tw.common: Ethereum base protocol tracking wallet dependency classes
+proto.eth.tw.rpc: Ethereum base protocol tracking wallet RPC class
 """
 """
-from ....globalvars import g
+
 from ....tw.ctl import TrackingWallet
 from ....tw.ctl import TrackingWallet
-from ....tw.view import TwView
 from ....addr import CoinAddr
 from ....addr import CoinAddr
 from ....tw.shared import TwLabel
 from ....tw.shared import TwLabel
 
 
-class EthereumTwCommon(TwView):
-
-	def age_disp(self,o,age_fmt): # TODO
-		pass
-
-	def get_disp_prec(self,wide):
-		return self.proto.coin_amt.max_prec if wide else 8
-
-	def subheader(self,color):
-		ret = ''
-		if self.disp_prec == 8:
-			ret += 'Balances truncated to 8 decimal points\n'
-		if g.cached_balances:
-			from ....color import nocolor,yellow
-			ret += (nocolor,yellow)[color](
-				'WARNING: Using cached balances. These may be out of date!') + '\n'
-		return ret
+class EthereumTwRPC:
 
 
 	async def get_addr_label_pairs(self,twmmid=None):
 	async def get_addr_label_pairs(self,twmmid=None):
 		wallet = (
 		wallet = (

+ 2 - 2
mmgen/proto/eth/tw/unspent.py

@@ -22,10 +22,10 @@ proto.eth.twuo: Ethereum tracking wallet unspent outputs class
 
 
 from ....tw.shared import TwLabel
 from ....tw.shared import TwLabel
 from ....tw.unspent import TwUnspentOutputs
 from ....tw.unspent import TwUnspentOutputs
-from .common import EthereumTwCommon
+from .view import EthereumTwView
 
 
 # No unspent outputs with Ethereum, but naming must be consistent
 # No unspent outputs with Ethereum, but naming must be consistent
-class EthereumTwUnspentOutputs(EthereumTwCommon,TwUnspentOutputs):
+class EthereumTwUnspentOutputs(EthereumTwView,TwUnspentOutputs):
 
 
 	class display_type(TwUnspentOutputs.display_type):
 	class display_type(TwUnspentOutputs.display_type):
 
 

+ 34 - 0
mmgen/proto/eth/tw/view.py

@@ -0,0 +1,34 @@
+#!/usr/bin/env python3
+#
+# mmgen = Multi-Mode GENerator, a command-line cryptocurrency wallet
+# Copyright (C)2013-2022 The MMGen Project <mmgen@tuta.io>
+# Licensed under the GNU General Public License, Version 3:
+#   https://www.gnu.org/licenses
+# Public project repositories:
+#   https://github.com/mmgen/mmgen
+#   https://gitlab.com/mmgen/mmgen
+
+"""
+proto.eth.tw.view: Ethereum base protocol base class for tracking wallet view classes
+"""
+
+from ....globalvars import g
+from ....tw.view import TwView
+
+class EthereumTwView(TwView):
+
+	def age_disp(self,o,age_fmt): # TODO
+		pass
+
+	def get_disp_prec(self,wide):
+		return self.proto.coin_amt.max_prec if wide else 8
+
+	def subheader(self,color):
+		ret = ''
+		if self.disp_prec == 8:
+			ret += 'Balances truncated to 8 decimal points\n'
+		if g.cached_balances:
+			from ....color import nocolor,yellow
+			ret += (nocolor,yellow)[color](
+				'WARNING: Using cached balances. These may be out of date!') + '\n'
+		return ret