1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-25 20:02:58 +01:00

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

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

* chore: clean up url issue
This commit is contained in:
Matthew Epps 2021-10-20 04:07:34 -07:00 committed by ryanml
parent 078ba89ebd
commit 6526a423af
2 changed files with 4 additions and 2 deletions

View File

@ -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,

View File

@ -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,
};