Skip to content

Commit

Permalink
Use controllers monorepo packages
Browse files Browse the repository at this point in the history
  • Loading branch information
FrederikBolding committed Nov 22, 2022
1 parent 4e63ed8 commit 8689e6e
Show file tree
Hide file tree
Showing 36 changed files with 121 additions and 1,621 deletions.
2 changes: 1 addition & 1 deletion packages/rpc-methods/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"publish:package": "../../scripts/publish-package.sh"
},
"dependencies": {
"@metamask/controllers": "^32.0.2",
"@metamask/key-tree": "^6.0.0",
"@metamask/permission-controller": "^1.0.0",
"@metamask/snaps-utils": "^0.24.1",
"@metamask/types": "^1.1.0",
"@metamask/utils": "^3.3.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RequestedPermissions } from '@metamask/controllers';
import { RequestedPermissions } from '@metamask/permission-controller';
import { InstallSnapsResult } from '@metamask/snaps-utils';
import { isObject } from '@metamask/utils';
import { ethErrors } from 'eth-rpc-errors';
Expand Down
3 changes: 1 addition & 2 deletions packages/rpc-methods/src/permitted/requestSnaps.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RequestedPermissions } from '@metamask/controllers';
import { RequestedPermissions } from '@metamask/permission-controller';
import {
getSnapPermissionName,
InstallSnapsResult,
Expand All @@ -13,7 +13,6 @@ import {
PendingJsonRpcResponse,
} from '@metamask/types';
import { JsonRpcEngine } from 'json-rpc-engine';

import { requestSnapsHandler } from './requestSnaps';

describe('requestSnapsHandler', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/rpc-methods/src/permitted/requestSnaps.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
PermissionConstraint,
RequestedPermissions,
} from '@metamask/controllers';
} from '@metamask/permission-controller';
import { getSnapPermissionName } from '@metamask/snaps-utils';
import {
PermittedHandlerExport,
Expand Down
2 changes: 1 addition & 1 deletion packages/rpc-methods/src/restricted/confirm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
PermissionType,
RestrictedMethodOptions,
ValidPermissionSpecification,
} from '@metamask/controllers';
} from '@metamask/permission-controller';
import { isObject, NonEmptyArray } from '@metamask/utils';
import { ethErrors } from 'eth-rpc-errors';

Expand Down
2 changes: 1 addition & 1 deletion packages/rpc-methods/src/restricted/dialog.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PermissionType } from '@metamask/controllers';
import { PermissionType } from '@metamask/permission-controller';

import {
dialogBuilder,
Expand Down
2 changes: 1 addition & 1 deletion packages/rpc-methods/src/restricted/dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
PermissionType,
RestrictedMethodOptions,
ValidPermissionSpecification,
} from '@metamask/controllers';
} from '@metamask/permission-controller';
import { NonEmptyArray } from '@metamask/utils';
import { ethErrors } from 'eth-rpc-errors';
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/rpc-methods/src/restricted/getBip32Entropy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
RestrictedMethodCaveatSpecificationConstraint,
RestrictedMethodOptions,
ValidPermissionSpecification,
} from '@metamask/controllers';
} from '@metamask/permission-controller';
import { BIP32Node, JsonSLIP10Node, SLIP10Node } from '@metamask/key-tree';
import {
Bip32Entropy,
Expand Down
2 changes: 1 addition & 1 deletion packages/rpc-methods/src/restricted/getBip32PublicKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
PermissionValidatorConstraint,
RestrictedMethodOptions,
ValidPermissionSpecification,
} from '@metamask/controllers';
} from '@metamask/permission-controller';
import { BIP32Node, SLIP10Node } from '@metamask/key-tree';
import {
Bip32Entropy,
Expand Down
2 changes: 1 addition & 1 deletion packages/rpc-methods/src/restricted/getBip44Entropy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
ValidPermissionSpecification,
PermissionConstraint,
RestrictedMethodCaveatSpecificationConstraint,
} from '@metamask/controllers';
} from '@metamask/permission-controller';
import { BIP44CoinTypeNode, JsonBIP44CoinTypeNode } from '@metamask/key-tree';
import { SnapCaveatType } from '@metamask/snaps-utils';
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/rpc-methods/src/restricted/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PermissionConstraint } from '@metamask/controllers';
import { PermissionConstraint } from '@metamask/permission-controller';
import { Json } from '@metamask/utils';

