import React, { Component } from 'react' import PropTypes from 'prop-types' import { FaAngleDown } from 'react-icons/lib/fa' import Isvg from 'react-inlinesvg' import { btc } from 'utils' import Value from 'components/Value' import bitcoinIcon from 'icons/bitcoin.svg' import zapLogo from 'icons/zap_logo.svg' import qrCode from 'icons/qrcode.svg' import ReceiveModal from './ReceiveModal' import styles from './Wallet.scss' class Wallet extends Component { constructor(props) { super(props) this.state = { modalOpen: false, qrCodeType: 1 } } render() { const { balance, address, info, newAddress, ticker, currentTicker, openPayForm, openRequestForm } = this.props const { modalOpen, qrCodeType } = this.state const usdAmount = btc.satoshisToUsd((parseInt(balance.walletBalance, 10) + parseInt(balance.channelBalance, 10)), currentTicker.price_usd) const changeQrCode = () => { const qrCodeNum = this.state.qrCodeType === 1 ? 2 : 1 this.setState({ qrCodeType: qrCodeNum }) } return (
{ ( modalOpen && this.setState({ modalOpen: false })} pubkey={info.data.identity_pubkey} address={address} newAddress={newAddress} qrCodeType={qrCodeType} changeQrCode={changeQrCode} /> ) }
{info.data.alias}

{btc.renderCurrency(ticker.currency)} this.setState({ modalOpen: true })}>

≈ ${usdAmount ? usdAmount.toLocaleString() : ''}
Pay
Request
) } } Wallet.propTypes = { balance: PropTypes.object.isRequired, address: PropTypes.string.isRequired, info: PropTypes.object.isRequired, newAddress: PropTypes.func.isRequired, ticker: PropTypes.object.isRequired, currentTicker: PropTypes.object.isRequired, openPayForm: PropTypes.func.isRequired, openRequestForm: PropTypes.func.isRequired } export default Wallet