Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): @metamask/transaction-controller@^8.0.1->^12.0.0 #9275

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/components/UI/Transactions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ import RetryModal from './RetryModal';
import PriceChartContext, {
PriceChartProvider,
} from '../AssetOverview/PriceChart/PriceChart.context';
import { ethErrors } from 'eth-rpc-errors';
import { providerErrors } from '@metamask/rpc-errors';
import {
selectConversionRate,
selectCurrentCurrency,
Expand Down Expand Up @@ -578,7 +578,7 @@ class Transactions extends PureComponent {
cancelUnsignedQRTransaction = async (tx) => {
await Engine.context.ApprovalController.reject(
tx.id,
ethErrors.provider.userRejectedRequest(),
providerErrors.userRejectedRequest(),
);
};

Expand Down
6 changes: 3 additions & 3 deletions app/components/Views/confirmations/Approval/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import {
selectProviderType,
} from '../../../../selectors/networkController';
import { selectSelectedAddress } from '../../../../selectors/preferencesController';
import { ethErrors } from 'eth-rpc-errors';
import { providerErrors } from '@metamask/rpc-errors';
import { getLedgerKeyring } from '../../../../core/Ledger/Ledger';
import ExtendedKeyringTypes from '../../../../constants/keyringTypes';
import { getBlockaidMetricsParams } from '../../../../util/blockaid';
Expand Down Expand Up @@ -153,7 +153,7 @@ class Approval extends PureComponent {
} else {
Engine.rejectPendingApproval(
transaction?.id,
ethErrors.provider.userRejectedRequest(),
providerErrors.userRejectedRequest(),
{
ignoreMissing: true,
logErrors: false,
Expand Down Expand Up @@ -197,7 +197,7 @@ class Approval extends PureComponent {
if (transaction?.id && this.isTxStatusCancellable(currentTransaction)) {
Engine.rejectPendingApproval(
transaction.id,
ethErrors.provider.userRejectedRequest(),
providerErrors.userRejectedRequest(),
{
ignoreMissing: true,
logErrors: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ import {
} from '../../../../../selectors/accountTrackerController';
import ShowBlockExplorer from '../../components/ApproveTransactionReview/ShowBlockExplorer';
import createStyles from './styles';
import { ethErrors } from 'eth-rpc-errors';
import { providerErrors } from '@metamask/rpc-errors';
import { getLedgerKeyring } from '../../../../../core/Ledger/Ledger';
import ExtendedKeyringTypes from '../../../../../constants/keyringTypes';
import { updateTransaction } from '../../../../../util/transaction-controller';
Expand Down Expand Up @@ -337,7 +337,7 @@ class Approve extends PureComponent {
if (!approved)
Engine.rejectPendingApproval(
transaction.id,
ethErrors.provider.userRejectedRequest(),
providerErrors.userRejectedRequest(),
{
ignoreMissing: true,
logErrors: false,
Expand All @@ -351,7 +351,7 @@ class Approve extends PureComponent {
const { transaction } = this.props;
Engine.rejectPendingApproval(
transaction?.id,
ethErrors.provider.userRejectedRequest(),
providerErrors.userRejectedRequest(),
{
ignoreMissing: true,
logErrors: false,
Expand Down Expand Up @@ -594,7 +594,7 @@ class Approve extends PureComponent {
const { metrics, hideModal } = this.props;
Engine.rejectPendingApproval(
this.props.transaction.id,
ethErrors.provider.userRejectedRequest(),
providerErrors.userRejectedRequest(),
{
ignoreMissing: true,
logErrors: false,
Expand Down
4 changes: 2 additions & 2 deletions app/components/Views/confirmations/Send/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import {
selectIdentities,
selectSelectedAddress,
} from '../../../../selectors/preferencesController';
import { ethErrors } from 'eth-rpc-errors';
import { providerErrors } from '@metamask/rpc-errors';
import { withMetricsAwareness } from '../../../../components/hooks/useMetrics';

const REVIEW = 'review';
Expand Down Expand Up @@ -520,7 +520,7 @@ class Send extends PureComponent {
onCancel = (id) => {
Engine.context.ApprovalController.reject(
id,
ethErrors.provider.userRejectedRequest(),
providerErrors.userRejectedRequest(),
);
this.props.navigation.pop();
this.unmountHandled = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ApprovalControllerState } from '@metamask/approval-controller';
import { useSelector } from 'react-redux';
import useApprovalRequest from './useApprovalRequest';
import Engine from '../../../../core/Engine';
import { ethErrors } from 'eth-rpc-errors';
import { providerErrors } from '@metamask/rpc-errors';

jest.mock('react-redux', () => ({
...jest.requireActual('react-redux'),
Expand Down Expand Up @@ -143,7 +143,7 @@ describe('useApprovalRequest', () => {
expect(Engine.rejectPendingApproval).toHaveBeenCalledTimes(1);
expect(Engine.rejectPendingApproval).toHaveBeenCalledWith(
APPROVAL_REQUEST.id,
ethErrors.provider.userRejectedRequest(),
providerErrors.userRejectedRequest(),
);
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Engine from '../../../../core/Engine';
import { useCallback } from 'react';
import { ethErrors } from 'eth-rpc-errors';
import { providerErrors } from '@metamask/rpc-errors';
import { useSelector } from 'react-redux';
import { selectPendingApprovals } from '../../../../selectors/approvalController';
import { cloneDeep, isEqual } from 'lodash';
Expand Down Expand Up @@ -36,7 +36,7 @@ const useApprovalRequest = () => {

Engine.rejectPendingApproval(
approvalRequest.id,
ethErrors.provider.userRejectedRequest(),
providerErrors.userRejectedRequest(),
);
}, [approvalRequest]);

Expand Down
6 changes: 3 additions & 3 deletions app/core/BackgroundBridge/BackgroundBridge.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable import/no-commonjs */
import URL from 'url-parse';
import { ChainId } from '@metamask/controller-utils';
import { JsonRpcEngine } from 'json-rpc-engine';
import { JsonRpcEngine } from '@metamask/json-rpc-engine';
import MobilePortStream from '../MobilePortStream';
import { setupMultiplex } from '../../util/streams';
import {
Expand All @@ -27,8 +27,8 @@ import snapMethodMiddlewareBuilder from '../Snaps/SnapsMethodMiddleware';
import { SubjectType } from '@metamask/permission-controller';
///: END:ONLY_INCLUDE_IF

const createFilterMiddleware = require('eth-json-rpc-filters');
const createSubscriptionManager = require('eth-json-rpc-filters/subscriptionManager');
const createFilterMiddleware = require('@metamask/eth-json-rpc-filters');
const createSubscriptionManager = require('@metamask/eth-json-rpc-filters/subscriptionManager');
const providerAsMiddleware = require('eth-json-rpc-middleware/providerAsMiddleware');
const pump = require('pump');
// eslint-disable-next-line import/no-nodejs-modules
Expand Down
4 changes: 2 additions & 2 deletions app/core/Engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ import {
import { hasProperty, Json } from '@metamask/utils';
// TODO: Export this type from the package directly
import { SwapsState } from '@metamask/swaps-controller/dist/SwapsController';
import { ethErrors } from 'eth-rpc-errors';
import { providerErrors } from '@metamask/rpc-errors';

import { PPOM, ppomInit } from '../lib/ppom/PPOMView';
import RNFSStorageBackend from '../lib/ppom/ppom-storage-backend';
Expand Down Expand Up @@ -1539,7 +1539,7 @@ class Engine {

rejectPendingApproval(
id: string,
reason: Error = ethErrors.provider.userRejectedRequest(),
reason: Error = providerErrors.userRejectedRequest(),
opts: { ignoreMissing?: boolean; logErrors?: boolean } = {},
) {
const { ApprovalController } = this.context;
Expand Down
2 changes: 1 addition & 1 deletion app/core/Permissions/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { errorCodes as rpcErrorCodes } from 'eth-rpc-errors';
import { errorCodes as rpcErrorCodes } from '@metamask/rpc-errors';
import { orderBy } from 'lodash';
import { RestrictedMethods, CaveatTypes } from './constants';
import ImportedEngine from '../Engine';
Expand Down
24 changes: 10 additions & 14 deletions app/core/RPCMethods/RPCMethodMiddleware.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import {
JsonRpcRequest,
JsonRpcResponse,
JsonRpcSuccess,
} from 'json-rpc-engine';
} from '@metamask/json-rpc-engine';
import type { Transaction } from '@metamask/transaction-controller';
import type { ProviderConfig } from '@metamask/network-controller';
import { ethErrors } from 'eth-rpc-errors';
import { providerErrors, rpcErrors } from '@metamask/rpc-errors';
import Engine from '../Engine';
import { store } from '../../store';
import { getPermittedAccounts } from '../Permissions';
Expand Down Expand Up @@ -572,7 +572,7 @@ describe('getRpcMethodMiddleware', () => {
method: 'eth_sendTransaction',
params: [mockTransactionParameters],
};
const expectedError = ethErrors.provider.userRejectedRequest();
const expectedError = providerErrors.userRejectedRequest();

const response = await callMiddleware({ middleware, request });

Expand Down Expand Up @@ -611,7 +611,7 @@ describe('getRpcMethodMiddleware', () => {
method: 'eth_sendTransaction',
params: [mockTransactionParameters],
};
const expectedError = ethErrors.rpc.invalidParams({
const expectedError = rpcErrors.invalidParams({
message: `Invalid parameters: must provide an Ethereum address.`,
});

Expand Down Expand Up @@ -684,7 +684,7 @@ describe('getRpcMethodMiddleware', () => {
method: 'eth_sendTransaction',
params: [mockTransactionParameters],
};
const expectedError = ethErrors.rpc.invalidParams({
const expectedError = rpcErrors.invalidParams({
message: `Invalid parameters: must provide an Ethereum address.`,
});

Expand Down Expand Up @@ -759,7 +759,7 @@ describe('getRpcMethodMiddleware', () => {
method: 'eth_sendTransaction',
params: [mockTransactionParameters],
};
const expectedError = ethErrors.rpc.invalidParams({
const expectedError = rpcErrors.invalidParams({
message: `Invalid parameters: must provide an Ethereum address.`,
});

Expand Down Expand Up @@ -845,7 +845,7 @@ describe('getRpcMethodMiddleware', () => {
method: 'eth_sendTransaction',
params: [mockTransactionParameters],
};
const expectedError = ethErrors.rpc.internal('Failed to add transaction');
const expectedError = rpcErrors.internal('Failed to add transaction');

const response = await callMiddleware({ middleware, request });

Expand Down Expand Up @@ -874,9 +874,7 @@ describe('getRpcMethodMiddleware', () => {
method: 'eth_sendTransaction',
params: [mockTransactionParameters],
};
const expectedError = ethErrors.rpc.internal(
'Failed to process transaction',
);
const expectedError = rpcErrors.internal('Failed to process transaction');

const response = await callMiddleware({ middleware, request });

Expand Down Expand Up @@ -949,9 +947,7 @@ describe('getRpcMethodMiddleware', () => {
method: 'personal_ecRecover',
params: [helloWorldMessage],
};
const expectedError = ethErrors.rpc.internal(
'Missing signature parameter',
);
const expectedError = rpcErrors.internal('Missing signature parameter');

const response = await callMiddleware({ middleware, request });

Expand All @@ -972,7 +968,7 @@ describe('getRpcMethodMiddleware', () => {
method: 'personal_ecRecover',
params: [undefined, helloWorldSignature],
};
const expectedError = ethErrors.rpc.internal('Missing data parameter');
const expectedError = rpcErrors.internal('Missing data parameter');

const response = await callMiddleware({ middleware, request });

Expand Down
Loading
Loading