Skip to content

Commit

Permalink
Merge branch 'main' into bump-swaps-controller
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmire committed Dec 11, 2024
2 parents 1c2a362 + 2d17939 commit f3c4cc2
Show file tree
Hide file tree
Showing 29 changed files with 896 additions and 1,411 deletions.
15 changes: 9 additions & 6 deletions .js.env.example
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
# Sign up and generate your own keys at pubnub.com
# Then rename this file to ".js.env" and rebuild the app
#
#
# In order for this feature to work properly, you need to
# build metamask-extension from source (https://github.com/MetaMask/metamask-extension)
# and set your the same values there.
#
#
# For more info take a look at https://github.com/MetaMask/metamask-extension/pull/5955

export MM_PUBNUB_SUB_KEY=""
export MM_PUBNUB_PUB_KEY=""
export MM_OPENSEA_KEY=""
export MM_ETHERSCAN_KEY=""
export MM_FOX_CODE="EXAMPLE_FOX_CODE"

# NOTE: Non-MetaMask only, will need to create an account and generate
Expand Down Expand Up @@ -70,6 +69,10 @@ export SEGMENT_FLUSH_EVENT_LIMIT="1"
# URL of security alerts API used to validate dApp requests.
export SECURITY_ALERTS_API_URL="https://security-alerts.api.cx.metamask.io"

# Enable Portfolio View
export PORTFOLIO_VIEW="true"


# Temporary mechanism to enable security alerts API prior to release.
export MM_SECURITY_ALERTS_API_ENABLED="true"
# Firebase
Expand All @@ -81,7 +84,7 @@ export FCM_CONFIG_MESSAGING_SENDER_ID=""
export FCM_CONFIG_APP_ID=""
export GOOGLE_SERVICES_B64_ANDROID=""
export GOOGLE_SERVICES_B64_IOS=""
#Notifications Feature Announcements
# Notifications Feature Announcements
export FEATURES_ANNOUNCEMENTS_ACCESS_TOKEN=
export FEATURES_ANNOUNCEMENTS_SPACE_ID=

Expand All @@ -96,8 +99,8 @@ export MM_PER_DAPP_SELECTED_NETWORK=""

export MM_CHAIN_PERMISSIONS=""

#Multichain feature flag specific to UI changes
# Multichain feature flag specific to UI changes
export MM_MULTICHAIN_V1_ENABLED=""

#Permissions Settings feature flag specific to UI changes
# Permissions Settings feature flag specific to UI changes
export MM_PERMISSIONS_SETTINGS_V1_ENABLED=""
6 changes: 3 additions & 3 deletions app/components/Nav/Main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ const Main = (props) => {
stopIncomingTransactionPolling();

if (showIncomingTransactionsNetworks[chainId]) {
startIncomingTransactionPolling([networkClientId]);
startIncomingTransactionPolling([chainId]);
}
}, [chainId, networkClientId, showIncomingTransactionsNetworks]);

Expand Down Expand Up @@ -178,11 +178,11 @@ const Main = (props) => {
removeNotVisibleNotifications();

BackgroundTimer.runBackgroundTimer(async () => {
await updateIncomingTransactions([props.networkClientId]);
await updateIncomingTransactions([props.chainId]);
}, AppConstants.TX_CHECK_BACKGROUND_FREQUENCY);
}
},
[backgroundMode, removeNotVisibleNotifications, props.networkClientId],
[backgroundMode, removeNotVisibleNotifications, props.chainId],
);

const initForceReload = () => {
Expand Down
13 changes: 13 additions & 0 deletions app/components/UI/AccountSelectorList/AccountSelector.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import { mockNetworkState } from '../../../util/test/network';
import { CHAIN_IDS } from '@metamask/transaction-controller';
import { AccountSelectorListProps } from './AccountSelectorList.types';

// eslint-disable-next-line import/no-namespace
import * as Utils from '../../hooks/useAccounts/utils';

const BUSINESS_ACCOUNT = '0xC4955C0d639D99699Bfd7Ec54d9FaFEe40e4D272';
const PERSONAL_ACCOUNT = '0xd018538C87232FF95acbCe4870629b75640a78E7';

Expand Down Expand Up @@ -125,6 +128,16 @@ const renderComponent = (

describe('AccountSelectorList', () => {
beforeEach(() => {
jest.spyOn(Utils, 'getAccountBalances').mockReturnValueOnce({
balanceETH: '1',
balanceFiat: '$3200.00',
balanceWeiHex: '',
});
jest.spyOn(Utils, 'getAccountBalances').mockReturnValueOnce({
balanceETH: '2',
balanceFiat: '$6400.00',
balanceWeiHex: '',
});
onSelectAccount.mockClear();
onRemoveImportedAccount.mockClear();
});
Expand Down
2 changes: 1 addition & 1 deletion app/components/UI/AssetOverview/AssetOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ const AssetOverview: React.FC<AssetOverviewProps> = ({
: `${balance} ${asset.symbol}`;
}
} else {
mainBalance = `${balance} ${asset.ticker}`;
mainBalance = `${balance} ${asset.isETH ? asset.ticker : asset.symbol}`;
secondaryBalance = exchangeRate ? asset.balanceFiat : '';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2253,7 +2253,7 @@ exports[`AssetOverview should render correctly when portfolio view is enabled 1`
}
testID="main-balance-test-id"
>
0 undefined
0 ETH
</Text>
</View>
</TouchableOpacity>
Expand Down
10 changes: 4 additions & 6 deletions app/components/UI/NetworkCell/NetworkCell.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
import React from 'react';
import { Switch, ImageSourcePropType } from 'react-native';
import { ETHERSCAN_SUPPORTED_NETWORKS } from '@metamask/transaction-controller';
import { useStyles } from '../../../component-library/hooks';
import Cell from '../../../component-library/components/Cells/Cell/Cell';
import { CellVariant } from '../../../component-library/components/Cells/Cell';
import { AvatarVariant } from '../../../component-library/components/Avatars/Avatar/Avatar.types';
import { useTheme } from '../../../util/theme';
import { EtherscanSupportedHexChainId } from '@metamask/preferences-controller';
import styleSheet from './NetworkCell.styles';
import { Hex } from '@metamask/utils';

const supportedNetworks = ETHERSCAN_SUPPORTED_NETWORKS;
interface NetworkCellProps {
name: string;
chainId: EtherscanSupportedHexChainId | keyof typeof supportedNetworks;
chainId: Hex;
imageSource: ImageSourcePropType;
secondaryText: string;
secondaryText?: string;
showIncomingTransactionsNetworks: Record<string, boolean>;
toggleEnableIncomingTransactions: (
chainId: EtherscanSupportedHexChainId,
chainId: Hex,
value: boolean,
) => void;
testID?: string;
Expand Down
2 changes: 1 addition & 1 deletion app/components/UI/Notification/BaseNotification/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ const getTitle = (status, { nonce, amount, assetType }) => {
};

export const getDescription = (status, { amount = null, type = null }) => {
if (amount && typeof amount !== 'object') {
if (amount && typeof amount !== 'object' && type) {
return strings(`notifications.${type}_${status}_message`, { amount });
}
return strings(`notifications.${status}_message`);
Expand Down
Loading

0 comments on commit f3c4cc2

Please sign in to comment.