Skip to content

Commit

Permalink
fix(unsupported): merge development
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLeoB committed Jun 29, 2020
2 parents dcab80a + 65cf674 commit 41e9dd8
Show file tree
Hide file tree
Showing 114 changed files with 1,523 additions and 354 deletions.
49 changes: 49 additions & 0 deletions config/mocks/wallet-options-v4.json
Expand Up @@ -16,6 +16,30 @@
"url": "https://games.bitcoin.com/slots?cma=20190619_blockchainwalletS&utm_source=blockchainwallet_S&utm_medium=banner&utm_campaign=20190619_blockchainwalletS"
},
"coins": {
"ALGO": {
"availability": {
"send": false,
"request": false,
"lockbox": false,
"exchangeTo": false,
"exchangeFrom": false,
"syncToPit": false
},
"coinCode": "ALGO",
"coinTicker": "ALGO",
"colorCode": "algo",
"displayName": "Algorand",
"hasLockboxSupport": false,
"icons": {
"default": "algo",
"circle": "algo",
"circleFilled": "algo"
},
"learnMoreLink": "",
"minConfirmations": 3,
"txExplorerBaseUrl": "",
"txListAppRoute": "/algo/transactions"
},
"BTC": {
"availability": {
"send": true,
Expand Down Expand Up @@ -89,6 +113,31 @@
"minConfirmations": 3,
"txExplorerBaseUrl": "https://blockchair.com/bitcoin-sv/transaction"
},
"USDT": {
"availability": {
"send": false,
"request": false,
"lockbox": false,
"exchangeTo": false,
"exchangeFrom": false,
"syncToPit": false
},
"coinCode": "USDT",
"coinTicker": "USDT",
"colorCode": "usdt",
"contractAddress": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"displayName": "USD Tether",
"hasLockboxSupport": false,
"icons": {
"default": "usdt",
"circle": "usdt",
"circleFilled": "usdt"
},
"learnMoreLink": " https://support.blockchain.com/hc/en-us/articles/360044952032",
"minConfirmations": 12,
"txExplorerBaseUrl": "https://www.blockchain.com/eth/tx",
"txListAppRoute": "/usdt/transactions"
},
"ETH": {
"availability": {
"send": true,
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "blockchain-wallet-v4",
"version": "4.36.8",
"version": "4.37.1",
"license": "AGPL-3.0-or-later",
"private": true,
"author": {
Expand Down
2 changes: 2 additions & 0 deletions packages/blockchain-info-components/src/Colors/DarkMode.ts
Expand Up @@ -68,6 +68,7 @@ const DarkTheme: DefaultTheme = {
red700: '#B2251B',
red800: '#99180F',
red900: '#800900',
algo: '#000000',
btc: '#FF9B22',
'btc-light': '#FFF2E5',
bch: '#8DC351',
Expand All @@ -80,6 +81,7 @@ const DarkTheme: DefaultTheme = {
'usd-d-light': 'rgba(0, 82, 44, 0.15)',
xlm: '#797979',
'xlm-light': 'rgba(0, 0, 0, 0.15)',
usdt: '#26A17B',
// OLD - AVOID USE \\
// Brand
'brand-yellow': '#665227',
Expand Down
2 changes: 2 additions & 0 deletions packages/blockchain-info-components/src/Colors/Default.ts
Expand Up @@ -65,6 +65,7 @@ const Default = {
red700: '#B2251B',
red800: '#99180F',
red900: '#800900',
algo: '#000000',
btc: '#FF9B22',
'btc-light': 'rgba(255, 155, 34, 0.15)',
bch: '#8DC351',
Expand All @@ -77,6 +78,7 @@ const Default = {
'usd-d-light': 'rgba(0, 82, 44, 0.15)',
xlm: '#121D33',
'xlm-light': 'rgba(0, 0, 0, 0.15)',
usdt: '#26A17B',
// OLD - AVOID USE \\
// Brand
'brand-yellow': '#FFB266',
Expand Down
2 changes: 1 addition & 1 deletion packages/blockchain-info-components/src/Icons/Icomoon.ts
@@ -1,6 +1,6 @@
const IcoMoon = {
algo: '\\e939',
'alert-filled': '\\e900',
algo: '\\e939',
'arrow-down': '\\e91d',
'arrow-down-circle': '\\e935',
'arrow-left': '\\e90f',
Expand Down
Expand Up @@ -1977,6 +1977,7 @@
"scenes.transaction.headertext.explainer.btc1": "Bitcoin (BTC) is the original crypto and the internet’s digital currency.",
"scenes.transaction.headertext.explainer.eth": "Ethereum (ETH) is a currency and computing platform. Built for developers and apps.",
"scenes.transaction.headertext.explainer.usdd": "The USD Digital coin (USD-D) is backed by the US Dollar, making it a Stablecoin.",
"scenes.transaction.headertext.explainer.usdt": "The USD Tether coin (USDT) is backed by the US Dollar, making it a Stablecoin.",
"scenes.transaction.headertext.explainer.xlm": "The Stellar Lumen (XLM) connects banks, payments and you to the Stellar Payment network.",
"scenes.transaction.interest.view_txs": "Visit the Earn Interest page to view your transaction history.",
"scenes.transactions.bitcoin.content.list.listitem.status.received": "Received",
Expand Down
Expand Up @@ -2012,6 +2012,7 @@ type MessagesType = {
'scenes.transaction.headertext.explainer.btc1': 'Bitcoin (BTC) is the original crypto and the internet’s digital currency.'
'scenes.transaction.headertext.explainer.eth': 'Ethereum (ETH) is a currency and computing platform. Built for developers and apps.'
'scenes.transaction.headertext.explainer.usdd': 'The USD Digital coin (USD-D) is backed by the US Dollar, making it a Stablecoin.'
'scenes.transaction.headertext.explainer.usdt': 'The USD Tether coin (USDT) is backed by the US Dollar, making it a Stablecoin.'
'scenes.transaction.headertext.explainer.xlm': 'The Stellar Lumen (XLM) connects banks, payments and you to the Stellar Payment network.'
'scenes.transactions.bitcoin.content.list.listitem.status.received': 'Received'
'scenes.transactions.bitcoin.content.list.listitem.status.sent': 'Sent'
Expand Down
Expand Up @@ -3,12 +3,15 @@ import { add, lift, map, prop, reduce } from 'ramda'
import { createDeepEqualSelector } from 'services/ReselectHelper'
import { Exchange, Remote } from 'blockchain-wallet-v4/src'
import {
getAlgoBalance as getAlgoWalletBalance,
getBchBalance as getBchWalletBalance,
getBtcBalance as getBtcWalletBalance,
getEthBalance as getEthWalletBalance,
getPaxBalance as getPaxWalletBalance,
getUsdtBalance as getUsdtWalletBalance,
getXlmBalance as getXlmWalletBalance
} from '../wallet/selectors'
import { INVALID_COIN_TYPE } from 'blockchain-wallet-v4/src/model'
import { selectors } from 'data'

export const getBtcBalance = createDeepEqualSelector(
Expand Down Expand Up @@ -56,8 +59,10 @@ export const getBchBalance = createDeepEqualSelector(
}
)

export const getAlgoBalance = getAlgoWalletBalance
export const getEthBalance = getEthWalletBalance
export const getPaxBalance = getPaxWalletBalance
export const getUsdtBalance = getUsdtWalletBalance
export const getXlmBalance = getXlmWalletBalance

export const getBtcBalanceInfo = createDeepEqualSelector(
Expand Down Expand Up @@ -143,6 +148,49 @@ export const getPaxBalanceInfo = createDeepEqualSelector(
}
)

export const getUsdtBalanceInfo = createDeepEqualSelector(
[
getUsdtBalance,
state => selectors.core.data.eth.getErc20Rates(state, 'usdt'),
selectors.core.settings.getCurrency,
selectors.core.settings.getInvitations
],
(usdtBalanceR, erc20RatesR, currencyR, invitationsR) => {
const invitations = invitationsR.getOrElse({ USDT: false })
const invited = prop('USDT', invitations)
const transform = (value, rates, toCurrency) => {
return Exchange.convertUsdtToFiat({
value,
fromUnit: 'WEI',
toCurrency,
rates
}).value
}

return invited
? lift(transform)(usdtBalanceR, erc20RatesR, currencyR)
: Remote.Success(0)
}
)

export const getAlgoBalanceInfo = createDeepEqualSelector(
[
getAlgoBalance,
selectors.core.data.algo.getRates,
selectors.core.settings.getCurrency
],
(algoBalanceR, algoRatesR, currencyR) => {
const transform = (value, rates, toCurrency) =>
Exchange.convertAlgoToFiat({
value,
fromUnit: 'mALGO',
toCurrency,
rates
}).value
return lift(transform)(algoBalanceR, algoRatesR, currencyR)
}
)

export const getXlmBalanceInfo = createDeepEqualSelector(
[
getXlmBalance,
Expand All @@ -163,48 +211,79 @@ export const getXlmBalanceInfo = createDeepEqualSelector(

export const getTotalBalance = createDeepEqualSelector(
[
getAlgoBalanceInfo,
getBchBalanceInfo,
getBtcBalanceInfo,
getEthBalanceInfo,
getPaxBalanceInfo,
getUsdtBalanceInfo,
getXlmBalanceInfo,
selectors.core.settings.getCurrency,
selectors.router.getPathname
],
(
algoBalanceInfoR,
bchBalanceInfoR,
btcBalanceInfoR,
ethBalanceInfoR,
paxBalanceInfoR,
usdtBalanceInfoR,
xlmBalanceInfoR,
currency,
path
) => {
const transform = (
algoBalance,
bchBalance,
btcBalance,
ethBalance,
paxBalance,
usdtBalance,
xlmBalance,
currency
) => {
const total = Currency.formatFiat(
Number(btcBalance) +
Number(ethBalance) +
Number(bchBalance) +
Number(paxBalance) +
Number(xlmBalance)
Number(algoBalance) +
Number(xlmBalance) +
Number(usdtBalance) +
Number(paxBalance)
)
const totalBalance = `${Exchange.getSymbol(currency)}${total}`
return { totalBalance, path }
}
return lift(transform)(
algoBalanceInfoR,
bchBalanceInfoR,
btcBalanceInfoR,
ethBalanceInfoR,
paxBalanceInfoR,
usdtBalanceInfoR,
xlmBalanceInfoR,
currency
)
}
)

export const getBalanceSelector = coin => {
switch (coin) {
case 'BTC':
return getBtcBalance
case 'BCH':
return getBchBalance
case 'ETH':
return getEthBalance
case 'PAX':
return getPaxBalance
case 'XLM':
return getXlmBalance
case 'USDT':
return getUsdtBalance
case 'ALGO':
return getAlgoBalance
default:
return Remote.Failure(INVALID_COIN_TYPE)
}
}

0 comments on commit 41e9dd8

Please sign in to comment.