proto.eth.tw.unspent: use parent MMGenTwUnspentOutput class

This commit is contained in:
The MMGen Project 2025-05-26 09:39:11 +00:00
commit c51cd601b3
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
3 changed files with 15 additions and 18 deletions

View file

@ -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

View file

@ -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'

View file

@ -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