@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
31 lines (26 loc) • 673 B
text/typescript
import { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
import { getEnv } from "@ledgerhq/live-env";
type LedgerExplorer = {
version: string;
id: string;
endpoint: string;
};
export const findCurrencyExplorer = (
currency: CryptoCurrency,
): LedgerExplorer | null | undefined => {
if (getEnv("SATSTACK") && currency.id === "bitcoin") {
return {
endpoint: getEnv("EXPLORER_SATSTACK"),
id: "btc",
version: "v3",
};
}
if (currency.explorerId == null) {
console.warn("no explorerId for", currency.id);
}
return {
endpoint: getEnv("EXPLORER"),
id: currency.explorerId ?? currency.id,
version: "v4",
};
};