1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-22 17:33:23 +01:00

[FLASK] snaps@0.34.0-flask.1 (#19377)

* snaps@0.34.0-flask.1

* Update LavaMoat policies

* Replace instances of targetKey with targetName

* Replace use of PermissionKeys with PermissionNames

* Use Flask packages in tests for now

* Bump execution env

* Add another mock

* Fix lint
This commit is contained in:
Frederik Bolding 2023-06-05 13:51:19 +02:00 committed by GitHub
parent 1726fb3fd0
commit f03f2d3f79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 379 additions and 210 deletions

View File

@ -8,15 +8,17 @@ import {
ExcludedSnapPermissions,
} from '../../../../../shared/constants/permissions';
// TODO: Use the exported versions of these functions from the snaps monorepo after stable release.
/**
* @returns {Record<string, Record<string, unknown>>} All endowment permission
* specifications.
*/
export const buildSnapEndowmentSpecifications = () =>
Object.values(endowmentPermissionBuilders).reduce(
(allSpecifications, { targetKey, specificationBuilder }) => {
if (!Object.keys(ExcludedSnapEndowments).includes(targetKey)) {
allSpecifications[targetKey] = specificationBuilder();
(allSpecifications, { targetName, specificationBuilder }) => {
if (!Object.keys(ExcludedSnapEndowments).includes(targetName)) {
allSpecifications[targetName] = specificationBuilder();
}
return allSpecifications;
},
@ -29,9 +31,9 @@ export const buildSnapEndowmentSpecifications = () =>
*/
export const buildSnapRestrictedMethodSpecifications = (hooks) =>
Object.values(restrictedMethodPermissionBuilders).reduce(
(specifications, { targetKey, specificationBuilder, methodHooks }) => {
if (!Object.keys(ExcludedSnapPermissions).includes(targetKey)) {
specifications[targetKey] = specificationBuilder({
(specifications, { targetName, specificationBuilder, methodHooks }) => {
if (!Object.keys(ExcludedSnapPermissions).includes(targetName)) {
specifications[targetName] = specificationBuilder({
methodHooks: selectHooks(hooks, methodHooks),
});
}

View File

@ -8,6 +8,14 @@ import {
buildSnapRestrictedMethodSpecifications,
} from './snap-permissions';
// Temporarily replace the snaps packages with the Flask versions.
jest.mock('@metamask/snaps-controllers', () =>
jest.requireActual('@metamask/snaps-controllers-flask'),
);
jest.mock('@metamask/rpc-methods', () =>
jest.requireActual('@metamask/rpc-methods-flask'),
);
describe('buildSnapRestrictedMethodSpecifications', () => {
it('creates valid permission specification objects', () => {
const hooks = {
@ -29,7 +37,7 @@ describe('buildSnapRestrictedMethodSpecifications', () => {
Object.values(specifications).forEach((specification) => {
expect(specification).toMatchObject({
targetKey: expect.stringMatching(/^(snap_|wallet_)/u),
targetName: expect.stringMatching(/^(snap_|wallet_)/u),
methodImplementation: expect.any(Function),
});
});
@ -43,8 +51,8 @@ describe('buildSnapEndowmentSpecifications', () => {
).toStrictEqual(
Object.keys(EndowmentPermissions)
.filter(
(targetKey) =>
!Object.keys(ExcludedSnapEndowments).includes(targetKey),
(targetName) =>
!Object.keys(ExcludedSnapEndowments).includes(targetName),
)
.sort(),
);

View File

@ -21,7 +21,7 @@ import {
* The "keys" of all of permissions recognized by the PermissionController.
* Permission keys and names have distinct meanings in the permission system.
*/
const PermissionKeys = Object.freeze({
const PermissionNames = Object.freeze({
...RestrictedMethods,
});
@ -101,22 +101,22 @@ export const getPermissionSpecifications = ({
captureKeyringTypesWithMissingIdentities,
}) => {
return {
[PermissionKeys.eth_accounts]: {
[PermissionNames.eth_accounts]: {
permissionType: PermissionType.RestrictedMethod,
targetKey: PermissionKeys.eth_accounts,
targetName: PermissionNames.eth_accounts,
allowedCaveats: [CaveatTypes.restrictReturnedAccounts],
factory: (permissionOptions, requestData) => {
if (Array.isArray(permissionOptions.caveats)) {
throw new Error(
`${PermissionKeys.eth_accounts} error: Received unexpected caveats. Any permitted caveats will be added automatically.`,
`${PermissionNames.eth_accounts} error: Received unexpected caveats. Any permitted caveats will be added automatically.`,
);
}
// This value will be further validated as part of the caveat.
if (!requestData.approvedAccounts) {
throw new Error(
`${PermissionKeys.eth_accounts} error: No approved accounts specified.`,
`${PermissionNames.eth_accounts} error: No approved accounts specified.`,
);
}
@ -169,7 +169,7 @@ export const getPermissionSpecifications = ({
caveats[0].type !== CaveatTypes.restrictReturnedAccounts
) {
throw new Error(
`${PermissionKeys.eth_accounts} error: Invalid caveats. There must be a single caveat of type "${CaveatTypes.restrictReturnedAccounts}".`,
`${PermissionNames.eth_accounts} error: Invalid caveats. There must be a single caveat of type "${CaveatTypes.restrictReturnedAccounts}".`,
);
}
},
@ -189,7 +189,7 @@ export const getPermissionSpecifications = ({
function validateCaveatAccounts(accounts, getIdentities) {
if (!Array.isArray(accounts) || accounts.length === 0) {
throw new Error(
`${PermissionKeys.eth_accounts} error: Expected non-empty array of Ethereum addresses.`,
`${PermissionNames.eth_accounts} error: Expected non-empty array of Ethereum addresses.`,
);
}
@ -197,13 +197,13 @@ function validateCaveatAccounts(accounts, getIdentities) {
accounts.forEach((address) => {
if (!address || typeof address !== 'string') {
throw new Error(
`${PermissionKeys.eth_accounts} error: Expected an array of Ethereum addresses. Received: "${address}".`,
`${PermissionNames.eth_accounts} error: Expected an array of Ethereum addresses. Received: "${address}".`,
);
}
if (!identities[address]) {
throw new Error(
`${PermissionKeys.eth_accounts} error: Received unrecognized address: "${address}".`,
`${PermissionNames.eth_accounts} error: Received unrecognized address: "${address}".`,
);
}
});

View File

@ -144,7 +144,7 @@ describe('PermissionController specifications', () => {
const permissionSpecifications = getPermissionSpecifications({});
expect(Object.keys(permissionSpecifications)).toHaveLength(1);
expect(
permissionSpecifications[RestrictedMethods.eth_accounts].targetKey,
permissionSpecifications[RestrictedMethods.eth_accounts].targetName,
).toStrictEqual(RestrictedMethods.eth_accounts);
});

View File

@ -43,11 +43,26 @@ const createLoggerMiddlewareMock = () => (req, res, next) => {
next();
};
// Temporarily replace the snaps packages with the Flask versions.
const proxyPermissions = proxyquire('./controllers/permissions', {
'./snaps/snap-permissions': proxyquire(
'./controllers/permissions/snaps/snap-permissions',
{
// eslint-disable-next-line node/global-require
'@metamask/snaps-controllers': require('@metamask/snaps-controllers-flask'),
// eslint-disable-next-line node/global-require
'@metamask/rpc-methods': require('@metamask/rpc-methods-flask'),
},
),
});
const TEST_SEED =
'debris dizzy just program just float decrease vacant alarm reduce speak stadium';
const MetaMaskController = proxyquire('./metamask-controller', {
'./lib/createLoggerMiddleware': { default: createLoggerMiddlewareMock },
// Temporarily replace the snaps packages with the Flask versions.
'./controllers/permissions': proxyPermissions,
}).default;
describe('MetaMaskController', function () {

View File

@ -72,6 +72,19 @@ function MockEthContract() {
};
}
// Temporarily replace the snaps packages with the Flask versions.
const proxyPermissions = proxyquire('./controllers/permissions', {
'./snaps/snap-permissions': proxyquire(
'./controllers/permissions/snaps/snap-permissions',
{
// eslint-disable-next-line node/global-require
'@metamask/snaps-controllers': require('@metamask/snaps-controllers-flask'),
// eslint-disable-next-line node/global-require
'@metamask/rpc-methods': require('@metamask/rpc-methods-flask'),
},
),
});
// TODO, Feb 24, 2023:
// ethjs-contract is being added to proxyquire, but we might want to discontinue proxyquire
// this is for expediency as we resolve a bug for v10.26.0. The proper solution here would have
@ -80,10 +93,14 @@ function MockEthContract() {
const MetaMaskController = proxyquire('./metamask-controller', {
'./lib/createLoggerMiddleware': { default: createLoggerMiddlewareMock },
'ethjs-contract': MockEthContract,
// Temporarily replace the snaps packages with the Flask versions.
'./controllers/permissions': proxyPermissions,
}).default;
const MetaMaskControllerMV3 = proxyquire('./metamask-controller', {
'../../shared/modules/mv3.utils': { isManifestV3: true },
// Temporarily replace the snaps packages with the Flask versions.
'./controllers/permissions': proxyPermissions,
}).default;
const currentNetworkId = '5';

View File

@ -50,7 +50,7 @@ buildTypes:
- SEGMENT_FLASK_WRITE_KEY
- ALLOW_LOCAL_SNAPS: true
- REQUIRE_SNAPS_ALLOWLIST: false
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/0.16.0-flask.1/index.html
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/0.16.1-flask.1/index.html
- SUPPORT_LINK: https://metamask-flask.zendesk.com/hc
- SUPPORT_REQUEST_LINK: https://metamask-flask.zendesk.com/hc/en-us/requests/new
- INFURA_ENV_KEY_REF: INFURA_FLASK_PROJECT_ID
@ -68,7 +68,7 @@ buildTypes:
- SEGMENT_FLASK_WRITE_KEY
- ALLOW_LOCAL_SNAPS: true
- REQUIRE_SNAPS_ALLOWLIST: false
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/0.16.0-flask.1/index.html
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/0.16.1-flask.1/index.html
- SUPPORT_LINK: https://metamask-flask.zendesk.com/hc
- SUPPORT_REQUEST_LINK: https://metamask-flask.zendesk.com/hc/en-us/requests/new
- INFURA_ENV_KEY_REF: INFURA_FLASK_PROJECT_ID

View File

@ -1673,37 +1673,16 @@
"console.error": true
},
"packages": {
"@metamask/permission-controller>@metamask/base-controller": true,
"@metamask/permission-controller>@metamask/controller-utils": true,
"@metamask/base-controller": true,
"@metamask/controller-utils": true,
"@metamask/permission-controller>nanoid": true,
"@metamask/utils": true,
"deep-freeze-strict": true,
"eth-rpc-errors": true,
"immer": true,
"json-rpc-engine": true
}
},
"@metamask/permission-controller>@metamask/base-controller": {
"packages": {
"immer": true
}
},
"@metamask/permission-controller>@metamask/controller-utils": {
"globals": {
"URL": true,
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/controller-utils>@spruceid/siwe-parser": true,
"@metamask/utils": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/permission-controller>nanoid": {
"globals": {
"crypto.getRandomValues": true

View File

@ -1751,37 +1751,16 @@
"console.error": true
},
"packages": {
"@metamask/permission-controller>@metamask/base-controller": true,
"@metamask/permission-controller>@metamask/controller-utils": true,
"@metamask/base-controller": true,
"@metamask/controller-utils": true,
"@metamask/permission-controller>nanoid": true,
"@metamask/utils": true,
"deep-freeze-strict": true,
"eth-rpc-errors": true,
"immer": true,
"json-rpc-engine": true
}
},
"@metamask/permission-controller>@metamask/base-controller": {
"packages": {
"immer": true
}
},
"@metamask/permission-controller>@metamask/controller-utils": {
"globals": {
"URL": true,
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/controller-utils>@spruceid/siwe-parser": true,
"@metamask/utils": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/permission-controller>nanoid": {
"globals": {
"crypto.getRandomValues": true
@ -1902,15 +1881,15 @@
"@metamask/permission-controller": true,
"@metamask/rpc-methods-flask>@metamask/snaps-ui": true,
"@metamask/rpc-methods-flask>@metamask/snaps-utils": true,
"@metamask/rpc-methods-flask>@metamask/utils": true,
"@metamask/rpc-methods-flask>nanoid": true,
"@metamask/utils": true,
"eth-rpc-errors": true,
"superstruct": true
}
},
"@metamask/rpc-methods-flask>@metamask/snaps-ui": {
"packages": {
"@metamask/utils": true,
"@metamask/rpc-methods-flask>@metamask/utils": true,
"superstruct": true
}
},
@ -1927,11 +1906,25 @@
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"@metamask/key-tree>@scure/base": true,
"@metamask/rpc-methods-flask>@metamask/utils": true,
"@metamask/snaps-utils-flask>is-svg": true,
"@metamask/snaps-utils>cron-parser": true,
"@metamask/snaps-utils>fast-json-stable-stringify": true,
"@metamask/snaps-utils>rfdc": true,
"@metamask/snaps-utils>validate-npm-package-name": true,
"@metamask/utils": true,
"browserify>buffer": true,
"semver": true,
"superstruct": true
}
},
"@metamask/rpc-methods-flask>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
"superstruct": true
}
@ -2087,12 +2080,13 @@
"setTimeout": true
},
"packages": {
"@metamask/base-controller": true,
"@metamask/permission-controller": true,
"@metamask/post-message-stream": true,
"@metamask/providers>@metamask/object-multiplex": true,
"@metamask/snaps-controllers-flask>@metamask/base-controller": true,
"@metamask/snaps-controllers-flask>@metamask/rpc-methods": true,
"@metamask/snaps-controllers-flask>@metamask/snaps-utils": true,
"@metamask/snaps-controllers-flask>@metamask/utils": true,
"@metamask/snaps-controllers-flask>concat-stream": true,
"@metamask/snaps-controllers-flask>nanoid": true,
"@metamask/snaps-controllers>@xstate/fsm": true,
@ -2100,18 +2094,12 @@
"@metamask/snaps-controllers>readable-web-to-node-stream": true,
"@metamask/snaps-controllers>tar-stream": true,
"@metamask/snaps-utils>@metamask/snaps-registry": true,
"@metamask/utils": true,
"eth-rpc-errors": true,
"json-rpc-engine": true,
"json-rpc-middleware-stream": true,
"pump": true
}
},
"@metamask/snaps-controllers-flask>@metamask/base-controller": {
"packages": {
"immer": true
}
},
"@metamask/snaps-controllers-flask>@metamask/rpc-methods": {
"packages": {
"@metamask/key-tree": true,
@ -2119,8 +2107,8 @@
"@metamask/permission-controller": true,
"@metamask/snaps-controllers-flask>@metamask/snaps-utils": true,
"@metamask/snaps-controllers-flask>@metamask/snaps-utils>@metamask/snaps-ui": true,
"@metamask/snaps-controllers-flask>@metamask/utils": true,
"@metamask/snaps-controllers-flask>nanoid": true,
"@metamask/utils": true,
"eth-rpc-errors": true,
"superstruct": true
}
@ -2138,18 +2126,32 @@
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"@metamask/key-tree>@scure/base": true,
"@metamask/snaps-controllers-flask>@metamask/utils": true,
"@metamask/snaps-utils-flask>is-svg": true,
"@metamask/snaps-utils>cron-parser": true,
"@metamask/snaps-utils>fast-json-stable-stringify": true,
"@metamask/snaps-utils>rfdc": true,
"@metamask/snaps-utils>validate-npm-package-name": true,
"@metamask/utils": true,
"browserify>buffer": true,
"semver": true,
"superstruct": true
}
},
"@metamask/snaps-controllers-flask>@metamask/snaps-utils>@metamask/snaps-ui": {
"packages": {
"@metamask/utils": true,
"@metamask/snaps-controllers-flask>@metamask/utils": true,
"superstruct": true
}
},
"@metamask/snaps-controllers-flask>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
"superstruct": true
}
},
@ -2306,7 +2308,19 @@
},
"@metamask/snaps-ui-flask": {
"packages": {
"@metamask/utils": true,
"@metamask/snaps-ui-flask>@metamask/utils": true,
"superstruct": true
}
},
"@metamask/snaps-ui-flask>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
"superstruct": true
}
},
@ -2323,19 +2337,59 @@
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"@metamask/key-tree>@scure/base": true,
"@metamask/snaps-utils-flask>@metamask/utils": true,
"@metamask/snaps-utils-flask>is-svg": true,
"@metamask/snaps-utils>cron-parser": true,
"@metamask/snaps-utils>fast-json-stable-stringify": true,
"@metamask/snaps-utils>rfdc": true,
"@metamask/snaps-utils>validate-npm-package-name": true,
"@metamask/utils": true,
"browserify>buffer": true,
"semver": true,
"superstruct": true
}
},
"@metamask/snaps-utils-flask>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
"superstruct": true
}
},
"@metamask/snaps-utils-flask>is-svg": {
"packages": {
"@metamask/snaps-utils-flask>is-svg>fast-xml-parser": true
}
},
"@metamask/snaps-utils-flask>is-svg>fast-xml-parser": {
"globals": {
"entityName": true,
"val": true
},
"packages": {
"@metamask/snaps-utils-flask>is-svg>fast-xml-parser>strnum": true
}
},
"@metamask/snaps-utils>@metamask/snaps-registry": {
"packages": {
"@metamask/key-tree>@noble/secp256k1": true,
"@metamask/utils": true,
"@metamask/snaps-utils>@metamask/snaps-registry>@metamask/utils": true,
"superstruct": true
}
},
"@metamask/snaps-utils>@metamask/snaps-registry>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
"superstruct": true
}
},

View File

@ -1751,37 +1751,16 @@
"console.error": true
},
"packages": {
"@metamask/permission-controller>@metamask/base-controller": true,
"@metamask/permission-controller>@metamask/controller-utils": true,
"@metamask/base-controller": true,
"@metamask/controller-utils": true,
"@metamask/permission-controller>nanoid": true,
"@metamask/utils": true,
"deep-freeze-strict": true,
"eth-rpc-errors": true,
"immer": true,
"json-rpc-engine": true
}
},
"@metamask/permission-controller>@metamask/base-controller": {
"packages": {
"immer": true
}
},
"@metamask/permission-controller>@metamask/controller-utils": {
"globals": {
"URL": true,
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/controller-utils>@spruceid/siwe-parser": true,
"@metamask/utils": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/permission-controller>nanoid": {
"globals": {
"crypto.getRandomValues": true
@ -1902,15 +1881,15 @@
"@metamask/permission-controller": true,
"@metamask/rpc-methods-flask>@metamask/snaps-ui": true,
"@metamask/rpc-methods-flask>@metamask/snaps-utils": true,
"@metamask/rpc-methods-flask>@metamask/utils": true,
"@metamask/rpc-methods-flask>nanoid": true,
"@metamask/utils": true,
"eth-rpc-errors": true,
"superstruct": true
}
},
"@metamask/rpc-methods-flask>@metamask/snaps-ui": {
"packages": {
"@metamask/utils": true,
"@metamask/rpc-methods-flask>@metamask/utils": true,
"superstruct": true
}
},
@ -1927,11 +1906,25 @@
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"@metamask/key-tree>@scure/base": true,
"@metamask/rpc-methods-flask>@metamask/utils": true,
"@metamask/snaps-utils-flask>is-svg": true,
"@metamask/snaps-utils>cron-parser": true,
"@metamask/snaps-utils>fast-json-stable-stringify": true,
"@metamask/snaps-utils>rfdc": true,
"@metamask/snaps-utils>validate-npm-package-name": true,
"@metamask/utils": true,
"browserify>buffer": true,
"semver": true,
"superstruct": true
}
},
"@metamask/rpc-methods-flask>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
"superstruct": true
}
@ -2087,12 +2080,13 @@
"setTimeout": true
},
"packages": {
"@metamask/base-controller": true,
"@metamask/permission-controller": true,
"@metamask/post-message-stream": true,
"@metamask/providers>@metamask/object-multiplex": true,
"@metamask/snaps-controllers-flask>@metamask/base-controller": true,
"@metamask/snaps-controllers-flask>@metamask/rpc-methods": true,
"@metamask/snaps-controllers-flask>@metamask/snaps-utils": true,
"@metamask/snaps-controllers-flask>@metamask/utils": true,
"@metamask/snaps-controllers-flask>concat-stream": true,
"@metamask/snaps-controllers-flask>nanoid": true,
"@metamask/snaps-controllers>@xstate/fsm": true,
@ -2100,18 +2094,12 @@
"@metamask/snaps-controllers>readable-web-to-node-stream": true,
"@metamask/snaps-controllers>tar-stream": true,
"@metamask/snaps-utils>@metamask/snaps-registry": true,
"@metamask/utils": true,
"eth-rpc-errors": true,
"json-rpc-engine": true,
"json-rpc-middleware-stream": true,
"pump": true
}
},
"@metamask/snaps-controllers-flask>@metamask/base-controller": {
"packages": {
"immer": true
}
},
"@metamask/snaps-controllers-flask>@metamask/rpc-methods": {
"packages": {
"@metamask/key-tree": true,
@ -2119,8 +2107,8 @@
"@metamask/permission-controller": true,
"@metamask/snaps-controllers-flask>@metamask/snaps-utils": true,
"@metamask/snaps-controllers-flask>@metamask/snaps-utils>@metamask/snaps-ui": true,
"@metamask/snaps-controllers-flask>@metamask/utils": true,
"@metamask/snaps-controllers-flask>nanoid": true,
"@metamask/utils": true,
"eth-rpc-errors": true,
"superstruct": true
}
@ -2138,18 +2126,32 @@
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"@metamask/key-tree>@scure/base": true,
"@metamask/snaps-controllers-flask>@metamask/utils": true,
"@metamask/snaps-utils-flask>is-svg": true,
"@metamask/snaps-utils>cron-parser": true,
"@metamask/snaps-utils>fast-json-stable-stringify": true,
"@metamask/snaps-utils>rfdc": true,
"@metamask/snaps-utils>validate-npm-package-name": true,
"@metamask/utils": true,
"browserify>buffer": true,
"semver": true,
"superstruct": true
}
},
"@metamask/snaps-controllers-flask>@metamask/snaps-utils>@metamask/snaps-ui": {
"packages": {
"@metamask/utils": true,
"@metamask/snaps-controllers-flask>@metamask/utils": true,
"superstruct": true
}
},
"@metamask/snaps-controllers-flask>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
"superstruct": true
}
},
@ -2306,7 +2308,19 @@
},
"@metamask/snaps-ui-flask": {
"packages": {
"@metamask/utils": true,
"@metamask/snaps-ui-flask>@metamask/utils": true,
"superstruct": true
}
},
"@metamask/snaps-ui-flask>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
"superstruct": true
}
},
@ -2323,19 +2337,59 @@
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"@metamask/key-tree>@scure/base": true,
"@metamask/snaps-utils-flask>@metamask/utils": true,
"@metamask/snaps-utils-flask>is-svg": true,
"@metamask/snaps-utils>cron-parser": true,
"@metamask/snaps-utils>fast-json-stable-stringify": true,
"@metamask/snaps-utils>rfdc": true,
"@metamask/snaps-utils>validate-npm-package-name": true,
"@metamask/utils": true,
"browserify>buffer": true,
"semver": true,
"superstruct": true
}
},
"@metamask/snaps-utils-flask>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
"superstruct": true
}
},
"@metamask/snaps-utils-flask>is-svg": {
"packages": {
"@metamask/snaps-utils-flask>is-svg>fast-xml-parser": true
}
},
"@metamask/snaps-utils-flask>is-svg>fast-xml-parser": {
"globals": {
"entityName": true,
"val": true
},
"packages": {
"@metamask/snaps-utils-flask>is-svg>fast-xml-parser>strnum": true
}
},
"@metamask/snaps-utils>@metamask/snaps-registry": {
"packages": {
"@metamask/key-tree>@noble/secp256k1": true,
"@metamask/utils": true,
"@metamask/snaps-utils>@metamask/snaps-registry>@metamask/utils": true,
"superstruct": true
}
},
"@metamask/snaps-utils>@metamask/snaps-registry>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
"superstruct": true
}
},

