diff --git a/src/components/Activity.tsx b/src/components/Activity.tsx index 0ba7dd1..9234832 100644 --- a/src/components/Activity.tsx +++ b/src/components/Activity.tsx @@ -1,5 +1,5 @@ import { LoadingSpinner, NiceP, SmallAmount, SmallHeader } from './layout'; -import { For, Match, ParentComponent, Show, Switch, createEffect, createMemo, createResource, createSignal } from 'solid-js'; +import { For, Match, Show, Switch, createEffect, createMemo, createResource, createSignal } from 'solid-js'; import { useMegaStore } from '~/state/megaStore'; import { MutinyInvoice } from '@mutinywallet/mutiny-wasm'; import { JsonModal } from '~/components/JsonModal'; @@ -8,6 +8,7 @@ import utxoIcon from '~/assets/icons/coin.svg'; import { getRedshifted } from '~/utils/fakeLabels'; import { ActivityItem } from './ActivityItem'; import { MutinyTagItem } from '~/utils/tags'; +import { Network } from '~/logic/mutinyWalletSetup'; export const THREE_COLUMNS = 'grid grid-cols-[auto,1fr,auto] gap-4 py-2 px-2 border-b border-neutral-800 last:border-b-0' export const CENTER_COLUMN = 'min-w-0 overflow-hidden max-w-full' @@ -40,11 +41,7 @@ export type UtxoItem = { redshifted?: boolean, } -const SubtleText: ParentComponent = (props) => { - return

{props.children}

-} - -function OnChainItem(props: { item: OnChainTx, labels: MutinyTagItem[] }) { +function OnChainItem(props: { item: OnChainTx, labels: MutinyTagItem[], network: Network }) { const isReceive = () => props.item.received > props.item.sent const [open, setOpen] = createSignal(false) @@ -52,7 +49,7 @@ function OnChainItem(props: { item: OnChainTx, labels: MutinyTagItem[] }) { return ( <> - + Mempool Link @@ -158,6 +155,8 @@ export function CombinedActivity(props: { limit?: number }) { const [activity, { refetch }] = createResource(getAllActivity); + const network = state.mutiny_wallet?.get_network() as Network; + createEffect(() => { // After every sync we should refetch the activity if (!state.is_syncing) { @@ -178,11 +177,9 @@ export function CombinedActivity(props: { limit?: number }) { {(activityItem) => - {/* FIXME */} - + - {/* FIXME */} diff --git a/src/components/KitchenSink.tsx b/src/components/KitchenSink.tsx index 8e2f119..a1e115c 100644 --- a/src/components/KitchenSink.tsx +++ b/src/components/KitchenSink.tsx @@ -9,6 +9,7 @@ import eify from "~/utils/eify"; import { ConfirmDialog } from "~/components/Dialog"; import { showToast } from "~/components/Toaster"; import { ImportExport } from "~/components/ImportExport"; +import { Network } from "~/logic/mutinyWalletSetup"; // TODO: hopefully I don't have to maintain this type forever but I don't know how to pass it around otherwise type RefetchPeersType = (info?: unknown) => MutinyPeer[] | Promise | null | undefined @@ -127,7 +128,7 @@ function ConnectPeer(props: { refetchPeers: RefetchPeersType }) { type RefetchChannelsListType = (info?: unknown) => MutinyChannel[] | Promise | null | undefined -function ChannelItem(props: { channel: MutinyChannel, network?: string }) { +function ChannelItem(props: { channel: MutinyChannel, network?: Network }) { const [state, _] = useMegaStore() const [confirmOpen, setConfirmOpen] = createSignal(false); @@ -194,7 +195,7 @@ function ChannelsList() { }); }) - const network = state.mutiny_wallet?.get_network(); + const network = state.mutiny_wallet?.get_network() as Network; return ( <> @@ -253,6 +254,8 @@ function OpenChannel(props: { refetchChannels: RefetchChannelsListType }) { } }; + const network = state.mutiny_wallet?.get_network() as Network; + return ( <> @@ -283,7 +286,7 @@ function OpenChannel(props: { refetchChannels: RefetchChannelsListType }) { {JSON.stringify(newChannel()?.outpoint, null, 2)}
{newChannel()?.outpoint}
- + Mempool Link diff --git a/src/logic/mutinyWalletSetup.ts b/src/logic/mutinyWalletSetup.ts index 5dd44a6..11ac0e5 100644 --- a/src/logic/mutinyWalletSetup.ts +++ b/src/logic/mutinyWalletSetup.ts @@ -6,7 +6,7 @@ import initWaila from '@mutinywallet/waila-wasm' // network?: string, proxy?: string, esplora?: string, rgs?: string, lsp?: string, // } -type Network = "bitcoin" | "testnet" | "regtest" | "signet"; +export type Network = "bitcoin" | "testnet" | "regtest" | "signet"; export type MutinyWalletSettingStrings = { network?: Network, proxy?: string, esplora?: string, rgs?: string, lsp?: string, } diff --git a/src/routes/Receive.tsx b/src/routes/Receive.tsx index a8dc128..110c062 100644 --- a/src/routes/Receive.tsx +++ b/src/routes/Receive.tsx @@ -18,6 +18,7 @@ import { AmountCard } from "~/components/AmountCard"; import { ShareCard } from "~/components/ShareCard"; import { BackButton } from "~/components/layout/BackButton"; import { MutinyTagItem } from "~/utils/tags"; +import { Network } from "~/logic/mutinyWalletSetup"; type OnChainTx = { transaction: { @@ -181,6 +182,8 @@ export default function Receive() { const [paidState, { refetch }] = createResource(bip21Raw, checkIfPaid); + const network = state.mutiny_wallet?.get_network() as Network; + createEffect(() => { const interval = setInterval(() => { if (receiveState() === "show") refetch(); @@ -242,7 +245,7 @@ export default function Receive() { diff --git a/src/routes/Redshift.tsx b/src/routes/Redshift.tsx index 6b74e03..8568d57 100644 --- a/src/routes/Redshift.tsx +++ b/src/routes/Redshift.tsx @@ -13,6 +13,7 @@ import { MutinyChannel } from "@mutinywallet/mutiny-wasm"; import mempoolTxUrl from "~/utils/mempoolTxUrl"; import { Amount } from "~/components/Amount"; import { getRedshifted, setRedshifted } from "~/utils/fakeLabels"; +import { Network } from "~/logic/mutinyWalletSetup"; type ShiftOption = "utxo" | "lightning" @@ -106,6 +107,8 @@ function RedshiftReport(props: { redshift: RedshiftResult, utxo: UtxoItem }) { setRedshifted(true, redshiftResource()?.output_utxo) }) + const network = state.mutiny_wallet?.get_network() as Network; + return ( @@ -141,7 +144,7 @@ function RedshiftReport(props: { redshift: RedshiftResult, utxo: UtxoItem }) {
{redshiftResource().introduction_channel}
- + View on mempool
@@ -150,7 +153,7 @@ function RedshiftReport(props: { redshift: RedshiftResult, utxo: UtxoItem }) {
{redshiftResource().output_channel}
- + View on mempool diff --git a/src/utils/mempoolTxUrl.ts b/src/utils/mempoolTxUrl.ts index def9adf..9bf62fb 100644 --- a/src/utils/mempoolTxUrl.ts +++ b/src/utils/mempoolTxUrl.ts @@ -1,4 +1,6 @@ -export default function mempoolTxUrl(txid?: string, network?: string) { +import { Network } from "~/logic/mutinyWalletSetup" + +export default function mempoolTxUrl(txid?: string, network?: Network) { if (!txid || !network) { console.error("Problem creating the mempool url") return "#"