-
Notifications
You must be signed in to change notification settings - Fork 211
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
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -198,7 +200,7 @@ export function TokenApprovalDialog(props: TokenApprovalDialogProps) { | |||
isCctp, | |||
isDepositMode, | |||
parentChainProvider, | |||
token?.address, | |||
token, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
const { bridgeTokensToAdd, candidateUnbridgedTokensToAdd } = | ||
await processTokensFromList({ | ||
arbTokenList, | ||
listId, | ||
parentChainId: l1ChainID, | ||
childChainId: l2ChainID | ||
}) |
There was a problem hiding this comment.
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
@@ -0,0 +1,101 @@ | |||
import { getProviderForChainId } from '@/token-bridge-sdk/utils' | |||
import { ChainId } from '../../util/networks' |
There was a problem hiding this comment.
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.
Closes FS-1072