Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
lightning-bits
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bitsoko services
lightning-bits
Commits
f2b8d059
Commit
f2b8d059
authored
Feb 13, 2019
by
Tankred Hase
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor computed channels to calculate balances in sat separately
parent
660fd326
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
16 deletions
+24
-16
channel.js
src/computed/channel.js
+24
-16
No files found.
src/computed/channel.js
View file @
f2b8d059
...
...
@@ -35,37 +35,45 @@ const ComputedChannel = store => {
});
return
all
;
},
get
channelBalanceOpenLabel
()
{
const
{
channels
,
settings
}
=
store
;
const
sum
=
(
channels
||
[])
get
channelBalanceOpenSatoshis
()
{
return
(
store
.
channels
||
[])
.
filter
(
c
=>
c
.
active
)
.
map
(
c
=>
Number
(
c
.
localBalance
))
.
reduce
((
a
,
b
)
=>
a
+
b
,
0
);
return
toAmountLabel
(
sum
,
settings
);
},
get
channelBalanceInactiveLabel
()
{
const
{
channels
,
settings
}
=
store
;
const
sum
=
(
channels
||
[])
get
channelBalanceOpenLabel
()
{
const
{
channelBalanceOpenSatoshis
,
settings
}
=
store
;
return
toAmountLabel
(
channelBalanceOpenSatoshis
,
settings
);
},
get
channelBalanceInactiveSatoshis
()
{
return
(
store
.
channels
||
[])
.
filter
(
c
=>
!
c
.
active
)
.
map
(
c
=>
Number
(
c
.
localBalance
))
.
reduce
((
a
,
b
)
=>
a
+
b
,
0
);
return
toAmountLabel
(
sum
,
settings
);
},
get
channelBalancePendingLabel
()
{
const
{
pendingChannels
,
settings
}
=
store
;
const
sum
=
(
pendingChannels
||
[])
get
channelBalanceInactiveLabel
()
{
const
{
channelBalanceInactiveSatoshis
,
settings
}
=
store
;
return
toAmountLabel
(
channelBalanceInactiveSatoshis
,
settings
);
},
get
channelBalancePendingSatoshis
()
{
return
(
store
.
pendingChannels
||
[])
.
filter
(
c
=>
c
.
status
.
includes
(
'open'
))
.
map
(
c
=>
Number
(
c
.
localBalance
))
.
reduce
((
a
,
b
)
=>
a
+
b
,
0
);
return
toAmountLabel
(
sum
,
settings
);
},
get
channelBalanceClosingLabel
()
{
const
{
pendingChannels
,
settings
}
=
store
;
const
sum
=
(
pendingChannels
||
[])
get
channelBalancePendingLabel
()
{
const
{
channelBalancePendingSatoshis
,
settings
}
=
store
;
return
toAmountLabel
(
channelBalancePendingSatoshis
,
settings
);
},
get
channelBalanceClosingSatoshis
()
{
return
(
store
.
pendingChannels
||
[])
.
filter
(
c
=>
!
c
.
status
.
includes
(
'open'
))
.
map
(
c
=>
Number
(
c
.
localBalance
))
.
reduce
((
a
,
b
)
=>
a
+
b
,
0
);
return
toAmountLabel
(
sum
,
settings
);
},
get
channelBalanceClosingLabel
()
{
const
{
channelBalanceClosingSatoshis
,
settings
}
=
store
;
return
toAmountLabel
(
channelBalanceClosingSatoshis
,
settings
);
},
get
showChannelAlert
()
{
return
(
store
.
channels
||
[]).
length
===
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment