mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +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:
parent
22378e4f72
commit
7b34c7263d
@ -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
|
// _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
|
// 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.
|
// 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) {
|
if (!approvalRequired) {
|
||||||
newQuotes = mapValues(newQuotes, (quote) => ({
|
newQuotes = mapValues(newQuotes, (quote) => ({
|
||||||
...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.
|
// This is mapping for v1 URLs and will be removed once we migrate to v2.
|
||||||
export const METASWAP_CHAINID_API_HOST_MAP = {
|
export const METASWAP_CHAINID_API_HOST_MAP = {
|
||||||
[MAINNET_CHAIN_ID]: METASWAP_ETH_API_HOST,
|
[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,
|
[BSC_CHAIN_ID]: METASWAP_BSC_API_HOST,
|
||||||
[RINKEBY_CHAIN_ID]: SWAPS_TESTNET_HOST,
|
[RINKEBY_CHAIN_ID]: SWAPS_TESTNET_HOST,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user