Skip to content

Commit

Permalink
sort imported addresses by balance
Browse files Browse the repository at this point in the history
  • Loading branch information
schnogz committed May 9, 2019
1 parent ced1a59 commit e77b5d9
Showing 1 changed file with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
import {
concat,
curry,
descend,
filter,
has,
map,
sequence,
sort,
reduce,
prepend
prepend,
prop,
head,
path,
set,
lensProp,
compose,
lensIndex
} from 'ramda'
import { Exchange, Remote } from 'blockchain-wallet-v4/src'
import { selectors } from 'data'
Expand Down Expand Up @@ -75,7 +84,15 @@ export const getData = (state, ownProps) => {
.map(toDropdown)
.map(toGroup('Lockbox'))
]).map(([b1, b2, b3]) => {
const data = reduce(concat, [], [b1, b2, b3])
const importedAddressesSorted = set(
compose(
lensIndex(0),
lensProp('options')
),
sort(descend(path(['value', 'balance'])), prop('options', head(b2))),
b2
)
const data = reduce(concat, [], [b1, importedAddressesSorted, b3])
if (includeAll) {
return { data: prepend(allWallets, data) }
} else if (excludeHDWallets) {
Expand Down

0 comments on commit e77b5d9

Please sign in to comment.