diff --git a/apps/remix-ide/src/remixAppManager.js b/apps/remix-ide/src/remixAppManager.js index 97aefe4d2c..66f2b92bc3 100644 --- a/apps/remix-ide/src/remixAppManager.js +++ b/apps/remix-ide/src/remixAppManager.js @@ -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) } } diff --git a/apps/walletconnect/src/services/RemixClient.ts b/apps/walletconnect/src/services/RemixClient.ts index 0edd7dc691..9e88d5e6c2 100644 --- a/apps/walletconnect/src/services/RemixClient.ts +++ b/apps/walletconnect/src/services/RemixClient.ts @@ -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]