Skip to content

Commit

Permalink
chore: set insufficientBal=true if rpcUrl is tenderly
Browse files Browse the repository at this point in the history
  • Loading branch information
micaelae committed Nov 5, 2024
1 parent 9059226 commit 24a5e46
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
19 changes: 10 additions & 9 deletions app/scripts/controllers/bridge/bridge-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,16 @@ export default class BridgeController extends StaticIntervalPollingController<
);
const provider = this.#getSelectedNetworkClient()?.provider;

const insufficientBal = provider
? !(await hasSufficientBalance(
provider,
walletAddress,
updatedQuoteRequest.srcTokenAddress,
updatedQuoteRequest.srcTokenAmount,
srcChainIdInHex,
))
: true;
const insufficientBal =
provider && !paramsToUpdate.insufficientBal
? !(await hasSufficientBalance(
provider,
walletAddress,
updatedQuoteRequest.srcTokenAddress,
updatedQuoteRequest.srcTokenAmount,
srcChainIdInHex,
))
: true;

this.startPollingByNetworkClientId(srcChainIdInHex, {
...updatedQuoteRequest,
Expand Down
4 changes: 4 additions & 0 deletions ui/pages/bridge/prepare/prepare-bridge-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import { getCurrentCurrency } from '../../../selectors';
import { SECOND } from '../../../../shared/constants/time';
import { Footer } from '../../../components/multichain/pages/page';
import MascotBackgroundAnimation from '../../swaps/mascot-background-animation/mascot-background-animation';
import { getProviderConfig } from '../../../ducks/metamask/metamask';
import { BridgeInputGroup } from './bridge-input-group';
import { BridgeCTAButton } from './bridge-cta-button';

Expand All @@ -75,6 +76,7 @@ const PrepareBridgePage = () => {
const fromAmount = useSelector(getFromAmount);

const slippage = useSelector(getSlippage);
const providerConfig = useSelector(getProviderConfig);

const quoteRequest = useSelector(getQuoteRequest);
const { activeQuote, isLoading } = useSelector(getBridgeQuotes);
Expand Down Expand Up @@ -109,6 +111,7 @@ const PrepareBridgePage = () => {
? Number(hexToDecimal(toChain.chainId))
: undefined,
slippage,
insufficientBal: Boolean(providerConfig?.rpcUrl?.includes('tenderly')),
}),
[
fromToken,
Expand All @@ -117,6 +120,7 @@ const PrepareBridgePage = () => {
toChain?.chainId,
fromAmount,
slippage,
providerConfig,
],
);

Expand Down

0 comments on commit 24a5e46

Please sign in to comment.