[FLASK] `snaps-monorepo@0.24.1` (#16525)

* snaps-monorepo@0.24.0

* Fix imports and regen LavaMoat policies

* Bump iframe-execution-environment

* Fix tests

* Add permissions

* Bump patch

* Bump test-snaps

* [FLASK] Fix update e2e test to catch snaps with caveats (#16546)

* changed snap to update to bip32

* small changes to test

* Fix lint

* Fix E2E

* Update copy

* Update icon

Co-authored-by: Bowen Sanders <bowensanders@gmail.com>
feature/default_network_editable
Frederik Bolding 2 years ago committed by GitHub
parent d533bd45e9
commit de955f3faa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      app/_locales/en/messages.json
  2. 2
      app/scripts/controllers/permissions/flask/snap-permissions.js
  3. 4
      app/scripts/controllers/permissions/specifications.js
  4. 5
      app/scripts/controllers/permissions/specifications.test.js
  5. 4
      app/scripts/metamask-controller.js
  6. 4
      lavamoat/browserify/beta/policy.json
  7. 168
      lavamoat/browserify/flask/policy.json
  8. 4
      lavamoat/browserify/main/policy.json
  9. 2
      lavamoat/browserify/policy-override.json
  10. 6
      package.json
  11. 2
      shared/constants/permissions.test.js
  12. 2
      shared/constants/permissions.ts
  13. 2
      test/e2e/snaps/enums.js
  14. 23
      test/e2e/snaps/test-snap-update.spec.js
  15. 1
      ui/components/app/permissions-connect-permission-list/index.scss
  16. 10
      ui/helpers/utils/permission.js
  17. 2
      ui/pages/permissions-connect/flask/util.js
  18. 128
      yarn.lock

@ -2716,6 +2716,14 @@
"message": "See address, account balance, activity and suggest transactions to approve",
"description": "The description for the `eth_accounts` permission"
},
"permission_ethereumProvider": {
"message": "Access the Ethereum provider.",
"description": "The description for the `endowment:ethereum-provider` permission"
},
"permission_getEntropy": {
"message": "Derive arbitrary keys unique to this snap.",
"description": "The description for the `snap_getEntropy` permission"
},
"permission_longRunning": {
"message": "Run indefinitely.",
"description": "The description for the `endowment:long-running` permission"

@ -1,4 +1,4 @@
import { endowmentPermissionBuilders } from '@metamask/snap-controllers';
import { endowmentPermissionBuilders } from '@metamask/snaps-controllers';
import {
restrictedMethodPermissionBuilders,
selectHooks,

@ -1,6 +1,6 @@
import { constructPermission, PermissionType } from '@metamask/controllers';
///: BEGIN:ONLY_INCLUDE_IN(flask)
import { endowmentCaveatSpecifications as snapsEndowmentCaveatSpecifications } from '@metamask/snap-controllers';
import { endowmentCaveatSpecifications as snapsEndowmentCaveatSpecifications } from '@metamask/snaps-controllers';
import { caveatSpecifications as snapsCaveatsSpecifications } from '@metamask/rpc-methods';
///: END:ONLY_INCLUDE_IN
import {
@ -11,7 +11,7 @@ import {
/**
* This file contains the specifications of the permissions and caveats
* that are recognized by our permission system. See the PermissionController
* README in @metamask/snap-controllers for details.
* README in @metamask/controllers for details.
*/
/**

@ -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(5);
expect(Object.keys(caveatSpecifications)).toHaveLength(6);
expect(
caveatSpecifications[CaveatTypes.restrictReturnedAccounts].type,
).toStrictEqual(CaveatTypes.restrictReturnedAccounts);
@ -33,6 +33,9 @@ describe('PermissionController specifications', () => {
expect(caveatSpecifications.snapCronjob.type).toStrictEqual(
SnapCaveatType.SnapCronjob,
);
expect(caveatSpecifications.transactionOrigin.type).toStrictEqual(
SnapCaveatType.TransactionOrigin,
);
});
describe('restrictReturnedAccounts', () => {

@ -52,7 +52,7 @@ import {
CronjobController,
SnapController,
IframeExecutionService,
} from '@metamask/snap-controllers';
} from '@metamask/snaps-controllers';
///: END:ONLY_INCLUDE_IN
import {
@ -661,7 +661,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.10.0',
'https://metamask.github.io/iframe-execution-environment/0.11.0',
),
messenger: this.controllerMessenger.getRestricted({
name: 'ExecutionService',

@ -1396,7 +1396,7 @@
"setTimeout": true
}
},
"@metamask/snap-controllers>nanoid": {
"@metamask/snaps-controllers>nanoid": {
"globals": {
"crypto.getRandomValues": true
}
@ -2354,7 +2354,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/snap-utils>superstruct": true,
"@metamask/snaps-utils>superstruct": true,
"browserify>buffer": true,
"nock>debug": true
}

@ -1428,8 +1428,9 @@
"@metamask/rpc-methods>@metamask/controllers": true,
"@metamask/rpc-methods>@metamask/key-tree": true,
"@metamask/rpc-methods>nanoid": true,
"@metamask/snap-utils": true,
"@metamask/snap-utils>superstruct": true,
"@metamask/snaps-utils": true,
"@metamask/snaps-utils>@noble/hashes": true,
"@metamask/snaps-utils>superstruct": true,
"eth-block-tracker>@metamask/utils": true,
"eth-rpc-errors": true
}
@ -1570,8 +1571,8 @@
"@metamask/rpc-methods>@metamask/key-tree>@noble/ed25519": true,
"@metamask/rpc-methods>@metamask/key-tree>@noble/secp256k1": true,
"@metamask/rpc-methods>@metamask/key-tree>@scure/bip39": true,
"@metamask/snap-utils>@noble/hashes": true,
"@metamask/snap-utils>@scure/base": true,
"@metamask/snaps-utils>@noble/hashes": true,
"@metamask/snaps-utils>@scure/base": true,
"eth-block-tracker>@metamask/utils": true
}
},
@ -1593,8 +1594,8 @@
},
"@metamask/rpc-methods>@metamask/key-tree>@scure/bip39": {
"packages": {
"@metamask/snap-utils>@noble/hashes": true,
"@metamask/snap-utils>@scure/base": true
"@metamask/snaps-utils>@noble/hashes": true,
"@metamask/snaps-utils>@scure/base": true
}
},
"@metamask/rpc-methods>nanoid": {
@ -1772,7 +1773,7 @@
"setTimeout": true
}
},
"@metamask/snap-controllers": {
"@metamask/snaps-controllers": {
"globals": {
"URL": true,
"clearTimeout": true,
@ -1790,23 +1791,23 @@
"@metamask/post-message-stream": true,
"@metamask/providers>@metamask/object-multiplex": true,
"@metamask/rpc-methods": true,
"@metamask/snap-controllers>@metamask/browser-passworder": true,
"@metamask/snap-controllers>@metamask/controllers": true,
"@metamask/snap-controllers>@xstate/fsm": true,
"@metamask/snap-controllers>concat-stream": true,
"@metamask/snap-controllers>gunzip-maybe": true,
"@metamask/snap-controllers>json-rpc-middleware-stream": true,
"@metamask/snap-controllers>nanoid": true,
"@metamask/snap-controllers>readable-web-to-node-stream": true,
"@metamask/snap-controllers>tar-stream": true,
"@metamask/snap-utils": true,
"@metamask/snaps-controllers>@metamask/browser-passworder": true,
"@metamask/snaps-controllers>@metamask/controllers": true,
"@metamask/snaps-controllers>@xstate/fsm": true,
"@metamask/snaps-controllers>concat-stream": true,
"@metamask/snaps-controllers>gunzip-maybe": true,
"@metamask/snaps-controllers>json-rpc-middleware-stream": true,
"@metamask/snaps-controllers>nanoid": true,
"@metamask/snaps-controllers>readable-web-to-node-stream": true,
"@metamask/snaps-controllers>tar-stream": true,
"@metamask/snaps-utils": true,
"eth-block-tracker>@metamask/utils": true,
"eth-rpc-errors": true,
"json-rpc-engine": true,
"pump": true
}
},
"@metamask/snap-controllers>@metamask/browser-passworder": {
"@metamask/snaps-controllers>@metamask/browser-passworder": {
"globals": {
"btoa": true,
"crypto.getRandomValues": true,
@ -1819,7 +1820,7 @@
"browserify>buffer": true
}
},
"@metamask/snap-controllers>@metamask/controllers": {
"@metamask/snaps-controllers>@metamask/controllers": {
"globals": {
"Headers": true,
"URL": true,
@ -1847,9 +1848,9 @@
"@metamask/controllers>web3": true,
"@metamask/controllers>web3-provider-engine": true,
"@metamask/metamask-eth-abis": true,
"@metamask/snap-controllers>@metamask/controllers>eth-method-registry": true,
"@metamask/snap-controllers>@metamask/controllers>ethereumjs-wallet": true,
"@metamask/snap-controllers>nanoid": true,
"@metamask/snaps-controllers>@metamask/controllers>eth-method-registry": true,
"@metamask/snaps-controllers>@metamask/controllers>ethereumjs-wallet": true,
"@metamask/snaps-controllers>nanoid": true,
"browserify>buffer": true,
"browserify>events": true,
"deep-freeze-strict": true,
@ -1869,21 +1870,21 @@
"uuid": true
}
},
"@metamask/snap-controllers>@metamask/controllers>eth-method-registry": {
"@metamask/snaps-controllers>@metamask/controllers>eth-method-registry": {
"packages": {
"@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs": true
"@metamask/snaps-controllers>@metamask/controllers>eth-method-registry>ethjs": true
}
},
"@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs": {
"@metamask/snaps-controllers>@metamask/controllers>eth-method-registry>ethjs": {
"globals": {
"clearInterval": true,
"setInterval": true
},
"packages": {
"@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>bn.js": true,
"@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-abi": true,
"@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract": true,
"@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-query": true,
"@metamask/snaps-controllers>@metamask/controllers>eth-method-registry>ethjs>bn.js": true,
"@metamask/snaps-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-abi": true,
"@metamask/snaps-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract": true,
"@metamask/snaps-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-query": true,
"browserify>buffer": true,
"ethjs>ethjs-filter": true,
"ethjs>ethjs-provider-http": true,
@ -1893,17 +1894,17 @@
"ethjs>number-to-bn": true
}
},
"@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-abi": {
"@metamask/snaps-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-abi": {
"packages": {
"@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>bn.js": true,
"@metamask/snaps-controllers>@metamask/controllers>eth-method-registry>ethjs>bn.js": true,
"browserify>buffer": true,
"ethjs>js-sha3": true,
"ethjs>number-to-bn": true
}
},
"@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract": {
"@metamask/snaps-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract": {
"packages": {
"@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract>ethjs-abi": true,
"@metamask/snaps-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract>ethjs-abi": true,
"ethjs-query>babel-runtime": true,
"ethjs>ethjs-filter": true,
"ethjs>ethjs-util": true,
@ -1911,15 +1912,15 @@
"promise-to-callback": true
}
},
"@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract>ethjs-abi": {
"@metamask/snaps-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-contract>ethjs-abi": {
"packages": {
"@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>bn.js": true,
"@metamask/snaps-controllers>@metamask/controllers>eth-method-registry>ethjs>bn.js": true,
"browserify>buffer": true,
"ethjs>js-sha3": true,
"ethjs>number-to-bn": true
}
},
"@metamask/snap-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-query": {
"@metamask/snaps-controllers>@metamask/controllers>eth-method-registry>ethjs>ethjs-query": {
"globals": {
"console": true
},
@ -1930,9 +1931,9 @@
"promise-to-callback": true
}
},
"@metamask/snap-controllers>@metamask/controllers>ethereumjs-wallet": {
"@metamask/snaps-controllers>@metamask/controllers>ethereumjs-wallet": {
"packages": {
"@metamask/snap-controllers>@metamask/controllers>ethereumjs-wallet>uuid": true,
"@metamask/snaps-controllers>@metamask/controllers>ethereumjs-wallet>uuid": true,
"@truffle/codec>utf8": true,
"browserify>buffer": true,
"browserify>crypto-browserify": true,
@ -1944,20 +1945,20 @@
"ethers>@ethersproject/json-wallets>scrypt-js": true
}
},
"@metamask/snap-controllers>@metamask/controllers>ethereumjs-wallet>uuid": {
"@metamask/snaps-controllers>@metamask/controllers>ethereumjs-wallet>uuid": {
"globals": {
"crypto": true,
"msCrypto": true
}
},
"@metamask/snap-controllers>concat-stream": {
"@metamask/snaps-controllers>concat-stream": {
"packages": {
"@metamask/snap-controllers>concat-stream>readable-stream": true,
"@metamask/snaps-controllers>concat-stream>readable-stream": true,
"browserify>buffer": true,
"pumpify>inherits": true
}
},
"@metamask/snap-controllers>concat-stream>readable-stream": {
"@metamask/snaps-controllers>concat-stream>readable-stream": {
"packages": {
"@storybook/api>util-deprecate": true,
"browserify>browser-resolve": true,
@ -1968,19 +1969,19 @@
"pumpify>inherits": true
}
},
"@metamask/snap-controllers>gunzip-maybe": {
"@metamask/snaps-controllers>gunzip-maybe": {
"packages": {
"@metamask/snap-controllers>gunzip-maybe>browserify-zlib": true,
"@metamask/snap-controllers>gunzip-maybe>is-deflate": true,
"@metamask/snap-controllers>gunzip-maybe>is-gzip": true,
"@metamask/snap-controllers>gunzip-maybe>peek-stream": true,
"@metamask/snap-controllers>gunzip-maybe>pumpify": true,
"@metamask/snap-controllers>gunzip-maybe>through2": true
"@metamask/snaps-controllers>gunzip-maybe>browserify-zlib": true,
"@metamask/snaps-controllers>gunzip-maybe>is-deflate": true,
"@metamask/snaps-controllers>gunzip-maybe>is-gzip": true,
"@metamask/snaps-controllers>gunzip-maybe>peek-stream": true,
"@metamask/snaps-controllers>gunzip-maybe>pumpify": true,
"@metamask/snaps-controllers>gunzip-maybe>through2": true
}
},
"@metamask/snap-controllers>gunzip-maybe>browserify-zlib": {
"@metamask/snaps-controllers>gunzip-maybe>browserify-zlib": {
"packages": {
"@metamask/snap-controllers>gunzip-maybe>browserify-zlib>pako": true,
"@metamask/snaps-controllers>gunzip-maybe>browserify-zlib>pako": true,
"browserify>assert": true,
"browserify>buffer": true,
"browserify>process": true,
@ -1988,15 +1989,15 @@
"readable-stream": true
}
},
"@metamask/snap-controllers>gunzip-maybe>peek-stream": {
"@metamask/snaps-controllers>gunzip-maybe>peek-stream": {
"packages": {
"@metamask/snap-controllers>gunzip-maybe>peek-stream>duplexify": true,
"@metamask/snap-controllers>gunzip-maybe>peek-stream>through2": true,
"@metamask/snaps-controllers>gunzip-maybe>peek-stream>duplexify": true,
"@metamask/snaps-controllers>gunzip-maybe>peek-stream>through2": true,
"browserify>buffer": true,
"terser>source-map-support>buffer-from": true
}
},
"@metamask/snap-controllers>gunzip-maybe>peek-stream>duplexify": {
"@metamask/snaps-controllers>gunzip-maybe>peek-stream>duplexify": {
"packages": {
"browserify>buffer": true,
"browserify>process": true,
@ -2006,7 +2007,7 @@
"readable-stream": true
}
},
"@metamask/snap-controllers>gunzip-maybe>peek-stream>through2": {
"@metamask/snaps-controllers>gunzip-maybe>peek-stream>through2": {
"packages": {
"browserify>process": true,
"browserify>util": true,
@ -2014,14 +2015,14 @@
"watchify>xtend": true
}
},
"@metamask/snap-controllers>gunzip-maybe>pumpify": {
"@metamask/snaps-controllers>gunzip-maybe>pumpify": {
"packages": {
"@metamask/snap-controllers>gunzip-maybe>pumpify>duplexify": true,
"@metamask/snap-controllers>gunzip-maybe>pumpify>pump": true,
"@metamask/snaps-controllers>gunzip-maybe>pumpify>duplexify": true,
"@metamask/snaps-controllers>gunzip-maybe>pumpify>pump": true,
"pumpify>inherits": true
}
},
"@metamask/snap-controllers>gunzip-maybe>pumpify>duplexify": {
"@metamask/snaps-controllers>gunzip-maybe>pumpify>duplexify": {
"packages": {
"browserify>buffer": true,
"browserify>process": true,
@ -2031,14 +2032,14 @@
"readable-stream": true
}
},
"@metamask/snap-controllers>gunzip-maybe>pumpify>pump": {
"@metamask/snaps-controllers>gunzip-maybe>pumpify>pump": {
"packages": {
"browserify>browser-resolve": true,
"end-of-stream": true,
"pump>once": true
}
},
"@metamask/snap-controllers>gunzip-maybe>through2": {
"@metamask/snaps-controllers>gunzip-maybe>through2": {
"packages": {
"browserify>process": true,
"browserify>util": true,
@ -2046,8 +2047,9 @@
"watchify>xtend": true
}
},
"@metamask/snap-controllers>json-rpc-middleware-stream": {
"@metamask/snaps-controllers>json-rpc-middleware-stream": {
"globals": {
"console.warn": true,
"setTimeout": true
},
"packages": {
@ -2055,17 +2057,17 @@
"readable-stream": true
}
},
"@metamask/snap-controllers>nanoid": {
"@metamask/snaps-controllers>nanoid": {
"globals": {
"crypto.getRandomValues": true
}
},
"@metamask/snap-controllers>readable-web-to-node-stream": {
"@metamask/snaps-controllers>readable-web-to-node-stream": {
"packages": {
"@metamask/snap-controllers>readable-web-to-node-stream>readable-stream": true
"@metamask/snaps-controllers>readable-web-to-node-stream>readable-stream": true
}
},
"@metamask/snap-controllers>readable-web-to-node-stream>readable-stream": {
"@metamask/snaps-controllers>readable-web-to-node-stream>readable-stream": {
"packages": {
"@storybook/api>util-deprecate": true,
"browserify>browser-resolve": true,
@ -2076,10 +2078,10 @@
"pumpify>inherits": true
}
},
"@metamask/snap-controllers>tar-stream": {
"@metamask/snaps-controllers>tar-stream": {
"packages": {
"@metamask/snap-controllers>tar-stream>fs-constants": true,
"@metamask/snap-controllers>tar-stream>readable-stream": true,
"@metamask/snaps-controllers>tar-stream>fs-constants": true,
"@metamask/snaps-controllers>tar-stream>readable-stream": true,
"browserify>buffer": true,
"browserify>process": true,
"browserify>string_decoder": true,
@ -2089,12 +2091,12 @@
"pumpify>inherits": true
}
},
"@metamask/snap-controllers>tar-stream>fs-constants": {
"@metamask/snaps-controllers>tar-stream>fs-constants": {
"packages": {
"browserify>constants-browserify": true
}
},
"@metamask/snap-controllers>tar-stream>readable-stream": {
"@metamask/snaps-controllers>tar-stream>readable-stream": {
"packages": {
"@storybook/api>util-deprecate": true,
"browserify>browser-resolve": true,
@ -2105,18 +2107,18 @@
"pumpify>inherits": true
}
},
"@metamask/snap-utils": {
"@metamask/snaps-utils": {
"globals": {
"URL": true
},
"packages": {
"@babel/core": true,
"@babel/core>@babel/types": true,
"@metamask/snap-utils>@noble/hashes": true,
"@metamask/snap-utils>@scure/base": true,
"@metamask/snap-utils>cron-parser": true,
"@metamask/snap-utils>rfdc": true,
"@metamask/snap-utils>superstruct": true,
"@metamask/snaps-utils>@noble/hashes": true,
"@metamask/snaps-utils>@scure/base": true,
"@metamask/snaps-utils>cron-parser": true,
"@metamask/snaps-utils>rfdc": true,
"@metamask/snaps-utils>superstruct": true,
"browserify": true,
"browserify>buffer": true,
"browserify>crypto-browserify": true,
@ -2127,25 +2129,25 @@
"semver": true
}
},
"@metamask/snap-utils>@noble/hashes": {
"@metamask/snaps-utils>@noble/hashes": {
"globals": {
"TextEncoder": true,
"crypto": true
}
},
"@metamask/snap-utils>@scure/base": {
"@metamask/snaps-utils>@scure/base": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
}
},
"@metamask/snap-utils>cron-parser": {
"@metamask/snaps-utils>cron-parser": {
"packages": {
"browserify>browser-resolve": true,
"luxon": true
}
},
"@metamask/snap-utils>rfdc": {
"@metamask/snaps-utils>rfdc": {
"packages": {
"browserify>buffer": true
}
@ -3137,7 +3139,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/snap-utils>superstruct": true,
"@metamask/snaps-utils>superstruct": true,
"browserify>buffer": true,
"nock>debug": true
}

@ -1396,7 +1396,7 @@
"setTimeout": true
}
},
"@metamask/snap-controllers>nanoid": {
"@metamask/snaps-controllers>nanoid": {
"globals": {
"crypto.getRandomValues": true
}
@ -2354,7 +2354,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/snap-utils>superstruct": true,
"@metamask/snaps-utils>superstruct": true,
"browserify>buffer": true,
"nock>debug": true
}

@ -87,7 +87,7 @@
"crypto.getRandomValues": true
}
},
"@metamask/snap-controllers>nanoid": {
"@metamask/snaps-controllers>nanoid": {
"globals": {
"crypto.getRandomValues": true
}

@ -122,11 +122,11 @@
"@metamask/obs-store": "^5.0.0",
"@metamask/post-message-stream": "^6.0.0",
"@metamask/providers": "^10.0.0",
"@metamask/rpc-methods": "^0.23.0",
"@metamask/rpc-methods": "^0.24.1",
"@metamask/slip44": "^2.1.0",
"@metamask/smart-transactions-controller": "^3.0.0",
"@metamask/snap-controllers": "^0.23.0",
"@metamask/snap-utils": "^0.23.0",
"@metamask/snaps-controllers": "^0.24.1",
"@metamask/snaps-utils": "^0.24.1",
"@ngraveio/bc-ur": "^1.1.6",
"@popperjs/core": "^2.4.0",
"@reduxjs/toolkit": "^1.6.2",

@ -1,4 +1,4 @@
import { endowmentPermissionBuilders } from '@metamask/snap-controllers';
import { endowmentPermissionBuilders } from '@metamask/snaps-controllers';
import { restrictedMethodPermissionBuilders } from '@metamask/rpc-methods';
import {
EndowmentPermissions,

@ -11,6 +11,7 @@ export const RestrictedMethods = Object.freeze({
snap_getBip32PublicKey: 'snap_getBip32PublicKey',
snap_getBip32Entropy: 'snap_getBip32Entropy',
snap_getBip44Entropy: 'snap_getBip44Entropy',
snap_getEntropy: 'snap_getEntropy',
'wallet_snap_*': 'wallet_snap_*',
///: END:ONLY_INCLUDE_IN
} as const);
@ -25,6 +26,7 @@ export const EndowmentPermissions = Object.freeze({
'endowment:long-running': 'endowment:long-running',
'endowment:transaction-insight': 'endowment:transaction-insight',
'endowment:cronjob': 'endowment:cronjob',
'endowment:ethereum-provider': 'endowment:ethereum-provider',
} as const);
// Methods / permissions in external packages that we are temporarily excluding.

@ -1,3 +1,3 @@
module.exports = {
TEST_SNAPS_WEBSITE_URL: 'https://metamask.github.io/test-snaps/4.0.2/',
TEST_SNAPS_WEBSITE_URL: 'https://metamask.github.io/test-snaps/4.1.1/',
};

@ -29,7 +29,7 @@ describe('Test Snap update', function () {
await driver.press('#password', driver.Key.ENTER);
// open a new tab and navigate to test snaps page and connect
await driver.openNewPage(TEST_SNAPS_WEBSITE_URL);
await driver.driver.get(TEST_SNAPS_WEBSITE_URL);
// find and scroll to the correct card and click first
const snapButton = await driver.findElement('#connectUpdateNew');
@ -41,7 +41,7 @@ describe('Test Snap update', function () {
// switch to metamask extension and click connect
let windowHandles = await driver.waitUntilXWindowHandles(
3,
2,
1000,
10000,
);
@ -59,7 +59,7 @@ describe('Test Snap update', function () {
await driver.delay(2000);
// approve install of snap
windowHandles = await driver.waitUntilXWindowHandles(3, 1000, 10000);
windowHandles = await driver.waitUntilXWindowHandles(2, 1000, 10000);
await driver.switchToWindowWithTitle(
'MetaMask Notification',
windowHandles,
@ -69,8 +69,17 @@ describe('Test Snap update', function () {
tag: 'button',
});
// wait for permissions popover, click checkboxes and confirm
await driver.delay(1000);
await driver.clickElement('#key-access-bip32-m-44h-0h-secp256k1-0');
await driver.clickElement('#key-access-bip32-m-44h-0h-ed25519-0');
await driver.clickElement({
text: 'Confirm',
tag: 'button',
});
// navigate to test snap page
windowHandles = await driver.waitUntilXWindowHandles(2, 1000, 10000);
windowHandles = await driver.waitUntilXWindowHandles(1, 1000, 10000);
await driver.switchToWindowWithTitle('Test Snaps', windowHandles);
await driver.delay(1000);
@ -81,7 +90,7 @@ describe('Test Snap update', function () {
await driver.clickElement('#connectUpdateNew');
// switch to metamask extension and click connect
await driver.waitUntilXWindowHandles(3, 1000, 10000);
await driver.waitUntilXWindowHandles(2, 1000, 10000);
await driver.delay(1000);
// approve update of snap
@ -96,13 +105,13 @@ describe('Test Snap update', function () {
});
// navigate to test snap page
windowHandles = await driver.waitUntilXWindowHandles(2, 1000, 10000);
windowHandles = await driver.waitUntilXWindowHandles(1, 1000, 10000);
await driver.switchToWindowWithTitle('Test Snaps', windowHandles);
// look for the correct version text
const versionResult = await driver.findElement('#updateSnapVersion');
await driver.delay(1000);
assert.equal(await versionResult.getText(), '"2.0.0"');
assert.equal(await versionResult.getText(), '"4.0.2"');
},
);
});

@ -19,6 +19,7 @@
min-height: 16px;
color: var(--color-icon-alternative);
font-size: 1rem;
text-align: center;
}
}

@ -74,6 +74,11 @@ const PERMISSION_DESCRIPTIONS = deepFreeze({
leftIcon: 'fas fa-door-open',
rightIcon: null,
},
[RestrictedMethods.snap_getEntropy]: {
label: (t) => t('permission_getEntropy'),
leftIcon: 'fas fa-key',
rightIcon: null,
},
[RestrictedMethods.snap_manageState]: {
label: (t) => t('permission_manageState'),
leftIcon: 'fas fa-download',
@ -107,6 +112,11 @@ const PERMISSION_DESCRIPTIONS = deepFreeze({
leftIcon: 'fas fa-clock',
rightIcon: null,
},
[EndowmentPermissions['endowment:ethereum-provider']]: {
label: (t) => t('permission_ethereumProvider'),
leftIcon: 'fab fa-ethereum',
rightIcon: null,
},
///: END:ONLY_INCLUDE_IN
[UNKNOWN_PERMISSION]: {
label: (t, permissionName) =>

@ -1,4 +1,4 @@
import { flatMap } from '@metamask/snap-utils';
import { flatMap } from '@metamask/snaps-utils';
import { coinTypeToProtocolName } from '../../../helpers/utils/util';
export function getSnapInstallWarnings(permissions, targetSubjectMetadata, t) {

@ -2973,23 +2973,6 @@
resolved "https://registry.yarnpkg.com/@metamask/etherscan-link/-/etherscan-link-2.2.0.tgz#76314d0c1405a0669fc4a0a19e0877bd3d0c389f"
integrity sha512-xUgehvgU+ZbzeJ44m4sUtsyf6Dwou+SlYhiKfi6lkRcbWh6Jl3TCi0YM9C7XWgxfnLSdQBO1ndvcp0kslKgMsA==
"@metamask/execution-environments@^0.23.0":
version "0.23.0"
resolved "https://registry.yarnpkg.com/@metamask/execution-environments/-/execution-environments-0.23.0.tgz#55b573ebc116d17b3b19cf15335c4acd97cabaff"
integrity sha512-OU0gEQ/oDMf19b7B7RZX3jWaZCAjDQA1+6cuGBKbxbFsgEYg3tHUuvn2KtH4Lah4SUGHAv3JZoTShX9j+wHGyg==
dependencies:
"@metamask/object-multiplex" "^1.2.0"
"@metamask/post-message-stream" "^6.0.0"
"@metamask/providers" "^9.0.0"
"@metamask/snap-types" "^0.23.0"
"@metamask/snap-utils" "^0.23.0"
"@metamask/utils" "^3.3.0"
eth-rpc-errors "^4.0.3"
pump "^3.0.0"
ses "^0.17.0"
stream-browserify "^3.0.0"
superstruct "^0.16.7"
"@metamask/forwarder@^1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@metamask/forwarder/-/forwarder-1.1.0.tgz#13829d8244bbf19ea658c0b20d21a77b67de0bdd"
@ -3082,7 +3065,7 @@
"@metamask/utils" "^2.0.0"
readable-stream "2.3.3"
"@metamask/providers@^10.0.0":
"@metamask/providers@^10.0.0", "@metamask/providers@^10.2.0":
version "10.2.0"
resolved "https://registry.yarnpkg.com/@metamask/providers/-/providers-10.2.0.tgz#8131de667db0c55a61a150438c2a7f17b2d53615"
integrity sha512-qO3cOZZr/YJ8LLOqhR+51GGBiRknalfV/na7hwXyqZ1R/uxeLeNdqCyg+g8l3Z8JcLoEiaKGNJOEV3FFyLw8mQ==
@ -3100,34 +3083,17 @@
pump "^3.0.0"
webextension-polyfill-ts "^0.25.0"
"@metamask/providers@^9.0.0":
version "9.1.0"
resolved "https://registry.yarnpkg.com/@metamask/providers/-/providers-9.1.0.tgz#ccbbfd698eeb777c5c45aee91c3ad97e20eab20b"
integrity sha512-ZMfdIZ8PzaK1m0NblQOPTuDaMuTStSxrUYJiDNRi+UDqVd84WItQVXe3jy0k7TzhpjkbzgXrTK7rUcoQRhkwtw==
dependencies:
"@metamask/object-multiplex" "^1.1.0"
"@metamask/safe-event-emitter" "^2.0.0"
"@types/chrome" "^0.0.136"
detect-browser "^5.2.0"
eth-rpc-errors "^4.0.2"
extension-port-stream "^2.0.1"
fast-deep-equal "^2.0.1"
is-stream "^2.0.0"
json-rpc-engine "^6.1.0"
json-rpc-middleware-stream "^3.0.0"
pump "^3.0.0"
webextension-polyfill-ts "^0.25.0"
"@metamask/rpc-methods@^0.23.0":
version "0.23.0"
resolved "https://registry.yarnpkg.com/@metamask/rpc-methods/-/rpc-methods-0.23.0.tgz#51e1ebb91891d7227d346b229a6f112b67984c8e"
integrity sha512-jUsdkyOgOv3e7HMuLK/HNLVw431gguNAQf1vYRihV4+OdUZjV0sqVYliCkYuC5F4GPSlqnUK4JEDRI8e8rivsw==
"@metamask/rpc-methods@^0.24.1":
version "0.24.1"
resolved "https://registry.yarnpkg.com/@metamask/rpc-methods/-/rpc-methods-0.24.1.tgz#77bb9d3c0960a53b04aeec5e97967a7581a341f7"
integrity sha512-mUwN5Ya1F51p/yq81MAqUwR1D3R8CU1cLw3sKypfH0gVtwHNxXogp6Jeyv1VI/46Hrh4i9yXDztsRMOr+AjZEw==
dependencies:
"@metamask/controllers" "^32.0.2"
"@metamask/key-tree" "^6.0.0"
"@metamask/snap-utils" "^0.23.0"
"@metamask/snaps-utils" "^0.24.1"
"@metamask/types" "^1.1.0"
"@metamask/utils" "^3.3.0"
"@metamask/utils" "^3.3.1"
"@noble/hashes" "^1.1.3"
eth-rpc-errors "^4.0.2"
nanoid "^3.1.31"
superstruct "^0.16.7"
@ -3157,20 +3123,20 @@
isomorphic-fetch "^3.0.0"
lodash "^4.17.21"
"@metamask/snap-controllers@^0.23.0":
version "0.23.0"
resolved "https://registry.yarnpkg.com/@metamask/snap-controllers/-/snap-controllers-0.23.0.tgz#edcf3ec723c94899ec5b31ec54c6ed94be0b8551"
integrity sha512-TqPmlVDdbUu0gsYtoSHXxKQihXxhcRhPde7TnvrauouA13DAi1c/kiOSpCY8S14mMaLVSoc3WBm1t8YziG/cig==
"@metamask/snaps-controllers@^0.24.1":
version "0.24.1"
resolved "https://registry.yarnpkg.com/@metamask/snaps-controllers/-/snaps-controllers-0.24.1.tgz#602542b8b35e8faefcea4393589a82a5d3d8dfd8"
integrity sha512-RI9uZJipGHyh/+9joZVV6OC1bMI4h1XSfSJeJtNl121i0CZIsAIZQHWDfPToPfwKV2vVkpd3AEPrWIaHZ94hHg==
dependencies:
"@metamask/browser-passworder" "^3.0.0"
"@metamask/controllers" "^32.0.2"
"@metamask/execution-environments" "^0.23.0"
"@metamask/object-multiplex" "^1.1.0"
"@metamask/post-message-stream" "^6.0.0"
"@metamask/rpc-methods" "^0.23.0"
"@metamask/snap-types" "^0.23.0"
"@metamask/snap-utils" "^0.23.0"
"@metamask/utils" "^3.3.0"
"@metamask/rpc-methods" "^0.24.1"
"@metamask/snaps-execution-environments" "^0.24.1"
"@metamask/snaps-types" "^0.24.1"
"@metamask/snaps-utils" "^0.24.1"
"@metamask/utils" "^3.3.1"
"@xstate/fsm" "^2.0.0"
concat-stream "^2.0.0"
cron-parser "^4.5.0"
@ -3178,30 +3144,48 @@
gunzip-maybe "^1.4.2"
immer "^9.0.6"
json-rpc-engine "^6.1.0"
json-rpc-middleware-stream "^3.0.0"
json-rpc-middleware-stream "^4.2.0"
nanoid "^3.1.31"
pump "^3.0.0"
readable-web-to-node-stream "^3.0.2"
tar-stream "^2.2.0"
"@metamask/snap-types@^0.23.0":
version "0.23.0"
resolved "https://registry.yarnpkg.com/@metamask/snap-types/-/snap-types-0.23.0.tgz#bcd491a100b2410cb91bbecc59007a278fa508d5"
integrity sha512-l5QK9XKw5aGEn8ohofyopTQndtlrVzYjXyZik3RhxZccRcGA4rp7juvTuIoyBE/0fiqTc30BHCmKtVvkaTyd9Q==
"@metamask/snaps-execution-environments@^0.24.1":
version "0.24.1"
resolved "https://registry.yarnpkg.com/@metamask/snaps-execution-environments/-/snaps-execution-environments-0.24.1.tgz#fd2765b0ca24670c245896330a85e2c1b57b2997"
integrity sha512-pMsKM3htIXmdeRKkXrl4ktiRrXojo3oxCqv3GhIhY0Tbm+nuJM4x105utLEi62LFeuAFvIVFB8uU1dnjtl6bhg==
dependencies:
"@metamask/providers" "^9.0.0"
"@metamask/snap-utils" "^0.23.0"
"@metamask/object-multiplex" "^1.2.0"
"@metamask/post-message-stream" "^6.0.0"
"@metamask/providers" "^10.2.0"
"@metamask/snaps-types" "^0.24.1"
"@metamask/snaps-utils" "^0.24.1"
"@metamask/utils" "^3.3.1"
eth-rpc-errors "^4.0.3"
json-rpc-engine "^6.1.0"
pump "^3.0.0"
ses "^0.17.0"
stream-browserify "^3.0.0"
superstruct "^0.16.7"
"@metamask/snaps-types@^0.24.1":
version "0.24.1"
resolved "https://registry.yarnpkg.com/@metamask/snaps-types/-/snaps-types-0.24.1.tgz#f315321f954611a7bdb514cf786a9c008897a3b6"
integrity sha512-Kt6pacC+nEISJm2BSa9Gu9HvYApIk03THCl6pmG8/HQr5g6r+VXRtQ56nQw7pHAiyV6eKlSITl/rFY+dYuJg6Q==
dependencies:
"@metamask/providers" "^10.2.0"
"@metamask/snaps-utils" "^0.24.1"
"@metamask/types" "^1.1.0"
"@metamask/snap-utils@^0.23.0":
version "0.23.0"
resolved "https://registry.yarnpkg.com/@metamask/snap-utils/-/snap-utils-0.23.0.tgz#9a116a2361910ade229749e1f65f8312567faa01"
integrity sha512-S0/D+OZ70tvpyMIBIJJzZp/0X1SPVfofbGU3wQCG0OX7TWMpLsnQnBZfRyK7Jw+ZC+j7fyYMUyXEpvimYfHQBA==
"@metamask/snaps-utils@^0.24.1":
version "0.24.1"
resolved "https://registry.yarnpkg.com/@metamask/snaps-utils/-/snaps-utils-0.24.1.tgz#b95678828a739a5cf0c4e25c0843094931d3a0c7"
integrity sha512-W0wtDcvZd/y6MGyPWKnOBQ4ORpUTSCy8cwuxS0NsMuV1FhLgl9RlTmNWUlUS+eEGkUiQxdX8l+W34Cfe4ZZnuA==
dependencies:
"@babel/core" "^7.18.6"
"@babel/types" "^7.18.7"
"@metamask/snap-types" "^0.23.0"
"@metamask/utils" "^3.3.0"
"@metamask/snaps-types" "^0.24.1"
"@metamask/utils" "^3.3.1"
"@noble/hashes" "^1.1.3"
"@scure/base" "^1.1.1"
cron-parser "^4.5.0"
@ -3229,10 +3213,10 @@
dependencies:
fast-deep-equal "^3.1.3"
"@metamask/utils@^3.0.1", "@metamask/utils@^3.0.3", "@metamask/utils@^3.3.0":
version "3.3.0"
resolved "https://registry.yarnpkg.com/@metamask/utils/-/utils-3.3.0.tgz#e5e7885c72a30f50f9e2b29690f543da1d6ab496"
integrity sha512-GT8jMTCiGl3z9L1lvALjgW/6urJsl5Cwnix4C65NzJInF0cK2GxqpLkEMQJ50Mdky2qc2P7+F5++d4utvx2TtA==
"@metamask/utils@^3.0.1", "@metamask/utils@^3.0.3", "@metamask/utils@^3.3.0", "@metamask/utils@^3.3.1":
version "3.3.1"
resolved "https://registry.yarnpkg.com/@metamask/utils/-/utils-3.3.1.tgz#04a00a24469e3eb03bde111432053c05afb45326"
integrity sha512-r65Swl91wQ2YDkEQXZah1l7it0iBJK+trTeX9uPHplLQ0lzWZ/yODbEMFZVrStRQxDU8RARXryDyfUX5CLVvLA==
dependencies:
"@types/debug" "^4.1.7"
debug "^4.3.4"
@ -15881,14 +15865,6 @@ json-rpc-middleware-stream@^2.1.1:
readable-stream "^2.3.3"
safe-event-emitter "^1.0.1"
json-rpc-middleware-stream@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/json-rpc-middleware-stream/-/json-rpc-middleware-stream-3.0.0.tgz#8540331d884f36b9e0ad31054cc68ac6b5a89b52"
integrity sha512-JmZmlehE0xF3swwORpLHny/GvW3MZxCsb2uFNBrn8TOqMqivzCfz232NSDLLOtIQlrPlgyEjiYpyzyOPFOzClw==
dependencies:
"@metamask/safe-event-emitter" "^2.0.0"
readable-stream "^2.3.3"
json-rpc-middleware-stream@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/json-rpc-middleware-stream/-/json-rpc-middleware-stream-4.2.0.tgz#a235814e031a2f85cc14b213aa7d42b75527104b"

Loading…
Cancel
Save