diff --git a/src/logic/wallets/transactionDataCheck.ts b/src/logic/wallets/transactionDataCheck.ts index 5c7a7b05..4ca7235e 100644 --- a/src/logic/wallets/transactionDataCheck.ts +++ b/src/logic/wallets/transactionDataCheck.ts @@ -1,18 +1,19 @@ -function transactionDataCheck(): any { - let completed = false - return (stateAndHelpers) => { - const { wallet } = stateAndHelpers +import { loadFromStorage, saveToStorage } from 'src/utils/storage' +import { WALLET_PROVIDER } from 'src/logic/wallets/getWeb3' - if (wallet && wallet.name === 'Ledger' && !completed) { +const USER_ENABLED_LEDGER_TX_DATA = 'USER_ENABLED_LEDGER_TX_DATA' +function transactionDataCheck(): any { + return async (stateAndHelpers) => { + const { wallet } = stateAndHelpers + const isTransactionDataEnabled = await loadFromStorage(USER_ENABLED_LEDGER_TX_DATA) + if (wallet && wallet.name === WALLET_PROVIDER.LEDGER && !isTransactionDataEnabled) { return { heading: 'Allow Transaction Data', // edit modal heading here description: 'Please allow transaction data on your Ledger device.', // edit modal description that is displayed here. You can include html strings here and they will be rendered as html elements. eventCode: 'allowTransactionData', button: { text: 'Done', - onclick: () => { - completed = true - }, + onclick: async () => await saveToStorage(USER_ENABLED_LEDGER_TX_DATA, true), }, icon: ` diff --git a/src/routes/open/container/Open.tsx b/src/routes/open/container/Open.tsx index f489fbe3..45c5e714 100644 --- a/src/routes/open/container/Open.tsx +++ b/src/routes/open/container/Open.tsx @@ -69,12 +69,14 @@ export const createSafe = (values, userAccount) => { }) .then(async (receipt) => { await checkReceiptStatus(receipt.transactionHash) - const safeAddress = receipt.events.ProxyCreation.returnValues.proxy const safeProps = await getSafeProps(safeAddress, name, ownersNames, ownerAddresses) // returning info for testing purposes, in app is fully async return { safeAddress: safeProps.address, safeTx: receipt } }) + .catch((error) => { + console.error(error) + }) return promiEvent } diff --git a/src/routes/safe/store/actions/createTransaction.ts b/src/routes/safe/store/actions/createTransaction.ts index a6cb1b57..2dbfd554 100644 --- a/src/routes/safe/store/actions/createTransaction.ts +++ b/src/routes/safe/store/actions/createTransaction.ts @@ -117,6 +117,7 @@ const createTransaction = ({ const notificationsQueue = getNotificationsFromTxType(notifiedTransaction, origin) const beforeExecutionKey = showSnackbar(notificationsQueue.beforeExecution, enqueueSnackbar, closeSnackbar) + let pendingExecutionKey let txHash @@ -246,6 +247,10 @@ const createTransaction = ({ return receipt.transactionHash }) } catch (err) { + const errorMsg = err.message + ? `${notificationsQueue.afterExecutionError.message} - ${err.message}` + : notificationsQueue.afterExecutionError.message + console.error(err) closeSnackbar(beforeExecutionKey) @@ -253,7 +258,7 @@ const createTransaction = ({ closeSnackbar(pendingExecutionKey) } - showSnackbar(notificationsQueue.afterExecutionError, enqueueSnackbar, closeSnackbar) + showSnackbar(errorMsg, enqueueSnackbar, closeSnackbar) const executeDataUsedSignatures = safeInstance.contract.methods .execTransaction(to, valueInWei, txData, operation, 0, 0, 0, ZERO_ADDRESS, ZERO_ADDRESS, sigs) diff --git a/src/routes/safe/store/actions/processTransaction.ts b/src/routes/safe/store/actions/processTransaction.ts index a1bc4f47..f591b02d 100644 --- a/src/routes/safe/store/actions/processTransaction.ts +++ b/src/routes/safe/store/actions/processTransaction.ts @@ -199,6 +199,9 @@ const processTransaction = ({ return receipt.transactionHash }) } catch (err) { + const errorMsg = err.message + ? `${notificationsQueue.afterExecutionError.message} - ${err.message}` + : notificationsQueue.afterExecutionError.message console.error(err) if (txHash !== undefined) { @@ -208,7 +211,7 @@ const processTransaction = ({ closeSnackbar(pendingExecutionKey) } - showSnackbar(notificationsQueue.afterExecutionError, enqueueSnackbar, closeSnackbar) + showSnackbar(errorMsg, enqueueSnackbar, closeSnackbar) const executeData = safeInstance.contract.methods.approveHash(txHash).encodeABI() const errMsg = await getErrorMessage(safeInstance.address, 0, executeData, from)