import { confirmBuilder, ConfirmMethodHooks } from './confirm';
Expand Down
2 changes: 1 addition & 1 deletion packages/rpc-methods/src/restricted/invokeSnap.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PermissionType } from '@metamask/controllers';
import { PermissionType } from '@metamask/permission-controller';
import {
MOCK_SNAP_ID,
MOCK_ORIGIN,
Expand Down
2 changes: 1 addition & 1 deletion packages/rpc-methods/src/restricted/invokeSnap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
RestrictedMethodOptions,
ValidPermissionSpecification,
PermissionType,
} from '@metamask/controllers';
} from '@metamask/permission-controller';
import {
Snap,
SNAP_PREFIX,
Expand Down
2 changes: 1 addition & 1 deletion packages/rpc-methods/src/restricted/manageState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
PermissionType,
RestrictedMethodOptions,
ValidPermissionSpecification,
} from '@metamask/controllers';
} from '@metamask/permission-controller';
import {
Json,
NonEmptyArray,
Expand Down
2 changes: 1 addition & 1 deletion packages/rpc-methods/src/restricted/notify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
PermissionType,
RestrictedMethodOptions,
ValidPermissionSpecification,
} from '@metamask/controllers';
} from '@metamask/permission-controller';
import { NonEmptyArray, isObject } from '@metamask/utils';
import { ethErrors } from 'eth-rpc-errors';

Expand Down
4 changes: 3 additions & 1 deletion packages/snaps-controllers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@
"publish:package": "../../scripts/publish-package.sh"
},
"dependencies": {
"@metamask/approval-controller": "^1.0.0",
"@metamask/base-controller": "^1.0.0",
"@metamask/browser-passworder": "^3.0.0",
"@metamask/controllers": "^32.0.2",
"@metamask/object-multiplex": "^1.1.0",
"@metamask/permission-controller": "^1.0.0",
"@metamask/post-message-stream": "^6.0.0",
"@metamask/rpc-methods": "^0.24.1",
"@metamask/snaps-execution-environments": "^0.24.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/snaps-controllers/src/cronjob/CronjobController.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
BaseControllerV2 as BaseController,
RestrictedControllerMessenger,
GetPermissions,
} from '@metamask/controllers';
} from '@metamask/base-controller';
import { GetPermissions } from '@metamask/permission-controller';
import {
HandlerType,
SnapId,
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-controllers/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type { Json } from '@metamask/controllers';
export type { Json } from '@metamask/utils';
export * from './services';
export * from './snaps';
export * from './utils';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { BaseControllerV2 as BaseController } from '@metamask/base-controller';
import {
AddApprovalRequest,
BaseControllerV2 as BaseController,
GetPermissions,
GrantPermissions,
HasPermission,
PermissionConstraint,
RestrictedControllerMessenger,
} from '@metamask/controllers';
} from '@metamask/permission-controller';
import { SnapKeyring } from '@metamask/snaps-types';
import {
parseAccountId,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RestrictedControllerMessenger } from '@metamask/controllers';
import { RestrictedControllerMessenger } from '@metamask/base-controller';
import { SnapId, SnapRpcHookArgs } from '@metamask/snaps-utils';
import { Json } from '@metamask/types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
getPersistentState,
SubjectPermissions,
ValidPermission,
} from '@metamask/controllers';
} from '@metamask/permission-controller';
import {
DEFAULT_ENDOWMENTS,
getSnapSourceShasum,
Expand Down
6 changes: 3 additions & 3 deletions packages/snaps-controllers/src/snaps/SnapController.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import passworder from '@metamask/browser-passworder';
import { BaseControllerV2 as BaseController } from '@metamask/base-controller';
import { AddApprovalRequest } from '@metamask/approval-controller';
import {
AddApprovalRequest,
BaseControllerV2 as BaseController,
Caveat,
GetEndowments,
GetPermissions,
Expand All @@ -16,7 +16,7 @@ import {
RevokePermissions,
SubjectPermissions,
ValidPermission,
} from '@metamask/controllers';
} from '@metamask/permission-controller';
import { caveatMappers } from '@metamask/rpc-methods';
import {
assertIsSnapManifest,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Caveat, PermissionType } from '@metamask/controllers';
import { Caveat, PermissionType } from '@metamask/permission-controller';
import { SnapCaveatType } from '@metamask/snaps-utils';

import { SnapEndowments } from '.';
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-controllers/src/snaps/endowments/cronjob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
PermissionConstraint,
Caveat,
CaveatSpecificationConstraint,
} from '@metamask/controllers';
} from '@metamask/permission-controller';
import {
SnapCaveatType,
CronjobSpecification,
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-controllers/src/snaps/endowments/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PermissionConstraint } from '@metamask/controllers';
import { PermissionConstraint } from '@metamask/permission-controller';
import { Json } from '@metamask/utils';

