diff --git a/app/transactions/hash/[id]/page.tsx b/app/transactions/hash/[id]/page.tsx index 1927892..5589bcc 100644 --- a/app/transactions/hash/[id]/page.tsx +++ b/app/transactions/hash/[id]/page.tsx @@ -17,12 +17,20 @@ import LnPayment from "../../../../components/transactions/ln-payment" export default async function TransactionDetails({ params }: { params: { id: string } }) { const id = params.id - const data = await getClient().query({ - query: TransactionsByHashDocument, - variables: { hash: id }, - }) + let txs: any - const txs = data.data.transactionsByHash + try { + const data = await getClient().query({ + query: TransactionsByHashDocument, + variables: { hash: id }, + }) + + txs = data.data.transactionsByHash + } catch (err) { + // ignore + // no transactions attached to this hash + console.log(err) + } let invoice: LightningInvoice | undefined @@ -39,7 +47,7 @@ export default async function TransactionDetails({ params }: { params: { id: str console.log(err) } - let payment: LightningPayment + let payment: LightningPayment | undefined try { const data = await getClient().query({ @@ -49,31 +57,36 @@ export default async function TransactionDetails({ params }: { params: { id: str payment = data.data?.lightningPayment } catch (err) { - const message = err instanceof Error ? err.message : "Unknown error" - return { message: `Failed to fetch: ${message}` } + // ignore + // no payment attached to this hash + console.log(err) } return ( <> -

- Transaction details -

-
- {txs && } -
+ {txs && ( + <> +

+ Transaction details +

+
+ +
+ + )} {invoice && ( <>

Invoice

- {invoice && } +
)} {payment && ( <> -

Invoice

+

Payment

- {payment && } +
)} diff --git a/components/transactions/list.tsx b/components/transactions/list.tsx index 075c0bd..2def639 100644 --- a/components/transactions/list.tsx +++ b/components/transactions/list.tsx @@ -1,7 +1,7 @@ import { formatDate, formatNumber } from "../../app/utils" type Props = { - transactions: any + transactions: unknown[] } /* eslint @typescript-eslint/ban-ts-comment: "off" */