@reservoir0x/relay-kit-ui
Version:
Relay is the Fastest and Cheapest Way to Bridge and Transact Across Chains.
44 lines • 1.69 kB
JavaScript
import defaultMoonPayCurrencies from '../constants/moonPayCurrencies.js';
import { bitcoin } from './bitcoin.js';
import { solana } from './solana.js';
export const convertSupportedCurrencies = (currencies) => {
if (currencies) {
return currencies
.filter((currency) => (currency.type === 'crypto' &&
currency.metadata.chainId &&
currency.metadata.contractAddress) ||
currency.code === 'btc' ||
currency.code.includes('sol'))
.map((currency) => {
currency = currency;
let chainId = currency.metadata.chainId;
let contractAddress = currency.metadata.contractAddress;
if (currency.code === 'btc') {
chainId = `${bitcoin.id}`;
contractAddress = 'bc1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqmql8k8';
}
else if (currency.code.includes('sol')) {
chainId = `${solana.id}`;
if (currency.code === 'sol') {
contractAddress = '11111111111111111111111111111111';
}
}
else {
contractAddress = contractAddress.toLowerCase();
}
return {
name: currency.name,
type: currency.type,
notAllowedCountries: currency.notAllowedCountries,
notAllowedUSStates: currency.notAllowedUSStates,
code: currency.code,
chainId: chainId,
contractAddress: contractAddress
};
});
}
else {
return defaultMoonPayCurrencies;
}
};
//# sourceMappingURL=moonPay.js.map