From 1b53a49587c773a2d14d733fd92800e76a27ae20 Mon Sep 17 00:00:00 2001 From: nikoferro Date: Fri, 7 Jun 2024 15:00:32 +0200 Subject: [PATCH] fix: restoring web3 import patch --- src/SwapsController.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/SwapsController.ts b/src/SwapsController.ts index 929ff4fc..c53d25f8 100644 --- a/src/SwapsController.ts +++ b/src/SwapsController.ts @@ -21,7 +21,7 @@ import type { Hex } from '@metamask/utils'; import { Mutex } from 'async-mutex'; import { BigNumber } from 'bignumber.js'; import abiERC20 from 'human-standard-token-abi'; -import { Web3 } from 'web3'; +import * as web3 from 'web3'; import type { Web3 as Web3Type } from 'web3'; import type { @@ -59,6 +59,9 @@ import { shouldEnableDirectWrapping, } from './swapsUtil'; +// Hack to fix the issue with the web3 import that works different in app vs tests +const Web3 = web3.Web3 === undefined ? web3.default : web3.Web3; + // Functions to determine type of the return value from GasFeeController /**