Skip to content

Commit

Permalink
feat(brokerage): fixed URL to use proper ones
Browse files Browse the repository at this point in the history
  • Loading branch information
milan-bc committed Jun 2, 2021
1 parent 524d2f6 commit d63013a
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,7 @@ type MessagesType = {
'modals.simplebuy.confirm.ach_lock': 'For your security, buy orders with a bank account are subject to a holding period of up to {days} days. You can Swap or Sell during this time. We will notify you once the funds are fully available.'
'modals.simplebuy.confirm.ach_ob_lock': 'Your final amount might change due to market activity. An initial hold period of {days} days will be applied to your funds. You can Buy, Sell, and Swap during this period.'
'modals.simplebuy.confirm.activity': 'Your final amount may change due to market activity.'
'modals.simplebuy.confirm.activity_card11': 'Your final amount might change due to market activity. For your security, buy orders with a bank account are subject up to a 14 day holding period. You can Swap or Sell during this time. We will notify you once the funds are fully available.'
'modals.simplebuy.confirm.activity_card11': 'Your final amount might change due to market activity. For your security, buy orders with a bank account are subject to up to a 14 day holding period. You can Swap or Sell during this time. We will notify you once the funds are fully available.'
'modals.simplebuy.confirm.activity_card2': 'Your crypto will be available to be withdrawn within <b>{days} days</b>.'
'modals.simplebuy.confirm.activity_accept_terms': 'I agree to Blockchain’s <a>Terms of Service</a> and its return, refund and cancellation policy.'
'modals.simplebuy.confirm.funds_wallet': '{coin} Wallet'
Expand All @@ -1444,7 +1444,7 @@ type MessagesType = {
'modals.simplebuy.confirm.sell_description': "Final amount may change due to market activity.<br /> By approving this Sell you agree to Blockchain.com’s <br /><a href='https://www.blockchain.com/legal/terms' rel='noopener noreferrer' target='_blank'>Refund Policy.</a>"
'modals.simplebuy.confirm.coin_tooltip': 'Blockchain.com provides the best market price we receive and applies a spread.'
'modals.simplebuy.confirm.sale_amount': 'Sale Amount'
'modals.simplebuy.confirm.network_fees': 'Network fees are set by the Bitcoin network.'
'modals.simplebuy.confirm.network_fees': 'Network fees are set by the {coin} network.'
'modals.simplebuy.confirm.learn_more_about_fees': 'Learn more about fees'
'modals.simplebuy.processing': 'Processing…'
'modals.simplebuy.deposit.deposit_button': 'Deposit {amount}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const IconWrapper = styled.div`
const RowText = styled(Text)`
font-size: 16px;
font-weight: 500;
color: ${props => props.theme.grey900};
color: ${(props) => props.theme.grey900};
display: flex;
flex-direction: column;
justify-content: center;
Expand All @@ -42,7 +42,7 @@ const ToolTipText = styled.div`
border-radius: 8px;
margin-top: 8px;
padding: 16px;
background-color: ${props => props.theme.grey000};
background-color: ${(props) => props.theme.grey000};
animation: fadeIn 0.3s ease-in-out;
@keyframes fadeIn {
Expand Down Expand Up @@ -88,9 +88,8 @@ const TooltipRowItem = ({ title, value }: Props) => {
defaultMessage='Blockchain.com requires a fee when paying with a card.'
/>
</Text>
{/* TODO: update link */}
<Link
href='https://blockchain.zendesk.com/hc/en-us/sections/360002593291-Setting-Up-Lockbox'
href='https://support.blockchain.com/hc/en-us/articles/360061672651'
size='14px'
rel='noopener noreferrer'
target='_blank'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,8 @@ const Success: React.FC<InjectedFormProps<{ form: string }, Props> & Props> = (p
defaultMessage='Blockchain.com requires a fee when paying with a card.'
/>
</Text>
{/* TODO: update link */}
<Link
href='https://blockchain.zendesk.com/hc/en-us/sections/360002593291-Setting-Up-Lockbox'
href='https://support.blockchain.com/hc/en-us/articles/360061672651'
size='14px'
rel='noopener noreferrer'
target='_blank'
Expand Down Expand Up @@ -345,9 +344,8 @@ const Success: React.FC<InjectedFormProps<{ form: string }, Props> & Props> = (p
defaultMessage='Blockchain.com requires a fee when paying with a card.'
/>
</Text>
{/* TODO: update link */}
<Link
href='https://blockchain.zendesk.com/hc/en-us/sections/360002593291-Setting-Up-Lockbox'
href='https://support.blockchain.com/hc/en-us/articles/360061672651'
size='14px'
rel='noopener noreferrer'
target='_blank'
Expand Down Expand Up @@ -383,7 +381,7 @@ const Success: React.FC<InjectedFormProps<{ form: string }, Props> & Props> = (p
<Text size='12px' weight={500} color='grey900'>
<FormattedMessage
id='modals.simplebuy.confirm.activity_card11'
defaultMessage='Your final amount might change due to market activity. For your security, buy orders with a bank account are subject up to a 14 day holding period. You can Swap or Sell during this time. We will notify you once the funds are fully available.'
defaultMessage='Your final amount might change due to market activity. For your security, buy orders with a bank account are subject to up to a 14 day holding period. You can Swap or Sell during this time. We will notify you once the funds are fully available.'
/>
</Text>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ class PreviewSell extends PureComponent<
const counterCoinTicker = coins[COUNTER].coinTicker
const { rates, ratesEth } = this.props
const fiatCurrency = getFiatFromPair(this.props.pair.pair)
const isErc20 = coins[COUNTER].contractAddress

return (
<CustomForm onSubmit={this.handleSubmit}>
Expand Down Expand Up @@ -329,9 +330,8 @@ class PreviewSell extends PureComponent<
defaultMessage='Blockchain.com provides the best market price we receive and applies a spread.'
/>
</Text>
{/* TODO: update link */}
<Link
href='https://blockchain.zendesk.com/hc/en-us/sections/360002593291-Setting-Up-Lockbox'
href='https://support.blockchain.com/hc/en-us/articles/360061675191'
size='14px'
rel='noopener noreferrer'
target='_blank'
Expand Down Expand Up @@ -448,12 +448,16 @@ class PreviewSell extends PureComponent<
<Text size='14px'>
<FormattedMessage
id='modals.simplebuy.confirm.network_fees'
defaultMessage='Network fees are set by the Bitcoin network.'
defaultMessage='Network fees are set by the {coin} network.'
values={{ coin: counterCoinTicker }}
/>
</Text>
{/* TODO: update link */}
<Link
href='https://blockchain.zendesk.com/hc/en-us/sections/360002593291-Setting-Up-Lockbox'
href={
isErc20
? 'https://support.blockchain.com/hc/en-us/articles/360061258732'
: 'https://support.blockchain.com/hc/en-us/articles/360061672651'
}
size='14px'
rel='noopener noreferrer'
target='_blank'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ import {
SupportedWalletCurrencyType
} from 'blockchain-wallet-v4/src/types'
import { convertBaseToStandard } from 'data/components/exchange/services'
import {
getBaseCurrency,
getCounterCurrency,
getOrderType
} from 'data/components/simpleBuy/model'
import { getBaseCurrency, getCounterCurrency, getOrderType } from 'data/components/simpleBuy/model'
import { BankTransferAccountType } from 'data/types'

export const BuyOrSell = (props: {
Expand All @@ -30,8 +26,7 @@ export const BuyOrSell = (props: {
id='buttons.buy_coin'
defaultMessage='Buy {displayName}'
values={{
displayName:
props.crypto === 'Crypto' ? 'Crypto' : props.coinModel?.coinTicker
displayName: props.crypto === 'Crypto' ? 'Crypto' : props.coinModel?.coinTicker
}}
/>
) : (
Expand All @@ -55,9 +50,7 @@ export const getOrderDestination = (order: SBOrderType, supportedCoins) => {
const baseCurrency = getBaseCurrency(order, supportedCoins)
const counterCurrency = getCounterCurrency(order, supportedCoins)

return orderType === 'BUY'
? `${baseCurrency} Trading Account`
: `${counterCurrency} Account`
return orderType === 'BUY' ? `${baseCurrency} Trading Account` : `${counterCurrency} Account`
}

export const getPaymentMethod = (
Expand All @@ -72,10 +65,7 @@ export const getPaymentMethod = (
switch (order.paymentType) {
case 'PAYMENT_CARD':
return (
<FormattedMessage
id='modals.simplebuy.confirm.payment_card'
defaultMessage='Credit Card'
/>
<FormattedMessage id='modals.simplebuy.confirm.payment_card' defaultMessage='Credit Card' />
)
case 'FUNDS':
return orderType === 'BUY' ? (
Expand All @@ -91,9 +81,9 @@ export const getPaymentMethod = (
)
case 'BANK_TRANSFER':
const defaultBankInfo = {
bankName: 'Bank Transfer',
accountNumber: '',
bankAccountType: '',
accountNumber: ''
bankName: 'Bank Transfer'
}
const d = (bankAccount && bankAccount.details) || defaultBankInfo
return `${d.bankName}`
Expand Down Expand Up @@ -130,13 +120,12 @@ export const getPaymentMethodDetails = (
return `${cardDetails?.card?.type} ${cardDetails?.card?.number}`
case 'BANK_TRANSFER':
const defaultBankInfo = {
bankName: 'Bank Transfer',
accountNumber: '',
bankAccountType: '',
accountNumber: ''
bankName: 'Bank Transfer'
}
const d = (bankAccount && bankAccount.details) || defaultBankInfo
return `${d.bankAccountType?.toLowerCase() || ''} ${d.accountNumber ||
''}`
return `${d.bankAccountType?.toLowerCase() || ''} ${d.accountNumber || ''}`
default:
return null
}
Expand Down
84 changes: 31 additions & 53 deletions packages/blockchain-wallet-v4/src/transactions/eth.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
import moment from 'moment'
import {
any,
curry,
equals,
filter,
head,
includes,
lift,
map,
path,
prop,
toLower
} from 'ramda'
import { any, curry, equals, filter, head, includes, lift, map, path, prop, toLower } from 'ramda'

import { calculateFee } from 'blockchain-wallet-v4/src/utils/eth'
import { EthRawTxType } from 'core/network/api/eth/types'
Expand All @@ -29,7 +17,7 @@ import Remote from '../remote'
//
// Shared Utils
//
export const getTime = timeStamp => {
export const getTime = (timeStamp) => {
const date = moment.unix(timeStamp).local()
return equals(date.year(), moment().year())
? date.format('MMMM D @ h:mm A')
Expand Down Expand Up @@ -65,12 +53,12 @@ export const getLabel = (address, state) => {
return defaultLabel
case any(
// @ts-ignore
x => equals(toLower(x.addr), toLower(address)),
(x) => equals(toLower(x.addr), toLower(address)),
lockboxEthAccounts
):
const ethAccounts = filter(
// @ts-ignore
x => equals(toLower(x.addr), toLower(address)),
(x) => equals(toLower(x.addr), toLower(address)),
lockboxEthAccounts
)
// @ts-ignore
Expand All @@ -79,46 +67,36 @@ export const getLabel = (address, state) => {
return address
}
}
const labelR = lift(transform)(
defaultLabelR,
defaultAddressR,
lockboxEthAccountsR
)
const labelR = lift(transform)(defaultLabelR, defaultAddressR, lockboxEthAccountsR)
return labelR.getOrElse(address)
}

export const _transformTx = curry(
(addresses, erc20Contracts, state, tx: EthRawTxType) => {
const fee = calculateFee(
tx.gasPrice,
tx.state === 'CONFIRMED' ? tx.gasUsed : tx.gasLimit,
false
)
const type = toLower(getType(tx, addresses))
const amount =
type === 'sent' ? parseInt(tx.value) + parseInt(fee) : parseInt(tx.value)
// @ts-ignore
const time = tx.timestamp || tx.timeStamp
const isErc20 = includes(tx.to, erc20Contracts.map(toLower))
export const _transformTx = curry((addresses, erc20Contracts, state, tx: EthRawTxType) => {
const fee = calculateFee(tx.gasPrice, tx.state === 'CONFIRMED' ? tx.gasUsed : tx.gasLimit, false)
const type = toLower(getType(tx, addresses))
const amount =
type === 'sent' ? parseInt(tx.value, 10) + parseInt(fee, 10) : parseInt(tx.value, 10)
// @ts-ignore
const time = tx.timestamp || tx.timeStamp
const isErc20 = includes(tx.to, erc20Contracts.map(toLower))

return {
amount,
blockHeight: tx.state === 'CONFIRMED' ? tx.blockNumber : undefined,
data: isErc20 ? tx.data : null,
description: getEthTxNote(state, tx.hash).getOrElse(''),
erc20: isErc20,
fee: Remote.Success(fee),
from: getLabel(tx.from, state),
hash: tx.hash,
insertedAt: Number(time) * 1000,
state: tx.state,
time,
timeFormatted: getTime(time),
to: getLabel(tx.to, state),
type
}
return {
amount,
blockHeight: tx.state === 'CONFIRMED' ? tx.blockNumber : undefined,
data: isErc20 ? tx.data : null,
description: getEthTxNote(state, tx.hash).getOrElse(''),
erc20: isErc20,
fee: Remote.Success(fee),
from: getLabel(tx.from, state),
hash: tx.hash,
insertedAt: Number(time) * 1000,
state: tx.state,
time,
timeFormatted: getTime(time),
to: getLabel(tx.to, state),
type
}
)
})

//
// ERC20
Expand All @@ -141,9 +119,9 @@ export const _transformErc20Tx = curry((addresses, state, token, tx) => {
const time = tx.timestamp || tx.timeStamp

return {
amount: parseInt(tx.value),
coin: token,
amount: parseInt(tx.value, 10),
blockHeight: tx.blockNumber,
coin: token,
description: getErc20TxNote(state, token, tx.transactionHash).getOrElse(''),
fee: Remote.NotAsked,
from: getErc20Label(tx.from, token, state),
Expand Down

0 comments on commit d63013a

Please sign in to comment.