1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/ui/helpers/utils/moonpay.ts

23 lines
553 B
TypeScript
Raw Normal View History

import {
BUYABLE_CHAINS_MAP,
CHAIN_IDS,
} from '../../../shared/constants/network';
export const formatMoonpaySymbol = (
symbol: string | null,
chainId: keyof typeof BUYABLE_CHAINS_MAP,
): string | null => {
if (!symbol) {
return symbol;
}
let _symbol = symbol;
if (chainId === CHAIN_IDS.POLYGON || chainId === CHAIN_IDS.BSC) {
_symbol = `${_symbol}_${BUYABLE_CHAINS_MAP?.[
chainId
]?.network.toUpperCase()}`;
} else if (chainId === CHAIN_IDS.AVALANCHE) {
_symbol = `${_symbol}_CCHAIN`;
}
return _symbol;
};