@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
24 lines (18 loc) • 797 B
text/typescript
import { Currency, CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
import { findCryptoCurrencyById } from "@ledgerhq/cryptoassets";
export function isCryptoCurrency(currency: Currency): currency is CryptoCurrency {
return currency.type === "CryptoCurrency";
}
export function isTokenCurrency(currency: Currency): currency is TokenCurrency {
return currency.type === "TokenCurrency";
}
export function isUTXOCompliant(currencyFamily: string): boolean {
return currencyFamily === "bitcoin" || currencyFamily === "cardano";
}
export type CurrencyFilters = {
currencies?: string[];
};
export function getFamilyByCurrencyId(currencyId: string): CryptoCurrency["family"] | undefined {
const currency = findCryptoCurrencyById(currencyId);
return currency?.family;
}