1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-22 17:33:23 +01:00

Revert "[MMI] Add confirm-transaction-base code fences (#18795)" (#19328)

This reverts commit 97a9834182.

Co-authored-by: António Regadas <apregadas@gmail.com>
This commit is contained in:
legobeat 2023-05-30 12:39:38 +00:00 committed by GitHub
parent f2356b29a5
commit dfafdbb6bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 90 additions and 659 deletions

View File

@ -783,109 +783,6 @@
"@babel/runtime": true
}
},
"@metamask-institutional/extension": {
"globals": {
"console.log": true,
"fetch": true
},
"packages": {
"@ethereumjs/tx>@ethereumjs/util": true,
"@metamask-institutional/extension>@metamask-institutional/custody-controller": true,
"@metamask-institutional/extension>@metamask-institutional/sdk": true,
"@metamask-institutional/extension>@metamask-institutional/types": true
}
},
"@metamask-institutional/extension>@metamask-institutional/custody-controller": {
"packages": {
"@ethereumjs/tx>@ethereumjs/util": true,
"@metamask-institutional/extension>@metamask-institutional/custody-keyring": true,
"@metamask/obs-store": true
}
},
"@metamask-institutional/extension>@metamask-institutional/custody-keyring": {
"globals": {
"console.log": true,
"console.warn": true
},
"packages": {
"@ethereumjs/tx>@ethereumjs/util": true,
"@metamask-institutional/extension>@metamask-institutional/custody-keyring>@metamask-institutional/configuration-client": true,
"@metamask-institutional/extension>@metamask-institutional/sdk": true,
"@metamask-institutional/extension>@metamask-institutional/types": true,
"@metamask/obs-store": true,
"browserify>crypto-browserify": true,
"browserify>events": true,
"gulp-sass>lodash.clonedeep": true
}
},
"@metamask-institutional/extension>@metamask-institutional/custody-keyring>@metamask-institutional/configuration-client": {
"globals": {
"console.log": true,
"fetch": true
}
},
"@metamask-institutional/extension>@metamask-institutional/sdk": {
"globals": {
"URLSearchParams": true,
"console.debug": true,
"console.log": true,
"console.warn": true,
"fetch": true
},
"packages": {
"@metamask-institutional/extension>@metamask-institutional/sdk>@metamask-institutional/simplecache": true,
"@metamask-institutional/extension>@metamask-institutional/sdk>bignumber.js": true,
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken": true,
"browserify>crypto-browserify": true,
"browserify>events": true
}
},
"@metamask-institutional/extension>@metamask-institutional/sdk>bignumber.js": {
"globals": {
"crypto": true,
"define": true
}
},
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken": {
"packages": {
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws": true,
"browserify>buffer": true,
"browserify>crypto-browserify": true,
"browserify>process": true,
"lodash": true,
"mocha>ms": true,
"semver": true
}
},
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws": {
"packages": {
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws>jwa": true,
"browserify>buffer": true,
"browserify>process": true,
"browserify>stream-browserify": true,
"browserify>util": true,
"ethereumjs-wallet>safe-buffer": true
}
},
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws>jwa": {
"packages": {
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws>jwa>buffer-equal-constant-time": true,
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws>jwa>ecdsa-sig-formatter": true,
"browserify>crypto-browserify": true,
"browserify>util": true,
"ethereumjs-wallet>safe-buffer": true
}
},
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws>jwa>buffer-equal-constant-time": {
"packages": {
"browserify>buffer": true
}
},
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws>jwa>ecdsa-sig-formatter": {
"packages": {
"ethereumjs-wallet>safe-buffer": true
}
},
"@metamask/address-book-controller": {
"packages": {
"@metamask/base-controller": true,

View File

@ -783,109 +783,6 @@
"@babel/runtime": true
}
},
"@metamask-institutional/extension": {
"globals": {
"console.log": true,
"fetch": true
},
"packages": {
"@ethereumjs/tx>@ethereumjs/util": true,
"@metamask-institutional/extension>@metamask-institutional/custody-controller": true,
"@metamask-institutional/extension>@metamask-institutional/sdk": true,
"@metamask-institutional/extension>@metamask-institutional/types": true
}
},
"@metamask-institutional/extension>@metamask-institutional/custody-controller": {
"packages": {
"@ethereumjs/tx>@ethereumjs/util": true,
"@metamask-institutional/extension>@metamask-institutional/custody-keyring": true,
"@metamask/obs-store": true
}
},
"@metamask-institutional/extension>@metamask-institutional/custody-keyring": {
"globals": {
"console.log": true,
"console.warn": true
},
"packages": {
"@ethereumjs/tx>@ethereumjs/util": true,
"@metamask-institutional/extension>@metamask-institutional/custody-keyring>@metamask-institutional/configuration-client": true,
"@metamask-institutional/extension>@metamask-institutional/sdk": true,
"@metamask-institutional/extension>@metamask-institutional/types": true,
"@metamask/obs-store": true,
"browserify>crypto-browserify": true,
"browserify>events": true,
"gulp-sass>lodash.clonedeep": true
}
},
"@metamask-institutional/extension>@metamask-institutional/custody-keyring>@metamask-institutional/configuration-client": {
"globals": {
"console.log": true,
"fetch": true
}
},
"@metamask-institutional/extension>@metamask-institutional/sdk": {
"globals": {
"URLSearchParams": true,
"console.debug": true,
"console.log": true,
"console.warn": true,
"fetch": true
},
"packages": {
"@metamask-institutional/extension>@metamask-institutional/sdk>@metamask-institutional/simplecache": true,
"@metamask-institutional/extension>@metamask-institutional/sdk>bignumber.js": true,
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken": true,
"browserify>crypto-browserify": true,
"browserify>events": true
}
},
"@metamask-institutional/extension>@metamask-institutional/sdk>bignumber.js": {
"globals": {
"crypto": true,
"define": true
}
},
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken": {
"packages": {
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws": true,
"browserify>buffer": true,
"browserify>crypto-browserify": true,
"browserify>process": true,
"lodash": true,
"mocha>ms": true,
"semver": true
}
},
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws": {
"packages": {
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws>jwa": true,
"browserify>buffer": true,
"browserify>process": true,
"browserify>stream-browserify": true,
"browserify>util": true,
"ethereumjs-wallet>safe-buffer": true
}
},
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws>jwa": {
"packages": {
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws>jwa>buffer-equal-constant-time": true,
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws>jwa>ecdsa-sig-formatter": true,
"browserify>crypto-browserify": true,
"browserify>util": true,
"ethereumjs-wallet>safe-buffer": true
}
},
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws>jwa>buffer-equal-constant-time": {
"packages": {
"browserify>buffer": true
}
},
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws>jwa>ecdsa-sig-formatter": {
"packages": {
"ethereumjs-wallet>safe-buffer": true
}
},
"@metamask/address-book-controller": {
"packages": {
"@metamask/base-controller": true,

View File

@ -783,109 +783,6 @@
"@babel/runtime": true
}
},
"@metamask-institutional/extension": {
"globals": {
"console.log": true,
"fetch": true
},
"packages": {
"@ethereumjs/tx>@ethereumjs/util": true,
"@metamask-institutional/extension>@metamask-institutional/custody-controller": true,
"@metamask-institutional/extension>@metamask-institutional/sdk": true,
"@metamask-institutional/extension>@metamask-institutional/types": true
}
},
"@metamask-institutional/extension>@metamask-institutional/custody-controller": {
"packages": {
"@ethereumjs/tx>@ethereumjs/util": true,
"@metamask-institutional/extension>@metamask-institutional/custody-keyring": true,
"@metamask/obs-store": true
}
},
"@metamask-institutional/extension>@metamask-institutional/custody-keyring": {
"globals": {
"console.log": true,
"console.warn": true
},
"packages": {
"@ethereumjs/tx>@ethereumjs/util": true,
"@metamask-institutional/extension>@metamask-institutional/custody-keyring>@metamask-institutional/configuration-client": true,
"@metamask-institutional/extension>@metamask-institutional/sdk": true,
"@metamask-institutional/extension>@metamask-institutional/types": true,
"@metamask/obs-store": true,
"browserify>crypto-browserify": true,
"browserify>events": true,
"gulp-sass>lodash.clonedeep": true
}
},
"@metamask-institutional/extension>@metamask-institutional/custody-keyring>@metamask-institutional/configuration-client": {
"globals": {
"console.log": true,
"fetch": true
}
},
"@metamask-institutional/extension>@metamask-institutional/sdk": {
"globals": {
"URLSearchParams": true,
"console.debug": true,
"console.log": true,
"console.warn": true,
"fetch": true
},
"packages": {
"@metamask-institutional/extension>@metamask-institutional/sdk>@metamask-institutional/simplecache": true,
"@metamask-institutional/extension>@metamask-institutional/sdk>bignumber.js": true,
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken": true,
"browserify>crypto-browserify": true,
"browserify>events": true
}
},
"@metamask-institutional/extension>@metamask-institutional/sdk>bignumber.js": {
"globals": {
"crypto": true,
"define": true
}
},
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken": {
"packages": {
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws": true,
"browserify>buffer": true,
"browserify>crypto-browserify": true,
"browserify>process": true,
"lodash": true,
"mocha>ms": true,
"semver": true
}
},
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws": {
"packages": {
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws>jwa": true,
"browserify>buffer": true,
"browserify>process": true,
"browserify>stream-browserify": true,
"browserify>util": true,
"ethereumjs-wallet>safe-buffer": true
}
},
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws>jwa": {
"packages": {
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws>jwa>buffer-equal-constant-time": true,
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws>jwa>ecdsa-sig-formatter": true,
"browserify>crypto-browserify": true,
"browserify>util": true,
"ethereumjs-wallet>safe-buffer": true
}
},
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws>jwa>buffer-equal-constant-time": {
"packages": {
"browserify>buffer": true
}
},
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws>jwa>ecdsa-sig-formatter": {
"packages": {
"ethereumjs-wallet>safe-buffer": true
}
},
"@metamask/address-book-controller": {
"packages": {
"@metamask/base-controller": true,

View File

@ -783,109 +783,6 @@
"@babel/runtime": true
}
},
"@metamask-institutional/extension": {
"globals": {
"console.log": true,
"fetch": true
},
"packages": {
"@ethereumjs/tx>@ethereumjs/util": true,
"@metamask-institutional/extension>@metamask-institutional/custody-controller": true,
"@metamask-institutional/extension>@metamask-institutional/sdk": true,
"@metamask-institutional/extension>@metamask-institutional/types": true
}
},
"@metamask-institutional/extension>@metamask-institutional/custody-controller": {
"packages": {
"@ethereumjs/tx>@ethereumjs/util": true,
"@metamask-institutional/extension>@metamask-institutional/custody-keyring": true,
"@metamask/obs-store": true
}
},
"@metamask-institutional/extension>@metamask-institutional/custody-keyring": {
"globals": {
"console.log": true,
"console.warn": true
},
"packages": {
"@ethereumjs/tx>@ethereumjs/util": true,
"@metamask-institutional/extension>@metamask-institutional/custody-keyring>@metamask-institutional/configuration-client": true,
"@metamask-institutional/extension>@metamask-institutional/sdk": true,
"@metamask-institutional/extension>@metamask-institutional/types": true,
"@metamask/obs-store": true,
"browserify>crypto-browserify": true,
"browserify>events": true,
"gulp-sass>lodash.clonedeep": true
}
},
"@metamask-institutional/extension>@metamask-institutional/custody-keyring>@metamask-institutional/configuration-client": {
"globals": {
"console.log": true,
"fetch": true
}
},
"@metamask-institutional/extension>@metamask-institutional/sdk": {
"globals": {
"URLSearchParams": true,
"console.debug": true,
"console.log": true,
"console.warn": true,
"fetch": true
},
"packages": {
"@metamask-institutional/extension>@metamask-institutional/sdk>@metamask-institutional/simplecache": true,
"@metamask-institutional/extension>@metamask-institutional/sdk>bignumber.js": true,
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken": true,
"browserify>crypto-browserify": true,
"browserify>events": true
}
},
"@metamask-institutional/extension>@metamask-institutional/sdk>bignumber.js": {
"globals": {
"crypto": true,
"define": true
}
},
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken": {
"packages": {
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws": true,
"browserify>buffer": true,
"browserify>crypto-browserify": true,
"browserify>process": true,
"lodash": true,
"mocha>ms": true,
"semver": true
}
},
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws": {
"packages": {
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws>jwa": true,
"browserify>buffer": true,
"browserify>process": true,
"browserify>stream-browserify": true,
"browserify>util": true,
"ethereumjs-wallet>safe-buffer": true
}
},
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws>jwa": {
"packages": {
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws>jwa>buffer-equal-constant-time": true,
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws>jwa>ecdsa-sig-formatter": true,
"browserify>crypto-browserify": true,
"browserify>util": true,
"ethereumjs-wallet>safe-buffer": true
}
},
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws>jwa>buffer-equal-constant-time": {
"packages": {
"browserify>buffer": true
}
},
"@metamask-institutional/extension>@metamask-institutional/sdk>jsonwebtoken>jws>jwa>ecdsa-sig-formatter": {
"packages": {
"ethereumjs-wallet>safe-buffer": true
}
},
"@metamask/address-book-controller": {
"packages": {
"@metamask/base-controller": true,

View File

@ -133,15 +133,13 @@ export default class ConfirmTransactionBase extends Component {
hardwareWalletRequiresConnection: PropTypes.bool,
isMultiLayerFeeNetwork: PropTypes.bool,
isBuyableChain: PropTypes.bool,
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
accountType: PropTypes.string,
isNoteToTraderSupported: PropTypes.bool,
///: END:ONLY_INCLUDE_IN
isApprovalOrRejection: PropTypes.bool,
assetStandard: PropTypes.string,
useCurrencyRateCheck: PropTypes.bool,
isNotification: PropTypes.bool,
accountType: PropTypes.string,
setWaitForConfirmDeepLinkDialog: PropTypes.func,
showTransactionsFailedModal: PropTypes.func,
showCustodianDeepLink: PropTypes.func,
isNoteToTraderSupported: PropTypes.bool,
};
state = {
@ -595,81 +593,36 @@ export default class ConfirmTransactionBase extends Component {
}
handleSubmit() {
let submit = this.handleMainSubmit.bind(this);
const {
sendTransaction,
txData,
history,
mostRecentOverviewPage,
updateCustomNonce,
maxFeePerGas,
customTokenAmount,
dappProposedTokenAmount,
currentTokenBalance,
maxPriorityFeePerGas,
baseFeePerGas,
methodData,
addToAddressBookIfNew,
toAccounts,
toAddress,
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
accountType,
isNoteToTraderSupported,
///: END:ONLY_INCLUDE_IN
} = this.props;
const {
submitting,
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
noteText,
///: END:ONLY_INCLUDE_IN
} = this.state;
const { name } = methodData;
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
submit = this.handleMMISubmit.bind(this);
///: END:ONLY_INCLUDE_IN
submit();
}
handleMainSubmit() {
const {
sendTransaction,
txData,
history,
mostRecentOverviewPage,
updateCustomNonce,
} = this.props;
this.updateTxData();
this.setState(
{
submitting: true,
submitError: null,
},
() => {
this._removeBeforeUnload();
sendTransaction(txData)
.then(() => {
if (!this._isMounted) {
return;
}
this.setState(
{
submitting: false,
},
() => {
history.push(mostRecentOverviewPage);
updateCustomNonce('');
},
);
})
.catch((error) => {
if (!this._isMounted) {
return;
}
this.setState({
submitting: false,
submitError: error.message,
});
updateCustomNonce('');
});
},
);
}
handleMMISubmit() {
const {
sendTransaction,
txData,
history,
mostRecentOverviewPage,
updateCustomNonce,
unapprovedTxCount,
accountType,
isNotification,
setWaitForConfirmDeepLinkDialog,
showTransactionsFailedModal,
fromAddress,
isNoteToTraderSupported,
} = this.props;
const { noteText } = this.state;
if (accountType === 'custody') {
txData.custodyStatus = 'created';
@ -679,92 +632,7 @@ export default class ConfirmTransactionBase extends Component {
};
}
}
this.updateTxData();
this.setState(
{
submitting: true,
submitError: null,
},
() => {
this._removeBeforeUnload();
if (txData.custodyStatus) {
setWaitForConfirmDeepLinkDialog(true);
}
sendTransaction(txData)
.then(() => {
if (!this._isMounted) {
return;
}
if (txData.custodyStatus) {
this.props.showCustodianDeepLink({
fromAddress,
closeNotification: isNotification && unapprovedTxCount === 1,
txId: txData.id,
onDeepLinkFetched: () => {
this.context.trackEvent({
category: 'MMI',
event: 'Show deeplink for transaction',
});
},
onDeepLinkShown: () => {
this.props.clearConfirmTransaction();
this.setState({ submitting: false }, () => {
history.push(mostRecentOverviewPage);
updateCustomNonce('');
});
},
});
} else {
this.setState(
{
submitting: false,
},
() => {
history.push(mostRecentOverviewPage);
updateCustomNonce('');
},
);
}
})
.catch((error) => {
if (!this._isMounted) {
return;
}
showTransactionsFailedModal(error.message, isNotification);
this.setState({
submitting: false,
submitError: error.message,
});
setWaitForConfirmDeepLinkDialog(true);
updateCustomNonce('');
});
},
);
}
updateTxData() {
const {
txData,
maxFeePerGas,
customTokenAmount,
dappProposedTokenAmount,
currentTokenBalance,
maxPriorityFeePerGas,
baseFeePerGas,
addToAddressBookIfNew,
toAccounts,
toAddress,
methodData,
} = this.props;
const { submitting } = this.state;
const { name } = methodData;
///: END:ONLY_INCLUDE_IN
if (txData.type === TransactionType.simpleSend) {
addToAddressBookIfNew(toAddress, toAccounts);
@ -810,6 +678,44 @@ export default class ConfirmTransactionBase extends Component {
maxPriorityFeePerGas,
};
}
this.setState(
{
submitting: true,
submitError: null,
},
() => {
this._removeBeforeUnload();
sendTransaction(txData)
.then(() => {
if (!this._isMounted) {
return;
}
this.setState(
{
submitting: false,
},
() => {
history.push(mostRecentOverviewPage);
updateCustomNonce('');
},
);
})
.catch((error) => {
if (!this._isMounted) {
return;
}
this.setState({
submitting: false,
submitError: error.message,
});
updateCustomNonce('');
});
},
);
}
handleSetApprovalForAll() {

View File

@ -1,10 +1,7 @@
import { connect } from 'react-redux';
import { compose } from 'redux';
import { withRouter } from 'react-router-dom';
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
import { showCustodianDeepLink } from '@metamask-institutional/extension';
import { mmiActionsFactory } from '../../store/institutional/institution-background';
///: END:ONLY_INCLUDE_IN
import { clearConfirmTransaction } from '../../ducks/confirm-transaction/confirm-transaction.duck';
import {
@ -51,12 +48,7 @@ import {
getSendToAccounts,
getProviderConfig,
} from '../../ducks/metamask/metamask';
import {
addHexPrefix,
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
getEnvironmentType,
///: END:ONLY_INCLUDE_IN
} from '../../../app/scripts/lib/util';
import { addHexPrefix } from '../../../app/scripts/lib/util';
import {
parseStandardTokenTransactionData,
@ -71,11 +63,8 @@ import {
import { getGasLoadingAnimationIsShowing } from '../../ducks/app/app';
import { isLegacyTransaction } from '../../helpers/utils/transactions.util';
import { CUSTOM_GAS_ESTIMATE } from '../../../shared/constants/gas';
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
import { getAccountType } from '../../selectors/selectors';
import { ENVIRONMENT_TYPE_NOTIFICATION } from '../../../shared/constants/app';
import { getIsNoteToTraderSupported } from '../../selectors/institutional/selectors';
///: END:ONLY_INCLUDE_IN
import {
TransactionStatus,
@ -111,11 +100,6 @@ const mapStateToProps = (state, ownProps) => {
const { id: paramsTransactionId } = params;
const isMainnet = getIsMainnet(state);
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
const envType = getEnvironmentType();
const isNotification = envType === ENVIRONMENT_TYPE_NOTIFICATION;
///: END:ONLY_INCLUDE_IN
const isGasEstimatesLoading = getIsGasEstimatesLoading(state);
const gasLoadingAnimationIsShowing = getGasLoadingAnimationIsShowing(state);
const isBuyableChain = getIsBuyableChain(state);
@ -215,20 +199,29 @@ const mapStateToProps = (state, ownProps) => {
txParamsAreDappSuggested(fullTxData);
const fromAddressIsLedger = isAddressLedger(state, fromAddress);
const nativeCurrency = getNativeCurrency(state);
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
const accountType = getAccountType(state, fromAddress);
const fromChecksumHexAddress = toChecksumHexAddress(fromAddress);
const isNoteToTraderSupported = getIsNoteToTraderSupported(
state,
fromChecksumHexAddress,
);
///: END:ONLY_INCLUDE_IN
const hardwareWalletRequiresConnection =
doesAddressRequireLedgerHidConnection(state, fromAddress);
const isMultiLayerFeeNetwork = getIsMultiLayerFeeNetwork(state);
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
const accountType = getAccountType(state);
const fromChecksumHexAddress = toChecksumHexAddress(fromAddress);
let isNoteToTraderSupported = false;
if (
state.metamask.custodyAccountDetails &&
state.metamask.custodyAccountDetails[fromChecksumHexAddress]
) {
const { custodianName } =
state.metamask.custodyAccountDetails[fromChecksumHexAddress];
isNoteToTraderSupported = state.metamask.mmiConfiguration?.custodians?.find(
(custodian) => custodian.name === custodianName,
)?.isNoteToTraderSupported;
}
///: END:ONLY_INCLUDE_IN
return {
balance,
fromAddress,
@ -282,15 +275,11 @@ const mapStateToProps = (state, ownProps) => {
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
accountType,
isNoteToTraderSupported,
isNotification,
///: END:ONLY_INCLUDE_IN
};
};
export const mapDispatchToProps = (dispatch) => {
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
const mmiActions = mmiActionsFactory();
///: END:ONLY_INCLUDE_IN
return {
tryReverseResolveAddress: (address) => {
return dispatch(tryReverseResolveAddress(address));
@ -327,45 +316,6 @@ export const mapDispatchToProps = (dispatch) => {
dispatch(addToAddressBook(hexPrefixedAddress, nickname));
}
},
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
getCustodianConfirmDeepLink: (id) =>
dispatch(mmiActions.getCustodianConfirmDeepLink(id)),
showCustodyConfirmLink: ({ link, address, closeNotification, custodyId }) =>
dispatch(
mmiActions.showCustodyConfirmLink({
link,
address,
closeNotification,
custodyId,
}),
),
showTransactionsFailedModal: (errorMessage, closeNotification) =>
dispatch(
showModal({
name: 'TRANSACTION_FAILED',
errorMessage,
closeNotification,
}),
),
showCustodianDeepLink: ({
txId,
fromAddress,
closeNotification,
onDeepLinkFetched,
onDeepLinkShown,
}) =>
showCustodianDeepLink({
dispatch,
mmiActions,
txId,
fromAddress,
closeNotification,
onDeepLinkFetched,
onDeepLinkShown,
}),
setWaitForConfirmDeepLinkDialog: (wait) =>
dispatch(mmiActions.setWaitForConfirmDeepLinkDialog(wait)),
///: END:ONLY_INCLUDE_IN
};
};

View File

@ -78,16 +78,3 @@ export function getMMIConfiguration(state) {
export function getInteractiveReplacementToken(state) {
return state.metamask.interactiveReplacementToken || {};
}
export function getIsNoteToTraderSupported(state, fromChecksumHexAddress) {
let isNoteToTraderSupported = false;
if (state.metamask.custodyAccountDetails?.[fromChecksumHexAddress]) {
const { custodianName } =
state.metamask.custodyAccountDetails[fromChecksumHexAddress];
isNoteToTraderSupported = state.metamask.mmiConfiguration?.custodians?.find(
(custodian) => custodian.name === custodianName,
)?.isNoteToTraderSupported;
}
return isNoteToTraderSupported;
}