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

refactor: use token list gateways if possible #2172

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

fionnachan
Copy link
Member

Closes FS-1072

@cla-bot cla-bot bot added the cla-signed label Jan 6, 2025
Copy link

vercel bot commented Jan 6, 2025

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

Name Status Preview Updated (UTC)
arbitrum-token-bridge ✅ Ready (Inspect) Visit Preview Jan 13, 2025 2:21pm

@@ -198,7 +200,7 @@ export function TokenApprovalDialog(props: TokenApprovalDialogProps) {
isCctp,
isDepositMode,
parentChainProvider,
token?.address,
token,
Copy link
Contributor

Choose a reason for hiding this comment

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

We should avoid passing objects, and extract only the required data points in the dependency array - token?.address, token?.parentBridgeAddress and token?.childBridgeAddress

Copy link
Contributor

Choose a reason for hiding this comment

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

Passing object is fine if the reference is stable

@@ -213,6 +213,8 @@ export const useArbTokenBridge = (
symbol,
address: l1Address,
l2Address: address.toLowerCase(),
parentBridgeAddress: bridgeInfo[l1NetworkID]?.originBridgeAddress,
Copy link
Contributor

Choose a reason for hiding this comment

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

@chrstph-dvx Are we 100% sure parent and child here refer to origin and dest addresses?

Copy link
Member Author

Choose a reason for hiding this comment

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

actually good point, i think it's the reverse
i'll add some tests

@fionnachan fionnachan marked this pull request as draft January 8, 2025 12:30
Comment on lines +250 to +256
const { bridgeTokensToAdd, candidateUnbridgedTokensToAdd } =
await processTokensFromList({
arbTokenList,
listId,
parentChainId: l1ChainID,
childChainId: l2ChainID
})
Copy link
Member Author

@fionnachan fionnachan Jan 8, 2025

Choose a reason for hiding this comment

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

had to move the processing code out, otherwise we will have to mock all the external and internal hooks, e.g. useAccount from wagmi, useQueryParams etc in order to render useArbTokenBridge in the test file, which points to an issue of this hook and make it pretty much untestable

@fionnachan fionnachan marked this pull request as ready for review January 8, 2025 15:23
@@ -0,0 +1,101 @@
import { getProviderForChainId } from '@/token-bridge-sdk/utils'
import { ChainId } from '../../util/networks'
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be updated since the reference has changed. Otherwise test fails.

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.

3 participants