Fix weth->eth direct wrapping allowance issue (#12405)

* chore: fix weth->eth direct wrapping allowance issue

* chore: clean up url issue
feature/default_network_editable
Matthew Epps 3 years ago committed by GitHub
parent 22378e4f72
commit 7b34c7263d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      app/scripts/controllers/swaps.js
  2. 2
      shared/constants/swaps.js

@ -277,7 +277,9 @@ export default class SwapsController {
// _getERC20Allowance() returns the amount of the token they have approved for withdrawal. If that amount is greater
// than 0, it means that approval has already occured and is not needed. Otherwise, for tokens to be swapped, a new
// call of the ERC-20 approve method is required.
approvalRequired = allowance.eq(0);
approvalRequired =
allowance.eq(0) &&
Object.values(newQuotes)[0].aggregator !== 'wrappedNative';
if (!approvalRequired) {
newQuotes = mapValues(newQuotes, (quote) => ({
...quote,

@ -114,7 +114,7 @@ export const ALLOWED_SWAPS_CHAIN_IDS = {
// This is mapping for v1 URLs and will be removed once we migrate to v2.
export const METASWAP_CHAINID_API_HOST_MAP = {
[MAINNET_CHAIN_ID]: METASWAP_ETH_API_HOST,
[SWAPS_TESTNET_CHAIN_ID]: SWAPS_TESTNET_HOST,
[SWAPS_TESTNET_CHAIN_ID]: `${SWAPS_API_V2_BASE_URL}/networks/1`,
[BSC_CHAIN_ID]: METASWAP_BSC_API_HOST,
[RINKEBY_CHAIN_ID]: SWAPS_TESTNET_HOST,
};

Loading…
Cancel
Save