kivy: simplify swaps dialog
This commit is contained in:
@@ -27,15 +27,11 @@ Builder.load_string(r'''
|
|||||||
title: _('Lightning Swap')
|
title: _('Lightning Swap')
|
||||||
size_hint: 0.8, 0.8
|
size_hint: 0.8, 0.8
|
||||||
pos_hint: {'top':0.9}
|
pos_hint: {'top':0.9}
|
||||||
|
mining_fee_text: ''
|
||||||
|
fee_rate_text: ''
|
||||||
method: 0
|
method: 0
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
orientation: 'vertical'
|
orientation: 'vertical'
|
||||||
BoxLayout:
|
|
||||||
orientation: 'horizontal'
|
|
||||||
size_hint: 1, 0.5
|
|
||||||
Label:
|
|
||||||
text: _('Swap Settings')
|
|
||||||
background_color: (0,0,0,0)
|
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
orientation: 'horizontal'
|
orientation: 'horizontal'
|
||||||
size_hint: 1, 0.5
|
size_hint: 1, 0.5
|
||||||
@@ -69,17 +65,6 @@ Builder.load_string(r'''
|
|||||||
text: _('0')
|
text: _('0')
|
||||||
background_color: (0,0,0,0)
|
background_color: (0,0,0,0)
|
||||||
size_hint: 0.6, 1
|
size_hint: 0.6, 1
|
||||||
BoxLayout:
|
|
||||||
orientation: 'horizontal'
|
|
||||||
size_hint: 1, 0.5
|
|
||||||
Label:
|
|
||||||
text: _('Mining Fee') + ':'
|
|
||||||
size_hint: 0.4, 1
|
|
||||||
Label:
|
|
||||||
id: mining_fee_label
|
|
||||||
text: _('0')
|
|
||||||
background_color: (0,0,0,0)
|
|
||||||
size_hint: 0.6, 1
|
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
orientation: 'horizontal'
|
orientation: 'horizontal'
|
||||||
size_hint: 1, 0.5
|
size_hint: 1, 0.5
|
||||||
@@ -99,16 +84,10 @@ Builder.load_string(r'''
|
|||||||
orientation: 'horizontal'
|
orientation: 'horizontal'
|
||||||
size_hint: 1, 0.5
|
size_hint: 1, 0.5
|
||||||
Label:
|
Label:
|
||||||
text: _('Onchain Fees')
|
text: _('Mining Fee') + ':'
|
||||||
background_color: (0,0,0,0)
|
size_hint: 0.4, 1
|
||||||
BoxLayout:
|
|
||||||
orientation: 'horizontal'
|
|
||||||
size_hint: 1, 0.5
|
|
||||||
Label:
|
|
||||||
text: _('Fee rate:')
|
|
||||||
Button:
|
Button:
|
||||||
id: fee_rate
|
text: root.mining_fee_text + ' (' + root.fee_rate_text + ')'
|
||||||
text: '? sat/B'
|
|
||||||
background_color: (0,0,0,0)
|
background_color: (0,0,0,0)
|
||||||
bold: True
|
bold: True
|
||||||
on_release:
|
on_release:
|
||||||
@@ -673,7 +652,7 @@ class SwapDialog(Factory.Popup):
|
|||||||
msg = f'Info: Your swap is estimated to be processed in {eta} ' \
|
msg = f'Info: Your swap is estimated to be processed in {eta} ' \
|
||||||
f'block{s} with an onchain fee rate of {fee_per_b} sat/B.'
|
f'block{s} with an onchain fee rate of {fee_per_b} sat/B.'
|
||||||
|
|
||||||
self.ids.fee_rate.text = f'{fee_per_b} sat/B'
|
self.fee_rate_text = f'{fee_per_b} sat/B'
|
||||||
self.ids.fee_estimate.text = msg
|
self.ids.fee_estimate.text = msg
|
||||||
|
|
||||||
def update_tx(self, onchain_amount: Union[int, str]):
|
def update_tx(self, onchain_amount: Union[int, str]):
|
||||||
@@ -734,7 +713,7 @@ class SwapDialog(Factory.Popup):
|
|||||||
# fee breakdown
|
# fee breakdown
|
||||||
self.ids.server_fee_label.text = \
|
self.ids.server_fee_label.text = \
|
||||||
f"{self.swap_manager.percentage:0.1f}% + {self.fmt_amt(self.swap_manager.lockup_fee)}"
|
f"{self.swap_manager.percentage:0.1f}% + {self.fmt_amt(self.swap_manager.lockup_fee)}"
|
||||||
self.ids.mining_fee_label.text = \
|
self.mining_fee_text = \
|
||||||
f"{self.fmt_amt(self.swap_manager.get_claim_fee())}"
|
f"{self.fmt_amt(self.swap_manager.get_claim_fee())}"
|
||||||
|
|
||||||
else: # forward (normal) swap
|
else: # forward (normal) swap
|
||||||
@@ -757,7 +736,7 @@ class SwapDialog(Factory.Popup):
|
|||||||
# fee breakdown
|
# fee breakdown
|
||||||
self.ids.server_fee_label.text = \
|
self.ids.server_fee_label.text = \
|
||||||
f"{self.swap_manager.percentage:0.1f}% + {self.fmt_amt(self.swap_manager.normal_fee)}"
|
f"{self.swap_manager.percentage:0.1f}% + {self.fmt_amt(self.swap_manager.normal_fee)}"
|
||||||
self.ids.mining_fee_label.text = \
|
self.mining_fee_text = \
|
||||||
f"{self.fmt_amt(self.tx.get_fee())}" if self.tx else ""
|
f"{self.fmt_amt(self.tx.get_fee())}" if self.tx else ""
|
||||||
|
|
||||||
if pay_amount and receive_amount:
|
if pay_amount and receive_amount:
|
||||||
|
|||||||
Reference in New Issue
Block a user