How to use the @ledgerhq/live-common/lib/currencies.listCryptoCurrencies function in @ledgerhq/live-common

To help you get started, we’ve selected a few @ledgerhq/live-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github LedgerHQ / ledger-live-common / tools / src / demos / explorers / index.js View on Github external
render() {
    const coins = listCryptoCurrencies(true);
    return (
      <main>
        {coins
          .filter(c =&gt; hasCurrencyExplorer(c))
          .map(c =&gt; (
            
          ))}
      </main>
    );
  }
}
github LedgerHQ / ledger-live-mobile / src / countervalues.js View on Github external
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;
      },
      () => {
github LedgerHQ / ledger-live-common / demo / src / demos / countervalue-intermediary / reducers / app.js View on Github external
ADD_ROW: state => ({
    ...state,
    rows: state.rows.concat({
      currency: pick(listCryptoCurrencies()),
      exchange: null,
      value: 1
    })
  }),
github LedgerHQ / ledger-live-mobile / src / config / cryptocurrencies.js View on Github external
export const listCryptoCurrencies = memoize((withDevCrypto?: boolean) =>
  listCC(withDevCrypto)
    .filter(c => supported.includes(c.id))
    .sort((a, b) => a.name.localeCompare(b.name)),
);
github LedgerHQ / ledger-live-common / tools / src / demos / Currencies / index.js View on Github external
render() {
    const { tickers } = this.state;
    const all = listCryptoCurrencies(true);
    const available = tickers
      .map(ticker =&gt; all.find(a =&gt; a.ticker === ticker))
      .filter(Boolean);
    const unavailable = all.filter(a =&gt; !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 =&gt; (
              
            ))}</section></div>
github LedgerHQ / ledger-live-common / tools / src / demos / derivations / index.js View on Github external
render() {
    const { currency } = this.state;
    const currencies = listCryptoCurrencies(true).sort((a, b) =&gt;
      a.family === b.family
        ? a.name.localeCompare(b.name)
        : a.family.localeCompare(b.family)
    );
    return (
      <main>
        <div style="{{">
          
        </div>
        {currency ? (
          
        ) : null}</main>
github LedgerHQ / ledger-live-common / tools / src / demos / countervalues / components / CounterValuesAPIDemo.js View on Github external
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: {
github LedgerHQ / ledger-live-mobile / src / countervalues.js View on Github external
network,
  ...(Config.MOCK
    ? {
        getDailyRatesImplementation,
        fetchExchangesForPairImplementation,
        fetchTickersByMarketcapImplementation,
      }
    : {}),
});

const CounterValues = getCountervalues();

type PC = Promise;

let sortCache;
let syncCache = listCryptoCurrencies(true).sort((a, b) =&gt;
  a.name.localeCompare(b.name),
);

export const getFullListSortedCryptoCurrencies: () =&gt; PC = () =&gt; {
  if (!sortCache) {
    sortCache = CounterValues.fetchTickersByMarketcap().then(
      tickers =&gt; {
        const list = listCryptoCurrencies(true).slice(0);
        const prependList = [];
        tickers.forEach(ticker =&gt; {
          const item = list.find(c =&gt; c.ticker === ticker);
          if (item) {
            list.splice(list.indexOf(item), 1);
            prependList.push(item);
          }
        });
github LedgerHQ / ledger-live-common / tools / src / demos / assets / index.js View on Github external
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]) {