Skip to content

Commit

Permalink
chore: flip swqp tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
micaelae committed Feb 12, 2025
1 parent cde35de commit 10c2a61
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions ui/pages/bridge/prepare/prepare-bridge-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -471,10 +471,10 @@ const PrepareBridgePage = () => {
disabled={
isSwitchingTemporarilyDisabled ||
!isValidQuoteRequest(quoteRequest, false) ||
!isNetworkAdded(toChain)
(!isSwap && !isNetworkAdded(toChain))
}
onClick={() => {
if (!isNetworkAdded(toChain)) {
if (!isSwap && !isNetworkAdded(toChain)) {
return;
}
setRotateSwitchTokens(!rotateSwitchTokens);
Expand All @@ -483,15 +483,19 @@ const PrepareBridgePage = () => {
event: MetaMetricsEventName.InputSourceDestinationFlipped,
properties: flippedRequestProperties,
});
const toChainClientId =
toChain?.defaultRpcEndpointIndex !== undefined &&
toChain?.rpcEndpoints
? toChain.rpcEndpoints[toChain.defaultRpcEndpointIndex]
.networkClientId
: undefined;
toChainClientId && dispatch(setActiveNetwork(toChainClientId));
if (!isSwap) {
// Only flip networks if bridging
const toChainClientId =
toChain?.defaultRpcEndpointIndex !== undefined &&
toChain?.rpcEndpoints &&
isNetworkAdded(toChain)
? toChain.rpcEndpoints[toChain.defaultRpcEndpointIndex]
.networkClientId
: undefined;
toChainClientId && dispatch(setActiveNetwork(toChainClientId));
fromChain?.chainId && dispatch(setToChainId(fromChain.chainId));
}
dispatch(setFromToken(toToken));
fromChain?.chainId && dispatch(setToChainId(fromChain.chainId));
dispatch(setToToken(fromToken));
}}
/>
Expand Down

0 comments on commit 10c2a61

Please sign in to comment.