Skip to content

Commit b478b62

Browse files
authored
Merge pull request #24840 from MetaMask/Version-v11.16.1
Version v11.16.1
2 parents 5b67025 + 78b6874 commit b478b62

File tree

16 files changed

+457
-44
lines changed

16 files changed

+457
-44
lines changed

CHANGELOG.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [11.16.1]
10+
911
## [11.16.0]
1012
### Added
1113
- Revamped the UI for Snap installation and update processes ([#23870](https://github.com/MetaMask/metamask-extension/pull/23870))
@@ -4748,7 +4750,8 @@ Update styles and spacing on the critical error page ([#20350](https://github.c
47484750
- Added the ability to restore accounts from seed words.
47494751

47504752

4751-
[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v11.16.0...HEAD
4753+
[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v11.16.1...HEAD
4754+
[11.16.1]: https://github.com/MetaMask/metamask-extension/compare/v11.16.0...v11.16.1
47524755
[11.16.0]: https://github.com/MetaMask/metamask-extension/compare/v11.15.6...v11.16.0
47534756
[11.15.6]: https://github.com/MetaMask/metamask-extension/compare/v11.15.5...v11.15.6
47544757
[11.15.5]: https://github.com/MetaMask/metamask-extension/compare/v11.15.4...v11.15.5

app/_locales/en/messages.json

+8-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/scripts/lib/transaction/metrics.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ export type TransactionMetricsRequest = {
7676
getEIP1559GasFeeEstimates(options?: FetchGasFeeEstimateOptions): Promise<any>;
7777
getParticipateInMetrics: () => boolean;
7878
getSelectedAddress: () => string;
79-
getTokenStandardAndDetails: () => {
79+
getTokenStandardAndDetails: () => Promise<{
8080
decimals?: string;
8181
balance?: string;
8282
symbol?: string;
8383
standard?: TokenStandard;
84-
};
84+
}>;
8585
getTransaction: (transactionId: string) => TransactionMeta;
8686
provider: Provider;
8787
snapAndHardwareMessenger: SnapAndHardwareMessenger;

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "metamask-crx",
3-
"version": "11.16.0",
3+
"version": "11.16.1",
44
"private": true,
55
"repository": {
66
"type": "git",

shared/modules/transaction.utils.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,12 @@ export async function determineTransactionType(
198198
return { type: TransactionType.simpleSend, getCodeResponse: contractCode };
199199
}
200200

201-
type GetTokenStandardAndDetails = (to: string | undefined) => {
201+
type GetTokenStandardAndDetails = (to: string | undefined) => Promise<{
202202
decimals?: string;
203203
balance?: string;
204204
symbol?: string;
205205
standard?: TokenStandard;
206-
};
206+
}>;
207207
/**
208208
* Given a transaction meta object, determine the asset type that the
209209
* transaction is dealing with, as well as the standard for the token if it
@@ -254,7 +254,7 @@ export async function determineTransactionAssetType(
254254
try {
255255
// We don't need a balance check, so the second parameter to
256256
// getTokenStandardAndDetails is omitted.
257-
const details = getTokenStandardAndDetails(txMeta.txParams.to);
257+
const details = await getTokenStandardAndDetails(txMeta.txParams.to);
258258
if (details.standard) {
259259
return {
260260
assetType:

test/e2e/mmi/pageObjects/mmi-signup-page.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class MMISignUpPage {
1313

1414
readonly agreeBtn: Locator;
1515

16-
readonly noThanksBtn: Locator;
16+
readonly enableBtn: Locator;
1717

1818
readonly passwordTxt: Locator;
1919

@@ -44,9 +44,7 @@ export class MMISignUpPage {
4444
'button:has-text("Confirm Secret Recovery Phrase")',
4545
);
4646
this.agreeBtn = page.locator('button:has-text("I agree")');
47-
this.noThanksBtn = page.locator(
48-
'button:has-text("Don\'t enable enhanced protection")',
49-
);
47+
this.enableBtn = page.locator('button:has-text("Enable")'); // It shows in the Smart Transactions Opt-In Modal.
5048
this.passwordTxt = page.getByTestId('create-password-new');
5149
this.passwordConfirmTxt = page.getByTestId('create-password-confirm');
5250
this.agreeCheck = page.getByTestId('create-new-vault__terms-checkbox');

test/e2e/mock-e2e.js

+11
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,17 @@ async function setupMocking(server, testSpecificMock, { chainId }) {
577577
await mockLensNameProvider(server);
578578
await mockTokenNameProvider(server, chainId);
579579

580+
// IPFS endpoint for NFT metadata
581+
await server
582+
.forGet(
583+
'https://bafybeidxfmwycgzcp4v2togflpqh2gnibuexjy4m4qqwxp7nh3jx5zlh4y.ipfs.dweb.link/1.json',
584+
)
585+
.thenCallback(() => {
586+
return {
587+
statusCode: 200,
588+
};
589+
});
590+
580591
/**
581592
* Returns an array of alphanumerically sorted hostnames that were requested
582593
* during the current test suite.

test/e2e/vault-decryption-chrome.spec.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,13 @@ async function getExtensionStorageFilePath(driver) {
5050
*/
5151
async function closePopoverIfPresent(driver) {
5252
const popoverButtonSelector = '[data-testid="popover-close"]';
53-
const linkNoThanks = {
54-
text: "Don't enable enhanced protection",
53+
// It shows in the Smart Transactions Opt-In Modal.
54+
const enableButtonSelector = {
55+
text: 'Enable',
5556
tag: 'button',
5657
};
5758
await driver.clickElementSafe(popoverButtonSelector);
58-
await driver.clickElementSafe(linkNoThanks);
59+
await driver.clickElementSafe(enableButtonSelector);
5960
}
6061

6162
/**
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`SmartTransactionsOptInModal displays the correct text in the modal 1`] = `<div />`;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import React from 'react';
2+
import { fireEvent } from '@testing-library/react';
3+
import thunk from 'redux-thunk';
4+
import configureMockStore from 'redux-mock-store';
5+
import { useHistory } from 'react-router-dom';
6+
7+
import {
8+
renderWithProvider,
9+
createSwapsMockStore,
10+
} from '../../../../test/jest';
11+
import { setSmartTransactionsOptInStatus } from '../../../store/actions';
12+
import { ADVANCED_ROUTE } from '../../../helpers/constants/routes';
13+
import SmartTransactionsOptInModal from './smart-transactions-opt-in-modal';
14+
15+
const middleware = [thunk];
16+
17+
jest.mock('../../../store/actions');
18+
19+
describe('SmartTransactionsOptInModal', () => {
20+
it('displays the correct text in the modal', () => {
21+
const store = configureMockStore(middleware)(createSwapsMockStore());
22+
const { getByText, container } = renderWithProvider(
23+
<SmartTransactionsOptInModal
24+
isOpen={true}
25+
hideWhatsNewPopup={jest.fn()}
26+
/>,
27+
store,
28+
);
29+
expect(getByText('Enable')).toBeInTheDocument();
30+
expect(getByText('Manage in settings')).toBeInTheDocument();
31+
expect(container).toMatchSnapshot();
32+
});
33+
34+
it('calls setSmartTransactionsOptInStatus with false when the "Manage in settings" link is clicked and redirects to Advanced Settings', () => {
35+
(setSmartTransactionsOptInStatus as jest.Mock).mockImplementationOnce(() =>
36+
jest.fn(),
37+
);
38+
const historyPushMock = jest.fn();
39+
(useHistory as jest.Mock).mockImplementationOnce(() => ({
40+
push: historyPushMock,
41+
}));
42+
const store = configureMockStore(middleware)(createSwapsMockStore());
43+
const { getByText } = renderWithProvider(
44+
<SmartTransactionsOptInModal
45+
isOpen={true}
46+
hideWhatsNewPopup={jest.fn()}
47+
/>,
48+
store,
49+
);
50+
const manageInSettingsLink = getByText('Manage in settings');
51+
fireEvent.click(manageInSettingsLink);
52+
expect(setSmartTransactionsOptInStatus).toHaveBeenCalledWith(false);
53+
expect(historyPushMock).toHaveBeenCalledWith(
54+
`${ADVANCED_ROUTE}#smart-transactions`,
55+
);
56+
});
57+
58+
it('calls setSmartTransactionsOptInStatus with true when the "Enable" button is clicked', () => {
59+
(setSmartTransactionsOptInStatus as jest.Mock).mockImplementationOnce(() =>
60+
jest.fn(),
61+
);
62+
const store = configureMockStore(middleware)(createSwapsMockStore());
63+
const { getByText } = renderWithProvider(
64+
<SmartTransactionsOptInModal
65+
isOpen={true}
66+
hideWhatsNewPopup={jest.fn()}
67+
/>,
68+
store,
69+
);
70+
const enableButton = getByText('Enable');
71+
fireEvent.click(enableButton);
72+
expect(setSmartTransactionsOptInStatus).toHaveBeenCalledWith(true);
73+
});
74+
});

ui/components/app/smart-transactions/smart-transactions-opt-in-modal.tsx

+14-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { useCallback, useEffect } from 'react';
2+
import { useHistory } from 'react-router-dom';
23
import { useDispatch } from 'react-redux';
34

45
import { useI18nContext } from '../../../hooks/useI18nContext';
@@ -30,6 +31,7 @@ import {
3031
} from '../../component-library';
3132
import { setSmartTransactionsOptInStatus } from '../../../store/actions';
3233
import { SMART_TRANSACTIONS_LEARN_MORE_URL } from '../../../../shared/constants/smartTransactions';
34+
import { ADVANCED_ROUTE } from '../../../helpers/constants/routes';
3335

3436
export type SmartTransactionsOptInModalProps = {
3537
isOpen: boolean;
@@ -73,10 +75,10 @@ const EnableSmartTransactionsButton = ({
7375
);
7476
};
7577

76-
const NoThanksLink = ({
77-
handleNoThanksLinkClick,
78+
const ManageInSettingsLink = ({
79+
handleManageInSettingsLinkClick,
7880
}: {
79-
handleNoThanksLinkClick: () => void;
81+
handleManageInSettingsLinkClick: () => void;
8082
}) => {
8183
const t = useI18nContext();
8284
return (
@@ -85,11 +87,11 @@ const NoThanksLink = ({
8587
type="link"
8688
variant={ButtonVariant.Link}
8789
color={TextColor.textAlternative}
88-
onClick={handleNoThanksLinkClick}
90+
onClick={handleManageInSettingsLinkClick}
8991
width={BlockSize.Full}
9092
className="mm-smart-transactions-opt-in-modal__no-thanks-link"
9193
>
92-
{t('dontEnableEnhancedProtection')}
94+
{t('manageInSettings')}
9395
</Button>
9496
);
9597
};
@@ -164,13 +166,16 @@ export default function SmartTransactionsOptInModal({
164166
}: SmartTransactionsOptInModalProps) {
165167
const t = useI18nContext();
166168
const dispatch = useDispatch();
169+
const history = useHistory();
167170

168171
const handleEnableButtonClick = useCallback(() => {
169172
dispatch(setSmartTransactionsOptInStatus(true));
170173
}, [dispatch]);
171174

172-
const handleNoThanksLinkClick = useCallback(() => {
175+
const handleManageInSettingsLinkClick = useCallback(() => {
176+
// Set the Smart Transactions opt-in status to false, so the opt-in modal is not shown again.
173177
dispatch(setSmartTransactionsOptInStatus(false));
178+
history.push(`${ADVANCED_ROUTE}#smart-transactions`);
174179
}, [dispatch]);
175180

176181
useEffect(() => {
@@ -210,7 +215,9 @@ export default function SmartTransactionsOptInModal({
210215
<EnableSmartTransactionsButton
211216
handleEnableButtonClick={handleEnableButtonClick}
212217
/>
213-
<NoThanksLink handleNoThanksLinkClick={handleNoThanksLinkClick} />
218+
<ManageInSettingsLink
219+
handleManageInSettingsLinkClick={handleManageInSettingsLinkClick}
220+
/>
214221
</Box>
215222
</ModalContent>
216223
</Modal>

ui/pages/home/home.component.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -840,10 +840,8 @@ export default class Home extends PureComponent {
840840
!process.env.IN_TEST &&
841841
!newNetworkAddedConfigurationId;
842842

843-
// TODO(dbrans): temporary fix to disable the smart transactions opt-in modal
844-
// in 11.15 to unblock the release. Change this line in 11.16.
845843
const showSmartTransactionsOptInModal =
846-
false && canSeeModals && isSmartTransactionsOptInModalAvailable;
844+
canSeeModals && isSmartTransactionsOptInModalAvailable;
847845

848846
const showWhatsNew =
849847
canSeeModals &&

ui/pages/settings/advanced-tab/__snapshots__/advanced-tab.component.test.js.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ exports[`AdvancedTab Component should match snapshot 1`] = `
8080
>
8181
<span>
8282
83-
Turn on Smart Transactions for more reliable and secure transactions on ETH Mainnet.
83+
Turn on Smart Transactions for more reliable and secure transactions on Ethereum Mainnet.
8484
<a
8585
class="mm-box mm-text mm-button-base mm-button-link mm-button-link--size-inherit mm-text--body-md-medium mm-box--padding-0 mm-box--padding-right-0 mm-box--padding-left-0 mm-box--display-inline-flex mm-box--justify-content-center mm-box--align-items-center mm-box--color-primary-default mm-box--background-color-transparent"
8686
href="https://support.metamask.io/transactions-and-gas/transactions/smart-transactions/"

0 commit comments

Comments
 (0)