Skip to content

Commit

Permalink
Merge branch 'develop' into refactor-inject-inpage
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmurdoch authored Feb 7, 2024
2 parents 2861767 + 65f5b81 commit 9ae02ae
Show file tree
Hide file tree
Showing 96 changed files with 1,037 additions and 783 deletions.
34 changes: 33 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [11.8.0]
### Added
- Enhanced the Networks List with drag and drop functionality ([#21163] (https://github.com/MetaMask/metamask-extension/pull/21163))
- Added a deprecation warning for the Aurora network to inform users about its upcoming removal ([#21933] (https://github.com/MetaMask/metamask-extension/pull/21933))

### Changed
- Corrected a typo and improved the alignment of 'Terms of use' ([#22227] (https://github.com/MetaMask/metamask-extension/pull/22227))
- Changed the title of MetaMask pop-up window to 'MetaMask Dialog' ([#21680] (https://github.com/MetaMask/metamask-extension/pull/21680))
- Refined the Max fee calculation in Smart Swaps to ensure it does not exceed twice the estimated gas fee ([#22127] (https://github.com/MetaMask/metamask-extension/pull/22127))
- [MMI] Enabled the Cancel and Speed Up options for non-custodial accounts in MetaMask Institutional ([#22164] (https://github.com/MetaMask/metamask-extension/pull/22164))
- [MMI] Updated Consensys URLs from .net to .io ([#22107] (https://github.com/MetaMask/metamask-extension/pull/22107))
- [FLASK] Updated the background color of the Snap Avatar ([#22137] (https://github.com/MetaMask/metamask-extension/pull/22137))
- [FLASK] Updated the color of the tooltip icon in the transaction confirmation section ([#22144] (https://github.com/MetaMask/metamask-extension/pull/22144))
- [FLASK] Updated the weighting of permissions ([#22063] (https://github.com/MetaMask/metamask-extension/pull/22063))

### Fixed
- Improved the token autodetection feature to automatically trigger detection when the setting is enabled ([#21749] (https://github.com/MetaMask/metamask-extension/pull/21749))
- Fixed an issue causing duplicate entries for confirmed incoming transactions ([#21840] (https://github.com/MetaMask/metamask-extension/pull/21840))
- Fixed a rounding issue causing incorrect gas fee displays on the Optimism network ([#19960] (https://github.com/MetaMask/metamask-extension/pull/19960))
- Fixed an issue causing incorrect EIP-6963 provider names in MetaMask production builds ([#22090] (https://github.com/MetaMask/metamask-extension/pull/22090))
- Fixed a crash that occurred when the list of ordered networks was empty ([#22109] (https://github.com/MetaMask/metamask-extension/pull/22109))
- Fixed an issue where the settings search function only supported English and numbers ([#21013] (https://github.com/MetaMask/metamask-extension/pull/21013))

## [11.7.5]
### Fixed
- Fix compatability of MetaMask Extension and Chrome versions v122 and higher [#22590](https://github.com/MetaMask/metamask-extension/pull/22590)

## [11.7.4]

## [11.7.3]
### Fixed
- Ensure fiat token balances are displayed on the homescreen [#22295](https://github.com/MetaMask/metamask-extension/pull/22295)
Expand Down Expand Up @@ -4266,7 +4295,10 @@ Update styles and spacing on the critical error page ([#20350](https://github.c
### Uncategorized
- Added the ability to restore accounts from seed words.

[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v11.7.3...HEAD
[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v11.8.0...HEAD
[11.8.0]: https://github.com/MetaMask/metamask-extension/compare/v11.7.5...v11.8.0
[11.7.5]: https://github.com/MetaMask/metamask-extension/compare/v11.7.4...v11.7.5
[11.7.4]: https://github.com/MetaMask/metamask-extension/compare/v11.7.3...v11.7.4
[11.7.3]: https://github.com/MetaMask/metamask-extension/compare/v11.7.2...v11.7.3
[11.7.2]: https://github.com/MetaMask/metamask-extension/compare/v11.7.1...v11.7.2
[11.7.1]: https://github.com/MetaMask/metamask-extension/compare/v11.7.0...v11.7.1
Expand Down
15 changes: 15 additions & 0 deletions app/scripts/controllers/app-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,21 @@ export default class AppStateController extends EventEmitter {
},
});
}

/**
* Set the setCustodianDeepLink with the fromAddress and custodyId
*
* @param {object} opts
* @param opts.fromAddress
* @param opts.custodyId
* @returns {void}
*/
setCustodianDeepLink({ fromAddress, custodyId }) {
this.store.updateState({
custodianDeepLink: { fromAddress, custodyId },
});
}

///: END:ONLY_INCLUDE_IF

addSignatureSecurityAlertResponse(securityAlertResponse) {
Expand Down
40 changes: 40 additions & 0 deletions app/scripts/controllers/app-state.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,4 +314,44 @@ describe('AppStateController', () => {
updateStateSpy.mockRestore();
});
});

describe('institutional', () => {
it('set the interactive replacement token with a url and the old refresh token', () => {
appStateController = createAppStateController();
const updateStateSpy = jest.spyOn(
appStateController.store,
'updateState',
);

const mockParams = { url: 'https://example.com', oldRefreshToken: 'old' };

appStateController.showInteractiveReplacementTokenBanner(mockParams);

expect(updateStateSpy).toHaveBeenCalledTimes(1);
expect(updateStateSpy).toHaveBeenCalledWith({
interactiveReplacementToken: mockParams,
});

updateStateSpy.mockRestore();
});

it('set the setCustodianDeepLink with the fromAddress and custodyId', () => {
appStateController = createAppStateController();
const updateStateSpy = jest.spyOn(
appStateController.store,
'updateState',
);

const mockParams = { fromAddress: '0x', custodyId: 'custodyId' };

appStateController.setCustodianDeepLink(mockParams);

expect(updateStateSpy).toHaveBeenCalledTimes(1);
expect(updateStateSpy).toHaveBeenCalledWith({
custodianDeepLink: mockParams,
});

updateStateSpy.mockRestore();
});
});
});
5 changes: 5 additions & 0 deletions app/scripts/controllers/mmi-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,11 @@ export default class MMIController extends EventEmitter {
signOperation,
true,
);

this.appStateController.setCustodianDeepLink({
fromAddress: signature.from,
custodyId: signature.custodian_transactionId,
});
}

this.signatureController.setMessageMetadata(messageId, signature);
Expand Down
4 changes: 3 additions & 1 deletion app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -3130,6 +3130,8 @@ export default class MetamaskController extends EventEmitter {
appStateController.showInteractiveReplacementTokenBanner.bind(
appStateController,
),
setCustodianDeepLink:
appStateController.setCustodianDeepLink.bind(appStateController),
///: END:ONLY_INCLUDE_IF

///: BEGIN:ONLY_INCLUDE_IF(snaps)
Expand Down Expand Up @@ -4907,7 +4909,7 @@ export default class MetamaskController extends EventEmitter {
origin,
),
getIsLocked: () => {
return !this.appStateController.isUnlocked;
return !this.appStateController.isUnlocked();
},
///: END:ONLY_INCLUDE_IF
///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "metamask-crx",
"version": "11.7.3",
"version": "11.8.0",
"private": true,
"repository": {
"type": "git",
Expand Down
1 change: 0 additions & 1 deletion test/e2e/accounts/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export const accountSnapFixtures = (title: string | undefined) => {
})
.build(),
ganacheOptions: multipleGanacheOptions,
failOnConsoleError: false,
title,
};
};
Expand Down
3 changes: 0 additions & 3 deletions test/e2e/accounts/create-snap-account.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ describe('Create Snap Account', function (this: Suite) {
{
fixtures: new FixtureBuilder().build(),
ganacheOptions: defaultGanacheOptions,
failOnConsoleError: false,
title: this.test?.fullTitle(),
},
async ({ driver }: { driver: Driver }) => {
Expand Down Expand Up @@ -95,7 +94,6 @@ describe('Create Snap Account', function (this: Suite) {
{
fixtures: new FixtureBuilder().build(),
ganacheOptions: defaultGanacheOptions,
failOnConsoleError: false,
title: this.test?.fullTitle(),
},
async ({ driver }: { driver: Driver }) => {
Expand Down Expand Up @@ -188,7 +186,6 @@ describe('Create Snap Account', function (this: Suite) {
{
fixtures: new FixtureBuilder().build(),
ganacheOptions: defaultGanacheOptions,
failOnConsoleError: false,
title: this.test?.fullTitle(),
},
async ({ driver }: { driver: Driver }) => {
Expand Down
1 change: 0 additions & 1 deletion test/e2e/accounts/remove-account-snap.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ describe('Remove Account Snap', function (this: Suite) {
{
fixtures: new FixtureBuilder().build(),
ganacheOptions: defaultGanacheOptions,
failOnConsoleError: false,
title: this.test?.fullTitle(),
},
async ({ driver }: { driver: Driver }) => {
Expand Down
26 changes: 26 additions & 0 deletions test/e2e/accounts/smart-swap-disabled.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { title } from 'process';
import { Suite } from 'mocha';
import { withFixtures } from '../helpers';
import { Driver } from '../webdriver/driver';
import {
accountSnapFixtures,
installSnapSimpleKeyring,
makeNewAccountAndSwitch,
} from './common';

describe('Smart Swaps', function (this: Suite) {
it('should be disabled for snap accounts', async function () {
await withFixtures(
accountSnapFixtures(title),
async ({ driver }: { driver: Driver }) => {
await installSnapSimpleKeyring(driver, false);
await makeNewAccountAndSwitch(driver);
await driver.clickElement('[data-testid="token-overview-button-swap"]');
await driver.clickElement('[title="Transaction settings"]');
await driver.assertElementNotPresent(
'[data-testid="transaction-settings-smart-swaps-toggle"]',
);
},
);
});
});
1 change: 0 additions & 1 deletion test/e2e/accounts/snap-account-settings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ describe('Add snap account experimental settings', function (this: Suite) {
{
fixtures: new FixtureBuilder().build(),
title: this.test?.fullTitle(),
failOnConsoleError: false,
},
async ({ driver }: { driver: Driver }) => {
await driver.navigate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ describe('Snap Account Signatures and Disconnects', function (this: Suite) {
dapp: true,
fixtures: new FixtureBuilder().build(),
ganacheOptions: multipleGanacheOptions,
failOnConsoleError: false,
title: this.test?.fullTitle(),
},
async ({ driver }: { driver: Driver }) => {
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async function withFixtures(options, testSuite) {
driverOptions,
dappOptions,
title,
failOnConsoleError = true,
ignoredConsoleErrors = [],
dappPath = undefined,
dappPaths,
testSpecificMock = function () {
Expand Down Expand Up @@ -125,8 +125,8 @@ async function withFixtures(options, testSuite) {
webDriver = driver.driver;

if (process.env.SELENIUM_BROWSER === 'chrome') {
await driver.checkBrowserForExceptions(failOnConsoleError);
await driver.checkBrowserForConsoleErrors(failOnConsoleError);
await driver.checkBrowserForExceptions(ignoredConsoleErrors);
await driver.checkBrowserForConsoleErrors(ignoredConsoleErrors);
}

let driverProxy;
Expand Down Expand Up @@ -160,7 +160,7 @@ async function withFixtures(options, testSuite) {
});

const errorsAndExceptions = driver.summarizeErrorsAndExceptions();
if (errorsAndExceptions && failOnConsoleError) {
if (errorsAndExceptions) {
throw new Error(errorsAndExceptions);
}

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/mv3-perf-stats/init-load-stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async function profilePageLoad() {
const parsedLogs = {};
try {
await withFixtures(
{ fixtures: new FixtureBuilder().build(), failOnConsoleError: false },
{ fixtures: new FixtureBuilder().build() },
async ({ driver }) => {
await driver.delay(tinyDelayMs);
await driver.navigate();
Expand Down
1 change: 0 additions & 1 deletion test/e2e/snaps/test-snap-bip-32.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ describe('Test Snap bip-32', function () {
{
fixtures: new FixtureBuilder().build(),
ganacheOptions: defaultGanacheOptions,
failOnConsoleError: false,
title: this.test.fullTitle(),
},
async ({ driver }) => {
Expand Down
1 change: 0 additions & 1 deletion test/e2e/snaps/test-snap-bip-44.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ describe('Test Snap bip-44', function () {
{
fixtures: new FixtureBuilder().build(),
ganacheOptions: defaultGanacheOptions,
failOnConsoleError: false,
title: this.test.fullTitle(),
},
async ({ driver }) => {
Expand Down
1 change: 0 additions & 1 deletion test/e2e/snaps/test-snap-cronjob.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ describe('Test Snap Cronjob', function () {
{
fixtures: new FixtureBuilder().build(),
ganacheOptions: defaultGanacheOptions,
failOnConsoleError: false,
title: this.test.fullTitle(),
},
async ({ driver }) => {
Expand Down
1 change: 0 additions & 1 deletion test/e2e/snaps/test-snap-dialog.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ describe('Test Snap Dialog', function () {
{
fixtures: new FixtureBuilder().build(),
ganacheOptions: defaultGanacheOptions,
failOnConsoleError: false,
title: this.test.fullTitle(),
},
async ({ driver }) => {
Expand Down
1 change: 0 additions & 1 deletion test/e2e/snaps/test-snap-ethprovider.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ describe('Test Snap ethereum_provider', function () {
{
fixtures: new FixtureBuilder().build(),
ganacheOptions: defaultGanacheOptions,
failOnConsoleError: false,
title: this.test.fullTitle(),
},
async ({ driver }) => {
Expand Down
1 change: 0 additions & 1 deletion test/e2e/snaps/test-snap-get-file.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ describe('Test Snap Get File', function () {
{
fixtures: new FixtureBuilder().build(),
ganacheOptions: defaultGanacheOptions,
failOnConsoleError: false,
title: this.test.title,
},
async ({ driver }) => {
Expand Down
1 change: 0 additions & 1 deletion test/e2e/snaps/test-snap-get-locale.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ describe('Test Snap Get Locale', function () {
{
fixtures: new FixtureBuilder().build(),
ganacheOptions: defaultGanacheOptions,
failOnConsoleError: false,
title: this.test.fullTitle(),
},
async ({ driver }) => {
Expand Down
1 change: 0 additions & 1 deletion test/e2e/snaps/test-snap-getentropy.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ describe('Test Snap getEntropy', function () {
{
fixtures: new FixtureBuilder().build(),
ganacheOptions: defaultGanacheOptions,
failOnConsoleError: false,
title: this.test.fullTitle(),
},
async ({ driver }) => {
Expand Down
1 change: 0 additions & 1 deletion test/e2e/snaps/test-snap-homepage.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ describe('Test Snap Homepage', function () {
{
fixtures: new FixtureBuilder().build(),
ganacheOptions: defaultGanacheOptions,
failOnConsoleError: false,
title: this.test.fullTitle(),
},
async ({ driver }) => {
Expand Down
1 change: 0 additions & 1 deletion test/e2e/snaps/test-snap-installed.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ describe('Test Snap Installed', function () {
})
.build(),
ganacheOptions: defaultGanacheOptions,
failOnConsoleError: false,
title: this.test.fullTitle(),
testSpecificMock: mockSegment,
},
Expand Down
1 change: 0 additions & 1 deletion test/e2e/snaps/test-snap-lifecycle.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ describe('Test Snap Lifecycle Hooks', function () {
{
fixtures: new FixtureBuilder().build(),
ganacheOptions: defaultGanacheOptions,
failOnConsoleError: false,
title: this.test.fullTitle(),
},
async ({ driver }) => {
Expand Down
1 change: 0 additions & 1 deletion test/e2e/snaps/test-snap-management.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ describe('Test Snap Management', function () {
{
fixtures: new FixtureBuilder().build(),
ganacheOptions: defaultGanacheOptions,
failOnConsoleError: false,
title: this.test.fullTitle(),
},
async ({ driver }) => {
Expand Down
1 change: 0 additions & 1 deletion test/e2e/snaps/test-snap-managestate.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ describe('Test Snap manageState', function () {
{
fixtures: new FixtureBuilder().build(),
ganacheOptions: defaultGanacheOptions,
failOnConsoleError: false,
title: this.test.fullTitle(),
},
async ({ driver }) => {
Expand Down
1 change: 0 additions & 1 deletion test/e2e/snaps/test-snap-namelookup.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ describe('Test Snap Name Lookup', function () {
{
fixtures: new FixtureBuilder().build(),
ganacheOptions: defaultGanacheOptions,
failOnConsoleError: false,
title: this.test.fullTitle(),
},
async ({ driver }) => {
Expand Down
1 change: 0 additions & 1 deletion test/e2e/snaps/test-snap-networkaccess.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ describe('Test Snap networkAccess', function () {
{
fixtures: new FixtureBuilder().build(),
ganacheOptions: defaultGanacheOptions,
failOnConsoleError: false,
title: this.test.fullTitle(),
},
async ({ driver }) => {
Expand Down
Loading

0 comments on commit 9ae02ae

Please sign in to comment.