1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-12-28 18:08:08 +00:00

rewrite static notification condition (xrp || txrp)

This commit is contained in:
Szymon Lesisz 2019-01-09 18:03:41 +01:00 committed by Szymon Lesisz
parent 2c24b75d47
commit 3ebce65093

View File

@ -15,18 +15,20 @@ export default (props: Props) => {
if (!location || !selectedAccount || !account) return null;
// Ripple minimum reserve notification
const { reserve, balance } = account;
const bigBalance = new Bignumber(balance);
const bigReserve = new Bignumber(reserve);
if (location.pathname.includes('xrp') && (bigBalance.lessThan(bigReserve) || bigBalance.lessThanOrEqualTo(new Bignumber(0)))) {
notifications.push(
<Notification
key="xrp-warning"
type="warning"
title="Minimum account reserve required"
message={`The Base Reserve is a minimum amount of XRP that is required for every address in the ledger. Currently, this is ${bigReserve.toString()} XRP.`}
/>,
);
if (account.networkType === 'ripple') {
const { reserve, balance } = account;
const bigBalance = new Bignumber(balance);
const bigReserve = new Bignumber(reserve);
if (bigBalance.lessThan(bigReserve)) {
notifications.push(
<Notification
key="xrp-warning"
type="warning"
title="Minimum account reserve required"
message={`The Base Reserve is a minimum amount of XRP that is required for every address in the ledger. Currently, this is ${bigReserve.toString()} XRP.`}
/>,
);
}
}
return (