Skip to content

Commit

Permalink
address feedback + cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
adonesky1 committed Jul 30, 2024
1 parent 2219e0d commit 343ee96
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 196 deletions.
14 changes: 5 additions & 9 deletions app/scripts/controllers/mmi-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -791,15 +791,10 @@ export default class MMIController extends EventEmitter {
const updatedMsgParams = { ...msgParams, deferSetAsSigned: isCustodial };

if (
req.method !== 'eth_signTypedData' &&
req.method !== 'eth_signTypedData_v3' &&
req.method !== 'eth_signTypedData_v4' &&
req.method !== 'personal_sign'
req.method === 'eth_signTypedData' ||
req.method === 'eth_signTypedData_v3' ||
req.method === 'eth_signTypedData_v4'
) {
throw new Error('Unexpected method');
}

if (req.method.includes('eth_signTypedData')) {
return await this.signatureController.newUnsignedTypedMessage(
updatedMsgParams as PersonalMessageParams,
req as OriginalRequest,
Expand All @@ -812,7 +807,8 @@ export default class MMIController extends EventEmitter {
req as OriginalRequest,
);
}
return undefined;

throw new Error('Unexpected method');
}

async handleSigningEvents(
Expand Down
2 changes: 0 additions & 2 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -1798,8 +1798,6 @@ export default class MetamaskController extends EventEmitter {
`${this.loggingController.name}:add`,
],
}),
// TODO remove this option
isEthSignEnabled: () => false,
getAllState: this.getState.bind(this),
getCurrentChainId: () =>
this.networkController.state.providerConfig.chainId,
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ import SnapLegacyAuthorshipHeader from '../../../../components/app/snaps/snap-le
import InsightWarnings from '../../../../components/app/snaps/insight-warnings';
import { BlockaidResultType } from '../../../../../shared/constants/security-provider';
import { QueuedRequestsBannerAlert } from '../../confirmation/components/queued-requests-banner-alert';
import SignatureRequestOriginalWarning from './signature-request-original-warning';

export default class SignatureRequestOriginal extends Component {
static contextTypes = {
Expand Down Expand Up @@ -87,7 +86,6 @@ export default class SignatureRequestOriginal extends Component {
};

state = {
showSignatureRequestWarning: false,
showSignatureInsights: false,
};

Expand Down Expand Up @@ -350,13 +348,7 @@ export default class SignatureRequestOriginal extends Component {
};

render = () => {
const {
messagesCount,
fromAccount: { address, name },
txData,
warnings,
} = this.props;
const { showSignatureRequestWarning } = this.state;
const { messagesCount, txData, warnings } = this.props;
const { t } = this.context;

const rejectNText = t('rejectRequestsN', [messagesCount]);
Expand All @@ -375,23 +367,7 @@ export default class SignatureRequestOriginal extends Component {
<LedgerInstructionField showDataInstruction />
</div>
) : null}
{showSignatureRequestWarning && (
<SignatureRequestOriginalWarning
senderAddress={address}
name={name}
onSubmit={async () => {
if (warnings?.length >= 1) {
return this.setState({
showSignatureInsights: true,
showSignatureRequestWarning: false,
});
}

return await this.onSubmit();
}}
onCancel={async (event) => await this.onCancel(event)}
/>
)}
{this.state.showSignatureInsights && (
<InsightWarnings
warnings={warnings}
Expand Down

0 comments on commit 343ee96

Please sign in to comment.