Skip to content

Commit

Permalink
Add transactions in ConnectWalletModal component
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcoderistov committed Oct 18, 2022
1 parent 95c89d9 commit d0006f5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/components/ConnectWalletModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import ErrorView from './ErrorView'
import AccountView from './AccountView'
import TermsView from './TermsView'
import AppContext from '../../context'
import { Transaction } from '../../types'
import { getChainExplorerUrl } from '../../utils'


interface ConnectWalletModalProps {
Expand All @@ -22,6 +24,7 @@ export default function ConnectWalletModal (props: ConnectWalletModalProps) {
setSelectedAccount,
connectedTo,
setConnectedTo,
transactions,
metamask
} = useContext(AppContext)

Expand Down Expand Up @@ -115,6 +118,13 @@ export default function ConnectWalletModal (props: ConnectWalletModalProps) {
setIsActionable(true)
}

const handleTransactionClick = (transaction: Transaction) => {
const baseUrl = getChainExplorerUrl(transaction.chainId)
if (baseUrl) {
window.open(`${baseUrl}/tx/${transaction.hash}`)
}
}

return (
<Dialog
open={props.open}
Expand All @@ -140,6 +150,8 @@ export default function ConnectWalletModal (props: ConnectWalletModalProps) {
{ isAccountView && selectedAccount ? (
<AccountView
address={selectedAccount}
transactions={transactions}
onTransactionClick={handleTransactionClick}
onDisconnect={handleDisconnectWallet}
onChange={handleChangeWallet}
/>
Expand Down

0 comments on commit d0006f5

Please sign in to comment.