Skip to content

Commit

Permalink
Merge pull request #205 from G7DAO/feat/network-toggle
Browse files Browse the repository at this point in the history
Feat/network toggle
  • Loading branch information
elclandestin0 authored Nov 25, 2024
2 parents 8ada142 + 700146b commit 6ef6ba4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ import { useBridgeTransfer } from '@/hooks/useBridgeTransfer'
import { useDepositStatus } from '@/hooks/useL2ToL1MessageStatus'
import { TransactionRecord } from '@/utils/bridge/depositERC20ArbitrumSDK'
import { ETA, timeAgo } from '@/utils/timeFormat'
import { getTokensForNetwork } from '@/utils/tokens'
import { getBlockExplorerUrl } from '@/utils/web3utils'

interface DepositProps {
deposit: TransactionRecord
}
const Deposit: React.FC<DepositProps> = ({ deposit }) => {
const { connectedAccount, selectedNetworkType } = useBlockchainContext()
const { selectedNetworkType } = useBlockchainContext()
const smallView = useMediaQuery('(max-width: 1199px)')
const depositInfo = {
from: getLowNetworks(selectedNetworkType)?.find((n) => n.chainId === deposit.lowNetworkChainId)?.displayName ?? '',
Expand All @@ -30,9 +29,6 @@ const Deposit: React.FC<DepositProps> = ({ deposit }) => {
const { returnTransferData, getTransactionInputs } = useBridgeTransfer()
const { data: transferStatus, isLoading } = returnTransferData({ txRecord: deposit })
const { data: transactionInputs } = getTransactionInputs({ txRecord: deposit })
const tokenInformation = getTokensForNetwork(deposit?.lowNetworkChainId, connectedAccount).find(
(token) => token.address === transactionInputs?.tokenOriginAddress
)

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { NetworkInterface, useBlockchainContext } from '@/contexts/BlockchainCon
import { useBridgeTransfer } from '@/hooks/useBridgeTransfer'
import { TransactionRecord } from '@/utils/bridge/depositERC20ArbitrumSDK'
import { ETA, timeAgo } from '@/utils/timeFormat'
import { getTokensForNetwork } from '@/utils/tokens'
import { getBlockExplorerUrl } from '@/utils/web3utils'
import { ChildToParentMessageStatus } from '@arbitrum/sdk'
import { useMediaQuery } from '@mantine/hooks'
Expand Down Expand Up @@ -54,7 +53,7 @@ export const getStatus = (
}
}
const Withdrawal: React.FC<WithdrawalProps> = ({ withdrawal }) => {
const { connectedAccount, selectedNetworkType } = useBlockchainContext()
const { selectedNetworkType } = useBlockchainContext()
const smallView = useMediaQuery('(max-width: 1199px)')
const { claim, returnTransferData, getTransactionInputs } = useBridgeTransfer()
const [collapseExecuted, setCollapseExecuted] = useState(false)
Expand All @@ -65,9 +64,6 @@ const Withdrawal: React.FC<WithdrawalProps> = ({ withdrawal }) => {
const { data: transferStatus, isLoading } = returnTransferData({ txRecord: withdrawal })

const { data: transactionInputs } = getTransactionInputs({ txRecord: withdrawal })
const tokenInformation = getTokensForNetwork(withdrawal?.highNetworkChainId, connectedAccount).find(
(token) => token.address === transactionInputs?.tokenAddress
)

return (
<>
Expand Down Expand Up @@ -97,7 +93,7 @@ const Withdrawal: React.FC<WithdrawalProps> = ({ withdrawal }) => {
<div className={styles.gridItem}>{timeAgo(withdrawal.highNetworkTimestamp)}</div>
<div
className={styles.gridItem}
>{`${tokenInformation?.decimals ? Number(withdrawal.amount) / tokenInformation?.decimals : withdrawal.amount} ${transactionInputs?.tokenSymbol}`}</div>
>{`${transactionInputs?.tokenSymbol === 'USDC' ? ethers.utils.formatUnits(transactionInputs?.amount, 6) : withdrawal.amount} ${transactionInputs?.tokenSymbol}`}</div>
<div className={styles.gridItem}>{status?.data?.from ?? ''}</div>
<div className={styles.gridItem}>{status?.data?.to ?? ''}</div>
<div className={styles.gridItem}>
Expand Down Expand Up @@ -215,7 +211,7 @@ const Withdrawal: React.FC<WithdrawalProps> = ({ withdrawal }) => {
<div className={styles.gridItemInitiate}>{timeAgo(withdrawal?.highNetworkTimestamp)}</div>
<div
className={styles.gridItemInitiate}
>{`${tokenInformation?.decimals ? Number(withdrawal.amount) / tokenInformation?.decimals : withdrawal.amount} ${transactionInputs?.tokenSymbol}`}</div>
>{`${transactionInputs?.tokenSymbol === 'USDC' ? ethers.utils.formatUnits(transactionInputs?.amount, 6) : withdrawal.amount} ${transactionInputs?.tokenSymbol}`}</div>
<div className={styles.gridItemInitiate}>{status?.data?.from ?? ''}</div>
<div className={styles.gridItemInitiate}>{status?.data?.to ?? ''}</div>
<div className={styles.gridItemInitiate}>
Expand All @@ -239,7 +235,7 @@ const Withdrawal: React.FC<WithdrawalProps> = ({ withdrawal }) => {
<div className={styles.gridItemInitiate}>{timeAgo(withdrawal?.completionTimestamp)}</div>
<div
className={styles.gridItemInitiate}
>{`${tokenInformation?.decimals ? Number(withdrawal.amount) / tokenInformation?.decimals : withdrawal.amount} ${transactionInputs?.tokenSymbol}`}</div>
>{`${transactionInputs?.tokenSymbol === 'USDC' ? ethers.utils.formatUnits(transactionInputs?.amount, 6) : withdrawal.amount} ${transactionInputs?.tokenSymbol}`}</div>
<div className={styles.gridItemInitiate}>{status?.data?.from ?? ''}</div>
<div className={styles.gridItemInitiate}>{status?.data?.to ?? ''}</div>
<div className={styles.gridItemInitiate}>
Expand Down Expand Up @@ -272,7 +268,7 @@ const Withdrawal: React.FC<WithdrawalProps> = ({ withdrawal }) => {
<div className={styles.gridItem}>{timeAgo(status?.data?.timestamp)}</div>
<div
className={styles.gridItem}
>{`${tokenInformation?.decimals ? Number(withdrawal.amount) / tokenInformation?.decimals : withdrawal.amount} ${transactionInputs?.tokenSymbol}`}</div>
>{`${transactionInputs?.tokenSymbol === 'USDC' ? ethers.utils.formatUnits(transactionInputs?.amount, 6) : withdrawal.amount} ${transactionInputs?.tokenSymbol}`}</div>
<div className={styles.gridItem}>{status?.data?.from ?? ''}</div>
<div className={styles.gridItem}>{status?.data?.to ?? ''}</div>
{transferStatus && transferStatus?.status === ChildToParentMessageStatus.CONFIRMED && (
Expand Down

0 comments on commit 6ef6ba4

Please sign in to comment.