diff --git a/webapps/world-builder-dashboard/constants.ts b/webapps/world-builder-dashboard/constants.ts index 5802a49d..e3a262c0 100644 --- a/webapps/world-builder-dashboard/constants.ts +++ b/webapps/world-builder-dashboard/constants.ts @@ -81,7 +81,6 @@ export const L2_MAIN_NETWORK: NetworkInterface = { symbol: 'ETH' }, g7TokenAddress: '0xF18e4466F26B4cA55bbAb890b314a54976E45B17', - routerSpender: '0x902b3e5f8f19571859f4ab1003b960a5df693aff', retryableCreationTimeout: 15 * 60 } @@ -97,7 +96,6 @@ export const L3_MAIN_NETWORK: NetworkInterface = { symbol: 'G7T' }, g7TokenAddress: '0x0000000000000000000000000000000000000000', - routerSpender: '0x902b3e5f8f19571859f4ab1003b960a5df693aff', retryableCreationTimeout: 15 * 60, wrappedG7TokenAddress: '0xfa3ed70386b9255fC04aA008A8ad1B0CDa816Fac' } @@ -128,8 +126,6 @@ export const FIVE_MINUTES = 1000 * 60 * 5 export const DEFAULT_STAKE_NATIVE_POOL_ID = '1' -export const MAX_ALLOWANCE_ACCOUNT = '0x9ed191DB1829371F116Deb9748c26B49467a592A' - export const TG7T: TokenAddressMap = { 13746: '0x0000000000000000000000000000000000000000', 421614: '0x10adbf84548f923577be12146eac104c899d1e75', @@ -143,7 +139,7 @@ export const ETH: TokenAddressMap = { export const USDC: TokenAddressMap = { 13746: '0xf2B58E3519C5b977a254993A4A6EaD581A8989A0', - 421614: '0x119f0E6303BEc7021B295EcaB27A4a1A5b37ECf0', + 421614: '0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d', 11155111: '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238' } diff --git a/webapps/world-builder-dashboard/src/assets/IconTokenNoSymbol.tsx b/webapps/world-builder-dashboard/src/assets/IconTokenNoSymbol.tsx index f839c71d..af6cbcad 100644 --- a/webapps/world-builder-dashboard/src/assets/IconTokenNoSymbol.tsx +++ b/webapps/world-builder-dashboard/src/assets/IconTokenNoSymbol.tsx @@ -1,6 +1,6 @@ import React from 'react' -const IconTokenNoSynbol: React.FC> = () => ( +const IconTokenNoSymbol: React.FC> = () => ( > = () => ( ) -export default IconTokenNoSynbol +export default IconTokenNoSymbol diff --git a/webapps/world-builder-dashboard/src/components/bridge/bridge/ActionButton.tsx b/webapps/world-builder-dashboard/src/components/bridge/bridge/ActionButton.tsx index ebd9a528..3260d3cb 100644 --- a/webapps/world-builder-dashboard/src/components/bridge/bridge/ActionButton.tsx +++ b/webapps/world-builder-dashboard/src/components/bridge/bridge/ActionButton.tsx @@ -114,7 +114,10 @@ const ActionButton: React.FC = ({ completionTimestamp: Date.now() / 1000, newTransaction: true, symbol: symbol, - status: BridgeTransferStatus.DEPOSIT_GAS_PENDING + status: + selectedBridgeToken.address === ZERO_ADDRESS + ? BridgeTransferStatus.DEPOSIT_GAS_PENDING + : BridgeTransferStatus.DEPOSIT_ERC20_NOT_YET_CREATED } } else { const tx = await bridger?.transfer({ amount: amountToSend, signer, destinationProvider }) diff --git a/webapps/world-builder-dashboard/src/components/bridge/bridge/BridgeView.tsx b/webapps/world-builder-dashboard/src/components/bridge/bridge/BridgeView.tsx index 7dd7911b..f16ac260 100644 --- a/webapps/world-builder-dashboard/src/components/bridge/bridge/BridgeView.tsx +++ b/webapps/world-builder-dashboard/src/components/bridge/bridge/BridgeView.tsx @@ -30,7 +30,7 @@ import { useCoinGeckoAPI } from '@/hooks/useCoinGeckoAPI' // Hooks and Constants import { DepositDirection } from '@/pages/BridgePage/BridgePage' import { getStakeNativeTxData } from '@/utils/bridge/stakeContractInfo' -import { Token } from '@/utils/tokens' +import { getTokensForNetwork, Token } from '@/utils/tokens' const BridgeView = ({ direction, @@ -56,13 +56,19 @@ const BridgeView = ({ setSelectedHighNetwork, setSelectedBridgeToken, selectedBridgeToken, - selectedNetworkType + selectedNetworkType, + setSelectedNativeToken, + selectedNativeToken } = useBlockchainContext() const { isFetching: isFetchingTokenInformation, data: tokenInformation } = useTokenInformation({ account: connectedAccount, token: selectedBridgeToken }) + const { data: nativeTokenInformation } = useTokenInformation({ + account: connectedAccount, + token: selectedNativeToken + }) const { data: coinUSDRate, isFetching: isCoinFetching } = useUSDPriceOfToken(selectedBridgeToken.geckoId ?? '') const handleTokenChange = async (token: Token) => { @@ -126,6 +132,20 @@ const BridgeView = ({ return } try { + if (direction === 'DEPOSIT') { + const token = + getTokensForNetwork(selectedLowNetwork.chainId, connectedAccount).find( + (token) => token.symbol === selectedLowNetwork.nativeCurrency?.symbol + ) ?? null + setSelectedNativeToken(token) + } else if (direction === 'WITHDRAW') { + const token = + getTokensForNetwork(selectedLowNetwork.chainId, connectedAccount).find( + (token) => token.symbol === selectedLowNetwork.nativeCurrency?.symbol + ) ?? null + + setSelectedNativeToken(token) + } const _bridger: Bridger = new Bridger(originChainId, destinationChainId, selectedBridgeToken.tokenAddressMap) setBridger(_bridger) } catch (e) { @@ -252,8 +272,8 @@ const BridgeView = ({ )} diff --git a/webapps/world-builder-dashboard/src/components/bridge/bridge/TransactionSummary.tsx b/webapps/world-builder-dashboard/src/components/bridge/bridge/TransactionSummary.tsx index 2f97335e..a8d20857 100644 --- a/webapps/world-builder-dashboard/src/components/bridge/bridge/TransactionSummary.tsx +++ b/webapps/world-builder-dashboard/src/components/bridge/bridge/TransactionSummary.tsx @@ -20,16 +20,16 @@ interface TransactionSummaryProps { fee: number isEstimatingFee: boolean value: number - gasBalance: number + nativeBalance: number ethRate: number tokenSymbol: string - gasTokenSymbol: string + nativeTokenSymbol: string tokenRate: number direction: 'DEPOSIT' | 'WITHDRAW' } const TransactionSummary: React.FC = ({ direction, - gasBalance, + nativeBalance, address, transferTime, fee, @@ -37,7 +37,7 @@ const TransactionSummary: React.FC = ({ ethRate, tokenRate, tokenSymbol, - gasTokenSymbol, + nativeTokenSymbol, value }) => { const clipboard = useClipboard({ timeout: 700 }) @@ -87,8 +87,8 @@ const TransactionSummary: React.FC = ({
{`${fee.toFixed(18).replace(/\.?0+$/, '')} ${gasTokenSymbol}`}
+ title={`Balance: ${String(nativeBalance)} ${nativeTokenSymbol}`} + >{`${fee.toFixed(18).replace(/\.?0+$/, '')} ${nativeTokenSymbol}`}
{!!(fee * (direction === 'DEPOSIT' ? ethRate : tokenRate)) && (
{formatCurrency(fee * (direction === 'DEPOSIT' ? ethRate : tokenRate))} diff --git a/webapps/world-builder-dashboard/src/components/bridge/bridge/ValueToBridge.tsx b/webapps/world-builder-dashboard/src/components/bridge/bridge/ValueToBridge.tsx index 7e8ad4a2..02ea5dde 100644 --- a/webapps/world-builder-dashboard/src/components/bridge/bridge/ValueToBridge.tsx +++ b/webapps/world-builder-dashboard/src/components/bridge/bridge/ValueToBridge.tsx @@ -43,7 +43,7 @@ const ValueToBridge: React.FC = ({ const [tokens, setTokens] = useState([]) const { connectedAccount, selectedBridgeToken, selectedHighNetwork, selectedLowNetwork } = useBlockchainContext() - const getTokens = async () => { + const getTokens = () => { const highNetworkChainId = String(selectedHighNetwork.chainId) const lowNetworkChainId = String(selectedLowNetwork.chainId) const _tokens = getTokensForNetwork(selectedChainId, connectedAccount) diff --git a/webapps/world-builder-dashboard/src/components/bridge/history/Deposit.tsx b/webapps/world-builder-dashboard/src/components/bridge/history/Deposit.tsx index 9da36271..43a4a3b1 100644 --- a/webapps/world-builder-dashboard/src/components/bridge/history/Deposit.tsx +++ b/webapps/world-builder-dashboard/src/components/bridge/history/Deposit.tsx @@ -1,5 +1,5 @@ -import React, { useEffect, useState } from 'react' -import { getHighNetworks, getLowNetworks, getNetworks } from '../../../../constants' +import React from 'react' +import { getHighNetworks, getLowNetworks } from '../../../../constants' import DepositMobile from './DepositMobile' import styles from './WithdrawTransactions.module.css' import { ethers } from 'ethers' @@ -11,70 +11,24 @@ import { useBlockchainContext } from '@/contexts/BlockchainContext' import { useBridgeTransfer } from '@/hooks/useBridgeTransfer' import { TransactionRecord } from '@/utils/bridge/depositERC20ArbitrumSDK' import { ETA, timeAgo } from '@/utils/timeFormat' -import { fetchTransactionTimestamp, getBlockExplorerUrl, getCachedTransactions } from '@/utils/web3utils' +import { getBlockExplorerUrl } from '@/utils/web3utils' interface DepositProps { deposit: TransactionRecord } const Deposit: React.FC = ({ deposit }) => { - const { selectedNetworkType, connectedAccount } = useBlockchainContext() + const { selectedNetworkType } = useBlockchainContext() const smallView = useMediaQuery('(max-width: 1199px)') const depositInfo = { from: getLowNetworks(selectedNetworkType)?.find((n) => n.chainId === deposit.lowNetworkChainId)?.displayName ?? '', to: getHighNetworks(selectedNetworkType)?.find((n) => n.chainId === deposit.highNetworkChainId)?.displayName ?? '' } - const { returnTransferData, getTransactionInputs } = useBridgeTransfer() + const { returnTransferData, getTransactionInputs, getHighNetworkTimestamp } = useBridgeTransfer() const { data: transferStatus, isLoading } = returnTransferData({ txRecord: deposit }) const { data: transactionInputs } = getTransactionInputs({ txRecord: deposit }) - const [highNetworkTimestamp, setHighNetworkTimestamp] = useState(0) - - useEffect(() => { - const fetchTimestamp = async () => { - if (deposit) { - const transactions = getCachedTransactions(connectedAccount ?? '', selectedNetworkType) - - const cachedTransaction = transactions.find((t: any) => t.lowNetworkHash === deposit.lowNetworkHash) - - if (cachedTransaction && cachedTransaction.highNetworkTimestamp) { - setHighNetworkTimestamp(cachedTransaction.highNetworkTimestamp) - return - } - - const destinationRpc = getNetworks(selectedNetworkType)?.find((n) => n.chainId === deposit.highNetworkChainId) - ?.rpcs[0] - if (transferStatus?.completionTxHash) { - try { - const timestamp = await fetchTransactionTimestamp(transferStatus.completionTxHash, destinationRpc ?? '') - if (timestamp) { - setHighNetworkTimestamp(timestamp) - const updatedTransactions = transactions.map((t: any) => { - const isSameHash = t.lowNetworkHash === deposit.lowNetworkHash - return isSameHash ? { ...t, highNetworkTimestamp: timestamp, lastUpdated: Date.now() } : t - }) - - localStorage.setItem( - `bridge-${connectedAccount}-transactions-${selectedNetworkType}`, - JSON.stringify(updatedTransactions) - ) - } - } catch (error) { - console.error('Error fetching timestamp:', error) - - if (cachedTransaction && cachedTransaction.highNetworkTimestamp) { - setHighNetworkTimestamp(cachedTransaction.highNetworkTimestamp) - } - } - } else { - console.log('No completion transaction hash found') - } - } - } - - fetchTimestamp() - }, [transferStatus?.completionTxHash]) - + const { data: highNetworkTimestamp } = getHighNetworkTimestamp({ txRecord: deposit, transferStatus: transferStatus }) return ( <> {isLoading && smallView ? ( diff --git a/webapps/world-builder-dashboard/src/components/bridge/history/HistoryDesktop.tsx b/webapps/world-builder-dashboard/src/components/bridge/history/HistoryDesktop.tsx index 82214ff9..2e8d0098 100644 --- a/webapps/world-builder-dashboard/src/components/bridge/history/HistoryDesktop.tsx +++ b/webapps/world-builder-dashboard/src/components/bridge/history/HistoryDesktop.tsx @@ -77,24 +77,20 @@ const HistoryDesktop: React.FC = () => { const formattedApiTransactions = apiTransactions ? apiTransactions.map(mapAPIDataToTransactionRecord) : [] const combinedTransactions = mergeTransactions(formattedApiTransactions, localTransactions) // Retrieve existing transactions from localStorage - const storedTransactionsString = localStorage.getItem( - `bridge-${connectedAccount}-transactions-${selectedNetworkType}` - ) - const storedTransactions = storedTransactionsString ? JSON.parse(storedTransactionsString) : [] - + // Check if the combined transactions are different from those in localStorage if ( - combinedTransactions.length !== storedTransactions.length || + combinedTransactions.length !== localTransactions.length || !combinedTransactions.every((tx, index) => tx.type === 'DEPOSIT' - ? tx.lowNetworkHash === storedTransactions[index]?.lowNetworkHash - : tx.highNetworkHash === storedTransactions[index]?.highNetworkHash + ? tx.lowNetworkHash === localTransactions[index]?.lowNetworkHash + : tx.highNetworkHash === localTransactions[index]?.highNetworkHash ) ) { // Determine new transactions that aren’t in storedTransactions const newTransactions = combinedTransactions.filter( (newTx) => - !storedTransactions.some((storedTx: TransactionRecord) => + !localTransactions.some((storedTx: TransactionRecord) => storedTx.type === 'DEPOSIT' ? storedTx.lowNetworkHash === newTx.lowNetworkHash : storedTx.highNetworkHash === newTx.highNetworkHash @@ -103,7 +99,7 @@ const HistoryDesktop: React.FC = () => { localStorage.setItem( `bridge-${connectedAccount}-transactions-${selectedNetworkType}`, - JSON.stringify([...storedTransactions, ...newTransactions]) + JSON.stringify([...localTransactions, ...newTransactions]) ) } setMergedTransactions(combinedTransactions) diff --git a/webapps/world-builder-dashboard/src/components/commonComponents/networkToggle/NetworkToggle.tsx b/webapps/world-builder-dashboard/src/components/commonComponents/networkToggle/NetworkToggle.tsx index 502455ce..1263001e 100644 --- a/webapps/world-builder-dashboard/src/components/commonComponents/networkToggle/NetworkToggle.tsx +++ b/webapps/world-builder-dashboard/src/components/commonComponents/networkToggle/NetworkToggle.tsx @@ -11,7 +11,7 @@ interface NetworkToggleProps {} const NetworkToggle: React.FC = () => { const { selectedNetworkType, setSelectedNetworkType } = useBlockchainContext() const [isDropdownOpen, setDropdownOpen] = useState(false) - const dropdownRef = useRef(null) + const dropdownRef = useRef(null) const [searchParams, setSearchParams] = useSearchParams() const toggleDropdown = () => setDropdownOpen((prev) => !prev) diff --git a/webapps/world-builder-dashboard/src/contexts/BlockchainContext.tsx b/webapps/world-builder-dashboard/src/contexts/BlockchainContext.tsx index 3e5689f5..3af47d9c 100644 --- a/webapps/world-builder-dashboard/src/contexts/BlockchainContext.tsx +++ b/webapps/world-builder-dashboard/src/contexts/BlockchainContext.tsx @@ -28,6 +28,8 @@ interface BlockchainContextType { setSelectedHighNetwork: (network: NetworkInterface) => void selectedBridgeToken: Token setSelectedBridgeToken: (token: Token) => void + selectedNativeToken: Token | null + setSelectedNativeToken: (token: Token | null) => void isMetaMask: boolean getProvider: (network: NetworkInterface) => Promise accounts: string[] @@ -90,6 +92,11 @@ export const BlockchainProvider: React.FC = ({ children const [selectedBridgeToken, setSelectedBridgeToken] = useState( getTokensForNetwork(DEFAULT_LOW_NETWORK.chainId, connectedAccount)[0] ) + const [selectedNativeToken, setSelectedNativeToken] = useState( + getTokensForNetwork(DEFAULT_LOW_NETWORK.chainId, connectedAccount).find( + (token) => token.symbol === DEFAULT_LOW_NETWORK.nativeCurrency?.symbol + ) ?? null + ) const tokenAddress = '0x5f88d811246222F6CB54266C42cc1310510b9feA' @@ -315,7 +322,9 @@ export const BlockchainProvider: React.FC = ({ children setSelectedBridgeToken, selectedBridgeToken, selectedNetworkType, - setSelectedNetworkType + setSelectedNetworkType, + setSelectedNativeToken, + selectedNativeToken }} > {children} diff --git a/webapps/world-builder-dashboard/src/hooks/useBalance.ts b/webapps/world-builder-dashboard/src/hooks/useBalance.ts index 065eca72..84350821 100644 --- a/webapps/world-builder-dashboard/src/hooks/useBalance.ts +++ b/webapps/world-builder-dashboard/src/hooks/useBalance.ts @@ -5,14 +5,14 @@ import { Token } from '@/utils/tokens' interface UseBalanceProps { account: string | undefined - token: Token + token: Token | null } const useTokenInformation = ({ account, token }: UseBalanceProps) => { return useQuery( ['balance', account, token], async () => { - if (!account) { + if (!account || !token) { return { tokenBalance: '0', symbol: '' } } const bridgeToken: BridgeToken = new BridgeToken(token.tokenAddressMap, token.chainId) diff --git a/webapps/world-builder-dashboard/src/hooks/useBridgeAPI.ts b/webapps/world-builder-dashboard/src/hooks/useBridgeAPI.ts index 48850891..675b0687 100644 --- a/webapps/world-builder-dashboard/src/hooks/useBridgeAPI.ts +++ b/webapps/world-builder-dashboard/src/hooks/useBridgeAPI.ts @@ -12,7 +12,6 @@ export const useBridgeAPI = () => { return useQuery( ['historyTransactions', address, selectedNetworkType], async () => { - console.log(selectedNetworkType) const res = await fetch(`${BASE_URL}/bridge/game7${uriSnippet}/${address}/transactions?limit=50&offset=0`, { method: 'GET' }) diff --git a/webapps/world-builder-dashboard/src/hooks/useBridgeTransfer.ts b/webapps/world-builder-dashboard/src/hooks/useBridgeTransfer.ts index 17291a70..292f311d 100644 --- a/webapps/world-builder-dashboard/src/hooks/useBridgeTransfer.ts +++ b/webapps/world-builder-dashboard/src/hooks/useBridgeTransfer.ts @@ -7,7 +7,7 @@ import { BridgeTransfer, BridgeTransferStatus } from 'game7-bridge-sdk' import { useBlockchainContext } from '@/contexts/BlockchainContext' import { useBridgeNotificationsContext } from '@/contexts/BridgeNotificationsContext' import { TransactionRecord } from '@/utils/bridge/depositERC20ArbitrumSDK' -import { getCachedTransactions } from '@/utils/web3utils' +import { fetchTransactionTimestamp, getCachedTransactions } from '@/utils/web3utils' interface UseTransferDataProps { txRecord: TransactionRecord @@ -15,6 +15,26 @@ interface UseTransferDataProps { export const useBridgeTransfer = () => { const { connectedAccount, selectedNetworkType, switchChain } = useBlockchainContext() + // Retry function with exponential backoff for handling 429 errors + const retryWithExponentialBackoff = async (fn: () => Promise, retries = 5, delay = 1000, jitterFactor = 0.5) => { + let attempt = 0 + + while (attempt < retries) { + try { + return await fn() + } catch (error: any) { + if (error?.response?.status === 429 && attempt < retries - 1) { + const baseDelay = delay *2**attempt + const jitter = baseDelay * (Math.random() * jitterFactor * 2 - jitterFactor) + const retryDelay = Math.max(baseDelay + jitter, 0) + await new Promise((resolve) => setTimeout(resolve, retryDelay)) + attempt++ + } else { + throw error // Rethrow error if not 429 or max retries reached + } + } + } + } const returnTransferData = ({ txRecord }: UseTransferDataProps) => { const isDeposit = txRecord.type === 'DEPOSIT' @@ -24,25 +44,6 @@ export const useBridgeTransfer = () => { const destinationRpc = getNetworks(selectedNetworkType)?.find((n) => n.chainId === destinationChainId)?.rpcs[0] const originRpc = getNetworks(selectedNetworkType)?.find((n) => n.chainId === originChainId)?.rpcs[0] - // Retry function with exponential backoff for handling 429 errors - const retryWithExponentialBackoff = async (fn: () => Promise, retries: number = 5, delay: number = 1000) => { - let attempt = 0 - - while (attempt < retries) { - try { - return await fn() - } catch (error: any) { - if (error?.response?.status === 429 && attempt < retries - 1) { - const retryDelay = delay * 2 ** attempt - await new Promise((resolve) => setTimeout(resolve, retryDelay)) - attempt++ - } else { - throw error // Rethrow error if not 429 or max retries reached - } - } - } - } - // If the status is pending and time since last fetched is > 2 minutes, fetch again const shouldFetchStatus = (cachedTransaction: any) => { const isPending = ![1, 2, 6, 9].includes(cachedTransaction?.status) @@ -266,9 +267,71 @@ export const useBridgeTransfer = () => { } ) } + + const getHighNetworkTimestamp = ({ + txRecord, + transferStatus, + }: { + txRecord: any + transferStatus: any + }) => { + + + return useQuery( + ['highNetworkTimestamp', txRecord?.lowNetworkHash], + async () => { + if (!txRecord) throw new Error('Deposit data is missing.') + + const transactions = getCachedTransactions(connectedAccount ?? '', selectedNetworkType) + const cachedTransaction = transactions.find((t: any) => t.lowNetworkHash === txRecord.lowNetworkHash) + + if (cachedTransaction?.highNetworkTimestamp) { + return cachedTransaction.highNetworkTimestamp + } + + const destinationRpc = getNetworks(selectedNetworkType)?.find((n) => n.chainId === txRecord.highNetworkChainId) + ?.rpcs[0] + + if (!transferStatus?.completionTxHash) { + console.log('No completion transaction hash found') + throw new Error('Completion transaction hash is missing.') + } + + const timestamp = await retryWithExponentialBackoff(() => + fetchTransactionTimestamp(transferStatus.completionTxHash, destinationRpc ?? '') + ) + + const updatedTransactions = transactions.map((t: any) => { + const isSameHash = t.lowNetworkHash === txRecord.lowNetworkHash + return isSameHash ? { ...t, highNetworkTimestamp: timestamp, lastUpdated: Date.now() } : t + }) + + localStorage.setItem( + `bridge-${connectedAccount}-transactions-${selectedNetworkType}`, + JSON.stringify(updatedTransactions) + ) + + return timestamp + }, + { + placeholderData: () => { + const transactions = getCachedTransactions(connectedAccount ?? '', selectedNetworkType) + const cachedTransaction = transactions.find((t: any) => t.lowNetworkHash === txRecord?.lowNetworkHash) + return cachedTransaction?.highNetworkTimestamp + }, + + staleTime: 1 * 60 * 1000, + refetchInterval: false, + refetchOnWindowFocus: false, + enabled: !!txRecord && !!transferStatus?.completionTxHash // Run query only if data is valid + } + ) + } + return { getTransactionInputs, returnTransferData, + getHighNetworkTimestamp, claim } } diff --git a/webapps/world-builder-dashboard/src/hooks/useL2ToL1MessageStatus.ts b/webapps/world-builder-dashboard/src/hooks/useL2ToL1MessageStatus.ts index c3455111..6fa60a99 100644 --- a/webapps/world-builder-dashboard/src/hooks/useL2ToL1MessageStatus.ts +++ b/webapps/world-builder-dashboard/src/hooks/useL2ToL1MessageStatus.ts @@ -88,26 +88,6 @@ export const getDecodedInputs = (tx: Transaction, ABI: any) => { }) } -// const getDepositTransferType = (tx: Transaction) => { -// if (tx.to === networks[this.destinationNetworkChainId]?.ethBridge?.inbox) { -// try { -// const decodedInputs = getDecodedInputs(tx, INBOX_ABI) -// return { transferType: BridgeTransferType.DEPOSIT_GAS, decodedInputs } -// } catch (_) { -// try { -// const decodedInputs = getDecodedInputs(tx, ERC20_INBOX_ABI) -// return { transferType: BridgeTransferType.DEPOSIT_ERC20_TO_GAS, decodedInputs } -// } catch (_) { -// throw new Error(`Unable to decode inputs - unknown method of inbox contract ${tx.to}`) -// } -// } -// } else if (tx.to === networks[this.destinationNetworkChainId]?.tokenBridge?.parentGatewayRouter) { -// const decodedInputs = getDecodedInputs(tx, L1GatewayRouterABI) -// return { transferType: BridgeTransferType.DEPOSIT_ERC20, decodedInputs } -// } -// throw new Error(`Unable to decode inputs - ${tx.to} is unknown contract`) -// } - const fetchDepositStatus = async (deposit: TransactionRecord, selectedNetworkType: NetworkType) => { const { lowNetworkChainId, highNetworkChainId, lowNetworkHash, lowNetworkTimestamp } = deposit if (lowNetworkChainId === L2_NETWORK.chainId) {