From ced3211d6d5552e7c9087a476d6cd9f0f0db82ec Mon Sep 17 00:00:00 2001
From: katspaugh <381895+katspaugh@users.noreply.github.com>
Date: Mon, 13 Nov 2023 16:39:07 +0100
Subject: [PATCH] Fix: revert relaying message (#2799)
---
package.json | 2 +-
.../tx/ExecutionMethodSelector/index.tsx | 2 +-
.../tx/SignOrExecuteForm/ExecuteForm.tsx | 25 +++---
src/components/tx/SponsoredBy/index.tsx | 87 +++++++------------
src/hooks/useWalletCanRelay.ts | 8 +-
5 files changed, 44 insertions(+), 80 deletions(-)
diff --git a/package.json b/package.json
index 60669cabad..329f71c72e 100644
--- a/package.json
+++ b/package.json
@@ -3,7 +3,7 @@
"homepage": "https://github.com/safe-global/safe-wallet-web",
"license": "GPL-3.0",
"type": "module",
- "version": "1.22.1",
+ "version": "1.22.2",
"scripts": {
"dev": "next dev",
"start": "next dev",
diff --git a/src/components/tx/ExecutionMethodSelector/index.tsx b/src/components/tx/ExecutionMethodSelector/index.tsx
index baae6e7855..95e56b9d4a 100644
--- a/src/components/tx/ExecutionMethodSelector/index.tsx
+++ b/src/components/tx/ExecutionMethodSelector/index.tsx
@@ -71,7 +71,7 @@ export const ExecutionMethodSelector = ({
-
+ {shouldRelay && relays ? : null}
)
}
diff --git a/src/components/tx/SignOrExecuteForm/ExecuteForm.tsx b/src/components/tx/SignOrExecuteForm/ExecuteForm.tsx
index 628c5877f9..72ae840fc6 100644
--- a/src/components/tx/SignOrExecuteForm/ExecuteForm.tsx
+++ b/src/components/tx/SignOrExecuteForm/ExecuteForm.tsx
@@ -12,6 +12,7 @@ import { useIsExecutionLoop, useTxActions } from './hooks'
import { useRelaysBySafe } from '@/hooks/useRemainingRelays'
import useWalletCanRelay from '@/hooks/useWalletCanRelay'
import { ExecutionMethod, ExecutionMethodSelector } from '../ExecutionMethodSelector'
+import { hasRemainingRelays } from '@/utils/relaying'
import type { SignOrExecuteProps } from '.'
import type { SafeTransaction } from '@safe-global/safe-core-sdk-types'
import { TxModalContext } from '@/components/tx-flow'
@@ -52,13 +53,15 @@ const ExecuteForm = ({
// Check that the transaction is executable
const isExecutionLoop = useIsExecutionLoop()
- // SC wallets can relay fully signed transactions
- const [canWalletRelay] = useWalletCanRelay(safeTx)
- // We default to relay
+ // 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 [walletCanRelay] = useWalletCanRelay(safeTx)
+
// The transaction can/will be relayed
- const willRelay = executionMethod === ExecutionMethod.RELAY
- const hasRelays = !!relays?.remaining
+ const canRelay = walletCanRelay && hasRemainingRelays(relays)
+ const willRelay = canRelay && executionMethod === ExecutionMethod.RELAY
// Estimate gas limit
const { gasLimit, gasLimitError } = useGasLimit(safeTx)
@@ -99,18 +102,12 @@ const ExecuteForm = ({
const cannotPropose = !isOwner && !onlyExecute
const submitDisabled =
- !safeTx ||
- !isSubmittable ||
- disableSubmit ||
- isValidExecutionLoading ||
- isExecutionLoop ||
- cannotPropose ||
- (willRelay && !hasRelays)
+ !safeTx || !isSubmittable || disableSubmit || isValidExecutionLoading || isExecutionLoop || cannotPropose
return (
<>