Skip to content

Commit

Permalink
Merge branch 'develop' into chore/bump-browser-passworder
Browse files Browse the repository at this point in the history
  • Loading branch information
legobeat committed Dec 4, 2023
2 parents b9df8b3 + 5ac1d27 commit aad500d
Show file tree
Hide file tree
Showing 161 changed files with 3,693 additions and 3,430 deletions.
2 changes: 1 addition & 1 deletion .github/pull-request-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Write a short description of the changes included in this pull request, also inc

## **Related issues**

Fixes: #
Fixes:

## **Manual testing steps**

Expand Down
19 changes: 19 additions & 0 deletions .storybook/test-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,26 @@ const state = {
balance: '0x15f6f0b9d4f8d000',
},
},
accountsByChainId: {
'0x5': {
'0x64a845a5b02460acf8a3d84503b0d68d028b4bb4': {
address: '0x64a845a5b02460acf8a3d84503b0d68d028b4bb4',
balance: '0x176e5b6f173ebe66',
},
'0xb19ac54efa18cc3a14a5b821bfec73d284bf0c5e': {
address: '0xb19ac54efa18cc3a14a5b821bfec73d284bf0c5e',
balance: '0x2d3142f5000',
},
'0x9d0ba4ddac06032527b140912ec808ab9451b788': {
address: '0x9d0ba4ddac06032527b140912ec808ab9451b788',
balance: '0x15f6f0b9d4f8d000',
},
},
},
currentBlockGasLimit: '0x793af4',
currentBlockGasLimitByChainId: {
'0x5': '0x793af4'
},
transactions: [
{
chainId: '0x38',
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [11.6.3]
### Fixed
- Fixed a problem related with passing the wrong method name to TransactionController ([#22102](https://github.com/MetaMask/metamask-extension/pull/22102))

## [11.6.2]
### Fixed
- Fixed a problem with including links in Snaps custom UI ([#22086](https://github.com/MetaMask/metamask-extension/pull/22086))
Expand Down Expand Up @@ -4213,7 +4217,8 @@ 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.6.2...HEAD
[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v11.6.3...HEAD
[11.6.3]: https://github.com/MetaMask/metamask-extension/compare/v11.6.2...v11.6.3
[11.6.2]: https://github.com/MetaMask/metamask-extension/compare/v11.6.1...v11.6.2
[11.6.1]: https://github.com/MetaMask/metamask-extension/compare/v11.6.0...v11.6.1
[11.6.0]: https://github.com/MetaMask/metamask-extension/compare/v11.5.2...v11.6.0
Expand Down
46 changes: 24 additions & 22 deletions app/scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import log from 'loglevel';
import browser from 'webextension-polyfill';
import { storeAsStream } from '@metamask/obs-store';
import { isObject } from '@metamask/utils';
///: BEGIN:ONLY_INCLUDE_IN(snaps)
///: BEGIN:ONLY_INCLUDE_IF(snaps)
import { ApprovalType } from '@metamask/controller-utils';
///: END:ONLY_INCLUDE_IN
///: END:ONLY_INCLUDE_IF
import PortStream from 'extension-port-stream';

import { ethErrors } from 'eth-rpc-errors';
Expand All @@ -28,9 +28,9 @@ import {
ENVIRONMENT_TYPE_FULLSCREEN,
EXTENSION_MESSAGES,
PLATFORM_FIREFOX,
///: BEGIN:ONLY_INCLUDE_IN(keyring-snaps)
///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps)
SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES,
///: END:ONLY_INCLUDE_IN
///: END:ONLY_INCLUDE_IF
} from '../../shared/constants/app';
import {
REJECT_NOTIFICATION_CLOSE,
Expand Down Expand Up @@ -65,13 +65,13 @@ import { deferredPromise, getPlatform } from './lib/util';
/* eslint-enable import/first */

/* eslint-disable import/order */
///: BEGIN:ONLY_INCLUDE_IN(desktop)
///: BEGIN:ONLY_INCLUDE_IF(desktop)
import {
CONNECTION_TYPE_EXTERNAL,
CONNECTION_TYPE_INTERNAL,
} from '@metamask/desktop/dist/constants';
import DesktopManager from '@metamask/desktop/dist/desktop-manager';
///: END:ONLY_INCLUDE_IN
///: END:ONLY_INCLUDE_IF
/* eslint-enable import/order */

// Setup global hook for improved Sentry state snapshots during initialization
Expand Down Expand Up @@ -114,12 +114,12 @@ const ONE_SECOND_IN_MILLISECONDS = 1_000;
// Timeout for initializing phishing warning page.
const PHISHING_WARNING_PAGE_TIMEOUT = ONE_SECOND_IN_MILLISECONDS;

///: BEGIN:ONLY_INCLUDE_IN(desktop)
///: BEGIN:ONLY_INCLUDE_IF(desktop)
const OVERRIDE_ORIGIN = {
EXTENSION: 'EXTENSION',
DESKTOP: 'DESKTOP_APP',
};
///: END:ONLY_INCLUDE_IN
///: END:ONLY_INCLUDE_IF

// Event emitter for state persistence
export const statePersistenceEvents = new EventEmitter();
Expand Down Expand Up @@ -238,7 +238,9 @@ function saveTimestamp() {
* @property {string} providerConfig.type - An identifier for the type of network selected, allows MetaMask to use custom provider strategies for known networks.
* @property {string} networkStatus - Either "unknown", "available", "unavailable", or "blocked", depending on the status of the currently selected network.
* @property {object} accounts - An object mapping lower-case hex addresses to objects with "balance" and "address" keys, both storing hex string values.
* @property {object} accountsByChainId - An object mapping lower-case hex addresses to objects with "balance" and "address" keys, both storing hex string values keyed by chain id.
* @property {hex} currentBlockGasLimit - The most recently seen block gas limit, in a lower case hex prefixed string.
* @property {object} currentBlockGasLimitByChainId - The most recently seen block gas limit, in a lower case hex prefixed string keyed by chain id.
* @property {object} unapprovedMsgs - An object of messages pending approval, mapping a unique ID to the options.
* @property {number} unapprovedMsgCount - The number of messages in unapprovedMsgs.
* @property {object} unapprovedPersonalMsgs - An object of messages pending approval, mapping a unique ID to the options.
Expand Down Expand Up @@ -274,9 +276,9 @@ async function initialize() {
const initState = initData.data;
const initLangCode = await getFirstPreferredLangCode();

///: BEGIN:ONLY_INCLUDE_IN(desktop)
///: BEGIN:ONLY_INCLUDE_IF(desktop)
await DesktopManager.init(platform.getVersion());
///: END:ONLY_INCLUDE_IN
///: END:ONLY_INCLUDE_IF

let isFirstMetaMaskControllerSetup;
if (isManifestV3) {
Expand Down Expand Up @@ -565,7 +567,7 @@ export function setupController(
* @param {Port} remotePort - The port provided by a new context.
*/
connectRemote = async (remotePort) => {
///: BEGIN:ONLY_INCLUDE_IN(desktop)
///: BEGIN:ONLY_INCLUDE_IF(desktop)
if (
DesktopManager.isDesktopEnabled() &&
OVERRIDE_ORIGIN.DESKTOP !== overrides?.getOrigin?.()
Expand All @@ -583,7 +585,7 @@ export function setupController(
);
return;
}
///: END:ONLY_INCLUDE_IN
///: END:ONLY_INCLUDE_IF

const processName = remotePort.name;

Expand Down Expand Up @@ -677,15 +679,15 @@ export function setupController(

// communication with page or other extension
connectExternal = (remotePort) => {
///: BEGIN:ONLY_INCLUDE_IN(desktop)
///: BEGIN:ONLY_INCLUDE_IF(desktop)
if (
DesktopManager.isDesktopEnabled() &&
OVERRIDE_ORIGIN.DESKTOP !== overrides?.getOrigin?.()
) {
DesktopManager.createStream(remotePort, CONNECTION_TYPE_EXTERNAL);
return;
}
///: END:ONLY_INCLUDE_IN
///: END:ONLY_INCLUDE_IF

const portStream =
overrides?.getPortStream?.(remotePort) || new PortStream(remotePort);
Expand Down Expand Up @@ -803,22 +805,22 @@ export function setupController(
Object.values(controller.approvalController.state.pendingApprovals).forEach(
({ id, type }) => {
switch (type) {
///: BEGIN:ONLY_INCLUDE_IN(snaps)
///: BEGIN:ONLY_INCLUDE_IF(snaps)
case ApprovalType.SnapDialogAlert:
case ApprovalType.SnapDialogPrompt:
controller.approvalController.accept(id, null);
break;
case ApprovalType.SnapDialogConfirmation:
controller.approvalController.accept(id, false);
break;
///: END:ONLY_INCLUDE_IN
///: BEGIN:ONLY_INCLUDE_IN(keyring-snaps)
///: END:ONLY_INCLUDE_IF
///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps)
case SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES.confirmAccountCreation:
case SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES.confirmAccountRemoval:
case SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES.showSnapAccountRedirect:
controller.approvalController.accept(id, false);
break;
///: END:ONLY_INCLUDE_IN
///: END:ONLY_INCLUDE_IF
default:
controller.approvalController.reject(
id,
Expand All @@ -830,20 +832,20 @@ export function setupController(
);
}

///: BEGIN:ONLY_INCLUDE_IN(desktop)
///: BEGIN:ONLY_INCLUDE_IF(desktop)
if (OVERRIDE_ORIGIN.DESKTOP !== overrides?.getOrigin?.()) {
controller.store.subscribe((state) => {
DesktopManager.setState(state);
});
}
///: END:ONLY_INCLUDE_IN
///: END:ONLY_INCLUDE_IF

///: BEGIN:ONLY_INCLUDE_IN(snaps)
///: BEGIN:ONLY_INCLUDE_IF(snaps)
// Updates the snaps registry and check for newly blocked snaps to block if the user has at least one snap installed.
if (Object.keys(controller.snapController.state.snaps).length > 0) {
controller.snapController.updateBlockedSnaps();
}
///: END:ONLY_INCLUDE_IN
///: END:ONLY_INCLUDE_IF
}

//
Expand Down
32 changes: 14 additions & 18 deletions app/scripts/constants/contracts.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
export const SINGLE_CALL_BALANCES_ADDRESS =
'0xb1f8e55c7f64d203c1400b9d8555d050f94adf39';
export const SINGLE_CALL_BALANCES_ADDRESS_GOERLI =
'0x9788C4E93f9002a7ad8e72633b11E8d1ecd51f9b';
// TODO(SEPOLIA) There is currently no balance call address for Sepolia
export const SINGLE_CALL_BALANCES_ADDRESS_SEPOLIA = '';
export const SINGLE_CALL_BALANCES_ADDRESS_BSC =
'0x2352c63A83f9Fd126af8676146721Fa00924d7e4';
export const SINGLE_CALL_BALANCES_ADDRESS_OPTIMISM =
'0xB1c568e9C3E6bdaf755A60c7418C269eb11524FC';
export const SINGLE_CALL_BALANCES_ADDRESS_POLYGON =
'0x2352c63A83f9Fd126af8676146721Fa00924d7e4';
export const SINGLE_CALL_BALANCES_ADDRESS_AVALANCHE =
'0xD023D153a0DFa485130ECFdE2FAA7e612EF94818';
export const SINGLE_CALL_BALANCES_ADDRESS_FANTOM =
'0x07f697424ABe762bB808c109860c04eA488ff92B';
export const SINGLE_CALL_BALANCES_ADDRESS_ARBITRUM =
'0x151E24A486D7258dd7C33Fb67E4bB01919B7B32c';
import { CHAIN_IDS } from '../../../shared/constants/network';

export const SINGLE_CALL_BALANCES_ADDRESSES = {
[CHAIN_IDS.MAINNET]: '0xb1f8e55c7f64d203c1400b9d8555d050f94adf39',
[CHAIN_IDS.GOERLI]: '0x9788C4E93f9002a7ad8e72633b11E8d1ecd51f9b',
// TODO(SEPOLIA) There is currently no balance call address for Sepolia
[CHAIN_IDS.SEPOLIA]: '',
[CHAIN_IDS.BSC]: '0x2352c63A83f9Fd126af8676146721Fa00924d7e4',
[CHAIN_IDS.OPTIMISM]: '0xB1c568e9C3E6bdaf755A60c7418C269eb11524FC',
[CHAIN_IDS.POLYGON]: '0x2352c63A83f9Fd126af8676146721Fa00924d7e4',
[CHAIN_IDS.AVALANCHE]: '0xD023D153a0DFa485130ECFdE2FAA7e612EF94818',
[CHAIN_IDS.FANTOM]: '0x07f697424ABe762bB808c109860c04eA488ff92B',
[CHAIN_IDS.ARBITRUM]: '0x151E24A486D7258dd7C33Fb67E4bB01919B7B32c',
};
8 changes: 4 additions & 4 deletions app/scripts/controllers/app-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export default class AppStateController extends EventEmitter {
});
}

///: BEGIN:ONLY_INCLUDE_IN(snaps)
///: BEGIN:ONLY_INCLUDE_IF(snaps)
/**
* Record if popover for snaps privacy warning has been shown
* on the first install of a snap.
Expand All @@ -204,7 +204,7 @@ export default class AppStateController extends EventEmitter {
snapsInstallPrivacyWarningShown: shown,
});
}
///: END:ONLY_INCLUDE_IN
///: END:ONLY_INCLUDE_IF

/**
* Record the timestamp of the last time the user has seen the outdated browser warning
Expand Down Expand Up @@ -397,7 +397,7 @@ export default class AppStateController extends EventEmitter {
this.store.updateState({ usedNetworks });
}

///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
///: BEGIN:ONLY_INCLUDE_IF(build-mmi)
/**
* Set the interactive replacement token with a url and the old refresh token
*
Expand All @@ -415,7 +415,7 @@ export default class AppStateController extends EventEmitter {
});
}

///: END:ONLY_INCLUDE_IN
///: END:ONLY_INCLUDE_IF
/**
* A setter for the currentPopupId which indicates the id of popup window that's currently active
*
Expand Down
Loading

0 comments on commit aad500d

Please sign in to comment.