diff --git a/apps/remix-ide/src/app/files/foundry-handle.js b/apps/remix-ide/src/app/files/foundry-handle.js index cf20f03e79..94efd7b04b 100644 --- a/apps/remix-ide/src/app/files/foundry-handle.js +++ b/apps/remix-ide/src/app/files/foundry-handle.js @@ -15,4 +15,12 @@ export class FoundryHandle extends WebsocketPlugin { constructor () { super(profile) } + + callPluginMethod(key, payload = []) { + if (this.socket.readyState !== this.socket.OPEN) { + console.log(`${this.profile.name} connection is not opened.`) + return false + } + return super.callPluginMethod(key, payload) + } } diff --git a/apps/remix-ide/src/app/files/git-handle.js b/apps/remix-ide/src/app/files/git-handle.js index a935068679..596bf77015 100644 --- a/apps/remix-ide/src/app/files/git-handle.js +++ b/apps/remix-ide/src/app/files/git-handle.js @@ -15,4 +15,12 @@ export class GitHandle extends WebsocketPlugin { constructor () { super(profile) } + + callPluginMethod(key, payload = []) { + if (this.socket.readyState !== this.socket.OPEN) { + console.log(`${this.profile.name} connection is not opened.`) + return false + } + return super.callPluginMethod(key, payload) + } } diff --git a/apps/remix-ide/src/app/files/hardhat-handle.js b/apps/remix-ide/src/app/files/hardhat-handle.js index 7b64f489dc..84a2c1d28a 100644 --- a/apps/remix-ide/src/app/files/hardhat-handle.js +++ b/apps/remix-ide/src/app/files/hardhat-handle.js @@ -15,4 +15,12 @@ export class HardhatHandle extends WebsocketPlugin { constructor () { super(profile) } + + callPluginMethod(key, payload = []) { + if (this.socket.readyState !== this.socket.OPEN) { + console.log(`${this.profile.name} connection is not opened.`) + return false + } + return super.callPluginMethod(key, payload) + } } diff --git a/apps/remix-ide/src/app/files/slither-handle.js b/apps/remix-ide/src/app/files/slither-handle.js index 9604202d7e..27c7b3cbd8 100644 --- a/apps/remix-ide/src/app/files/slither-handle.js +++ b/apps/remix-ide/src/app/files/slither-handle.js @@ -16,4 +16,12 @@ export class SlitherHandle extends WebsocketPlugin { constructor () { super(profile) } + + callPluginMethod(key, payload = []) { + if (this.socket.readyState !== this.socket.OPEN) { + console.log(`${this.profile.name} connection is not opened.`) + return false + } + return super.callPluginMethod(key, payload) + } } diff --git a/apps/remix-ide/src/app/files/truffle-handle.js b/apps/remix-ide/src/app/files/truffle-handle.js index bdeed78592..1111cba60d 100644 --- a/apps/remix-ide/src/app/files/truffle-handle.js +++ b/apps/remix-ide/src/app/files/truffle-handle.js @@ -15,4 +15,13 @@ export class TruffleHandle extends WebsocketPlugin { constructor () { super(profile) } + + callPluginMethod(key, payload = []) { + if (this.socket.readyState !== this.socket.OPEN) { + console.log(`${this.profile.name} connection is not opened.`) + return false + } + return super.callPluginMethod(key, payload) + } + } diff --git a/apps/remix-ide/src/app/plugins/remixd-handle.tsx b/apps/remix-ide/src/app/plugins/remixd-handle.tsx index 56855d4caf..35353d774d 100644 --- a/apps/remix-ide/src/app/plugins/remixd-handle.tsx +++ b/apps/remix-ide/src/app/plugins/remixd-handle.tsx @@ -71,6 +71,14 @@ export class RemixdHandle extends WebsocketPlugin { } + async callPluginMethod(key: string, payload?: any[]) { + if (this.socket.readyState !== this.socket.OPEN) { + console.log(`${this.profile.name} connection is not opened.`) + return false + } + return super.callPluginMethod(key, payload) + } + /** * connect to localhost if no connection and render the explorer * disconnect from localhost if connected and remove the explorer