Skip to content
This repository was archived by the owner on Jan 22, 2026. It is now read-only.

Commit ff52abd

Browse files
authored
Merge pull request #1735 from blockchain/feat/pit-send-dropdown
Feat/pit send dropdown
2 parents 2ddbea8 + d565caf commit ff52abd

30 files changed

Lines changed: 264 additions & 23 deletions

File tree

packages/blockchain-info-components/src/Buttons/Button.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ Button.propTypes = {
180180
'gray-3',
181181
'light',
182182
'primary',
183+
'purple',
183184
'received',
184185
'secondary',
185186
'sent',

packages/blockchain-wallet-v4-frontend/src/components/Form/SelectBoxBchAddresses/selectors.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ export const getData = (state, ownProps) => {
5454
excludeWatchOnly,
5555
excludeImported,
5656
excludeLockbox,
57-
includeAll = true
57+
includeAll = true,
58+
includePitAddress
5859
} = ownProps
5960
const buildDisplay = wallet => {
6061
if (has('balance', wallet)) {
@@ -71,6 +72,13 @@ export const getData = (state, ownProps) => {
7172
const excluded = filter(x => !exclude.includes(x.label))
7273
const toDropdown = map(x => ({ label: buildDisplay(x), value: x }))
7374
const toGroup = curry((label, options) => [{ label, options }])
75+
const toPit = x => [{ label: `My PIT BCH Address`, value: x }]
76+
77+
const pitAddress = selectors.components.send.getPaymentsAccountPit(
78+
'BCH',
79+
state
80+
)
81+
const hasPitAddress = Remote.Success.is(pitAddress)
7482

7583
const formatAddress = addressData => {
7684
const formattedAddress = {}
@@ -133,9 +141,12 @@ export const getData = (state, ownProps) => {
133141
.getLockboxBchBalances(state)
134142
.map(excluded)
135143
.map(toDropdown)
136-
.map(toGroup('Lockbox'))
137-
]).map(([b1, b2, b3]) => {
138-
const data = reduce(concat, [], [b1, b2, b3])
144+
.map(toGroup('Lockbox')),
145+
includePitAddress && hasPitAddress
146+
? pitAddress.map(toPit).map(toGroup('The PIT'))
147+
: Remote.of([])
148+
]).map(([b1, b2, b3, b4]) => {
149+
const data = reduce(concat, [], [b1, b2, b3, b4])
139150
if (includeAll) {
140151
return { data: prepend(allWallets, data) }
141152
} else if (excludeHDWallets) {

packages/blockchain-wallet-v4-frontend/src/components/Form/SelectBoxBtcAddresses/selectors.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ export const getData = (state, ownProps) => {
4646
excludeHDWallets,
4747
excludeImported,
4848
excludeLockbox,
49-
includeAll = true
49+
includeAll = true,
50+
includePitAddress
5051
} = ownProps
5152
const buildDisplay = wallet => {
5253
if (has('balance', wallet)) {
@@ -62,6 +63,13 @@ export const getData = (state, ownProps) => {
6263
const excluded = filter(x => !exclude.includes(x.label))
6364
const toDropdown = map(x => ({ label: buildDisplay(x), value: x }))
6465
const toGroup = curry((label, options) => [{ label, options }])
66+
const toPit = x => [{ label: `My PIT BTC Address`, value: x }]
67+
68+
const pitAddress = selectors.components.send.getPaymentsAccountPit(
69+
'BTC',
70+
state
71+
)
72+
const hasPitAddress = Remote.Success.is(pitAddress)
6573

6674
const getAddressesData = () => {
6775
return sequence(Remote.of, [
@@ -95,9 +103,12 @@ export const getData = (state, ownProps) => {
95103
.getLockboxBtcBalances(state)
96104
.map(excluded)
97105
.map(toDropdown)
98-
.map(toGroup('Lockbox'))
99-
]).map(([b1, b2, b3]) => {
100-
const data = reduce(concat, [], [b1, b2, b3])
106+
.map(toGroup('Lockbox')),
107+
includePitAddress && hasPitAddress
108+
? pitAddress.map(toPit).map(toGroup('The PIT'))
109+
: Remote.of([])
110+
]).map(([b1, b2, b3, b4]) => {
111+
const data = reduce(concat, [], [b1, b2, b3, b4])
101112
if (includeAll) {
102113
return { data: prepend(allWallets, data) }
103114
} else if (excludeHDWallets) {

packages/blockchain-wallet-v4-frontend/src/components/Form/SelectBoxEthAddresses/selectors.js

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { concat, curry, filter, has, map, sequence } from 'ramda'
1+
import { concat, curry, filter, has, map, reduce, sequence } from 'ramda'
22
import { Exchange, Remote } from 'blockchain-wallet-v4/src'
33
import { selectors } from 'data'
44

55
export const getEthData = (state, ownProps) => {
6-
const { exclude = [], excludeLockbox } = ownProps
6+
const { exclude = [], excludeLockbox, includePitAddress } = ownProps
77
const displayEtherFixed = data => {
88
const etherAmount = Exchange.convertEtherToEther(data)
99
return Exchange.displayEtherToEther({
@@ -26,6 +26,13 @@ export const getEthData = (state, ownProps) => {
2626
const excluded = filter(x => !exclude.includes(x.label))
2727
const toDropdown = map(x => ({ label: buildDisplay(x), value: x }))
2828
const toGroup = curry((label, options) => [{ label, options, value: '' }])
29+
const toPit = x => [{ label: `My PIT ETH Address`, value: x }]
30+
31+
const pitAddress = selectors.components.send.getPaymentsAccountPit(
32+
'ETH',
33+
state
34+
)
35+
const hasPitAddress = Remote.Success.is(pitAddress)
2936

3037
const getAddressesData = () => {
3138
return sequence(Remote.of, [
@@ -40,15 +47,18 @@ export const getEthData = (state, ownProps) => {
4047
.getLockboxEthBalances(state)
4148
.map(excluded)
4249
.map(toDropdown)
43-
.map(toGroup('Lockbox'))
44-
]).map(([b1, b2]) => ({ data: concat(b1, b2) }))
50+
.map(toGroup('Lockbox')),
51+
includePitAddress && hasPitAddress
52+
? pitAddress.map(toPit).map(toGroup('The PIT'))
53+
: Remote.of([])
54+
]).map(([b1, b2, b3]) => ({ data: reduce(concat, [], [b1, b2, b3]) }))
4555
}
4656

4757
return getAddressesData()
4858
}
4959

5060
export const getErc20Data = (state, ownProps) => {
51-
const { coin, exclude = [] } = ownProps
61+
const { coin, exclude = [], includePitAddress } = ownProps
5262
const displayErc20Fixed = data => {
5363
// TODO: ERC20 make more generic
5464
if (coin === 'PAX') {
@@ -72,6 +82,13 @@ export const getErc20Data = (state, ownProps) => {
7282
}
7383
const toDropdown = map(x => ({ label: buildDisplay(x), value: x }))
7484
const toGroup = curry((label, options) => [{ label, options }])
85+
const toPit = x => [{ label: `My PIT ${coin} Address`, value: x }]
86+
87+
const pitAddress = selectors.components.send.getPaymentsAccountPit(
88+
coin,
89+
state
90+
)
91+
const hasPitAddress = Remote.Success.is(pitAddress)
7592

7693
const getAddressesData = () => {
7794
return sequence(Remote.of, [
@@ -80,8 +97,11 @@ export const getErc20Data = (state, ownProps) => {
8097
.map(excluded)
8198
.map(toDropdown)
8299
.map(toGroup('Wallet')),
83-
Remote.of([])
84-
]).map(([b1, b2]) => ({ data: concat(b1, b2) }))
100+
Remote.of([]),
101+
includePitAddress && hasPitAddress
102+
? pitAddress.map(toPit).map(toGroup('The PIT'))
103+
: Remote.of([])
104+
]).map(([b1, b2, b3]) => ({ data: reduce(concat, [], [b1, b2, b3]) }))
85105
}
86106

87107
return getAddressesData()

packages/blockchain-wallet-v4-frontend/src/components/Form/SelectBoxXlmAddresses/selectors.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { concat, curry, filter, has, map, sequence } from 'ramda'
1+
import { concat, curry, filter, has, map, reduce, sequence } from 'ramda'
22
import { Exchange, Remote } from 'blockchain-wallet-v4/src'
33
import { selectors } from 'data'
44
import { createDeepEqualSelector } from 'services/ReselectHelper'
@@ -7,10 +7,19 @@ export const getData = createDeepEqualSelector(
77
[
88
selectors.core.common.xlm.getAccountBalances,
99
selectors.core.common.xlm.getLockboxXlmBalances,
10+
selectors.components.send.getPaymentsAccountPit('XLM'),
11+
(state, { includePitAddress }) => includePitAddress,
1012
(state, { exclude }) => exclude,
1113
(state, { excludeLockbox }) => excludeLockbox
1214
],
13-
(walletBalances, lockboxBalances, exclude = [], excludeLockbox) => {
15+
(
16+
walletBalances,
17+
lockboxBalances,
18+
pitAddress,
19+
includePitAddress,
20+
exclude = [],
21+
excludeLockbox
22+
) => {
1423
const buildDisplay = wallet => {
1524
if (has('balance', wallet)) {
1625
let xlmDisplay = Exchange.displayXlmToXlm({
@@ -25,6 +34,9 @@ export const getData = createDeepEqualSelector(
2534
const excluded = filter(x => !exclude.includes(x.label))
2635
const toDropdown = map(x => ({ label: buildDisplay(x), value: x }))
2736
const toGroup = curry((label, options) => [{ label, options }])
37+
const toPit = x => [{ label: `My PIT XLM Address`, value: x }]
38+
39+
const hasPitAddress = Remote.Success.is(pitAddress)
2840

2941
return sequence(Remote.of, [
3042
walletBalances
@@ -36,7 +48,10 @@ export const getData = createDeepEqualSelector(
3648
: lockboxBalances
3749
.map(excluded)
3850
.map(toDropdown)
39-
.map(toGroup('Lockbox'))
40-
]).map(([b1, b2]) => ({ data: concat(b1, b2) }))
51+
.map(toGroup('Lockbox')),
52+
includePitAddress && hasPitAddress
53+
? pitAddress.map(toPit).map(toGroup('The PIT'))
54+
: Remote.of([])
55+
]).map(([b1, b2, b3]) => ({ data: reduce(concat, [], [b1, b2, b3]) }))
4156
}
4257
)

packages/blockchain-wallet-v4-frontend/src/data/components/actionTypes.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import * as requestBtc from './requestBtc/actionTypes'
2020
import * as requestBch from './requestBch/actionTypes'
2121
import * as requestEth from './requestEth/actionTypes'
2222
import * as requestXlm from './requestXlm/actionTypes'
23+
import * as send from './send/actionTypes'
2324
import * as sendBch from './sendBch/actionTypes'
2425
import * as sendBtc from './sendBtc/actionTypes'
2526
import * as sendEth from './sendEth/actionTypes'
@@ -53,6 +54,7 @@ export {
5354
requestBch,
5455
requestEth,
5556
requestXlm,
57+
send,
5658
sendBch,
5759
sendBtc,
5860
sendEth,

packages/blockchain-wallet-v4-frontend/src/data/components/actions.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import * as requestBtc from './requestBtc/actions'
2020
import * as requestBch from './requestBch/actions'
2121
import * as requestEth from './requestEth/actions'
2222
import * as requestXlm from './requestXlm/actions'
23+
import * as send from './send/actions'
2324
import * as sendBch from './sendBch/actions'
2425
import * as sendBtc from './sendBtc/actions'
2526
import * as sendEth from './sendEth/actions'
@@ -53,6 +54,7 @@ export {
5354
requestBch,
5455
requestEth,
5556
requestXlm,
57+
send,
5658
sendBch,
5759
sendBtc,
5860
sendEth,

packages/blockchain-wallet-v4-frontend/src/data/components/reducers.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import layoutWallet from './layoutWallet/reducers'
88
import manageAddresses from './manageAddresses/reducers'
99
import onfido from './onfido/reducers'
1010
import priceChart from './priceChart/reducers'
11+
import send from './send/reducers'
1112
import sendBch from './sendBch/reducers'
1213
import sendBtc from './sendBtc/reducers'
1314
import sendEth from './sendEth/reducers'
@@ -26,6 +27,7 @@ export default combineReducers({
2627
manageAddresses,
2728
onfido,
2829
priceChart,
30+
send,
2931
sendBch,
3032
sendBtc,
3133
sendEth,

packages/blockchain-wallet-v4-frontend/src/data/components/sagaRegister.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import requestBtc from './requestBtc/sagaRegister'
2020
import requestBch from './requestBch/sagaRegister'
2121
import requestEth from './requestEth/sagaRegister'
2222
import requestXlm from './requestXlm/sagaRegister'
23+
import send from './send/sagaRegister'
2324
import sendBch from './sendBch/sagaRegister'
2425
import sendBtc from './sendBtc/sagaRegister'
2526
import sendEth from './sendEth/sagaRegister'
@@ -53,6 +54,7 @@ export default ({ api, coreSagas, networks }) =>
5354
yield fork(requestBch({ networks }))
5455
yield fork(requestEth({ networks }))
5556
yield fork(requestXlm())
57+
yield fork(send({ api }))
5658
yield fork(sendBch({ coreSagas, networks }))
5759
yield fork(sendBtc({ coreSagas, networks }))
5860
yield fork(sendEth({ api, coreSagas, networks }))

packages/blockchain-wallet-v4-frontend/src/data/components/sagas.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import requestBtc from './requestBtc/sagas'
1818
import requestBch from './requestBch/sagas'
1919
import requestEth from './requestEth/sagas'
2020
import requestXlm from './requestXlm/sagas'
21+
import send from './send/sagas'
2122
import sendBch from './sendBch/sagas'
2223
import sendBtc from './sendBtc/sagas'
2324
import sendEth from './sendEth/sagas'
@@ -49,6 +50,7 @@ export default ({ api, coreSagas, networks }) => ({
4950
requestBch: requestBch(),
5051
requestEth: requestEth(),
5152
requestXlm: requestXlm(),
53+
send: send({ api }),
5254
sendBch: sendBch({ coreSagas, networks }),
5355
sendBtc: sendBtc({ coreSagas, networks }),
5456
sendEth: sendEth({ api, coreSagas, networks }),

0 commit comments

Comments
 (0)