Replace logic for eth swap token in fetchQuotesAndSetQuoteState with getSwapsEthToken call (#10624)

feature/default_network_editable
Dan J Miller 4 years ago committed by GitHub
parent 669ab187a1
commit 9339278d3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      ui/app/ducks/swaps/swaps.js

@ -41,7 +41,6 @@ import {
decimalToHex, decimalToHex,
getValueFromWeiHex, getValueFromWeiHex,
decGWEIToHexWEI, decGWEIToHexWEI,
hexToDecimal,
hexWEIToDecGWEI, hexWEIToDecGWEI,
} from '../../helpers/utils/conversions.util'; } from '../../helpers/utils/conversions.util';
import { conversionLessThan } from '../../helpers/utils/conversion-util'; import { conversionLessThan } from '../../helpers/utils/conversion-util';
@ -50,11 +49,11 @@ import {
getSelectedAccount, getSelectedAccount,
getTokenExchangeRates, getTokenExchangeRates,
getUSDConversionRate, getUSDConversionRate,
getSwapsEthToken,
} from '../../selectors'; } from '../../selectors';
import { import {
ERROR_FETCHING_QUOTES, ERROR_FETCHING_QUOTES,
QUOTES_NOT_AVAILABLE_ERROR, QUOTES_NOT_AVAILABLE_ERROR,
ETH_SWAPS_TOKEN_OBJECT,
SWAP_FAILED_ERROR, SWAP_FAILED_ERROR,
SWAPS_FETCH_ORDER_CONFLICT, SWAPS_FETCH_ORDER_CONFLICT,
} from '../../helpers/constants/swaps'; } from '../../helpers/constants/swaps';
@ -396,15 +395,7 @@ export const fetchQuotesAndSetQuoteState = (
const balanceError = getBalanceError(state); const balanceError = getBalanceError(state);
const fetchParamsFromToken = const fetchParamsFromToken =
fetchParams?.metaData?.sourceTokenInfo?.symbol === 'ETH' fetchParams?.metaData?.sourceTokenInfo?.symbol === 'ETH'
? { ? getSwapsEthToken(state)
...ETH_SWAPS_TOKEN_OBJECT,
string: getValueFromWeiHex({
value: selectedAccount.balance,
numberOfDecimals: 4,
toDenomination: 'ETH',
}),
balance: hexToDecimal(selectedAccount.balance),
}
: fetchParams?.metaData?.sourceTokenInfo; : fetchParams?.metaData?.sourceTokenInfo;
const selectedFromToken = getFromToken(state) || fetchParamsFromToken || {}; const selectedFromToken = getFromToken(state) || fetchParamsFromToken || {};
const selectedToToken = const selectedToToken =

Loading…
Cancel
Save