wallet.get_full_history: rm "include_fiat" arg, infer it from fx
ref https://github.com/spesmilo/electrum/pull/10209#discussion_r2334228490
This commit is contained in:
@@ -214,7 +214,6 @@ class QETransactionListModel(QAbstractListModel, QtEventListener):
|
|||||||
history = self.wallet.get_full_history(
|
history = self.wallet.get_full_history(
|
||||||
onchain_domain=self.onchain_domain,
|
onchain_domain=self.onchain_domain,
|
||||||
include_lightning=self.include_lightning,
|
include_lightning=self.include_lightning,
|
||||||
include_fiat=False,
|
|
||||||
)
|
)
|
||||||
txs = []
|
txs = []
|
||||||
for key, tx in history.items():
|
for key, tx in history.items():
|
||||||
|
|||||||
@@ -298,10 +298,9 @@ class HistoryModel(CustomModel, Logger):
|
|||||||
wallet = self.window.wallet
|
wallet = self.window.wallet
|
||||||
self.set_visibility_of_columns()
|
self.set_visibility_of_columns()
|
||||||
transactions = wallet.get_full_history(
|
transactions = wallet.get_full_history(
|
||||||
self.window.fx,
|
fx=self.window.fx if self.should_show_fiat() else None,
|
||||||
onchain_domain=self.get_domain(),
|
onchain_domain=self.get_domain(),
|
||||||
include_lightning=self.should_include_lightning_payments(),
|
include_lightning=self.should_include_lightning_payments(),
|
||||||
include_fiat=self.should_show_fiat(),
|
|
||||||
)
|
)
|
||||||
old_length = self._root.childCount()
|
old_length = self._root.childCount()
|
||||||
if old_length != 0:
|
if old_length != 0:
|
||||||
@@ -853,7 +852,7 @@ class HistoryList(MyTreeView, AcceptFileDragDrop):
|
|||||||
self.main_window.show_message(_("Your wallet history has been successfully exported."))
|
self.main_window.show_message(_("Your wallet history has been successfully exported."))
|
||||||
|
|
||||||
def do_export_history(self, file_name, is_csv):
|
def do_export_history(self, file_name, is_csv):
|
||||||
txns = self.wallet.get_full_history(fx=self.main_window.fx, include_fiat=self.main_window.fx.is_enabled())
|
txns = self.wallet.get_full_history(fx=self.main_window.fx if self.hm.should_show_fiat() else None)
|
||||||
lines = []
|
lines = []
|
||||||
|
|
||||||
def get_all_fees_paid_by_item(h_item: dict) -> Tuple[int, Fiat]:
|
def get_all_fees_paid_by_item(h_item: dict) -> Tuple[int, Fiat]:
|
||||||
|
|||||||
@@ -1427,16 +1427,16 @@ class Abstract_Wallet(ABC, Logger, EventListener):
|
|||||||
@profiler
|
@profiler
|
||||||
def get_full_history(
|
def get_full_history(
|
||||||
self,
|
self,
|
||||||
fx=None,
|
|
||||||
*,
|
*,
|
||||||
|
fx: 'FxThread' = None, # used for fiat values if set
|
||||||
onchain_domain=None,
|
onchain_domain=None,
|
||||||
include_lightning=True,
|
include_lightning=True,
|
||||||
include_fiat=False
|
|
||||||
) -> OrderedDictWithIndex:
|
) -> OrderedDictWithIndex:
|
||||||
"""
|
"""
|
||||||
includes both onchain and lightning
|
includes both onchain and lightning
|
||||||
includes grouping information
|
includes grouping information
|
||||||
"""
|
"""
|
||||||
|
include_fiat = fx is not None and fx.has_history()
|
||||||
transactions_tmp = OrderedDictWithIndex()
|
transactions_tmp = OrderedDictWithIndex()
|
||||||
# add on-chain txns
|
# add on-chain txns
|
||||||
onchain_history = self.get_onchain_history(domain=onchain_domain)
|
onchain_history = self.get_onchain_history(domain=onchain_domain)
|
||||||
@@ -1476,7 +1476,6 @@ class Abstract_Wallet(ABC, Logger, EventListener):
|
|||||||
if parent is None:
|
if parent is None:
|
||||||
parent = {
|
parent = {
|
||||||
'label': group_label,
|
'label': group_label,
|
||||||
'fiat_value': Fiat(Decimal(0), fx.ccy) if fx else None,
|
|
||||||
'bc_value': Satoshis(0),
|
'bc_value': Satoshis(0),
|
||||||
'ln_value': Satoshis(0),
|
'ln_value': Satoshis(0),
|
||||||
'value': Satoshis(0),
|
'value': Satoshis(0),
|
||||||
@@ -1489,6 +1488,8 @@ class Abstract_Wallet(ABC, Logger, EventListener):
|
|||||||
'confirmations': 0,
|
'confirmations': 0,
|
||||||
'txid': '----',
|
'txid': '----',
|
||||||
}
|
}
|
||||||
|
if include_fiat:
|
||||||
|
parent['fiat_value'] = Fiat(Decimal(0), fx.ccy)
|
||||||
transactions[key] = parent
|
transactions[key] = parent
|
||||||
parent['bc_value'] += tx_item['bc_value']
|
parent['bc_value'] += tx_item['bc_value']
|
||||||
parent['ln_value'] += tx_item['ln_value']
|
parent['ln_value'] += tx_item['ln_value']
|
||||||
|
|||||||
Reference in New Issue
Block a user