watch for receives

This commit is contained in:
Paul Miller
2023-04-19 14:32:06 -05:00
parent 4be030749a
commit 4dc0a2fa18
7 changed files with 136 additions and 22 deletions

View File

@@ -5,7 +5,7 @@ import { For, JSX, Match, Show, Suspense, Switch, createMemo, createResource, cr
import { useMegaStore } from '~/state/megaStore';
import { MutinyInvoice } from '@mutinywallet/mutiny-wasm';
import { prettyPrintTime } from '~/utils/prettyPrintTime';
import { JsonModal } from './JsonModal';
import { JsonModal } from '~/components/JsonModal';
import mempoolTxUrl from '~/utils/mempoolTxUrl';
const THREE_COLUMNS = 'grid grid-cols-[auto,1fr,auto] gap-4 py-2 px-2 border-b border-neutral-800 last:border-b-0'
@@ -49,7 +49,6 @@ function OnChainItem(props: { item: OnChainTx }) {
<a href={mempoolTxUrl(props.item.txid, "signet")} target="_blank" rel="noreferrer">
Mempool Link
</a>
</JsonModal>
<div class={THREE_COLUMNS} onclick={() => setOpen(!open())}>
{isReceive() ? <img src={receive} alt="receive arrow" /> : <img src={send} alt="send arrow" />}

View File

@@ -21,7 +21,6 @@ export default function BalanceBox() {
const fetchOnchainBalance = async () => {
console.log("Refetching onchain balance");
await state.node_manager?.sync();
const balance = await state.node_manager?.get_balance();
return balance
};

View File

@@ -1,11 +1,11 @@
import { Dialog } from "@kobalte/core";
import { JSX, createMemo } from "solid-js";
import { Button, ButtonLink, SmallHeader } from "~/components/layout";
import { Button, SmallHeader } from "~/components/layout";
import { useCopy } from "~/utils/useCopy";
const OVERLAY = "fixed inset-0 z-50 bg-black/50 backdrop-blur-sm"
const DIALOG_POSITIONER = "fixed inset-0 z-50 flex items-center justify-center"
const DIALOG_CONTENT = "max-w-[600px] max-h-screen-safe p-4 bg-gray/50 backdrop-blur-md shadow-xl rounded-xl border border-white/10 overflow-y-scroll disable-scrollbars"
const DIALOG_CONTENT = "max-w-[600px] max-h-screen-safe p-4 bg-gray/50 backdrop-blur-md shadow-xl rounded-xl border border-white/10"
export function JsonModal(props: { title: string, open: boolean, data?: unknown, setOpen: (open: boolean) => void, children?: JSX.Element }) {
const json = createMemo(() => JSON.stringify(props.data, null, 2));
@@ -29,9 +29,11 @@ export function JsonModal(props: { title: string, open: boolean, data?: unknown,
</Dialog.CloseButton>
</div>
<Dialog.Description class="flex flex-col gap-4">
<pre class="whitespace-pre-wrap break-all">
{json()}
</pre>
<div class="bg-white/10 rounded-xl max-h-[50vh] overflow-y-scroll disable-scrollbars p-4">
<pre class="whitespace-pre-wrap break-all">
{json()}
</pre>
</div>
{props.children}
<Button onClick={(_) => copy(json() ?? "")}>{copied() ? "Copied" : "Copy"}</Button>
<Button onClick={(_) => props.setOpen(false)}>Close</Button>