Wallet {#if $wallet}
Connected
{:else} {/if}
{#if $wallet} {#if $wallet?.type === "webln"} {@const {node, version} = $wallet.info}

Connected to {node?.alias || version || "unknown wallet"} via {$wallet.type}

Balance: {#await getWebLn() ?.enable() .then(() => getWebLn().getBalance())} {:then res} {new Intl.NumberFormat(LOCALE).format(res?.balance || 0)} {:catch} [unknown] {/await} sats

{:else if $wallet.type === "nwc"} {@const {lud16, relayUrl, nostrWalletConnectUrl} = $wallet.info}

Connected to {lud16} via {displayRelayUrl(relayUrl)}

Balance: {#await new nwc.NWCClient({nostrWalletConnectUrl}).getBalance()} {:then res} {new Intl.NumberFormat(LOCALE).format(fromMsats(res?.balance || 0))} {:catch} [unknown] {/await} sats

{/if} {:else}

No wallet connected

{/if}