import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { PermissionConstraint, PermissionType } from '@metamask/controllers';
import {
PermissionConstraint,
PermissionType,
} from '@metamask/permission-controller';
import { SnapCaveatType } from '@metamask/snaps-utils';
import { getNamespace } from '@metamask/snaps-utils/test-utils';

Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-controllers/src/snaps/endowments/keyring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
PermissionType,
PermissionValidatorConstraint,
ValidPermissionSpecification,
} from '@metamask/controllers';
} from '@metamask/permission-controller';
import {
assertIsNamespacesObject,
Namespaces,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PermissionType } from '@metamask/controllers';
import { PermissionType } from '@metamask/permission-controller';

import { SnapEndowments } from '.';
import { longRunningEndowmentBuilder } from './long-running';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import {
PermissionType,
EndowmentGetterParams,
ValidPermissionSpecification,
} from '@metamask/controllers';

} from '@metamask/permission-controller';
import { SnapEndowments } from './enum';

const permissionName = SnapEndowments.LongRunning;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PermissionType } from '@metamask/controllers';
import { PermissionType } from '@metamask/permission-controller';

import { SnapEndowments } from './enum';
import { networkAccessEndowmentBuilder } from './network-access';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
PermissionSpecificationBuilder,
PermissionType,
ValidPermissionSpecification,
} from '@metamask/controllers';
} from '@metamask/permission-controller';

import { SnapEndowments } from './enum';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PermissionConstraint, PermissionType } from '@metamask/controllers';
import { PermissionConstraint, PermissionType } from '@metamask/permission-controller';
import { SnapCaveatType } from '@metamask/snaps-utils';

import { SnapEndowments } from '.';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
PermissionConstraint,
CaveatSpecificationConstraint,
Caveat,
} from '@metamask/controllers';
} from '@metamask/permission-controller';
import { SnapCaveatType } from '@metamask/snaps-utils';
import {
assert,
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-controllers/src/test-utils/controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ControllerMessenger } from '@metamask/controllers';
import { ControllerMessenger } from '@metamask/base-controller';
import { getPersistedSnapObject } from '@metamask/snaps-utils/test-utils';

import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ControllerMessenger } from '@metamask/controllers';
import { ControllerMessenger } from '@metamask/base-controller';
import { SnapRpcHookArgs } from '@metamask/snaps-utils';
import { JsonRpcEngine } from 'json-rpc-engine';
import { createEngineStream } from 'json-rpc-middleware-stream';
Expand Down
Loading

0 comments on commit 8689e6e

Please sign in to comment.