Skip to content

Commit

Permalink
use preview build from MetaMask/core#4602
Browse files Browse the repository at this point in the history
  • Loading branch information
adonesky1 committed Sep 11, 2024
1 parent fbd9692 commit 082ce4f
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
29 changes: 29 additions & 0 deletions app/core/Engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ import {
ApprovalControllerEvents,
ApprovalControllerState,
} from '@metamask/approval-controller';
import {
METAMASK_DOMAIN,
SelectedNetworkController,
SelectedNetworkControllerState,
createSelectedNetworkMiddleware,
} from '@metamask/selected-network-controller';
import {
PermissionController,
PermissionControllerActions,
Expand Down Expand Up @@ -336,6 +342,7 @@ export interface EngineState {
LoggingController: LoggingControllerState;
PPOMController: PPOMState;
AccountsController: AccountsControllerState;
SelectedNetworkController: SelectedNetworkControllerState;
}

/**
Expand Down Expand Up @@ -898,6 +905,28 @@ class Engine {
unrestrictedMethods,
});

const selectedNetworkController = new SelectedNetworkController({
messenger: this.controllerMessenger.getRestricted({
name: 'SelectedNetworkController',
allowedActions: [
'NetworkController:getNetworkClientById',
'NetworkController:getState',
'NetworkController:getSelectedNetworkClient',
'PermissionController:hasPermissions',
'PermissionController:getSubjectNames',
],
allowedEvents: [
'NetworkController:stateChange',
'PermissionController:stateChange',
],
}),
state: initialState.SelectedNetworkController || { domains: {} },
useRequestQueuePreference: !!process.env.MULTICHAIN_V1,
// @ts-expect-error TODO: Resolve mismatch between PreferenceController versions.
onPreferencesStateChange,
domainProxyMap: new WeakRefObjectMap(),
});

///: BEGIN:ONLY_INCLUDE_IF(preinstalled-snaps,external-snaps)
const subjectMetadataController = new SubjectMetadataController({
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@
"@metamask/rpc-errors": "^6.2.1",
"@metamask/scure-bip39": "^2.1.0",
"@metamask/sdk-communication-layer": "^0.28.1",
"@metamask/selected-network-controller": "^15.0.2",
"@metamask/signature-controller": "^16.0.0",
"@metamask/slip44": "3.1.0",
"@metamask/smart-transactions-controller": "11.0.0",
Expand Down
12 changes: 12 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5065,6 +5065,18 @@
utf-8-validate "^5.0.2"
uuid "^8.3.2"

"@metamask/selected-network-controller@^15.0.2":
version "15.0.2"
resolved "https://registry.yarnpkg.com/@metamask/selected-network-controller/-/selected-network-controller-15.0.2.tgz#6373156a1e837839ea771b61aa065f69b47a90c9"
integrity sha512-B4jZO0g49NwK78Zh391UOZsGYlHlWw/GMVkb9rXDLBYpbXSgiVMb5mdgdfqSWvi2YnFuwiCDPTszwBTM+M+aLA==
dependencies:
"@metamask/base-controller" "^6.0.0"
"@metamask/json-rpc-engine" "^9.0.0"
"@metamask/network-controller" "^19.0.0"
"@metamask/permission-controller" "^10.0.0"
"@metamask/swappable-obj-proxy" "^2.2.0"
"@metamask/utils" "^8.3.0"

"@metamask/signature-controller@^16.0.0":
version "16.0.0"
resolved "https://registry.yarnpkg.com/@metamask/signature-controller/-/signature-controller-16.0.0.tgz#78c7f23d02da99d4e953eb9b4e8e2909523a3288"
Expand Down

0 comments on commit 082ce4f

Please sign in to comment.