Skip to content

Commit

Permalink
Merge branch 'develop' into controller_update
Browse files Browse the repository at this point in the history
  • Loading branch information
jpuri authored Oct 7, 2022
2 parents ba62042 + 7ba0f78 commit c253c92
Show file tree
Hide file tree
Showing 31 changed files with 1,420 additions and 132 deletions.
3 changes: 3 additions & 0 deletions app/_locales/en/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions app/scripts/controllers/permissions/flask/snap-permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import {
restrictedMethodPermissionBuilders,
selectHooks,
} from '@metamask/rpc-methods';
import { ExcludedSnapPermissions } from '../../../../../shared/constants/permissions';
import {
ExcludedSnapEndowments,
ExcludedSnapPermissions,
} from '../../../../../shared/constants/permissions';

/**
* @returns {Record<string, Record<string, unknown>>} All endowment permission
Expand All @@ -12,7 +15,9 @@ import { ExcludedSnapPermissions } from '../../../../../shared/constants/permiss
export const buildSnapEndowmentSpecifications = () =>
Object.values(endowmentPermissionBuilders).reduce(
(allSpecifications, { targetKey, specificationBuilder }) => {
allSpecifications[targetKey] = specificationBuilder();
if (!ExcludedSnapEndowments.has(targetKey)) {
allSpecifications[targetKey] = specificationBuilder();
}
return allSpecifications;
},
{},
Expand Down
2 changes: 2 additions & 0 deletions app/scripts/controllers/permissions/specifications.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { constructPermission, PermissionType } from '@metamask/controllers';
///: BEGIN:ONLY_INCLUDE_IN(flask)
import { endowmentCaveatSpecifications as snapsEndowmentCaveatSpecifications } from '@metamask/snap-controllers';
import { caveatSpecifications as snapsCaveatsSpecifications } from '@metamask/rpc-methods';
///: END:ONLY_INCLUDE_IN
import {
Expand Down Expand Up @@ -69,6 +70,7 @@ export const getCaveatSpecifications = ({ getIdentities }) => {

///: BEGIN:ONLY_INCLUDE_IN(flask)
...snapsCaveatsSpecifications,
...snapsEndowmentCaveatSpecifications,
///: END:ONLY_INCLUDE_IN
};
};
Expand Down
5 changes: 4 additions & 1 deletion app/scripts/controllers/permissions/specifications.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('PermissionController specifications', () => {
describe('caveat specifications', () => {
it('getCaveatSpecifications returns the expected specifications object', () => {
const caveatSpecifications = getCaveatSpecifications({});
expect(Object.keys(caveatSpecifications)).toHaveLength(3);
expect(Object.keys(caveatSpecifications)).toHaveLength(4);
expect(
caveatSpecifications[CaveatTypes.restrictReturnedAccounts].type,
).toStrictEqual(CaveatTypes.restrictReturnedAccounts);
Expand All @@ -27,6 +27,9 @@ describe('PermissionController specifications', () => {
expect(caveatSpecifications.permittedCoinTypes.type).toStrictEqual(
SnapCaveatType.PermittedCoinTypes,
);
expect(caveatSpecifications.snapKeyring.type).toStrictEqual(
SnapCaveatType.SnapKeyring,
);
});

describe('restrictReturnedAccounts', () => {
Expand Down
4 changes: 2 additions & 2 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ export default class MetamaskController extends EventEmitter {
///: BEGIN:ONLY_INCLUDE_IN(flask)
this.snapExecutionService = new IframeExecutionService({
iframeUrl: new URL(
'https://metamask.github.io/iframe-execution-environment/0.8.0',
'https://metamask.github.io/iframe-execution-environment/0.9.0',
),
messenger: this.controllerMessenger.getRestricted({
name: 'ExecutionService',
Expand Down Expand Up @@ -3744,7 +3744,7 @@ export default class MetamaskController extends EventEmitter {
),
getSnaps: this.controllerMessenger.call.bind(
this.controllerMessenger,
'SnapController:getSnaps',
'SnapController:getPermittedSnaps',
origin,
),
requestPermissions: async (requestedPermissions) => {
Expand Down
28 changes: 9 additions & 19 deletions lavamoat/browserify/beta/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -682,11 +682,11 @@
"3box>ipfs>ipfs-unixfs-importer>async-iterator-batch": true,
"3box>ipfs>ipfs-unixfs-importer>async-iterator-first": true,
"3box>ipfs>ipfs-unixfs-importer>rabin-wasm": true,
"3box>ipfs>ipfs-unixfs-importer>superstruct": true,
"3box>ipfs>ipld-dag-pb": true,
"3box>ipfs>ipld-raw>multihashing-async": true,
"3box>ipfs>multicodec": true,
"3box>ipfs>multihashes": true,
"3box>ipfs>superstruct": true,
"browserify>buffer": true,
"madge>rc>deep-extend": true
}
Expand Down Expand Up @@ -841,11 +841,11 @@
"3box>ipfs>libp2p>libp2p-floodsub": true,
"3box>ipfs>libp2p>libp2p-ping": true,
"3box>ipfs>libp2p>libp2p-switch": true,
"3box>ipfs>libp2p>superstruct": true,
"3box>ipfs>multiaddr": true,
"3box>ipfs>peer-book": true,
"3box>ipfs>peer-id": true,
"3box>ipfs>peer-info": true,
"3box>ipfs>superstruct": true,
"browserify>events": true,
"browserify>insert-module-globals>is-buffer": true,
"browserify>process": true,
Expand Down Expand Up @@ -3148,20 +3148,13 @@
"setTimeout": true
},
"packages": {
"@metamask/eth-json-rpc-infura>@metamask/utils": true,
"@metamask/eth-json-rpc-infura>eth-json-rpc-middleware": true,
"eth-block-tracker>@metamask/utils": true,
"eth-rpc-errors": true,
"json-rpc-engine": true,
"node-fetch": true
}
},
"@metamask/eth-json-rpc-infura>@metamask/utils": {
"packages": {
"@metamask/eth-json-rpc-infura>@metamask/utils>superstruct": true,
"eslint>fast-deep-equal": true,
"nock>debug": true
}
},
"@metamask/eth-json-rpc-infura>eth-json-rpc-middleware": {
"globals": {
"URL": true,
Expand Down Expand Up @@ -4646,9 +4639,13 @@
}
},
"eth-block-tracker>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/snap-utils>superstruct": true,
"eslint>fast-deep-equal": true,
"eth-block-tracker>@metamask/utils>superstruct": true,
"nock>debug": true
}
},
Expand Down Expand Up @@ -4705,7 +4702,7 @@
},
"packages": {
"browserify>browser-resolve": true,
"eth-json-rpc-middleware>@metamask/utils": true,
"eth-block-tracker>@metamask/utils": true,
"eth-json-rpc-middleware>eth-sig-util": true,
"eth-json-rpc-middleware>pify": true,
"eth-rpc-errors": true,
Expand All @@ -4715,13 +4712,6 @@
"vinyl>clone": true
}
},
"eth-json-rpc-middleware>@metamask/utils": {
"packages": {
"eslint>fast-deep-equal": true,
"eth-json-rpc-middleware>@metamask/utils>superstruct": true,
"nock>debug": true
}
},
"eth-json-rpc-middleware>eth-sig-util": {
"packages": {
"eth-json-rpc-middleware>eth-sig-util>ethereumjs-abi": true,
Expand Down
52 changes: 24 additions & 28 deletions lavamoat/browserify/flask/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -682,11 +682,11 @@
"3box>ipfs>ipfs-unixfs-importer>async-iterator-batch": true,
"3box>ipfs>ipfs-unixfs-importer>async-iterator-first": true,
"3box>ipfs>ipfs-unixfs-importer>rabin-wasm": true,
"3box>ipfs>ipfs-unixfs-importer>superstruct": true,
"3box>ipfs>ipld-dag-pb": true,
"3box>ipfs>ipld-raw>multihashing-async": true,
"3box>ipfs>multicodec": true,
"3box>ipfs>multihashes": true,
"3box>ipfs>superstruct": true,
"browserify>buffer": true,
"madge>rc>deep-extend": true
}
Expand Down Expand Up @@ -841,11 +841,11 @@
"3box>ipfs>libp2p>libp2p-floodsub": true,
"3box>ipfs>libp2p>libp2p-ping": true,
"3box>ipfs>libp2p>libp2p-switch": true,
"3box>ipfs>libp2p>superstruct": true,
"3box>ipfs>multiaddr": true,
"3box>ipfs>peer-book": true,
"3box>ipfs>peer-id": true,
"3box>ipfs>peer-info": true,
"3box>ipfs>superstruct": true,
"browserify>events": true,
"browserify>insert-module-globals>is-buffer": true,
"browserify>process": true,
Expand Down Expand Up @@ -3293,20 +3293,13 @@
"setTimeout": true
},
"packages": {
"@metamask/eth-json-rpc-infura>@metamask/utils": true,
"@metamask/eth-json-rpc-infura>eth-json-rpc-middleware": true,
"eth-block-tracker>@metamask/utils": true,
"eth-rpc-errors": true,
"json-rpc-engine": true,
"node-fetch": true
}
},
"@metamask/eth-json-rpc-infura>@metamask/utils": {
"packages": {
"@metamask/eth-json-rpc-infura>@metamask/utils>superstruct": true,
"eslint>fast-deep-equal": true,
"nock>debug": true
}
},
"@metamask/eth-json-rpc-infura>eth-json-rpc-middleware": {
"globals": {
"URL": true,
Expand Down Expand Up @@ -3616,11 +3609,15 @@
}
},
"@metamask/rpc-methods": {
"globals": {
"console.warn": true
},
"packages": {
"@metamask/controllers": true,
"@metamask/rpc-methods>@metamask/key-tree": true,
"@metamask/snap-utils": true,
"@metamask/snap-utils>@metamask/utils": true,
"@metamask/snap-utils>superstruct": true,
"eth-block-tracker>@metamask/utils": true,
"eth-rpc-errors": true
}
},
Expand Down Expand Up @@ -3869,7 +3866,7 @@
"@metamask/snap-controllers>readable-web-to-node-stream": true,
"@metamask/snap-controllers>tar-stream": true,
"@metamask/snap-utils": true,
"@metamask/snap-utils>@metamask/utils": true,
"eth-block-tracker>@metamask/utils": true,
"eth-rpc-errors": true,
"json-rpc-engine": true,
"pump": true
Expand Down Expand Up @@ -3898,8 +3895,13 @@
"removeEventListener": true
},
"packages": {
"@metamask/snap-controllers>@metamask/post-message-stream>readable-stream": true,
"@metamask/snap-utils>@metamask/utils": true
"@metamask/snap-controllers>@metamask/post-message-stream>@metamask/utils": true,
"@metamask/snap-controllers>@metamask/post-message-stream>readable-stream": true
}
},
"@metamask/snap-controllers>@metamask/post-message-stream>@metamask/utils": {
"packages": {
"eslint>fast-deep-equal": true
}
},
"@metamask/snap-controllers>@metamask/post-message-stream>readable-stream": {
Expand Down Expand Up @@ -4123,20 +4125,17 @@
"@babel/core>@babel/types": true,
"@metamask/snap-utils>ajv": true,
"@metamask/snap-utils>rfdc": true,
"@metamask/snap-utils>superstruct": true,
"browserify": true,
"browserify>buffer": true,
"browserify>crypto-browserify": true,
"browserify>events": true,
"browserify>path-browserify": true,
"eslint>fast-deep-equal": true,
"eth-block-tracker>@metamask/utils": true,
"semver": true
}
},
"@metamask/snap-utils>@metamask/utils": {
"packages": {
"eslint>fast-deep-equal": true
}
},
"@metamask/snap-utils>rfdc": {
"packages": {
"browserify>buffer": true
Expand Down Expand Up @@ -5178,9 +5177,13 @@
}
},
"eth-block-tracker>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/snap-utils>superstruct": true,
"eslint>fast-deep-equal": true,
"eth-block-tracker>@metamask/utils>superstruct": true,
"nock>debug": true
}
},
Expand Down Expand Up @@ -5237,7 +5240,7 @@
},
"packages": {
"browserify>browser-resolve": true,
"eth-json-rpc-middleware>@metamask/utils": true,
"eth-block-tracker>@metamask/utils": true,
"eth-json-rpc-middleware>eth-sig-util": true,
"eth-json-rpc-middleware>pify": true,
"eth-rpc-errors": true,
Expand All @@ -5247,13 +5250,6 @@
"vinyl>clone": true
}
},
"eth-json-rpc-middleware>@metamask/utils": {
"packages": {
"eslint>fast-deep-equal": true,
"eth-json-rpc-middleware>@metamask/utils>superstruct": true,
"nock>debug": true
}
},
"eth-json-rpc-middleware>eth-sig-util": {
"packages": {
"eth-json-rpc-middleware>eth-sig-util>ethereumjs-abi": true,
Expand Down
Loading

0 comments on commit c253c92

Please sign in to comment.