Implement generic settings notifications
This commit is contained in:
parent
5a86436c2f
commit
2b26e18147
|
@ -41,7 +41,7 @@ const notificationStyles = {
|
||||||
boxShadow: '0 0 10px 0 rgba(212, 212, 211, 0.59)',
|
boxShadow: '0 0 10px 0 rgba(212, 212, 211, 0.59)',
|
||||||
},
|
},
|
||||||
info: {
|
info: {
|
||||||
background: '#e8673c',
|
background: '#ffffff',
|
||||||
fontFamily: 'Averta',
|
fontFamily: 'Averta',
|
||||||
fontSize: '14px',
|
fontSize: '14px',
|
||||||
lineHeight: 1.43,
|
lineHeight: 1.43,
|
||||||
|
|
|
@ -8,14 +8,14 @@ import closeSnackbarAction from '~/logic/notifications/store/actions/closeSnackb
|
||||||
import { type Notification, NOTIFICATIONS } from './notificationTypes'
|
import { type Notification, NOTIFICATIONS } from './notificationTypes'
|
||||||
|
|
||||||
export type NotificationsQueue = {
|
export type NotificationsQueue = {
|
||||||
beforeExecution: Notification,
|
beforeExecution: Notification | null,
|
||||||
pendingExecution: Notification,
|
pendingExecution: Notification | null,
|
||||||
afterExecution: {
|
afterExecution: {
|
||||||
noMoreConfirmationsNeeded: Notification,
|
noMoreConfirmationsNeeded: Notification | null,
|
||||||
moreConfirmationsNeeded: Notification,
|
moreConfirmationsNeeded: Notification | null,
|
||||||
},
|
},
|
||||||
afterExecutionError: Notification,
|
afterExecutionError: Notification | null,
|
||||||
afterRejection: Notification,
|
afterRejection: Notification | null,
|
||||||
}
|
}
|
||||||
|
|
||||||
const standardTxNotificationsQueue: NotificationsQueue = {
|
const standardTxNotificationsQueue: NotificationsQueue = {
|
||||||
|
@ -31,78 +31,67 @@ const standardTxNotificationsQueue: NotificationsQueue = {
|
||||||
|
|
||||||
const confirmationTxNotificationsQueue: NotificationsQueue = {
|
const confirmationTxNotificationsQueue: NotificationsQueue = {
|
||||||
beforeExecution: NOTIFICATIONS.SIGN_TX_MSG,
|
beforeExecution: NOTIFICATIONS.SIGN_TX_MSG,
|
||||||
pendingExecution: {
|
pendingExecution: NOTIFICATIONS.TX_CONFIRMATION_PENDING_MSG,
|
||||||
noMoreConfirmationsNeeded: NOTIFICATIONS.TX_CONFIRMATION_PENDING_MSG,
|
afterRejection: NOTIFICATIONS.TX_REJECTED_MSG,
|
||||||
|
afterExecution: {
|
||||||
|
noMoreConfirmationsNeeded: NOTIFICATIONS.TX_CONFIRMATION_EXECUTED_MSG,
|
||||||
moreConfirmationsNeeded: null,
|
moreConfirmationsNeeded: null,
|
||||||
},
|
},
|
||||||
afterRejection: NOTIFICATIONS.TX_REJECTED_MSG,
|
|
||||||
afterExecution: NOTIFICATIONS.TX_CONFIRMATION_EXECUTED_MSG,
|
|
||||||
afterExecutionError: NOTIFICATIONS.TX_CONFIRMATION_FAILED_MSG,
|
afterExecutionError: NOTIFICATIONS.TX_CONFIRMATION_FAILED_MSG,
|
||||||
}
|
}
|
||||||
|
|
||||||
const cancellationTxNotificationsQueue: NotificationsQueue = {
|
const cancellationTxNotificationsQueue: NotificationsQueue = {
|
||||||
beforeExecution: NOTIFICATIONS.SIGN_TX_MSG,
|
beforeExecution: NOTIFICATIONS.SIGN_TX_MSG,
|
||||||
pendingExecution: {
|
pendingExecution: NOTIFICATIONS.TX_PENDING_MSG,
|
||||||
noMoreConfirmationsNeeded: NOTIFICATIONS.TX_PENDING_MSG,
|
|
||||||
moreConfirmationsNeeded: NOTIFICATIONS.TX_PENDING_MORE_CONFIRMATIONS_MSG,
|
|
||||||
},
|
|
||||||
afterRejection: NOTIFICATIONS.TX_REJECTED_MSG,
|
afterRejection: NOTIFICATIONS.TX_REJECTED_MSG,
|
||||||
afterExecution: NOTIFICATIONS.TX_EXECUTED_MSG,
|
afterExecution: {
|
||||||
afterExecutionError: NOTIFICATIONS.TX_FAILED_MSG,
|
noMoreConfirmationsNeeded: NOTIFICATIONS.TX_EXECUTED_MSG,
|
||||||
}
|
moreConfirmationsNeeded: NOTIFICATIONS.TX_EXECUTED_MORE_CONFIRMATIONS_MSG,
|
||||||
|
|
||||||
const ownerChangeTxNotificationsQueue: NotificationsQueue = {
|
|
||||||
beforeExecution: NOTIFICATIONS.SIGN_OWNER_CHANGE_MSG,
|
|
||||||
pendingExecution: {
|
|
||||||
noMoreConfirmationsNeeded: NOTIFICATIONS.OWNER_CHANGE_PENDING_MSG,
|
|
||||||
moreConfirmationsNeeded: NOTIFICATIONS.OWNER_CHANGE_PENDING_MORE_CONFIRMATIONS_MSG,
|
|
||||||
},
|
},
|
||||||
afterRejection: NOTIFICATIONS.OWNER_CHANGE_REJECTED_MSG,
|
afterExecutionError: NOTIFICATIONS.TX_FAILED_MSG,
|
||||||
afterExecution: NOTIFICATIONS.OWNER_CHANGE_EXECUTED_MSG,
|
|
||||||
afterExecutionError: NOTIFICATIONS.OWNER_CHANGE_FAILED_MSG,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const safeNameChangeNotificationsQueue: NotificationsQueue = {
|
const safeNameChangeNotificationsQueue: NotificationsQueue = {
|
||||||
beforeExecution: null,
|
beforeExecution: null,
|
||||||
pendingExecution: {
|
pendingExecution: null,
|
||||||
noMoreConfirmationsNeeded: null,
|
afterRejection: null,
|
||||||
|
afterExecution: {
|
||||||
|
noMoreConfirmationsNeeded: NOTIFICATIONS.SAFE_NAME_CHANGED_MSG,
|
||||||
moreConfirmationsNeeded: null,
|
moreConfirmationsNeeded: null,
|
||||||
},
|
},
|
||||||
afterRejection: null,
|
|
||||||
afterExecution: NOTIFICATIONS.SAFE_NAME_CHANGED_MSG,
|
|
||||||
afterExecutionError: null,
|
afterExecutionError: null,
|
||||||
}
|
}
|
||||||
|
|
||||||
const ownerNameChangeNotificationsQueue: NotificationsQueue = {
|
const ownerNameChangeNotificationsQueue: NotificationsQueue = {
|
||||||
beforeExecution: null,
|
beforeExecution: null,
|
||||||
pendingExecution: {
|
pendingExecution: null,
|
||||||
noMoreConfirmationsNeeded: null,
|
afterRejection: null,
|
||||||
|
afterExecution: {
|
||||||
|
noMoreConfirmationsNeeded: NOTIFICATIONS.OWNER_NAME_CHANGE_EXECUTED_MSG,
|
||||||
moreConfirmationsNeeded: null,
|
moreConfirmationsNeeded: null,
|
||||||
},
|
},
|
||||||
afterRejection: null,
|
|
||||||
afterExecution: NOTIFICATIONS.OWNER_NAME_CHANGE_EXECUTED_MSG,
|
|
||||||
afterExecutionError: null,
|
afterExecutionError: null,
|
||||||
}
|
}
|
||||||
|
|
||||||
const thresholdChangeTxNotificationsQueue: NotificationsQueue = {
|
const settingsChangeTxNotificationsQueue: NotificationsQueue = {
|
||||||
beforeExecution: NOTIFICATIONS.SIGN_THRESHOLD_CHANGE_MSG,
|
beforeExecution: NOTIFICATIONS.SIGN_SETTINGS_CHANGE_MSG,
|
||||||
pendingExecution: {
|
pendingExecution: NOTIFICATIONS.SETTINGS_CHANGE_PENDING_MSG,
|
||||||
noMoreConfirmationsNeeded: NOTIFICATIONS.THRESHOLD_CHANGE_PENDING_MSG,
|
afterRejection: NOTIFICATIONS.SETTINGS_CHANGE_REJECTED_MSG,
|
||||||
moreConfirmationsNeeded: NOTIFICATIONS.THRESHOLD_CHANGE_PENDING_MORE_CONFIRMATIONS_MSG,
|
afterExecution: {
|
||||||
|
noMoreConfirmationsNeeded: NOTIFICATIONS.SETTINGS_CHANGE_EXECUTED_MSG,
|
||||||
|
moreConfirmationsNeeded: NOTIFICATIONS.SETTINGS_CHANGE_EXECUTED_MORE_CONFIRMATIONS_MSG,
|
||||||
},
|
},
|
||||||
afterRejection: NOTIFICATIONS.THRESHOLD_CHANGE_REJECTED_MSG,
|
afterExecutionError: NOTIFICATIONS.SETTINGS_CHANGE_FAILED_MSG,
|
||||||
afterExecution: NOTIFICATIONS.THRESHOLD_CHANGE_EXECUTED_MSG,
|
|
||||||
afterExecutionError: NOTIFICATIONS.THRESHOLD_CHANGE_FAILED_MSG,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultNotificationsQueue: NotificationsQueue = {
|
const defaultNotificationsQueue: NotificationsQueue = {
|
||||||
beforeExecution: NOTIFICATIONS.SIGN_TX_MSG,
|
beforeExecution: NOTIFICATIONS.SIGN_TX_MSG,
|
||||||
pendingExecution: {
|
pendingExecution: NOTIFICATIONS.TX_PENDING_MSG,
|
||||||
noMoreConfirmationsNeeded: NOTIFICATIONS.TX_PENDING_MSG,
|
|
||||||
moreConfirmationsNeeded: NOTIFICATIONS.TX_PENDING_MORE_CONFIRMATIONS_MSG,
|
|
||||||
},
|
|
||||||
afterRejection: NOTIFICATIONS.TX_REJECTED_MSG,
|
afterRejection: NOTIFICATIONS.TX_REJECTED_MSG,
|
||||||
afterExecution: NOTIFICATIONS.TX_EXECUTED_MSG,
|
afterExecution: {
|
||||||
|
noMoreConfirmationsNeeded: NOTIFICATIONS.TX_EXECUTED_MSG,
|
||||||
|
moreConfirmationsNeeded: NOTIFICATIONS.TX_EXECUTED_MORE_CONFIRMATIONS_MSG,
|
||||||
|
},
|
||||||
afterExecutionError: NOTIFICATIONS.TX_FAILED_MSG,
|
afterExecutionError: NOTIFICATIONS.TX_FAILED_MSG,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,8 +111,8 @@ export const getNotificationsFromTxType = (txType: string) => {
|
||||||
notificationsQueue = cancellationTxNotificationsQueue
|
notificationsQueue = cancellationTxNotificationsQueue
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case TX_NOTIFICATION_TYPES.OWNER_CHANGE_TX: {
|
case TX_NOTIFICATION_TYPES.SETTINGS_CHANGE_TX: {
|
||||||
notificationsQueue = ownerChangeTxNotificationsQueue
|
notificationsQueue = settingsChangeTxNotificationsQueue
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case TX_NOTIFICATION_TYPES.SAFE_NAME_CHANGE_TX: {
|
case TX_NOTIFICATION_TYPES.SAFE_NAME_CHANGE_TX: {
|
||||||
|
@ -134,10 +123,6 @@ export const getNotificationsFromTxType = (txType: string) => {
|
||||||
notificationsQueue = ownerNameChangeNotificationsQueue
|
notificationsQueue = ownerNameChangeNotificationsQueue
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case TX_NOTIFICATION_TYPES.THRESHOLD_CHANGE_TX: {
|
|
||||||
notificationsQueue = thresholdChangeTxNotificationsQueue
|
|
||||||
break
|
|
||||||
}
|
|
||||||
default: {
|
default: {
|
||||||
notificationsQueue = defaultNotificationsQueue
|
notificationsQueue = defaultNotificationsQueue
|
||||||
break
|
break
|
||||||
|
@ -151,7 +136,7 @@ export const enhanceSnackbarForAction = (notification: Notification) => ({
|
||||||
...notification,
|
...notification,
|
||||||
options: {
|
options: {
|
||||||
...notification.options,
|
...notification.options,
|
||||||
action: (key) => (
|
action: (key: number) => (
|
||||||
<IconButton onClick={() => store.dispatch(closeSnackbarAction({ key }))}>
|
<IconButton onClick={() => store.dispatch(closeSnackbarAction({ key }))}>
|
||||||
<IconClose />
|
<IconClose />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|
|
@ -51,20 +51,11 @@ export type Notifications = {
|
||||||
OWNER_NAME_CHANGE_EXECUTED_MSG: Notification,
|
OWNER_NAME_CHANGE_EXECUTED_MSG: Notification,
|
||||||
|
|
||||||
// Owners
|
// Owners
|
||||||
SIGN_OWNER_CHANGE_MSG: Notification,
|
SIGN_SETTINGS_CHANGE_MSG: Notification,
|
||||||
OWNER_CHANGE_PENDING_MSG: Notification,
|
SETTINGS_CHANGE_PENDING_MSG: Notification,
|
||||||
OWNER_CHANGE_PENDING_MORE_CONFIRMATIONS_MSG: Notification,
|
SETTINGS_CHANGE_REJECTED_MSG: Notification,
|
||||||
OWNER_CHANGE_REJECTED_MSG: Notification,
|
SETTINGS_CHANGE_EXECUTED_MORE_CONFIRMATIONS_MSG: Notification,
|
||||||
OWNER_CHANGE_EXECUTED_MSG: Notification,
|
SETTINGS_CHANGE_FAILED_MSG: Notification,
|
||||||
OWNER_CHANGE_FAILED_MSG: Notification,
|
|
||||||
|
|
||||||
// Threshold
|
|
||||||
SIGN_THRESHOLD_CHANGE_MSG: Notification,
|
|
||||||
THRESHOLD_CHANGE_PENDING_MSG: Notification,
|
|
||||||
THRESHOLD_CHANGE_PENDING_MORE_CONFIRMATIONS_MSG: Notification,
|
|
||||||
THRESHOLD_CHANGE_REJECTED_MSG: Notification,
|
|
||||||
THRESHOLD_CHANGE_EXECUTED_MSG: Notification,
|
|
||||||
THRESHOLD_CHANGE_FAILED_MSG: Notification,
|
|
||||||
|
|
||||||
// Rinkeby version
|
// Rinkeby version
|
||||||
RINKEBY_VERSION_MSG: Notification,
|
RINKEBY_VERSION_MSG: Notification,
|
||||||
|
@ -159,7 +150,7 @@ export const NOTIFICATIONS: Notifications = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
SETTINGS_CHANGE_MSG: {
|
SIGN_SETTINGS_CHANGE_MSG: {
|
||||||
message: 'Please sign settings change',
|
message: 'Please sign settings change',
|
||||||
options: { variant: SUCCESS, persist: true },
|
options: { variant: SUCCESS, persist: true },
|
||||||
},
|
},
|
||||||
|
@ -167,53 +158,27 @@ export const NOTIFICATIONS: Notifications = {
|
||||||
message: 'Settings change pending',
|
message: 'Settings change pending',
|
||||||
options: { variant: INFO, persist: true },
|
options: { variant: INFO, persist: true },
|
||||||
},
|
},
|
||||||
SETTINGS_CHANGE_PENDING_MORE_CONFIRMATIONS_MSG: {
|
|
||||||
message: 'Owner change pending: More confirmations required to execute',
|
|
||||||
options: { variant: INFO, persist: true },
|
|
||||||
},
|
|
||||||
SETTINGS_CHANGE_REJECTED_MSG: {
|
SETTINGS_CHANGE_REJECTED_MSG: {
|
||||||
message: 'Owner change rejected',
|
message: 'Settings change rejected',
|
||||||
options: { variant: ERROR, persist: false, autoHideDuration: longDuration },
|
options: { variant: ERROR, persist: false, autoHideDuration: longDuration },
|
||||||
},
|
},
|
||||||
SETTINGS_CHANGE_EXECUTED_MSG: {
|
SETTINGS_CHANGE_EXECUTED_MSG: {
|
||||||
message: 'Owner change successfully executed',
|
message: 'Settings change successfully executed',
|
||||||
|
options: { variant: SUCCESS, persist: false, autoHideDuration: longDuration },
|
||||||
|
},
|
||||||
|
SETTINGS_CHANGE_EXECUTED_MORE_CONFIRMATIONS_MSG: {
|
||||||
|
message: 'Settings change successfully created. More confirmations needed to execute',
|
||||||
options: { variant: SUCCESS, persist: false, autoHideDuration: longDuration },
|
options: { variant: SUCCESS, persist: false, autoHideDuration: longDuration },
|
||||||
},
|
},
|
||||||
SETTINGS_CHANGE_FAILED_MSG: {
|
SETTINGS_CHANGE_FAILED_MSG: {
|
||||||
message: 'Owner change failed',
|
message: 'Settings change failed',
|
||||||
options: { variant: ERROR, persist: false, autoHideDuration: longDuration },
|
|
||||||
},
|
|
||||||
|
|
||||||
// Threshold
|
|
||||||
SIGN_THRESHOLD_CHANGE_MSG: {
|
|
||||||
message: 'Please sign the required confirmations change',
|
|
||||||
options: { variant: SUCCESS, persist: true },
|
|
||||||
},
|
|
||||||
THRESHOLD_CHANGE_PENDING_MSG: {
|
|
||||||
message: 'Required confirmations change pending',
|
|
||||||
options: { variant: INFO, persist: true },
|
|
||||||
},
|
|
||||||
THRESHOLD_CHANGE_PENDING_MORE_CONFIRMATIONS_MSG: {
|
|
||||||
message: 'Required confirmations change pending: More confirmations required to execute',
|
|
||||||
options: { variant: INFO, persist: true },
|
|
||||||
},
|
|
||||||
THRESHOLD_CHANGE_REJECTED_MSG: {
|
|
||||||
message: 'Required confirmations change rejected',
|
|
||||||
options: { variant: ERROR, persist: false, autoHideDuration: longDuration },
|
|
||||||
},
|
|
||||||
THRESHOLD_CHANGE_EXECUTED_MSG: {
|
|
||||||
message: 'Required confirmations change successfully executed',
|
|
||||||
options: { variant: SUCCESS, persist: false, autoHideDuration: longDuration },
|
|
||||||
},
|
|
||||||
THRESHOLD_CHANGE_FAILED_MSG: {
|
|
||||||
message: 'Required confirmations change failed',
|
|
||||||
options: { variant: ERROR, persist: false, autoHideDuration: longDuration },
|
options: { variant: ERROR, persist: false, autoHideDuration: longDuration },
|
||||||
},
|
},
|
||||||
|
|
||||||
// Network
|
// Network
|
||||||
RINKEBY_VERSION_MSG: {
|
RINKEBY_VERSION_MSG: {
|
||||||
message: "Rinkeby Version: Don't send Mainnet assets to this Safe",
|
message: "Rinkeby Version: Don't send Mainnet assets to this Safe",
|
||||||
options: { variant: INFO, persist: true, preventDuplicate: true },
|
options: { variant: WARNING, persist: true, preventDuplicate: true },
|
||||||
},
|
},
|
||||||
WRONG_NETWORK_MSG: {
|
WRONG_NETWORK_MSG: {
|
||||||
message: `Wrong network: Please use ${capitalize(getNetwork())}`,
|
message: `Wrong network: Please use ${capitalize(getNetwork())}`,
|
||||||
|
|
|
@ -4,18 +4,16 @@ export type NotifiedTransaction = {
|
||||||
STANDARD_TX: string,
|
STANDARD_TX: string,
|
||||||
CONFIRMATION_TX: string,
|
CONFIRMATION_TX: string,
|
||||||
CANCELLATION_TX: string,
|
CANCELLATION_TX: string,
|
||||||
OWNER_CHANGE_TX: string,
|
SETTINGS_CHANGE_TX: string,
|
||||||
SAFE_NAME_CHANGE_TX: string,
|
SAFE_NAME_CHANGE_TX: string,
|
||||||
OWNER_NAME_CHANGE_TX: string,
|
OWNER_NAME_CHANGE_TX: string,
|
||||||
THRESHOLD_CHANGE_TX: string,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const TX_NOTIFICATION_TYPES: NotifiedTransaction = {
|
export const TX_NOTIFICATION_TYPES: NotifiedTransaction = {
|
||||||
STANDARD_TX: 'STANDARD_TX',
|
STANDARD_TX: 'STANDARD_TX',
|
||||||
CONFIRMATION_TX: 'CONFIRMATION_TX',
|
CONFIRMATION_TX: 'CONFIRMATION_TX',
|
||||||
CANCELLATION_TX: 'CANCELLATION_TX',
|
CANCELLATION_TX: 'CANCELLATION_TX',
|
||||||
OWNER_CHANGE_TX: 'OWNER_CHANGE_TX',
|
SETTINGS_CHANGE_TX: 'SETTINGS_CHANGE_TX',
|
||||||
SAFE_NAME_CHANGE_TX: 'SAFE_NAME_CHANGE_TX',
|
SAFE_NAME_CHANGE_TX: 'SAFE_NAME_CHANGE_TX',
|
||||||
OWNER_NAME_CHANGE_TX: 'OWNER_NAME_CHANGE_TX',
|
OWNER_NAME_CHANGE_TX: 'OWNER_NAME_CHANGE_TX',
|
||||||
THRESHOLD_CHANGE_TX: 'THRESHOLD_CHANGE_TX',
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ export const sendAddOwner = async (
|
||||||
safeAddress,
|
safeAddress,
|
||||||
0,
|
0,
|
||||||
txData,
|
txData,
|
||||||
TX_NOTIFICATION_TYPES.OWNER_CHANGE_TX,
|
TX_NOTIFICATION_TYPES.SETTINGS_CHANGE_TX,
|
||||||
enqueueSnackbar,
|
enqueueSnackbar,
|
||||||
closeSnackbar,
|
closeSnackbar,
|
||||||
)
|
)
|
||||||
|
|
|
@ -64,7 +64,7 @@ export const sendRemoveOwner = async (
|
||||||
safeAddress,
|
safeAddress,
|
||||||
0,
|
0,
|
||||||
txData,
|
txData,
|
||||||
TX_NOTIFICATION_TYPES.OWNER_CHANGE_TX,
|
TX_NOTIFICATION_TYPES.SETTINGS_CHANGE_TX,
|
||||||
enqueueSnackbar,
|
enqueueSnackbar,
|
||||||
closeSnackbar,
|
closeSnackbar,
|
||||||
)
|
)
|
||||||
|
|
|
@ -60,7 +60,7 @@ export const sendReplaceOwner = async (
|
||||||
safeAddress,
|
safeAddress,
|
||||||
0,
|
0,
|
||||||
txData,
|
txData,
|
||||||
TX_NOTIFICATION_TYPES.OWNER_CHANGE_TX,
|
TX_NOTIFICATION_TYPES.SETTINGS_CHANGE_TX,
|
||||||
enqueueSnackbar,
|
enqueueSnackbar,
|
||||||
closeSnackbar,
|
closeSnackbar,
|
||||||
)
|
)
|
||||||
|
|
|
@ -52,7 +52,7 @@ const ThresholdSettings = ({
|
||||||
safeAddress,
|
safeAddress,
|
||||||
0,
|
0,
|
||||||
txData,
|
txData,
|
||||||
TX_NOTIFICATION_TYPES.THRESHOLD_CHANGE_TX,
|
TX_NOTIFICATION_TYPES.SETTINGS_CHANGE_TX,
|
||||||
enqueueSnackbar,
|
enqueueSnackbar,
|
||||||
closeSnackbar,
|
closeSnackbar,
|
||||||
)
|
)
|
||||||
|
|
|
@ -16,7 +16,6 @@ import {
|
||||||
saveTxToHistory,
|
saveTxToHistory,
|
||||||
} from '~/logic/safe/transactions'
|
} from '~/logic/safe/transactions'
|
||||||
import {
|
import {
|
||||||
type Notification,
|
|
||||||
type NotificationsQueue,
|
type NotificationsQueue,
|
||||||
getNotificationsFromTxType,
|
getNotificationsFromTxType,
|
||||||
showSnackbar,
|
showSnackbar,
|
||||||
|
@ -75,16 +74,8 @@ const createTransaction = (
|
||||||
.once('transactionHash', async (hash) => {
|
.once('transactionHash', async (hash) => {
|
||||||
txHash = hash
|
txHash = hash
|
||||||
closeSnackbar(beforeExecutionKey)
|
closeSnackbar(beforeExecutionKey)
|
||||||
const pendingExecutionNotification: Notification = isExecution
|
|
||||||
? {
|
pendingExecutionKey = showSnackbar(notificationsQueue.pendingExecution, enqueueSnackbar, closeSnackbar)
|
||||||
message: notificationsQueue.pendingExecution.noMoreConfirmationsNeeded.message,
|
|
||||||
options: notificationsQueue.pendingExecution.noMoreConfirmationsNeeded.options,
|
|
||||||
}
|
|
||||||
: {
|
|
||||||
message: notificationsQueue.pendingExecution.moreConfirmationsNeeded.message,
|
|
||||||
options: notificationsQueue.pendingExecution.moreConfirmationsNeeded.options,
|
|
||||||
}
|
|
||||||
pendingExecutionKey = showSnackbar(pendingExecutionNotification, enqueueSnackbar, closeSnackbar)
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await saveTxToHistory(
|
await saveTxToHistory(
|
||||||
|
@ -109,7 +100,13 @@ const createTransaction = (
|
||||||
closeSnackbar(pendingExecutionKey)
|
closeSnackbar(pendingExecutionKey)
|
||||||
|
|
||||||
if (isExecution) {
|
if (isExecution) {
|
||||||
showSnackbar(notificationsQueue.afterExecution, enqueueSnackbar, closeSnackbar)
|
showSnackbar(
|
||||||
|
isExecution
|
||||||
|
? notificationsQueue.afterExecution.noMoreConfirmationsNeeded
|
||||||
|
: notificationsQueue.afterExecution.moreConfirmationsNeeded,
|
||||||
|
enqueueSnackbar,
|
||||||
|
closeSnackbar,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
dispatch(fetchTransactions(safeAddress))
|
dispatch(fetchTransactions(safeAddress))
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@ import {
|
||||||
TX_TYPE_CONFIRMATION,
|
TX_TYPE_CONFIRMATION,
|
||||||
} from '~/logic/safe/transactions'
|
} from '~/logic/safe/transactions'
|
||||||
import {
|
import {
|
||||||
type Notification,
|
|
||||||
type NotificationsQueue,
|
type NotificationsQueue,
|
||||||
getNotificationsFromTxType,
|
getNotificationsFromTxType,
|
||||||
showSnackbar,
|
showSnackbar,
|
||||||
|
@ -107,11 +106,8 @@ const processTransaction = (
|
||||||
.once('transactionHash', async (hash) => {
|
.once('transactionHash', async (hash) => {
|
||||||
txHash = hash
|
txHash = hash
|
||||||
closeSnackbar(beforeExecutionKey)
|
closeSnackbar(beforeExecutionKey)
|
||||||
const notification: Notification = {
|
|
||||||
message: notificationsQueue.pendingExecution.noMoreConfirmationsNeeded.message,
|
pendingExecutionKey = showSnackbar(notificationsQueue.pendingExecution, enqueueSnackbar, closeSnackbar)
|
||||||
options: notificationsQueue.pendingExecution.noMoreConfirmationsNeeded.options,
|
|
||||||
}
|
|
||||||
pendingExecutionKey = showSnackbar(notification, enqueueSnackbar, closeSnackbar)
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await saveTxToHistory(
|
await saveTxToHistory(
|
||||||
|
@ -135,7 +131,13 @@ const processTransaction = (
|
||||||
.then((receipt) => {
|
.then((receipt) => {
|
||||||
closeSnackbar(pendingExecutionKey)
|
closeSnackbar(pendingExecutionKey)
|
||||||
|
|
||||||
showSnackbar(notificationsQueue.afterExecution, enqueueSnackbar, closeSnackbar)
|
showSnackbar(
|
||||||
|
shouldExecute
|
||||||
|
? notificationsQueue.afterExecution.noMoreConfirmationsNeeded
|
||||||
|
: notificationsQueue.afterExecution.moreConfirmationsNeeded,
|
||||||
|
enqueueSnackbar,
|
||||||
|
closeSnackbar,
|
||||||
|
)
|
||||||
dispatch(fetchTransactions(safeAddress))
|
dispatch(fetchTransactions(safeAddress))
|
||||||
|
|
||||||
return receipt.transactionHash
|
return receipt.transactionHash
|
||||||
|
|
Loading…
Reference in New Issue