diff --git a/components/Bridge/WalletSwitchV2/NEVMConnect.tsx b/components/Bridge/WalletSwitchV2/NEVMConnect.tsx index 5e85690..aeb6fbb 100644 --- a/components/Bridge/WalletSwitchV2/NEVMConnect.tsx +++ b/components/Bridge/WalletSwitchV2/NEVMConnect.tsx @@ -6,6 +6,7 @@ import WalletSwitchConfirmCard from "./ConfirmCard"; import { ITransfer } from "@contexts/Transfer/types"; import { useNevmBalance } from "utils/balance-hooks"; import { MIN_AMOUNT } from "@constants"; +import { useFeatureFlags } from "../v3/hooks/useFeatureFlags"; type NEVMConnectProps = { transfer: ITransfer; @@ -16,6 +17,7 @@ const minAmount = MIN_AMOUNT; const NEVMConnect: React.FC = ({ setNevm, transfer }) => { const { account, connect } = useNEVM(); + const { isEnabled } = useFeatureFlags(); const { isBitcoinBased, switchTo, changeAccount, isEVMInjected } = usePaliWalletV2(); const balance = useNevmBalance(transfer.nevmAddress); @@ -41,8 +43,13 @@ const NEVMConnect: React.FC = ({ setNevm, transfer }) => { if (isNaN(balanceNum)) { balanceNum = 0; } + const foundationFundingAvailable = + isEnabled("foundationFundingAvailable") && + transfer.type === "sys-to-nevm"; const faucetLink = - balance.isFetched && balanceNum < minAmount ? ( + balance.isFetched && + balanceNum < minAmount && + !foundationFundingAvailable ? ( You don't have enough balance. Please go to  diff --git a/components/Bridge/v3/Steps/ConnectValidate.tsx b/components/Bridge/v3/Steps/ConnectValidate.tsx index 9122866..6b28a95 100644 --- a/components/Bridge/v3/Steps/ConnectValidate.tsx +++ b/components/Bridge/v3/Steps/ConnectValidate.tsx @@ -19,9 +19,8 @@ import NEVMConnect from "components/Bridge/WalletSwitchV2/NEVMConnect"; import { useNevmBalance, useUtxoBalance } from "utils/balance-hooks"; import { ITransfer, TransferStatus } from "@contexts/Transfer/types"; import { useRouter } from "next/router"; -import NextLink from "next/link"; -import CompareArrows from "@mui/icons-material/CompareArrows"; import { MIN_AMOUNT } from "@constants"; +import { useFeatureFlags } from "../hooks/useFeatureFlags"; const ErrorMessage = ({ message }: { message: string }) => ( @@ -49,6 +48,7 @@ const BridgeV3ConnectValidateStep: React.FC< const { replace } = useRouter(); const { transfer, isSaving, saveTransfer } = useTransfer(); const { isLoading } = usePaliWalletV2(); + const { isEnabled } = useFeatureFlags(); const { register, setValue, @@ -79,7 +79,11 @@ const BridgeV3ConnectValidateStep: React.FC< utxoBalance.data !== undefined && utxoBalance.data < minAmount; + const foundationFundingAvailable = + isEnabled("foundationFundingAvailable") && transfer.type === "sys-to-nevm"; + const isNevmNotEnoughGas = + !foundationFundingAvailable && Boolean(nevmAddress) && nevmBalance.isFetched && nevmBalance.data !== undefined && @@ -98,7 +102,8 @@ const BridgeV3ConnectValidateStep: React.FC< const isUtxoValid = isValidSYSAddress(utxoAddress, 57) && !isUtxoNotEnoughGas; const isNevmValid = - isValidEthereumAddress(nevmAddress) && !isNevmNotEnoughGas; + isValidEthereumAddress(nevmAddress) && + (!isNevmNotEnoughGas || foundationFundingAvailable); const isAmountValid = errors.amount === undefined; const balanceFetched = utxoBalance.isFetched && nevmBalance.isFetched; const isReady = isUtxoValid && isNevmValid && isAmountValid && balanceFetched;