Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: fetch tx history sequentially #2141

Draft
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

brtkx
Copy link
Contributor

@brtkx brtkx commented Dec 13, 2024

closes FS-1054

The goal of these changes is to fetch sender transactions first, and once it's done and we display them we fetch receiver transactions.

Change log:

  • the return type of useTransactionHistory updated to include individual data for sender and receiver, so we can track states (such as loading) for each of them
  • useTransactionHistoryWithoutStatuses renamed to useRawTransactionHistory
  • split state from different transfer types fetched into 3 hooks: useCctpTransactions, useMappedSenderTransactionHistory and useMappedReceiverTransactionHistory, all of which return MergedTransaction[]
  • failedChainPairs renamed to rawDataErroredChains
  • getUpdatedPendingTransaction moved outside the hook and is reused in different hooks

@cla-bot cla-bot bot added the cla-signed label Dec 13, 2024
Copy link

vercel bot commented Dec 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
arbitrum-token-bridge ✅ Ready (Inspect) Visit Preview Dec 18, 2024 0:16am

@@ -241,101 +259,65 @@ function dedupeTransactions(txs: Transfer[]) {
)
}

async function getUpdatedPendingTransaction(tx: MergedTransaction) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved outside the hook because it's used by both sender and receiver fetchers

const { chain } = useNetwork()
const [isTestnetMode] = useIsTestnetMode()
const { isSmartContractWallet, isLoading: isLoadingAccountType } =
useAccountType()

// Check what type of CCTP (deposit, withdrawal or all) to fetch
Copy link
Contributor Author

@brtkx brtkx Dec 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CCTP moved to its own hook

useSWRImmutable<ChainPair[]>(
address ? ['failed_chain_pairs', address] : null
)
const { data: erroredChains, mutate: addErroredChain } = useSWRImmutable<
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

erroredChains are renamed from failedChainPairs imo it's less of a mouthful

@brtkx brtkx changed the title feat: fetch transactions from sender and to receiver sequentially feat: sequentially fetch sender and to receiver transactions Dec 16, 2024
@brtkx brtkx changed the title feat: sequentially fetch sender and to receiver transactions feat: fetch tx history sequentially Dec 16, 2024
<div className="flex h-[28px] items-center space-x-2">
<FailedChainPairsTooltip failedChainPairs={failedChainPairs} />
<FailedChainPairsTooltip failedChainPairs={rawDataErroredChains} />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the property is still called failedChainPairs
we should update it??

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we should split some hooks under a folder called /transactionHistoryHooks/ or split the hooks into several files

it's too chunky right now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants