-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c7ebdc3
commit 4e83f2f
Showing
1 changed file
with
14 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ import { successSvg } from '../../internal/svg/successSvg'; | |
import { getChainExplorer } from '../../network/getChainExplorer'; | ||
import { cn, color, text } from '../../styles/theme'; | ||
import { useTransactionContext } from '../components/TransactionProvider'; | ||
import { useShowCallsStatus } from 'wagmi/experimental'; | ||
|
||
export function useGetTransactionToast() { | ||
const { | ||
|
@@ -22,6 +23,8 @@ export function useGetTransactionToast() { | |
|
||
const isInProgress = isLoading || !!transactionId || !!transactionHash; | ||
|
||
const { showCallsStatus } = useShowCallsStatus(); | ||
Check failure on line 26 in src/transaction/hooks/useGetTransactionToast.tsx GitHub Actions / build (18.x)src/transaction/hooks/useGetTransactionToast.test.tsx > useGetTransactionToast > should return correct toast and actionElement when transaction is loading
Check failure on line 26 in src/transaction/hooks/useGetTransactionToast.tsx GitHub Actions / build (18.x)src/transaction/hooks/useGetTransactionToast.test.tsx > useGetTransactionToast > should return correct toast and actionElement when receipt exists
|
||
|
||
return useMemo(() => { | ||
const chainExplorer = getChainExplorer(accountChainId); | ||
|
||
|
@@ -33,6 +36,7 @@ export function useGetTransactionToast() { | |
icon = <Spinner className="px-1.5 py-1.5" />; | ||
label = 'Transaction in progress'; | ||
} | ||
// EOA will have txn hash | ||
if (transactionHash) { | ||
actionElement = ( | ||
<a | ||
|
@@ -46,6 +50,16 @@ export function useGetTransactionToast() { | |
</a> | ||
); | ||
} | ||
// SW will have txn id | ||
if (transactionId) { | ||
actionElement = ( | ||
<button onClick={() => showCallsStatus({ id: transactionId })}> | ||
<span className={cn(text.label1, color.primary)}> | ||
View transaction | ||
</span> | ||
</button> | ||
); | ||
} | ||
if (receipt) { | ||
icon = successSvg; | ||
label = 'Successful'; | ||
|