Skip to content

Commit

Permalink
chore: set default solana dest token for swaps
Browse files Browse the repository at this point in the history
  • Loading branch information
micaelae committed Feb 27, 2025
1 parent 963278f commit 163cf04
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
10 changes: 10 additions & 0 deletions shared/constants/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,13 @@ export const REFRESH_INTERVAL_MS = 30 * 1000;
export const DEFAULT_MAX_REFRESH_COUNT = 5;

export const STATIC_METAMASK_BASE_URL = 'https://static.cx.metamask.io';

export const SOLANA_USDC_ASSET = {
address:
'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
symbol: 'USDC',
decimals: 6,
image:
'https://static.cx.metamask.io/api/v2/tokenIcons/assets/solana/5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v.png',
chainId: MultichainNetworks.SOLANA,
};
13 changes: 12 additions & 1 deletion ui/pages/bridge/prepare/prepare-bridge-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ import {
} from '../../../selectors';
import { isHardwareKeyring } from '../../../helpers/utils/hardware';
import { SECOND } from '../../../../shared/constants/time';
import { BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE } from '../../../../shared/constants/bridge';
import {
BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE,
SOLANA_USDC_ASSET,
} from '../../../../shared/constants/bridge';
import { getIntlLocale } from '../../../ducks/locale/locale';
import { useIsMultichainSwap } from '../hooks/useIsMultichainSwap';
import { useMultichainSelector } from '../../../hooks/useMultichainSelector';
Expand Down Expand Up @@ -466,6 +469,14 @@ const PrepareBridgePage = () => {
}
}, [fromChain, fromToken, fromTokens, search, isFromTokensLoading]);

// Set the default destination token for the swap
useEffect(() => {
if (isSwap && fromChain && !toToken) {
dispatch(setToChainId(fromChain.chainId));
dispatch(setToToken(SOLANA_USDC_ASSET));
}
}, []);

const isSolanaBridgeEnabled = useSelector(isBridgeSolanaEnabled);

return (
Expand Down

0 comments on commit 163cf04

Please sign in to comment.