From 90ca41e462f19037b11a9371c84a34e969bd2aaf Mon Sep 17 00:00:00 2001 From: Gregor Zurowski Date: Mon, 4 May 2026 10:50:58 +0200 Subject: [PATCH 1/5] Don't allow withdrawals without MFA --- .../modals/ResearchCoin/WithdrawModal.tsx | 241 ++++++++++-------- 1 file changed, 137 insertions(+), 104 deletions(-) diff --git a/components/modals/ResearchCoin/WithdrawModal.tsx b/components/modals/ResearchCoin/WithdrawModal.tsx index baf945040..3c513ddfe 100644 --- a/components/modals/ResearchCoin/WithdrawModal.tsx +++ b/components/modals/ResearchCoin/WithdrawModal.tsx @@ -11,6 +11,7 @@ import { ChevronDown, } from 'lucide-react'; import Image from 'next/image'; +import Link from 'next/link'; import { BaseModal } from '@/components/ui/BaseModal'; import { BaseMenu, BaseMenuItem } from '@/components/ui/form/BaseMenu'; import { formatRSC, getMaxDecimalPlaces } from '@/utils/number'; @@ -266,6 +267,10 @@ export function WithdrawModal({ } // Main form footer + if (!isMfaEnabled) { + return null; // don't show if MFA is not enabled + } + return (
@@ -296,6 +301,7 @@ export function WithdrawModal({ handleWithdraw, isFeeLoading, showMfaConfirmation, + isMfaEnabled, ]); return ( @@ -445,118 +451,145 @@ export function WithdrawModal({ )} {mfaStatusError && ( - - Could not verify MFA status. If you have MFA enabled, the withdrawal may fail. - + Could not verify MFA status. Please try again later. )} - {/* Destination Address ("To") + inline network selector */} -
-
- To - + {!isMfaStatusLoading && !mfaStatusError && !isMfaEnabled && ( +
+
+ +
+
+

+ Two-factor authentication required +

+

+ To protect your funds, withdrawals require two-factor authentication. Please + enable it in your account settings to continue. +

+
+ + Go to Settings +
- + {/* Destination Address ("To") + inline network selector */} +
+
+ To + +
+ + {isAddressCopied ? ( + + ) : ( + + )} + + ) + } + /> + {destinationAddress && !isAddressValid ? ( +

+ Please enter a valid Ethereum address (0x followed by 40 hex characters). +

+ ) : null} +
+ + {/* Amount Input */} +
+ Amount +
+ +
+ RSC +
+
+
+ + Balance:{' '} + + {formatRSC({ amount: availableBalance })} RSC + + {fee != null && !isFeeLoading && ( + (− {fee} RSC fee) + )} + - ) - } - /> - {destinationAddress && !isAddressValid ? ( -

- Please enter a valid Ethereum address (0x followed by 40 hex characters). -

- ) : null} -
- - {/* Amount Input */} -
- Amount -
- + {feeError && ( +

+ + Unable to fetch fee: {feeError} +

)} - /> -
- RSC -
-
-
- - Balance:{' '} - - {formatRSC({ amount: availableBalance })} RSC - - {fee != null && !isFeeLoading && ( - (− {fee} RSC fee) + {isBelowMinimum && ( +

+ Minimum withdrawal amount is {MIN_WITHDRAWAL_AMOUNT} RSC. +

)} -
- -
- {feeError && ( -

- - Unable to fetch fee: {feeError} -

- )} - {isBelowMinimum && ( -

- Minimum withdrawal amount is {MIN_WITHDRAWAL_AMOUNT} RSC. -

- )} - {hasInsufficientBalance && ( -

- Withdrawal amount exceeds your available balance. -

- )} - {!isFeeLoading && amountUserWillReceive <= 0 && withdrawAmount > 0 && fee && ( -

- Withdrawal amount must be greater than the network fee. -

- )} -
+ {hasInsufficientBalance && ( +

+ Withdrawal amount exceeds your available balance. +

+ )} + {!isFeeLoading && amountUserWillReceive <= 0 && withdrawAmount > 0 && fee && ( +

+ Withdrawal amount must be greater than the network fee. +

+ )} +
+ + )} )}
From 4b1090ee66d19f7bd74596247dcc6a1a66a439a6 Mon Sep 17 00:00:00 2001 From: Gregor Zurowski Date: Mon, 4 May 2026 10:54:43 +0200 Subject: [PATCH 2/5] Move MFA check up --- components/modals/ResearchCoin/WithdrawModal.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/components/modals/ResearchCoin/WithdrawModal.tsx b/components/modals/ResearchCoin/WithdrawModal.tsx index 3c513ddfe..b705272f3 100644 --- a/components/modals/ResearchCoin/WithdrawModal.tsx +++ b/components/modals/ResearchCoin/WithdrawModal.tsx @@ -237,6 +237,11 @@ export function WithdrawModal({ }, []); const footer = useMemo(() => { + // Don't show footer if MFA is not enabled + if (!isMfaEnabled) { + return null; + } + const txHash = txStatus.state === 'success' ? txStatus.txHash : undefined; if (txHash) { @@ -267,10 +272,6 @@ export function WithdrawModal({ } // Main form footer - if (!isMfaEnabled) { - return null; // don't show if MFA is not enabled - } - return (
From 957b7c555df8678f537993b24bc2121d8a58194b Mon Sep 17 00:00:00 2001 From: Gregor Zurowski Date: Mon, 4 May 2026 11:10:51 +0200 Subject: [PATCH 3/5] Use "Enable 2FA" label for action button --- components/modals/ResearchCoin/WithdrawModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/modals/ResearchCoin/WithdrawModal.tsx b/components/modals/ResearchCoin/WithdrawModal.tsx index b705272f3..337e76a2a 100644 --- a/components/modals/ResearchCoin/WithdrawModal.tsx +++ b/components/modals/ResearchCoin/WithdrawModal.tsx @@ -474,7 +474,7 @@ export function WithdrawModal({ className="inline-flex items-center justify-center px-4 py-2 rounded-lg bg-primary-600 text-white font-medium hover:bg-primary-700 transition-colors" onClick={onClose} > - Go to Settings + Enable 2FA
)} From 2e1d988a7e0ddf5b9149715941bdb4b935bc8787 Mon Sep 17 00:00:00 2001 From: Gregor Zurowski Date: Mon, 4 May 2026 11:18:02 +0200 Subject: [PATCH 4/5] Use same icon and arrow as on the RSC page --- components/modals/ResearchCoin/WithdrawModal.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/components/modals/ResearchCoin/WithdrawModal.tsx b/components/modals/ResearchCoin/WithdrawModal.tsx index 337e76a2a..faac4d2b1 100644 --- a/components/modals/ResearchCoin/WithdrawModal.tsx +++ b/components/modals/ResearchCoin/WithdrawModal.tsx @@ -4,10 +4,11 @@ import { useCallback, useMemo, useState, useEffect, useRef } from 'react'; import { Check, AlertCircle, - AlertTriangle, + ShieldCheck, Loader2, Copy, ArrowLeft, + ArrowRight, ChevronDown, } from 'lucide-react'; import Image from 'next/image'; @@ -411,7 +412,7 @@ export function WithdrawModal({ } + icon={} > Verify your wallet supports {NETWORK_CONFIG[selectedNetwork].name}. @@ -458,7 +459,7 @@ export function WithdrawModal({ {!isMfaStatusLoading && !mfaStatusError && !isMfaEnabled && (
- +

@@ -471,10 +472,11 @@ export function WithdrawModal({

Enable 2FA +
)} From 469e9357bad41c967d63ed2ccbb0d4c6506c819e Mon Sep 17 00:00:00 2001 From: Gregor Zurowski Date: Mon, 4 May 2026 11:20:35 +0200 Subject: [PATCH 5/5] Make modal slightly more compact --- components/modals/ResearchCoin/WithdrawModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/modals/ResearchCoin/WithdrawModal.tsx b/components/modals/ResearchCoin/WithdrawModal.tsx index faac4d2b1..2a45278dd 100644 --- a/components/modals/ResearchCoin/WithdrawModal.tsx +++ b/components/modals/ResearchCoin/WithdrawModal.tsx @@ -457,7 +457,7 @@ export function WithdrawModal({ )} {!isMfaStatusLoading && !mfaStatusError && !isMfaEnabled && ( -
+