call deactivate on a plugin if exposed as a method

pull/5370/head
bunsenstraat 2 years ago
parent 32374a3c54
commit e12774ea09
  1. 14
      apps/remix-ide/src/remixAppManager.js
  2. 7
      apps/walletconnect/src/services/RemixClient.ts

@ -71,11 +71,19 @@ export class RemixAppManager extends PluginManager {
}
async deactivatePlugin(name) {
const profile = await this.getProfile(name)
const [to, from] = [
await this.getProfile(name),
profile,
await this.getProfile(this.requestFrom)
]
if (this.canDeactivatePlugin(from, to)) {
if (profile.methods.includes('deactivate')) {
try {
await this.call(name, 'deactivate')
} catch (e) {
console.log(e)
}
}
await this.toggleActive(name)
}
}
@ -171,7 +179,9 @@ export class RemixAppManager extends PluginManager {
return plugins.map(plugin => {
if (plugin.name === testPluginName) plugin.url = testPluginUrl
return new IframePlugin(plugin)
let iframePlugin = new IframePlugin(plugin)
console.log('registering plugin', iframePlugin.disconnect)
return iframePlugin
})
}

@ -15,7 +15,7 @@ export class RemixClient extends PluginClient {
super()
createClient(this)
this.internalEvents = new EventManager()
this.methods = ["sendAsync", "init"]
this.methods = ["sendAsync", "init", "deactivate"]
this.onload()
}
@ -30,6 +30,11 @@ export class RemixClient extends PluginClient {
console.log('initializing walletconnect plugin...')
}
async deactivate(){
console.log('deactivating walletconnect plugin...')
return true
}
async initClient () {
try {
this.chains = [arbitrum, arbitrumGoerli, mainnet, polygon, polygonMumbai, optimism, optimismGoerli, goerli, sepolia]

Loading…
Cancel
Save