Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MMI] Allows the mmi build to be generated using the dist command #20148

Merged
merged 30 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
5865602
adds listeners for signatureControll and adds the handleSigningEvents…
zone-live Jul 6, 2023
6b9c1e7
clean up
zone-live Jul 6, 2023
a852d5e
Merge branch 'develop' into MMI-listen-for-signing-events
zone-live Jul 7, 2023
1ad2d59
updates signature request containers files
zone-live Jul 10, 2023
e408027
adds necessary methods
zone-live Jul 10, 2023
bf2c6b2
wip
zone-live Jul 11, 2023
2677b1f
signing flow with core methods
zone-live Jul 14, 2023
b2d967c
yarn lint
zone-live Jul 14, 2023
1cffea6
updates logic to fit latest signatureCOntroller
zone-live Jul 18, 2023
75d7a95
updates mmi extension package
zone-live Jul 18, 2023
003f2b6
updates signature-controller and message-manager packages
zone-live Jul 19, 2023
0d22ffd
Merge branch 'develop' into MMI-listen-for-signing-events
zone-live Jul 19, 2023
d8b4535
checkout develop lock file and run yarn
zone-live Jul 19, 2023
4a5ac75
Merge branch 'develop' into MMI-listen-for-signing-events
zone-live Jul 19, 2023
e6e6eb0
checkout develop lock file and package.json to test circleci
zone-live Jul 19, 2023
0b3eb91
test fix
zone-live Jul 19, 2023
b62599c
adds signature-controller new version
zone-live Jul 19, 2023
8c922d1
updates mmi extension package
zone-live Jul 19, 2023
a562cc2
Merge branch 'develop' into MMI-listen-for-signing-events
zone-live Jul 19, 2023
9f8f726
tx-list update and runs lavamoat auto
zone-live Jul 19, 2023
8f866ea
lint fix
zone-live Jul 19, 2023
c9ace96
runs lavamoat auto
zone-live Jul 19, 2023
d3c5ca7
resets lavamoat/build-system/policy.jsono to develop
zone-live Jul 19, 2023
50873c3
Update LavaMoat policies
metamaskbot Jul 19, 2023
0059db0
adds back the dispatch
zone-live Jul 20, 2023
edf4938
lint
zone-live Jul 20, 2023
ee72fec
changes needed to generate a mmi build
zone-live Jul 20, 2023
d617ed1
adds metametricsId in url param
zone-live Jul 24, 2023
b579e00
Merge branch 'develop' into MMI-yarn-dist-working-changes
zone-live Jul 24, 2023
cca8133
adds necessary fence
zone-live Jul 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion development/build/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function createManifestTasks({

const buildName =
buildType === 'mmi'
? `MetaMask Institutional ${mv3Str}${lavamoatStr}${snowStr}`
? `MetaMask Institutional ${mv3Str}`
: `MetaMask ${capitalize(buildType)}${mv3Str}${lavamoatStr}${snowStr}`;

manifest.name = buildName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import { Tabs, Tab } from '../../../ui/tabs';
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
import Button from '../../../ui/button';
///: END:ONLY_INCLUDE_IN
import ActionableMessage from '../../../ui/actionable-message/actionable-message';
import { PageContainerFooter } from '../../../ui/page-container';
import ErrorMessage from '../../../ui/error-message';
Expand Down Expand Up @@ -57,7 +59,9 @@ export default class ConfirmPageContainerContent extends Component {
toAddress: PropTypes.string,
transactionType: PropTypes.string,
isBuyableChain: PropTypes.bool,
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
openBuyCryptoInPdapp: PropTypes.func,
///: END:ONLY_INCLUDE_IN
txData: PropTypes.object,
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
noteComponent: PropTypes.node,
Expand Down Expand Up @@ -197,7 +201,9 @@ export default class ConfirmPageContainerContent extends Component {
toAddress,
transactionType,
isBuyableChain,
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
openBuyCryptoInPdapp,
///: END:ONLY_INCLUDE_IN
txData,
} = this.props;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import React, { useCallback, useContext, useEffect, useState } from 'react';
import React, {
useCallback,
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
useContext,
///: END:ONLY_INCLUDE_IN
useEffect,
useState,
} from 'react';
import PropTypes from 'prop-types';
import { useSelector } from 'react-redux';

Expand Down Expand Up @@ -45,11 +52,13 @@ import {
getSwapsDefaultToken,
} from '../../../selectors';
import useRamps from '../../../hooks/experiences/useRamps';
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
import { MetaMetricsContext } from '../../../contexts/metametrics';
import {
MetaMetricsEventCategory,
MetaMetricsEventName,
} from '../../../../shared/constants/metametrics';
///: END:ONLY_INCLUDE_IN
import {
ConfirmPageContainerHeader,
ConfirmPageContainerContent,
Expand Down Expand Up @@ -105,8 +114,9 @@ const ConfirmPageContainer = (props) => {
} = props;

const t = useI18nContext();
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
const trackEvent = useContext(MetaMetricsContext);

///: END:ONLY_INCLUDE_IN
const [collectionBalance, setCollectionBalance] = useState('0');

const isBuyableChain = useSelector(getIsBuyableChain);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ export default class SignatureRequestOriginal extends Component {
address: PropTypes.string.isRequired,
name: PropTypes.string,
}).isRequired,
clearConfirmTransaction: PropTypes.func.isRequired,
history: PropTypes.object.isRequired,
mostRecentOverviewPage: PropTypes.string.isRequired,
txData: PropTypes.object.isRequired,
subjectMetadata: PropTypes.object,
hardwareWalletRequiresConnection: PropTypes.bool,
Expand All @@ -75,6 +72,9 @@ export default class SignatureRequestOriginal extends Component {
showRejectTransactionsConfirmationModal: PropTypes.func.isRequired,
cancelAllApprovals: PropTypes.func.isRequired,
rejectPendingApproval: PropTypes.func.isRequired,
clearConfirmTransaction: PropTypes.func.isRequired,
history: PropTypes.object.isRequired,
mostRecentOverviewPage: PropTypes.string.isRequired,
resolvePendingApproval: PropTypes.func.isRequired,
completedTx: PropTypes.func.isRequired,
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
Expand Down Expand Up @@ -258,11 +258,11 @@ export default class SignatureRequestOriginal extends Component {

onSubmit = async () => {
const {
resolvePendingApproval,
completedTx,
clearConfirmTransaction,
history,
mostRecentOverviewPage,
resolvePendingApproval,
completedTx,
txData,
} = this.props;
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
Expand All @@ -272,12 +272,10 @@ export default class SignatureRequestOriginal extends Component {
}
///: END:ONLY_INCLUDE_IN

///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
await resolvePendingApproval(txData.id);
completedTx(txData.id);
clearConfirmTransaction();
history.push(mostRecentOverviewPage);
///: END:ONLY_INCLUDE_IN
};

onCancel = async () => {
Expand Down Expand Up @@ -332,11 +330,9 @@ export default class SignatureRequestOriginal extends Component {
}
///: END:ONLY_INCLUDE_IN

///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
await resolvePendingApproval(txData.id);
clearConfirmTransaction();
history.push(mostRecentOverviewPage);
///: END:ONLY_INCLUDE_IN
}
}}
disabled={
Expand Down
4 changes: 3 additions & 1 deletion ui/components/app/signature-request/signature-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ import { ethErrors, serializeError } from 'eth-rpc-errors';
import { showCustodianDeepLink } from '@metamask-institutional/extension';
///: END:ONLY_INCLUDE_IN
import {
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
resolvePendingApproval,
rejectPendingApproval,
completedTx,
///: END:ONLY_INCLUDE_IN
rejectPendingApproval,
} from '../../../store/actions';
import {
doesAddressRequireLedgerHidConnection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ export default function TransactionList({
{pendingTransactions.map((dateGroup) => {
return dateGroup.transactionGroups.map(
(transactionGroup, index) => {
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
if (
transactionGroup.initialTransaction.transactionType ===
TransactionType.smart
Expand All @@ -193,7 +192,6 @@ export default function TransactionList({
</>
);
}
///: END:ONLY_INCLUDE_IN
return (
<>
{renderDateStamp(index, dateGroup)}
Expand All @@ -218,7 +216,7 @@ export default function TransactionList({
<>
{renderDateStamp(index, dateGroup)}
{transactionGroup.initialTransaction?.transactionType ===
'smart' ? (
TransactionType.smart ? (
<SmartTransactionListItem
transactionGroup={transactionGroup}
smartTransaction={transactionGroup.initialTransaction}
Expand Down
27 changes: 20 additions & 7 deletions ui/components/app/wallet-overview/eth-overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import React, { useContext } from 'react';
import PropTypes from 'prop-types';
import { useDispatch, useSelector } from 'react-redux';
import classnames from 'classnames';
import { useHistory, useLocation } from 'react-router-dom';
import {
useHistory,
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
useLocation,
///: END:ONLY_INCLUDE_IN
} from 'react-router-dom';

///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
import {
Expand All @@ -25,11 +30,13 @@ import {
getCurrentKeyring,
getSwapsDefaultToken,
getIsSwapsChain,
getIsBridgeChain,
getIsBuyableChain,
getSelectedAccountCachedBalance,
getCurrentChainId,
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
getIsBridgeChain,
getIsBuyableChain,
getMetaMetricsId,
///: END:ONLY_INCLUDE_IN
} from '../../../selectors';
import { setSwapsFromToken } from '../../../ducks/swaps/swaps';
import IconButton from '../../ui/icon-button';
Expand All @@ -45,27 +52,31 @@ import { startNewDraftTransaction } from '../../../ducks/send';
import { AssetType } from '../../../../shared/constants/transaction';
import { Icon, IconName } from '../../component-library';
import { IconColor } from '../../../helpers/constants/design-system';
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
import useRamps from '../../../hooks/experiences/useRamps';
import { getPortfolioUrl } from '../../../helpers/utils/portfolio';
///: END:ONLY_INCLUDE_IN
import WalletOverview from './wallet-overview';

const EthOverview = ({ className, showAddress }) => {
const dispatch = useDispatch();
const t = useContext(I18nContext);
const trackEvent = useContext(MetaMetricsContext);
const history = useHistory();
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
const location = useLocation();
const isBridgeChain = useSelector(getIsBridgeChain);
const isBuyableChain = useSelector(getIsBuyableChain);
const metaMetricsId = useSelector(getMetaMetricsId);
///: END:ONLY_INCLUDE_IN
const keyring = useSelector(getCurrentKeyring);
const usingHardwareWallet = isHardwareKeyring(keyring?.type);
const balanceIsCached = useSelector(isBalanceCached);
const showFiat = useSelector(getShouldShowFiat);
const balance = useSelector(getSelectedAccountCachedBalance);
const isSwapsChain = useSelector(getIsSwapsChain);
const isBridgeChain = useSelector(getIsBridgeChain);
const isBuyableChain = useSelector(getIsBuyableChain);
const defaultSwapsToken = useSelector(getSwapsDefaultToken);
const chainId = useSelector(getCurrentChainId);
const metaMetricsId = useSelector(getMetaMetricsId);

///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
const mmiPortfolioEnabled = useSelector(getMmiPortfolioEnabled);
Expand Down Expand Up @@ -95,7 +106,7 @@ const EthOverview = ({ className, showAddress }) => {
onClick={() => {
stakingEvent();
global.platform.openTab({
url: 'https://metamask-institutional.io/staking',
url: 'https://metamask-institutional.io/stake',
});
}}
/>
Expand All @@ -117,7 +128,9 @@ const EthOverview = ({ className, showAddress }) => {
};
///: END:ONLY_INCLUDE_IN

///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
const { openBuyCryptoInPdapp } = useRamps();
///: END:ONLY_INCLUDE_IN

return (
<WalletOverview
Expand Down
7 changes: 6 additions & 1 deletion ui/components/multichain/global-menu/global-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ import {
MetaMetricsEventCategory,
MetaMetricsContextProp,
} from '../../../../shared/constants/metametrics';
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
import { getPortfolioUrl } from '../../../helpers/utils/portfolio';
///: END:ONLY_INCLUDE_IN
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
import {
getMmiPortfolioEnabled,
Expand Down Expand Up @@ -129,7 +131,10 @@ export const GlobalMenu = ({ closeMenu, anchorElement }) => {
category: MetaMetricsEventCategory.Navigation,
event: MetaMetricsEventName.MMIPortfolioButtonClicked,
});
window.open(mmiPortfolioUrl, '_blank');
window.open(
`${mmiPortfolioUrl}?metametricsId=${metaMetricsId}`,
'_blank',
);
closeMenu();
}}
data-testid="global-menu-mmi-portfolio"
Expand Down
Loading
Loading