mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 01:39:44 +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 createSubscriptionManager from 'eth-json-rpc-filters/subscriptionManager';
|
||||||
import { providerAsMiddleware } from 'eth-json-rpc-middleware';
|
import { providerAsMiddleware } from 'eth-json-rpc-middleware';
|
||||||
import KeyringController from 'eth-keyring-controller';
|
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 { Mutex } from 'await-semaphore';
|
||||||
import { stripHexPrefix } from 'ethereumjs-util';
|
import { stripHexPrefix } from 'ethereumjs-util';
|
||||||
import log from 'loglevel';
|
import log from 'loglevel';
|
||||||
@ -1723,7 +1727,12 @@ export default class MetamaskController extends EventEmitter {
|
|||||||
resolvePendingApproval: approvalController.accept.bind(
|
resolvePendingApproval: approvalController.accept.bind(
|
||||||
approvalController,
|
approvalController,
|
||||||
),
|
),
|
||||||
rejectPendingApproval: approvalController.reject.bind(approvalController),
|
rejectPendingApproval: async (id, error) => {
|
||||||
|
approvalController.reject(
|
||||||
|
id,
|
||||||
|
new EthereumRpcError(error.code, error.message, error.data),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
// Notifications
|
// Notifications
|
||||||
updateViewedNotifications: notificationController.updateViewed.bind(
|
updateViewedNotifications: notificationController.updateViewed.bind(
|
||||||
|
@ -204,7 +204,7 @@ function getValues(pendingApproval, t, actions) {
|
|||||||
onCancel: () =>
|
onCancel: () =>
|
||||||
actions.rejectPendingApproval(
|
actions.rejectPendingApproval(
|
||||||
pendingApproval.id,
|
pendingApproval.id,
|
||||||
ethErrors.provider.userRejectedRequest(),
|
ethErrors.provider.userRejectedRequest().serialize(),
|
||||||
),
|
),
|
||||||
networkDisplay: true,
|
networkDisplay: true,
|
||||||
};
|
};
|
||||||
|
@ -83,7 +83,7 @@ function getValues(pendingApproval, t, actions) {
|
|||||||
onCancel: () =>
|
onCancel: () =>
|
||||||
actions.rejectPendingApproval(
|
actions.rejectPendingApproval(
|
||||||
pendingApproval.id,
|
pendingApproval.id,
|
||||||
ethErrors.provider.userRejectedRequest(),
|
ethErrors.provider.userRejectedRequest().serialize(),
|
||||||
),
|
),
|
||||||
networkDisplay: true,
|
networkDisplay: true,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user