1
0
mirror of https://github.com/trezor/trezor-wallet synced 2025-07-12 01:28:13 +00:00
trezor-wallet/src/components/notifications/Context/components/Static/index.js
Vladimir Volek 83b2cd7e10 Update bignumber and methods + other non breaking packages (#364)
* Update bignumber and methods + other non breaking packages

* Removed unused flowtype

* Removed unused flowtype 2
2019-02-18 11:45:40 +01:00

39 lines
1.2 KiB
JavaScript

/* @flow */
import * as React from 'react';
import Notification from 'components/Notification';
import Bignumber from 'bignumber.js';
import type { Props } from '../../index';
export default (props: Props) => {
const { selectedAccount } = props;
const { account } = selectedAccount;
const { location } = props.router;
const notifications: Array<Notification> = [];
if (!location || !selectedAccount || !account) return null;
// Ripple minimum reserve notification
if (account.networkType === 'ripple') {
const { reserve, balance } = account;
const bigBalance = new Bignumber(balance);
const bigReserve = new Bignumber(reserve);
if (bigBalance.isLessThan(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 (
<React.Fragment>
{notifications}
</React.Fragment>
);
};