mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
gui: display lightning balance in status bar
This commit is contained in:
parent
18bd934461
commit
b7d93e2e11
3 changed files with 11 additions and 0 deletions
|
@ -348,11 +348,14 @@ class Commands:
|
||||||
def getbalance(self):
|
def getbalance(self):
|
||||||
"""Return the balance of your wallet. """
|
"""Return the balance of your wallet. """
|
||||||
c, u, x = self.wallet.get_balance()
|
c, u, x = self.wallet.get_balance()
|
||||||
|
l = self.lnworker.get_balance()
|
||||||
out = {"confirmed": str(Decimal(c)/COIN)}
|
out = {"confirmed": str(Decimal(c)/COIN)}
|
||||||
if u:
|
if u:
|
||||||
out["unconfirmed"] = str(Decimal(u)/COIN)
|
out["unconfirmed"] = str(Decimal(u)/COIN)
|
||||||
if x:
|
if x:
|
||||||
out["unmatured"] = str(Decimal(x)/COIN)
|
out["unmatured"] = str(Decimal(x)/COIN)
|
||||||
|
if l:
|
||||||
|
out["lightning"] = str(Decimal(l)/COIN)
|
||||||
return out
|
return out
|
||||||
|
|
||||||
@command('n')
|
@command('n')
|
||||||
|
|
|
@ -371,6 +371,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
|
||||||
self.channels_list.update_rows.emit(*args)
|
self.channels_list.update_rows.emit(*args)
|
||||||
elif event == 'channel':
|
elif event == 'channel':
|
||||||
self.channels_list.update_single_row.emit(*args)
|
self.channels_list.update_single_row.emit(*args)
|
||||||
|
self.update_status()
|
||||||
elif event == 'ln_status':
|
elif event == 'ln_status':
|
||||||
self.need_update_ln.set()
|
self.need_update_ln.set()
|
||||||
else:
|
else:
|
||||||
|
@ -850,6 +851,9 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
|
||||||
text += " [%s unconfirmed]"%(self.format_amount(u, is_diff=True).strip())
|
text += " [%s unconfirmed]"%(self.format_amount(u, is_diff=True).strip())
|
||||||
if x:
|
if x:
|
||||||
text += " [%s unmatured]"%(self.format_amount(x, is_diff=True).strip())
|
text += " [%s unmatured]"%(self.format_amount(x, is_diff=True).strip())
|
||||||
|
l = self.wallet.lnworker.get_balance()
|
||||||
|
if l:
|
||||||
|
text += u' \U0001f5f2 %s'%(self.format_amount_and_units(l).strip())
|
||||||
|
|
||||||
# append fiat balance and price
|
# append fiat balance and price
|
||||||
if self.fx.is_enabled():
|
if self.fx.is_enabled():
|
||||||
|
|
|
@ -572,6 +572,10 @@ class LNWorker(PrintError):
|
||||||
self.wallet.storage.put('lightning_invoices', self.invoices)
|
self.wallet.storage.put('lightning_invoices', self.invoices)
|
||||||
self.wallet.storage.write()
|
self.wallet.storage.write()
|
||||||
|
|
||||||
|
def get_balance(self):
|
||||||
|
with self.lock:
|
||||||
|
return Decimal(sum(chan.balance(LOCAL) for chan in self.channels.values()))/1000
|
||||||
|
|
||||||
def list_channels(self):
|
def list_channels(self):
|
||||||
with self.lock:
|
with self.lock:
|
||||||
# we output the funding_outpoint instead of the channel_id because lnd uses channel_point (funding outpoint) to identify channels
|
# we output the funding_outpoint instead of the channel_id because lnd uses channel_point (funding outpoint) to identify channels
|
||||||
|
|
Loading…
Add table
Reference in a new issue