Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/components/Send/SendToken.js
Show All 18 Lines | |||||
import makeBlockie from 'ethereum-blockies-base64'; | import makeBlockie from 'ethereum-blockies-base64'; | ||||
import BigNumber from 'bignumber.js'; | import BigNumber from 'bignumber.js'; | ||||
import { | import { | ||||
currency, | currency, | ||||
parseAddress, | parseAddress, | ||||
isValidTokenPrefix, | isValidTokenPrefix, | ||||
} from '@components/Common/Ticker.js'; | } from '@components/Common/Ticker.js'; | ||||
import { Event } from '@utils/GoogleAnalytics'; | import { Event } from '@utils/GoogleAnalytics'; | ||||
import { formatBalance } from '@utils/cashMethods'; | |||||
const SendToken = ({ tokenId }) => { | const SendToken = ({ tokenId }) => { | ||||
const { wallet, tokens, slpBalancesAndUtxos, apiError } = React.useContext( | const { wallet, tokens, slpBalancesAndUtxos, apiError } = React.useContext( | ||||
WalletContext, | WalletContext, | ||||
); | ); | ||||
const token = tokens.find(token => token.tokenId === tokenId); | const token = tokens.find(token => token.tokenId === tokenId); | ||||
const [queryStringText, setQueryStringText] = useState(null); | const [queryStringText, setQueryStringText] = useState(null); | ||||
const [sendTokenAddressError, setSendTokenAddressError] = useState(false); | const [sendTokenAddressError, setSendTokenAddressError] = useState(false); | ||||
▲ Show 20 Lines • Show All 187 Lines • ▼ Show 20 Lines | return ( | ||||
<> | <> | ||||
{!token && <Redirect to="/" />} | {!token && <Redirect to="/" />} | ||||
{token && ( | {token && ( | ||||
<> | <> | ||||
<BalanceHeader> | <BalanceHeader> | ||||
<p>Available balance</p> | <p>Available balance</p> | ||||
<h3> | <h3> | ||||
{token.balance.toString()} {token.info.tokenTicker} | {formatBalance(token.balance)}{' '} | ||||
{token.info.tokenTicker} | |||||
</h3> | </h3> | ||||
</BalanceHeader> | </BalanceHeader> | ||||
<Row type="flex"> | <Row type="flex"> | ||||
<Col span={24}> | <Col span={24}> | ||||
<Spin | <Spin | ||||
style={{ color: 'red' }} | style={{ color: 'red' }} | ||||
spinning={loading} | spinning={loading} | ||||
▲ Show 20 Lines • Show All 131 Lines • Show Last 20 Lines |