1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-25 20:02:58 +01:00

Fixed error thrown for 712 errors (#14008)

This commit is contained in:
Shane 2022-03-16 16:42:55 -07:00 committed by GitHub
parent 4c908d7413
commit bba8b214b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
import EventEmitter from 'events'; import EventEmitter from 'events';
import { strict as assert } from 'assert'; import { strict as assert } from 'assert';
import { ObservableStore } from '@metamask/obs-store'; import { ObservableStore } from '@metamask/obs-store';
import { EthereumRpcError, ethErrors } from 'eth-rpc-errors'; import { ethErrors } from 'eth-rpc-errors';
import { typedSignatureHash, TYPED_MESSAGE_SCHEMA } from 'eth-sig-util'; import { typedSignatureHash, TYPED_MESSAGE_SCHEMA } from 'eth-sig-util';
import log from 'loglevel'; import log from 'loglevel';
import jsonschema from 'jsonschema'; import jsonschema from 'jsonschema';
@ -193,11 +193,11 @@ export default class TypedMessageManager extends EventEmitter {
`Primary type of "${data.primaryType}" has no type definition.`, `Primary type of "${data.primaryType}" has no type definition.`,
); );
if (validation.errors.length !== 0) { if (validation.errors.length !== 0) {
throw new EthereumRpcError( throw ethErrors.rpc.invalidParams({
ethErrors.rpc.invalidParams, message:
'Signing data must conform to EIP-712 schema. See https://git.io/fNtcx.', 'Signing data must conform to EIP-712 schema. See https://git.io/fNtcx.',
validation.errors.map((v) => v.message.toString()), data: validation.errors.map((v) => v.message.toString()),
); });
} }
let { chainId } = data.domain; let { chainId } = data.domain;
if (chainId) { if (chainId) {