-
Notifications
You must be signed in to change notification settings - Fork 213
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: Add new routes components #2279
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
||
/** | ||
* Display CCTP routes: | ||
* - Mainnet/Arb1, Sepolia/ArbSepolia |
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.
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.
Also should we have a permanent route option for opening 3rd party bridge's dialog?
* - Mainnet/Arb1, Sepolia/ArbSepolia | ||
* - Native USDC on Arbitrum, USDC on L1 | ||
* Display layerzero: | ||
* - Mainnet/Arb1, Sepolia/ArbSepolia |
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.
LayerZero OFT v2 is only available for mainnets at the moment, not Sepolia/ArbSepolia.
if (isOftV2Transfer) { | ||
return ( | ||
<Wrapper> | ||
<LayerZeroRoute onRouteSelected={onRouteSelected} /> |
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.
I'd recommend this be named as OftV2Route
and not layerzero since OFT v1 is quite different from this, and it will be confusing if we even plan on integrating it.
<div | ||
className={twMerge( | ||
'group cursor-pointer rounded border border-[#ffffff33] text-white transition-colors', | ||
selected && 'border-white' |
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.
@@ -1188,11 +1197,9 @@ export function TransferPanel() { | |||
)} | |||
> | |||
<TransferPanelMain /> | |||
<Routes onRouteSelected={setSelectedRoute} /> |
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.
I think when there is only 1 route option, it should show selected by default (currently it isn't showing which route is selected on load), and if we're not selecting any route by default then the move funds button should be disabled.
Also, if multiple routes are an option then are we selecting the first route by default?

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.
By default no route are selected
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.
That was my thought as well, seems like an UX issue. No routes are selected by default, but the transfer button is enabled so there is a default route. IMHO a route should be always selected in that case, or the transfer button should be disabled.
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.
Yep, some logic was missing, it's fixed now. Button is disabled until we select a route. But it make sense to auto select a route if we have only one, good point
@@ -0,0 +1,22 @@ | |||
import { create } from 'zustand' | |||
|
|||
export type RouteType = 'arbitrum' | 'layerzero' | 'cctp' |
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.
I think this should be an enum, and this should come from bridge-sdk
and should be linked with transfer-type otherwise we're creating a lot of disjointed types trying to express the same information?
Eg. in bridge-sdk, we have TransferType =
${Asset}_${TxType} | 'cctp' | 'oftV2'
.
At the very least the Route names and Transfer type names should be consistent.
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.
TransferType carries a lot of information that we don't need, we have only 3 types here. And TransferType has 8. Also in ArbitrumRoute for example we would have a transferType that might be different than the actual transfer
{isLoadingGasEstimate ? ( | ||
<Loader size="small" color="white" /> | ||
) : gasCost ? ( | ||
formatAmount(BigNumber.from(gasCost), { |
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.
Are we okay with removing the feature of showing the fiat/dollar value of the gas fee? IMHO it's a pretty useful feature.
* If source and destination chains are using the same currency, we display combined cost for both child and parent chain. | ||
* If they use a different currency, we display cost for child chain only | ||
*/ | ||
const gasCost = |
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.
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.
As discussed offline, we should also cover existing cases where ETH + native gas token gas is shown together
packages/arb-token-bridge-ui/src/components/TransferPanel/MoveFundsButton.tsx
Outdated
Show resolved
Hide resolved
height={15} | ||
alt="duration" | ||
/> | ||
<span className="ml-1"> |
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.
Could we also add the old tooltip and the bolt icon for fast withdrawals?
Old source:
Lines 337 to 351 in 9ab3102
{fastWithdrawalActive && ( | |
<div className="flex items-center"> | |
<Tooltip | |
content={ | |
'Fast Withdrawals relies on a committee of validators. In the event of a committee outage, your withdrawal falls back to the 7 day challenge period secured by Arbitrum Fraud Proofs.' | |
} | |
> | |
<InformationCircleIcon className="h-3 w-3 sm:ml-1" /> | |
</Tooltip> | |
<div className="ml-1 flex space-x-0.5 text-[#FFD000]"> | |
<Image src={LightningIcon} alt="Lightning Icon" /> | |
<span className="font-normal">FAST</span> | |
</div> | |
</div> | |
)} |
* If source and destination chains are using the same currency, we display combined cost for both child and parent chain. | ||
* If they use a different currency, we display cost for child chain only | ||
*/ | ||
const gasCost = |
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.
As discussed offline, we should also cover existing cases where ETH + native gas token gas is shown together
*/ | ||
const isUsdcTransfer = isTokenNativeUSDC(token?.address) | ||
const overrideToken = isDepositMode ? bridgedUsdcToken : nativeUsdcToken | ||
const duration = |
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.
nit: could we rename duration
to durationMs
so it's easier to understand right away
<span className="ml-1">{bridge}</span> | ||
</div> | ||
</div> | ||
{tag && ( |
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.
<div className="flex flex-col"> | ||
<span>You will receive:</span> | ||
<div className="flex items-center text-lg"> | ||
{'logoURI' in 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.
Can we use this instead? It also handles native token logos. You don't have to specify logoURI with this one, by default it will use the selected token logo.
@@ -135,7 +135,9 @@ export function getWithdrawalConfirmationDate({ | |||
return dayjs(createdAt).add(confirmationTimeInSeconds, 'second') | |||
} | |||
|
|||
function getWithdrawalDuration(tx: MergedTransaction) { | |||
export function getWithdrawalDuration( | |||
tx: Pick<MergedTransaction, 'createdAt' | 'sourceChainId'> |
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 could also change tx
to { createdAt, sourceChainId }
Showing routes has a delay after typing amount. Maybe we could have some loading state? Screen.Recording.2025-02-26.at.16.50.12.mov |
|
function getGasCostAndToken({ | ||
childChainNativeCurrency, | ||
parentChainNativeCurrency, | ||
gasSummaryStatus, | ||
estimatedChildChainGasFees, | ||
estimatedParentChainGasFees, | ||
isDepositMode, | ||
selectedToken | ||
}: { | ||
childChainNativeCurrency: NativeCurrency | ||
parentChainNativeCurrency: NativeCurrency | ||
gasSummaryStatus: UseGasSummaryResult['status'] | ||
estimatedChildChainGasFees: UseGasSummaryResult['estimatedChildChainGasFees'] | ||
estimatedParentChainGasFees: UseGasSummaryResult['estimatedParentChainGasFees'] | ||
isDepositMode: boolean | ||
selectedToken: ERC20BridgeToken | null | ||
}): { |
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 function is accepting lots of parameters rather than being a hook with lots of internal calls to hook to make it easier to test
561c903
to
e7ad9ce
Compare
BREAKING CHANGES: Removed TransferPanelSummary
9b22d5a
to
b96cedb
Compare
BREAKING CHANGES: Removed TransferPanelSummary
Summary
Steps to test