diff --git a/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionsTableRowAction.tsx b/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionsTableRowAction.tsx
index af4fe167ef..b698597a3a 100644
--- a/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionsTableRowAction.tsx
+++ b/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionsTableRowAction.tsx
@@ -17,27 +17,26 @@ import { useNetwork } from 'wagmi'
import { isDepositReadyToRedeem } from '../../state/app/utils'
import { useRedeemRetryable } from '../../hooks/useRedeemRetryable'
import { TransferCountdown } from '../common/TransferCountdown'
-import { Address } from '../../util/AddressUtils'
import { getChainIdForRedeemingRetryable } from '../../util/RetryableUtils'
import { isTeleportTx } from '../../hooks/useTransactions'
import { useRedeemTeleporter } from '../../hooks/useRedeemTeleporter'
import { sanitizeTokenSymbol } from '../../util/TokenUtils'
import { formatAmount } from '../../util/NumberUtils'
+import { useTransactionHistoryAddressStore } from './TransactionHistorySearchBar'
export function TransactionsTableRowAction({
tx,
isError,
- type,
- address
+ type
}: {
tx: MergedTransaction | TeleporterMergedTransaction
isError: boolean
type: 'deposits' | 'withdrawals'
- address: Address | undefined
}) {
const { chain } = useNetwork()
const { switchNetworkAsync } = useSwitchNetworkWithConfig()
const networkName = getNetworkName(chain?.id ?? 0)
+ const { sanitizedAddress } = useTransactionHistoryAddressStore()
const tokenSymbol = sanitizeTokenSymbol(tx.asset, {
erc20L1Address: tx.tokenAddress,
@@ -48,10 +47,10 @@ export function TransactionsTableRowAction({
const { claim: claimCctp, isClaiming: isClaimingCctp } = useClaimCctp(tx)
const { redeem, isRedeeming: isRetryableRedeeming } = useRedeemRetryable(
tx,
- address
+ sanitizedAddress
)
const { redeem: teleporterRedeem, isRedeeming: isTeleporterRedeeming } =
- useRedeemTeleporter(tx, address)
+ useRedeemTeleporter(tx, sanitizedAddress)
const isRedeeming = isRetryableRedeeming || isTeleporterRedeeming
diff --git a/packages/arb-token-bridge-ui/src/components/TransactionHistory/useTransactionHistoryUpdater.ts b/packages/arb-token-bridge-ui/src/components/TransactionHistory/useTransactionHistoryUpdater.ts
index 119b150dd4..968cd53e17 100644
--- a/packages/arb-token-bridge-ui/src/components/TransactionHistory/useTransactionHistoryUpdater.ts
+++ b/packages/arb-token-bridge-ui/src/components/TransactionHistory/useTransactionHistoryUpdater.ts
@@ -1,13 +1,13 @@
-import { useAccount } from 'wagmi'
import { useTransactionHistory } from '../../hooks/useTransactionHistory'
import { useEffect, useMemo } from 'react'
import { isTxPending } from './helpers'
+import { useTransactionHistoryAddressStore } from './TransactionHistorySearchBar'
export function useTransactionHistoryUpdater() {
- const { address } = useAccount()
+ const { sanitizedAddress } = useTransactionHistoryAddressStore()
- const transactionHistoryProps = useTransactionHistory(address, {
+ const transactionHistoryProps = useTransactionHistory(sanitizedAddress, {
runFetcher: true
})
From 26646377aec04580d683537382d6ce87d6ef0384 Mon Sep 17 00:00:00 2001
From: Fionna <13184582+fionnachan@users.noreply.github.com>
Date: Tue, 19 Nov 2024 18:55:07 +0000
Subject: [PATCH 23/49] ux update
---
.../TransactionHistorySearchBar.tsx | 57 +++++++++++++------
1 file changed, 41 insertions(+), 16 deletions(-)
diff --git a/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionHistorySearchBar.tsx b/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionHistorySearchBar.tsx
index f031e6b8c2..22f60dbe1b 100644
--- a/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionHistorySearchBar.tsx
+++ b/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionHistorySearchBar.tsx
@@ -3,9 +3,11 @@ import { isAddress } from 'ethers/lib/utils.js'
import { Address, useAccount, useNetwork } from 'wagmi'
import { Button } from '../common/Button'
-import { useEffect } from 'react'
+import { useEffect, useState } from 'react'
import { ExternalLink } from '../common/ExternalLink'
import { getExplorerUrl } from '../../util/networks'
+import { MagnifyingGlassIcon } from '@heroicons/react/24/outline'
+import { twMerge } from 'tailwind-merge'
type TransactionHistoryAddressStore = {
address: string
@@ -45,6 +47,7 @@ export const useTransactionHistoryAddressStore =
export function TransactionHistorySearchBar() {
const { address, setAddress, setSanitizedAddress, sanitizedAddress } =
useTransactionHistoryAddressStore()
+ const [showAddressField, setShowAddressField] = useState(false)
const { address: connectedAddress } = useAccount()
const { chain } = useNetwork()
@@ -56,21 +59,6 @@ export function TransactionHistorySearchBar() {
return (
-
Showing transactions for{' '}
{chain ? (
@@ -84,6 +72,43 @@ export function TransactionHistorySearchBar() {
sanitizedAddress
)}
+
+
+
+
)
}
From 923515f5a551ddff2928390f5203320f1d62e413 Mon Sep 17 00:00:00 2001
From: Fionna <13184582+fionnachan@users.noreply.github.com>
Date: Thu, 21 Nov 2024 19:04:27 +0000
Subject: [PATCH 24/49] update
---
.../TransactionHistorySearchBar.tsx | 114 +++++++-----------
1 file changed, 41 insertions(+), 73 deletions(-)
diff --git a/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionHistorySearchBar.tsx b/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionHistorySearchBar.tsx
index 22f60dbe1b..434f907521 100644
--- a/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionHistorySearchBar.tsx
+++ b/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionHistorySearchBar.tsx
@@ -1,55 +1,39 @@
import { create } from 'zustand'
import { isAddress } from 'ethers/lib/utils.js'
-import { Address, useAccount, useNetwork } from 'wagmi'
-
-import { Button } from '../common/Button'
-import { useEffect, useState } from 'react'
-import { ExternalLink } from '../common/ExternalLink'
-import { getExplorerUrl } from '../../util/networks'
+import { Address, useAccount } from 'wagmi'
+import { useCallback, useEffect } from 'react'
import { MagnifyingGlassIcon } from '@heroicons/react/24/outline'
import { twMerge } from 'tailwind-merge'
+import { Button } from '../common/Button'
+
type TransactionHistoryAddressStore = {
address: string
sanitizedAddress: Address | undefined
+ searchError: any
setAddress: (address: string) => void
setSanitizedAddress: (address: string) => void
+ setSearchError: (error: any) => void
}
export const useTransactionHistoryAddressStore =
create
((set, get) => ({
address: '',
sanitizedAddress: undefined,
- setAddress: (address: string) => {
- const currentSanitizedAddress = get().sanitizedAddress
-
- set({ address })
-
- if (
- typeof currentSanitizedAddress !== 'undefined' &&
- isAddress(currentSanitizedAddress) &&
- !isAddress(address)
- ) {
- return
- }
-
- get().setSanitizedAddress(address)
- },
+ setAddress: (address: string) => set({ address }),
setSanitizedAddress: (address: string) => {
if (isAddress(address)) {
set({ sanitizedAddress: address })
- } else {
- set({ sanitizedAddress: undefined })
}
- }
+ },
+ searchError: undefined,
+ setSearchError: (error: string | undefined) => set({ searchError: error })
}))
export function TransactionHistorySearchBar() {
- const { address, setAddress, setSanitizedAddress, sanitizedAddress } =
+ const { address, setAddress, setSanitizedAddress } =
useTransactionHistoryAddressStore()
- const [showAddressField, setShowAddressField] = useState(false)
const { address: connectedAddress } = useAccount()
- const { chain } = useNetwork()
useEffect(() => {
if (address === '' && connectedAddress) {
@@ -57,58 +41,42 @@ export function TransactionHistorySearchBar() {
}
}, [address, connectedAddress, setSanitizedAddress])
+ const searchTxForAddress = useCallback(() => {
+ if (isAddress(address)) {
+ setSanitizedAddress(address)
+ }
+ }, [address, setSanitizedAddress])
+
return (
-
-
- Showing transactions for{' '}
- {chain ? (
-
- {sanitizedAddress}
-
- ) : (
- sanitizedAddress
+
)
}
From f251bd41715a4b9d4c01f13919ff32c8ba895d27 Mon Sep 17 00:00:00 2001
From: Fionna <13184582+fionnachan@users.noreply.github.com>
Date: Fri, 22 Nov 2024 12:26:44 +0000
Subject: [PATCH 25/49] add invalid address error
---
.../TransactionHistory/TransactionHistorySearchBar.tsx | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionHistorySearchBar.tsx b/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionHistorySearchBar.tsx
index 434f907521..e5c8ead832 100644
--- a/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionHistorySearchBar.tsx
+++ b/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionHistorySearchBar.tsx
@@ -7,6 +7,10 @@ import { twMerge } from 'tailwind-merge'
import { Button } from '../common/Button'
+export enum TransactionHistorySearchError {
+ INVALID_ADDRESS = 'That doesn’t seem to be a valid address, please try again.'
+}
+
type TransactionHistoryAddressStore = {
address: string
sanitizedAddress: Address | undefined
@@ -31,7 +35,7 @@ export const useTransactionHistoryAddressStore =
}))
export function TransactionHistorySearchBar() {
- const { address, setAddress, setSanitizedAddress } =
+ const { address, setAddress, setSanitizedAddress, setSearchError } =
useTransactionHistoryAddressStore()
const { address: connectedAddress } = useAccount()
@@ -44,8 +48,10 @@ export function TransactionHistorySearchBar() {
const searchTxForAddress = useCallback(() => {
if (isAddress(address)) {
setSanitizedAddress(address)
+ } else {
+ setSearchError(TransactionHistorySearchError.INVALID_ADDRESS)
}
- }, [address, setSanitizedAddress])
+ }, [address, setSanitizedAddress, setSearchError])
return (
From 44fd863bb842699b971f435cfdd195f12bad5191 Mon Sep 17 00:00:00 2001
From: Fionna <13184582+fionnachan@users.noreply.github.com>
Date: Fri, 22 Nov 2024 17:13:00 +0000
Subject: [PATCH 26/49] update error message screen
---
.../EmptyTransactionHistory.tsx | 6 +-
.../TransactionHistory/TransactionHistory.tsx | 102 +--------------
.../TransactionHistorySearchBar.tsx | 10 +-
.../TransactionHistorySearchResults.tsx | 122 ++++++++++++++++++
.../TransactionHistoryTable.tsx | 4 +-
5 files changed, 139 insertions(+), 105 deletions(-)
create mode 100644 packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionHistorySearchResults.tsx
diff --git a/packages/arb-token-bridge-ui/src/components/TransactionHistory/EmptyTransactionHistory.tsx b/packages/arb-token-bridge-ui/src/components/TransactionHistory/EmptyTransactionHistory.tsx
index 6c0d3e1b69..8a93052271 100644
--- a/packages/arb-token-bridge-ui/src/components/TransactionHistory/EmptyTransactionHistory.tsx
+++ b/packages/arb-token-bridge-ui/src/components/TransactionHistory/EmptyTransactionHistory.tsx
@@ -52,5 +52,9 @@ export const EmptyTransactionHistory = ({
)
}
- return
Looks like no transactions here yet.
+ return (
+
+ No {tabType} transactions.
+
+ )
}
diff --git a/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionHistory.tsx b/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionHistory.tsx
index 7fe6ddcabf..c6f3e1ceef 100644
--- a/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionHistory.tsx
+++ b/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionHistory.tsx
@@ -1,23 +1,12 @@
-import dayjs from 'dayjs'
import { useEffect, useMemo } from 'react'
-import { Tab } from '@headlessui/react'
import { useAccount } from 'wagmi'
import { create } from 'zustand'
-import { TransactionHistoryTable } from './TransactionHistoryTable'
-import { TransactionStatusInfo } from '../TransactionHistory/TransactionStatusInfo'
-import {
- isTxClaimable,
- isTxCompleted,
- isTxExpired,
- isTxFailed,
- isTxPending
-} from './helpers'
import { MergedTransaction } from '../../state/app/state'
-import { TabButton } from '../common/Tab'
-import { TransactionsTableDetails } from './TransactionsTableDetails'
import { useTransactionHistory } from '../../hooks/useTransactionHistory'
import { TransactionHistorySearchBar } from './TransactionHistorySearchBar'
+import { TransactionHistorySearchResults } from './TransactionHistorySearchResults'
+import { isTxPending } from './helpers'
function useTransactionHistoryUpdater() {
const { address } = useAccount()
@@ -73,96 +62,13 @@ export const useTxDetailsStore = create
(set => ({
}))
export const TransactionHistory = () => {
- const props = useTransactionHistoryUpdater()
- const { transactions } = props
-
- const oldestTxTimeAgoString = useMemo(() => {
- return dayjs(transactions[transactions.length - 1]?.createdAt).toNow(true)
- }, [transactions])
-
- const groupedTransactions = useMemo(
- () =>
- transactions.reduce(
- (acc, tx) => {
- if (isTxCompleted(tx) || isTxExpired(tx)) {
- acc.settled.push(tx)
- }
- if (isTxPending(tx)) {
- acc.pending.push(tx)
- }
- if (isTxClaimable(tx)) {
- acc.claimable.push(tx)
- }
- if (isTxFailed(tx)) {
- acc.failed.push(tx)
- }
- return acc
- },
- {
- settled: [] as MergedTransaction[],
- pending: [] as MergedTransaction[],
- claimable: [] as MergedTransaction[],
- failed: [] as MergedTransaction[]
- }
- ),
- [transactions]
- )
-
- const pendingTransactions = [
- ...groupedTransactions.failed,
- ...groupedTransactions.pending,
- ...groupedTransactions.claimable
- ]
-
- const settledTransactions = groupedTransactions.settled
+ useTransactionHistoryUpdater()
return (
-
-
-
-
-
-
-
- Pending transactions
-
-
- Settled transactions
-
-
-
-
-
-
-
-
-
-
-
-
-
+
)
}
diff --git a/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionHistorySearchBar.tsx b/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionHistorySearchBar.tsx
index e5c8ead832..df0ed4a1d1 100644
--- a/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionHistorySearchBar.tsx
+++ b/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionHistorySearchBar.tsx
@@ -42,22 +42,24 @@ export function TransactionHistorySearchBar() {
useEffect(() => {
if (address === '' && connectedAddress) {
setSanitizedAddress(connectedAddress)
+ setSearchError(undefined)
}
- }, [address, connectedAddress, setSanitizedAddress])
+ }, [address, connectedAddress, setSanitizedAddress, setSearchError])
const searchTxForAddress = useCallback(() => {
- if (isAddress(address)) {
+ if (address !== '' && isAddress(address)) {
setSanitizedAddress(address)
+ setSearchError(undefined)
} else {
setSearchError(TransactionHistorySearchError.INVALID_ADDRESS)
}
}, [address, setSanitizedAddress, setSearchError])
return (
-
+