From f5374ad39904887a0e8ec4d3b6600975a02da8f7 Mon Sep 17 00:00:00 2001 From: Bartek Date: Fri, 4 Jul 2025 12:45:05 +0200 Subject: [PATCH 01/10] better history errors --- .../TransactionHistory/ChainErrorsInfo.tsx | 104 ++++++++++++++++++ .../PendingDepositWarning.tsx | 10 +- .../TransactionHistorySearchResults.tsx | 9 +- .../TransactionHistoryTable.tsx | 47 +------- .../src/components/common/atoms/Toast.tsx | 11 ++ .../src/hooks/useTransactionHistory.ts | 63 +++++++---- 6 files changed, 169 insertions(+), 75 deletions(-) create mode 100644 packages/arb-token-bridge-ui/src/components/TransactionHistory/ChainErrorsInfo.tsx diff --git a/packages/arb-token-bridge-ui/src/components/TransactionHistory/ChainErrorsInfo.tsx b/packages/arb-token-bridge-ui/src/components/TransactionHistory/ChainErrorsInfo.tsx new file mode 100644 index 0000000000..8b58483be1 --- /dev/null +++ b/packages/arb-token-bridge-ui/src/components/TransactionHistory/ChainErrorsInfo.tsx @@ -0,0 +1,104 @@ +import { + Disclosure, + DisclosureButton, + DisclosurePanel +} from '@headlessui/react' +import { + XCircleIcon, + ChevronRightIcon, + ArrowsRightLeftIcon, + DocumentIcon, + EyeIcon +} from '@heroicons/react/24/outline' +import { ChainError, ChainPair } from '../../hooks/useTransactionHistory' +import { Tooltip } from '../common/Tooltip' +import { getNetworkName } from '../../util/networks' +import { NetworkImage } from '../common/NetworkImage' +import { useCopyToClipboard } from '@uidotdev/usehooks' +import { successToast } from '../common/atoms/Toast' + +function Networks({ networks }: { networks: ChainPair }) { + return ( +
+
+ + {getNetworkName(networks.parentChainId)} +
+ +
+ + {getNetworkName(networks.childChainId)} +
+
+ ) +} + +function ErrorTooltip({ error }: { error: string }) { + return ( + +
+ + View details +
+
+ ) +} + +function CopyErrorToClipboard({ error }: { error: string }) { + const [, copyToClipboard] = useCopyToClipboard() + + const handleCopy = () => { + copyToClipboard(error) + successToast('Error message copied to clipboard.') + } + + return ( + + ) +} + +export function ChainErrorsInfo({ + chainErrors +}: { + chainErrors: ChainError[] +}) { + if (chainErrors.length === 0) { + return null + } + + return ( + + +
+ +

+ Errors occurred while fetching data for some of the chains and they + may not show in the history. Click to expand the view and see more + info. +

+
+ +
+ +
    + {chainErrors.map(chainError => ( +
  • + + + +
  • + ))} +
+
+
+ ) +} diff --git a/packages/arb-token-bridge-ui/src/components/TransactionHistory/PendingDepositWarning.tsx b/packages/arb-token-bridge-ui/src/components/TransactionHistory/PendingDepositWarning.tsx index e2782468f7..3b333d96d5 100644 --- a/packages/arb-token-bridge-ui/src/components/TransactionHistory/PendingDepositWarning.tsx +++ b/packages/arb-token-bridge-ui/src/components/TransactionHistory/PendingDepositWarning.tsx @@ -1,4 +1,4 @@ -import { Disclosure } from '@headlessui/react' +import { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/react' import { InformationCircleIcon, ChevronRightIcon @@ -13,7 +13,7 @@ export function PendingDepositWarning() { as="div" className="mt-4 flex w-full flex-col justify-start gap-1 rounded border border-orange-dark bg-orange p-3 text-sm text-orange-dark" > - +

@@ -22,8 +22,8 @@ export function PendingDepositWarning() {

-
- + +

If you must leave, check back within a week. In most cases, your deposits should go through successfully. @@ -42,7 +42,7 @@ export function PendingDepositWarning() { , the mechanism behind deposits.

-
+ ) } diff --git a/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionHistorySearchResults.tsx b/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionHistorySearchResults.tsx index e69b6a9b91..6a2c94ce0e 100644 --- a/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionHistorySearchResults.tsx +++ b/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionHistorySearchResults.tsx @@ -24,6 +24,7 @@ import { import { useTransactionHistoryAddressStore } from './TransactionHistorySearchBar' import { shallow } from 'zustand/shallow' import { TransactionHistoryDisclaimer } from './TransactionHistoryDisclaimer' +import { ChainErrorsInfo } from './ChainErrorsInfo' function useTransactionHistoryUpdater() { const sanitizedAddress = useTransactionHistoryAddressStore( @@ -56,7 +57,7 @@ const tabClasses = export function TransactionHistorySearchResults() { const props = useTransactionHistoryUpdater() - const { transactions } = props + const { transactions, chainErrors } = props const { forceFetchReceived, setForceFetchReceived } = useForceFetchReceived( state => ({ forceFetchReceived: state.forceFetchReceived, @@ -125,6 +126,12 @@ export function TransactionHistorySearchResults() { + {chainErrors.length > 0 && ( +
+ +
+ )} +
diff --git a/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionHistoryTable.tsx b/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionHistoryTable.tsx index 2c05ec0da8..03c5ed42b7 100644 --- a/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionHistoryTable.tsx +++ b/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionHistoryTable.tsx @@ -8,20 +8,13 @@ import { } from 'react' import { twMerge } from 'tailwind-merge' import { Column, Table } from 'react-virtualized' -import { - ExclamationCircleIcon, - PlusCircleIcon -} from '@heroicons/react/24/outline' +import { PlusCircleIcon } from '@heroicons/react/24/outline' import dayjs from 'dayjs' import { getProviderForChainId } from '@/token-bridge-sdk/utils' import { isTokenDeposit } from '../../state/app/utils' -import { - ChainPair, - UseTransactionHistoryResult -} from '../../hooks/useTransactionHistory' +import { UseTransactionHistoryResult } from '../../hooks/useTransactionHistory' import { Tooltip } from '../common/Tooltip' -import { getNetworkName } from '../../util/networks' import { isTxPending } from './helpers' import { PendingDepositWarning } from './PendingDepositWarning' import { TransactionsTableRow } from './TransactionsTableRow' @@ -96,39 +89,6 @@ export const HistoryLoader = () => { return Loading transactions... } -const FailedChainPairsTooltip = ({ - failedChainPairs -}: { - failedChainPairs: ChainPair[] -}) => { - if (failedChainPairs.length === 0) { - return null - } - - return ( - - - We were unable to fetch data for the following chain pairs: - -
    - {failedChainPairs.map(pair => ( -
  • - {getNetworkName(pair.parentChainId)} - {' <> '} - {getNetworkName(pair.childChainId)} -
  • - ))} -
- - } - > - -
- ) -} - type TransactionHistoryTableProps = UseTransactionHistoryResult & { selectedTabIndex: number oldestTxTimeAgoString: string @@ -142,7 +102,6 @@ export const TransactionHistoryTable = ( loading, completed, error, - failedChainPairs, resume, selectedTabIndex, oldestTxTimeAgoString @@ -216,13 +175,11 @@ export const TransactionHistoryTable = ( > {loading ? (
-
) : (
- Showing {transactions.length}{' '} {isPendingTab ? 'pending' : 'settled'} transactions made in{' '} diff --git a/packages/arb-token-bridge-ui/src/components/common/atoms/Toast.tsx b/packages/arb-token-bridge-ui/src/components/common/atoms/Toast.tsx index 081a7e7824..2b144e4e45 100644 --- a/packages/arb-token-bridge-ui/src/components/common/atoms/Toast.tsx +++ b/packages/arb-token-bridge-ui/src/components/common/atoms/Toast.tsx @@ -22,6 +22,17 @@ export const warningToast = ( toast.warning(message, { autoClose }) } +export const successToast = ( + message: React.ReactNode, + { + autoClose + }: { + autoClose?: number | false | undefined + } = { autoClose: 5000 } +) => { + toast.success(message, { autoClose }) +} + export const Toast = () => { return ( void resume: () => void addPendingTransaction: (tx: MergedTransaction) => void @@ -93,6 +93,10 @@ export type UseTransactionHistoryResult = { } export type ChainPair = { parentChainId: ChainId; childChainId: ChainId } +export type ChainError = { + chainPair: ChainPair + error: string +} export type Deposit = Transaction @@ -117,6 +121,14 @@ export const useForceFetchReceived = create(set => ({ setForceFetchReceived: forceFetchReceived => set({ forceFetchReceived }) })) +function errorToHumanReadableFeedback(err: unknown) { + if (err instanceof Error) { + return err.message + } + + return 'An unknown error occurred. Please try again later, and if the issue persists contact support for more information.' +} + function getTransactionTimestamp(tx: Transfer) { if (isLifiTransfer(tx)) { return tx.createdAt ?? 0 @@ -373,10 +385,8 @@ const useTransactionHistoryWithoutStatuses = (address: Address | undefined) => { isTestnet: isTestnetMode }) - const { data: failedChainPairs, mutate: addFailedChainPair } = - useSWRImmutable( - address ? ['failed_chain_pairs', address] : null - ) + const { data: chainErrors = [], mutate: addChainError } = + useSWRImmutable(address ? ['chainErrors', address] : null) const fetcher = useCallback( (type: 'deposits' | 'withdrawals') => { @@ -462,23 +472,28 @@ const useTransactionHistoryWithoutStatuses = (address: Address | undefined) => { forceFetchReceived, batchSizeBlocks }) - } catch { - addFailedChainPair(prevFailedChainPairs => { - if (!prevFailedChainPairs) { - return [chainPair] + } catch (err) { + addChainError(prevChainErrors => { + const newChainError = { + chainPair, + error: errorToHumanReadableFeedback(err) + } + + if (!prevChainErrors) { + return [newChainError] } - if ( - typeof prevFailedChainPairs.find( - prevPair => - prevPair.parentChainId === chainPair.parentChainId && - prevPair.childChainId === chainPair.childChainId - ) !== 'undefined' - ) { - // already added - return prevFailedChainPairs + + const alreadyExists = prevChainErrors.some( + prev => + prev.chainPair.parentChainId === chainPair.parentChainId && + prev.chainPair.childChainId === chainPair.childChainId + ) + + if (alreadyExists) { + return prevChainErrors } - return [...prevFailedChainPairs, chainPair] + return [...prevChainErrors, newChainError] }) return [] @@ -489,7 +504,7 @@ const useTransactionHistoryWithoutStatuses = (address: Address | undefined) => { [ address, isTestnetMode, - addFailedChainPair, + addChainError, isSmartContractWallet, chain, forceFetchReceived @@ -541,7 +556,7 @@ const useTransactionHistoryWithoutStatuses = (address: Address | undefined) => { cctpLoading || oftLoading, error: depositsError ?? withdrawalsError, - failedChainPairs: failedChainPairs || [] + chainErrors } } @@ -578,7 +593,7 @@ export const useTransactionHistory = ( data, loading: isLoadingTxsWithoutStatus, error, - failedChainPairs + chainErrors } = useTransactionHistoryWithoutStatuses(address) const getCacheKey = useCallback( @@ -939,7 +954,7 @@ export const useTransactionHistory = ( transactions: newTransactionsData || [], loading: isLoadingTxsWithoutStatus, error, - failedChainPairs: [], + chainErrors: [], completed: true, pause, resume, @@ -953,7 +968,7 @@ export const useTransactionHistory = ( loading: isLoadingFirstPage || isLoadingMore, completed, error: txPagesError ?? error, - failedChainPairs, + chainErrors, pause, resume, addPendingTransaction, From 5d5d13b5d7764b66d79bfd1d983d6077b7ca9011 Mon Sep 17 00:00:00 2001 From: Bartek Date: Fri, 4 Jul 2025 12:50:42 +0200 Subject: [PATCH 02/10] format --- .../components/TransactionHistory/PendingDepositWarning.tsx | 6 +++++- .../arb-token-bridge-ui/src/hooks/useTransactionHistory.ts | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/arb-token-bridge-ui/src/components/TransactionHistory/PendingDepositWarning.tsx b/packages/arb-token-bridge-ui/src/components/TransactionHistory/PendingDepositWarning.tsx index 3b333d96d5..bd431ebbc1 100644 --- a/packages/arb-token-bridge-ui/src/components/TransactionHistory/PendingDepositWarning.tsx +++ b/packages/arb-token-bridge-ui/src/components/TransactionHistory/PendingDepositWarning.tsx @@ -1,4 +1,8 @@ -import { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/react' +import { + Disclosure, + DisclosureButton, + DisclosurePanel +} from '@headlessui/react' import { InformationCircleIcon, ChevronRightIcon diff --git a/packages/arb-token-bridge-ui/src/hooks/useTransactionHistory.ts b/packages/arb-token-bridge-ui/src/hooks/useTransactionHistory.ts index 5bac698547..644f4a4b0c 100644 --- a/packages/arb-token-bridge-ui/src/hooks/useTransactionHistory.ts +++ b/packages/arb-token-bridge-ui/src/hooks/useTransactionHistory.ts @@ -385,8 +385,9 @@ const useTransactionHistoryWithoutStatuses = (address: Address | undefined) => { isTestnet: isTestnetMode }) - const { data: chainErrors = [], mutate: addChainError } = - useSWRImmutable(address ? ['chainErrors', address] : null) + const { data: chainErrors = [], mutate: addChainError } = useSWRImmutable< + ChainError[] + >(address ? ['chainErrors', address] : null) const fetcher = useCallback( (type: 'deposits' | 'withdrawals') => { From 2c5db496e30784ffe0999015d494a7315297b6a4 Mon Sep 17 00:00:00 2001 From: Bartek Date: Fri, 4 Jul 2025 12:55:10 +0200 Subject: [PATCH 03/10] key --- .../src/components/TransactionHistory/ChainErrorsInfo.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/arb-token-bridge-ui/src/components/TransactionHistory/ChainErrorsInfo.tsx b/packages/arb-token-bridge-ui/src/components/TransactionHistory/ChainErrorsInfo.tsx index 8b58483be1..555d8baefd 100644 --- a/packages/arb-token-bridge-ui/src/components/TransactionHistory/ChainErrorsInfo.tsx +++ b/packages/arb-token-bridge-ui/src/components/TransactionHistory/ChainErrorsInfo.tsx @@ -91,7 +91,10 @@ export function ChainErrorsInfo({
    {chainErrors.map(chainError => ( -
  • +
  • From 83dbe4ba040927f4f4b63d22e4a18a817cb419a1 Mon Sep 17 00:00:00 2001 From: Bartek Date: Fri, 4 Jul 2025 13:18:23 +0200 Subject: [PATCH 04/10] get help btn --- .../TransactionHistory/ChainErrorsInfo.tsx | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/packages/arb-token-bridge-ui/src/components/TransactionHistory/ChainErrorsInfo.tsx b/packages/arb-token-bridge-ui/src/components/TransactionHistory/ChainErrorsInfo.tsx index 555d8baefd..de634bbd2a 100644 --- a/packages/arb-token-bridge-ui/src/components/TransactionHistory/ChainErrorsInfo.tsx +++ b/packages/arb-token-bridge-ui/src/components/TransactionHistory/ChainErrorsInfo.tsx @@ -8,7 +8,8 @@ import { ChevronRightIcon, ArrowsRightLeftIcon, DocumentIcon, - EyeIcon + EyeIcon, + ChatBubbleLeftRightIcon } from '@heroicons/react/24/outline' import { ChainError, ChainPair } from '../../hooks/useTransactionHistory' import { Tooltip } from '../common/Tooltip' @@ -16,6 +17,8 @@ import { getNetworkName } from '../../util/networks' import { NetworkImage } from '../common/NetworkImage' import { useCopyToClipboard } from '@uidotdev/usehooks' import { successToast } from '../common/atoms/Toast' +import { ExternalLink } from '../common/ExternalLink' +import { GET_HELP_LINK } from '../../constants' function Networks({ networks }: { networks: ChainPair }) { return ( @@ -63,6 +66,18 @@ function CopyErrorToClipboard({ error }: { error: string }) { ) } +function GetHelp() { + return ( + + + Get help + + ) +} + export function ChainErrorsInfo({ chainErrors }: { @@ -89,15 +104,16 @@ export function ChainErrorsInfo({ -
      +
        {chainErrors.map(chainError => (
      • +
      • ))}
      From be3724e548b7e63973ad40006a08005641c79731 Mon Sep 17 00:00:00 2001 From: Bartek Date: Fri, 4 Jul 2025 14:15:49 +0200 Subject: [PATCH 05/10] nit --- .../TransactionHistory/ChainErrorsInfo.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/arb-token-bridge-ui/src/components/TransactionHistory/ChainErrorsInfo.tsx b/packages/arb-token-bridge-ui/src/components/TransactionHistory/ChainErrorsInfo.tsx index de634bbd2a..b7f537d387 100644 --- a/packages/arb-token-bridge-ui/src/components/TransactionHistory/ChainErrorsInfo.tsx +++ b/packages/arb-token-bridge-ui/src/components/TransactionHistory/ChainErrorsInfo.tsx @@ -19,6 +19,8 @@ import { useCopyToClipboard } from '@uidotdev/usehooks' import { successToast } from '../common/atoms/Toast' import { ExternalLink } from '../common/ExternalLink' import { GET_HELP_LINK } from '../../constants' +import SyntaxHighlighter from 'react-syntax-highlighter' +import { stackoverflowDark } from 'react-syntax-highlighter/dist/esm/styles/hljs' function Networks({ networks }: { networks: ChainPair }) { return ( @@ -40,7 +42,16 @@ function ErrorTooltip({ error }: { error: string }) { return ( + {error} + + } >
      From ba5f2a5b6ec3145ec19523c3a5cdd2bca3780180 Mon Sep 17 00:00:00 2001 From: Bartek Date: Fri, 4 Jul 2025 16:57:29 +0200 Subject: [PATCH 06/10] fix --- .../src/components/TransactionHistory/ChainErrorsInfo.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/arb-token-bridge-ui/src/components/TransactionHistory/ChainErrorsInfo.tsx b/packages/arb-token-bridge-ui/src/components/TransactionHistory/ChainErrorsInfo.tsx index b7f537d387..bfc8592a9b 100644 --- a/packages/arb-token-bridge-ui/src/components/TransactionHistory/ChainErrorsInfo.tsx +++ b/packages/arb-token-bridge-ui/src/components/TransactionHistory/ChainErrorsInfo.tsx @@ -3,6 +3,8 @@ import { DisclosureButton, DisclosurePanel } from '@headlessui/react' +import SyntaxHighlighter from 'react-syntax-highlighter' +import { stackoverflowDark } from 'react-syntax-highlighter/dist/esm/styles/hljs' import { XCircleIcon, ChevronRightIcon, @@ -19,8 +21,6 @@ import { useCopyToClipboard } from '@uidotdev/usehooks' import { successToast } from '../common/atoms/Toast' import { ExternalLink } from '../common/ExternalLink' import { GET_HELP_LINK } from '../../constants' -import SyntaxHighlighter from 'react-syntax-highlighter' -import { stackoverflowDark } from 'react-syntax-highlighter/dist/esm/styles/hljs' function Networks({ networks }: { networks: ChainPair }) { return ( @@ -101,7 +101,7 @@ export function ChainErrorsInfo({ return (
      From fffc2ef8699a979624299dc37b3e2469128476a1 Mon Sep 17 00:00:00 2001 From: Bartek Date: Mon, 14 Jul 2025 17:06:46 +0200 Subject: [PATCH 07/10] fix --- .../components/TransactionHistory/ChainErrorsInfo.tsx | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/packages/arb-token-bridge-ui/src/components/TransactionHistory/ChainErrorsInfo.tsx b/packages/arb-token-bridge-ui/src/components/TransactionHistory/ChainErrorsInfo.tsx index bfc8592a9b..fbd49b0e10 100644 --- a/packages/arb-token-bridge-ui/src/components/TransactionHistory/ChainErrorsInfo.tsx +++ b/packages/arb-token-bridge-ui/src/components/TransactionHistory/ChainErrorsInfo.tsx @@ -42,16 +42,7 @@ function ErrorTooltip({ error }: { error: string }) { return ( - {error} - - } + content={error} >
      From bcabf195e2025309b82377f8753349ccb528a2c3 Mon Sep 17 00:00:00 2001 From: Bartek Date: Mon, 14 Jul 2025 17:27:20 +0200 Subject: [PATCH 08/10] logs --- .../TransactionHistory/ChainErrorsInfo.tsx | 11 ++++- .../src/hooks/useTransactionHistory.ts | 19 ++++++++ .../src/util/deposits/fetchDeposits.ts | 4 ++ .../src/util/withdrawals/fetchWithdrawals.ts | 48 +++++++++++++++++++ 4 files changed, 81 insertions(+), 1 deletion(-) diff --git a/packages/arb-token-bridge-ui/src/components/TransactionHistory/ChainErrorsInfo.tsx b/packages/arb-token-bridge-ui/src/components/TransactionHistory/ChainErrorsInfo.tsx index fbd49b0e10..bfc8592a9b 100644 --- a/packages/arb-token-bridge-ui/src/components/TransactionHistory/ChainErrorsInfo.tsx +++ b/packages/arb-token-bridge-ui/src/components/TransactionHistory/ChainErrorsInfo.tsx @@ -42,7 +42,16 @@ function ErrorTooltip({ error }: { error: string }) { return ( + {error} + + } >
      diff --git a/packages/arb-token-bridge-ui/src/hooks/useTransactionHistory.ts b/packages/arb-token-bridge-ui/src/hooks/useTransactionHistory.ts index 644f4a4b0c..fb7d38c607 100644 --- a/packages/arb-token-bridge-ui/src/hooks/useTransactionHistory.ts +++ b/packages/arb-token-bridge-ui/src/hooks/useTransactionHistory.ts @@ -435,6 +435,9 @@ const useTransactionHistoryWithoutStatuses = (address: Address | undefined) => { destinationChainId: chainPair.childChainId }) ) { + if (chainPair.childChainId === 42170) { + console.log('nova error 1') + } // teleporter does not support withdrawals if (type === 'withdrawals') return [] @@ -452,16 +455,32 @@ const useTransactionHistoryWithoutStatuses = (address: Address | undefined) => { }) } + if (chainPair.childChainId === 42170) { + console.log('nova error 2') + } + const batchSizeBlocks = BATCH_FETCH_BLOCKS[chainPair.childChainId] + if (chainPair.childChainId === 42170) { + console.log('nova error 3') + } + const withdrawalFn = typeof batchSizeBlocks === 'number' ? fetchWithdrawalsInBatches : fetchWithdrawals + if (chainPair.childChainId === 42170) { + console.log('nova error 4') + } + const fetcherFn = type === 'deposits' ? fetchDeposits : withdrawalFn + if (chainPair.childChainId === 42170) { + console.log('nova error 5') + } + // else, fetch deposits or withdrawals return await fetcherFn({ sender: includeSentTxs ? address : undefined, diff --git a/packages/arb-token-bridge-ui/src/util/deposits/fetchDeposits.ts b/packages/arb-token-bridge-ui/src/util/deposits/fetchDeposits.ts index 17acc4dd64..9391cd4cb0 100644 --- a/packages/arb-token-bridge-ui/src/util/deposits/fetchDeposits.ts +++ b/packages/arb-token-bridge-ui/src/util/deposits/fetchDeposits.ts @@ -47,6 +47,10 @@ export const fetchDeposits = async ({ const l1ChainId = (await l1Provider.getNetwork()).chainId const l2ChainId = (await l2Provider.getNetwork()).chainId + if (l2ChainId === 42170) { + console.log('nova error d1') + } + const nativeCurrency = await fetchNativeCurrency({ provider: l2Provider }) if (!fromBlock) { diff --git a/packages/arb-token-bridge-ui/src/util/withdrawals/fetchWithdrawals.ts b/packages/arb-token-bridge-ui/src/util/withdrawals/fetchWithdrawals.ts index 7ccadcbd59..209b1cb495 100644 --- a/packages/arb-token-bridge-ui/src/util/withdrawals/fetchWithdrawals.ts +++ b/packages/arb-token-bridge-ui/src/util/withdrawals/fetchWithdrawals.ts @@ -75,6 +75,10 @@ export async function fetchWithdrawals({ const l1ChainID = (await l1Provider.getNetwork()).chainId const l2ChainID = (await l2Provider.getNetwork()).chainId + if (l2ChainID === 42170) { + console.log('nova error w1') + } + const { isOrbitChain, isCoreChain } = isNetwork(l2ChainID) if (!fromBlock) { @@ -88,6 +92,10 @@ export async function fetchWithdrawals({ const latestSubgraphBlock = await fetchLatestSubgraphBlockNumber(l2ChainID) + if (l2ChainID === 42170) { + console.log('nova error w2') + } + let withdrawalsFromSubgraph: WithdrawalFromSubgraph[] = [] try { const toBlockSubgraph = @@ -117,12 +125,20 @@ export async function fetchWithdrawals({ } }) + if (l2ChainID === 42170) { + console.log('nova error w3') + } + // if successful, this is our latest fetched block and we will use it as a start block for event logs to fetch the remaining data latestFetchedBlock = toBlockSubgraph } catch (error) { console.log('Error fetching withdrawals from subgraph', error) } + if (l2ChainID === 42170) { + console.log('nova error w4') + } + const gateways = await getGateways(l2Provider) const senderNonce = await backOff(() => getNonce(sender, { provider: l2Provider }) @@ -134,6 +150,10 @@ export async function fetchWithdrawals({ const isAlchemy = isAlchemyChain(l2ChainID) const delayMs = isAlchemy ? 2_000 : 0 + if (l2ChainID === 42170) { + console.log('nova error w5') + } + const allGateways = [ gateways.standardGateway, gateways.wethGateway, @@ -155,6 +175,10 @@ export async function fetchWithdrawals({ } } + if (l2ChainID === 42170) { + console.log('nova error w6') + } + const fetchReceivedTransactions = // check if we already fetched for each block toBlock && latestFetchedBlock >= toBlock @@ -175,6 +199,10 @@ export async function fetchWithdrawals({ } } + if (l2ChainID === 42170) { + console.log('nova error w7') + } + const ethWithdrawalsFromEventLogs = fetchReceivedTransactions ? await backOff(() => fetchETHWithdrawalsFromEventLogs({ @@ -188,6 +216,10 @@ export async function fetchWithdrawals({ await wait(delayMs) + if (l2ChainID === 42170) { + console.log('nova error w8') + } + const tokenWithdrawalsFromEventLogs = await fetchTokenWithdrawalsFromEventLogsSequentially({ sender, @@ -198,6 +230,10 @@ export async function fetchWithdrawals({ queries }) + if (l2ChainID === 42170) { + console.log('nova error w9') + } + const mappedEthWithdrawalsFromEventLogs: Withdrawal[] = ethWithdrawalsFromEventLogs.map(tx => { return { @@ -209,6 +245,10 @@ export async function fetchWithdrawals({ } }) + if (l2ChainID === 42170) { + console.log('nova error w10') + } + const mappedTokenWithdrawalsFromEventLogs: WithdrawalInitiated[] = tokenWithdrawalsFromEventLogs.map(tx => { return { @@ -220,6 +260,10 @@ export async function fetchWithdrawals({ } }) + if (l2ChainID === 42170) { + console.log('nova error w11') + } + // we need timestamps to sort token withdrawals along ETH withdrawals const tokenWithdrawalsFromEventLogsWithTimestamp: Withdrawal[] = await Promise.all( @@ -228,6 +272,10 @@ export async function fetchWithdrawals({ ) ) + if (l2ChainID === 42170) { + console.log('nova error w12') + } + return [ ...mappedEthWithdrawalsFromEventLogs, ...tokenWithdrawalsFromEventLogsWithTimestamp, From 0cc13469e361786adb38ae0f2884cfe698763c86 Mon Sep 17 00:00:00 2001 From: Bartek Date: Mon, 14 Jul 2025 17:40:58 +0200 Subject: [PATCH 09/10] fix try --- .../src/util/SubgraphUtils.ts | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/packages/arb-token-bridge-ui/src/util/SubgraphUtils.ts b/packages/arb-token-bridge-ui/src/util/SubgraphUtils.ts index dcdd31f896..a8bc03dce2 100644 --- a/packages/arb-token-bridge-ui/src/util/SubgraphUtils.ts +++ b/packages/arb-token-bridge-ui/src/util/SubgraphUtils.ts @@ -39,15 +39,19 @@ export function hasTeleporterSubgraph(l1ChainId: number) { export const fetchLatestSubgraphBlockNumber = async ( chainId: number ): Promise => { - const response = await fetch( - `${getAPIBaseUrl()}/api/chains/${chainId}/block-number`, - { - method: 'GET', - headers: { 'Content-Type': 'application/json' } - } - ) - - return ((await response.json()) as { data: number }).data + try { + const response = await fetch( + `${getAPIBaseUrl()}/api/chains/${chainId}/block-number`, + { + method: 'GET', + headers: { 'Content-Type': 'application/json' } + } + ) + + return ((await response.json()) as { data: number }).data + } catch { + return 0 + } } export const shouldIncludeSentTxs = ({ From 536e3d5ad3eccfa16e0e9be77c46b1cce36662c1 Mon Sep 17 00:00:00 2001 From: Bartek Date: Mon, 14 Jul 2025 17:41:15 +0200 Subject: [PATCH 10/10] log --- packages/arb-token-bridge-ui/src/util/SubgraphUtils.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/arb-token-bridge-ui/src/util/SubgraphUtils.ts b/packages/arb-token-bridge-ui/src/util/SubgraphUtils.ts index a8bc03dce2..66c9202a22 100644 --- a/packages/arb-token-bridge-ui/src/util/SubgraphUtils.ts +++ b/packages/arb-token-bridge-ui/src/util/SubgraphUtils.ts @@ -47,6 +47,8 @@ export const fetchLatestSubgraphBlockNumber = async ( headers: { 'Content-Type': 'application/json' } } ) + + console.log({ response }) return ((await response.json()) as { data: number }).data } catch {