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 `require` parameter for wallet_installPlugins #140

Closed rekmarks closed 2 years ago

rekmarks commented 4 years ago

We should add a require parameter for wallet_installPlugins so that domains can request that a specific version of a plugin is installed. The user must install (or already have) a version of the plugin compatible with the semver string value of the require key in the request object. This probably requires proper plugin version management before we can meaningfully implement it.

Similarly, a require:boolean parameter should also be added to rpc-cap for permissions requests: https://github.com/MetaMask/rpc-cap/issues/70

Examples:

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

// wallet_enable
await ethereum.send('wallet_enable', [{
  'wallet_plugin': {
    'http://localhost:8082/package.json': {
      require: '^1.1.0',
    },
  },
  'eth_accounts': {}
}])
rekmarks commented 2 years ago

Tracked elsewhere.