diff --git a/ui/components/app/wallet-overview/coin-buttons.tsx b/ui/components/app/wallet-overview/coin-buttons.tsx index df8e42fdf0d6..63088c9f34b5 100644 --- a/ui/components/app/wallet-overview/coin-buttons.tsx +++ b/ui/components/app/wallet-overview/coin-buttons.tsx @@ -52,6 +52,7 @@ import { getMemoizedUnapprovedTemplatedConfirmations, ///: END:ONLY_INCLUDE_IF getNetworkConfigurationIdByChainId, + isNonEvmAccount, } from '../../../selectors'; import Tooltip from '../../ui/tooltip'; ///: BEGIN:ONLY_INCLUDE_IF(build-main,build-beta,build-flask) @@ -170,6 +171,9 @@ const CoinButtons = ({ const isExternalServicesEnabled = useSelector(getUseExternalServices); + const isNonEvmAccountWithoutExternalServices = + !isExternalServicesEnabled && isNonEvmAccount(account); + const buttonTooltips = { buyButton: [ ///: BEGIN:ONLY_INCLUDE_IF(build-main,build-beta,build-flask) @@ -463,7 +467,11 @@ const CoinButtons = ({ } - disabled={!isSigningEnabled} + disabled={!isSigningEnabled || isNonEvmAccountWithoutExternalServices} label={t('send')} onClick={handleSendOnClick} tooltipRender={(contents: React.ReactElement) => diff --git a/ui/components/app/wallet-overview/non-evm-overview.test.tsx b/ui/components/app/wallet-overview/non-evm-overview.test.tsx index 38db5fd4dc57..bcc8b2e7d30c 100644 --- a/ui/components/app/wallet-overview/non-evm-overview.test.tsx +++ b/ui/components/app/wallet-overview/non-evm-overview.test.tsx @@ -86,6 +86,7 @@ const mockBuyableChainsWithBtc = [...mockBuyableChainsWithoutBtc, mockBtcChain]; const mockMetamaskStore = { ...mockState.metamask, + useExternalServices: true, accountsAssets: { [mockNonEvmAccount.id]: [MultichainNativeAssets.BITCOIN], }, @@ -418,4 +419,23 @@ describe('NonEvmOverview', () => { expect.any(Object), ); }); + + it('disables the Send and Bridge buttons if external services are disabled', () => { + const { queryByTestId } = renderWithProvider( + , + getStore({ + metamask: { + ...mockMetamaskStore, + useExternalServices: false, + }, + }), + ); + + const sendButton = queryByTestId(BTC_OVERVIEW_SEND); + const bridgeButton = queryByTestId(BTC_OVERVIEW_BRIDGE); + expect(sendButton).toBeInTheDocument(); + expect(sendButton).toBeDisabled(); + expect(bridgeButton).toBeInTheDocument(); + expect(bridgeButton).toBeDisabled(); + }); }); diff --git a/ui/selectors/accounts.ts b/ui/selectors/accounts.ts index 0c18028224a4..441beffb8458 100644 --- a/ui/selectors/accounts.ts +++ b/ui/selectors/accounts.ts @@ -27,6 +27,15 @@ export function isSolanaAccount(account: InternalAccount) { return Boolean(account && account.type === DataAccount); } +export function isNonEvmAccount(account: InternalAccount) { + const { P2wpkh } = BtcAccountType; + const { DataAccount } = SolAccountType; + + return Boolean( + account && (account.type === P2wpkh || account.type === DataAccount), + ); +} + export const getInternalAccounts = createSelector( (state: AccountsState) => Object.values(state.metamask.internalAccounts.accounts),