diff --git a/src/app/components/MessageSignPage/MessageSignPage.tsx b/src/app/components/MessageSignPage/MessageSignPage.tsx index eb51293..0ae53fd 100644 --- a/src/app/components/MessageSignPage/MessageSignPage.tsx +++ b/src/app/components/MessageSignPage/MessageSignPage.tsx @@ -21,7 +21,7 @@ export default function MessageSignPage() { setReqIndex(0); }, [signRequests]); - function nextRequest() { + async function nextRequest() { if (reqIndex < signRequests.length - 1) { setReqIndex(reqIndex + 1); } else { @@ -31,18 +31,17 @@ export default function MessageSignPage() { async function acceptClick() { setAccepting(true); - await fetchBackground({ method: "FINALIZE_MESSAGE_SIGN", id: signRequest.id, success: true }); + await fetchBackground({ method: "FINALIZE_MESSAGE_SIGN", id: signRequest?.id, success: true }); setAccepting(false); - nextRequest(); + await nextRequest(); } async function denyClick() { setDenying(true); - await fetchBackground({ method: "FINALIZE_MESSAGE_SIGN", id: signRequest.id, success: false }); + await fetchBackground({ method: "FINALIZE_MESSAGE_SIGN", id: signRequest?.id, success: false }); setDenying(false); - nextRequest(); + await nextRequest(); } - return (

Sign Request

@@ -50,7 +49,7 @@ export default function MessageSignPage() {

You sign:

Message:

-

{signRequest.message}

+

{signRequest?.message}

diff --git a/src/app/components/ModalConfirmation/ModalConfirmation.tsx b/src/app/components/ModalConfirmation/ModalConfirmation.tsx index f5c5c1b..514af42 100644 --- a/src/app/components/ModalConfirmation/ModalConfirmation.tsx +++ b/src/app/components/ModalConfirmation/ModalConfirmation.tsx @@ -35,7 +35,7 @@ const ModalConfirmation = ({ isOpen, onClose, onConfirm }: ModalConfirmationProp
params:
- {params && + {Array.isArray(params) && params.map((param: string) => {param})}
diff --git a/src/app/components/OuterConfirmation/OuterConfirmation.tsx b/src/app/components/OuterConfirmation/OuterConfirmation.tsx index 78b7a52..5892e72 100644 --- a/src/app/components/OuterConfirmation/OuterConfirmation.tsx +++ b/src/app/components/OuterConfirmation/OuterConfirmation.tsx @@ -32,14 +32,16 @@ const OuterConfirmation = () => { const [showFullAddresses, setShowFullAddresses] = useState(false); const [showFullComment, setShowFullComment] = useState(false); - const req = reqs[reqIndex]; + const req = reqs[reqIndex] || {}; const { id, name, params, method, destinations } = req; const isTransferMethod = name?.toLowerCase() === "transfer"; const isMultipleDestinations = destinations && destinations.length > 0; - const transactionParams = Object.fromEntries((params as ParamsType[]).map(item => [item.key, item.value])); + const transactionParams = params + ? Object.fromEntries((params as ParamsType[]).map(item => [item.key, item.value])) + : {}; const totalAmount = Number(isMultipleDestinations ? destinations.reduce((sum: number, dest: { amount: number }) => sum + Number(dest.amount), 0) : transactionParams.Amount).toLocaleString(); useEffect(() => { @@ -88,6 +90,10 @@ const OuterConfirmation = () => { console.log("FINALIZA TRANSACTION", req); + if (!req) { + return
No request found.
; + } + return (

Request Confirmation

@@ -101,11 +107,11 @@ const OuterConfirmation = () => {
From
-

{transactionParams.From}

+

{transactionParams?.From}

Asset
-

{getAssetIcon(transactionParams.Asset)} {transactionParams.Asset}

+

{getAssetIcon(transactionParams?.Asset)} {transactionParams?.Asset}

Amount
@@ -121,7 +127,7 @@ const OuterConfirmation = () => { : <> - {transactionParams.Comment} + {transactionParams?.Comment} {showFullComment && } }

@@ -131,7 +137,7 @@ const OuterConfirmation = () => {
To
-

{isMultipleDestinations ? <>{destinations?.length} addresses : transactionParams.To}

+

{isMultipleDestinations ? <>{destinations?.length} addresses : transactionParams?.To}

{!isMultipleDestinations &&
@@ -149,7 +155,7 @@ const OuterConfirmation = () => { Show addresses arrow - {showFullAddresses && destinations.map((item: DestionationType, idx: number) => ( + {showFullAddresses && destinations?.map((item: DestionationType, idx: number) => (

RECIPIENT {idx + 1}

@@ -172,7 +178,7 @@ const OuterConfirmation = () => { ) : (
- {params.map((item: ParamsType, idx: number) => ( + {Array.isArray(params) && params?.map((item: ParamsType, idx: number) => (
{item.key}

{item.value}