mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-22 17:33:23 +01:00
Fixed serialization of error parameter for rejectPendingApproval
across JSON-RPC (#13847)
* Fixed serialization of error parameter for rejectPendingApproval across JSON-RPC * Fixed linting * Added serialize error to add-ethereum-chain
This commit is contained in:
parent
f09459cb84
commit
adce5c558d
@ -9,7 +9,11 @@ import createFilterMiddleware from 'eth-json-rpc-filters';
|
||||
import createSubscriptionManager from 'eth-json-rpc-filters/subscriptionManager';
|
||||
import { providerAsMiddleware } from 'eth-json-rpc-middleware';
|
||||
import KeyringController from 'eth-keyring-controller';
|
||||
import { errorCodes as rpcErrorCodes, ethErrors } from 'eth-rpc-errors';
|
||||
import {
|
||||
errorCodes as rpcErrorCodes,
|
||||
EthereumRpcError,
|
||||
ethErrors,
|
||||
} from 'eth-rpc-errors';
|
||||
import { Mutex } from 'await-semaphore';
|
||||
import { stripHexPrefix } from 'ethereumjs-util';
|
||||
import log from 'loglevel';
|
||||
@ -1723,7 +1727,12 @@ export default class MetamaskController extends EventEmitter {
|
||||
resolvePendingApproval: approvalController.accept.bind(
|
||||
approvalController,
|
||||
),
|
||||
rejectPendingApproval: approvalController.reject.bind(approvalController),
|
||||
rejectPendingApproval: async (id, error) => {
|
||||
approvalController.reject(
|
||||
id,
|
||||
new EthereumRpcError(error.code, error.message, error.data),
|
||||
);
|
||||
},
|
||||
|
||||
// Notifications
|
||||
updateViewedNotifications: notificationController.updateViewed.bind(
|
||||
|
@ -204,7 +204,7 @@ function getValues(pendingApproval, t, actions) {
|
||||
onCancel: () =>
|
||||
actions.rejectPendingApproval(
|
||||
pendingApproval.id,
|
||||
ethErrors.provider.userRejectedRequest(),
|
||||
ethErrors.provider.userRejectedRequest().serialize(),
|
||||
),
|
||||
networkDisplay: true,
|
||||
};
|
||||
|
@ -83,7 +83,7 @@ function getValues(pendingApproval, t, actions) {
|
||||
onCancel: () =>
|
||||
actions.rejectPendingApproval(
|
||||
pendingApproval.id,
|
||||
ethErrors.provider.userRejectedRequest(),
|
||||
ethErrors.provider.userRejectedRequest().serialize(),
|
||||
),
|
||||
networkDisplay: true,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user