diff --git a/app/css/interceptor.css b/app/css/interceptor.css index f50cf86e..72bb0d72 100644 --- a/app/css/interceptor.css +++ b/app/css/interceptor.css @@ -891,9 +891,9 @@ svg.spinner > circle { .dashed-notification { border-style: dashed; - background: unset; - border-width: medium; - border-color: white; + background: unset; + border-width: medium; + border-color: white; } .popup-footer { diff --git a/app/ts/background/background.ts b/app/ts/background/background.ts index 0b8e8daa..2159be34 100644 --- a/app/ts/background/background.ts +++ b/app/ts/background/background.ts @@ -648,7 +648,7 @@ export async function popupMessageHandler( case 'popup_get_export_settings': return await exportSettings() case 'popup_set_rpc_list': return await setNewRpcList(simulator, parsedRequest, settings) case 'popup_simulateGovernanceContractExecution': return await simulateGovernanceContractExecutionOnPass(simulator.ethereum, parsedRequest) - case 'popup_simulateGnosisSafeTransaction': return await simulateGnosisSafeTransactionOnPass(simulator.ethereum, parsedRequest) + case 'popup_simulateGnosisSafeTransaction': return await simulateGnosisSafeTransactionOnPass(simulator.ethereum, parsedRequest.data.gnosisSafeMessage) case 'popup_changeAddOrModifyAddressWindowState': return await changeAddOrModifyAddressWindowState(simulator.ethereum, parsedRequest) case 'popup_fetchAbiAndNameFromEtherscan': return await popupFetchAbiAndNameFromEtherscan(parsedRequest) case 'popup_openWebPage': return await openWebPage(parsedRequest) diff --git a/app/ts/background/popupMessageHandlers.ts b/app/ts/background/popupMessageHandlers.ts index af0adb2e..5fdc5b31 100644 --- a/app/ts/background/popupMessageHandlers.ts +++ b/app/ts/background/popupMessageHandlers.ts @@ -2,7 +2,7 @@ import { changeActiveAddressAndChainAndResetSimulation, changeActiveRpc, refresh import { getSettings, setUseTabsInsteadOfPopup, setMakeMeRich, setPage, setUseSignersAddressAsActiveAddress, updateWebsiteAccess, exportSettingsAndAddressBook, importSettingsAndAddressBook, getMakeMeRich, getUseTabsInsteadOfPopup, getMetamaskCompatibilityMode, setMetamaskCompatibilityMode, getPage } from './settings.js' import { getPendingTransactionsAndMessages, getCurrentTabId, getTabState, saveCurrentTabId, setRpcList, getRpcList, getPrimaryRpcForChain, getRpcConnectionStatus, updateUserAddressBookEntries, getSimulationResults, setIdsOfOpenedTabs, getIdsOfOpenedTabs, updatePendingTransactionOrMessage, getLatestUnexpectedError, addEnsLabelHash, addEnsNodeHash } from './storageVariables.js' import { Simulator, parseEvents, parseInputData } from '../simulation/simulator.js' -import { ChangeActiveAddress, ChangeMakeMeRich, ChangePage, RemoveTransaction, RequestAccountsFromSigner, TransactionConfirmation, InterceptorAccess, ChangeInterceptorAccess, ChainChangeConfirmation, EnableSimulationMode, ChangeActiveChain, AddOrEditAddressBookEntry, GetAddressBookData, RemoveAddressBookEntry, InterceptorAccessRefresh, InterceptorAccessChangeAddress, Settings, RefreshConfirmTransactionMetadata, ChangeSettings, ImportSettings, SetRpcList, UpdateHomePage, SimulateGovernanceContractExecution, ChangeAddOrModifyAddressWindowState, FetchAbiAndNameFromEtherscan, OpenWebPage, DisableInterceptor, SetEnsNameForHash, UpdateConfirmTransactionDialog, UpdateConfirmTransactionDialogPendingTransactions, SimulateGnosisSafeTransaction, SimulateExecutionReply } from '../types/interceptor-messages.js' +import { ChangeActiveAddress, ChangeMakeMeRich, ChangePage, RemoveTransaction, RequestAccountsFromSigner, TransactionConfirmation, InterceptorAccess, ChangeInterceptorAccess, ChainChangeConfirmation, EnableSimulationMode, ChangeActiveChain, AddOrEditAddressBookEntry, GetAddressBookData, RemoveAddressBookEntry, InterceptorAccessRefresh, InterceptorAccessChangeAddress, Settings, RefreshConfirmTransactionMetadata, ChangeSettings, ImportSettings, SetRpcList, UpdateHomePage, SimulateGovernanceContractExecution, ChangeAddOrModifyAddressWindowState, FetchAbiAndNameFromEtherscan, OpenWebPage, DisableInterceptor, SetEnsNameForHash, UpdateConfirmTransactionDialog, UpdateConfirmTransactionDialogPendingTransactions, SimulateExecutionReply } from '../types/interceptor-messages.js' import { formEthSendTransaction, formSendRawTransaction, resolvePendingTransactionOrMessage, updateConfirmTransactionView } from './windows/confirmTransaction.js' import { getAddressMetadataForAccess, requestAddressChange, resolveInterceptorAccess } from './windows/interceptorAccess.js' import { resolveChainChange } from './windows/changeChain.js' @@ -29,6 +29,7 @@ import { makeSureInterceptorIsNotSleeping } from './sleeping.js' import { craftPersonalSignPopupMessage } from './windows/personalSign.js' import { checkAndThrowRuntimeLastError, updateTabIfExists } from '../utils/requests.js' import { modifyObject } from '../utils/typescript.js' +import { VisualizedPersonalSignRequestSafeTx } from '../types/personal-message-definitions.js' export async function confirmDialog(simulator: Simulator, websiteTabConnections: WebsiteTabConnections, confirmation: TransactionConfirmation) { await resolvePendingTransactionOrMessage(simulator, websiteTabConnections, confirmation) @@ -389,12 +390,12 @@ export async function simulateGovernanceContractExecutionOnPass(ethereum: Ethere })) } -export async function simulateGnosisSafeTransactionOnPass(ethereum: EthereumClientService, request: SimulateGnosisSafeTransaction) { +export async function simulateGnosisSafeTransactionOnPass(ethereum: EthereumClientService, gnosisSafeMessage: VisualizedPersonalSignRequestSafeTx) { const simulationResults = await getSimulationResults() - const gnosisTransactionExecutionVisualisation = await simulateGnosisSafeMetaTransaction(request.data.gnosisSafeMessage, simulationResults.simulationState, ethereum) + const gnosisTransactionExecutionVisualisation = await simulateGnosisSafeMetaTransaction(gnosisSafeMessage, simulationResults.simulationState, ethereum) return await sendPopupMessageToOpenWindows(serialize(SimulateExecutionReply, { method: 'popup_simulateExecutionReply' as const, - data: { ...gnosisTransactionExecutionVisualisation, transactionOrMessageIdentifier: request.data.gnosisSafeMessage.messageIdentifier } + data: { ...gnosisTransactionExecutionVisualisation, transactionOrMessageIdentifier: gnosisSafeMessage.messageIdentifier } })) } diff --git a/app/ts/background/windows/confirmTransaction.ts b/app/ts/background/windows/confirmTransaction.ts index 4565d48b..60e8e654 100644 --- a/app/ts/background/windows/confirmTransaction.ts +++ b/app/ts/background/windows/confirmTransaction.ts @@ -24,6 +24,7 @@ import { craftPersonalSignPopupMessage } from './personalSign.js' import { getSettings } from '../settings.js' import * as funtypes from 'funtypes' import { modifyObject } from '../../utils/typescript.js' +import { simulateGnosisSafeTransactionOnPass } from '../popupMessageHandlers.js' const pendingConfirmationSemaphore = new Semaphore(1) @@ -289,6 +290,9 @@ export async function openConfirmTransactionDialogForMessage( await updateConfirmTransactionView(ethereumClientService) await tryFocusingTabOrWindow(openedDialog) + if (visualizedPersonalSignRequest.type === 'SafeTx') { + await simulateGnosisSafeTransactionOnPass(simulator.ethereum, visualizedPersonalSignRequest) + } }) } catch(e) { await handleUnexpectedError(e) diff --git a/app/ts/components/pages/PersonalSign.tsx b/app/ts/components/pages/PersonalSign.tsx index 4d1739fb..0639d7f5 100644 --- a/app/ts/components/pages/PersonalSign.tsx +++ b/app/ts/components/pages/PersonalSign.tsx @@ -138,11 +138,11 @@ function SignRequest({ visualizedPersonalSignRequest, renameAddressCallBack, edi
{ visualizedPersonalSignRequest.message }
} - case 'SafeTx': returnGnosis Safe meta transaction input:
-{ dataStringWith0xStart(visualizedPersonalSignRequestSafeTx.message.message.data) }
-Parsed Gnosis Safe meta transaction:
- { visualizedPersonalSignRequestSafeTx.parsedMessageData?.type !== 'Parsed' ?No ABI available
:Gnosis Safe meta transaction input:
+{ dataStringWith0xStart(visualizedPersonalSignRequestSafeTx.message.message.data) }
+Parsed Gnosis Safe meta transaction:
+ { visualizedPersonalSignRequestSafeTx.parsedMessageData?.type !== 'Parsed' ?No ABI available
:Simulation of this transaction should the multisig approve the transaction:
-Approves Gnosis Safe
message