import { Show, createResource } from "solid-js" import { useMegaStore } from "~/state/megaStore" import { satsToUsd } from "~/utils/conversions" function prettyPrintAmount(n?: number | bigint): string { if (!n || n.valueOf() === 0) { return "0" } return n.toLocaleString() } export function Amount(props: { amountSats: bigint | number | undefined, showFiat?: boolean, loading?: boolean }) { const [state, _] = useMegaStore() const amountInUsd = () => satsToUsd(state.price, Number(props.amountSats) || 0, true) return (

{props.loading ? "..." : prettyPrintAmount(props.amountSats)} SATS

≈ {props.loading ? "..." : amountInUsd()} USD

) }