From 7dd1d2177eee098ba80fe46c4f0c788bdb930136 Mon Sep 17 00:00:00 2001 From: Iveta Date: Wed, 13 Nov 2024 16:50:43 -0500 Subject: [PATCH] Fix View XDR for non-transaction types (#1156) --- src/app/(sidebar)/xdr/view/page.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/app/(sidebar)/xdr/view/page.tsx b/src/app/(sidebar)/xdr/view/page.tsx index a8a9322b..a10e11c1 100644 --- a/src/app/(sidebar)/xdr/view/page.tsx +++ b/src/app/(sidebar)/xdr/view/page.tsx @@ -81,9 +81,18 @@ export default function ViewXdr() { }; const xdrJsonDecoded = xdrDecodeJson(); - const txn = xdrJsonDecoded?.jsonString - ? TransactionBuilder.fromXDR(xdr.blob, network.passphrase) - : null; + + const txnFromXdr = () => { + try { + return xdrJsonDecoded?.jsonString + ? TransactionBuilder.fromXDR(xdr.blob, network.passphrase) + : null; + } catch (e) { + return null; + } + }; + + const txn = txnFromXdr(); const prettifyJsonString = (jsonString: string): string => { try {