Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Commit

Permalink
send tx to service only after it was mined
Browse files Browse the repository at this point in the history
  • Loading branch information
mmv08 committed Nov 14, 2019
1 parent f25f9fb commit eb0584f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions src/routes/safe/store/actions/createTransaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ const createTransaction = (
closeSnackbar(beforeExecutionKey)

pendingExecutionKey = showSnackbar(notificationsQueue.pendingExecution, enqueueSnackbar, closeSnackbar)
})
.on('error', (error) => {
console.error('Tx error: ', error)
})
.then(async (receipt) => {
closeSnackbar(pendingExecutionKey)

try {
await saveTxToHistory(
Expand All @@ -88,12 +94,6 @@ const createTransaction = (
} catch (err) {
console.error(err)
}
})
.on('error', (error) => {
console.error('Tx error: ', error)
})
.then((receipt) => {
closeSnackbar(pendingExecutionKey)

showSnackbar(
isExecution
Expand Down
14 changes: 7 additions & 7 deletions src/routes/safe/store/actions/processTransaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,17 @@ const processTransaction = (

await transaction
.send(sendParams)
.once('transactionHash', async (hash) => {
.once('transactionHash', (hash) => {
txHash = hash
closeSnackbar(beforeExecutionKey)

pendingExecutionKey = showSnackbar(notificationsQueue.pendingExecution, enqueueSnackbar, closeSnackbar)
})
.on('error', (error) => {
console.error('Processing transaction error: ', error)
})
.then(async (receipt) => {
closeSnackbar(pendingExecutionKey)

try {
await saveTxToHistory(
Expand All @@ -124,12 +130,6 @@ const processTransaction = (
} catch (err) {
console.error(err)
}
})
.on('error', (error) => {
console.error('Processing transaction error: ', error)
})
.then((receipt) => {
closeSnackbar(pendingExecutionKey)

showSnackbar(
shouldExecute
Expand Down

0 comments on commit eb0584f

Please sign in to comment.