diff --git a/client/src/model.js b/client/src/model.js index f85eae7..b8fdfb7 100644 --- a/client/src/model.js +++ b/client/src/model.js @@ -5,8 +5,8 @@ import { dbg, getChannels, formatAmt, recvAmt, combine, isConnError } from './ut const msatbtc = big(100000000000) // msat in 1 btc const - sumChans = chans => chans.filter(c => c.peer.connected && c.chan.state === 'CHANNELD_NORMAL') - .reduce((T, c) => T + Math.max(0, c.chan.spendable_msatoshi), 0) + sumChans = chans => chans.filter(c => c.chan.state === 'CHANNELD_NORMAL') + .reduce((T, c) => T + Math.max(0, c.chan.msatoshi_to_us), 0) , fmtAlert = (s, unitf) => s.replace(/@\{\{(\d+)\}\}/g, (_, msat) => unitf(msat)) @@ -77,6 +77,7 @@ module.exports = ({ dismiss$, togExp$, togTheme$, togUnit$, page$, goHome$, goRe .startWith(null) // On-chain balance + // TODO: patch with known outgoing payments , obalance$ = funds$.map(funds => funds.outputs.reduce((T, o) => T+o.value*1000, 0)) .distinctUntilChanged() diff --git a/client/src/views/layout.js b/client/src/views/layout.js index 1c8567f..c42f461 100644 --- a/client/src/views/layout.js +++ b/client/src/views/layout.js @@ -12,13 +12,13 @@ const layout = ({ state: S, body }) => , S.info ? footer(S) : '' ]) -const navbar = ({ unitf, cbalance, page }) => +const navbar = ({ unitf, cbalance, obalance, page }) => nav(`.navbar.navbar-dark.bg-primary.mb-3`, div('.container', [ a('.navbar-brand', { attrs: { href: '#/' } }, [ page.pathname != '/' ? span('.icon.icon-left-open') : '' , 'Spark' ]) - , cbalance != null ? span('.toggle-unit.navbar-brand.mr-0', unitf(cbalance)) : '' + , cbalance != null && obalance != null ? span('.toggle-unit.navbar-brand.mr-0', unitf(cbalance + obalance)) : '' ])) const footer = ({ info, btcusd, msatusd, rate, conf: { unit, theme, expert } }) =>