Skip to content

Commit d0006f5

Browse files
Add transactions in ConnectWalletModal component
1 parent 95c89d9 commit d0006f5

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/components/ConnectWalletModal/index.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import ErrorView from './ErrorView'
77
import AccountView from './AccountView'
88
import TermsView from './TermsView'
99
import AppContext from '../../context'
10+
import { Transaction } from '../../types'
11+
import { getChainExplorerUrl } from '../../utils'
1012

1113

1214
interface ConnectWalletModalProps {
@@ -22,6 +24,7 @@ export default function ConnectWalletModal (props: ConnectWalletModalProps) {
2224
setSelectedAccount,
2325
connectedTo,
2426
setConnectedTo,
27+
transactions,
2528
metamask
2629
} = useContext(AppContext)
2730

@@ -115,6 +118,13 @@ export default function ConnectWalletModal (props: ConnectWalletModalProps) {
115118
setIsActionable(true)
116119
}
117120

121+
const handleTransactionClick = (transaction: Transaction) => {
122+
const baseUrl = getChainExplorerUrl(transaction.chainId)
123+
if (baseUrl) {
124+
window.open(`${baseUrl}/tx/${transaction.hash}`)
125+
}
126+
}
127+
118128
return (
119129
<Dialog
120130
open={props.open}
@@ -140,6 +150,8 @@ export default function ConnectWalletModal (props: ConnectWalletModalProps) {
140150
{ isAccountView && selectedAccount ? (
141151
<AccountView
142152
address={selectedAccount}
153+
transactions={transactions}
154+
onTransactionClick={handleTransactionClick}
143155
onDisconnect={handleDisconnectWallet}
144156
onChange={handleChangeWallet}
145157
/>

0 commit comments

Comments
 (0)