Skip to content

Commit

Permalink
Merge branch 'Version-v12.6.0' into chore--v12.6.0-changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
benjisclowder authored Oct 31, 2024
2 parents 72db34d + 8b7ad81 commit 6467110
Show file tree
Hide file tree
Showing 22 changed files with 495 additions and 364 deletions.
3 changes: 2 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ npmAuditIgnoreAdvisories:
# Currently in use for the network list drag and drop functionality.
# Maintenance has stopped and the project will be archived in 2025.
- 'react-beautiful-dnd (deprecation)'

# New package name format for new versions: @ethereumjs/wallet.
- 'ethereumjs-wallet (deprecation)'
npmRegistries:
'https://npm.pkg.github.com':
npmAlwaysAuth: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { jsonrpc2, Json } from '@metamask/utils';
import { BtcAccountType, EthAccountType } from '@metamask/keyring-api';
import type { JsonRpcParams, JsonRpcRequest } from '@metamask/utils';
import createEvmMethodsToNonEvmAccountReqFilterMiddleware, {
EvmMethodsToNonEvmAccountFilterMessenger,
} from './createEvmMethodsToNonEvmAccountReqFilterMiddleware';

describe('createEvmMethodsToNonEvmAccountReqFilterMiddleware', () => {
const getMockRequest = (method: string, params: Json) => ({
const getMockRequest = (method: string, params: Record<string, Json>) => ({
jsonrpc: jsonrpc2,
id: 1,
method,
Expand Down Expand Up @@ -286,7 +285,7 @@ describe('createEvmMethodsToNonEvmAccountReqFilterMiddleware', () => {
}: {
accountType: EthAccountType | BtcAccountType;
method: string;
params: Json;
params: Record<string, Json>;
calledNext: number;
}) => {
const filterFn = createEvmMethodsToNonEvmAccountReqFilterMiddleware({
Expand All @@ -298,7 +297,7 @@ describe('createEvmMethodsToNonEvmAccountReqFilterMiddleware', () => {
const mockEnd = jest.fn();

filterFn(
getMockRequest(method, params) as JsonRpcRequest<JsonRpcParams>,
getMockRequest(method, params),
getMockResponse(),
mockNext,
mockEnd,
Expand Down
46 changes: 28 additions & 18 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,11 @@ import {
NotificationServicesController,
} from '@metamask/notification-services-controller';
import { isProduction } from '../../shared/modules/environment';
import { methodsRequiringNetworkSwitch } from '../../shared/constants/methods-tags';
import {
methodsRequiringNetworkSwitch,
methodsThatCanSwitchNetworkWithoutApproval,
methodsThatShouldBeEnqueued,
} from '../../shared/constants/methods-tags';

///: BEGIN:ONLY_INCLUDE_IF(build-mmi)
import { toChecksumHexAddress } from '../../shared/modules/hexstring-utils';
Expand Down Expand Up @@ -486,22 +490,6 @@ export default class MetamaskController extends EventEmitter {
this.approvalController.clear(providerErrors.userRejectedRequest());
};

this.queuedRequestController = new QueuedRequestController({
messenger: this.controllerMessenger.getRestricted({
name: 'QueuedRequestController',
allowedActions: [
'NetworkController:getState',
'NetworkController:setActiveNetwork',
'SelectedNetworkController:getNetworkClientIdForDomain',
],
allowedEvents: ['SelectedNetworkController:stateChange'],
}),
shouldRequestSwitchNetwork: ({ method }) =>
methodsRequiringNetworkSwitch.includes(method),
clearPendingConfirmations,
showApprovalRequest: opts.showUserConfirmation,
});

this.approvalController = new ApprovalController({
messenger: this.controllerMessenger.getRestricted({
name: 'ApprovalController',
Expand All @@ -517,6 +505,28 @@ export default class MetamaskController extends EventEmitter {
],
});

this.queuedRequestController = new QueuedRequestController({
messenger: this.controllerMessenger.getRestricted({
name: 'QueuedRequestController',
allowedActions: [
'NetworkController:getState',
'NetworkController:setActiveNetwork',
'SelectedNetworkController:getNetworkClientIdForDomain',
],
allowedEvents: ['SelectedNetworkController:stateChange'],
}),
shouldRequestSwitchNetwork: ({ method }) =>
methodsRequiringNetworkSwitch.includes(method),
canRequestSwitchNetworkWithoutApproval: ({ method }) =>
methodsThatCanSwitchNetworkWithoutApproval.includes(method),
clearPendingConfirmations,
showApprovalRequest: () => {
if (this.approvalController.getTotalApprovalCount() > 0) {
opts.showUserConfirmation();
}
},
});

///: BEGIN:ONLY_INCLUDE_IF(build-mmi)
this.mmiConfigurationController = new MmiConfigurationController({
initState: initState.MmiConfigurationController,
Expand Down Expand Up @@ -5642,7 +5652,7 @@ export default class MetamaskController extends EventEmitter {
this.preferencesController,
),
shouldEnqueueRequest: (request) => {
return methodsRequiringNetworkSwitch.includes(request.method);
return methodsThatShouldBeEnqueued.includes(request.method);
},
});
engine.push(requestQueueMiddleware);
Expand Down
112 changes: 53 additions & 59 deletions lavamoat/browserify/beta/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -787,15 +787,30 @@
},
"packages": {
"@ethereumjs/tx>@ethereumjs/util": true,
"@metamask/controller-utils>@metamask/utils": true,
"@metamask/controller-utils>@spruceid/siwe-parser": true,
"@metamask/ethjs>@metamask/ethjs-unit": true,
"@metamask/utils": true,
"bn.js": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true
}
},
"@metamask/controller-utils>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/utils>@metamask/superstruct": true,
"@metamask/utils>@scure/base": true,
"@metamask/utils>pony-cause": true,
"@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true
}
},
"@metamask/controller-utils>@spruceid/siwe-parser": {
"globals": {
"console.error": true,
Expand Down Expand Up @@ -1354,9 +1369,24 @@
},
"@metamask/json-rpc-engine": {
"packages": {
"@metamask/json-rpc-engine>@metamask/utils": true,
"@metamask/rpc-errors": true,
"@metamask/safe-event-emitter": true,
"@metamask/utils": true
"@metamask/safe-event-emitter": true
}
},
"@metamask/json-rpc-engine>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/utils>@metamask/superstruct": true,
"@metamask/utils>@scure/base": true,
"@metamask/utils>pony-cause": true,
"@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true
}
},
"@metamask/keyring-api": {
Expand Down Expand Up @@ -2197,64 +2227,13 @@
},
"@metamask/queued-request-controller": {
"packages": {
"@metamask/queued-request-controller>@metamask/base-controller": true,
"@metamask/queued-request-controller>@metamask/json-rpc-engine": true,
"@metamask/queued-request-controller>@metamask/rpc-errors": true,
"@metamask/base-controller": true,
"@metamask/json-rpc-engine": true,
"@metamask/queued-request-controller>@metamask/utils": true,
"@metamask/rpc-errors": true,
"@metamask/selected-network-controller": true
}
},
"@metamask/queued-request-controller>@metamask/base-controller": {
"globals": {
"setTimeout": true
},
"packages": {
"immer": true
}
},
"@metamask/queued-request-controller>@metamask/json-rpc-engine": {
"packages": {
"@metamask/queued-request-controller>@metamask/json-rpc-engine>@metamask/utils": true,
"@metamask/queued-request-controller>@metamask/rpc-errors": true,
"@metamask/safe-event-emitter": true
}
},
"@metamask/queued-request-controller>@metamask/json-rpc-engine>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/utils>@metamask/superstruct": true,
"@metamask/utils>@scure/base": true,
"@metamask/utils>pony-cause": true,
"@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true
}
},
"@metamask/queued-request-controller>@metamask/rpc-errors": {
"packages": {
"@metamask/queued-request-controller>@metamask/rpc-errors>@metamask/utils": true,
"@metamask/rpc-errors>fast-safe-stringify": true
}
},
"@metamask/queued-request-controller>@metamask/rpc-errors>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/utils>@metamask/superstruct": true,
"@metamask/utils>@scure/base": true,
"@metamask/utils>pony-cause": true,
"@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true
}
},
"@metamask/queued-request-controller>@metamask/utils": {
"globals": {
"TextDecoder": true,
Expand Down Expand Up @@ -2326,8 +2305,23 @@
},
"@metamask/rpc-errors": {
"packages": {
"@metamask/rpc-errors>fast-safe-stringify": true,
"@metamask/utils": true
"@metamask/rpc-errors>@metamask/utils": true,
"@metamask/rpc-errors>fast-safe-stringify": true
}
},
"@metamask/rpc-errors>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/utils>@metamask/superstruct": true,
"@metamask/utils>@scure/base": true,
"@metamask/utils>pony-cause": true,
"@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true
}
},
"@metamask/rpc-methods-flask>nanoid": {
Expand Down
Loading

0 comments on commit 6467110

Please sign in to comment.