Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
render() {
const coins = listCryptoCurrencies(true);
return (
<main>
{coins
.filter(c => hasCurrencyExplorer(c))
.map(c => (
))}
</main>
);
}
}
tickers => {
const list = listCryptoCurrencies(true).slice(0);
const prependList = [];
tickers.forEach(ticker => {
const item = list.find(c => c.ticker === ticker);
if (item) {
list.splice(list.indexOf(item), 1);
prependList.push(item);
}
});
const res = prependList.concat(list);
syncCache = res;
return res;
},
() => {
ADD_ROW: state => ({
...state,
rows: state.rows.concat({
currency: pick(listCryptoCurrencies()),
exchange: null,
value: 1
})
}),
export const listCryptoCurrencies = memoize((withDevCrypto?: boolean) =>
listCC(withDevCrypto)
.filter(c => supported.includes(c.id))
.sort((a, b) => a.name.localeCompare(b.name)),
);
render() {
const { tickers } = this.state;
const all = listCryptoCurrencies(true);
const available = tickers
.map(ticker => all.find(a => a.ticker === ticker))
.filter(Boolean);
const unavailable = all.filter(a => !available.includes(a));
return (
<div>
This shows <code>@ledgerhq/live-common</code> database (Disclaimer:
regardless if a given crypto-asset is supported)
<section>
Crypto assets
{available.map(a => (
))}</section></div>
render() {
const { currency } = this.state;
const currencies = listCryptoCurrencies(true).sort((a, b) =>
a.family === b.family
? a.name.localeCompare(b.name)
: a.family.localeCompare(b.family)
);
return (
<main>
<div style="{{">
</div>
{currency ? (
) : null}</main>
import {
listFiatCurrencies,
listCryptoCurrencies,
listTokens
} from "@ledgerhq/live-common/lib/currencies";
import { getCountervalues } from "@ledgerhq/live-common/lib/countervalues";
import CurrencySelect from "./CurrencySelect";
import ExchangeSelect from "./ExchangeSelect";
import { marketsSelector } from "../../../reducers/markets";
import { addMarket, setMarket } from "../../../actions/markets";
import Price from "./Price";
import PriceGraph from "./PriceGraph";
import ReversePrice from "./ReversePrice";
import type { Currency } from "@ledgerhq/live-common/lib/types";
const fromCurrencyList: Currency[] = listCryptoCurrencies().concat(
listTokens()
);
const toCurrencyList: Currency[] = listCryptoCurrencies()
.concat(listFiatCurrencies())
.concat(listTokens());
const styles = theme => ({
root: {
width: "100%",
overflowX: "auto"
},
flex: {
flex: 1
},
table: {
() => currenciesByMarketcap(listCryptoCurrencies()),
)
network,
...(Config.MOCK
? {
getDailyRatesImplementation,
fetchExchangesForPairImplementation,
fetchTickersByMarketcapImplementation,
}
: {}),
});
const CounterValues = getCountervalues();
type PC = Promise;
let sortCache;
let syncCache = listCryptoCurrencies(true).sort((a, b) =>
a.name.localeCompare(b.name),
);
export const getFullListSortedCryptoCurrencies: () => PC = () => {
if (!sortCache) {
sortCache = CounterValues.fetchTickersByMarketcap().then(
tickers => {
const list = listCryptoCurrencies(true).slice(0);
const prependList = [];
tickers.forEach(ticker => {
const item = list.find(c => c.ticker === ticker);
if (item) {
list.splice(list.indexOf(item), 1);
prependList.push(item);
}
});
const Assets = () => {
const tokens = listTokens({ withDelisted: true });
const currencies = listCryptoCurrencies();
const all = useMemo(() => currencies.concat(tokens), [tokens, currencies]);
const tickers = useMarketcapTickers() || [];
const [rates, setRates] = useState({});
const byMarketcap = useCurrenciesByMarketcap(all);
const data = byMarketcap.map(t => {
let countervalueStatus = "no";
let loading = false;
let exchange;
let formatted = "";
let usdValue = "";
if (t.disableCountervalue) {
countervalueStatus = "disabled";
} else if (tickers.includes(t.ticker)) {
countervalueStatus = "yes";
const counter = counterpartFor(t);
if (rates[counter.ticker]) {