Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ import { Tooltip, TooltipExtras } from '../Tooltip';
import Fields from '../Field';
import CloseIcon from '../icons/CloseIcon';
import PropTypes from 'prop-types';
import { getNetworkByChainId } from '../../constants/networkData';
import { getCurrencyInternalName } from '../../helpers/formatCurrency';
import useAssets from '../../../../hooks/useAssets';

const ExchangeFormMain = (props) => {
const { secondStep, isDesktopHorizontal, onExchangeClick } = props;
Expand All @@ -50,7 +47,6 @@ const ExchangeFormMain = (props) => {

const [isAnimateSwap, setIsAnimateSwap] = useState(false);
const [animateTimer, setAnimateTimer] = useState(null);
const assets = useAssets();

const { t } = useTranslation();

Expand Down Expand Up @@ -88,13 +84,9 @@ const ExchangeFormMain = (props) => {
!`${currencyFromValue}`.length ||
!`${currencyToValue}`.length;

const walletCurrencies = Object.entries(assets).reduce((acc, [chainId, tokens])=> {
return [...acc, ...tokens.map(token=>`${token.symbol.toLowerCase() === 'matic'? 'pol': token.symbol.toLowerCase() }:${getNetworkByChainId(chainId)?.shortName}`)]
},[])

return (
<Main second={secondStep} isDesktopHorizontal={isDesktopHorizontal}>
<Fields type="from" walletCurrencies={walletCurrencies}/>
<Fields type="from"/>
<Controls>
<Tooltip
trigger="click"
Expand Down Expand Up @@ -156,7 +148,6 @@ const ExchangeFormMain = (props) => {
}}
/>
<SwapRow
$isDisabled={!walletCurrencies.includes(getCurrencyInternalName(currencyTo))}
$isDesktopHorizontal={isDesktopHorizontal}
onClick={onSwap}
>
Expand Down
5 changes: 1 addition & 4 deletions src/apps/simpleswap/components/Field/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { ExchangeContext } from '../../contexts/ExchangeContext';
import {getCurrencyInternalName} from '../../helpers/formatCurrency';
import PropTypes from 'prop-types';

export default function Fields({ type, walletCurrencies }){
export default function Fields({ type }){
const { t } = useTranslation();

const {
Expand Down Expand Up @@ -87,7 +87,6 @@ export default function Fields({ type, walletCurrencies }){
const resultData = currenciesList.filter(
(currency) =>
Object.keys(pairsList).includes(getCurrencyInternalName(currency)) &&
walletCurrencies.includes(getCurrencyInternalName(currency)) &&
getCurrencyInternalName(currencyTo) !== getCurrencyInternalName(currency),
);

Expand All @@ -108,7 +107,6 @@ export default function Fields({ type, walletCurrencies }){
fixedPairs,
search,
currencyFrom,
walletCurrencies
]);

const [list] = useCurrenciesList({
Expand Down Expand Up @@ -246,5 +244,4 @@ export default function Fields({ type, walletCurrencies }){

Fields.propTypes = {
type: PropTypes.string,
walletCurrencies: PropTypes.array,
}