Skip to content

Commit

Permalink
fix: show error for reverted txs
Browse files Browse the repository at this point in the history
  • Loading branch information
schmanu committed Jul 25, 2023
1 parent 4afb12f commit 07b9a6e
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/components/tx-flow/flows/SuccessScreen/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,19 @@ export const SuccessScreen = ({ txId }: { txId: string }) => {
}, [txHash])

useEffect(() => {
const unsubscribe = txSubscribe(TxEvent.FAILED, (detail) => {
if (detail.txId === txId) setError(detail.error)
})
const unsubFns: Array<() => void> = []
unsubFns.push(
txSubscribe(TxEvent.FAILED, (detail) => {
if (detail.txId === txId) setError(detail.error)
}),
)
unsubFns.push(
txSubscribe(TxEvent.REVERTED, (detail) => {
if (detail.txId === txId) setError(detail.error)
}),
)

return unsubscribe
return () => unsubFns.forEach((unsubscribe) => unsubscribe())
}, [txId])

const homeLink: UrlObject = {
Expand Down

0 comments on commit 07b9a6e

Please sign in to comment.