| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- #!/usr/bin/env python3
- #
- # mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution
- # Copyright (C)2013-2024 The MMGen Project <mmgen@tuta.io>
- #
- # This program is free software: you can redistribute it and/or modify
- # it under the terms of the GNU General Public License as published by
- # the Free Software Foundation, either version 3 of the License, or
- # (at your option) any later version.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
- """
- proto.eth.tw.bal: Ethereum tracking wallet getbalance class
- """
- from ....tw.ctl import TwCtl
- from ....tw.bal import TwGetBalance
- class EthereumTwGetBalance(TwGetBalance):
- start_labels = ('TOTAL','Non-MMGen')
- conf_cols = {
- 'ge_minconf': 'Balance',
- }
- async def __init__(self,cfg,proto,*args,**kwargs):
- self.twctl = await TwCtl(cfg,proto,mode='w')
- await super().__init__(cfg,proto,*args,**kwargs)
- async def create_data(self):
- in_data = self.twctl.mmid_ordered_dict
- for d in in_data:
- if d.type == 'mmgen':
- label = d.obj.sid
- if label not in self.data:
- self.data[label] = self.balance_info()
- else:
- label = 'Non-MMGen'
- amt = await self.twctl.get_balance(in_data[d]['addr'])
- self.data['TOTAL']['ge_minconf'] += amt
- self.data[label]['ge_minconf'] += amt
- del self.twctl
- class EthereumTokenTwGetBalance(EthereumTwGetBalance):
- pass
|