Skip to content

Commit 7bd7db7

Browse files
authored
Merge branch 'main' into feat/ramp-non-evm-balance
2 parents 8638db2 + e89842c commit 7bd7db7

File tree

78 files changed

+5122
-1886
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+5122
-1886
lines changed

.github/CODEOWNERS

+3
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ app/components/UI/TemplateRenderer @MetaMask/confirmations @MetaMask/snaps-dev
9696

9797
# Staking Team
9898
app/components/UI/Stake @MetaMask/metamask-staking
99+
app/core/Engine/controllers/earn-controller @MetaMask/metamask-staking
100+
app/core/Engine/messengers/earn-controller-messenger @MetaMask/metamask-staking
101+
app/selectors/earnController @MetaMask/metamask-staking
99102

100103
# Assets Team
101104
app/components/hooks/useIsOriginalNativeTokenSymbol @MetaMask/metamask-assets

app/components/Approvals/AddChainApproval/AddChainApproval.test.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ describe('AddChainApproval', () => {
2727
it('renders', () => {
2828
mockApprovalRequest({
2929
type: ApprovalTypes.ADD_ETHEREUM_CHAIN,
30+
requestData: {},
3031
// TODO: Replace "any" with type
3132
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3233
} as any);

app/components/Approvals/AddChainApproval/AddChainApproval.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,17 @@ const AddChainApproval = () => {
1515

1616
if (approvalRequest?.type !== ApprovalTypes.ADD_ETHEREUM_CHAIN) return null;
1717

18+
const { isNetworkRpcUpdate, ...customNetworkInformation } =
19+
approvalRequest.requestData;
20+
1821
return (
1922
<BottomSheet onClose={onReject} shouldNavigateBack={false}>
2023
<View style={styles.actionsContainer}>
2124
<NetworkVerificationInfo
22-
customNetworkInformation={approvalRequest?.requestData}
25+
customNetworkInformation={customNetworkInformation}
2326
onReject={onReject}
2427
onConfirm={onConfirm}
28+
isNetworkRpcUpdate={isNetworkRpcUpdate}
2529
/>
2630
</View>
2731
</BottomSheet>

app/components/Approvals/AddChainApproval/__snapshots__/AddChainApproval.test.tsx.snap

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ exports[`AddChainApproval renders 1`] = `
1212
}
1313
}
1414
>
15-
<NetworkVerificationInfo />
15+
<NetworkVerificationInfo
16+
customNetworkInformation={{}}
17+
/>
1618
</View>
1719
</ForwardRef>
1820
`;

app/components/Nav/App/index.js

+5
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ import {
145145
} from '../../../util/trace';
146146
import getUIStartupSpan from '../../../core/Performance/UIStartup';
147147
import { Confirm } from '../../Views/confirmations/Confirm';
148+
import { BridgeTokenSelector } from '../../UI/Bridge/BridgeTokenSelector';
148149

149150
const clearStackNavigatorOptions = {
150151
headerShown: false,
@@ -523,6 +524,10 @@ const RootModalFlow = () => (
523524
component={ChangeInSimulationModal}
524525
/>
525526
<Stack.Screen name={Routes.SHEET.TOOLTIP_MODAL} component={TooltipModal} />
527+
<Stack.Screen
528+
name={Routes.SHEET.BRIDGE_TOKEN_SELECTOR}
529+
component={BridgeTokenSelector}
530+
/>
526531
</Stack.Navigator>
527532
);
528533

app/components/Nav/Main/MainNavigator.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ const MainNavigator = () => (
828828
{() => <RampRoutes rampType={RampType.SELL} />}
829829
</Stack.Screen>
830830
<Stack.Screen name="Swaps" component={Swaps} />
831-
<Stack.Screen name="Bridge" component={Bridge} />
831+
<Stack.Screen name={Routes.BRIDGE} component={Bridge} />
832832
<Stack.Screen name="StakeScreens" component={StakeScreenStack} />
833833
<Stack.Screen
834834
name="StakeModals"

app/components/Snaps/SnapUILink/SnapUILink.test.tsx

+1-9
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ describe('SnapUILink', () => {
2525
};
2626

2727
it('renders correctly with valid props', () => {
28-
const { UNSAFE_getByType } = render(
29-
<SnapUILink {...validProps} />,
30-
);
28+
const { UNSAFE_getByType } = render(<SnapUILink {...validProps} />);
3129

3230
const button = UNSAFE_getByType(ButtonLink);
3331
const icon = UNSAFE_getByType(Icon);
@@ -38,12 +36,6 @@ describe('SnapUILink', () => {
3836
expect(icon.props.name).toBe(IconName.Export);
3937
expect(icon.props.color).toBe(IconColor.Primary);
4038
expect(icon.props.size).toBe(IconSize.Sm);
41-
expect(icon.props.style).toEqual({
42-
marginLeft: 2,
43-
justifyContent: 'center',
44-
alignItems: 'center',
45-
alignSelf: 'center',
46-
});
4739
});
4840

4941
it('opens URL when pressed with valid https URL', () => {

app/components/Snaps/SnapUILink/SnapUILink.tsx

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
///: BEGIN:ONLY_INCLUDE_IF(preinstalled-snaps,external-snaps)
22
import { LinkChildren } from '@metamask/snaps-sdk/jsx';
33
import React from 'react';
4-
import { Linking } from 'react-native';
4+
import { Linking, View } from 'react-native';
55
import ButtonLink from '../../../component-library/components/Buttons/Button/variants/ButtonLink';
66
import { TextColor } from '../../../component-library/components/Texts/Text';
77
import Icon, {
@@ -31,13 +31,18 @@ export const SnapUILink: React.FC<SnapUILinkProps> = ({ href, children }) => {
3131
const label = (
3232
<>
3333
{children}
34+
<View
35+
/* eslint-disable-next-line react-native/no-inline-styles */
36+
style={{
37+
width: 4,
38+
}}
39+
/>
3440
<Icon
3541
name={IconName.Export}
3642
color={IconColor.Primary}
3743
size={IconSize.Sm}
3844
/* eslint-disable-next-line react-native/no-inline-styles */
3945
style={{
40-
marginLeft: 2,
4146
justifyContent: 'center',
4247
alignItems: 'center',
4348
alignSelf: 'center',

app/components/UI/AssetOverview/AssetOverview.test.tsx

+20
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,26 @@ describe('AssetOverview', () => {
348348
expect(buyButton).toBeNull();
349349
});
350350

351+
it('should render native balances even if there are no accounts for the asset chain in the state', async () => {
352+
jest.spyOn(networks, 'isPortfolioViewEnabled').mockReturnValue(true);
353+
354+
const container = renderWithProvider(
355+
<AssetOverview
356+
asset={{
357+
...asset,
358+
chainId: '0x2',
359+
isNative: true,
360+
}}
361+
displayBuyButton
362+
displaySwapsButton
363+
swapsIsLive
364+
/>,
365+
{ state: mockInitialState },
366+
);
367+
368+
expect(container).toMatchSnapshot();
369+
});
370+
351371
describe('Portfolio view network switching', () => {
352372
beforeEach(() => {
353373
jest.spyOn(networks, 'isPortfolioViewEnabled').mockReturnValue(true);

app/components/UI/AssetOverview/AssetOverview.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -364,12 +364,12 @@ const AssetOverview: React.FC<AssetOverviewProps> = ({
364364
if (asset.isETH || asset.isNative) {
365365
balance = renderFromWei(
366366
//@ts-expect-error - This should be fixed at the accountsController selector level, ongoing discussion
367-
accountsByChainId[toHexadecimal(chainId)][selectedAddress]?.balance,
367+
accountsByChainId[toHexadecimal(chainId)]?.[selectedAddress]?.balance,
368368
);
369369
balanceFiat = weiToFiat(
370370
hexToBN(
371371
//@ts-expect-error - This should be fixed at the accountsController selector level, ongoing discussion
372-
accountsByChainId[toHexadecimal(chainId)][selectedAddress]?.balance,
372+
accountsByChainId[toHexadecimal(chainId)]?.[selectedAddress]?.balance,
373373
),
374374
conversionRate,
375375
currentCurrency,

0 commit comments

Comments
 (0)