View File

@ -1673,37 +1673,16 @@
"console.error": true
},
"packages": {
"@metamask/permission-controller>@metamask/base-controller": true,
"@metamask/permission-controller>@metamask/controller-utils": true,
"@metamask/base-controller": true,
"@metamask/controller-utils": true,
"@metamask/permission-controller>nanoid": true,
"@metamask/utils": true,
"deep-freeze-strict": true,
"eth-rpc-errors": true,
"immer": true,
"json-rpc-engine": true
}
},
"@metamask/permission-controller>@metamask/base-controller": {
"packages": {
"immer": true
}
},
"@metamask/permission-controller>@metamask/controller-utils": {
"globals": {
"URL": true,
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/controller-utils>@spruceid/siwe-parser": true,
"@metamask/utils": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/permission-controller>nanoid": {
"globals": {
"crypto.getRandomValues": true

View File

@ -252,24 +252,24 @@
"@metamask/metamask-eth-abis": "^3.0.0",
"@metamask/notification-controller": "^3.0.0",
"@metamask/obs-store": "^8.1.0",
"@metamask/permission-controller": "^3.2.0",
"@metamask/permission-controller": "^4.0.0",
"@metamask/phishing-controller": "^3.0.0",
"@metamask/post-message-stream": "^6.0.0",
"@metamask/providers": "^10.2.1",
"@metamask/rate-limit-controller": "^2.0.0",
"@metamask/rpc-methods": "^0.32.2",
"@metamask/rpc-methods-flask": "npm:@metamask/rpc-methods@0.33.1-flask.1",
"@metamask/rpc-methods-flask": "npm:@metamask/rpc-methods@0.34.0-flask.1",
"@metamask/safe-event-emitter": "^2.0.0",
"@metamask/scure-bip39": "^2.0.3",
"@metamask/signature-controller": "^2.0.0",
"@metamask/slip44": "^3.0.0",
"@metamask/smart-transactions-controller": "^3.1.0",
"@metamask/snaps-controllers": "^0.32.2",
"@metamask/snaps-controllers-flask": "npm:@metamask/snaps-controllers@0.33.1-flask.1",
"@metamask/snaps-controllers-flask": "npm:@metamask/snaps-controllers@0.34.0-flask.1",
"@metamask/snaps-ui": "^0.32.2",
"@metamask/snaps-ui-flask": "npm:@metamask/snaps-ui@0.33.1-flask.1",
"@metamask/snaps-ui-flask": "npm:@metamask/snaps-ui@0.34.0-flask.1",
"@metamask/snaps-utils": "^0.32.2",
"@metamask/snaps-utils-flask": "npm:@metamask/snaps-utils@0.33.1-flask.1",
"@metamask/snaps-utils-flask": "npm:@metamask/snaps-utils@0.34.0-flask.1",
"@metamask/subject-metadata-controller": "^2.0.0",
"@metamask/swappable-obj-proxy": "^2.1.0",
"@metamask/utils": "^5.0.0",

View File

@ -14,8 +14,8 @@ describe('EndowmentPermissions', () => {
[
'endowment:long-running',
...Object.keys(endowmentPermissionBuilders).filter(
(targetKey) =>
!Object.keys(ExcludedSnapEndowments).includes(targetKey),
(targetName) =>
!Object.keys(ExcludedSnapEndowments).includes(targetName),
),
].sort(),
);
@ -28,8 +28,8 @@ describe('RestrictedMethods', () => {
[
'eth_accounts',
...Object.keys(restrictedMethodPermissionBuilders).filter(
(targetKey) =>
!Object.keys(ExcludedSnapPermissions).includes(targetKey),
(targetName) =>
!Object.keys(ExcludedSnapPermissions).includes(targetName),
),
].sort(),
);

165
yarn.lock
View File

@ -4420,7 +4420,7 @@ __metadata:
languageName: node
linkType: hard
"@metamask/permission-controller@npm:^3.0.0, @metamask/permission-controller@npm:^3.1.0, @metamask/permission-controller@npm:^3.2.0":
"@metamask/permission-controller@npm:^3.0.0, @metamask/permission-controller@npm:^3.1.0":
version: 3.2.0
resolution: "@metamask/permission-controller@npm:3.2.0"
dependencies:
@ -4440,6 +4440,26 @@ __metadata:
languageName: node
linkType: hard
"@metamask/permission-controller@npm:^4.0.0":
version: 4.0.0
resolution: "@metamask/permission-controller@npm:4.0.0"
dependencies:
"@metamask/approval-controller": ^3.0.0
"@metamask/base-controller": ^3.0.0
"@metamask/controller-utils": ^4.0.0
"@metamask/utils": ^5.0.2
"@types/deep-freeze-strict": ^1.1.0
deep-freeze-strict: ^1.1.1
eth-rpc-errors: ^4.0.2
immer: ^9.0.6
json-rpc-engine: ^6.1.0
nanoid: ^3.1.31
peerDependencies:
"@metamask/approval-controller": ^3.0.0
checksum: ac07f6180321f875df1ced0e0c60e872a32b334d5c04c280736ad5bf7c292cf07c97a2e9b49d24ed17145f302e83d24c46d5a4fc423e4a1c939b717c8fa653ec
languageName: node
linkType: hard
"@metamask/phishing-controller@npm:^3.0.0":
version: 3.0.0
resolution: "@metamask/phishing-controller@npm:3.0.0"
@ -4521,21 +4541,21 @@ __metadata:
languageName: node
linkType: hard
"@metamask/rpc-methods-flask@npm:@metamask/rpc-methods@0.33.1-flask.1, @metamask/rpc-methods@npm:^0.33.1-flask.1":
version: 0.33.1-flask.1
resolution: "@metamask/rpc-methods@npm:0.33.1-flask.1"
"@metamask/rpc-methods-flask@npm:@metamask/rpc-methods@0.34.0-flask.1, @metamask/rpc-methods@npm:^0.34.0-flask.1":
version: 0.34.0-flask.1
resolution: "@metamask/rpc-methods@npm:0.34.0-flask.1"
dependencies:
"@metamask/key-tree": ^7.0.0
"@metamask/permission-controller": ^3.2.0
"@metamask/snaps-ui": ^0.33.1-flask.1
"@metamask/snaps-utils": ^0.33.1-flask.1
"@metamask/permission-controller": ^4.0.0
"@metamask/snaps-ui": ^0.34.0-flask.1
"@metamask/snaps-utils": ^0.34.0-flask.1
"@metamask/types": ^1.1.0
"@metamask/utils": ^5.0.0
"@metamask/utils": ^6.0.0
"@noble/hashes": ^1.1.3
eth-rpc-errors: ^4.0.3
nanoid: ^3.1.31
superstruct: ^1.0.3
checksum: 1a7fd246944b68c8b70ab64e5db544b175b68195cca4a2692bf34bca7f5c55eab248156e4702152f044c49c644ad82a92d1b328fcfa876291665d2a8c2ae7dce
checksum: e6f05ab479f1136561a86dc313f5cbcfb3588bcdc5d8c723bafca81b2f07dc9f835586d70c0373fc6d1a194288c5010025eb6af47f9becfebbfacf0422e393b9
languageName: node
linkType: hard
@ -4631,20 +4651,20 @@ __metadata:
languageName: node
linkType: hard
"@metamask/snaps-controllers-flask@npm:@metamask/snaps-controllers@0.33.1-flask.1":
version: 0.33.1-flask.1
resolution: "@metamask/snaps-controllers@npm:0.33.1-flask.1"
"@metamask/snaps-controllers-flask@npm:@metamask/snaps-controllers@0.34.0-flask.1":
version: 0.34.0-flask.1
resolution: "@metamask/snaps-controllers@npm:0.34.0-flask.1"
dependencies:
"@metamask/approval-controller": ^2.0.0
"@metamask/base-controller": ^2.0.0
"@metamask/approval-controller": ^3.0.0
"@metamask/base-controller": ^3.0.0
"@metamask/object-multiplex": ^1.2.0
"@metamask/permission-controller": ^3.2.0
"@metamask/permission-controller": ^4.0.0
"@metamask/post-message-stream": ^6.1.2
"@metamask/rpc-methods": ^0.33.1-flask.1
"@metamask/snaps-execution-environments": ^0.33.1-flask.1
"@metamask/snaps-registry": ^1.2.0
"@metamask/snaps-utils": ^0.33.1-flask.1
"@metamask/utils": ^5.0.0
"@metamask/rpc-methods": ^0.34.0-flask.1
"@metamask/snaps-execution-environments": ^0.34.0-flask.1
"@metamask/snaps-registry": ^1.2.1
"@metamask/snaps-utils": ^0.34.0-flask.1
"@metamask/utils": ^6.0.0
"@xstate/fsm": ^2.0.0
concat-stream: ^2.0.0
cron-parser: ^4.5.0
@ -4657,7 +4677,7 @@ __metadata:
pump: ^3.0.0
readable-web-to-node-stream: ^3.0.2
tar-stream: ^2.2.0
checksum: 26fcba72c8bcb84783a970db4af2bfec65429a7206eadc05856873739b85aebd75b0d8d6062eadb9fffce30c436f79ff4bbca9d15e9e80016f1b27ac5e8693bc
checksum: 9c61f6b3dcc9d25411447a5b434bf2b1713190333a472f7e0f74bf644aebf140e58ba3e21b4df1a6d425180a916379868ae1932be044b675f1f365c5765b5f50
languageName: node
linkType: hard
@ -4712,16 +4732,16 @@ __metadata:
languageName: node
linkType: hard
"@metamask/snaps-execution-environments@npm:^0.33.1-flask.1":
version: 0.33.1-flask.1
resolution: "@metamask/snaps-execution-environments@npm:0.33.1-flask.1"
"@metamask/snaps-execution-environments@npm:^0.34.0-flask.1":
version: 0.34.0-flask.1
resolution: "@metamask/snaps-execution-environments@npm:0.34.0-flask.1"
dependencies:
"@metamask/object-multiplex": ^1.2.0
"@metamask/post-message-stream": ^6.1.2
"@metamask/providers": ^10.2.1
"@metamask/rpc-methods": ^0.33.1-flask.1
"@metamask/snaps-utils": ^0.33.1-flask.1
"@metamask/utils": ^5.0.0
"@metamask/rpc-methods": ^0.34.0-flask.1
"@metamask/snaps-utils": ^0.34.0-flask.1
"@metamask/utils": ^6.0.0
eth-rpc-errors: ^4.0.3
json-rpc-engine: ^6.1.0
nanoid: ^3.1.31
@ -4729,28 +4749,28 @@ __metadata:
ses: ^0.18.1
stream-browserify: ^3.0.0
superstruct: ^1.0.3
checksum: e86d70befbb6e3639368d7974f3e89ef343be1932a606a4b77ddfafdc0ed672a227481458e8935392bad9494c82deb75b6e1761606baea08ff165f4e6974f262
checksum: 384105334b3346fbdffca18eb9934391bb88e0c06022e17afdd235be91b0bc434ce26680ee3fb81bd99dd601e376b4e8448f02f7fdb379914d7bcbf4ce3a92e5
languageName: node
linkType: hard
"@metamask/snaps-registry@npm:^1.2.0":
version: 1.2.0
resolution: "@metamask/snaps-registry@npm:1.2.0"
"@metamask/snaps-registry@npm:^1.2.0, @metamask/snaps-registry@npm:^1.2.1":
version: 1.2.1
resolution: "@metamask/snaps-registry@npm:1.2.1"
dependencies:
"@metamask/utils": ^5.0.0
"@metamask/utils": ^6.0.0
"@noble/secp256k1": ^1.7.1
superstruct: ^1.0.3
checksum: d0534680e713ca94e41cbb86f5f700aaf8c1f36b88fc1ed24b4669f11f8583b6d949f6724b8d9fd518a6210131af4ea7822e73ce34e64649dbe29a28850c6682
checksum: d2d5b743a8b55b6f685708b2b694534585329585c6d94819328e270fd77c68c0bede88b866821db9c22a667eca1f4961ed860d83b438cf009bd1c4df6e75b78a
languageName: node
linkType: hard
"@metamask/snaps-ui-flask@npm:@metamask/snaps-ui@0.33.1-flask.1, @metamask/snaps-ui@npm:^0.33.1-flask.1":
version: 0.33.1-flask.1
resolution: "@metamask/snaps-ui@npm:0.33.1-flask.1"
"@metamask/snaps-ui-flask@npm:@metamask/snaps-ui@0.34.0-flask.1, @metamask/snaps-ui@npm:^0.34.0-flask.1":
version: 0.34.0-flask.1
resolution: "@metamask/snaps-ui@npm:0.34.0-flask.1"
dependencies:
"@metamask/utils": ^5.0.0
"@metamask/utils": ^6.0.0
superstruct: ^1.0.3
checksum: 52f00f1ac1e23da1fbb0307cd5bdc620cf9c235ee94a6cb6fb4fd38da0677a5d8df501952e3b7119bac918c3a56e8ffe453cbff0b2be35d3b882882deac65dc4
checksum: 1d8dbede166f5d6da08ad4cca4d6b6f64d282aeb9858a19ebd54274054014266e1ae089014fa6e786baf5f69f6df211c6e6c12399760f81a45cd5f0c508a1e77
languageName: node
linkType: hard
@ -4764,30 +4784,31 @@ __metadata:
languageName: node
linkType: hard
"@metamask/snaps-utils-flask@npm:@metamask/snaps-utils@0.33.1-flask.1, @metamask/snaps-utils@npm:^0.33.1-flask.1":
version: 0.33.1-flask.1
resolution: "@metamask/snaps-utils@npm:0.33.1-flask.1"
"@metamask/snaps-utils-flask@npm:@metamask/snaps-utils@0.34.0-flask.1, @metamask/snaps-utils@npm:^0.34.0-flask.1":
version: 0.34.0-flask.1
resolution: "@metamask/snaps-utils@npm:0.34.0-flask.1"
dependencies:
"@babel/core": ^7.20.12
"@babel/types": ^7.18.7
"@metamask/base-controller": ^2.0.0
"@metamask/permission-controller": ^3.2.0
"@metamask/base-controller": ^3.0.0
"@metamask/permission-controller": ^4.0.0
"@metamask/providers": ^10.2.1
"@metamask/snaps-registry": ^1.2.0
"@metamask/snaps-ui": ^0.33.1-flask.1
"@metamask/utils": ^5.0.0
"@metamask/snaps-registry": ^1.2.1
"@metamask/snaps-ui": ^0.34.0-flask.1
"@metamask/utils": ^6.0.0
"@noble/hashes": ^1.1.3
"@scure/base": ^1.1.1
cron-parser: ^4.5.0
eth-rpc-errors: ^4.0.3
fast-deep-equal: ^3.1.3
fast-json-stable-stringify: ^2.1.0
is-svg: ^4.4.0
rfdc: ^1.3.0
semver: ^7.3.7
ses: ^0.18.1
superstruct: ^1.0.3
validate-npm-package-name: ^5.0.0
checksum: 15a87d290423a31f3113aa65cb7076e5220f5697e4614eb9f4b7bf1e4b55e83a6545f05311d34555e05e111e94309f75154ae889eb593beef71010e9dae18c12
checksum: bc4ff9460dce673e00a0a82c81b61f7a9ddb1ca18331236a0d68f7ed07c14edb2c7bbdec5817b446970c7e3761ddbdcabf129721e1f1c5376c39e126cdf3221c
languageName: node
linkType: hard
@ -4876,6 +4897,19 @@ __metadata:
languageName: node
linkType: hard
"@metamask/utils@npm:^6.0.0":
version: 6.0.0
resolution: "@metamask/utils@npm:6.0.0"
dependencies:
"@ethereumjs/tx": ^4.1.2
"@types/debug": ^4.1.7
debug: ^4.3.4
semver: ^7.3.8
superstruct: ^1.0.3
checksum: 502a75c82af729f813a08382e8ca5e3bfab7903a377b375e781ffcd5541e3a57b468a0daf02bb8e5c5bcb9051408f51c1ffb7a92b90bfd89946e7691c1117ca9
languageName: node
linkType: hard
"@multiformats/base-x@npm:^4.0.1":
version: 4.0.1
resolution: "@multiformats/base-x@npm:4.0.1"
@ -16657,6 +16691,17 @@ __metadata:
languageName: node
linkType: hard
"fast-xml-parser@npm:^4.1.3":
version: 4.2.2
resolution: "fast-xml-parser@npm:4.2.2"
dependencies:
strnum: ^1.0.5
bin:
fxparser: src/cli/cli.js
checksum: f0e687927ddc11b2ba9e434d8bf77ef759b6692639dd2dd731e2f30201319e7c70dec08a103dd67a1af7a27f176246502d9d0f5325b5b5b99ab49665fa876857
languageName: node
linkType: hard
"fastq@npm:^1.6.0":
version: 1.6.0
resolution: "fastq@npm:1.6.0"
@ -20308,6 +20353,15 @@ __metadata:
languageName: node
linkType: hard
"is-svg@npm:^4.4.0":
version: 4.4.0
resolution: "is-svg@npm:4.4.0"
dependencies:
fast-xml-parser: ^4.1.3
checksum: cd5a0ba1af653e4897721913b0b80de968fa5b19eb1a592412f4672d3a1203935d183c2a9dbf61d68023739ee43d3761ea795ae1a9f618c6098a9e89eacdd256
languageName: node
linkType: hard
"is-symbol@npm:^1.0.2, is-symbol@npm:^1.0.3":
version: 1.0.4
resolution: "is-symbol@npm:1.0.4"
@ -23965,25 +24019,25 @@ __metadata:
"@metamask/metamask-eth-abis": ^3.0.0
"@metamask/notification-controller": ^3.0.0
"@metamask/obs-store": ^8.1.0
"@metamask/permission-controller": ^3.2.0
"@metamask/permission-controller": ^4.0.0
"@metamask/phishing-controller": ^3.0.0
"@metamask/phishing-warning": ^2.1.0
"@metamask/post-message-stream": ^6.0.0
"@metamask/providers": ^10.2.1
"@metamask/rate-limit-controller": ^2.0.0
"@metamask/rpc-methods": ^0.32.2
"@metamask/rpc-methods-flask": "npm:@metamask/rpc-methods@0.33.1-flask.1"
"@metamask/rpc-methods-flask": "npm:@metamask/rpc-methods@0.34.0-flask.1"
"@metamask/safe-event-emitter": ^2.0.0
"@metamask/scure-bip39": ^2.0.3
"@metamask/signature-controller": ^2.0.0
"@metamask/slip44": ^3.0.0
"@metamask/smart-transactions-controller": ^3.1.0
"@metamask/snaps-controllers": ^0.32.2
"@metamask/snaps-controllers-flask": "npm:@metamask/snaps-controllers@0.33.1-flask.1"
"@metamask/snaps-controllers-flask": "npm:@metamask/snaps-controllers@0.34.0-flask.1"
"@metamask/snaps-ui": ^0.32.2
"@metamask/snaps-ui-flask": "npm:@metamask/snaps-ui@0.33.1-flask.1"
"@metamask/snaps-ui-flask": "npm:@metamask/snaps-ui@0.34.0-flask.1"
"@metamask/snaps-utils": ^0.32.2
"@metamask/snaps-utils-flask": "npm:@metamask/snaps-utils@0.33.1-flask.1"
"@metamask/snaps-utils-flask": "npm:@metamask/snaps-utils@0.34.0-flask.1"
"@metamask/subject-metadata-controller": ^2.0.0
"@metamask/swappable-obj-proxy": ^2.1.0
"@metamask/test-dapp": ^6.0.0
@ -31917,6 +31971,13 @@ __metadata:
languageName: node
linkType: hard
"strnum@npm:^1.0.5":
version: 1.0.5
resolution: "strnum@npm:1.0.5"
checksum: 651b2031db5da1bf4a77fdd2f116a8ac8055157c5420f5569f64879133825915ad461513e7202a16d7fec63c54fd822410d0962f8ca12385c4334891b9ae6dd2
languageName: node
linkType: hard
"style-loader@npm:^0.21.0":
version: 0.21.0
resolution: "style-loader@npm:0.21.0"