Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ta =>
"\n " +
ta.type +
" " +
getAccountName(ta) +
": " +
formatCurrencyUnit(getAccountUnit(ta), ta.balance, {
showCode: true,
disableRounding: true
}) +
" (" +
ta.operations.length +
" ops)"
)
render() {
const { from, to, value, reversed } = this.props;
if (!reversed) return null;
return (
<span>
<strong>
{formatCurrencyUnit(to.units[0], value, { showCode: true })}
</strong>
{" = "}
<strong>
{formatCurrencyUnit(from.units[0], reversed, { showCode: true })}
</strong>
</span>
);
}
}
export const formatAPICurrencyXRP = (amount: BigNumber) => {
const value = formatCurrencyUnit(rippleUnit, amount, {
showAllDigits: true,
disableRounding: true,
useGrouping: false,
});
return { currency: "XRP", value };
};
render() {
const { to, countervalue } = this.props;
if (!countervalue) return null;
return (
<span>
<strong>
{formatCurrencyUnit(to.units[0], countervalue, { showCode: true })}
</strong>
</span>
);
}
}
render() {
const { unit, value, ...rest } = this.props;
return formatCurrencyUnit(unit, value, {
...rest,
});
}
}
choices: accounts.map(account => ({
name: `${account.name} | ${chalk.green(
formatCurrencyUnit(account.unit, account.balance, {
showCode: true,
}),
)}`,
value: account,
})),
name: 'account',
function format(unit: Unit, value: BigNumber, { locale, isFocused, showAllDigits, subMagnitude }) {
return formatCurrencyUnit(unit, value, {
locale,
useGrouping: !isFocused,
disableRounding: true,
showAllDigits: !!showAllDigits && !isFocused,
subMagnitude: value.isLessThan(1) ? subMagnitude : 0,
})
}
const format = (op, level = 0) => {
const amount = formatCurrencyUnit(
unitByAccountId(op.accountId),
getOperationAmountNumber(op),
{
showCode: true,
alwaysShowSign: true
}
);
const spaces = Array((level + 1) * 2)
.fill(" ")
.join("");
const extra = level > 0 ? "" : `${op.hash} ${op.date.toISOString()}`;
const head = `${(spaces + amount).padEnd(20)} ${op.type.padEnd(
11
)}${extra}`;
const sub = (op.subOperations || [])
.concat(op.internalOperations || [])
render() {
const { from, to, value, countervalue } = this.props;
if (!countervalue) return null;
return (
<span>
<strong>
{formatCurrencyUnit(from.units[0], value, { showCode: true })}
</strong>
{" = "}
<strong>
{formatCurrencyUnit(to.units[0], countervalue, { showCode: true })}
</strong>
</span>
);
}
}
const counter = counterpartFor(t);
if (rates[counter.ticker]) {
const ratePerExchange = (rates[counter.ticker] || {})[t.ticker] || {};
exchange = Object.keys(ratePerExchange)[0];
if (exchange) {
const latest = ratePerExchange[exchange].latest || 0;
if (counter !== usdFiat) {
if (rates[usdFiat.ticker]) {
const intermRatePerExchange =
(rates[usdFiat.ticker] || {})[counter.ticker] || {};
const intermExchange = Object.keys(intermRatePerExchange)[0];
if (intermExchange) {
const intermLatest =
intermRatePerExchange[intermExchange].latest || 0;
usdValue = formatCurrencyUnit(
usdFiat.units[0],
BigNumber(latest)
.times(intermLatest)
.times(10 ** t.units[0].magnitude)
);
}
}
} else {
usdValue = formatCurrencyUnit(
counter.units[0],
BigNumber(latest).times(10 ** t.units[0].magnitude)
);
}
formatted = formatCurrencyUnit(
counter.units[0],