1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-29 23:58:06 +01:00
metamask-extension/ui/helpers/utils/moonpay.js
Nicolas Ferro 3f801e377d
Ability to buy tokens with Moonpay (#15924)
* Ability to buy tokens with Moonpay

* fix for test cases failing

* updated description for MoonPayChainSettings type

* removed test results
2022-09-23 09:38:40 -07:00

20 lines
503 B
JavaScript

import {
BUYABLE_CHAINS_MAP,
CHAIN_IDS,
} from '../../../shared/constants/network';
export const formatMoonpaySymbol = (symbol, chainId = CHAIN_IDS.MAINNET) => {
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;
};