Merge pull request #3710 from ethereum/deactivatewallet

call deactivate on a plugin if exposed as a method
pull/3716/head
David Disu 2 years ago committed by GitHub
commit bd72b70da9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      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)
}
}

@ -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