diff --git a/src/components/tx/SignOrExecuteForm/ExecuteForm.tsx b/src/components/tx/SignOrExecuteForm/ExecuteForm.tsx index 38ab56b1bc..0df4e852ce 100644 --- a/src/components/tx/SignOrExecuteForm/ExecuteForm.tsx +++ b/src/components/tx/SignOrExecuteForm/ExecuteForm.tsx @@ -52,13 +52,14 @@ const ExecuteForm = ({ // Check that the transaction is executable const isExecutionLoop = useIsExecutionLoop() - // We default to relay, but the option is only shown if we canRelay - const [executionMethod, setExecutionMethod] = useState(ExecutionMethod.RELAY) - // SC wallets can relay fully signed transactions - const [canRelay] = useWalletCanRelay(safeTx) + const [canWalletRelay] = useWalletCanRelay(safeTx) + // We default to relay + const [executionMethod, setExecutionMethod] = useState( + canWalletRelay ? ExecutionMethod.RELAY : ExecutionMethod.WALLET, + ) // The transaction can/will be relayed - const willRelay = canRelay && executionMethod === ExecutionMethod.RELAY + const willRelay = executionMethod === ExecutionMethod.RELAY const hasRelays = !!relays?.remaining // Estimate gas limit @@ -111,7 +112,7 @@ const ExecuteForm = ({ return ( <>
-
+
- {canRelay && ( + {canWalletRelay && (
{ const { safe } = useSafeInfo() const wallet = useWallet() + const chain = useCurrentChain() + const isFeatureEnabled = chain && hasFeature(chain, FEATURES.RELAYING) const hasEnoughSignatures = tx && tx.signatures.size >= safe.threshold return useAsync(() => { - if (!tx || !wallet) return + if (!isFeatureEnabled || !tx || !wallet) return return isSmartContractWallet(wallet) .then((isSCWallet) => { @@ -23,7 +27,7 @@ const useWalletCanRelay = (tx: SafeTransaction | undefined) => { logError(Errors._106, err.message) return false }) - }, [hasEnoughSignatures, tx, wallet]) + }, [isFeatureEnabled, hasEnoughSignatures, tx, wallet]) } export default useWalletCanRelay