From c51cd601b3890ffd7fa541ee23d61caee2b05fab Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Mon, 26 May 2025 09:39:11 +0000 Subject: [PATCH] proto.eth.tw.unspent: use parent `MMGenTwUnspentOutput` class --- mmgen/proto/btc/tw/unspent.py | 5 ++++- mmgen/proto/eth/tw/unspent.py | 5 ----- mmgen/tw/unspent.py | 23 +++++++++++------------ 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/mmgen/proto/btc/tw/unspent.py b/mmgen/proto/btc/tw/unspent.py index 83927cc4..3d870173 100755 --- a/mmgen/proto/btc/tw/unspent.py +++ b/mmgen/proto/btc/tw/unspent.py @@ -12,7 +12,9 @@ proto.btc.tw.unspent: Bitcoin base protocol tracking wallet unspent outputs class """ +from ....obj import ImmutableAttr, ListItemAttr, HexStr from ....tw.unspent import TwUnspentOutputs + from .view import BitcoinTwView class BitcoinTwUnspentOutputs(BitcoinTwView, TwUnspentOutputs): @@ -39,7 +41,8 @@ class BitcoinTwUnspentOutputs(BitcoinTwView, TwUnspentOutputs): 'date', 'scriptPubKey', 'skip'} - invalid_attrs = {'proto'} + date = ListItemAttr(int, typeconv=False, reassign_ok=True) + scriptPubKey = ImmutableAttr(HexStr) has_age = True can_group = True diff --git a/mmgen/proto/eth/tw/unspent.py b/mmgen/proto/eth/tw/unspent.py index 755c0d23..88a1d64f 100755 --- a/mmgen/proto/eth/tw/unspent.py +++ b/mmgen/proto/eth/tw/unspent.py @@ -24,13 +24,8 @@ from ....tw.shared import TwLabel from ....tw.unspent import TwUnspentOutputs from .view import EthereumTwView -# No unspent outputs with Ethereum, but naming must be consistent class EthereumTwUnspentOutputs(EthereumTwView, TwUnspentOutputs): - class MMGenTwUnspentOutput(TwUnspentOutputs.MMGenTwUnspentOutput): - valid_attrs = {'txid', 'vout', 'amt', 'amt2', 'comment', 'twmmid', 'addr', 'confs', 'skip'} - invalid_attrs = {'proto'} - hdr_lbl = 'tracked accounts' desc = 'account balances' item_desc = 'account' diff --git a/mmgen/tw/unspent.py b/mmgen/tw/unspent.py index 1a8b4d30..d1baf760 100755 --- a/mmgen/tw/unspent.py +++ b/mmgen/tw/unspent.py @@ -26,7 +26,6 @@ from ..obj import ( ListItemAttr, MMGenListItem, TwComment, - HexStr, CoinTxID, NonNegativeInt) from ..addr import CoinAddr @@ -82,17 +81,17 @@ class TwUnspentOutputs(TwView): cols = ('num', 'addr', 'mmid', 'amt', 'amt2', 'comment') class MMGenTwUnspentOutput(MMGenListItem): - txid = ListItemAttr(CoinTxID) - vout = ListItemAttr(NonNegativeInt) - amt = ImmutableAttr(CoinAmtChk, include_proto=True) - amt2 = ListItemAttr(CoinAmtChk, include_proto=True) # the ETH balance for token account - comment = ListItemAttr(TwComment, reassign_ok=True) - twmmid = ImmutableAttr(TwMMGenID, include_proto=True) - addr = ImmutableAttr(CoinAddr, include_proto=True) - confs = ImmutableAttr(int, typeconv=False) - date = ListItemAttr(int, typeconv=False, reassign_ok=True) - scriptPubKey = ImmutableAttr(HexStr) - skip = ListItemAttr(str, typeconv=False, reassign_ok=True) + valid_attrs = {'txid', 'vout', 'amt', 'amt2', 'comment', 'twmmid', 'addr', 'confs', 'skip'} + invalid_attrs = {'proto'} + txid = ListItemAttr(CoinTxID) + vout = ListItemAttr(NonNegativeInt) + amt = ImmutableAttr(CoinAmtChk, include_proto=True) + amt2 = ListItemAttr(CoinAmtChk, include_proto=True) # the ETH balance for token account + comment = ListItemAttr(TwComment, reassign_ok=True) + twmmid = ImmutableAttr(TwMMGenID, include_proto=True) + addr = ImmutableAttr(CoinAddr, include_proto=True) + confs = ImmutableAttr(int, typeconv=False) + skip = ListItemAttr(str, typeconv=False, reassign_ok=True) def __init__(self, proto, **kwargs): self.__dict__['proto'] = proto