import React from 'react'
import PropTypes from 'prop-types'
import FaAngleUp from 'react-icons/lib/fa/angle-up'
import FaAngleDown from 'react-icons/lib/fa/angle-down'
import { Box, Flex } from 'rebass'
import { btc, blockExplorer } from 'lib/utils'
import Settings from 'components/Settings'
import { Button, Dropdown, Text, Value } from 'components/UI'
import CheckAnimated from 'components/Icon/CheckAnimated'
import ZapLogo from 'components/Icon/ZapLogo'
import ZapLogoBlack from 'components/Icon/ZapLogoBlack'
import Qrcode from 'components/Icon/Qrcode'
import { FormattedNumber, FormattedMessage } from 'react-intl'
import messages from './messages'
import styles from './Wallet.scss'
const Wallet = ({
balance,
info,
openReceiveModal,
ticker,
currentTicker,
openPayForm,
openRequestForm,
showPayLoadingScreen,
showSuccessPayScreen,
successTransactionScreen,
currencyFilters,
setCurrency,
network,
settingsProps,
paymentTimeout,
theme
}) => {
const fiatAmount = btc.satoshisToFiat(
parseInt(balance.walletBalance, 10) + parseInt(balance.channelBalance, 10),
currentTicker[ticker.fiatTicker].last
)
return (
{theme === 'light' ? (
) : (
)}
{info.data.testnet && (
Testnet
)}
{info.data.alias}
{settingsProps.settings.settingsOpen ? : }
{settingsProps.settings.settingsOpen && }
{Boolean(fiatAmount) && (
{'≈ '}
)}
{showPayLoadingScreen && (
{paymentTimeout / 1000}
)}
{showSuccessPayScreen && (
)}
{successTransactionScreen.show && (
{
return blockExplorer.showTransaction(network, successTransactionScreen.txid)
}}
>
)}
)
}
Wallet.propTypes = {
balance: PropTypes.object.isRequired,
info: PropTypes.object.isRequired,
ticker: PropTypes.object.isRequired,
currentTicker: PropTypes.object.isRequired,
openPayForm: PropTypes.func.isRequired,
openRequestForm: PropTypes.func.isRequired,
openReceiveModal: PropTypes.func.isRequired,
showPayLoadingScreen: PropTypes.bool.isRequired,
showSuccessPayScreen: PropTypes.bool.isRequired,
network: PropTypes.object.isRequired,
successTransactionScreen: PropTypes.object.isRequired,
settingsProps: PropTypes.object.isRequired,
currencyFilters: PropTypes.array.isRequired,
currencyName: PropTypes.string.isRequired,
paymentTimeout: PropTypes.number.isRequired,
setCurrency: PropTypes.func.isRequired
}
export default Wallet