MetaMask / metamask-snaps-beta

Fork of MetaMask that supports plugins! Read the Wiki!
https://github.com/MetaMask/metamask-snaps-beta/wiki
MIT License
144 stars 57 forks source link

Add `force` parameter for wallet_installPlugins #132

Closed rekmarks closed 4 years ago

rekmarks commented 4 years ago

The only reason for the force parameter to exist was for devX. It's so easy to clear plugin state that there isn't actually a need for this. What we actually need is #140. Closing.

Original Comment

We should definitely not force plugin reinstallation by default in production, and it's probably time to stop doing it in beta. The only argument to keep it would be for devX, but clearing plugin state is so easy that the benefits are dubious at best.

We should add a force parameter to wallet_installPlugins and wallet_enable requests if installation is to be forced. For production/later beta, we can add a user confirmation flow for forced installations.

Examples:

// install only
await ethereum.send('wallet_installPlugins', [{
  'http://localhost:8082/package.json': {
    force: true,
  },
}])

// wallet_enable
await ethereum.send('wallet_enable', [{
  'wallet_plugin': {
    'http://localhost:8082/package.json': {
      force: true,
    },
  },
  'eth_accounts': {}
}])