mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-31 01:11:35 +00:00
kivy: show tx fee rate in tx dialog
This commit is contained in:
parent
cb204dd969
commit
c7a8540d06
2 changed files with 16 additions and 2 deletions
|
@ -14,7 +14,7 @@ from electrum.wallet import Wallet, InternalAddressCorruption
|
||||||
from electrum.paymentrequest import InvoiceStore
|
from electrum.paymentrequest import InvoiceStore
|
||||||
from electrum.util import profiler, InvalidPassword, send_exception_to_crash_reporter
|
from electrum.util import profiler, InvalidPassword, send_exception_to_crash_reporter
|
||||||
from electrum.plugin import run_hook
|
from electrum.plugin import run_hook
|
||||||
from electrum.util import format_satoshis, format_satoshis_plain
|
from electrum.util import format_satoshis, format_satoshis_plain, format_fee_satoshis
|
||||||
from electrum.paymentrequest import PR_UNPAID, PR_PAID, PR_UNKNOWN, PR_EXPIRED
|
from electrum.paymentrequest import PR_UNPAID, PR_PAID, PR_UNKNOWN, PR_EXPIRED
|
||||||
from electrum import blockchain
|
from electrum import blockchain
|
||||||
from electrum.network import Network, TxBroadcastError, BestEffortRequestFailed
|
from electrum.network import Network, TxBroadcastError, BestEffortRequestFailed
|
||||||
|
@ -808,6 +808,10 @@ class ElectrumWindow(App):
|
||||||
def format_amount_and_units(self, x):
|
def format_amount_and_units(self, x):
|
||||||
return format_satoshis_plain(x, self.decimal_point()) + ' ' + self.base_unit
|
return format_satoshis_plain(x, self.decimal_point()) + ' ' + self.base_unit
|
||||||
|
|
||||||
|
def format_fee_rate(self, fee_rate):
|
||||||
|
# fee_rate is in sat/kB
|
||||||
|
return format_fee_satoshis(fee_rate/1000) + ' sat/byte'
|
||||||
|
|
||||||
#@profiler
|
#@profiler
|
||||||
def update_wallet(self, *dt):
|
def update_wallet(self, *dt):
|
||||||
self._trigger_update_status()
|
self._trigger_update_status()
|
||||||
|
|
|
@ -27,6 +27,7 @@ Builder.load_string('''
|
||||||
can_broadcast: False
|
can_broadcast: False
|
||||||
can_rbf: False
|
can_rbf: False
|
||||||
fee_str: ''
|
fee_str: ''
|
||||||
|
feerate_str: ''
|
||||||
date_str: ''
|
date_str: ''
|
||||||
date_label:''
|
date_label:''
|
||||||
amount_str: ''
|
amount_str: ''
|
||||||
|
@ -65,6 +66,9 @@ Builder.load_string('''
|
||||||
BoxLabel:
|
BoxLabel:
|
||||||
text: _('Transaction fee') if root.fee_str else ''
|
text: _('Transaction fee') if root.fee_str else ''
|
||||||
value: root.fee_str
|
value: root.fee_str
|
||||||
|
BoxLabel:
|
||||||
|
text: _('Transaction fee rate') if root.feerate_str else ''
|
||||||
|
value: root.feerate_str
|
||||||
TopLabel:
|
TopLabel:
|
||||||
text: _('Transaction ID') + ':' if root.tx_hash else ''
|
text: _('Transaction ID') + ':' if root.tx_hash else ''
|
||||||
TxHashLabel:
|
TxHashLabel:
|
||||||
|
@ -148,7 +152,13 @@ class TxDialog(Factory.Popup):
|
||||||
else:
|
else:
|
||||||
self.is_mine = True
|
self.is_mine = True
|
||||||
self.amount_str = format_amount(-amount)
|
self.amount_str = format_amount(-amount)
|
||||||
self.fee_str = format_amount(fee) if fee is not None else _('unknown')
|
if fee is not None:
|
||||||
|
self.fee_str = format_amount(fee)
|
||||||
|
fee_per_kb = fee / self.tx.estimated_size() * 1000
|
||||||
|
self.feerate_str = self.app.format_fee_rate(fee_per_kb)
|
||||||
|
else:
|
||||||
|
self.fee_str = _('unknown')
|
||||||
|
self.feerate_str = _('unknown')
|
||||||
self.can_sign = self.wallet.can_sign(self.tx)
|
self.can_sign = self.wallet.can_sign(self.tx)
|
||||||
self.ids.output_list.update(self.tx.get_outputs_for_UI())
|
self.ids.output_list.update(self.tx.get_outputs_for_UI())
|
||||||
self.is_local_tx = tx_mined_status.height == TX_HEIGHT_LOCAL
|
self.is_local_tx = tx_mined_status.height == TX_HEIGHT_LOCAL
|
||||||
|
|
Loading…
Add table
Reference in a new issue