Skip to content

Commit

Permalink
feat(no watch only in bch send dropdown)
Browse files Browse the repository at this point in the history
  • Loading branch information
sixtedemaupeou committed Jun 22, 2018
1 parent f42e712 commit 4fe1fc3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { assoc, assocPath, compose, concat, filter, lift, map, path, prop, sequence } from 'ramda'
import { assoc, assocPath, compose, concat, filter, isNil, lift, map, not, path, prop, sequence } from 'ramda'
import { Remote } from 'blockchain-wallet-v4/src'
import { selectors } from 'data'

export const getData = (state, ownProps) => {
const { coin, exclude = [], excludeImported } = ownProps
const { coin, exclude = [], excludeImported, noBchWatchOnly } = ownProps
const isActive = filter(x => !x.archived)
const excluded = filter(x => !exclude.includes(x.label))
const toDropdown = map(x => ({ text: x.label, value: x }))
Expand All @@ -26,10 +26,14 @@ export const getData = (state, ownProps) => {
switch (coin) {
case 'BCH':
const importedAddresses = selectors.core.common.bch.getActiveAddresses(state)
const filterRelevantAddresses = addrs =>
noBchWatchOnly ? filter(addr => not(isNil(prop('priv', addr))), addrs) : addrs
const relevantAddresses = lift(filterRelevantAddresses)(importedAddresses)

return sequence(Remote.of,
[
selectors.core.common.bch.getAccountsBalances(state).map(isActive).map(excluded).map(toDropdown),
excludeImported ? Remote.of([]) : lift(formatImportedAddressesData)(importedAddresses)
excludeImported ? Remote.of([]) : lift(formatImportedAddressesData)(relevantAddresses)
]).map(([b1, b2]) => ({ data: concat(b1, b2) }))
default:
return sequence(Remote.of,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const FirstStep = props => {
<FormLabel for='from'>
<FormattedMessage id='modals.sendBch.firststep.from' defaultMessage='From:' />
</FormLabel>
<Field name='from' component={SelectBoxBitcoinAddresses} includeAll={false} validate={[required]} coin='BCH' />
<Field name='from' component={SelectBoxBitcoinAddresses} includeAll={false} noBchWatchOnly validate={[required]} coin='BCH' />
</FormItem>
</FormGroup>
<FormGroup margin={'15px'}>
Expand Down

0 comments on commit 4fe1fc3

Please sign in to comment.