From 78034b3a30b0bd78a02a69f0526a562cd887bd2d Mon Sep 17 00:00:00 2001 From: manuelwedler Date: Wed, 3 May 2023 13:02:06 +0200 Subject: [PATCH] frontend: Show a warning if the same address as the connected Safe is chosen as the target --- frontend/src/components/RequestTargetInputs.vue | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/frontend/src/components/RequestTargetInputs.vue b/frontend/src/components/RequestTargetInputs.vue index f44d953d7..2a2f0951e 100644 --- a/frontend/src/components/RequestTargetInputs.vue +++ b/frontend/src/components/RequestTargetInputs.vue @@ -43,6 +43,9 @@
{{ v$.selectedTargetAddress.$errors[0].$message }}
+
+ Make sure you own a Safe with this address on the destination chain. +
 
@@ -66,7 +69,9 @@ import Selector from '@/components/inputs/Selector.vue'; import InputValidationMessage from '@/components/layout/InputValidationMessage.vue'; import { useChainSelection } from '@/composables/useChainSelection'; import { useRequestTargetInputValidations } from '@/composables/useRequestTargetInputValidations'; +import { SafeProvider } from '@/services/web3-provider'; import { useConfiguration } from '@/stores/configuration'; +import { useEthereumProvider } from '@/stores/ethereum-provider'; import { usePortals } from '@/stores/portals'; import type { Chain, Token } from '@/types/data'; import type { RequestTarget, SelectorOption } from '@/types/form'; @@ -86,8 +91,10 @@ const props = defineProps(); const emits = defineEmits(); const configuration = useConfiguration(); +const ethereumProvider = useEthereumProvider(); const { hideActionButton, showActionButton } = usePortals(); +const { provider, signerAddress } = storeToRefs(ethereumProvider); const { chains } = storeToRefs(configuration); const selectedTargetChain = ref | null>(props.modelValue.targetChain); @@ -98,6 +105,11 @@ const ignoreChains = computed(() => ); const { chainOptions } = useChainSelection(chains, ignoreChains); +const showSafeSameTargetWarning = computed( + () => + provider.value instanceof SafeProvider && signerAddress.value === selectedTargetAddress.value, +); + watch( () => props.sourceChain, (newSourceChain) => {